fedorovvl / tso_client

The Settlers Online client
42 stars 24 forks source link

Update mine rebuilder userscript #386

Closed SasSam closed 1 month ago

SasSam commented 1 month ago

This is an update for @PiTi2k5 's user_mine_rebuild.js userscript.

We can now switch between 2 options:

image

image

fedorovvl commented 1 month ago

@PiTi2k5 you approve this?

PiTi2k5 commented 1 month ago

Without combobox on each deposit, the create of templates are useless or not?

SasSam commented 1 month ago

@PiTi2k5 and I had a quick chat, and we agreed to add a radio button in the header that will show all checkboxes or only the available ones. Let's put this PR on hold till then.

SasSam commented 1 month ago

The update has been pushed.

fedorovvl commented 1 month ago

i see u using "game" variable for storing DepositDepletedGameScriptKeys.SWITCH_STATUS.. why? its not saving to settings ang "game" is class variable.. instead of this u can use settings file.. for ex

var DepositDepletedSettings = {
    SWITCH_STATUS: DepositDepletedSwitchStatuses.ON
}
$.extend(DepositDepletedSettings, readSettings(null, 'DepositDepleted'));
......
DepositDepletedSettings.SWITCH_STATUS = DepositDepletedSwitchStatuses.OFF;
......
storeSettings(DepositDepletedSettings, 'DepositDepleted');
SasSam commented 1 month ago

i see u using "game" variable for storing DepositDepletedGameScriptKeys.SWITCH_STATUS.. why? its not saving to settings ang "game" is class variable.. instead of this u can use settings file.. for ex

It just stores the radio button's state while the client is running. So, if you close the modal and reopen it, the radio button's state will be restored. But I don't think we need to save this setting permanently in a file.

I know the game is the main object, but the set key-value won't conflict with anything because it has a unique prefix.

image

fedorovvl commented 1 month ago

I know the game is the main object, but the set key-value won't conflict with anything because it has a unique prefix.

not necessary to escape from script scope.. u can use any variable defined inside script

SasSam commented 1 month ago

not necessary to escape from script scope.. u can use any variable defined inside script

Ok, I've pushed the update for this. Using a global variable within the script instead of the game object.