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
➜ VBscript
➜ Rolling Triggers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Meredin
(13 posts) Bio
|
Date
| Tue 31 Jan 2006 08:23 PM (UTC) |
Message
| Okay, I'm very curious about these rolling triggers. It seems to me that they would work fine, I even tested them out with smaller numbers and it worked, but after nearly two weeks of constant rolling, I happened to be sittin at my computer to witness an 18 18 16 roll, which is very good indeed! Unfortunately, the script sent reroll and I can't for the life of me figure it out why. The output from the screen was...
Strength 18 13
Dexterity 18 13
Intelligence 10 13
Wisdom 11 16
Charisma 9 11
Constitution 13 17
Luck 16 12
I'll paste my triggers here too, just so I'm giving up everything.
<triggers>
<trigger
enabled="y"
match="(Strength|Dexterity|Intelligence|Wisdom|Charisma|Constitution|Luck)\s*(\d+)\s*(\d+)$"
name="Stats"
regexp="y"
script="Store_Stats"
sequence="100"
>
</trigger>
</triggers>
I was pretty sure I had copied these straight from other forums and that they had worked for me in the past, but apparently I was wrong. Any help would be greatly appreciated, thanks!
Dim Str, Dex, Int, Wis, Cha, Con, Lck
Sub Store_Stats (TriggerName, TriggerLine, arrWildcards)
Select Case arrWildcards(1)
Case "Strength"
Str = arrWildcards(2)
Case "Dexterity"
Dex = arrWildcards(2)
Case "Intelligence"
Int = arrWildcards(2)
Case "Wisdom"
Wis = arrWildcards(2)
Case "Charisma"
Cha = arrWildcards(2)
Case "Constitution"
Con = arrWildcards(2)
Case "Luck"
Lck = arrWildcards(2)
Check_Stats
End Select
End Sub
Sub Check_Stats
if (Str => 18) and _
(Dex => 18) and _
(Int => 0) and _
(Wis => 0) and _
(Cha => 0) and _
(Con => 0) and _
(Lck => 15) then
World.Send "touch orb"
else
World.Send "reroll"
end if
End Sub | Top |
|
Posted by
| Meredin
(13 posts) Bio
|
Date
| Reply #1 on Tue 31 Jan 2006 08:40 PM (UTC) |
Message
| http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3107
That's the link to the triggers I was using, and I did some further testing, and when I set the numbers considerably lower, the trigger had no problem sending touch orb when the numbers were considerably higher than the pre-requisites that I assigned in the script, so I'm not sure what's going on here. | Top |
|
Posted by
| Meredin
(13 posts) Bio
|
Date
| Reply #2 on Tue 31 Jan 2006 09:05 PM (UTC) |
Message
| Sorry for the multiple posts, but I thought of something else that I'd love to ask you. Assuming that with your help I can get these triggers and scripts to work again, is there any way that I can play sound sort of sound or .wav file when they hit? That would be... awesome | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 31 Jan 2006 10:00 PM (UTC) |
Message
| You want to get to know "Debug simulated world input". Then you can test your trigger straight away. See Game menu -> Test Trigger (Shift+Ctrl+F12).
I tried that on your trigger, and that output, and it replied "touch orb". Maybe the script simply wasn't enabled?
Also, I think you should use CInt (convert to integer) on the amounts, otherwise it does a string compare, not a numeric compare.
For example "2" is greater than "15" when you do a string compare.
Dim Str, Dex, Int, Wis, Cha, Con, Lck
Sub Store_Stats (TriggerName, TriggerLine, arrWildcards)
Dim amount
amount = CInt (arrWildcards(2))
Select Case arrWildcards(1)
Case "Strength"
Str = amount
Case "Dexterity"
Dex = amount
Case "Intelligence"
Int = amount
Case "Wisdom"
Wis = amount
Case "Charisma"
Cha = amount
Case "Constitution"
Con = amount
Case "Luck"
Lck = amount
Check_Stats
End Select
End Sub
To play a sound, see:
http://www.gammon.com.au/scripts/doc.php?function=Sound
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 31 Jan 2006 10:05 PM (UTC) Amended on Tue 31 Jan 2006 10:06 PM (UTC) by Nick Gammon
|
Message
| You could check the script is running, and keep track of it, by adding a "roll number" which updates a count on the status line, like this:
Dim roll_number
roll_number = 0
Sub Check_Stats
if (Str => 18) and _
(Dex => 18) and _
(Int => 0) and _
(Wis => 0) and _
(Cha => 0) and _
(Con => 0) and _
(Lck => 15) then
World.Send "touch orb"
else
World.Send "reroll"
roll_number = roll_number + 1
SetStatus "Roll number " & roll_number
end if
End Sub
Now you will see "Roll number 1" (and so on) whenever it rejects some stats.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Meredin
(13 posts) Bio
|
Date
| Reply #5 on Tue 31 Jan 2006 10:42 PM (UTC) |
Message
| Okay, this is now the exact script that I am using...
Dim Str, Dex, Int, Wis, Cha, Con, Lck
Sub Store_Stats (TriggerName, TriggerLine, arrWildcards)
Dim amount
amount = CInt (arrWildcards(2))
Select Case arrWildcards(1)
Case "Strength"
Str = amount
Case "Dexterity"
Dex = amount
Case "Intelligence"
Int = amount
Case "Wisdom"
Wis = amount
Case "Charisma"
Cha = amount
Case "Constitution"
Con = amount
Case "Luck"
Lck = amount
Check_Stats
End Select
End Sub
Dim roll_number
roll_number = 0
Sub Check_Stats
if (Str => 18) and _
(Dex => 18) and _
(Int => 0) and _
(Wis => 0) and _
(Cha => 0) and _
(Con => 0) and _
(Lck => 15) then
World.Send "touch orb"
World.sound "ohyeah.wav"
else
World.Send "reroll"
roll_number = roll_number + 1
SetStatus "Roll number " & roll_number
end if
End Sub
If I try to test the trigger using Test Trigger under game, I copy the text exactly and I get no response, not even the color changing triggers work, tho I'm not sure if they are suppose to. However, if I log on the game and actually start rolling, the reroll part seems to happen just fine, though there isn't anything that comes up saying what number roll I am on. I would be very interested in seeing the roll_number work, but I still can't seem to test the triggers without lowering the numbers to something easily attainable and just watching. And I don't understand why test trigger isn't working, what am I doing wrong? I copied and pasted the screen, I put new lines in the front and back, I even manually typed it all in so I could hit Ctrl+Enter in the correct places... | Top |
|
Posted by
| Meredin
(13 posts) Bio
|
Date
| Reply #6 on Tue 31 Jan 2006 10:46 PM (UTC) |
Message
| After playing around with it some more, I noticed that the roll_number is actually there, down in what I would call the information bar, I was expecting it to be in the world somewhere, but I still don't see anywhere sending reroll or touch orb! :-) Thanks again | Top |
|
Posted by
| Meredin
(13 posts) Bio
|
Date
| Reply #7 on Tue 31 Jan 2006 11:02 PM (UTC) |
Message
| Okay, well I'm an idiot. I spent like three hours trying to get this all fixed up before I ever posted here, not to mention the three weeks that I've been rolling just about every night and have yet to hit (because they weren't working). And finally, I found out the problem. I had, of course, the triggers which sent the information to the script, but then I added triggers which would change the color of let's say strength if it was indeed 18, so I could visually see how close I was coming on my different worlds. Well, to make a long story short, I didn't check the keep evaluating box. Thus, when I was actually rolling, the information never got to the script, but when I changed the requirements to "TEST" the trigger, the color triggers never hit, so they never interfered, and so the script funtioned as normal. Anyways, I think it works now, and I can use the Test Trigger option but only when the world is connected, otherwise it won't show me the touch orb and reroll, but if I connect and then try, it will work. Sorry for all the confusion and all my stupidity! Thanks! :-\ | 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.
22,993 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top