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
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Wed Nov 20, 2002 4:18 am   

Alias question
 
I have a text file containing all of the quests for my MUD, along with the steps to complete the quest. I use an alias to search the file and return the matching quest. Here is the alias:

Name: quest
Value: #if (%1 = _nodef) {
#file 2 script_quests.txt
#forall @quest_alias {#execute %i}
#forall @quest_match {#say %i}
#close 2
} {
#file 2 script_quests.txt
#var quest_match %grep( 2, "%-1"))
#var quest_match %replace( @quest_match, "[%-1] ", "[quest] ")
#loop 3 {#delnitem quest_match %numitems( @quest_match)}
#var quest_alias %grep( 2, "alias-%-1")
#var quest_alias %replace( @quest_alias, "[alias-%-1] ", "")
#forall @quest_alias {#execute %i}
#forall @quest_match {#say %i}
#close 2
}

The problem is that I can't search using a variable.
Ex- #var quest_name {kill this guy}
"quest kill this guy" works just fine, but "quest @quest_name" actually searches for "quest @quest_name" INSTEAD of "quest kill this guy"

I've tried a few functions to fix this, but I've had no luck. I've even tried using a trigger.
Ex- #TRIGGER {^Name: (%*)$} {quest %lower(%1)}

That didn't work either. Any ideas?

Fat Tony
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 20, 2002 5:13 am   
 
Strange, your Trigger would expand %lower(%1) so there wouldn't be any variable for the alias to process.

If you're trying to use a variable at the command line, it normally won't be expanded. You can force expansion with <>.
quest <@quest_name>

LightBulb
Senior Member
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Wed Nov 20, 2002 3:52 pm   
 
In the trigger, if I use 'quest %lower(%1)', it opens, the file and then closes it, without displaying anything (as if it didn't find any quests that matched %1). If I don't use %lower, and just do 'quest %1', it almost works, but to make it work completely, I need everything captured in %1 to be lowercase. I also tried putting %lower(%1) in a variable, and then doing 'quest <@quest_name>', which brings up the LAST quest it matched, not the one I'm currently searching for. Is there something in the quest alias that is keeping it from being able to search for a variable?

Fat Tony
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