Hi,
Is it possible to repeat the last send command based on a trigger?
Scenario:
Trigger 1 caused SEND("stuff").
Trigger 2 caused a repeat of what Trigger 1 sent.
Repeating last command from trigger.
Re: Repeating last command from trigger.
If your game has a repeat command (IREs have "!" as the command), you could try using that.
Re: Repeating last command from trigger.
You could store things as you send them in a global variable to keep track of the last command you sent (as opposed to the last command sent to the mud, which could be from user input). Then just reference that.
Like this:
Like this:
Then your second trigger can use the value stored in "last_sent".
Re: Repeating last command from trigger.
I can't seem to get it working, can someone help fixed my code?
Trigger type: Perlreg.
Line:
Trigger type: Perlreg.
Line:
Code: Select all
John tells the group, 'Entr (\w+).'
[\code]
Code:
[code]
entrance.name = matches[2]
send("entrance "..entrance.name)
[\code]
Sample mud output:
[code]
John tells the group, 'Entr Lawson.'
[\code]
I should send to mud entrance Lawson
Re: Repeating last command from trigger.
So, let me get this straight, your trigger pattern is this:
John tells the group, 'Entr (\w+)\.'
(Note that I escaped the period to make it actually check for a period in your pattern, instead of any character.)
And your code is this:
John tells the group, 'Entr (\w+)\.'
(Note that I escaped the period to make it actually check for a period in your pattern, instead of any character.)
And your code is this:
But you can't make it work. First, are you getting any output at all? If not, it is likely that your trigger isn't firing. If you are getting output, what are you seeing?
Re: Repeating last command from trigger.
That is correct. Here is the pictures of the Trigger and Debug screen. I don't understand the error I am getting in the Debug.
http://imgur.com/a/SV5Pw
http://imgur.com/a/SV5Pw
Re: Repeating last command from trigger.
Oh. The '.' syntax you are using indicates that "entrance" is a table, and name is an index for that table. But entrance is not being declared as a table, hence the error.try using "entrance_name" instead of "entrance.name", and it will work perfectly. Or you can declare entrance as a table like so:
Re: Repeating last command from trigger.
That work!
Thank you!
Thank you!
Re: Repeating last command from trigger.
wow what a nifty tip! thx, I probably would have never found that otherwiseVadi wrote:If your game has a repeat command (IREs have "!" as the command), you could try using that.