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
mercatroid
Wanderer


Joined: 06 Dec 2004
Posts: 59

PostPosted: Sun Feb 04, 2007 8:15 am   

Database issue
 
zMud 7.21, WindowsXP

The following doesn't work:
Code:
#Trigger {Info: (%w) has entered the game}
  {#IF (!%db(%1,@Name.playerdb)) {
    Query %1;
    #NEW All {Name=%1|Class=@Playerclass|Clan=@Playerclan}}

Just to avoid confusion: the mudcommand "Query", returns in the following format:
Quote:
Name: Bob
Class: Mage
Clan: Forsaken

And I already have another trigger that captures that information and puts it in the @Playerclass and @Playerclan variables just fine.

The rest of it works too, except that it doesn't actually check if the player is already there. It always adds a new record with the player's name/class/clan, so I guess it's the part that checks if they're there first that's broken.

Any suggestions?

*Edit: After reading through the forums a bit more, I found this post. Kjata suggests trying the following:
Code:
#IF (%numitems(%query(((&Name = @name) & (&Level = @level) & (&Race = @race)), All)) = 0) {Record is unique, add record to the database}
Assuming the variables @name, @level, and @race have assignments. This seemed to work for the guy who started the topic, but it doesn't for me (changing only the variables involved).

I'm doing -something- wrong, obv...anyone know what?
Reply with quote
mercatroid
Wanderer


Joined: 06 Dec 2004
Posts: 59

PostPosted: Sun Feb 04, 2007 12:25 pm   
 
Hah...Nevermind...Kjata's code works...

When changing it to fit my variables, I erased the space before the first { of the true section of the IF-THEN statement.

Thanx Kjata for your unwitting help! :)

Btw, I figured out that @Name.playerdb is not the right way to address a database column, but pretty much no other syntax I tried worked with the #IF (!%db()){} format either.

Merc
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