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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 129

PostPosted: Tue Aug 18, 2020 6:56 pm   

Capturing data
 
Here's an example:-


Code:
You are carrying:
     (Glow) a Pink coloured wig (2)
     (Magic) an ultimate guitar (18)
     a colorful bikini (7)
     a colorful bikini (11)
     a colorful bikini (10)
( 2) a colorful bikini (8)
( 2) a colorful bikini (5)
     a life-size human figure (15)
     (Invis) a "RAYNER" brand sports-bra (1)
( 2) a colorful bikini (6)
     (Magic) a pink flamingo (1)
     a tobacco pouch (5)
     (Magic) a fishing permit (10)
     (Magic) an entry pass (1)
     (Glow) (Hum) a ticket to Mississippi (10)
     (Glow) (Hum) a ticket to Texas (10)
     (K) (Magic) Swift Galleon (1)
( 3) (K) (Magic) (Glow) (Hum) a Bag of Aardwolf (201)
     (K) (Magic) (Glow) (Hum) hide of a hairless cat (55)
( 2) ** Items on Keyring **


What I am after are the items with prefix'd digits at the start of the line. These are multiples of the same item. The bracketed digits at the end are the item level. Having more items within brackets doesn't help with pattern matching.

I am trying to pack away all but one of each item as my Id triggers may be causing application errors, which in turn cause anything in a package outside of the main 'window' to freak out.

for (all multiple items)-1, stow away...BUT...

the last several items are always there, those with (K). So I would wish to avoid those...plus one cannot put a container into a container, but they make pattern matching a headache as we want the first group of (%d) and we want the name, (eg) a colourful bikini, but we don't need the rest of the line.

Any brainy ideas?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4253
Location: Pensacola, FL, USA

PostPosted: Tue Aug 18, 2020 9:27 pm   
 
Well, there is no way to tell which items are containers, that I can tell.
I mean sure, we know that pouches and bags are containers, but we have to tell code somehow.

#TR {{~( ($num:%d)~)|}%s{~(Magic~) |}{~(Glow~) |}{~(Hum~) |}{~(Invis~) }|}($item:*) ~(($level:%d)~)} {Do stuff with $num $item and $level}

If it has the (K) it should not match this trigger.
(Invis) may be in the wrong order if it can appear with other tags.
_________________
Discord: Shalimar#3679
Reply with quote
hpoonis2010
Apprentice


Joined: 18 Jun 2019
Posts: 129

PostPosted: Wed Aug 19, 2020 6:00 am   
 
I think the order is fine...however, not all items invis are humming, not all items that hum are invis, not all items that are either glow.

The containers part is not THAT important as I factored a trigger for "you cannot put <a> into <b>"

However, the documentation stipulates that negated patterns can be used although I am not sure how that works in a trigger.

So, is it not possible to

#TR {search pattern {^sub-pattern} rest of pattern} {actions}

in the trigger?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4253
Location: Pensacola, FL, USA

PostPosted: Wed Aug 19, 2020 11:11 am   
 
Those are all optional tags via:

{~(Glow~) |}

That is an anonymous variable with a null member. It will match weather "(Glow) " is there (with the trailing space), or not.

And yes, negated subpatterns can be used, if you are having an issue with too many matches.
For example:

#TR {"[^"]"} {#CW aqua}

That tells it to look for two quotes, without any quotes between them, to properly match speech and color what was said.
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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