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
➜ Multi Line Matching per say
|
Multi Line Matching per say
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #15 on Sat 10 Jan 2004 06:15 PM (UTC) |
| Message
| I'm just having a hell of a time lol....
* n
You begin to walk northwards.
*
You walk northwards.
Found description: Rue St. Mederic des Assis St. Jacques.The Rue St. Mederic des Assis St. Jacques continues to the north and south.The Rue de la Vanerie is to the west. You could progress northwards,southwards, westwards.* nYou begin to walk northwards.*
I can go: northwards,southwards, westwards
Direction = northwards
Direction = southwards
Direction = westwards
Rue St. Mederic des Assis St. Jacques.
The Rue St. Mederic des Assis St. Jacques continues to the south. The Pont
Notre Dame is to the north. The Rue de Geur is to the east. The Rue de la
Tannerie is to the west. You could progress northwards, eastwards,
southwards, westwards.
* e
You begin to walk eastwards.
*
You walk eastwards.
Found description: Rue St. Mederic des Assis St. Jacques.The Rue St. Mederic des Assis St. Jacques continues to the south. The PontNotre Dame is to the north. The Rue de Geur is to the east. The Rue de laTannerie is to the west. You could progress northwards, eastwards,southwards, westwards.* eYou begin to walk eastwards.*
I can go: northwards, eastwards,southwards, westwards
Direction = northwards
Direction = eastwards
Direction = southwards
Direction = westwards
Rue St. Mederic des Assis St. Jacques.
The Rue St. Mederic des Assis St. Jacques continues to the south. The Pont
Notre Dame is to the north. The Rue de Geur is to the east. The Rue de la
Tannerie is to the west. You could progress northwards, eastwards,
southwards, westwards.
* e
You begin to walk eastwards.
*
You walk eastwards.
Found description: Rue St. Mederic des Assis St. Jacques.The Rue St. Mederic des Assis St. Jacques continues to the south. The PontNotre Dame is to the north. The Rue de Geur is to the east. The Rue de laTannerie is to the west. You could progress northwards, eastwards,southwards, westwards.* eYou begin to walk eastwards.*
I can go: northwards, eastwards,southwards, westwards
Direction = northwards
Direction = eastwards
Direction = southwards
Direction = westwards
Rue de Geur.
The Rue de Geur continues to the east. The Rue St. Mederic des Assis St.
Jacques is to the west. You could progress eastwards, westwards.
* score
Marquis Crea, le Batard de Paris.
Military Rank: Recruit
Social Level: 12 Social Points: 59182
Honour: 1441 Shame: 1
Health: 109 / 113 Experience Points: 2294776
Piety Points: 55
Rank: 51st within Paris, 51st in the Land.
You are sixty three percent off of your personal highest score.
Your account may receive PayPal payments to credit it.
You are a member of The Frog and Peach social club.
Your regiment is: Cardinal's Foot Guards (not yet assigned to a company).
You are a Worshipper at Notre Dame.
You own 595 livres.
You are holding 48 items. You wield nothing.
You are not toadying to anyone.
You are satiated and not thirsty at all.
You are a Kings Bard of the Royal Court.
You are barely tasked in your current employment.
You have 105 discipline points.
You have twenty eight free lessons with the Regimental tutor remaining.
Your scope of vision is fifty yards.
Type STATUS for further information.
* e
You begin to walk eastwards.
*
You walk eastwards.
Found description: Rue de Geur.The Rue de Geur continues to the east. The Rue St. Mederic des Assis St.Jacques is to the west. You could progress eastwards, westwards.* scoreMarquis Crea, le Batard de Paris.Military Rank: RecruitSocial Level: 12 Social Points: 59182Honour: 1441 Shame: 1Health: 109 / 113 Experience Points: 2294776Piety Points: 55Rank: 51st within Paris, 51st in the Land.You are sixty three percent off of your personal highest score.Your account may receive PayPal payments to credit it.You are a member of The Frog and Peach social club.Your regiment is: Cardinal's Foot Guards (not yet assigned to a company).You are a Worshipper at Notre Dame.You own 595 livres.You are holding 48 items. You wield nothing.You are not toadying to anyone.You are satiated and not thirsty at all.You are a Kings Bard of the Royal Court.You are barely tasked in your current employment.You have 105 discipline points.You have twenty eight free lessons with the Regimental tutor remaining.Your scope of vision is fifty yards.Type STATUS for further information.* eYou begin to walk eastwards.*
I can go: eastwards, westwards
Direction = eastwards
Direction = westwards
Rue de Geur.
The Rue de Geur continues to the east. The Rue St. Mederic des Assis St.
Jacques is to the west. You could progress eastwards, westwards.
* *
Ok So in that The scipt is always one room behind and if I do anything other than walk or anything it will end up in the desc.
| | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #16 on Sat 10 Jan 2004 06:15 PM (UTC) |
| Message
| This is what I am using.
sub descget (sName, sLine, wildcards)
desc = GetVariable ("desc")
if desc <> "" then
'
' DEBUG: Note found text
'
Note "Found description: " & desc
'
' Clear this description ready for next one
'
SetVariable "desc", ""
'
' Analyse description
'
Set regEx = New RegExp
' get trigger match text
regEx.Pattern = "In your immediate vicinity you see ([^.]*)\.?"
Set Matches = regEx.Execute(desc)
For Each match in Matches
ColourNote "blue", "white", _
"In my vicinity is: " & Match.SubMatches (0)
items = Split (Match.SubMatches (0), ",")
For Each item in Items
ColourNote "green", "white", "Item = " & Trim (item)
Next
Next
Set Match = Nothing
regEx.Pattern = "You could progress ([^.]*)\.?"
Set Matches = regEx.Execute(desc)
For Each match in Matches
ColourNote "blue", "white", _
"I can go: " & Match.SubMatches (0)
items = Split (Match.SubMatches (0), ",")
For Each item in Items
ColourNote "green", "white", "Direction = " & Trim (item)
Next
Next
Set regEx = Nothing
end if ' have a description
end sub
sub descfin (sName, sLine, wildcards)
SetVariable "desc", GetVariable ("desc") + wildcards (10)
end sub
<triggers>
<trigger
enabled="y"
match="^(.*?)$"
name="descfin"
regexp="y"
script="descfin"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
<trigger
custom_colour="4"
enabled="y"
match="You walk *."
name="descget"
script="descget"
sequence="90"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>
I am not sure how to edit it to make it work right..
But what I need to do is..
I need it to match on "You walk *." * being any possible direction.
When it matches on that it will copy Every following line until it matches an Asterik which will be on a line of it's on...
* = Normal
/* = I am parrying
*\ = I am sidestepping
/*\ = I am parrying and sidestepping
So the prompt can slightly change which means I need it to match either on all the combinations which there are more than I listed above, or , I need it to match on the next following asterik after You walk *.
So ...
Match: You walk *.
Turn * Trigger on
Copy All following Lins until *.
Match: *
Turn * Trigger off
Evalute the copied text and preform any actions providing feedback.
And I think if I do it that way it should work.
but maybe I am just repeating what I already am doing... bleh grumbles...
Thanks for any advice
wrtiii
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #17 on Sat 10 Jan 2004 07:31 PM (UTC) |
| Message
| One way would be to follow any movement direction with something that you can pick up as the end of the movement. I don't remember exactly what the MUD supports, but on other MUDs you can "think" so I would do something like this:
To move north:
walk north
think --- Movement ended ---
(You would do that with an alias so it happens automatically).
Then the trigger picks up "--- Movement ended ---" (which should appear after the movement happens) and process the room description.
However if the MUD throws in a delay you might have to be more cunning, eg. wait a second and do the think. eg.
world.Send "walk north"
world.DoAfter 1, "think --- Movement ended --"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #18 on Sat 10 Jan 2004 08:16 PM (UTC) |
| Message
| ok and on it's own what scripting do I need to use in order to make it take all the data after the first match until the second match whre it ends.
not including anything to evalute anything I just want it to
Match Start
Take all Data until
Match End
then I can make an alias "ShowData" world.note varible "desc" or whatever the line for that alias would need to be I would have to look it up. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #19 on Sat 10 Jan 2004 10:14 PM (UTC) |
| Message
| I don't really have time to write the whole script. I think the general ideas I have presented should be able to be made to work. For instance you could bracket a move with a before *and* after message.
eg.
think "I am about to move"
north
think "I have moved"
Now if everything is echoed in the right order you use the two bracket messages to find the description.
I strongly suspect this MUD is trying hard to defeat this sort of thing, so you may find it tricky. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #20 on Sat 10 Jan 2004 10:32 PM (UTC) |
| Message
| No No I just need to know the few lines I need to make it copy from Start Match to End Match
START
dfds
fdsfs
dfsd
dsfs
END
I just need to know the lines so that I can match on START which will then copy
dfds
fdsfs
dfsd
dsfs
and then stop copying it on END
Then I will build with what you gave me and with what I need on that to evaulate it and give a response to it.
I just can't seem to pick out which lines it is that does the copying from the first match to the ending match.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #21 on Sat 10 Jan 2004 11:24 PM (UTC) |
| Message
|
Quote:
No No I just need to know the few lines I need to make it copy from Start Match to End Match
START
dfds
fdsfs
dfsd
dsfs
END
You need to modify what I have done slightly, as I didn't try to solve that exact problem.
You need three triggers:
1. START -> enables trigger 2, empties description
2. * -> matches everything, adds to the description
3. END -> disables trigger 2, processes description |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #22 on Sun 11 Jan 2004 02:05 AM (UTC) Amended on Sun 11 Jan 2004 02:10 AM (UTC) by WRTIII
|
| Message
| Sub descstart (sName, sLine, wildcards)
world.SetVariable "desc", ""
World.EnableTrigger "descget", TRUE
World.EnableTrigger "descfin", TRUE
End Sub
Sub descfin (sName, sLine, wildcards)
World.EnableTrigger "descget", FALSE
World.EnableTrigger "descfin", FALSE
End Sub
<triggers>
<trigger
custom_colour="4"
keep_evaluating="y"
match="^\*."
name="descfin"
regexp="y"
script="descfin"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
<trigger
custom_colour="5"
keep_evaluating="y"
match="*"
name="descget"
send_to="12"
sequence="100"
variable="desc"
other_text_colour="black"
other_back_colour="black"
>
<send>world.ColourNote "red", "blue", "Hello there"
</send>
</trigger>
<trigger
custom_colour="4"
enabled="y"
keep_evaluating="y"
match="^You walk (.*?)\.$"
name="descstart"
regexp="y"
script="descstart"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>
Ok so I use that and I get...
* SOUTH
You begin to walk southwards.
*
You walk southwards.
Rue St. Mederic des Assis St. Jacques.
Hello there
The Rue St. Mederic des Assis St. Jacques continues to the north and south.
Hello there
You could progress northwards, southwards.
Hello there
* NORTH
Hello there
You begin to walk northwards.
*
You walk northwards.
Rue St. Mederic des Assis St. Jacques.
Hello there
The Rue St. Mederic des Assis St. Jacques continues to the north and south.
Hello there
You could progress northwards, southwards.
Hello there
* .
Hello there
I do not understand.
*
and when I change the one trigger to instead of doing the world note to send %1 to variable "desc" when it is finished I just end up with * in the variable
So I assume I either have to append each of the lines together.. or else I am matching it incorrectly and there is a way to match ALL of the text not each line seperatly which is what it appears to be doing. I am completely lost trying to decypher anything out of the snippet you gave me before although I know what I need to do now just theese small things getting in the way.
Ok also just change world note to note %1 and after each line it shows the line over again... but I don't see in the code you gave me where you are adding all thoose lines together to put them into the desc variable.. so I am thinking maybe I am missing something that will do it as a whole?
---
* n
* n0
You begin to walk northwards.
*
You walk northwards.
Rue St. Mederic des Assis St. Jacques.
Rue St. Mederic des Assis St. Jacques.0
The Rue St. Mederic des Assis St. Jacques continues to the north and south.
The Rue St. Mederic des Assis St. Jacques continues to the north and south.0
You could progress northwards, southwards.
You could progress northwards, southwards.0
* n
* n0
You begin to walk northwards.
*
You walk northwards.
Rue St. Mederic des Assis St. Jacques.
Rue St. Mederic des Assis St. Jacques.0
The Rue St. Mederic des Assis St. Jacques continues to the north and south.
The Rue St. Mederic des Assis St. Jacques continues to the north and south.0
You could progress northwards, southwards.
You could progress northwards, southwards.0
* .
* .0
I do not understand.
* *
---
!!! Oh The 0's in thoose ones came from me trying to use %10 it appeared the same way just without the 0's when I used %1 !!!
-- I saw you used %10 at one point and thought maybe that meant take it all since there are only 9 wildcard spots but doesn't seem to be like that... -- | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #23 on Sun 11 Jan 2004 04:10 AM (UTC) |
| Message
|
Quote:
I saw you used %10 at one point
No, I didn't.
I might have used wildcards (10) but not %10. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #24 on Sun 11 Jan 2004 04:13 AM (UTC) |
| Message
| |
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #25 on Sun 11 Jan 2004 05:09 AM (UTC) |
| Message
| Ok That is all working now except..
You walk northwards.
Rue V. Monoie.
You are able to see by the light of the lantern. The Rue V. Monoie continues
to the south. The Rue St. Lacque is to the north. You could progress
northwards, southwards.
*
You walk northwards.
Rue St. Lacque.
You are able to see by the light of the lantern. The Rue St. Lacque continues
to the east and west. The Rue V. Monoie is to the north and south. You could
progress northwards, eastwards, southwards, westwards.
*
You walk northwards.
Rue V. Monoie.
You are able to see by the light of the lantern. The Rue V. Monoie continues
to the north. The Rue St. Lacque is to the south. You could progress
northwards, southwards.
*
You walk northwards.
Rue V. Monoie.
You are able to see by the light of the lantern. The Rue V. Monoie continues
to the north. The Rue St. Lacque is to the south. You could progress
northwards, southwards.
*
You walk northwards.
Rue V. Monoie.
You are able to see by the light of the lantern. The Rue V. Monoie continues
to the south. The Rue de Geur is to the north. The Place au Yeux is to the
west. You could progress northwards, southwards, westwards.
* stop
You stop moving
You walk northwards. ---FIRST TRIGGER MATCHES HERE---
Rue V. Monoie. ---START COPYING HERE---
You are able to see by the light of the lantern. The Rue V. Monoie continues
to the south. The Rue de Geur is to the north. The Place au Yeux is to the
west. You could progress northwards, southwards, westwards.
* --- LAST TRIGGER FINISHES HERE AND ADD'S ALL TO VARIBLE WHICH IS WHERE THE PROBLEM LIES ---
If I was to just type WEST then nothing else and the game didn't scroll the screen at all then it would just sit then with the last thing on the last line showing being the * Which means that the last trigger and the one evaluating the desc does not run. until I type something in or the game gives some kinda output. (the line moves)
so when I type WALK WEST it makes me continusly walk to the west with a couple seconds delay between rooms... But as you can see the next line after the * is me moving into the next room so at that point any actions I wanted to do in the previous room will go off and be wasted as I am already 1 room away.
I tried to make the trigger world.send " " at the same time but that didn't work right off cause the trigger was not activating...
It doesn't color the asterik or anything till after the game goes a line past... There must be some way to fix this ... worst case scenario I can think of is a delayed timer working off of the first match and just time it perfectly but that is kinda a mickey mouse way around it I think..
| | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #26 on Sun 11 Jan 2004 05:33 AM (UTC) |
| Message
| Yes. Well the problem here is the Mushclient assume that if the line has not terminated in some way with a linefeed, then there may be more information pending and it won't fire a trigger. Unless you can alter the prompt to end with a /n (a line feed), you are pretty much out of luck. :(
I suggesting in another thread that this wasn't 100% necessary and you could match partial content and simply delay attempts to match most complex lines until more has arrived. If you want it to only match on a completed line, then there are ways to make it look for the end of a line, and both standard and regular expression triggers have a way. Requiring it to recieve one is often a serious problem and using a timer to make it to stop is in this case pretty useless, since the shortest delay you can create is 1 second. There are bound to be a few issues with changing it, but nothing a slight tweaking of a few triggers or a 'use old bahaviour' switch or something for those that stop working right. I suspect it would be a very small number that would completely mess up with such a change. | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #27 on Sun 11 Jan 2004 12:48 PM (UTC) |
| Message
| "you'll just have to deal with that. The correct signals are sent to
indicate that you are at a prompt once the prompt is sent"
I spoke to the sysops about the problem of the prompt line being incomplete and by the time that it is completed that the data is evaluated too late and that was his response.
Theese "correct signals" are they something I can make MUSHClient pickup on and activate the trigger when it realizes it is on a prompt line? | | Top |
|
| Posted by
| WRTIII
Canada (76 posts) Bio
|
| Date
| Reply #28 on Sun 11 Jan 2004 01:33 PM (UTC) |
| Message
| Hmm Also just looking around and trying to figure something out.... in options the option..
Keeps commands on prompt line
That option seems to recognize right off if a line is a prompt line or not..
Could maybe not incorparate something like that
If this line = a prompt line than check current output for a match instead of waiting for new line
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #29 on Sun 11 Jan 2004 08:20 PM (UTC) |
| Message
| It doesn't know a prompt line. All that option does is start the *next* line (ie. what you type) at the end of the previous line, if the previous line does not have a line feed.
This subject must have been covered 100 times in the forum by now - trigger matching on lines before the newline appears. The problem is *when* do you match the trigger, given that TCP/IP breaks data up into packets.
Say you get a line:
The PontNotre Dame is to the north. The Rue de Geur is to the east.\n
But, because of TCP/IP packets it is broken into two packets, namely:
1: The PontNotre Dame is to
2: the north. The Rue de Geur is to the east.\n
(Where \n indicates a newline).
If the trigger fires after the first packet, then it gets an incomplete line, and the words "the north" will not be processed, and the trigger match will be wrong.
As Shadowfyr says you can use timers, as described elsewhere, to simulate this partial-line matching. A timer firing every second would not introduce a huge delay, and that could look for if:
* the last line does *not* have a newline
* the last line starts with an asterisk
Then it could process the previous description.
However you would need to combine it with the normal trigger, because it only takes someone in the room to say something, and the line *will* be completed, as the MUD outputs the "say" data.
|
- 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.
106,872 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top