Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ two responses from addtrigger

two responses from addtrigger

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Cro   (3 posts)  Bio
Date Sun 08 May 2005 03:21 PM (UTC)
Message
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
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Sun 08 May 2005 05:51 PM (UTC)
Message
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"

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Cro   (3 posts)  Bio
Date Reply #2 on Mon 09 May 2005 12:51 AM (UTC)
Message
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?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #3 on Mon 09 May 2005 04:33 AM (UTC)
Message
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?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #4 on Mon 09 May 2005 05:23 AM (UTC)
Message
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)).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Cro   (3 posts)  Bio
Date Reply #5 on Mon 09 May 2005 03:13 PM (UTC)
Message
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.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #6 on Mon 09 May 2005 05:47 PM (UTC)
Message
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

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,365 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.