View previous topic :: View next topic |
Author |
Message |
futts
Joined: 24 Jan 2008 Posts: 12
|
Posted: Wed Mar 12, 2008 6:53 Post subject: Simple math question. |
|
|
Pardon my simple manners and newb-like question, but I am trying to help myself and a friend with a simple mathematics ordeal. What we want to accomplish is to GetPersistentInt, add or subtract a number (either one) from the acquired GetPersistentInt, and then replace the old Int with the new product.
In simpler terms, we pull an Int from the database - take two for example, then subtract one from it. We get one. Well, then we would put the product (the number one) into the database to replace two.
Of course we could do this all by ourselves and keep testing, but does anyone have any clean suggestions for us as someone more experienced?
I know this may be simple to you guys but not so much to me. I have a hard time with numbers but I'm steadily figuring things out. We all have to start somewhere. |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Wed Mar 12, 2008 9:27 Post subject: |
|
|
int iValue = GetPersistantInt(myObj, "DatabaseValue");
iValue = iValue - 1; //or some other maths
SetPersistantInt(myObj, "DatabaseValue", iValue);
The Set... functions will do a database INSERT or UPDATE the value |
|
Back to top |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|