Page 4 of 14

Re: The official --=jscam=-- thread

Posted: 28 Oct 2014, 19:07
by Iluvalar
I had to fix that when I was adding the passability on new propulsion support to the 2.3 source code. I found that the map was loading the pathfinding for no good reason. Only because it run another function which load it for other purpose... I had to place a switch on that function to NOT load the path finding when not needed (aka draw the map)

Re: The official --=jscam=-- thread

Posted: 29 Oct 2014, 09:40
by Per
vexed wrote:I did have fastplay converted 1:1 to JS, along with all required functions need to make it work, back when I was evaluating how feasible JS is. Sent Per a copy as well as some stuff I found out about how all this works.
I have attached a copy. It is using a very different API than we have now, though, so I actually think it would be less work to start again from scratch.

Re: The official --=jscam=-- thread

Posted: 30 Oct 2014, 03:56
by vexed
Wow... time sure does fly by!

And yeah, that was a quick & dirty conversion of everything in fastplay. There was no attempt to fix anything, just a straight 1:1 port.

Re: The official --=jscam=-- thread

Posted: 31 Oct 2014, 08:11
by NoQ
Yay, i see, at least i wouldn't miss the tiny 'start' script of the fastplay.

P.S. I'd have double weekend this time.
Spoiler:
Goth Zagog-Thou: if you're still struggling with the transport, let me know. If you're already past it, let me know anyway (: Right now we're not quite having saved games working, so it gets difficult to debug later levels, so it's not fun to skip yet, so i'd rather focus on helping with the transport mission (i do have my tutorial work as a "plan B" anyway though).

Re: The official --=jscam=-- thread

Posted: 01 Nov 2014, 08:38
by NoQ
NoQ wrote:i do have my tutorial work as a "plan B" anyway though
Emm no i don't.

Houston: Per: if i convert fastplay or tutorial into a challenge, i need to find out how to load the campaign research tree rather than the multiplayer research tree. For instance, researching mg in tutorial shouldn't unlock the mg bullets upgrade, and engineering research in fastplay shouldn't unlock the engine upgrade.

Since the tree is very small in both cases, i don't mind modifying-stats-from-scripts instead, as soon as it's possible (: But right now i cannot avoid having the mp tech tree applied, can i?

Re: The official --=jscam=-- thread

Posted: 01 Nov 2014, 12:29
by NoQ
Having a look at launching the transport, on cam1-2s as an example. I think we don't yet have a script function that would load the away mission when the transport leaves, and i think we don't even have events to notice transporter leaving; the only eventTransporter* i've seen triggered was eventTransporterLaunch, which is too early.

Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:

P.S. Since e43e57b, it's possible to see debug prints in eventStartLevel, as long as cheats were enabled on the previous level.

EDIT. hmm, loadLevel() seems to work.

Re: The official --=jscam=-- thread

Posted: 01 Nov 2014, 15:01
by cybersphinx
NoQ wrote:Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:
There is a script po/update-po.sh (not to be confused with make -Cpo update-po) that generates POTFILES.in.

Re: The official --=jscam=-- thread

Posted: 01 Nov 2014, 15:40
by NoQ
Yay, got the preparation for an off-world mission working. The scenario is as ridiculously short as it should be - around 10 lines of code (efc04bd). Had to fix a transporter exit event (cf6a369).

That's done without labels. Do we really need labels? Everything looks so nice without them.
cybersphinx wrote:a script po/update-po.sh
Yay, it works. The question remains though - the script doesn't look for actual translatable strings, it only looks for file extensions that may contain them (or may not). Which is not very important, i guess.

Re: The official --=jscam=-- thread

Posted: 02 Nov 2014, 00:22
by Per
NoQ wrote:if i convert fastplay or tutorial into a challenge, i need to find out how to load the campaign research tree rather than the multiplayer research tree.
I don't understand the problem(s). The wrf files for fastplay and tutorial should load the correct research trees, and the qtscript code set up everything to match. Doesn't this happen already?

Re: The official --=jscam=-- thread

Posted: 02 Nov 2014, 06:56
by NoQ
Now it does. If i convert them to javascript now, there's no problem. But if i'm to convert them into a challenge, it no longer would (and no WRF files would remain, and even if they are here, mp.wz would still be loaded first).

Re: The official --=jscam=-- thread

Posted: 02 Nov 2014, 19:31
by NoQ
9583cb6: Mostly sorted things out! The level (SUB_1_2) still needs more polishing, but at least the transporter works, "return to lz" works, "lz compromised" works, "reinforcements landing" works.

I'm seeing a magic constant in the c++ side, called LZ_COMPROMISED_TIME, that is used by WZScript's setReinforcementTime() to indicate that LZ is compromised (and, by the way, it cannot be set from JavaScript, because it's not an integer in seconds) but everything seems to work fine when reinforcement time is set to -1 instead.

One fancy item to check out: the "ascend" cheat to go straight to the level by level name, eg.

Code: Select all

ascend sub-1-2s
to instantly try out the newly committed mission. Auto-capitalizes and replaces "-" with "_" to save shift presses, because i'm using it really often, more often than "let me win". Note that it doesn't unlock techs from the skipped levels, so it's a very dirty debugging trick, use at your own risk!

Re: The official --=jscam=-- thread

Posted: 02 Nov 2014, 23:38
by Per
You should be able to set LZ_COMPROMISED_TIME by giving setReinforcementTime() a value of 999999 (defined as SCR_LZ_COMPROMISED_TIME in C++). This value should obviously have been defined as a constant in qtscriptfuncs.cpp already. Feel free to fix :)

Re: The official --=jscam=-- thread

Posted: 03 Nov 2014, 00:32
by Goth Zagog-Thou
Go ahead and take over Mission 3 in my stead, NoQ. You're moving along at a far better pace than I am. :(

Re: The official --=jscam=-- thread

Posted: 03 Nov 2014, 03:52
by vexed
NoQ wrote: Also, i have an unrelated question regarding POTFILES.in. Commit 5543c6a removes a script from this file, so that the game no longer looked for translatable strings in it. But there never were any translatable strings in this file ... right? They only contain references to strings.txt and similar stats, and even those are in vlo files, not in slo files. Why are all these files mentioned in POTFILES.in anyway? :hmm:
The script doesn't check, you are right.
Those files should never be in the POTFILES.in, since.. they aren't used.
So, someone needs to fix the script to be smarter.
NoQ wrote:Now it does. If i convert them to javascript now, there's no problem. But if i'm to convert them into a challenge, it no longer would (and no WRF files would remain, and even if they are here, mp.wz would still be loaded first).
I think this is the wrong approach for them, both the tutorial & fastplay aren't challenges.
They are more like stand-alone missions.
If we rename challenges to something else, then use that screen to load up different items (the tool tips would explain what each "thing" does), we could then use the ini to tell WZ what to load, either mp or base.

Oh, and while looking at why some things don't work anymore, I noticed this comment:

Code: Select all

////////////////////////////////////////////////////////////////////////////////

	yeah, like that. Also, it's exactly 80 characters wide. Code shouldn't be
	wider than that.
Why the 80 char limit ?

Code: Select all

	__camGenericDebug("TRACE",
	                  arguments.callee.caller.name,
	                  arguments);
vs

Code: Select all

	__camGenericDebug("TRACE", arguments.callee.caller.name, arguments);
:hmm:

Re: The official --=jscam=-- thread

Posted: 03 Nov 2014, 04:44
by NoQ
They are more like stand-alone missions.
If we rename challenges to something else
"Missions" sounds good for me (:
If we rename challenges to something else, then use that screen to load up different items (the tool tips would explain what each "thing" does), we could then use the ini to tell WZ what to load, either mp or base.
I'd still wait for a while if the moment when scripts are given write-access to stats (?), because it's seems to be much nicer to have the whole tree inside the mission, rather than rely on two pre-defined variants.
Why the 80 char limit ?
Got used to it at work and liked it. With my screen layout, i overflow at around 105 chars; some lines still overflow at this width, eg. the highlighted line on the screenshot. I can remove the enforcing comment (and i don't like the tone of it myself), but i'd still limit myself, because not everybody has 27" 1920x1080, so they may want to increase font or just have less pixels.