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


Joined: 15 Nov 2004
Posts: 18

PostPosted: Sat Jul 16, 2005 3:14 am   

Getting items from a corpse by looking at database
 
What I want to do is get all the items that are not in my database if something shows in a corpse that I do not have....out put for looking into a corpse is:

The corpse of the goblin holds:
an ornate black scale jacket
studded leather leggings
a pair of spiked mail sleeves
a dark goblin horned helmet
a goblin's shortsword
sharkskin belt


the database name is ident and the field that contains the name is Name....

Thanks!

Thalor
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jul 16, 2005 7:03 pm   
 
I'm assuming your prompt shows up immediately after this list (I'm assuming yes)? Also, are all your items strictly alphabetic or are there special symbols used as well (I'm assuming alphabetic, given your example)? Finally, can a single critter hold duplicate items (I'm assuming yes)?

I'm thinking there's a way to do this via multi-state triggers as well, but I'm not well-versed in many of the state types. Anywho, here's a more basic version:

#trigger {The corpse of the (*) holds:} {#T+ tCorpseItemList;vCorpseItemList = "";vCorpseItemsFound = 1}
#trigger {line that indicates nothing was on the corpse} {vCorpseItemsFound = 0}
#trigger "tCorpseItemList" {%q([a-z ])%q} {vCorpseItemList = %additem("%1",vCorpseItemList)}
#alias CheckCorpseItems {#dbload ident;#query (&Name = %item(vCorpseItemList,1);#if (%null(%rec)) {#new "" Name=%item(vCorpseItemList,1);#delnitem vCorpseItemList 1};#DBCLOSE}

In the prompt trigger, include these lines:
#T- tCorpseItemList
CheckCorpseItems

This is untested, so no guarantees it will even work. However, the three triggers do nothing but populate a stringlist. The first one initializes variables and turns on the capturing trigger. The second one is for those cases when the corpse is empty, no need to check the database then. The third trigger is for any items that might be on the corpse. These are contained in the vCorpseItemList variable to be passed along to the alias. The prompt trigger then shuts down the capturing trigger so that it can't accidentally fire on some other list and executes the checking alias.
_________________
EDIT: I didn't like my old signature
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