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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Help with prompt again..
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Help with prompt again..

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Aerath   (8 posts)  [Biography] 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!

[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] 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
[Go to top] top

Posted by Aerath   (8 posts)  [Biography] 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
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] 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
[Go to top] top

Posted by Aerath   (8 posts)  [Biography] 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..
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,388 posts)  [Biography] 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
[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.


6,974 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]