|
Gatekeeper Beginner
Joined: 22 Jul 2002 Posts: 15 Location: USA
|
Posted: Sun Dec 08, 2002 2:32 am
Parsed database file |
I'm fairly certain that I've successfully written more complicated triggers in the past, but I know very little about how the database feature on ZMud works. So I'd appreciate anything you can toss my way to help me get started. I'm running the most current beta of the client, so I do have access to trigger states (and use them often).
I want to set up a script to parse names from a who list and match them with a character database before sorting the player names by their class. Names not in the database should be listed as class "Unknown". Also if possible, I'd like this to replace the traditional who display via #gag.
An example of the who list would be:
H:3566 M:2075 B:100% [eb]qwho
Jael, Akuen, Ferow, Samantha, Darkninjo, Khepri, Serra, Ian, Daganev, Vhaillor,
Isabel, Asynth, Wynter, Gartaa, Zephy, Raiden, Kirian, Xizor, Pete, Ciani,
Rohan, Excenel, Saltzmaul, Turin, Mimique, Chromelotus, Caelin, Landara,
Airyizia, Felicia, Achavis, Zorn, Iereas, Mycelan, Gaea, Veovis, Ryudo, Ansury,
Kiansha, Ryusa, Fleur, Scane, Drahz, Jenny, Takara, Alar, Bassik, Tzalishan,
Pjoll, Celene, Zanthia, Melicent, Zendo, Elanoria, Vorlus, Faris, Kitania, Katt
, Alcadizaar, Espi, Saige, Aeron, Delak, Therapy, Alkaiser, Ebvory, Allanon,
Octavian, Arienne, Nicholai, Nightshadow, Miyamoto, Moyra, Daelar, Xijin, Hucky
, Freya, Dolor, Worton, Anaphiel, Relandroc, Azul, Matoko, Empathy, Zahmekoses,
Adicus, Koltan, Malaeda.
I've been collecting names and classes in a database "Players" for a while now. Rather straightforward, it has two data fields. "Name" and "Class". The biggest hurdle I have at the moment is finding how zmud takes variables and matches them with the database. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Dec 08, 2002 3:42 pm |
You should first grab all of the names into a stringlist and gag the output. Next, after you have the names in the stringlist, loop through each item and find it's corresponding class in the database by using %query, %dbget, and %db. This is all assuming, of course, that each name is unique in the database and there are no repeats. Then, as you find each associated class (or not find it as the case may be) you display the name and the class of the player on a separate line. Here's an example where all of the names have been captured into the @who stringlist:
#FORALL @who {#VAR class %db(%dbget(%query((&Name = %i), All)), "Class");#VAR class %if(@class, @class, "Unknown");#SH %format("&15.0s &10.0s", %i, @class)}
Kjata |
|
|
|
|
|
|
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
|
|