You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, August 3rd 2017, 4:58am

How to write a condition correctly?

Hello!
How to write a condition correctly?
Scene "name" - hotspot "name" - set the attribute "value"

Yanward

Beginner

Posts: 17

Location: Singapore

Occupation: Software Engineer

  • Send private message

2

Thursday, August 3rd 2017, 7:12am

if((scene["name"].name == "name") AND (hotspot["name"].name == "name"),

<!-- do something here when true -->

,

<!-- do something here when false -->

);


reference: [url='https://krpano.com/docu/actions/#if']https://krpano.com/docu/actions/#if[/url]
Yanward *squint*

3

Thursday, August 3rd 2017, 3:32pm

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>
?

Yanward

Beginner

Posts: 17

Location: Singapore

Occupation: Software Engineer

  • Send private message

4

Friday, August 4th 2017, 5:57am

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>
Yanward *squint*

5

Friday, August 4th 2017, 9:20am

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.

6

Friday, August 4th 2017, 10:49am


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

Yanward

Beginner

Posts: 17

Location: Singapore

Occupation: Software Engineer

  • Send private message

7

Friday, August 4th 2017, 11:05am

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
Yanward *squint*

8

Friday, August 4th 2017, 8:49pm

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>

Yanward

Beginner

Posts: 17

Location: Singapore

Occupation: Software Engineer

  • Send private message

9

Monday, August 7th 2017, 4:17am

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>
Yanward *squint*

10

Monday, August 7th 2017, 5:20pm

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>

panomaster

Intermediate

Posts: 277

Location: Kobyłka, Poland

Occupation: Virtual Tours - Spherical Panoramas - Krpano developer

  • Send private message

11

Thursday, August 24th 2017, 12:19am

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

12

Saturday, September 30th 2017, 9:53am

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,

Tuur

Sage

Posts: 3,169

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

13

Saturday, September 30th 2017, 10:27am

Look this
https://krpano.com/forum/wbb/index.php?p…d&threadID=2677

I 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 *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

Tuur

Sage

Posts: 3,169

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

14

Saturday, September 30th 2017, 3:24pm

Hi,

i made a quick example for you.
http://www.virtualtuur.com/krpano/scenename/

xml:
http://www.virtualtuur.com/krpano/scenename/tour.xml

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
Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

15

Saturday, September 30th 2017, 3:49pm

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
Tuur
Thank you so much ! Examples are cool! Everything worked out!