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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
morphius501
Newbie


Joined: 04 Jan 2015
Posts: 2
Location: portland, or

PostPosted: Wed Jan 07, 2015 11:48 am   

trigger help with multiple variables
 
I hope i titled my question right, so here's my issue. I'm playing on a very old bbs game and i'm having issues with a trigger output. The mud only supports single names for commands. I can have a character with multiple names however. So I can be Dave Jones. Or Dave Jones, the Elder Druid. Etc. I want to create some triggers and aliases and i'm having trouble nailing it down.

What I need to do is make a group auto join trigger basically i say 'join steve" and steve will 'add dave jones" however the game doesn't recognize dave jones. only dave.

The exact output of the mud is: "Dave Jones is asking to join your group." I can write a trigger %1 is asking to join and then add %1 and it's worked so far with characters having only one name and so I never really noticed anything. Well now I have a character that's got more than one name and so I need to strip out anything after the first name and before "is asking to join" and output just 'add name'

I'm also having the same issue with some buff triggers so like...someone with multiple names asks me for a stat boost i want my char to be able to 'c spell char ' but have to strip down to just their first name.

Hope I gave enough info. I know it's probably something really simple. But I'm just scratching my head here. Thank you for any help anyone might provide.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4774
Location: Pensacola, FL, USA

PostPosted: Wed Jan 07, 2015 5:45 pm   
 
first of, you should not be using %1 in the pattern, that is bad practice, use proper wildcards.
%1 is technically a temporary variable that only has value when you surround a portion of your pattern in parenthesis

you can use the word function to return the nth word in a string

#TR {(*) is asking to join the group.} {add %word(%1, 1)}
_________________
Discord: Shalimarwildcat
Reply with quote
morphius501
Newbie


Joined: 04 Jan 2015
Posts: 2
Location: portland, or

PostPosted: Thu Jan 08, 2015 4:09 pm   
 
That works spot on. Thank you so much and thank you for pointing out my bad coding. I'm still learning this and I know everything is really sloppy, but I'm learning as I go.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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