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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ using pills trigger
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Senchizinko
USA (11 posts) Bio
|
| Date
| Wed 20 Oct 2010 02:42 AM (UTC) |
| Message
| | ok ive been trying to figure out how to do this but well, im better with examples than with just pure faqs i was wandering if anyone can give me an example of how i can make a trigger that will make me eat a pill to regain health once my hp has fallen below a certain point |
Strength, intelligence, speed, immortality. We are the Trinity Core. | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #1 on Wed 20 Oct 2010 02:49 AM (UTC) Amended on Wed 20 Oct 2010 02:50 AM (UTC) by Twisol
|
| Message
| Example non-regexp trigger to match a prompt like "100h 100m":
Example code to "eat pill" when the health is too low:
if tonumber("%1") < 250 then
Send("eat pill")
end
Make sure the Send To setting on the trigger is set to Script for this to work. (Also, the script language needs to be Lua for this particular example, but if you don't know what I'm talking about you're probably fine.) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Senchizinko
USA (11 posts) Bio
|
| Date
| Reply #2 on Wed 20 Oct 2010 03:07 AM (UTC) Amended on Wed 20 Oct 2010 03:27 AM (UTC) by Senchizinko
|
| Message
| ok well i tried that but well idk what i might have done wrong maybe a little more info will do.. ok here i go my prompt is [%h/%Hhp %c/%Cch %t/%Tst M:%m %Mmp %Xtnl Ryo:%Y/%y %B Exits:%e]
where %h is current hp
also im playing on a mud not a mush dunno if that makes a diff or not but if theres any other info needed feel free to ask and ill try my best ive been playing muds for years but never even messed with triggers only aliases and timers
oh and my pills are in a container so i need it to not only eat the pills but retrieve them from my pack aswell |
Strength, intelligence, speed, immortality. We are the Trinity Core. | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #3 on Wed 20 Oct 2010 03:25 AM (UTC) Amended on Wed 20 Oct 2010 03:26 AM (UTC) by Twisol
|
| Message
|
Senchizinko said: ok well i tried that but well idk what i might have done wrong maybe a little more info will do.. ok here i go my prompt is [%h/%Hhp %c/%Cch %t/%Tst M:%m %Mmp %Xtnl Ryo:%Y/%y %B Exits:%e]
where %h is current hp
[...]
[*/*hp */*ch */*st M:* *mp *tnl Ryo:*/* * Exits:*]
Something like that should match your prompt.
Senchizinko said: also im playing on a mud not a mush dunno if that makes a diff or not
The difference is mostly academic, so probably not. What MUD are you playing though? Some of them treat prompts a little differently.
Senchizinko said: oh and my pills are in a container so i need it to not only eat the pills but retrieve them from my pack aswell
To do that, you can just add a Send("get pills from container") before the Send("eat pill") in my example. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Senchizinko
USA (11 posts) Bio
|
| Date
| Reply #4 on Wed 20 Oct 2010 03:28 AM (UTC) |
| Message
| | Its not very popular its called world of naruto mud |
Strength, intelligence, speed, immortality. We are the Trinity Core. | | Top |
|
| Posted by
| Senchizinko
USA (11 posts) Bio
|
| Date
| Reply #5 on Wed 20 Oct 2010 03:36 AM (UTC) Amended on Wed 20 Oct 2010 04:21 AM (UTC) by Senchizinko
|
| Message
| ok so something happend this time but i got a script error
Error number:0
Event: Run-Time Error
Raised by: World:Naruto
Description:
[string "Trigger: "]:2: attempt to call global 'send' (a nil value)
stack traceback:
[string "Trigger: "]:2: in main chunk
Called by:Immediate execution
heres what i have
trigger [*/*hp */*ch */*st M:* *mp *tnl Ryo:*/* * Exits:*]
send
if tonumber("%1") < 7000 then
send("get herb deid")
send("eat herb")
end
ad i have it sent to script and script lang is lua |
Strength, intelligence, speed, immortality. We are the Trinity Core. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #6 on Wed 20 Oct 2010 04:14 AM (UTC) |
| Message
| |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Senchizinko
USA (11 posts) Bio
|
| Date
| Reply #7 on Wed 20 Oct 2010 04:29 AM (UTC) |
| Message
| | Thank you, i never would have guessed it wasnt working cause it was a s and not a S lol |
Strength, intelligence, speed, immortality. We are the Trinity Core. | | 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.
27,042 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top