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 2:12 am   

Database
 
here the problem

Identify Class

Alias - Id
#Var IdItem ""
#Var TestName ""
#Var Exist ""
identify %1

Trigger - ^Object '(*)' is type (*)
#ADDKEY IdItem {Name=%1|Type=%2}

Trigger - ^Armor class is (%d) pierce, (%d) bash, (%d) slash, and (%d) vs. magic.
#ADDKEY IdItem {Pierce=%1|Bash=%2|Slash=%3|Magic=%4}

Trigger - ^Affects (*) by (%d).
#ADDKEY IdItem {%1=%2}

Trigger - You gratefully hand over 140 gold to The antique dealer.
#DBFIRST
#WHILE (!%null( %rec)) {#IF (@TestName=&Name) {@Exist = 1} {#DBNEXT}}
#IF (@Exist = "") {#NEW Name @IdItem} {#SHOW DUPLICATE}

My purpose is to create a equipment database script which will check with the existing database before adding a duplicate eq.

2 problems

1) it does not detect duplicate names in the database

2) for some reasons the data in NAME field in my database changes to 0 when i switch between 'List','Record' & 'Field' view, OR when i double click the Name in the 'List' view.

Rest of data is fine and doesn't change.

can anyone tell me what is wrong with my data?

Below is the data i wish to capture.

If anyone is really helpful can email me the correct script to marc1st@hotmail.com.

Toybear

-------------------------------------------------------------------

The antique dealer shows you the following information .......
Object 'axe aardwolf (187024)' is type weapon
Extra flags: glow hum magic DOH.
Weight is 10, value is 1000, level is 140.
Worn take wield.
Weapon type is axe.
Damage is 140d5 (average 420).
Damage type is cleave.
Weapons flags: vorpal.
This item belongs to Sanur
Affects damage roll by 14.
Affects hit roll by 14.
----------------------------------------------
You gratefully hand over 140 gold to The antique dealer.

The antique dealer shows you the following information .......
Object 'reading glasses' is type armor
Extra flags: glow hum anti-evil donated.
Weight is 0, value is 10, level is 22.
Worn take eyes.
Armor class is 6 pierce, 9 bash, 8 slash, and 8 vs. magic.
Affects intelligence by 1.
Affects wisdom by 2.
Affects armor class by 21.
----------------------------------------------
You gratefully hand over 22 gold to The antique dealer.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Thu Sep 04, 2003 4:02 pm   
 
I am sorry, Why are you just not using the one from the finished mud scripts?

The answer to your question is also there.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 04, 2003 4:37 pm   
 
1. @TestName is a null variable. You never update it in this script.
2. The whole purpose of your #WHILE is to determine whether or not the name is already in use. Just do a query.

Pattern:
^You gratefully hand over %d gold to the antique dealer.
Value:
#IF (%query( "&Name" = "@IdItem.Name")) {#SHOW DUPLICATE} {#NEW All @IdItem}

I'm not sure if you'll need the "" around the variables or not. Experiment.
Reply with quote
ToyBear
Beginner


Joined: 04 Sep 2003
Posts: 25
Location: Singapore

PostPosted: Thu Sep 04, 2003 6:24 pm   
 
hey i tried out your trigger.

#IF (%query( "&Name" = "@IdItem.Name")) {#SHOW DUPLICATE} {#NEW All @IdItem}

it doesn't seem to detect Similar &Name in the database. It continues adding the same items.

and the second problem that i mentioned...

----------------
2) for some reasons the data in NAME field in my database changes to 0 when i switch between 'List','Record' & 'Field' view, OR when i double click the Name in the 'List' view. *I notice when I scroll to the right and when i scroll back to the left edge of the screen the name changes to zero...
----------------

still happens. Data is still added and saved normally, if i don't do any of the actions mention above. I can open the data base and the names are still in there, however when i do any of the above actions it becomes 0.

By the way, when it had changed to 0, i edited the field, however any edition is not saved and it reverts back to 0 when i switch view.

Thanks
Reply with quote
ToyBear
Beginner


Joined: 04 Sep 2003
Posts: 25
Location: Singapore

PostPosted: Thu Sep 04, 2003 6:30 pm   
 
ooo by the way, I think the original finished mud script is a not tuned. too long
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 04, 2003 7:07 pm   
 
quote:
I'm not sure if you'll need the "" around the variables or not. Experiment.

#IF (%query( &Name = @IdItem.Name)) {#SHOW DUPLICATE} {#NEW All @IdItem}

Experiment means "if it doesn't work the first way, try it without the quotes. If that doesn't work, try it with quotes on one side but not the other, and if that doesn't work try it with the quotes on the other side." It's also a good idea, when experimenting, to replace the actual commands with #SHOW or #SAY.
#IF (%query( &Name = @IdItem.Name)) {#SHOW DUPLICATE} {#SHOW ~#NEW All @IdItem}


I don't know what causes the Name to be set to 0. It doesn't happen in my database, for which I'm thankful. If I had known what the problem was, or more importantly, what the solution to it is, I'd have said so in the first place.
Reply with quote
ToyBear
Beginner


Joined: 04 Sep 2003
Posts: 25
Location: Singapore

PostPosted: Thu Sep 04, 2003 7:31 pm   
 
whee it worked!!!!!

now left with the database problem.. u tink it has to do with the way i did my script or the database program is defective?
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