More trigger help

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

More trigger help

Post by majgif »

Ok, I have mostly got my triggers sorted out, but having some problems still.

First problem:

I'm trying to make a trigger so that when someone sends me a tell requesting certain spells I cast them on them. The spells are all aliased on the mud to match their respective abbreviations.

The string to trigger off is "(.*) tells you '(div|adiv|full|split|rc|cd|cp|cb)' "

The script I am trying to run is:

Send("wake")
send("" ..matches[3].. " " .. matches[2])
send("sleep")

The error I am getting says "try to call global 'send' (a nil value)" I assume that this is because the second line I am trying to send the variable that has matched.

Other things I have tried are:

send(" " ..matches[3].. " " .. matches[2])
and
send(..matches[3].. " " .. matches[2])

but I still get the same error message.

Any suggestions on how to fix this?

Thanks!

Beliar
Posts: 19
Joined: Fri Apr 22, 2011 12:51 pm

Re: More trigger help

Post by Beliar »

Is the "Send" in the first line capitalized in your code as well? Then thats the problem.

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

Re: More trigger help

Post by majgif »

That's exactly what it was. Thanks!!

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

Re: More trigger help

Post by majgif »

So, onto my next problem... level gear.

I want to make a trigger to wear my levelling gear when i get low tnl.

I have the string right, but no idea how to write a script to change gear when the variable gets below a certain number, say 300.

I have gone through the manual but can't see anything in there that is similar that I can adapt. The closest is the checkHealth script, but I couldn't get that to work, there seems to be a step or 2 I am missing.

Any ideas?

Akimoto
Posts: 30
Joined: Sun May 08, 2011 5:54 pm

Re: More trigger help

Post by Akimoto »

what you want to do is something like this:

if xptnl <= 300 then
send("wear items")

cant really say too much without a general idea as to what your capture method is.

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

Re: More trigger help

Post by majgif »

i know i need to do something like that, just no idea how to make it work.

I'm triggering off my prompt, which is <(.*) (\d+)Tnl (.*)>

I tried:
if matches[3] <= 300 then
send("wear items")
end

but that doesn't work. I get an error saying it's trying to compare a string with a number.

User avatar
Omni
Posts: 131
Joined: Fri Feb 12, 2010 10:26 am

Re: More trigger help

Post by Omni »

majgif wrote:i know i need to do something like that, just no idea how to make it work.

I'm triggering off my prompt, which is <(.*) (\d+)Tnl (.*)>

I tried:
if tonumber(matches[3]) <= 300 then
send("wear items")
end

but that doesn't work. I get an error saying it's trying to compare a string with a number.
if tonumber(matches[3]) <= 300 then
send("wear items")
end

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

Re: More trigger help

Post by majgif »

that works, only problem is it spams me every time my prompt comes up until i level, what i need is something that changes gear and then maybe changes a variable to say that i am already wearing my level gear, then when i level and change back, the variable can change back so next time my tnl gets low it knows to change again.

Either that, or add another line to the trigger so that after i wear the gear it disables itself, then when i level another trigger wears my normal gear again and re-enables the first trigger.... i will check the manual to see if i can find the command to turn triggers on and off....

majgif
Posts: 17
Joined: Tue Apr 19, 2011 4:17 am

Re: More trigger help

Post by majgif »

Ok, worked it out.... that was pretty easy :D

Final trigger problem for now, I want to make a trigger so that I don't get booted for spamming the same command repeatedly. So, basically, I need a trigger that enters some random command if I enter the same command 20 times in a row.

Is this possible?

Akimoto
Posts: 30
Joined: Sun May 08, 2011 5:54 pm

Re: More trigger help

Post by Akimoto »

the way I handle that is a manual override or a pause command what it does is an alias sets pause to true or false

^pause$

if system.paused then
system.paused = false
echo("System Paused")
elseif not system.paused then
system.paused = true
echo("System Unpaused
end

mine is a bit more complex but then you add this in places that would send commands like functions or certain triggers

if system.paused then return 0 end

add that to the top of the chain before any commands

Post Reply