Starting at scene via HTML Variable


I have a large document and I would like to be able to start this document at different scenes on different HTML pages.

Is it possible to have a variable of some sort on the HTML page that equals the desired scene in the document. Then on document load, it checks the variable and changes to it using a modified version of this code:

Var = 'Second_Scene'


(๐•„๐•š๐•”๐•™๐•’๐•–๐• ๐”พ๐•’๐•ฃ๐• ๐•—๐•’๐•๐• ) #2


Thanks for the suggestion! I didnโ€™t really want it to be a URL but it sent me into the right direction.

Iโ€™ve kinda figured it out, but iโ€™m having a little trouble, hereโ€™s what Iโ€™ve done so far:

First scene - onSceneLoad:JS:

if (count == 0) {
} else {
count = 1;

Then in my HTML i have:

scene_name = 'Menu';
count = '0';

This should ensure that the scene change only happens when the page first loads. However, whenever I go to the first scene, the onSceneLoad still occurs, and the scene transition happens. Any ideas?


Iโ€™ve fixed the problem by doing this:

if (count == 0) {
        count = 1;

But I donโ€™t know why it works. Iโ€™m always interested in learning, and if you could explain I would really appreciate it!


(Mark Hunte) #4

Here if count == 0 , then it will always equal 0 and never get to the second part ( else ) which set the count to 1.

Look at it this way.

what you had was.
if count Of First Run is false then do some stuff and donโ€™t set count Of First Run to true because itโ€™s false and we will always leave it as falseโ€ฆ

What you now have correctly is:

if countOfFirstRun is false then do some stuff and set countOfFirstRun to true so we can skip doing this stuff again on the next run


Yes I see now, very silly of me. I placed the count = 0 in the HTML JS to make it external / global. Is that the right thing to do?

(Mark Hunte) #6

A global var can be placed in a number of areas but this does not mean they will be seen in time or by the correct scope.
It is always easier to answer questions if we have a working example so we can be more specific