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


Joined: 02 Oct 2003
Posts: 2

PostPosted: Thu Oct 02, 2003 11:19 pm   

Random Input for Trigger?
 
Hi, I am new to these forums but someone said you all were the best people to ask so here it is:

I am trying to create a trigger that saves information from equipment I cast exerntum on. That spell shows all of the item's information. So far I have no trouble except I need to know how to save multiple answers from one line.

Example:

Special Properties: light crazed holy

There are about 30 different possible flags for Special Properties and light, crazed and holy are just three of them. I need the trigger to record the three different flags.. but what if the flags look like:

Special Properties: unholy dark

I was told that this could most likely be solved in a database format and that I could select all of the possible flags beforehand and then the trigger would find them etc. I spent about 6 hours last night reading helpfiles trying to find the syntax for this problem to no avail.

Basically if someone could tell me how the commands should look and perhaps a brief explanation of how it works. I didn't just give up after a few moments of trying by the way.. I have pulled many a fragile hair on this one. Thanks for all the help you can give me.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Oct 03, 2003 12:36 am   
 
There are two simple methods of doing this. The most basic is to make individual triggers for each property. If you do, it's important that the first trigger is the first one made:
#TRigger {Special Properties:} {#VARiable SP ""}
#TR {Special Properties:* light} {#ADDItem SP light}
#TR {Special Properties:* crazed} {#ADDI SP crazed}
Those would be entered at the command line. If you prefer to use the Settings Editor, the first part goes in the Pattern and the second part goes in the Value.
Pattern: Special Properties:* holy
Value: #ADDI SP holy
Because triggers are processed in the order of creation, the first trigger will clear the variable, and then each of the following triggers will add the appropriate item if the equipment has that property.

Another method is to create a stringlist directly by replacing the spaces with |. This reduces it to one trigger and has the significant advantage that you don't need to know all the possible properties in advance. This is probably the better choice.
#TR {Special Properties: (*)} {#VAR SP %replace( "%1", " ", "|")}

Once you've created a stringlist, you can add it to your database variable before making the new record.
#ADDKey DBvar SpecProp {@SP}
Reply with quote
rhcp216
Newbie


Joined: 02 Oct 2003
Posts: 2

PostPosted: Fri Oct 03, 2003 3:18 am   
 
I have been working with your suggestion and it works perfectly. You are all some fine individuals here. Thank you very much for the help!
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