Hello!
How to write a condition correctly?
Scene "name" - hotspot "name" - set the attribute "value"
How to write a condition correctly?
-
-
if((scene["name"].name == "name") AND (hotspot["name"].name == "name"),
<!-- do something here when true -->
,
<!-- do something here when false -->
);
reference: https://krpano.com/docu/actions/#if
-
if((scene["name"].name == "name") AND (hotspot["name"].name == "name"),
,
);
reference: https://krpano.com/docu/actions/#if
Thanks for the answer!
But I need it without the "if"need to specify a scene in which to set the parameters of the hotspot
<action name="set1">
set(scene.name == "scene_1", hotspot[hs2].ath,50);
</action>
? -
i didn't quite understand, but here's what i'm getting: you need a certain action that will play when a scene is loaded?
Example 1:
<scene name="scene_01" title="01" onstart="updatesomethingfrominside();" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">
<action name="updatesomethingfrominside">
set(hotspot[spot1].ath,100);
</action><view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/01.tiles/preview.jpg" />
<image>
<cube url="panos/01.tiles/pano_%s.jpg" /><cube url="panos/01.tiles/mobile/pano_%s.jpg" devices="mobile" />
</image><!-- place your scene hotspots here -->
<hotspot name="spot1" style="skin_hotspotstyle" ath="10.168" atv="7.534" linkedscene="scene_02" /></scene>
Example 2:
<scene name="scene_01" title="01" onstart="updatesomethingfrominside();" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">
<action name="updatesomethingfrominside">
set(hotspot[spot1].ath,100);
</action><view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/01.tiles/preview.jpg" />
<image>
<cube url="panos/01.tiles/pano_%s.jpg" /><cube url="panos/01.tiles/mobile/pano_%s.jpg" devices="mobile" />
</image><!-- place your scene hotspots here -->
<hotspot name="spot1" style="skin_hotspotstyle" ath="10.168" atv="7.534" linkedscene="scene_02" /></scene>
<action name="updatesomethingfromoutside">
set(hotspot[spot1].ath,100);
</action><scene name="scene_01" title="01" onstart="updatesomethingfromoutside();" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">
<view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/01.tiles/preview.jpg" />
<image>
<cube url="panos/01.tiles/pano_%s.jpg" /><cube url="panos/01.tiles/mobile/pano_%s.jpg" devices="mobile" />
</image><!-- place your scene hotspots here -->
<hotspot name="spot1" style="skin_hotspotstyle" ath="10.168" atv="7.534" linkedscene="scene_02" /></scene>
-
Thank you for the detailed answer!
Sorry for my English.<layer name="floor_1" url="floor1.png" x="5" y="5" onclick = "set1();" />
<action name="set1">
set(scene.name == "scene_5", hotspot[hs2].ath,50);
</action>For example, we are on scene №1
Need to change hotspot on scene №5
How to specify the scene in which this hotspot.
On different scenes the name of the hotspot can be the same. -
For example, we are on scene №1
Need to change hotspot on scene №5
How to specify the scene in which this hotspot.
On different scenes the name of the hotspot can be the same.you cant change a hotspot in scene 5 if scene 1 is loaded, this is not possible.
you can set some other variable, and create an onload event for scene 5.
there you can check the variable and set your hotspot accordingly -
indexofrefraction is right, hotspot on the other scene can't be changed without loading it scene.
other option is, make a global hotspot and only show it when the secific scene is loaded, so it can still be modified even if the specific scene is not yet loaded
-
Indexofrefraction прав, точка доступа на другой сцене не может быть изменена без загрузки сцены.
Другой вариант - создать глобальную точку доступа и показать ее только при загрузке отдельной сцены, поэтому ее можно изменить, даже если конкретная сцена еще не загружена
Thank you!
Global access point - write outside the scene?
Is not this a style?
And how to show it then?Something like this?
<events onnewscene="set1()" />
<action name="set1">
if(xml.scene == scene_5,set(hotspot [hs2] .ath, 50 ););
</action> -
i think there's an error on translation
what meant is to create global <hotspot>, it can still use style.
here's a working example:
<action name="scene01_load">
set(hotspot[scene01_spot1].visible,true);
set(hotspot[scene01_spot2].visible,true);
</action>
<action name="otherscene_load">
set(hotspot[scene01_spot1].visible,false);
set(hotspot[scene01_spot2].visible,false);
</action>
<hotspot name="scene01_spot1" style="skin_hotspotstyle" keep="true" visible="false" ath="2.148" atv="18.182" linkedscene_lookat="2.1, 2, 120" linkedscene="scene_02" />
<hotspot name="scene01_spot2" style="skin_hotspotstyle" keep="true" visible="false" ath="-68.221" atv="23.911" linkedscene_lookat="0, 4, 120" linkedscene="scene_02" /><scene name="scene_01" title="01" onstart="scene01_load();" thumburl="panos/01.tiles/thumb.jpg" lat="" lng="" heading="">
<view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="120" limitview="auto" />
<preview url="panos/01.tiles/preview.jpg" />
<image>
<cube url="panos/01.tiles/pano_%s.jpg" />
<cube url="panos/01.tiles/mobile/pano_%s.jpg" devices="mobile" />
</image>
</scene><scene name="scene_02" title="02" onstart="otherscene_load();" thumburl="panos/02.tiles/thumb.jpg" lat="" lng="" heading="">
<view hlookat="0" vlookat="0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="120" limitview="auto" />
<preview url="panos/02.tiles/preview.jpg" />
<image>
<cube url="panos/02.tiles/pano_%s.jpg" />
<cube url="panos/02.tiles/mobile/pano_%s.jpg" devices="mobile" />
</image>
</scene> -
Hello!
Thank you! Helpful information.
At me works so:
<events onnewscene="set_paramHSM()" />
<action name="set_paramHSM">
if(scene.name === scene_otdyh,set(hotspot[sun].scale,0.843);
set(hotspot[sun].alpha,1.28);
set(hotspot[sun].rotate,0);
set(hotspot[sun].ath,-45.00);
set(hotspot[sun].atv,8.37);
);
</action> -
BTW is there any way to javascript array of all hotspots in all scenes of virtual tour?
eg. something like scene[0].hotspot.count doesn't work
-
All the same, this does not work, performs the action for any value of % 1, what do I do wrong?
onclick="set_1(scene_1);"
<action name="set_1">
if(scene.name === %1,
-
Look this
https://krpano.com/forum/wbb/inde…d&threadID=2677I would try
if(name == ' ', -->
Or
if(scene[get(xml.scene)].name ==And NOT name the action as 'set' but like ChangeHtsp(); or
I use this stuff all the time.
Hope it helps
Tuur -
Hi,
i made a quick example for you.
http://www.virtualtuur.com/krpano/scenename/xml:
http://www.virtualtuur.com/krpano/scenename/tour.xmlof course it is now easy to get all those numbers (ath-atv) and text etc from an list/array or database or what ever.
Hope it helps
Tuur -
Hi,
i made a quick example for you.
http://www.virtualtuur.com/krpano/scenename/of course it is now easy to get all those numbers (ath-atv) and text etc from an list/array or database or what ever.
Hope it helps
TuurThank you so much ! Examples are cool! Everything worked out!
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!