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


Joined: 15 Oct 2002
Posts: 10
Location: Poland

PostPosted: Sat Mar 08, 2003 5:11 pm   

adding name to description
 
Greetings!

I have a problem with such thing:
I've made a list of players who I don't have remembered in mud (so I see their description instead of name). Now, I'd like to make a trigger which would add a name in brackets after the description whenever a it shows on screen. I imagine I could do it simply by making a trigger for every name, but it would take a lot of time (about 200 names now) and it would probably be much more useful to make a database with those descriptions and names and make a trigger use it.

Descriptions look like this:
1adj 2adj gender race

Can anyone help me? I have no clue how to use databases in zmud.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Sat Mar 08, 2003 7:58 pm   
 
Sorry no help for you because i think your going to have to clarify somethings.
1) 1adj 2adj gender race (name),is this what you want?
you see I don't think your comeing across clearly,it seems you have this stuff stored but don't remember there names so you want Zmud to see a discription and match it to one stored and then add the name of the character to it.?

2)how do you get the discription what is the command or the trigger?
In my gami it is, look character but yours is probablly different.

____________________________________________
I've made a list of players who I don't have remembered in mud (so I see their description instead of name).
____________________________________________
what exactly does this mean ? you have a list of characters that ?

see what i mean?

Give the forum a real example everything from what you type first or the trigger that starst what you have now and give everything you got now then a scetch for what you want to get from it or to it and
I am sure me or one of the many brilliant people here would love to help

megamog75
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sat Mar 08, 2003 8:38 pm   
 
I'm assuming 1adj and 2adj are single words? In that case you can use this method:

You'll need to open a new database. click the database button, then new, then choose no template. Add the following fields:
  • name as text

  • desc as text


then add this trigger:

#TRIGGER {(%w %w %w {human|elf|dwarf|halfling})} {#loopview {#if ("%1" =~ &desc) {#sub {%1 ~[&name~]};#abort 1}}}

except change the red stringlist to the list of races a person can be. You can also replace the blue %w with a string list of gender possibilites if you like, {man|woman} , maybe.

and this alias:

#ALIAS addp {#var new "";#addkey new name {%1};#addkey new desc {%-2};#var old {%find( @new.name, All)};#echo @old;#if (@old) {#show %ansi( red) @new.name is already in the database.;#dbput @old @new;#show %ansi( red) Description updated to @new.desc} {#new All @new;#show %ansi( blue) @new.name added as @new.desc}}


Use the alias to add a person to the database like this:
addp Emit strong helpful man human

and then any occurences of:
strong helpful man human
will be replaced by:
strong helpful man human [Emit]


--edit--
OH i forgot to add, you must leave/have the database window open for these to work.
--------

moon.icebound.net:9000
Reply with quote
romciom
Beginner


Joined: 15 Oct 2002
Posts: 10
Location: Poland

PostPosted: Sun Mar 09, 2003 2:04 am   
 
Thanks, the trigger above works, though only in Zmud 6.53. I can't make it work in 6.05, does anybody know why?
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sun Mar 09, 2003 3:18 am   
 
looking at the version history, there was a syntax fix to #loopview in version 6.09

Thats the only thing i found that might cause it. is the process breaking down in the trigger or in the alias? If trigger, you could eliminate #loopview and use a combination of #while, #dbfirst, and #dbnext, these appear to be working properly as of version 6.03. It might look something like this

#TRIGGER {(%w %w %w {human|elf|dwarf|halfling})} {#dbfirst;#while (%rec) {#if ("%1" =~ &desc) {#sub {%1 ~[&name~]};#abort 1};#dbnext}}

--------

moon.icebound.net:9000
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