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


Joined: 04 Sep 2003
Posts: 25
Location: Singapore

PostPosted: Thu Sep 04, 2003 9:35 pm   

Trigger
 
I want to capture 'hum','magic' & 'burn-proof' and enter it into my database field which is defined as option list.

However it seems nothing happens. It adds 'Extra flags' field in IdItem, but it has no value.

Whats wrong with it?

-------------------------------------------------------
Extra flags: hum magic burn-proof.
---------
Trigger : ^Extra flags: (*).
---------
@TempExtraFlag=%replace( %1, " ", |)
#if %ismember( anti-evil, @TempExtraFlag) {#addItem Extraflag anti-evil}
#if %ismember( anti-good, @TempExtraFlag) {#addItem Extraflag anti-good}
#if %ismember( anti-neutral, @TempExtraFlag) {#addItem Extraflag anti-neutral}
#if %ismember( glow, @TempExtraFlag) {#addItem Extraflag glow}
#if %ismember( hum, @TempExtraFlag) {#addItem Extraflag hum}
#if %ismember( bless, @TempExtraFlag) {#addItem Extraflag bless
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Sep 05, 2003 1:45 am   
 
#ADDITEM creates or adds to a list variable. You'll either need to use #ADDKEY to add to your record variable.
#ADDKEY IdItem ExtraFlags @ExtraFlag

or update it directly using dot-notation (@IdItem.ExtraFlags).
Pattern:
^Extra flags: (*).
Value:
#ADDKEY IdItem ExtraFlags ""
#IF %ismember( anti-evil, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags anti-evil}
#IF %ismember( anti-good, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags anti-good}
#IF %ismember( anti-neutral, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags anti-neutral}
#IF %ismember( glow, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags glow}
#IF %ismember( hum, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags hum}
#IF %ismember( bless, %replace( %1, " ", |)) {#ADDITEM IdItem.Extraflags bless}

I also eliminated @TempExtraFlag. You might prefer to put it back in, since it's easier to follow the script with a single %replace. Note that I started with #ADDKEY to ensure that @IdItem was a record variable with a key named Extraflags.
Reply with quote
ToyBear
Beginner


Joined: 04 Sep 2003
Posts: 25
Location: Singapore

PostPosted: Fri Sep 05, 2003 7:16 am   
 
there is a space in Extra flags.

so how do i type {#ADDITEM IdItem.Extraflags anti-evil}?

can i type #ADDITEM "IdItem.Extra flags" anti-evil}?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Sep 05, 2003 4:55 pm   
 
In that case, it's probably best to accumulate everything in a temp list variable with #ADDITEM, then replace the contents of that field in the record variable using #ADDKEY.

#VAR TempFlags "";#ADDK IdItem ExtraFlags ""
#IF %ismember( anti-evil, %replace( %1, " ", |)) {#ADDI TempFlags anti-evil;#ADDK IdItem {Extra Flags} @TempFlags}
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