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
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Mon Jun 02, 2003 6:30 am   

color triggers
 

Hi,

I'm trying to make a trigger that will fire everytime I enter or look into a room, and color any names in that room if it matches the names in a string list variable I have. :)

This is a sample of the room text.

A little shrine [ne,s].
Pica, Hulk and Lupen is standing here.

I haven't had luck.

Either it

- keeps on coloring the names everywhere (and not just in the room text)
- or it doesn't fire at all

Also, I tried this

Pattern: ({@temp}) arrives from
Value: #cw red

I can't get it to color just the @temp variable though. It does the whole pattern red.

And finally,

Does a 'may or may not be a word' expression exist?

Like say.

You think it's easy to climb the tree.
You think it's pretty easy to climb the tree.
You think it's very easy to climb the tree.

Is there a way to create an elegant pattern to match all three possibilities without using *?

- Ren
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Mon Jun 02, 2003 8:16 am   
 
quote:

I'm trying to make a trigger that will fire everytime I enter or look into a room, and color any names in that room if it matches the names in a string list variable I have. :)

This is a sample of the room text.

A little shrine [ne,s].
Pica, Hulk and Lupen is standing here.

I haven't had luck.

Either it

- keeps on coloring the names everywhere (and not just in the room text)
- or it doesn't fire at all

Also, I tried this


Pattern: ({@temp}) arrives from
Value: #cw red


Syntax: #CW [pattern] color

So try this instead:
Pattern: ({@temp}) arrives from
Value: #cw %1 red


quote:

And finally,

Does a 'may or may not be a word' expression exist?

Like say.

You think it's easy to climb the tree.
You think it's pretty easy to climb the tree.
You think it's very easy to climb the tree.

Is there a way to create an elegant pattern to match all three possibilities without using *?

- Ren


Perhaps:
Pattern: You think it's {easy|pretty easy|very easy} to climb the tree.

To make it colour certain things in a room description you need to use trigger states.
Something like this might work:
#TRIGGER "roomtrigger" {* ~[*~].} {#temp {^$} {#state roomtrigger 1}}
#COND {({@players})} {#cw %1 blue} {looplines|param=10}

Where players is a list of players.

I hope this helps.

Rorso
Currently using zMUD 6.62
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 02, 2003 3:19 pm   
 
quote:
Pattern: ({@temp}) arrives from
Value: #cw %1 red

If you supply a pattern with #CW you'll create a permanent trigger to color that pattern. This will color whatever just arrived, but it will then continue to color it anywhere it's encountered in the future. I don't think that's what Ren wants. The #PCOL command would be a better choice.

Pattern: ({@temp}) arrives from
Value: #PCOL red %x1

You might also be able to use #PCOL for the room description problem, but limiting it to a list of names would be quite involved. Is it really so important to have the names colored ONLY when they appear in the room description? If you just want all names in the room description highlighted it's fairly simple.
#TR {%w ~[%x~].}
#COND {(*) is standing here.} {#PCOL red %x1}

There is no 'may or may not be a word' wildcard. The * will match most strings of any length (including 0) and might be your best choice.
You think it's *easy to climb the tree.

LightBulb
Advanced Member
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 02, 2003 4:06 pm   
 
It just occured to me to try using #CW in a multi-state trigger. This works quite well.
#VAR temp {Pica|Hulk|Lupen}
#TR {%w ~[%x~].}
#COND {{@temp}} {#CW red} {Within|Param=1}

LightBulb
Advanced Member
Reply with quote
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Tue Jun 03, 2003 2:23 am   
 

Ack Lightbulb, the solution in your last post crashed Zmud.

I get a parse error: Error parsing command, Access violation something something.

- Ren
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 03, 2003 2:57 am   
 
Don't use it then.

I haven't had any trouble with it, but I've only tested it offline.

LightBulb
Advanced Member
Reply with quote
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Tue Jun 03, 2003 3:09 am   
 

Okay. :(

I've been fiddling with it for the past half hour... can't figure out why it keeps crashing.

Ah, will try to think of some other way.

> Is it really so important to have the names colored ONLY when they appear in the room description?

Yeah it is. :)
Thanks.

- Ren
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 03, 2003 12:19 pm   
 
What version of zMUD are you using?

Kjata
Reply with quote
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Tue Jun 03, 2003 6:44 pm   
 

6.62 :)

- Ren
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 03, 2003 9:23 pm   
 
What MUD is this on? I'll risk an online test.

You did enter the script at the COMMAND LINE, using cut-and-paste, didn't you?

LightBulb
Advanced Member
Reply with quote
Ren
Beginner


Joined: 04 Apr 2003
Posts: 27

PostPosted: Thu Jun 05, 2003 11:52 am   
 

Nooooo, I didn't. That must have been where it went bad.

I put #TR {%w ~[%x~].} as the pattern and
#COND {{@temp}} {#CW red} {Within|Param=1} as the value.

It works fine now. Thanks. :)

- Ren
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