Page 1 of 2

Tutorial and fastplay conversion

Posted: 28 Nov 2017, 21:50
by Berserk Cyborg
I took the liberty of converting the fastplay demo into a JS script. Essentially I treated it as a campaign mission and everything is controlled by the campaign library. Like the cam3-4 mission, the gameOverMessage function will probably need to be changed a bit. But other than that not much else to say since it is a pretty bare bones map.

Was going to do the tutorial, but it looks kind of scary and I am not even sure if it is possible with the current JS API.

current work.

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 01:52
by NoQ
Cool!

We've once been thinking if those should be challenges rather than campaigns. It turned out to be complicated because they need to use campaign stats (eg. tech tree), while challenges usually use multiplayer stats.

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 02:51
by Per
Cool, indeed!

Could you start making a list of things that are missing in the JS API for the tutorial? Should be easy to fix.

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 06:35
by Berserk Cyborg
I think these are what needs to be added. I will try listing the functions I see in the WZScripts:

1. removeReticuleButton(button_id)
2. Set the inTutorial flag (bInTutorial?)
3. stopCDAudio() / playIngameCDAudio()
4. addConsoleText()
5. tagConsoleText()
6. toggle flash of a reticule button. flashOn(button_id) / flashOff(button_id)
7. clearConsole()
8. event for when a certain reticule button is pressed
9. event for moving a factory delivery point
10. droid selected event
11. event when a menu icon is selected (think research item / build menu structure)
12. event when a droid design menu icon is selected (ie. vehicle/propulsion/weapon icon)

some others that I saw but probably not needed:
1. tutorialTemplates()
2. setCampaignNumber()
3. set gameLevel
4. setRadarZoom()
5. pause()

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 10:43
by Per
I already have a patch for 1, 11, and 12 in the works, just need to get time to finish it.

I would like to make the inTutorial flag obsolete.

console() isn't enough to replace addConsoleText()?

For 10, we have eventSelectionChanged().

Not sure what some of the others do, I'll have to look into it.

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 16:01
by Berserk Cyborg
Per wrote: console() isn't enough to replace addConsoleText()?

For 10, we have eventSelectionChanged().
Did not know about those... will update the list. Yeah, they both look like what was needed then.

Re: Tutorial and fastplay conversion

Posted: 29 Nov 2017, 22:57
by Per
Per wrote:I already have a patch for 1, 11, and 12 in the works, just need to get time to finish it.
Parts of it pushed. Preview of unfinished remainder: https://github.com/perim/warzone2100/co ... 256a3109bf

Re: Tutorial and fastplay conversion

Posted: 01 Dec 2017, 05:26
by Berserk Cyborg
Per wrote:Parts of it pushed.
Causes a crash when loading saves. See viewtopic.php?f=1&p=139167#p139166.

Re: Tutorial and fastplay conversion

Posted: 01 Dec 2017, 05:31
by Lord_Kane
Berserk Cyborg wrote:
Per wrote:Parts of it pushed.
Causes a crash when loading saves. See viewtopic.php?f=1&p=139167#p139166.
check my investigation results in that thread, logs are there in a 7z file but for convenience I have slapped them here too.

Re: Tutorial and fastplay conversion

Posted: 02 Dec 2017, 20:22
by Per
Berserk Cyborg wrote: 3. stopCDAudio() / playIngameCDAudio()
7. clearConsole()
9. event for moving a factory delivery point
Implemented in e26b9516d3e065527e41fe5006f9f94983653882, which adds:
clearConsole()
hackPlayIngameAudio()
hackStopIngameAudio()
eventDeliveryPointMoving()
eventDeliveryPointMoved()

Re: Tutorial and fastplay conversion

Posted: 02 Dec 2017, 20:50
by Berserk Cyborg
Awesome! Updated the list again.
Per wrote: hackPlayIngameAudio()
hackStopIngameAudio()
Looks like you got a copy paste oddity with the debug messages in those two.

Re: Tutorial and fastplay conversion

Posted: 02 Dec 2017, 21:59
by Per
Berserk Cyborg wrote:Looks like you got a copy paste oddity with the debug messages in those two.
:oops: 1a45f2778137e757f14b295101b195a6f732c3d0

Re: Tutorial and fastplay conversion

Posted: 02 Dec 2017, 23:04
by Per
Berserk Cyborg wrote:I think these are what needs to be added. I will try listing the functions I see in the WZScripts:
1. removeReticuleButton(button_id)
2. Set the inTutorial flag (bInTutorial?)
3. stopCDAudio() / playIngameCDAudio()
4. addConsoleText()
5. tagConsoleText()
6. toggle flash of a reticule button. flashOn(button_id) / flashOff(button_id)
7. clearConsole()
8. event for when a certain reticule button is pressed
9. event for moving a factory delivery point
10. droid selected event
11. event when a menu icon is selected (think research item / build menu structure)
12. event when a droid design menu icon is selected (ie. vehicle/propulsion/weapon icon)
Added in 2810c730e1733262b3ff27decfbb93c1db821a6a (and earlier): 1, 6, 8
Added in 629d43771b4ab621fcedb8403165f7557b235bdf: 11, 12 (I think all covered now?)

If 5 is really needed, I think it should handled by an extra, optional parameter to console(). Let me know if this is needed, and what other things this should do.

Number 2 is already handled by setTutorialMode(true);

If tutorial is converted as well, then the move away from the old wzscript would be almost complete, which would be a momentous achievement!

Re: Tutorial and fastplay conversion

Posted: 02 Dec 2017, 23:39
by Berserk Cyborg
Per wrote: If tutorial is converted as well, then the move away from the old wzscript would be almost complete, which would be a momentous achievement!
Yeah, there are still those weather and fog scripts still being used for multiplay/campaign in the base/script/text directory. I know the weather stuff can be ported over, not sure if the fog functions are useful anymore. They also use the setCampaignNumber().

I guess after that only tech level research enablers for skirmishes are left and Nexus AI.

Re: Tutorial and fastplay conversion

Posted: 03 Dec 2017, 00:18
by Berg
On a side note still within topic can a tutorial be added to show new player about unit orders if its not already in the tutorial.
I think this will rectify other issues for newbies that don’t know about orders and remove the idea that new folks cant find units orders.