You are not logged in.

loki

Trainee

  • "loki" started this thread

Posts: 72

Location: Berlin

  • Send private message

1

Thursday, April 1st 2021, 11:30am

if() action loop break/exitcall on meeting condition

Hi all,

in a tour of say three rooms with three panos each I would like to create a button to jump from one room to the next room (sometimes skipping a pano in the current room).

My loop below is working but it doesn't stop when the condition was met and my simple approaches trying with wait(0);/break();/exitcall();/callwhen();/stopcallwhen(); didn't lead to success.
Maybe there is a "on-meeting-condition stop & restart the action" solution as a workaround?
I see the indexing examples but I feel it is way out of my league.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<layer 
name="button-jump-to-next-room" 
.. 
onclick="jump-to-next-room();" 
/>

<action name="jump-to-next-room">
if (
scene[get(xml.scene)].title == 'room1scene1-title'
OR 
scene[get(xml.scene)].title == 'r1scene2-title'
OR 
scene[get(xml.scene)].title == 'r1scene3-title'
, 
jump-to-room2scene4();
);
if (
scene[get(xml.scene)].title == 'room2scene4-title'
OR 
scene[get(xml.scene)].title == r2scene5-title'
OR 
scene[get(xml.scene)].title == r2scene6-title'
, 
jump-to-room3scene7();
);
etc.
</action>


Could someone lead me to the right direction please?

Thanks and happy Easter!
loki

jeromebg

Professional

Posts: 1,120

Location: Angers - France

Occupation: 360 experiences creator

  • Send private message

2

Thursday, April 1st 2021, 1:13pm

You could set the "jump to room" for each scene

Source code

1
2
3
4
5
6
7
8
9
10
11
<scene name="scene_1" jumpto="scene_4"...></scene>
<scene name="scene_2" jumpto="scene_4"...></scene>
<scene name="scene_3" jumpto="scene_4"...></scene>
<scene name="scene_4" jumpto="scene_6"...></scene>
<scene name="scene_5" jumpto="scene_6"...></scene>
...
<layer 
name="button-jump-to-next-room" 
.. 
onclick="loadscene(get(scene[get(xml.scene)].jumpto))" 
/>

3

Thursday, April 1st 2021, 2:31pm

method 1: (exitcall)

Source code

1
2
3
4
if(	a, action_a(); exitcall()	);
if(	b, action_b(); exitcall()	);
...
if(	z, action_z()	);

method 2: (if/else)

Source code

1
2
3
4
5
6
if(
	a, action_a(),
	b, action_b(),
	...
	z, action_z()
);

the above just for the syntax...
jeromes idea is good *thumbup*

This post has been edited 1 times, last edit by "indexofrefraction" (Apr 1st 2021, 3:10pm)


Similar threads