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
➜ Bug reports
➜ AddTrigger not giving trigger name.
|
AddTrigger not giving trigger name.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jlzink
USA (15 posts) Bio
|
| Date
| Wed 18 Aug 2004 04:28 AM (UTC) |
| Message
| I'm working on making a bot for an online graphical game that allows bots. Problem is that my script is suppose to add triggers upon recieving a whisper. It adds the trigger fine, but isn't adding the trigger with the name it is suppose to. The following is the script. This problem is also preventing me from using DeleteTrigger as well.
Sub Addban (thename, theoutput, thewildcards)
dim sTarget
dim sTcommand
dim tname
sTarget = Trim (thewildcards (2))
mTarget = Trim (thewildcards (2))
tname = replacer(sTarget)
sTcommand = chr(34) & "eject " & sTarget
world.addtrigger tname,"*" & mTarget & "*",sTcommand,1,6,0,"",""
world.DoCommand "Save"
end sub
Sub Removeban(thename, theoutput, thewildcards)
dim i, furre, commander
commander = Trim (thewildcards (1))
furre = Trim (thewildcards (2))
furre = replacer(furre)
world.DeleteTrigger furre
i = world.DeleteTrigger (furre)
world.note "trigger delete status was " & i
world.DoCommand "Save"
end sub
The function 'replacer()' that the the string furre is sent to, is for replacing special characters. Please help me if you can. Thanks. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #1 on Wed 18 Aug 2004 06:27 AM (UTC) |
| Message
| | Try noting tname (world.note) so you can see if perhaps you have some invalid characters in the trigger name (or leading spaces, or whatnot). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Jlzink
USA (15 posts) Bio
|
| Date
| Reply #2 on Wed 18 Aug 2004 06:34 AM (UTC) |
| Message
| Didn't work. IT seems to be getting the name correctly. However only if I don't pass it to my function. However still if I use a name with no special characters as a test name it still doesn't name the trigger like it should.
| | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #3 on Wed 18 Aug 2004 06:39 AM (UTC) Amended on Wed 18 Aug 2004 06:42 AM (UTC) by Flannel
|
| Message
| What didnt work? It doesnt note it?
And what are you trying for the test? Everyone else has no problem adding triggers. So, maybe youre overlooking some minute detail. Those tend to be the ones. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #4 on Wed 18 Aug 2004 06:42 AM (UTC) |
| Message
| | And what is the function returning? Since that will most likely shine some light on the problem. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Wed 18 Aug 2004 09:56 PM (UTC) |
| Message
| Test that sort of thing by getting the return code, eg.
world.note world.addtrigger ("test","*" & mTarget & "*",sTcommand,1,6,0,"","")
I did that, and on the second time around got code 30006.
Look that up in the help file and you will see:
eTriggerAlreadyExists (30006) Attempt to add a trigger that already exists
You can add a flag to the trigger flags:
const eReplace = 1024 ' replace existing trigger of same name
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jlzink
USA (15 posts) Bio
|
| Date
| Reply #6 on Thu 19 Aug 2004 04:06 AM (UTC) |
| Message
| | I fixed it. I forgot to make global declaration in my script and wrote 1 line differently then I did in a prior script that did work. All is good now. Thanks for the help guys. | | 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.
20,208 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top