Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL Console Command Improvements #1001

Merged
merged 5 commits into from Oct 10, 2021
Merged

SDL Console Command Improvements #1001

merged 5 commits into from Oct 10, 2021

Conversation

Hoikas
Copy link
Member

@Hoikas Hoikas commented Oct 8, 2021

This addresses some problems with the Age SDL console commands:

There are three different forms of Age SDL, two of which the client knows about: vault SDL and python/gameserver SDL. On DirtSand, these are always equivalent, but not so on other server types. Previously, the ShowSDL command showed the vault SDL but the SetSDL commands modified the python SDL. Therefore, Age.ShowSDL has been split into two commands: Age.ShowPythonSDL and Age.ShowVaultSDL. @Deledrius can now be happy.

Age.ResetPythonSDL has been added. Closes #987.

Fixed bugs where scripts seem to assume that SDL bools will str to numbers. Fixed memory leaks in the SetSDL commands.

The set commands operate on the Python AgeSDLHook, but the ShowSDL
command was showing the age vault SDL values. On DirtSand, the server
merges these together, however on Cyan and MOSS servers, these values
are distinct. Therefore, we separate them into their own commands. The
Set commands operate on the Python SDL.
Fixes H-uru#987 - useful for Age development.
Many Python scripts `str()` "bools", assuming that they are ints. And we
get errors when they are "True" or "False" instead of "0" or "1". I saw
the following when using `Age.ResetPythonSDL` in Negilahn:

```
(10/08 02:16:55) cPythBattery - Traceback (most recent call last):
(10/08 02:16:55)   File
"D:\Plasma\CyanWorlds.comEngine\build\vc++2019-x86\install\client\./python/plasma\PlasmaTypes.py",
line 508, in run
(10/08 02:16:55)     idx = self.state_list.index(state)
(10/08 02:16:55) ValueError: 'False' is not in list
(10/08 02:16:55) During handling of the above exception, another
exception occurred:
(10/08 02:16:55) Traceback (most recent call last):
(10/08 02:16:55)   File ".\python\xPodBattery.py", line 450, in
OnSDLNotify
(10/08 02:16:55)     respPodLights.run(self.key,
state=str(ageSDL[SDLPodLights.value][0]))
(10/08 02:16:55)   File
"D:\Plasma\CyanWorlds.comEngine\build\vc++2019-x86\install\client\./python/plasma\PlasmaTypes.py",
line 511, in run
(10/08 02:16:55)     raise ptResponderStateError("There is no state
called '%s'"%(state))
(10/08 02:16:55) PlasmaTypes.ptResponderStateError: There is no state
called 'False'
```
Copy link
Member

@zrax zrax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed bugs where scripts seem to assume that SDL bools will str to numbers.

This sounds like it might cause other problems, as we're now translating bools to longs... Why not just fix the scripts instead?

@Hoikas
Copy link
Member Author

Hoikas commented Oct 9, 2021

I can certainly do that, but I'm uncertain as to how prevalent this hack is. So, I'll take some time to look through all of the scripts for it.

This appears to be the only script that was `str()`-ing a truthy value.
Depending on all truthy or falsey values to result in exactly "1" or "0"
is questionable behavior at best.
@Hoikas
Copy link
Member Author

Hoikas commented Oct 9, 2021

It looks like it was just the one script that was being naughty. 😄

@Hoikas Hoikas merged commit 73d5156 into H-uru:master Oct 10, 2021
@Hoikas Hoikas deleted the sdl_console branch October 10, 2021 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Console command to reset all Age SDL to default values
2 participants