Teacher, can I have some homework?

Posted by MushclientNewbie on Sun 16 Mar 2003 05:04 AM — 5 posts, 19,128 views.

USA #0
Alright, I utterly love your client Nick G. but, I have had no experience with any of the scripts (vb, java, and pearl). All of my mudding experience in the past has been with Gmud and the past month has been like stepping from pre-algerbra into calc III. Now, I'll get on with the meat of my post.

I want Mushclient to work its wonderful magic for me to roll a character on a mud. But, aside from choosing the trigger I want it to fire from - I'm lost. I will go ahead and post the output and, if somneone could, read through it and explain what I can do. Okay, here's the output - its a single line and I'll explain more as I go along:

[40] Cmds: help, end, roll, add, rem>

And, my trigger looks like this:

[*] Cmds: help, end, roll, add, rem>

Now, I want Mushclient to read the number in the wildcard and do two things. One, if it is equal to or higher than some number then I want it to beep and disable the trigger. If not, then it will 'roll.' Two, I want Mushclient to record the wildcard and keep track of the highest wildcard and display that high number.

Please, when you explain it, record every step so I can try to re-produce what you do. I don't want to have to come here for every single little thing I need ;) . Also, if there is some basic script site out there or here, that I've missed, I would love being directed towards that.

Thanks, Matt.
Australia Forum Administrator #1
You basically need to have your trigger call a small script. Go the configuration for the world, enable scripting, language VBscript, and choose a script file (you can use the existing exampscript.vbs file if you want).

Then add to the bottom of this file your script subroutine, like this:


sub OnRoll (name, line, wildcards)
dim roll

'
'  Find the amount rolled (wildcard 1) and convert to integer
'
roll = CInt (wildcards (1))

if roll < 40 then  ' choose your number here
  world.DoAfter 1, "roll"  ' roll again a second later
else
  world.EnableTrigger "mytrigger", 0  ' disable your trigger
  world.Sound "ding.wav"  ' get the exact path here
end if

end sub



Save this, answer "yes" if it asks you to reprocess the script file. If no errors, change your trigger to have the "script" field have "OnRoll".

That should do it.
Amended on Thu 08 May 2003 09:36 AM by Nick Gammon
USA #2
Okay, I still have a problem. Mushclient won't recognize the trigger unless I use just the first two characters:

[*

Then, the wildcard isn't an interger... I don't know what to do. I tried using a regular expression, but since I know nothing about regular expressions I didn't have much sucess. Could I have a little more help?

The script, I think, will work fine. I just had to add an end sub. Otherwise, I'm pretty sure that the only problem here is getting Mushclient to see and process this trigger the way we want:

[*] Cmds: help, end, roll, add, rem>

I'm stumped.

Matt.
Australia Forum Administrator #3
Sounds like there might be something else on the line, try this:

[*] Cmds: help, end, roll, add, rem>*

Make sure you get the spacing right, copy from the output window and paste into the trigger.

USA #4
Thanks, that was it. There were a few spaces after the ">" that kept the trigger from activating.