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
➜ A really stupid question about Triggers..
A really stupid question about Triggers..
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Elric
USA (51 posts) Bio
|
Date
| Sat 22 Dec 2001 07:15 AM (UTC) |
Message
| Can one set a trigger so that when someone reaches a certain amount of Mana, they will trance?
Like so:
Prompt1
(32715/32715hp|29075m|30000mv)(525)<1846628776 coins>(#21002)
When the mana drops below, say about, 28000, I want to be able to trance about 7 times. WITHOUT scripting, can it be done with Triggers? |
"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare | Top |
|
Posted by
| Elric
USA (51 posts) Bio
|
Date
| Reply #2 on Sat 22 Dec 2001 08:44 AM (UTC) |
Message
| Gosh, thanks.
Anywho, can it be done by just making MUSHClient, if it sees a specific number or a number below a certain number, do a command string?
Only reason I ask is because I cannot script. |
"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #3 on Sat 22 Dec 2001 02:33 PM (UTC) |
Message
| Heh.. well sorry, but as far as I know about triggers you
cant make them check for a number, but if you ask nicely
I'll help you make the script for it :) | Top |
|
Posted by
| Elric
USA (51 posts) Bio
|
Date
| Reply #4 on Sat 22 Dec 2001 02:44 PM (UTC) |
Message
| <Snicker> Alright, pretty please?
Help me make a script, pretty please? And I think your specialty is VB right? That works out, hehe.. |
"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #5 on Sun 23 Dec 2001 12:11 PM (UTC) Amended on Sun 23 Dec 2001 12:13 PM (UTC) by Storm Dragon
|
Message
| go into your config screen in MC, and click the scripting menu
and choose scripts, then make sure the 'Enable script' is active
scripting language is VBscript and select a location and filename
for your script.
click edit script and paste the following:
'---------------------------Storm Dragon Code--------------------------------
sub PromptParse (strTriggerName, trig_line, arrWildCards)
select case lcase(StrTriggerName)
case "install"
world.addtrigger "SendPrompt", "(*/*hp|*m|*mv)(*)<* coins>(#*)", "", 1, -1, 0, "", "PromptParse"
case "sendprompt" ' 1 2 3 4 5 6 7 - These are the wildcards
world.setvariable "CurrentHP", cint(arrWildCards(1))
world.setvariable "MaxHP", cint(arrWildCards(2))
world.setvariable "CurrentMana", cint(arrWildCards(3))
world.setvariable "CurrentVitality", cint(arrWildCards(4))
world.setvariable "CurrentCoins", cint(arrWildCards(6))
case else
end select
' Below this line we can insert the subroutines that have to be checked everytime a prompt shows up.
call ManaCheck
end sub
sub ManaCheck
if world.getvariable("CurrentMana") <= world.getvariable("MinMana") then
world.send "Trance"
world.send "Trance"
world.send "Trance"
world.send "Trance"
world.send "Trance"
world.send "Trance"
world.send "Trance"
end if
end sub
'-----------------------End Storm Dragon Code--------------------------------
Ok.. we are done with the script, save it and return to the config screen
notice just above the help button, it says 'Script Prefix' it should say /
change it only if you use that character in the game (I mean when you start a line with it)
click the ok button and type the following into your command line
/promptparse "install", "", ""
/world.setvariable "MinMana", 23000
where the last number is the minimum mana you have before starting the trancing | Top |
|
Posted by
| Elric
USA (51 posts) Bio
|
Date
| Reply #6 on Sun 23 Dec 2001 10:00 PM (UTC) |
Message
| Error number: -2146828282
Event: Execution of line 10 column 7
Description: Overflow: 'cint'
Called by: Function/Sub: PromptParse called by trigger
Reason: processing trigger "SendPrompt"
On trying to load the first command you put there.. Hehe.. |
"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare | Top |
|
Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
Date
| Reply #7 on Mon 24 Dec 2001 08:57 AM (UTC) |
Message
| Ah.. yes, I think the cint() is limited to 32000 or so
and the amount of coins you are carrying are way beyond that
Replace:
world.setvariable "CurrentCoins", cint(arrWildCards(6))
With:
world.setvariable "CurrentCoins", arrWildCards(6)
Or delete it completely if you dont believe you are going to use it | Top |
|
Posted by
| Elric
USA (51 posts) Bio
|
Date
| Reply #8 on Mon 24 Dec 2001 09:53 AM (UTC) |
Message
| Oh, I am definitely going to use this.. And now, thanks to your example and Nick's.. I may have a chance at learning this.. Lmao.. Thanks mate.. |
"By the pricking of my thumbs, something wicked this way comes. Open locks, whoever knocks!" MacBeth, Shakespeare | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #9 on Tue 29 Apr 2003 05:42 AM (UTC) |
Message
|
Quote:
When the mana drops below, say about, 28000, I want to be able to trance about 7 times. WITHOUT scripting, can it be done with Triggers?
With recent versions of MUSHclient this can now be done just a trigger with inline scripting. I suppose it is still scripting, but it is simple enough.
Say your prompt was:
(32715/32715hp|29075m|30000mv)
You could make a trigger match on:
(*/*hp|*m|*mv)*
That makes the mana wildcard 3 (third asterisk). So put in the send text:
if CLng (%3) < 28000 then
Send "trance"
Send "trance"
Send "trance"
Send "trance"
Send "trance"
Send "trance"
end if
Then mark the trigger "send to script". That should do it.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #10 on Tue 29 Apr 2003 01:31 PM (UTC) |
Message
| trigger text:
^\((.*?)\/(.*?)hp\|(27\d\d\d)m\|(.*?)mv\)\((.*?)\)\<(.*?) coins\>\(\#(.*?)\)
Don't know if the syntax is actually correct, wrote this off the top of my head, but it IS possible, using regex, to match on 27 and 3 digits, which means that this'll match on any number between 27000 and 27999...
Some people shout "script, script!" way too early :p
I like scripts a lot myself, but regex is really powerful, and if you can do it with just an expression, why write a script? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | 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.
26,809 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top