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


Joined: 30 Oct 2004
Posts: 127

PostPosted: Thu Jan 13, 2005 6:19 pm   

Question about getting info from variables
 
I am in the middle of making a reaction text for Aetolia and I've hit a snag.
One the end of the health line there is a indicator of equilibrium and balance, plus a few others.
The line looks like this for who don't know

H:3028 M:3100 E:16310 W:15200 [csdb eb]

Now, the part I'm having touble with is this. I assign the "csdb eb" to a variable, but all I'm interested in is the "eb" on the end. Also are to many variations to make if statements with.... here's a few too give you an idea

H:3028 M:3100 E:16310 W:15200 [c eb]
H:3028 M:3100 E:16310 W:15200 [eb]
H:3028 M:3100 E:16310 W:15200 [e-]
H:3028 M:3100 E:16310 W:15200 [cs eb]
H:3028 M:3100 E:16310 W:15200 [db eb]
H:3028 M:3100 E:16310 W:15200 [pdb eb]
H:3028 M:3100 E:16310 W:15200 [cspdb eb]

So as you can see, writing If statements for all this can get a little....uh hard on the system. I'd like a way to get the system to either bring in only the last section [eb] or at least be able to make an if statement that's something like this.

If (@bal = "* eb") {#var equilibrium 1} and so on. But mind you the asterix in this statement does not act like a wildcard and I can't find anything in the site about how to do this.

Thanks for your help ahead of time
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Thu Jan 13, 2005 8:03 pm   
 
Well, judging on the lack of responses, I'll include a little more of what I think I need.

In other programming languages, you are able to take a store string variable and take pieces out of it. Now, I'm not sure if Zmud's language is capable of this, but I'd appreciate any help one way or the other so I don't keep wasting my time.

Thanks again Cool
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Thu Jan 13, 2005 8:13 pm   
 
I think another guy has made this kind of script and you could search for it. just search for that equilibrium thing.. I posted on his problem with a missing bracket. Seems like you two play the same MUD.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 13, 2005 8:46 pm   
 
#TR {H:(%d) M:(%d) E:(%d) W:(%d) ~[(*)~] } {#IF %ends( %5, eb) {#VAR equilibrium 1} {#VAR equilibrium 0}} {} {prompt}
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Thu Jan 13, 2005 10:13 pm   Accessing different info in Variables
 
I wish to thank those who answered my first question. That somewhat worked for me.
I actually have the trigger that responds to the trigger....actually, here. Posted.

H:(%d) M:(%d) E:(%d) W:(%d) ~[&bal~]
#var Healthbal %1
#var manabal %2
#var endurance %3
#var willpower %4
#if (@vialbal = 1 and @healthbal < 3000) {
drinkhealth
#var vialbal 0
#if (@fulldef = 1 and @mossbal = 1) {
eatmoss
#var mossbal 0
}
}
#if (@vialbal = 1 and @manabal < 3000) {
drinkmana
#var vialbal 0
#if (@fulldef = 1 and @mossbal = 1) {
eatmoss
#var mossbal 0
}
}
#if (@fulldef = 1) {
Checkall
PHC
}

Then I have an alias called checkall seen above that checks the balance and equilibrium and assigns it if needed.

Checkall is this
#if %ifends( @bal, eb) {
#var equilibrium 1
#echo blah
}

Hope that helps somewhat....the echo was to test that the if statement worked. It echoed ok, but I did another one to look for an ending of e- and it echoed that too.....I'm not sure what's going on at the moment

Thanks Again
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 13, 2005 10:54 pm   
 
%if is a defined function. %ends is a defined function. %ifends is not defined and will not produce useful results.

An alias isn't necessary and neither is a second variable. Just incorporate the statement from my trigger in yours.

Pattern:
H:(%d) M:(%d) E:(%d) W:(%d) ~[(*)~]

Value:
#var Healthbal %1
#var manabal %2
#var endurance %3
#var willpower %4
#if (@vialbal = 1 and @healthbal < 3000) {
drinkhealth
#var vialbal 0
#if (@fulldef = 1 and @mossbal = 1) {
eatmoss
#var mossbal 0
}
}
#if (@vialbal = 1 and @manabal < 3000) {
drinkmana
#var vialbal 0
#if (@fulldef = 1 and @mossbal = 1) {
eatmoss
#var mossbal 0
}
}
#if (@fulldef = 1) {
#IF %ends( %5, eb) {#VAR equilibrium 1} {#VAR equilibrium 0}
PHC
}

ADDED:
If you are using @bal elsewhere, such as the PHC alias, just leave the &bal in your trigger pattern. It will still be %5 whether you use &bal or (*).
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
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