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
using pills trigger
Posted by Senchizinko on Wed 20 Oct 2010 02:42 AM — 8 posts, 28,501 views.
Example non-regexp trigger to match a prompt like "100h 100m":
Example code to "eat pill" when the health is too low:
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.)
*h *mExample code to "eat pill" when the health is too low:
if tonumber("%1") < 250 then
Send("eat pill")
endMake 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.)
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
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
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
[...]
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
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
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.
Its not very popular its called world of naruto mud
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
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
Please read the MUSHclient FAQ - point 30.
Thank you, i never would have guessed it wasnt working cause it was a s and not a S lol