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
➜ Help with prompt again..
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Aerath
(8 posts) Bio
|
Date
| Mon 12 Sep 2005 07:12 AM (UTC) |
Message
| Hello, i still have problems with reading my prompt, i am uber noob in scripting so i don't have any clue as how to fix this.
The problem is the following:
most of the time my prompt looks like this: 3888h, 2714m ex-
When going into combat its like this: 3888h, 2714m cexkdb-
My reg. exp. trigger for this prompt is the following:
^(\d+)h\, (\d+)m.*? ([cexkdb@]*)-$
Now, how do I script the following;
In both cases for my prompt (normal and combat prompt) i want to check that character string (ex or cexkdb) if it misses e, x or both.
So it would be something like (in plain text);
if ( Wildcard(3) = "x" or "cekdb" ) then do something..
if ( Wildcard(3) = "e" or "cxkdb" ) then do something..
I also want to check if both are missing in this wildcard string.
My main question is, how can i script this in VBscript?
I know this might be asked a thousand times already, but please explain it once more for me, really appreciated!
Thanks already!
| Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #1 on Mon 12 Sep 2005 01:08 PM (UTC) Amended on Mon 12 Sep 2005 01:09 PM (UTC) by Ked
|
Message
| First, you might want to fix the prompt trigger a little:
^(\d+)h\, (\d+)m.*? ([c]?[e]?[x]?[k]?[d]?[b]?[@]?)-$
The one you have will work in most cases, but might misfire on some exotic occasions.
To find out whether a certain letter is in your status string, do:
if InStr(wildcard(3), "x") then
'you have balance
end if
if InStr(wildcard(3), "e") then
'you have equilibrium
end if
| Top |
|
Posted by
| Aerath
(8 posts) Bio
|
Date
| Reply #2 on Mon 12 Sep 2005 05:11 PM (UTC) |
Message
| Ah yes, thats how its done, thanks alot!
But I rather wanted to know how to find out whether a certain letter is not in my status string..
Any tips?
Thank'ee | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #3 on Mon 12 Sep 2005 05:42 PM (UTC) |
Message
| You should be able to do something like this:
if InStr(wildcard(3), "x") = 0 then
'you are without balance
end if
if InStr(wildcard(3), "e") = 0 then
'you are without equilibrium
end if
|
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Aerath
(8 posts) Bio
|
Date
| Reply #4 on Wed 14 Sep 2005 10:25 PM (UTC) |
Message
| Thanks all of you who helped me out here all works fine from so on :)
I have yet another question this time regarding newlines..
Is it possible to send a newline to the world immedeately after i send any action to the world? (like sending a string typed from keyboard to the world)
If yes, how would the script look like then?
I am very curious if this works.. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #5 on Wed 14 Sep 2005 11:17 PM (UTC) |
Message
| Mushclient automatically appends a newline to everything you send, but if you want two newlines, for example to get an extra prompt... Don't think that there's any easy or absolutely reliable way to do that. You can try the following in a plugin:
function OnPluginSend(strText)
Send vbCRLF
OnPluginSend = vbTrue
end function
But that could very well result in you sending the newline before the command, and not after. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sun 18 Sep 2005 06:20 AM (UTC) |
Message
| Or try this:
function OnPluginSend(strText)
Send strText & vbCRLF
OnPluginSend = vbFalse
end function
The processing for OnPluginSend has a test to stop it recursing into an infinite loop (which doing a Send within a Send might well do), so that should work. The line "OnPluginSend = vbFalse" stops MUSHclient from doing the send twice.
|
- 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.
22,908 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top