About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
symposes
Novice


Joined: 26 Apr 2006
Posts: 34

PostPosted: Sat Jul 04, 2009 5:27 pm   

Is this doable?
 
I am wondering if there is something that works on the idea of

IF var string contains "BLAH" react.

i know thats vague, so here is the background.

In this particular mud, my hpbar, the bar that i see every 2 seconds in combat, shows what spells i am concentrating on using.

Ie shield, levitate, etc.

it looks like this

Main: Sh Le

It displays it in the order I turn them on, and I dont always use them all, IE I dont always need to levitate.

the line in question shows me other information, and i have a trigger to capture all this, and have ended up dumping the maintain into a single variable.

So my variable will look like Sh Le as long as both powers are on, the other trick is that if i turn on levitate before shield, the variable is Le Sh...

Now, When i turn on/off powers, I get messages, so i could very easily trigger off of those, But id like to know if i can make the trigger that captures the maintain variable for certain things

Like an %ismember, but im not entirely sure how to convert this to a list, or if that could do what I want. Any ideas would be appreicated. and thank you in advance.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Jul 04, 2009 10:57 pm   
 
The easiest to convert a string variable to a string list is to use the %replace command.

Something like
Code:
#VAR newVar %replace(@OldVar," ","|")


Basically this code will take your old variable and replace all spaces with the stringlist delimiter '|' and place into a new variable. Since it's properly delimited you can now use all the list function like %ismember on it.
_________________
Asati di tempari!
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Jul 05, 2009 6:35 pm   
 
You could also use the %pos function.

Code:
#if (%pos("Le",@main)) {levitation = 1}
#if (%pos("Sh",@main)) {shield = 1}
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