Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Capturing Equilibrium/Balance

Capturing Equilibrium/Balance

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Natasi   (79 posts)  Bio
Date Mon 02 May 2005 02:37 PM (UTC)
Message
I'm trying to capture if I have equilibrium and/or balance and have it kept track of in variables, so I can set certain actions to go off if I currently have both balance and equilibrium. The prompt looks like this:

3088h, 5056m, 3334e, 10p exk-

Now, I need something that works like this, but working,

Trigger:
^(.*?)h\, (.*?)m\, (.*?)e\, (.*?)p (.*?)\-$

Send:
if (%5 = e) then
world.setvariable "equilibrium", "1"
if (%5 = x) then
world.setvariable "balance", "1"
else
world.setvariable "equilibrium", "0"
world.setvariable "balance", "0"
end if
end if
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Mon 02 May 2005 03:22 PM (UTC)
Message
Is it 'not working' because it doesn't match? or does the script not fire at all? or does it just never step into any of the logic?

Assuming the last, it is because your wildcard (%5) can't simply equal 'e' AND 'x'. Even if it does equal just 'e' sometimes.
That wildcard has something in it like (from your example) "exk" so you'll need to use a function (something like InStr, something that ultimately checks for existance) and then check against the returned value.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Natasi   (79 posts)  Bio
Date Reply #2 on Mon 02 May 2005 04:26 PM (UTC)
Message
Ok, I tried this to see what was happening:

if (%5 = e) then
world.note "you have eq"
if (%5 = x) then
world.note "you have balance"
else
world.note "you have nothing"
end if
end if


and even off balance or off eq (no e or x)I would still see the
"you have eq"
"you have balance"
notes.

how would I wrtie the IntStr for this...never emssed with those scripts yet
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #3 on Mon 02 May 2005 04:43 PM (UTC)
Message


if instr("%5", "e") then
   world.setvariable "equilibrium", "1"
else
   world.setvariable "equilibrium", "0"
end if
if instr("%5", "x") then
   world.setvariable "balance", "1"
else
   world.setvariable "balance", "0"
end if


I don't even know how your script is working at all, as it is. It's probably just making up global variables as it goes, seeing that you don't have the strings you are testing quoted.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,997 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.