Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
ShadowsPirate
Beginner


Joined: 15 Jun 2007
Posts: 17

PostPosted: Sat Mar 22, 2008 2:59 am   

Group checking and putting in variables.
 
What I want to do is I can check the command gr(group), then have all the names put into a variables(s) so that if something is killed by them, a command is fired, but if it isn't part of the group then nothing.

commands, sample text.

not following or mounted.

Code:
GR
You are unmounted.
You not following anyone.
You are not a member of a group.

following someone, they can have prefixes and/or suffixes.

Code:
GR
You are unmounted.
You are following Joe, Templaric Squire.
The members of your group are:
Name                         Health    Mana
Daniel                      3680/3680 460/460


people following you, usually from 1-15

Code:
GR
You are unmounted.
You not following anyone.
The members of your group are:
Name                         Health    Mana
Joe                      3960/3960 495/495


As well, the first line could say

Code:
You are riding a warhorse


---------
The line to have the command fired upon or not would be something like, with and without prefix.

Code:
A giant has been slain by Joe.


or

Code:
A brigand has been slain by Enchanter Reylt.


Whoever can give any help, I will be most thankful to.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Mar 22, 2008 5:44 am   
 
#oninput {gr} {CurGroup=""}
#cond {(?:You are not following anyone.|You are following (\w+))} {#if (%1) {#additem CurGroup %1};#t+ PartyTrig} {regex}
#cond {The next line after the last line of your party goes here} {#t- PartyTrig}

#trig "PartyTrig" {(%w)%s%d/%d%s%d/%d} {#additem CurGroup %1} "" {disable}

Now you've got a variable, @CurGroup, which is a list of people in your group, and you can stick that in a trigger any time you like. For example:

.+? has been slain by [\w ]*?(@CurGroup)
or
{@CurGroup} picks {his|her} nose.

The former is how you'd use it in a regex (with normal brackets) and the latter in a zScript pattern (with braces {}).
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ShadowsPirate
Beginner


Joined: 15 Jun 2007
Posts: 17

PostPosted: Mon Mar 24, 2008 1:08 am   
 
As I said in my first post, thank you ever so much, Fang, works like a charm.

Edit:I didn't typo when I put it said, "You not following anyone." in the prompt. Horrible english, but it threw me for a loop as to why it didn't work for a bit, then I noticed the "are" in the statement. Heh, just goes to show the little things are sometimes the worst.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net