Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 6:09 pm   

Room Contents Parser
 
I'm having some intermittant trouble with a Room Contents parser, Any clue why its not matching as important correctly all the time?
It seems to be a speed related issue because when I run a #SH on the example of "Fails to match", it matches, but when I encounter the situation live it doesnt?

Suggestions appreciated.


Variable Data for example of problem:
#var currentlongdescs_descs {The screaming, filthy harpy claws madly at your face!|A footpad slinks through the shadows.|A female Wood Elf walks around holding a glowing healing orb.|An Elite Royal Guard stands here smiling happily.|A dark elf female is praying here.|A dolphin is here swimming around in this clear blue water.|A rather large rock toad sits here, croaking loudly.|A child is here eating bugs off the ground.|A construction worker is here working riveting framework.}

#var serv_namesbydesc ""
#addkey serv_namesbydesc {The screaming, filthy harpy claws madly at your face!} {oldstyle harpy}
#addkey serv_namesbydesc {A footpad slinks through the shadows.} {footpad}
#addkey serv_namesbydesc {A female Wood Elf walks around holding a glowing healing orb.} {wood elf healer fighterwood}
#addkey serv_namesbydesc {An Elite Royal Guard stands here smiling happily.} {oldstyle royal guard elite}
#addkey serv_namesbydesc {A dark elf female is praying here.} {dark elf female}
#addkey serv_namesbydesc {A dolphin is here swimming around in this clear blue water.} {dolphin}
#addkey serv_namesbydesc {A rather large rock toad sits here, croaking loudly.} {oldstyle toad rock}
#addkey serv_namesbydesc {A child is here eating bugs off the ground.} {child}
#addkey serv_namesbydesc {A construction worker is here working riveting framework.} {oldstyle construction worker female}

#TRIGGER "RomCol" {~[Exits~:(*)~]} {#var RoomCon_Lines 0;#var nummob 1;#var num_mobs_here_serv 0;#var Mobs_here_serv "";#t+ RoomCon_2;#state [RoomCon] 1}
#COND {~<} {#t- RoomCon_2;#state [RoomCon] 0}


#CLASS {RoomCon_2}
#TRIGGER {^(*)$} {
#VAR linetest {~"<%1>~"}
#add RoomCon_lines 1
#var isimportantline -2
#var importantlinematched ""
#var curlong_test ""
#forall @currentlongdescs_descs {
#if @isimportantline=-2 {
#if %ends( "%1", "%i")=1 {#var isimportantline 1} {#var isimportantline -2}
#if @isimportantline=1 {#var importantlinematched %ismember( "%i", @currentlongdescs_descs)} {#NOOP}
} {#NOOP}}
#if @isimportantline=1 {
#add num_mobs_here_serv 1
#VAR Mobs_here_Serv %addItem( @Nummob~.%db( @serv_namesbydesc, %item( @currentlongdescs_descs, @importantlinematched)), @Mobs_here_Serv)
#add nummob 1
} {
#VAR Mobs_here_Serv %addItem( UNIMPORTANT, @Mobs_here_Serv)
#add num_mobs_here_serv 1
}
}
#CLASS 0


Should both match as important on this line "(Target) An Elite Royal Guard stands here smiling happily."

Fails to match:


West Main Street
You are strolling on the street between Nabil's Exotic Animals and the
general store. To the west you hear a roadcrew at work and to the East, the
sounds of commerce taking place. The air is filled with the smell of gold
and riches. On the wall of the store is a poster.

[Exits: north east west]

A guard stands here, protecting the innocent.
A nomad merchant looks you over.
(Target) An Elite Royal Guard stands here smiling happily.

<82/82hp 199/199m 150/150mv> <Exits:NEW> <Qst: 8 TNL: 1292> <ROOM: West Main Street >


Matches:


West Main Street
You are strolling on the street between Nabil's Exotic Animals and the
general store. To the west you hear a roadcrew at work and to the East, the
sounds of commerce taking place. The air is filled with the smell of gold
and riches. On the wall of the store is a poster.

[Exits: north east west]

(Target) An Elite Royal Guard stands here smiling happily.

<82/82hp 199/199m 150/150mv> <Exits:NEW> <Qst: 12 TNL: 1292> <ROOM: West Main Street >

Matches:

The Western Market Square
This area of the square seems a bit more subdued than the rest. You
notice that most of the outland adventurers mill around the southern
end of the market, while the townfolk seem to keep their business in
the northern end. West Main Street begins here and heads for the
gate. The market's expanse fills the other directions.

[Exits: north east south west]

(Target) An Elite Royal Guard stands here smiling happily.
A nomad merchant looks you over.

<82/82hp 199/199m 58/150mv> <Exits:NESW> <Qst: 17 TNL: 1286> <ROOM: The Western Market Square >
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 8:21 pm   
 
I think I solved my own problem, by adding a #wait 150 to the begining of the script for ^(*)$
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Dec 15, 2005 8:45 pm   
 
Actually, you'll discover that #WAIT will create more problems.
_________________
EDIT: I didn't like my old signature
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Fri Dec 16, 2005 1:00 am   
 
Yes, you're right, #wait made it impossible to link the room number to anything useful.
Help Still needed.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Fri Dec 16, 2005 1:23 am   
 
#alarm +.15 try
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Fri Dec 16, 2005 2:18 am   
 
Tried alarm, still doesnt work, all items get parsed as if they came from different lines but the same line #.
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Fri Dec 16, 2005 2:35 am   
 
er, not room number to anything needed, Line #er. -sage-
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Fri Dec 16, 2005 4:25 am   
 
Minimum time on an alarm I believe is 0.5 seconds, so 0.15 won't work.
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Fri Dec 16, 2005 4:44 am   
 
yeah, fiddled with that alarm timer, still processed as if they came from different lines but the same line #.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Dec 16, 2005 9:12 am   
 
I don't see the trigger referenced by "#state [RoomCon] 1".
Brackets not required in "#state [RoomCon] 1".
Change "#forall @currentlongdescs_descs {" to "#PRIORITY {#forall @currentlongdescs_descs {" and add the neccessary closing brace.

That should do for a start. I would suggest a few other little things like: directly capturing the lines into a variable, this eliminates the use of %1 and allows better control of expansion; you could probably eliminate that #forall entirely, I really can't see how it is needed but you didn't include all the variables or triggers in your post.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Fri Dec 16, 2005 5:27 pm   
 
k, fixed the inital trigger

#TRIGGER "RomCon" {~[Exits~:(*)~]} {#var RoomCon_Lines 0;#var nummob 1;#var num_mobs_here_serv 0;#var Mobs_here_serv "";#t+ RoomCon_2;#state RoomCon 1}
#COND {~<} {#t- RoomCon_2;#state RoomCon 0}

The forall I believe is necessary because I need to know if the line matches ANY of the elements in @currentlongdescs_descs, and if so, which one, so I can check @serv_namesbydesc, and see what the items 'name' is.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Dec 16, 2005 11:31 pm   
 
Use %ismember instead and assign the result to a temporary variable.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Sat Dec 17, 2005 5:54 am   
 
does ismember work on partial lines though? I'm matching on the end of a line to eliminate flags on mobs and things.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Mon Dec 19, 2005 11:39 pm   
 
i have many alarms that use +.01
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Tue Dec 20, 2005 6:58 am   
 
I was recalling a post by Vijilante, which I see was a couple years ago.
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=13248

I suppose updated versions don't have the 0.5 second limit. Good to know.
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net