[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  A really stupid question about Triggers..

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: A really stupid question about Triggers..
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Tue 29 Apr 2003 01:31 PM (UTC)  quote  ]
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!
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Tue 29 Apr 2003 05:42 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Elric   USA  (51 posts)  [Biography] bio
Date Mon 24 Dec 2001 09:53 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Mon 24 Dec 2001 08:57 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Elric   USA  (51 posts)  [Biography] bio
Date Sun 23 Dec 2001 10:00 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Sun 23 Dec 2001 12:11 PM (UTC)  quote  ]

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
[Go to top] top

Posted by Elric   USA  (51 posts)  [Biography] bio
Date Sat 22 Dec 2001 02:44 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Sat 22 Dec 2001 02:33 PM (UTC)  quote  ]
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 :)
[Go to top] top

Posted by Elric   USA  (51 posts)  [Biography] bio
Date Sat 22 Dec 2001 08:44 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Sat 22 Dec 2001 08:31 AM (UTC)  quote  ]
Message
No
[Go to top] top

Posted by Elric   USA  (51 posts)  [Biography] bio
Date Sat 22 Dec 2001 07:15 AM (UTC)  quote  ]
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
[Go to top] 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.


2,782 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]