Larian Banner
Previous Thread
Next Thread
Print Thread
Joined: Jun 2019
stranger
OP Offline
stranger
Joined: Jun 2019
Hi folks,

Will do my best to be clear.
I'm working with Osiris DB for the first time and it's very different from what I'm used to.

I'm not quite sure how to modify an element in a database except for removing it and replacing it and I'm not sure how to store variables.

So for example, I expected this line to give _Sum the value of 3 but it tells me it's an unbound variable.

IntegerSum(1,2,_Sum);

I'm not looking for code or anything, I just want to understand the rules for declaring variables and modifying databases .

If anyone can help I would really appreciate it.

Thanks.

Joined: Dec 2013
old hand
Offline
old hand
Joined: Dec 2013
You have the right idea with database entries - you would need to add/delete to modify a database with the same key signature.

For your IntegerSum call, you probably did not call it as a query in your IF/AND block but rather tried to execute it in your THEN block. Anything with an output variable needs to be part of the IF/AND block.

Here is a little example code that actually exemplifies both of your questions. In this frame when a certain flag is set, the player is given 250 gold but the amount of gold given to any player is capped at 5000


Code
IF
ObjectFlagSet("HEA_DBG_GiveGold", _Player, _ID)
AND
DB_HEA_DBG_GoldGiven(_Player, _Count)
AND
_Count < 5000
AND
IntegerSum(_Count, 250, _Sum)
THEN
CharacterAddGold((CHARACTERGUID)_Player, 250);
ObjectClearFlag(_Player, "HEA_DBG_GiveGold", _ID);
NOT DB_HEA_DBG_GoldGiven(_Player, _Count);
DB_HEA_DBG_GoldGiven(_Player, _Sum);



Last edited by Windemere; 11/06/19 11:58 PM.

DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods
Joined: Jun 2019
stranger
OP Offline
stranger
Joined: Jun 2019
Hi there,

Sorry for the later reply. This worked perfectly, I didn't know you had to do that in the IF/AND blocks, getting the hang of it now.
I think I've seen some of your video's too, all very helpful stuff. Thanks so much.


Moderated by  Larian_Koala 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5