Page 1 of 2

A few questions about SDL vars

Posted: Sat Jan 14, 2012 6:20 am
by Sirius
Hi, I've got a few questions about SDLs (I'm trying with Christopher to supplement some of the Training Wall Python functions missing in MOULa's API. I first tried with Python notifications but it didn't work correctly).

I have a SDL var of this kind:

Code: Select all

VAR BYTE	blahblahblah[20]	DEFAULT=-1
1. Can a BYTE variable have a negative value ?
2. if the default value for this variable is -1, will all 20 "sub-variables" in it be defaulted to -1 ?
3. this variable has no DEFAULTOPTION, which means (I assume) it will be set to -1 on each Age reload as it isn't saved in the vault.
Let's say someone is already in the Age, and he set this var to another value.
A new player links in, and accesses this SDL var. Will its value be the default one or the modified one ?

Thanks.

Re: A few questions about SDL vars

Posted: Sat Jan 14, 2012 7:47 am
by diafero
1. Can a BYTE variable have a negative value ?
I would expect it to overflow, so -1 is the same as 255.
2. if the default value for this variable is -1, will all 20 "sub-variables" in it be defaulted to -1 ?
yes
3. this variable has no DEFAULTOPTION, which means (I assume) it will be set to -1 on each Age reload as it isn't saved in the vault.
No, DEFAULTOPTION and DISPLAYOPTION have no effect on the vault storage, as far as I know. Actually I have no clue which effect these flags have at all. Alcugs ignores them, that's working fine :D

Re: A few questions about SDL vars

Posted: Sat Jan 14, 2012 8:10 am
by D'Lanor
An INT can have a default value of -1. Why don't you use that?

SDL variables btw are usually not saved in the age vault but in the age SDL state. It is possible to save them in the age vault but that is exception rather than rule.

DEFAULTOPTION=VAULT is traditionally used for SDL variables that must conform to global SDL values as set within the vault of a shard. For all I know it could be redundant, because I have seen SDL variables without that option conform to global SDL changes just as easily. Cyan however still used DEFAULTOPTION=VAULT in MOULa for sparklies and other reward stuff that they wanted to control through their VaultManager.

Edit: Of DISPLAYOPTION=hidden I know that it hides SDL variables from Cyan's VaultManager. Of course people who build their own vault management tools are free to ignore this. ;)

Re: A few questions about SDL vars

Posted: Sat Jan 14, 2012 12:30 pm
by Sirius
Ok, thanks for the answers.

I was using BYTE because I was re-using a variable that was later deleted from the SDL file (I found some in the early versions of Gahreesen SDL). After a quick search in the forum, I saw INT was used for 32 bits numbers (up to roughly 4 000 000 000), and I don't need that much. BYTE would be fine, but I don't know if it can have a negative value.

I don't really know how these SDLs are stored, but I wanted them to be resetted when no one is in the Age. I'll do it manually in my script then.

Re: A few questions about SDL vars

Posted: Sun Jan 15, 2012 10:22 am
by diafero
I don't really know how these SDLs are stored,
You don't want to know the glory details, it's horrible^^

Just make sure to always use the PtGetAgeSDL() to access the age SDL state, and not go through the vault - the SDL of the actual age is stored twice, and both are supposed to stay in sync, but Alcugs (and Dirtsand) don't always do that.

Re: A few questions about SDL vars

Posted: Mon Jan 16, 2012 2:49 pm
by Branan
DEFAULTOPTION=Vault means "Use the value from the vault, unless that value is at default". If that option is not set, it will use whichever of the gameserver/vault values is newest.

Re: A few questions about SDL vars

Posted: Tue Jan 17, 2012 1:01 pm
by diafero
So if a DEFAULTOPTION=Vault variable is changed in the vault, there is no way to override it locally in an age, even by changing it *after* the global change?

Re: A few questions about SDL vars

Posted: Tue Jan 17, 2012 4:21 pm
by D'Lanor
diafero wrote:So if a DEFAULTOPTION=Vault variable is changed in the vault, there is no way to override it locally in an age, even by changing it *after* the global change?
In my experience it can be changed in age just like any SDL variable. My experience with this dates from UU though.

Re: A few questions about SDL vars

Posted: Tue Jan 17, 2012 4:50 pm
by Branan
diafero wrote:So if a DEFAULTOPTION=Vault variable is changed in the vault, there is no way to override it locally in an age, even by changing it *after* the global change?
I'm not sure. I've never tried to change a DEFAULTOPTION=Vault variable on the gameserver, just in the age instance vault.

Re: A few questions about SDL vars

Posted: Wed Jan 18, 2012 5:33 am
by Sirius
Ok, this SDL thing looks crazy. I guess I better reset the SDLs each time I link-in and there's no one in the Age.

Anyway, good news: using SDLs for the Wall is really hard to code, and I found out parts of the current script (on DI I mean) might not be synchronising properly the clients (+ some functions are called twice, or not at all...). Which means I'm wondering whether I should rewrite it from scratch :twisted: :twisted: . I'll see about that.