[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Capturing Equilibrium/Balance
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Capturing Equilibrium/Balance

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


Posted by Natasi   (79 posts)  [Biography] 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
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Natasi   (79 posts)  [Biography] 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
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] 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.
[Go to top] 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.


4,955 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]