|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<layer name="hscount" type="text" font="arial"
css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;"
width="80" height="30" bgcolor="0xffffff" align="topleft" bgalpha="0.8"
keep="true" zorder="9999" x="15" y="15" onloaded="hs_tag_click(get(name));" />
<action name="hs_tag_click" scope="local" args="name">
if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // only once!
if(hotspot[get(name)].tag === 'hide', inc(global.hs_tag_count));
calc(plugin[hscount].html, '14/' + global.hs_tag_count);
</action>
<hotspot html="Image" name="Cabin" style="Info" ath="2.145" atv="13.446"
onclick="popup('html', get(data[dog_house].content), 800, 330, true);"
tag="hide" onclick="hs_tag_click(get(name));" />
<hotspot name="spot2" style="Info" ath="-70.710" atv="0.729"
onclick="popup('html', get(data[BOPControlPanel].content), 800, 500, true);"
tag="hide" onclick="hs_tag_click(get(name));" />
|
This post has been edited 1 times, last edit by "ganeshkahane" (Mar 2nd 2023, 4:59pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
<layer name="hscount" type="text" font="arial"
css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;"
width="80" height="30" bgcolor="0xffffff" align="topleft" bgalpha="0.8"
keep="true" zorder="9999" x="15" y="15" onloaded="hs_tag_click(get(name));" />
<layer name="hscountComp" type="text" font="arial"
css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;"
height="30" bgcolor="0xffffff" align="topright" bgalpha="0.8"
keep="true" zorder="9999" x="15" y="15" html="Completed" visible="false"/>
<action name="hs_tag_click" scope="local" args="name">
if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // only once!
if(hotspot[get(name)].tag === 'hide', inc(global.hs_tag_count));
calc(plugin[hscount].html, '3/' + global.hs_tag_count);
<!-- trace(get(name)); -->
<!-- DISABLE HOTSPOTS -->
set(hotspot[get(name)].enabled, false);
<!-- trace(global.hs_tag_count); -->
<!-- DISPLAY NEW LAYER ONCE ALL HOTSPOTS HAVE BEEN CLICKED -->
if(global.hs_tag_count == 3,
set(layer[hscountComp].visible, true);
);
</action>
<style name="skin_hotspot" bgcolor="0x336699" bgalpha="0.6" css="font-family:Helvetica;color:#ffffff;font-size:14px;" bgborder="1 0xffffff 1" bgroundedge="10" width="100" ></style>
<hotspot name="htsp01" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="-50"
html="SPOT No. 1" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true"
tag="hide" oversampling="2" onclick="hs_tag_click(get(name));"/>
<hotspot name="htsp02" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="0"
html="SPOT No. 2" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true"
tag="hide" oversampling="2" onclick="hs_tag_click(get(name));"/>
<hotspot name="htsp03" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="50"
html="SPOT No. 3" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true"
tag="hide" oversampling="2" onclick="hs_tag_click(get(name));"/>
|
San7, I would see this as a good example to have an un complicated 'find the pieces' game within a tour. 10 scene tour with a hotspot in each that you can click on. View all 10 scenes, click on the 10 hotspots and get the congratulations message, popup image or play some audio. Deactivating the hotspot action just lets you keep the actual hotspot image where it is.

|
|
Source code |
1 2 3 4 5 6 7 8 9 |
<action name="hs_tag_click" scope="local" args="name"> if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // only once! if(hotspot[get(name)].tag === 'hide', inc(global.hs_tag_count)); calc(plugin[hscount].html, '14/' + global.hs_tag_count); if(global.hs_tag_count === 14, set(layer[congratulations].visible, true)); <!--set(hotspot[get(name)].enabled, false)--> sessionStorage.setItem(hotspot[get(name)].enabled,false); var enabled = sessionStorage.getItem(hotspot[get(name)].enabled); </action> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<hotspot name="htsp01" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="-50"
html="SPOT No. 1" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true"
oversampling="2" onloaded="if(tag_htsp01, set(enabled, false))" onclick="hs_tag_click(get(name));"/>
<action name="hs_tag_click" scope="local" args="name" >
if(!global.tag_%1,
set(global.tag_%1, true);
set(hotspot[get(name)].enabled, false);
if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // only once!
inc(global.hs_tag_count));
calc(plugin[hscount].html, '3/' + global.hs_tag_count);
<!-- trace(global.hs_tag_count); -->
<!-- DISPLAY NEW LAYER ONCE ALL HOTSPOTS HAVE BEEN CLICKED -->
if(global.hs_tag_count == 3, set(layer[hscountComp].visible, true);
);
</action>
|
|
|
Source code |
1 2 3 4 5 6 7 8 |
<action name="hs_tag_click" scope="local" args="name"> if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // reset only once! if(hotspot[get(name)].tag === 'hide' AND hotspot[get(name)].counted === null, set(hotspot[get(name)].counted, true); // tag as counted inc(global.hs_tag_count); calc(plugin[hscount].html, '14/' + global.hs_tag_count); ); </action> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<action name="hs_tag_click" scope="local" args="name">
if(hs_list === null, set(global.hs_list, '')); // reset only once!
if(hotspot[get(name)].tag === 'hide',
calc(local.id, xml.scene + '/' + name); // create an id for the clicked hs
indexoftxt(local.index, get(hs_list), get(id)); // search in global
if(index LT 0, // not found, then add the id
if(hs_list, txtadd(hs_list, ',')); // add separator if count > 0
txtadd(hs_list, get(id)); // add id
);
trace('id=',id);
trace('list=',hs_list);
set(local.count, 0); // reset count
if(hs_list, // prevent empty global to be counted
txtsplit(get(hs_list), ',', local.arr); // split to get actual count
copy(count, arr.count); // set count
);
trace('count=',count);
copy(plugin[hscount].html, count); // set count
if(count === 10,
trace('wheee! you found all hotspots!');
);
);
</action>
|
This post has been edited 13 times, last edit by "indexofrefraction" (Mar 8th 2023, 8:25pm)
San7, your new code seems to work across multiple scenes but for some reason the counter is already at 1 when the first scene loads (before any hotspots are clicked)
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
<action name="hs_tag_click" scope="local" args="name" >
...
if(global.hs_tag_count === null, set(global.hs_tag_count, 0));
inc(global.hs_tag_count));
calc(plugin[hscount].html, '3/' + global.hs_tag_count);
...
trace(global.hs_tag_count);
...
</action>
|
|
|
Source code |
1 2 3 4 5 6 |
<layer name="hscount" type="text" font="arial" css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;" width="80" height="30" bgcolor="0xffffff" align="topleft" bgalpha="0.8" keep="true" zorder="9999" x="15" y="15" onloaded="hs_tag_click(get(name));" /> <layer name="hscountComp" type="text" font="arial" css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;" height="30" bgcolor="0xffffff" align="topright" bgalpha="0.8" keep="true" zorder="9999" x="15" y="15" html="Completed" visible="false"/> <style name="skin_hotspot" bgcolor="0x336699" bgalpha="0.6" css="font-family:Helvetica;color:#ffffff;font-size:14px;" bgborder="1 0xffffff 1" bgroundedge="10" width="100" ></style> <action name="hs_tag_click" scope="local" args="name" > if(!global.tag_%1, set(global.tag_%1, true); set(hotspot[get(name)].enabled, false); if(global.hs_tag_count === null, set(global.hs_tag_count, 0)); // only once! inc(global.hs_tag_count)); calc(plugin[hscount].html, '3/' + global.hs_tag_count); showlog(); trace(global.hs_tag_count);<!-- --> <!-- DISPLAY NEW LAYER ONCE ALL HOTSPOTS HAVE BEEN CLICKED --> if(global.hs_tag_count == 3, set(layer[hscountComp].visible, true); ); </action> |
|
|
Source code |
1 |
<hotspot name="htsp01" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="-50" html="SPOT No. 1" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true" oversampling="2" onloaded="if(tag_htsp01, set(enabled, false))" onclick="hs_tag_click(get(name));"/> |
|
|
Source code |
1 2 |
<hotspot name="htsp02" type="text" distorted="true" ath="0" atv="0" style="skin_hotspot" oy="-50" html="SPOT No. 2" padding="2 8" vcenter="true" depth="500" mipmapping="true" enabled="true" oversampling="2" onloaded="if(tag_htsp02, set(enabled, false))" onclick="hs_tag_click(get(name));"/> |
<layer name="hscount" ... onloaded="hs_tag_click(get(name));" />
Can you explain why you have loading in a layer hscount![]()
|
|
Source code |
1 2 |
<layer name="hscount" ... html="3/0" onloaded="" <style name="skin_hotspot" ... onclick.addevent="hs_tag_click(get(name));" /> |
This post has been edited 2 times, last edit by "San7" (Mar 9th 2023, 7:30am)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<layer name="hscount" type="text" keep="true" align="topleft" x="15" y="15" width="80" height="30" enabled="false" zorder="9999"
font="arial" css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;" bgcolor="0xffffff" bgalpha="0.8"
html="3/0" />
<layer name="hscountComp" type="text" font="arial" css="text-align:center;font-weight:bold;color:#0114DD;font-size:25px;" height="30" visible="false"
enabled="false" bgcolor="0xffffff" align="topright" bgalpha="0.8" keep="true" zorder="9999" x="15" y="15" html="Completed" />
<style name="skin_hotspot" keep="false" type="text" ath="0" atv="0" width="100" depth="500" distorted="true" bgcolor="0x336699" bgalpha="0.6"
css="font-family:Helvetica;color:#ffffff;font-size:14px;" padding="2 8" vcenter="true" oversampling="2"
bgborder="1 0xffffff 1" bgroundedge="10" mipmapping="true"
onclick.addevent="hs_tag_click(get(name));"></style>
<action name="hs_tag_click" scope="local" args="name" >
if(!global.tag_%1,
set(global.tag_%1, true);
set(hotspot[get(name)].enabled, false);
if(global.hs_tag_count === null, set(global.hs_tag_count, 0));
inc(global.hs_tag_count));
calc(plugin[hscount].html, '3/' + global.hs_tag_count);
if(global.hs_tag_count == 3, set(layer[hscountComp].visible, true);
);
</action>
<hotspot name="htsp01" style="skin_hotspot" oy="-50" html="SPOT No. 1" onloaded="if(tag_htsp01, set(enabled, false))"/>
<hotspot name="htsp02" style="skin_hotspot" oy="0" html="SPOT No. 2" onloaded="if(tag_htsp02, set(enabled, false))" />
<hotspot name="htsp03" style="skin_hotspot" oy="50" html="SPOT No. 3" onloaded="if(tag_htsp03, set(enabled, false))"/>
|
|
|
Source code |
1 |
<hotspot name="htsp02" style="skin_hotspot" oy="0" html="SPOT No. 2" /> |
|
|
Source code |
1 |
<hotspot name="htsp01" style="skin_hotspot" oy="-50" html="SPOT No. 1" onloaded="if(tag_htsp01, set(enabled, false))"/> |