You are not logged in.

Bri

Beginner

  • "Bri" started this thread

Posts: 4

Location: Eindhoven

  • Send private message

1

Thursday, August 16th 2018, 2:58pm

Struggeling with If / Else

Hi,

I'am struggeling with formulating a right source code. I want to make a sort of configurator with KRPano. There are 2 color choices for the wall, 5 for the floor.

So depending on which base scene is chosen by the user; a (color wall option 1) or b (color wall option 2), next scene that is loaded will be a2 or b2.

I thought one solution would be to add my own XML tag to a scene to make a difference between the two 'wall choices'.

So my first question is: can I add a xml tag to a scene, for example x=a?

Source code

1
<scene name="WIT" title="WIT" onstart="" thumburl="thumb.jpg" lat="" lng="" heading="" x="a"> 



Second question: how do I put this to if else code? Now its not working properly, it is always false thus only loads the 'else' scene.

Source code

1
2
3
4
5
 <action name= "donkergrijs">	
		 if (x == a, loadscene(scene_30X45_dgrijs);	
		<!--else-->, 
 		loadscene(scene_40X20_DGRIJS);	                        );	);
</action>


Many thanks,

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Thursday, August 16th 2018, 3:02pm

Hi!


It seems that the 'if' check is wrong. It should be:

Source code

1
if (scene[WIT].x == a, loadscene(scene_30X45_dgrijs); 		<!--else-->,     loadscene(scene_40X20_DGRIJS);   
Regards,

Alexey

Bri

Beginner

  • "Bri" started this thread

Posts: 4

Location: Eindhoven

  • Send private message

3

Thursday, August 16th 2018, 3:21pm

Thanks for your quick reply!

yes, but the problem is that it will only check if that specific one scene is currently displayed, no?
I rendered 10 scenes. 5 scenes with color wall A and 5 scenes color wall B. Thats why I want to give 5 scenes a specific value, so the IF value is either A or B.

4

Thursday, August 16th 2018, 9:33pm

Hi,

the xml.scene variable contains the name of the current loaded scene.

So the correct if() would be something like this:

Source code

1
if(scene[get(xml.scene)].x == 'a', then... , else...);


Best regards,
Klaus

Similar threads