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
groundzero2010
Novice


Joined: 30 Sep 2004
Posts: 47
Location: Arkansas

PostPosted: Sat Oct 02, 2004 5:19 pm   

Problem with equipment database (using ID script)
 
I'm working on a identify script that places each object identified into the equipment database. The only problem I'm having is that the object in the database will bleed numbers down to the object below it if that object has a default of 0. Here is an example of whats happening.

Code:

NAME                  TYPE        HITROLL       DAMROLL
an elven long sword   WEAPON       +4             +4
a brilliant gem       TREASURE     +4             +4


It should look like this.

Code:

NAME                   TYPE       HITROLL       DAMROLL
an elven long sword    WEAPON      +4             +4
a brilliant gem        TREASURE     0              0



The brilliant gem doesn't have a hitroll modifier of +4 or the damroll modifier. That should default at 0 but the defaults don't seem to work. What is happening is somehow the Hitroll and Damroll modifiers are bleeding into the next object if that second object doesn't have a value.

If you need to see the script I'm running just let me know.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Oct 02, 2004 6:59 pm   
 
Quote:
What is happening is somehow the Hitroll and Damroll modifiers are bleeding into the next object if that second object doesn't have a value


What is probaly happening is your not reseting your Variable before using it Add something like this to the top of your ID script to make sure it is empty, Without seeing yout script there could be other changes but this comes to the top of my head.

dbvar=""
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
groundzero2010
Novice


Joined: 30 Sep 2004
Posts: 47
Location: Arkansas

PostPosted: Mon Oct 04, 2004 3:31 pm   
 
Here is my full script. I add the second line like suggested and it didn't fix the problem. Any other suggestions Question

Code:

#CLASS {ID}
#VAR dbvar {""}
#TRIGGER {$} {
  #if (%find( @item.name) = "") {#new "" @item}
  #t- identify
  }
#TRIGGER {Object '&{item.name}', Item type: &{item.type}} {}
#TRIGGER {Affects: HITROLL By &{item.hitroll}} {}
#TRIGGER {Affects: DAMROLL By &{item.damroll}} {}
#TRIGGER {Affects: DEX By &{item.dex}} {}
#TRIGGER {Affects: INT By &{item.int}} {}
#TRIGGER {Affects: STR By &{item.str}} {}
#TRIGGER {Affects: CON By &{item.con}} {}
#TRIGGER {Affects: CHA By &{item.cha}} {}
#TRIGGER {Affects: WIS By &{item.wis}} {}
#TRIGGER {Made out of: &{item.made}} {}
#TRIGGER {Level Restriction: &{item.level}} {}
#TRIGGER {Weapon Type: &{item.wtype}} {}
#TRIGGER {Weight: &{item.weight}, Value: &{item.value}} {}
#TRIGGER {Race/Class Restrict: &{item.rcrest}} {}
#TRIGGER {Item is: &{item.prop}} {}
#TRIGGER {Damage Dice is '&{item.damdice}' for an average per-round damage of &{item.avgdam}.} {}
#TRIGGER {Item can be worn on your &{item.wear}.} {}
#TRIGGER {Item can be worn as a &{item.wear}.} {}
#CLASS 0

Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 04, 2004 4:16 pm   
 
Clear the same variable that you're using to record identifies. It doesn't help any to clear a different variable.
#VAR item {""}

Nexela had no idea what your variable name was, since you hadn't mentioned it in your initial question. He just made up a name so he could give you an example. He expected you to be smart enough to change it without being told.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Oct 04, 2004 10:41 pm   
 
You need to find whatever trigger/alias does the #T+ Identify
and insert this into the value of it
#VAR item {""}
The way you have it now it will only create the variable once you import/create the script and not reset it before each ID.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 04, 2004 11:19 pm   
 
Ack, missed that.

With your current script, the best place to clear the variable would be right after you've finished using it, which would be right after the #NEW command in your first trigger.
Code:
#TRIGGER {$} {
  #if (%find( @item.name) = "") {#new "" @item}
  #VAR item {}
  #t- identify
  }
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
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