Just wondering if it's possible to get two responses from one addtrigger function, and if so, what's the syntax?
Example:World.addtrigger "monster", "* attacks", "need-two-seperate-reponses-here", 1, 14, 0, "", ""
Thanks
Two Seperate responses? As in, two lines?
Just make the send text have multiple lines.
In visual basic this involves using VBCrLf to seperate the lines, in other languages you can just embed a \n into the text.
The send argument becomes:
"Stuff" & VBCrLf & "MoreStuff"
Thanks, that works well.
One last thing, can I delete a trigger from addtrigger?
If I use:
world.addtrigger "trigger1", "*something*", world.deletetrigger ("trigger2"), 1, 14, 0, "", ""
it seems to work, but for some reason I get an output of 0 aswell as it deleting trigger2, am I doing something wrong?
Do you need to delete the trigger from the other trigger (have the second trigger delete the first one upon firing?)?
Or you just need to add a trigger, and then delete another one?
Im going to assume you're trying to add a trigger that deletes another trigger.
In that case, you need to make sure to put WHATEVER you want 'sent' in a string (since thats what the function is expecting).
What you're doing there, is either deleting it (when you add it) and then the response (0 for success) becomes your 'send' text.
What you WANT (provided that the trigger gets deleted with this trigger) is this:
world.addtrigger "trigger1", "*something","deletetrigger(""trigger2"")",1,14,0,"",""
Notice the doubling of the quotes, this is to get them past the parser.
However, If youre adding/deleting triggers, do you really WANT to add/delete? or just disable? If you have one trigger deleting another, and then a third trigger (or alias, or whatever) adding it again, you may want to consider merely enabling/disabling, since it will save time and is a bit cleaner (of course, there are situations where you do infact want to delete/add triggers, although usually enabling/disabling suffices (or using a variable)).
Yeah, I need to delete other triggers from within the trigger which is in an alias(hence the need to use addtrigger), kind of complicated to explain the purpose of it.
If I try the "deletetrigger(""trigger2"")" like you suggest, it outputs deletetrigger("trigger2") and doesn't delete the trigger, if I try deletetrigger(""trigger2"") it doesn't execute due to an error. Any help would be appreciated, I'm kind of stuck, my original syntax works but it outputs that 0, which ruins everything.
That's because you're sending to the world. You need to send to: script.
So, you'll need to use AddTriggerEx so that you can specify that you want it to send to script:
addtriggerex "trigger1", "*something","deletetrigger(""trigger2"")",1,14,0,"","",12,100