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
Tohya
Newbie


Joined: 24 Sep 2005
Posts: 4

PostPosted: Sun Sep 25, 2005 12:48 am   

Problem with multiple word variables
 
The MUD I'm playing (Discworld) has NPC's with varying length of names, some with words and some with one. I've got a trigger set up to tell me the name of anyone I attack (So I can use it for "special" buttons - "stab @target with random weapon" (My character dual-wield, so it's nicer to launch specials with random weapons, for cosmetic purposes), "health @target", etc), which works fine for NPC's that can be referred to with one-word names ("farmer", say) but when fighting two-word ones ("angry farmer", say) it will only pick up the first word.

My current trigger is:
Code:
targetting %1
#var target %1


And, yes, I can see why this will only pick up the first word, but I've tried changing it:
Code:
targetting %1 %2
#var target %1&" "&%2


But this then only works for two-word-named NPC's!

Ideally, after I get the targetting somethingorother message from the MUD, it would put all of the rest of that line in my target variable, regardless of the amount of words it is.

Anyone know how to do this?
_________________
This ain't an ultimatum, but baby I know where you sleep
Reply with quote
asm
Wanderer


Joined: 19 Jul 2004
Posts: 68

PostPosted: Sun Sep 25, 2005 1:21 am   
 
Um, well, the Discworld engine has a nice in game alias system. Tried that? ;)

And...I think it's something like %-1...Don't really remember...I'll have to check that
_________________
My collections of scripts.
Reply with quote
Tohya
Newbie


Joined: 24 Sep 2005
Posts: 4

PostPosted: Sun Sep 25, 2005 1:55 am   
 
Quote:

Um, well, the Discworld engine has a nice in game alias system. Tried that? ;)


Um, yes, but that doesn't allow me to do what I'm trying to :p
_________________
This ain't an ultimatum, but baby I know where you sleep
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Sun Sep 25, 2005 3:22 am   
 
#VARIABLE target {%1}
As long as you've captured the whole name, multiple words or not, in the first variable, the whole thing should be contained in @target.

So, if you had something like
#TRIGGER {(angry farmer)} {#VARIABLE target {%1}}
then
#SHOW @target
would output
angry farmer
Reply with quote
Tohya
Newbie


Joined: 24 Sep 2005
Posts: 4

PostPosted: Sun Sep 25, 2005 1:30 pm   
 
Ah-ha, fantastic, thanks :)
_________________
This ain't an ultimatum, but baby I know where you sleep
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