Divinity Banner
Previous Thread
Next Thread
Print Thread
Osiris Scripting - Modifying Databases #652835
11/06/19 08:10 PM
11/06/19 08:10 PM
Joined: Jun 2019
Posts: 2
crispyduck Offline OP
stranger
crispyduck  Offline OP
stranger

Joined: Jun 2019
Posts: 2
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.

Re: Osiris Scripting - Modifying Databases [Re: crispyduck] #652845
11/06/19 11:56 PM
11/06/19 11:56 PM
Joined: Dec 2013
Posts: 866
Windemere Offline

old hand
Windemere  Offline

old hand

Joined: Dec 2013
Posts: 866
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.

Shadow Over Moonglow - Standalone campaign (WIP)

The Noisy Crypt
(also on Nexus)

Re: Osiris Scripting - Modifying Databases [Re: Windemere] #653002
16/06/19 01:32 PM
16/06/19 01:32 PM
Joined: Jun 2019
Posts: 2
crispyduck Offline OP
stranger
crispyduck  Offline OP
stranger

Joined: Jun 2019
Posts: 2
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  Dom_Larian, Larian_Koala 

Powered by UBB.threads™ PHP Forum Software 7.6.2