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
➜ ZMUD user trying to convert to MUSHClient.
ZMUD user trying to convert to MUSHClient.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Caspian
(4 posts) Bio
|
Date
| Sun 04 Jul 2004 09:31 PM (UTC) |
Message
| Hey guys, I'm an old v4.62 ZMud user and I'm trying to convert some of my aliases over to MUSHClient. If I could just see how one or two of these would work in a script, I could figure out how to get the rest of them working.
The basic idea is to have a series of quick commands that I can use to lay down rooms and exits.
I have @newRoom set to the vnum of the next room in my area.
I have @curRoom set to the room I'm currently standing in.
I use this basic alias below to process my commands.
#ALIAS {mroom} {goto @newRoom; redit bexit @dir @curRoom; redit name @newRoom; #MATH {newRoom} {@newRoom+1}}
And I use a series of aliases like:
#ALIAS {mrn} {dir = south; mroom}
or
#ALIAS {mrse} {dir = southwest; mroom}
So gentlemen and ladies.. how would I go about converting the above into something I could use in MUSHClient?
Thanks for your help. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #1 on Mon 05 Jul 2004 04:36 AM (UTC) |
Message
| Put this in the "mroom" alias' send box, check "Expand variables", select "Scripting" from the Send to combo box.
world.Send "goto " & @curRoom
world.Send "redit bexit " & @dir
world.Send "redit name " & @newRoom
world.SetVariable "newRoom", @newRoom + 1
Then put the same things you alread have in your movement aliases into their send boxes, without using ; to delimit commands - just hit enter to send as two separate lines. Select "Execute" for the Send to option.
That should work as long as you have vbscript enabled under World properties->Scripting.
| Top |
|
Posted by
| Caspian
(4 posts) Bio
|
Date
| Reply #2 on Mon 05 Jul 2004 05:11 AM (UTC) |
Message
| Works great, thanks. Just one more question for you.
I seem to be having great troubles getting MUSHClient to trigger off matches in my prompt.
Example.
My prompt is:
[CurRoom:52171 WizInvis(105)]
What I want is for a trigger to identify what "CurRoom" is.
What I did was create a trigger like this:
CurRoom:* WizInvis
setVariable "curRoom", %1
Unfortunately, it's not triggering. It's like the triggers ignore my prompt. I never seemed to have this problem in zMUD, or, if I did, I think there was an option to have it recognize your prompt as a valid triggerable field.
Ideas? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Mon 05 Jul 2004 05:27 AM (UTC) |
Message
| ^\[CurRoom\:(\d+) WizInvis\(105\)\]
Checked: Regexp, enabled.
then you can use %1 (just like in ZM) to send to the variable.
Make sure you are sending to the script, and have it enabled, with the right language, just like you had it.
If the latter part of the script changes (the numbers, or whatever else) you might have a problem.
YOUR trigger might notve worked because it was a prompt (not terminated) then if you typed something, it wouldve been appended. Prompts are fickle things, because theyre usually not ended with a new line. One of the largest causes of trouble with triggers. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Caspian
(4 posts) Bio
|
Date
| Reply #4 on Mon 05 Jul 2004 06:15 AM (UTC) |
Message
| It doesn't work. And yeah, the latter part of the prompt does change. It's just simply not triggering.
My prompt is:
[CurRoom:115 WizInv(0)]
The WizInv part changes sometimes. Thoughts? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #5 on Mon 05 Jul 2004 06:28 AM (UTC) Amended on Mon 05 Jul 2004 06:29 AM (UTC) by Flannel
|
Message
| Meaning, the number?
^\[CurRoom\:(\d+) WizInvis\((\d+)\)\]
This matches on [CurRoom:# WizInvis(#)]
where both '#'s are any numbers of numerals. If other things change, we can change the regexp to account for that.
Make sure Regexp is checked. And to check to see if it matches, change the color. Theres no reason why you cant make a trigger to match it, weve just overlooked something (spaces? perhaps? or something else. Something hasnt been brought up)
This one should work though. You can read the VBscript docs for details for regexp, but its a standard thing, not a MC only sort of language (like ZM's). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #6 on Mon 05 Jul 2004 07:09 AM (UTC) |
Message
| The correct way to get the prompt is through the plugin though. You can make a small plugin without any triggers or aliases, and declare a OnPluginPartialLine sub in the script section.
sub OnPluginPartialLine(strText)
end sub
Then use a vbscript regexp object to see if that regexp above matches on the sub's argument, and if it does you can expose it through world.Execute and catch it with aliases in other places. Suppose you want to use an alias "OnPrompt *" to get the prompt and the value of interest in it, then the plugin's script could look like this:
dim re
Set re = new RegExp
re.pattern = "^[CurRoom\:(\d+) WizInvis\((\d+)\)]"
sub OnPluginPartialLine(stext)
dim Matches, Match, str
set Matches = re.Execute(stext)
if Matches.Count = 0 then
exit sub
end if
set Match = Matches.Item(0)
set Matches = Nothing
world.Execute "OnPrompt " & Match
end sub
Once you install the plugin in your world, you can get the prompt value in any other plugin installed for this world, or in the main world file, simply using an alias to match on "OnPrompt *".
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Mon 05 Jul 2004 07:27 AM (UTC) |
Message
|
Quote:
My prompt is:
[CurRoom:52171 WizInvis(105)]
...
What I did was create a trigger like this:
CurRoom:* WizInvis
setVariable "curRoom", %1
Since there is text after WizInvis, the very least you should do is this:
Match: CurRoom:* WizInvis*
Your trigger would only match if WizInvis is the last thing on the line. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #8 on Mon 05 Jul 2004 07:59 AM (UTC) |
Message
| Erm, so he does or doesnt have the brackets in the line? If he doesnt, then of course my triggers wont work.
Theres nothing wrong with using MC triggers (and not a plugin) to catch prompts, Ive been doing it since... a long time, never had too large of a problem with it, nothing that cant be worked around. Well, I guess depending on how you use it, it becomes important one way or the other. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #9 on Mon 05 Jul 2004 12:28 PM (UTC) |
Message
| Having a prompt hang at the bottom of the screen for nearly forever with triggers unable to get to it can get really frustrating, which is why I don't use triggers to get it ever since OnPluginPartialLine came around. And you need to make the plugin only once, after which you can just use it anytime you need it. | Top |
|
Posted by
| Caspian
(4 posts) Bio
|
Date
| Reply #10 on Mon 05 Jul 2004 08:01 PM (UTC) |
Message
| Alright, I'm following what you're saying about the plugin, but I've just never done it before, so do you think you could offer me maybe more step by step directions on how to build that plugin? I would appreciate it, thanks. I've given it a few tries, but I'm not doing something right. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #11 on Tue 06 Jul 2004 10:40 PM (UTC) |
Message
| Better post what you have done so far. It is hard to debug code if you have to guess what it is. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
27,936 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top