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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Writing an IF routine (?) to do a certain action once a requirement is met

Writing an IF routine (?) to do a certain action once a requirement is met

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 Fri 12 Nov 2004 06:36 PM (UTC)
Message
When using a skill to peer at someones mana I would like the cleint to see when they are under half mana and if so perform a certain action. I figured this would have to be written through an IF routine, but unsure as to do the this with %1 = type stuff.

This is how it looks when I contemplate someone:

Midget's mana stands at 3142/3142.

I want it set so that if say it read:

Midget's mana stands at 1245/3142.

then it would send a command to slap Midget...it has to be set also so I can use it against others, so the mana total will never be the same. Thanks for any help guys
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Sat 13 Nov 2004 12:28 AM (UTC)
Message

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   match="@target's mana stands at */*."
   send_to="12"
   sequence="100"
  >
  <send>if (%1*2 &lt;= %2) then
send &quot;slap @target&quot;
end if</send>
  </trigger>
</triggers>

<variables>
  <variable name="target">midget</variable>
</variables>


Copy between <triggers> and </triggers> and then paste in the trigger window, and do the same with <variables>.

You set the variable 'target' with whatever the name of the thing was (midget in this case) WITHOUT the apostrophe.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #2 on Sat 13 Nov 2004 12:34 AM (UTC)
Message
You can use this alias to set that other variable as well.


<aliases>
  <alias
   match="target *"
   enabled="y"
   echo_alias="y"
   variable="target"
   send_to="9"
   ignore_case="y"
   sequence="100"
  >
  <send>%1</send>
  </alias>
</aliases>


Obviously, you can alter the match text to suit your needs, as well as changing the variable name (you'll have to do it to the trigger, and the alias, TWO locations in the trigger, and then one in the alias's "variable" field.
The trigger is in the match text, as well as the send field.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Natasi   (79 posts)  [Biography] bio
Date Reply #3 on Sat 13 Nov 2004 01:50 AM (UTC)
Message
works perfectly! Thanks for the help
[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.


11,704 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 HostDash]