Ok so I am quite new to scripting and triggering and all that, but I am already stuck.
I made an alias varset which executes the lua code : var1 = 1
This works fine, but when I try to make a trigger to go off when var1 == 1, I have some trouble, as the trigger does not activate.
The full trigger is:
name: variablechange
0: if var1 == 1 then return true else return false end
in the script area:
var1 = 0
echo ("wewt it worked")
What am I doing wrong?
help with triggering on a lua function
Re: help with triggering on a lua function
Triggers are only processed when a new line has arrived from the MUD.
Re: help with triggering on a lua function
ok I see. Is there some way using the scripting panel that I could force triggers to fire if ready to fire?
Re: help with triggering on a lua function
you could always set the pattern in your trigger to 'return isPrompt()' the drop down would be lua function
the trigger script would be:
the trigger script would be:
while the alias script would be:
"this trigger" would be changed to be the name of the trigger
Re: help with triggering on a lua function
In response to Manni's post: There's no real reason for doing that stuff. Why fire off prompt when you want to only fire when a certain variable is set? The trigger in the OP is the best way of doing this, except it will only fire when a line is received (but so will a prompt trigger).
And if you don't want to wait for a line to be received, you can't use triggers. Triggers are really only meant to fire on new input from the mud. If you want something to react to what you type, you use aliases. So use your alias directly to call a function/raise an event.
And if you don't want to wait for a line to be received, you can't use triggers. Triggers are really only meant to fire on new input from the mud. If you want something to react to what you type, you use aliases. So use your alias directly to call a function/raise an event.
Re: help with triggering on a lua function
I'm only firing off prompt to give an example of what a trigger can do, and thats a guaranteed line (plus it was the first thing that came to mind because I closing a gate trigger when I wrote the response at 3 in the morning).
a more practical example would be get gold when a creature drops it, or something that counts your kills for you.
to count kills you would have an trigger and a script.
Script:
you trigger would look for a "beginning of substring" that would look like: You have slain
and the script would be:
a more practical example would be get gold when a creature drops it, or something that counts your kills for you.
to count kills you would have an trigger and a script.
Script:
everytime you bootup mudlet mykills will = 0 by default
you trigger would look for a "beginning of substring" that would look like: You have slain
and the script would be: