Quote:
In the Trigger: field I typed Hello, which is what I want it to match on. I didn't tough the Match: or on or any of the checkboxes next to that. In send, I wrote say hi. I checked the enabled, and ignore case, and labeled it 'triggerthatdoesnotwork' should this be working?
I presume you actually typed 'say hello', otherwise it doesn't have much chance. :)
Triggers match rather literally, so you have a couple of choices here. A simple one is to make a regular expression, which matches anywhere on the line, eg.
Match: hello
Regular expression: checked
Ignore case: checked
Change colour to: whatever
That should colour the word "hello" if it sees it anywhere on a line.
Another approach is to get the *exact* text the trigger should match on, replacing any unknowns with asterisks, eg.
Say if the MUD does this:
say hello
You say in human 'hello'
Then you need to match like this:
Match: You say in human 'hello'
Ignore case: checked
Change colour to: whatever
Or, if someone else is going to say it ...
Match: * says, 'hello'
Ignore case: checked
Change colour to: whatever
Quote:
I need something that will count the number of 'ship's rats' in the room.
You could do this by counting them in a script, like this:
Match: *You also see*
Label: count_rats
Script: count_rats
Then put this in the script file.
Sub count_rats (TriggerName, TriggerLine, arrWildcard)
dim count, start, col
start = 1 ' start at column 1
count = 0 ' no rats found yet
do
col = Instr (start, TriggerLine, "a ship's rat")
if col = 0 then
exit do
end if
count = count + 1 ' count those rats
start = col + 1 ' look for another
loop
world.setstatus count & " rats found"
end sub
This will show the number of rats on the status line.
Quote:
Also, is there a pause command or anything like it for MUSHclient? Say a script performs an action that swings a sword and my 'roundtime' is six seconds. Is there any way that the script will wait six seconds or do I need to do something like this..
You cannot pause in a script, because that would hold up the entire client. However you can introduce a timed delay, like this:
world.send "prepare myspell"
world.doafter 6, "cast myspell"
The "doafter" function does whatever you tell it, after the number of seconds you specify.
Quote:
Now my last question... for now anyways... If I type 'health' in a script, and the world responds with this -
Your body feels slightly battered.
I would make a trigger like this:
Match: Your body feels *
Send: %0
Send to: variable (label is name)
Label: health
The special sequence "%0" is the entire matching line, and matching on "Your body feels *" should hopefully match on the correct sort of line. The rest of the trigger copies the line into the variable "health".
Quote:
I have another question, can a script create a trigger? Or enable it?
Yes, see "world.addtrigger" and "world.EnableTrigger". Search this forum for examples. |