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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Keeping track of focus balance

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Keeping track of focus balance
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Rivius   (93 posts)  [Biography] bio
Date Sun 12 Sep 2010 03:47 AM (UTC)  quote  ]
Message
Excellent! Now I don't seem to be wasting mana. I'll test this a little more to see if there's any hiccups, but it looks like that's it. Also, the script seems very simple. So thanks for that!
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 12 Sep 2010 03:23 AM (UTC)  quote  ]

Amended on Sun 12 Sep 2010 03:24 AM (UTC) by Nick Gammon

Message
Something like this would do it:


<triggers>
  <trigger
   enabled="y"
   match="You are paralysed and *"
   send_to="12"
   sequence="110"
  >
  <send>

if not paralyzed then
  Send ("FOCUS BODY") 
  paralyzed = true
end -- if

</send>
  </trigger>

  <trigger
   enabled="y"
   match="Your muscles unlock; you are no longer paralysed."
   send_to="12"
   sequence="110"
  >
  <send>

paralyzed = false

</send>
  </trigger>

</triggers>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


This sets a Lua variable 'paralyzed' (which is assumed to be false when you open the world).

Then when you get the message about being paralysed you only send the message if the variable isn't set already.

I didn't use regular expressions there, your triggers are so simple it is easier to read without using regexps.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Rivius   (93 posts)  [Biography] bio
Date Sun 12 Sep 2010 03:03 AM (UTC)  quote  ]

Amended on Sun 12 Sep 2010 03:06 AM (UTC) by Rivius

Message
In one of the games I play there is a case where you might become paralyzed and need to send the command to the game

FOCUS BODY

Now when you're paralyzed, this is the trigger line.


^You are paralysed and


and I have it set to Send("FOCUS BODY") to the world.


For example lets say I get paralyzed mid-swing and then I attempt to swing again it would say

"You are paralysed and cannot do that".

and the trigger would fire and send "FOCUS BODY".
Focus body takes some time to eventually cure my paralysis.

Now if I inadvertently hit swing again while still focusing body, it will once again trigger off the command FOCUS BODY. This is undesirable because it uses up excess mana and takes longer.


Now, I don't know very much about variables and scripting, but I'm sure it isn't too difficult.

I want something like a variable called "paralyzed" to be initially set to 0 when I start the game. Then when a paralysis message comes up, I want it to set paralysis to 1 and prevent "focus body" from firing again.

this second trigger:

^Your muscles unlock\; you are no longer paralysed\.$

Should set paralyzed to 0, and allow for someone to once again fire off focus body.


In this way, I can be as efficient as possible with my mana. During combat with multiple people in a room, it gets too spammy and I can't always keep track of these things and before I notice I might do an extra swing or two.


Anyway, can you please instruct me on how to go about doing this? I figure this would assist in the coding of similar aspects.
[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.


1,053 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]