Sie sind nicht angemeldet.

1

Donnerstag, 3. August 2017, 04:58

How to write a condition correctly?

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

Yanward

Anfänger

Beiträge: 17

Wohnort: Singapore

Beruf: Software Engineer

  • Nachricht senden

2

Donnerstag, 3. August 2017, 07:12

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

Donnerstag, 3. August 2017, 15:32

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

Anfänger

Beiträge: 17

Wohnort: Singapore

Beruf: Software Engineer

  • Nachricht senden

4

Freitag, 4. August 2017, 05:57

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

Freitag, 4. August 2017, 09:20

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

Freitag, 4. August 2017, 10:49


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

Anfänger

Beiträge: 17

Wohnort: Singapore

Beruf: Software Engineer

  • Nachricht senden

7

Freitag, 4. August 2017, 11:05

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

Freitag, 4. August 2017, 20:49

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

Anfänger

Beiträge: 17

Wohnort: Singapore

Beruf: Software Engineer

  • Nachricht senden

9

Montag, 7. August 2017, 04:17

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

Montag, 7. August 2017, 17:20

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

Fortgeschrittener

Beiträge: 297

Wohnort: Kobyłka, Poland

Beruf: Virtual Tours - Spherical Panoramas - Krpano developer

  • Nachricht senden

11

Donnerstag, 24. August 2017, 00:19

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

Samstag, 30. September 2017, 09:53

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

13

Samstag, 30. September 2017, 10:27

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*

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

14

Samstag, 30. September 2017, 15:24

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*

15

Samstag, 30. September 2017, 15:49

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!