Sie sind nicht angemeldet.

1

Donnerstag, 16. August 2018, 14:58

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?

Quellcode

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.

Quellcode

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


Many thanks,

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

2

Donnerstag, 16. August 2018, 15:02

Hi!


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

Quellcode

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

Alexey

3

Donnerstag, 16. August 2018, 15:21

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

Donnerstag, 16. August 2018, 21:33

Hi,

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

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

Quellcode

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


Best regards,
Klaus

Ähnliche Themen