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


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Mon Nov 26, 2007 7:41 pm   

Gagging
 
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
The key to the Malaccan palace lies here.
On the ground is a little vial of healing magic.
A polished-blue breast plate sits alone here....It is in excellent condition.
A pair of blue arm plates lies here....It is in excellent condition.
A polished-blue breast plate sits alone here....It is in excellent condition.
A pair of dusty old rawhide leggings lay forgotten....It is in excellent condition.
A polished-blue breast plate sits alone here....It is in excellent condition.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.





Is there any way to gag it to where it will display like:
(4) On the ground is a little vial of healing magic?

Any help will be appricated!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 27, 2007 6:30 pm   
 
There's probably somethnigs that can be done but we'll need more information. A full room description including prompt would be needed at minimum.

Since all the the lines aren't guaranteed to be right after each other (as is the case with "On the ground is a little vial of healing magic.") Then it get's a little trickier.

Basically after you get your room description and exit line, you need to gag every line and place it in a record variable with a value of 1.
You increment the value each time you receive the line.

After you get your prompt you gag it and disable the trigger that was doing all the capturing, write out the lines the way you want and write the prompt again.

That's the high level approach. I hope that helps.
_________________
Asati di tempari!
Reply with quote
DaraisDarkwave
Beginner


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Tue Nov 27, 2007 6:44 pm   
 
Tech wrote:
There's probably somethnigs that can be done but we'll need more information. A full room description including prompt would be needed at minimum.

Since all the the lines aren't guaranteed to be right after each other (as is the case with "On the ground is a little vial of healing magic.") Then it get's a little trickier.

Basically after you get your room description and exit line, you need to gag every line and place it in a record variable with a value of 1.
You increment the value each time you receive the line.

After you get your prompt you gag it and disable the trigger that was doing all the capturing, write out the lines the way you want and write the prompt again.

That's the high level approach. I hope that helps.



Thank you for replying Tech and i see what you are trying to explain to me, but me being a noob at zmud scripting i have no idea where to start...i have so far only made simple scripts like Kill Count and Gold counting....if you can point in me the right direction or show me a link where i can learn how to write the script i would be more than glad to read the info you give me :-)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 27, 2007 6:51 pm   
 
Tell you what, post a few full room descriptions, i.e. from prompt to prompt and we'll see what we can come up with. In the mean while look at the following commands and special variables.

#GAG, #ADDKEY, Predefined Variables, #TRIGGER and #SHOW.
_________________
Asati di tempari!
Reply with quote
DaraisDarkwave
Beginner


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Tue Nov 27, 2007 6:54 pm   
 
Tech wrote:
Tell you what, post a few full room descriptions, i.e. from prompt to prompt and we'll see what we can come up with. In the mean while look at the following commands and special variables.

#GAG, #ADDKEY, Predefined Variables, #TRIGGER and #SHOW.


The Western Tower of the KFU Castle
Armagadeon, Destruction, Annihlation are just a few words to describe
what occurs in this room. By the powerful magic of some KFU members,
waves of helpless victims are summoned here and slain before they even
realize what is happening to them. Members who venture in here to gain
experience are pushed to near insanity and beyond, so how do you
think you can survive, when so many weak members fall victim to the
awesome magic that lives in this room.
Exits: down.
A blue wizard's hat lies here.(invisible)...It is in excellent condition.
A glowing potion rests here.
A vial of blistering red hot liquid lies here, abandoned.
a vial of red slime rests on the ground here.
A sturdy pair of snow boots lean upon a nearby wall...It is in excellent condition.
You see an opal ring here....It is in excellent condition.
A blue potion has been left here.
A small golden vial rests here.
Some bits of human flesh are rotting on the floor here.
a frozen puddle of ice lies on the floor....It is in excellent condition.
A cute purple shield is on the floor....It is in excellent condition.
A hideous purple breast plate is lying here with other trash....It is in excellent condition.
a ugly shield with white and purple stripes lies here....It is in excellent condition.
A cute purple shield is on the floor....It is in excellent condition.
A hideous purple breast plate is lying here with other trash....It is in excellent condition.
A cute purple shield is on the floor....It is in excellent condition.
A small cutting of lilac has been left here. It smells very nice.
A interesting stone that ripples white with clear lies here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
A small silver vial rests here.
The key to the Malaccan palace lies here.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.
A mug of dwarven ale sits here.
A mug of dwarven ale sits here.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.
On the ground is a little vial of healing magic.
A top lies here, abandoned
A suit of feathery body armor has been abandoned here...It is in excellent condition.
A small handsome cloak lies trampled in the dirt...It is in excellent condition.
a cute little feathery trinket lies beneath your feet...It is in excellent condition.
A sturdy pair of snow boots lean upon a nearby wall...It is in excellent condition.
A pair of old sandals have been discarded here....It is in excellent condition.
a shiny red apple, waiting to be eaten, is sitting here.
A runed key has been discarded here.
A small, engraved ebony seal is here.
A small, engraved ivory seal lies here.
a gold key inlaid with emeralds has been left here
a diamond studded key has been left here
a single green fig is here.
something worn on your body is lying here in the dirt....It is in excellent condition.
a small cape is lying on the ground.
The key to the Skexie Palace is stuck in the mud.
A Feathered Headdress lies upon the ground...It is in excellent condition.
A small silver vial rests here.
A small silver vial rests here.
The key to the Malaccan palace lies here.
The corpse of the Skexie Altar Boy is lying here.
[ 1] A Feathered Headdress lies upon the ground[5]
the bloody head of the Fledgling Skexie is lying on the ground.
[ 2] A long, curved sabre stands upright in the ground.[23]
[ 3] On the ground is a little vial of healing magic.[19]
A tough looking pair of armlets have been tossed here....It is in excellent condition.
[ 4] A blue wizard's hat lies here.[12]
A silvery key lies here in the dirt.
[ 5] Aegis lies here.[4]
[ 6] A large, chunky looking key lies here.[5]
[ 7] A complicated looking key is buried here in the dust.[3]
[ 8] A grey, intricately woven piece of cloth lies here.[5]
[ 9] A steel longsword lies here glinting in the sunlight.[4]
[10] The One Ring is here.[4]
[11] A pair of bronze leggings is lying on the ground.[4]
[12] Sting lies here.[4]
[13] A small boulder is here, covered in mucus and slime.[8]
[14] A suit of feathery body armor has been abandoned here[5]
[15] A small handsome cloak lies trampled in the dirt[5]
[16] a cute little feathery trinket lies beneath your feet[5]
[17] The key to the Skexie Palace is stuck in the mud.[4]
A glowing red turban lies in a heap on the ground....It is in excellent condition.
A small pair of ivory dice has been tossed here.
[18] A lovely yellow dress is here getting soiled.[7]
[19] A large, blue-tinted iron shield has been left here.[2]
[20] The mysterious devil rod lies on the floor.[4]
[21] A small silver vial rests here.[5]
[22] A pristine silver flute skips around happily![3]
[23] A sharpened pike made from ice lies here defrosting.[4]
[24] A sturdy pair of snow boots lean upon a nearby wall[3]
[25] A strange-looking contraption, it seems to fire a projectile from a muzzle.[7]
[26] A top lies here, abandoned[3]
[27] A small golden vial rests here.[2]
A small bag.
A nice looking purple sword is in the corner.
[28] The key to the Malaccan palace lies here.[2]
[29] A silvery blue wand has been dropped in the dirt[4]
something worn on your body is lying here in the dirt....It is in excellent condition.
a Silvery Fur Cloak has foolishly been left here....It is in excellent condition.
An ornate feathered belt lies here...It is in excellent condition.
[30] A tin of iron rations lies here.[2]
[31] Some dry rations lie here.[2]
[32] A hunk of cheese lies here.[2]
[33] A suit of ringmail lies here.[3]
[34] A buckler lies here.[2]
A pair of studded leather pants lies here....It is in excellent condition.
[35] An elven chain shirt lies here, crumpled on the ground.[2]
A pair of bronze sleeves is lying on the ground....It is in excellent condition.
A large chain of keys hangs on the wall
A runed dagger, almost hidden from sight, lies here.
A great dragon dark as night puts fear into your heart.
The Great Black Dragon is a member of [KFU]
The Great Black Dragon glows with a bright light!
The Great Black Dragon is hovering above the ground.
There appears to be a HUGE man made out of solid earth standing here.
An earth prince is a member of [KFU]
An earth prince glows with a bright light!
An earth prince glows with a red light!
An earth prince is hovering above the ground.
An earth prince is surrounded by a black sphere!
The vulture (pet) is resting here. [2]
The Super Repair Guy (pet) is sleeping here.

H:229 M:432 V:347 >

The Display is kind of long im sorry for this but this is how it shows in my zmud...(hints why i want to make it shorter :P) and as far as reading those i will jump right on them so i don't have to bother you guys that much ;)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Nov 27, 2007 6:57 pm   
 
EDIT: Ninja'd twice, but hopefully this is still relevant. Definitely pester your MUD admins to implement this themselves - surely they can see as well as anyone that that is simply horrific.

This script is almost certainly going to be more hassle than it's worth. Pester your MUD admins and get them to implement this kind of sorting on the server side.

If you're impatient, or if your MUD admins are dirty scoundrels, then solving this problem is going to be quite tricky. Expanding on Tech's idea of using a data record variable:

We really need an entire room description, preferably a few so we know how it looks. The basic principle will be that you'll have two triggers, one that says "This is where the items in the room begin" and one that says "This is where the items in the room end". Depending on the format of your room description, it might be a number of things, but it'll probably be the exit line to begin the items in the room and then your prompt to end the list of things in the room. You'll have two triggers for those:

#trig {Exit Line} {#t+ ItemCapture;RoomItems=""}
#trig {Prompt} {#t- ItemCapture}

These enable and disable the ItemCapture trigger that we'll be using to create a list of the items in the room. The first trigger also clears the list of things in the room, so that it's rebuilt from scratch. The capture trigger will look something like this:

#trig {(*)} {#if (%db(@RoomItems,"%1")) {#addkey RoomItems {%1} {%eval(%db(@RoomItems,%1)+1)}} {#addkey RoomItems {%1} 1};#gag}

What this does is check to see if we've already recorded the line that's been captured. If it's been seen before, it increments the counter for that line. If it hasn't, it creates a new counter for that line. It then gags the line.

Now that you've got a data record variable with a list of things in the room, you need to print out your own list of things in the room. You'd do this something like so:

#loopdb @RoomItems {#say (%val) %key}

Which will print out the value (the number of times the line was seen) in brackets, followed by the line itself.

Note that I haven't tested any of this code, and it's likely not to work. I give it to you purely to demonstrate in more detail the principles that Tech was describing.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
DaraisDarkwave
Beginner


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Tue Nov 27, 2007 7:08 pm   
 
Fang Xianfu wrote:
EDIT: Ninja'd twice, but hopefully this is still relevant. Definitely pester your MUD admins to implement this themselves - surely they can see as well as anyone that that is simply horrific.

This script is almost certainly going to be more hassle than it's worth. Pester your MUD admins and get them to implement this kind of sorting on the server side.

If you're impatient, or if your MUD admins are dirty scoundrels, then solving this problem is going to be quite tricky. Expanding on Tech's idea of using a data record variable:

We really need an entire room description, preferably a few so we know how it looks. The basic principle will be that you'll have two triggers, one that says "This is where the items in the room begin" and one that says "This is where the items in the room end". Depending on the format of your room description, it might be a number of things, but it'll probably be the exit line to begin the items in the room and then your prompt to end the list of things in the room. You'll have two triggers for those:

#trig {Exit Line} {#t+ ItemCapture;RoomItems=""}
#trig {Prompt} {#t- ItemCapture}

These enable and disable the ItemCapture trigger that we'll be using to create a list of the items in the room. The first trigger also clears the list of things in the room, so that it's rebuilt from scratch. The capture trigger will look something like this:

#trig {(*)} {#if (%db(@RoomItems,"%1")) {#addkey RoomItems {%1} {%eval(%db(@RoomItems,%1)+1)}} {#addkey RoomItems {%1} 1};#gag}

What this does is check to see if we've already recorded the line that's been captured. If it's been seen before, it increments the counter for that line. If it hasn't, it creates a new counter for that line. It then gags the line.

Now that you've got a data record variable with a list of things in the room, you need to print out your own list of things in the room. You'd do this something like so:

#loopdb @RoomItems {#say (%val) %key}

Which will print out the value (the number of times the line was seen) in brackets, followed by the line itself.

Note that I haven't tested any of this code, and it's likely not to work. I give it to you purely to demonstrate in more detail the principles that Tech was describing.



I tried your script out and impleted some of my knowledge and it just crashed my zmud...don't know what happened i just typed look and the whole zmud froze my OS
Reply with quote
DaraisDarkwave
Beginner


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Tue Nov 27, 2007 7:22 pm   
 
Thank you all for trying to help me, i have gotten so frustrated with this one i just will talk to the Admin to see if he will do the fixing on his end...Im moving on to another script...
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Nov 29, 2007 8:33 pm   
 
I finally got a chance to work on this for you. Copy this code into CMUD 2.13 and you will be all set.

It's a modification of the idea Fang post. They are issues with using the room name as keys, so this it's a little different but the basic idea is the same.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="ExitLine" priority="60">
    <pattern>Exits:</pattern>
    <value>#T+ ItemCapture
RoomItems=""</value>
  </trigger>
  <trigger name="ItemCapture" priority="70" trigontrig="false" enabled="false">
    <pattern>^(*)$</pattern>
    <value>#local $keyName, $tempRec
#IF (%match( %1, "Exits:")) {#exit}
#IF (%match( %1, "H:%d M:%d V:%d")) {#exit}
$keyName=%subregex( %1, "(\[\s?\d+\] )(.+)(\[\s?\d+\])", %pat( 2))
$keyName=%subchar( $keyName, " .,<>/?';:[]\|}{`~-_=+)(*&amp;^%$#@!", "")
$tempRec = %db( @RoomItems, $keyName)
#if ($tempRec) {
  $tempRec = %addkey( $tempRec, Count, %eval( %db( $tempRec, Count)+1))
  #addkey RoomItems $keyName %addkey( $tempRec, Count, %eval( %db( $tempRec, Count)+1))
} {
  $tempRec=%addkey( $tempRec , Desc , %1)
  $tempRec=%addkey( $tempRec , Count , 1)
  #addkey RoomItems $keyName $tempRec
}
#gag</value>
  </trigger>
  <trigger name="Prompt" priority="35" trigontrig="false">
    <pattern>(H:%d M:%d V:%d*)</pattern>
    <value>#T- ItemCapture
#gag
#local $tempRec
#LOOPDB @RoomItems {

  $tempRec  = %val
  #IF (%db( $tempRec, Count) > 1 ) {#show ~(%db( $tempRec, Count)~) %db( $tempRec, Desc)} {
    #show %db( $tempRec, Desc)}
  }
#show ""
#show %1
</value>
  </trigger>
</cmud>


A couple of notes. The prompt Trigger must have a higher priority (i.e. a lower priority number) the the ItemCapture trigger but I've coded it so it won't matter.
_________________
Asati di tempari!
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Thu Nov 29, 2007 9:05 pm   
 
Cough, Tech, Cough, BAD!!
This is the zMUD forum and he is using zMUD!
Your cMUD script isn't going to help him all that much ;)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Nov 30, 2007 9:00 am   
 
Doh!! Doh!! Doh!!

No matter how carefully I check I always seem to miss one once a month. Well I down coverted the code for zMUD. here it is.

Code:
#TRIGGER "ExitLine" {Exits:} {#T+ ItemCapture;RoomItems="";keyName="";tempRec=""} "" {notrig}
#TRIGGER "ItemCapture" {^(*)$} {#IF (%match( %1, "Exits:")) {#abort 1};#IF (%match( %1, "H:%d M:%d V:%d")) {#abort 1};keyName=%subregex( %1, "(\[\s?\d+\] )(.+)(\[\s?\d+\])", %2);keyName=%subchar( @keyName, " .,<>/?';:[]\|}{`~-_=+)(*&^%$#@!", "");tempRec = %db( @RoomItems, @keyName);#if (@tempRec) {#addkey tempRec Count %eval( %db( @tempRec, Count)+1));#addkey RoomItems @keyName %addkey( @tempRec, Count, %eval( %db( @tempRec, Count)+1))} {#addkey tempRec Desc "%1";#addkey tempRec Count 1;#addkey RoomItems @keyName @tempRec};#gag} "" {notrig|disable}
#TRIGGER "Prompt" {(H:%d M:%d V:%d*)} {#T- ItemCapture;#gag;#VAR tempRec, temp;#LOOPDB @RoomItems {tempRec = %val;#IF ((%db( @tempRec, Count) > 1)) {#show ~(%db( @tempRec, Count)~) %db( @tempRec, Desc)} {#show %db( @tempRec, Desc)}};#show "";#show %1} "" {notrig}
_________________
Asati di tempari!
Reply with quote
DaraisDarkwave
Beginner


Joined: 09 Nov 2007
Posts: 28
Location: Fairbanks, Alaska

PostPosted: Fri Nov 30, 2007 7:08 pm   
 
Tech wrote:
Doh!! Doh!! Doh!!

No matter how carefully I check I always seem to miss one once a month. Well I down coverted the code for zMUD. here it is.

Code:
#TRIGGER "ExitLine" {Exits:} {#T+ ItemCapture;RoomItems="";keyName="";tempRec=""} "" {notrig}
#TRIGGER "ItemCapture" {^(*)$} {#IF (%match( %1, "Exits:")) {#abort 1};#IF (%match( %1, "H:%d M:%d V:%d")) {#abort 1};keyName=%subregex( %1, "(\[\s?\d+\] )(.+)(\[\s?\d+\])", %2);keyName=%subchar( @keyName, " .,<>/?';:[]\|}{`~-_=+)(*&^%$#@!", "");tempRec = %db( @RoomItems, @keyName);#if (@tempRec) {#addkey tempRec Count %eval( %db( @tempRec, Count)+1));#addkey RoomItems @keyName %addkey( @tempRec, Count, %eval( %db( @tempRec, Count)+1))} {#addkey tempRec Desc "%1";#addkey tempRec Count 1;#addkey RoomItems @keyName @tempRec};#gag} "" {notrig|disable}
#TRIGGER "Prompt" {(H:%d M:%d V:%d*)} {#T- ItemCapture;#gag;#VAR tempRec, temp;#LOOPDB @RoomItems {tempRec = %val;#IF ((%db( @tempRec, Count) > 1)) {#show ~(%db( @tempRec, Count)~) %db( @tempRec, Desc)} {#show %db( @tempRec, Desc)}};#show "";#show %1} "" {notrig}


I inserted the script and every time a kill was made the code forced me to look...waz up with that? XD
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Nov 30, 2007 11:51 pm   
 
Not sure what that is, but unless you have another trigger firing off of the output I don't know why that would happen. This code doesn't fire off on kills commands and doesn't even issue the look command. the must be something else at work. You try disabling the triggers to confirm this.
_________________
Asati di tempari!
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