Page 1 of 1

Weather and fog scripts to JS

Posted: 13 Dec 2017, 02:31
by Berserk Cyborg
Branch.

I have the weather scripts done which was simple as ever. Oddly, the music was set from these scripts so I moved that to both rules.js files. Each of the three files use a setCampaignNumber(num) though I have not checked if it is useful anymore.

Because skirmish does not include the fog/weather scripts, the music has likely been incorrectly using the frontend music for some time now. Also implies weather particles do not show up for urban and rocky maps.

Now what to do with fog code (daynight files in here)? Maybe salvage NoQ's fog patch? In any case this marks the end of WZScript dependence.

Mod idea for weather:
Spoiler:
Edit: Buildbot is broken again.

Re: Weather and fog scripts to JS

Posted: 13 Dec 2017, 03:32
by NoQ
My fog patch had the problem of me cannot into opengl. So i made it work with trial and error, but i've no idea if it's like anyhow correct (: The scripting part was fine though, i guess.
Berserk Cyborg wrote: Mod idea for weather:
Spoiler:
Sounds awesome :3 I guess this way it would also actually disable units hit by lightning.

Re: Weather and fog scripts to JS

Posted: 14 Dec 2017, 21:32
by Berserk Cyborg
Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.
0001-Move-weather-scripts-to-JS.patch

Re: Weather and fog scripts to JS

Posted: 20 Dec 2017, 02:13
by Per
Berserk Cyborg wrote:Here is a patch for the weather (campaign only right now). Like what I did with the tech levels, I could include it along with rule.js if that is preferred. There is one problem where savegames are not loading because it says scriptstate.es is corrupted... not sure what is up with that.

Added setCampaignNumber(num) as it does have a couple of uses and I also saw no difference with the absence of the fog stuff with this patch.
0001-Move-weather-scripts-to-JS.patch
IIRC, if you remove globals from wzscript, old savegames will no longer load.

Patch looks good to me.

Re: Weather and fog scripts to JS

Posted: 20 Dec 2017, 17:29
by Berserk Cyborg
I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?

Re: Weather and fog scripts to JS

Posted: 20 Dec 2017, 22:25
by Per
Berserk Cyborg wrote:I should say that the patch creates broken saves. Claims no script contexts were found with scriptState.es and then goes back to the main menu. Or maybe that file is now obsoleted without any wzscripts around?
Ah, it does not expect that there is no wzscript context to be created from the savegame anymore. Fixed in f0930756a32ef8310818abcb022609c8f582621c. Your patch seems to work now.

Re: Weather and fog scripts to JS

Posted: 20 Dec 2017, 23:13
by Berserk Cyborg
Pushed b016f609d704ce4df022e3a89f4f70f6eaabbee7. I enabled weather for multiplay; Hopefully that does not cause problems. As for old saves, we can just delete the scriptState.es file and they will load.

I also fixed an ancient bug #983.

I guess the data/base/script/data and data/base/script/text directories are useless now and can be deleted.

Re: Weather and fog scripts to JS

Posted: 21 Dec 2017, 01:21
by Per
I pushed deletes for all remaining base wzscripts except basic.slo, where I just removed the stuff I am certain is no longer used.