 |
mercatroid Wanderer
Joined: 06 Dec 2004 Posts: 59
|
Posted: 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? |
|
|
|
 |
mercatroid Wanderer
Joined: 06 Dec 2004 Posts: 59
|
Posted: 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 |
|
|
|
 |
|
|
|
|
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
|
|