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
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 04, 2002 5:41 pm   

help needed ;)
 
Erroneously posted to the finished script forum: Siroko
quote:

I need some help on a trigger i am trying to make:
On my mud when i enter a room i see something like :

Halfway down Sweetheart Lane [w,e].
Ivan and a smiling mugger are standing here.

Now here Ivan is a player and mugger is a npc,what i want to do is colour the npc in let's say blue,but only in the room description,meaning when i start a battle or someone is already fighting the npc it doesnt get coloured.

Thanks in advance. ;)





TonDiening
Beta Upgrading to 6.26
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 04, 2002 5:54 pm   
 
Halfway down Sweetheart Lane [w,e].
Ivan and a smiling mugger are standing here.

Where: Ivan is a player and mugger is a npc


Let me make sure I understand you correctly,
you want to colour the npc in blue only in
when you are travelling through a room and
not when you are fighting or someone is fighting
that npc.

If that is correct, we would need to see
examples of mud out for:

When you are fighting that npc and
when someone else is fighting that npc when
you just look in the room.


//

Having said that, if you trigger on the highlighted
area in red:

Ivan and a smiling mugger are standing here.

You'll be able to reduce the coloring.

However the trigger that I can think of
would be slow and would involve parsing to
find out what was in front of the
{is|are} standing here. as the mud
output stacks all the npc/players into that one line.

TonDiening
Beta Upgrading to 6.26
Reply with quote
Siroko
Newbie


Joined: 04 Mar 2002
Posts: 3

PostPosted: Mon Mar 04, 2002 6:38 pm   
 
oh i see :)
Please tell me how to do that ;)
I dont mind if its slow as long as it works,the bad thing is i cant make the trigger by myself ;)
Ah and another thing,its not always a single line it may be something like :

Somewhere in the Shades [5,1,6,4,3,2].
A scary mugger, Ivan,a terrifying troll,a lumbering troll,two looming trolls,a deadly fighter,a mean mercenary,two troll warriors,a wandering warrior and a huge dwarf warrior are standing here.

Thanks again ;)
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 04, 2002 6:58 pm   
 
-[-c-o-d-e-]
Somewhere in the Shades [5,1,6,4,3,2].
A scary mugger, Ivan,a terrifying troll,a lumbering troll,two looming trolls,a deadly fighter,a mean mercenary,two troll warriors,a wandering warrior and a huge dwarf warrior are standing here.
-[-/-c-o-d-e-]

Excellent it is all on one line.

TonDiening
Beta Upgrading to 6.26
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 04, 2002 7:50 pm   
 
Heh Lightbulb didn't answer it ;)
He tends to be more succint and more to the
point of the issue!

Here goes nothing.

I hope I can rip from the exit line and not
cause you grief:

Trigger: ~].$(%*) {is|are} standing here.$
Script:


#GAG
#VAR LivingRoomList %replace( %replace( "%1", ",", "|"), " and ", "|")
#VAR LivingRoomSub ""
#FORALL @LivingRoomList {
#IF (%numwords( %i) > 1) {
#NOOP NPC
#VAR LivingRoomSub %concat( @LivingRoomSub, "%ansi(blue)", %i, ", ")
} {
#NOOP PC
#VAR LivingRoomSub %concat( @LivingRoomSub, "%ansi(red)", %i, ",")
}
}
#SAY @LivingRoomSub


TonDiening
Beta Upgrading to 6.26
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 04, 2002 7:59 pm   
 
That is kinda messy. I'm not sure if I could
use #SUB there with all that processing to
I used #GAG and #SAY

I'm hoping it takes the concat with the %ansi()
functions.

It will default , after everything
and defaults to are.

If the above works then try this to see if
it looks "nicer":

Trigger: ~].$(%*) ({is|are}) standing here.$
Script:


#VAR LivingRoomList %replace( %replace( "%1", ",", "|"), " and ", "|")
#VAR LivingRoomLast %item( @LivingRoomList, %numitems( @LivingRoomList))
#VAR LivingRoomSub ""
#FORALL @LivingRoomList {
#IF (%numwords( %i) > 1) {
#NOOP NPC
#VAR LivingRoomSub %concat( @LivingRoomSub, "%ansi(blue)", %i, %case( ((@LivingRoomLast == %i)+1), ", ", " "))
} {
#NOOP PC
#VAR LivingRoomSub %concat( @LivingRoomSub, "%ansi(red)", %i, %case( ((@LivingRoomLast == %i)+1), ", ", " "))
}
}
#SH @LivingRoomSub %2 standing here.


I'm not sure if it will take the %case() though.
I'm guessing it might.

TonDiening
Beta Upgrading to 6.26
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