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
myrison
Beginner


Joined: 10 Nov 2006
Posts: 22

PostPosted: Mon Oct 29, 2007 7:30 pm   

Variable Expansion in #SUB Trigger
 
Hi all,

I am having trouble with writing a trigger that creates a #SUB command. Within the #SUB command, I want to expand a variable from a varlist that is kept in ZMUD, but all I can get it to do is return the literal results (i.e. @variable instead of the variable value).

Info:

@varlist; list the vars are stored in (included items are text only)
@temp_var; temporary storage of the current variable to create the trigger

Code:
#LOOP (%numitems( @varlist)) {
  #VAR temp_var {%item( @varlist, %i)} {_nodef} {CLASSNAME}
  #trigger {@tempvar} {#SUB {@tempvar TEST TEXT TO SUB}}
  }


The idea is to just run this alias once to create a list of substitute triggers from a huge list of variables I now have in the list. However, I cannot get the @tempvar to expand in either the trigger pattern or the trigger value. I have tried using @{@tmpvar} as well with no success.

What results from the above is this trigger:
Pattern: @tempvar
Value: #SUB {@tempvar TEST TEXT TO SUB}

If I can get the variables to expand in both places before trigger is created I will have what I need.

Help appreciated. Thank you in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Oct 29, 2007 7:43 pm   
 
Why not just use the ability of triggers to make use of the list directly?
#TRIGGER {({@varlist})} {#SUB {%1 TEST TEXT TO SUB}}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
myrison
Beginner


Joined: 10 Nov 2006
Posts: 22

PostPosted: Mon Oct 29, 2007 7:59 pm   
 
Vijilante wrote:
Why not just use the ability of triggers to make use of the list directly?
#TRIGGER {({@varlist})} {#SUB {%1 TEST TEXT TO SUB}}
Obviously a case of a super over-complication of something rather simple. :-) May thanks Vijilante... problem solved, and quite neatly. Very Happy
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