Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Eiredrake
Beginner


Joined: 14 Jun 2005
Posts: 15

PostPosted: Sat Jun 20, 2009 9:55 pm   

Database Madness Part II
 
Basically the only mux I play on is a Shadowrun 3 mux and I play a decker. Unfortunately for me there is a metric butt tonne of information for me to keep track of. While the mux DOES allow decker characters, there are little if any automated systems to track, maintain and use the data needed to actually play one. So I am trying to set up my client to track everything I need for myself (and any number of other deckers I might run matrix missions for) in a database. I had quite a bit of stuff worked up in one profile but it suddenly an inexplicably stopped working properly one day so I started over with a new CMUD profile and figured I would add in each piece one at a time (additive debugging) then just copy the working scripts over my old settings as needed. I tend to do all my validation of input parameters as early as possible and display reject messages before getting to the real work but that does make things a bit wordy.

As a consequence I have set up a database with a field for each thing I need to track (including screen name which is what I use to locate them later).

Right now I have two menu items. One that calls a alias to pull the data for a specified runner and display it in a useful format. That works just fine. I have another menu that calls a function which is supposed to prompt you for how much you would like to subtract (use) from the selected runner's Karma Pool. Then update the database record so that I have it for future use. Once I have this second alias working I will use it as the basic model for everything else I need to do since it's essentially all the same stuff.

So basically I have three functions:
FIND_RUNNER - uses %selword to find the runner in the database and populates a database variable SelectedRunner.
DISPLAY_DECKER_STATS - uses the SelectedRunner variable to display the runner's data in a readable format.
SUBTRACT_KARMA_FROM_RUNNER - Loads the runner by calling FIND_RUNNER and subtracts the specified amount from his current karma variable. It then saves the information back to the database.

FIND_RUNNER and DISPLAY_DECKER_STATS both run perfectly.

SUBTRACT_KARMA_FROM_RUNNER unfortunately has caused me no end of problems. I've had everything from crashes to my selected runner's screen name being set to 0 to the whole database UI going wonky. The only thing I haven't had yet is the actual update to the database and that's where I need the help. I can see that my SelectedRunner variable is being updated with the proper value, but when I try to save it to the DB isn't working right.

I have truncated the (as far as I can tell) working parts of the code for clarity.
Code:

  #SHOW "RecordId: " @selectedDatabaseRecord;
  #SHOW "Initial Value: " @SelectedRunner.CurrentKarma;
  #VAR NEW_KARMA_TOTAL {@SelectedRunner.CurrentKarma};
   
  NEW_KARMA_TOTAL=@NEW_KARMA_TOTAL-$KARMA_AMOUNT;
 
  #SHOW "Cost: " $KARMA_AMOUNT;
  #SHOW "New Amount: " @NEW_KARMA_TOTAL;
 
  #IF (@NEW_KARMA_TOTAL>=0)
  {
    SelectedRunner.CurrentKarma=@NEW_KARMA_TOTAL;
    #SHOW "Runner Karma Value: " @SelectedRunner.CurrentKarma;
    #DBPUT @selectedDatabaseRecord {deckerCurrentKarma=@SelectedRunner.CurrentKarma};
    #DBSAVE "runnerinformationdatabase";
    #SHOW "Save completed";
  }


When this runs I can see the following on the screen...

>>> Loading database: runnerinformationdatabase
RecordId: 0
Initial Value: 99
Cost: 4
New Amount: 95
Runner Karma Value: 95
Save completed
>>> Closing database: runnerinformationdatabase


So it's actually getting to the line where it is saved...and the value is being updated in the SelectedRunner database variable. But when I look at the field in the database nothing has changed. anyone know what's going on?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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