Creating a random banner - who can help me?

Hello to everyone,
I know how to do this in theory, but I have no knowledge of javascript and don't know where to get my hands on Tumult.

The code could look like this:

set the variable A
choose a random nemo from 1 to 3
put it in variable A
if A= 1 go to stage 1
if A= 2 go to stage 2
if A= 3 go to stage 3
and so on...

Who can pass me an empty example of this project?

For example...

The script generates a random number from 1 to 3 and starts an equivalent Timeline (named '1', '2' or '3'). (15.6 KB)


Thank you very much!
What if with those numbers I wanted to aim for a different stage number instead?
For me it would be easier than controlling a timeline that could become a bit complex with animations...

What do you mean by 'stage' - scene?

If so ... it´s just a little bit different. The script now starts a scene instead of a timeline:

hypeDocument.showSceneNamed('scene_' +randomNum, hypeDocument.kSceneTransitionInstant)

I switched the button to a permanent symbol, so it´s available in each scene. (28.6 KB)


Sorry, but having the Italian version I did not know how to translate what is originally called 'scene area' (in the old Macromedia Director that was called 'stage').
Perfect, you understood what I wanted to say. Would it be possible not to put a button, but to make the random number appear when the presentation starts? I need it to make a container of causal banners, so I need that when the presentation starts, automatically a random number chooses the scene. If so, can you copy the code here for me so that I can insert it into the example you sent me.
Thank you very much

Of course, just call the randomize() function on scene load...

1 Like