Help with prompt again..

Posted by Aerath on Mon 12 Sep 2005 07:12 AM — 7 posts, 30,114 views.

#0
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!

Russia #1
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
Amended on Mon 12 Sep 2005 01:09 PM by Ked
#2
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
Canada #3
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
#4
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..
Russia #5
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.
Australia Forum Administrator #6
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.