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.

Erickh

Beginner

  • "Erickh" started this thread

Posts: 4

Location: France

Occupation: Watercolour painter and illustrator

  • Send private message

1

Tuesday, November 29th 2022, 2:40pm

How to save the last scene...Beginner/Game

Hello, I'm beginner and a new user with krpano.( and I dont't speak english very well.).

I tried to find on the forum but it's not easy...Actually, I would like to edit a sort of little "game".

I'm editing a tour with my drawings, it's ok but I 'm looking for a way to save the informations when I shut down the browser (lookat, last visit etc).

Is it possible to find the informations of browser and copy / overwrite them in the tour.xml ( xml, script php or else)?

Many thanks,

Tuur

Sage

Posts: 3,784

Location: Netherlands

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

  • Send private message

2

Tuesday, November 29th 2022, 5:20pm

Hi,

Did you try with a 'cookie' or 'localstorage' ?

I did

Tuur
*thumbsup*

Erickh

Beginner

  • "Erickh" started this thread

Posts: 4

Location: France

Occupation: Watercolour painter and illustrator

  • Send private message

3

Wednesday, November 30th 2022, 12:29am

Hi Tuur,
Thanks for your answer. And sorry. I'm late...I was working and trying to understand. Actually, I'm just at the begining *cry*
Here is just a wrong draft, but I imagine something like this with a javascript fonction:

[code]script or function savelookat(){
var hlookatvalue = storage.getItem('hlookat');
var vlookatvalue = storage.getItem('vlookat');
var hlookatelement = document.getElementById('hlookat');
var vlookatelement = document.getElementById('vlookat');......}[code]

But after I don't see at all how to replace the values in the tour.xml (wich gives value to tour.html.) *confused*
I will call the function with a script button in ../tour.html I think.

Well, maybe nothing's right with it. Maybe you can help me with links or krpano examples to go further.

Many Thanks
Erickh
( I only used a bit PHP with html forms and tables to post my drawings and create my website )

Just for you to imagine the project, here is an old vtour test I've done. https://www.qsqc.xyz/test/vtour/tour.html

4

Wednesday, November 30th 2022, 8:56am

there are a lot of tuts about cookies and localstorage
for example these ones
https://www.tutorialspoint.com/javascrip…ipt_cookies.htm
https://www.geeksforgeeks.org/javascript-localstorage/

you basically need to write/update the cookie in the onviewchange or maybe better the onidle event
and on page load you need to read the cookie and set the view parameters

Source code

1
var hlookatelement = document.getElementById('hlookat');

there are no such elements. you would do

Source code

1
krpano.set("view.hlookat", hlookat_from_cookie);

https://krpano.com/docu/xml/#view
https://krpano.com/docu/xml/#events.onviewchange

you can examine the standard vtourskin.xml,
search for "skin_deeplinking_update" and do it the same way

here is a template

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<events name="myevents" keep="true"
        onidle="cookie_deeplinking_write();"
        />

<action name="cookie_deeplinking_write" type="javascript"><![CDATA[
	var hlookat = krpano.get("view.hlookat");
	// ... write values
]]></action>

<action name="cookie_deeplinking_update_read" type="javascript" autorun="onstart"><![CDATA[
	// ... read values
	krpano.set("view.hlookat", 0);
]]></action>

This post has been edited 1 times, last edit by "indexofrefraction" (Nov 30th 2022, 9:17am)


Erickh

Beginner

  • "Erickh" started this thread

Posts: 4

Location: France

Occupation: Watercolour painter and illustrator

  • Send private message

5

Thursday, December 1st 2022, 2:46pm

So, many thanks indexofrefraction. And sorry! All wrong!!
so I erase my post... I just try to understand and I'll try post soon when I'll be a little bit further...

This post has been edited 1 times, last edit by "Erickh" (Dec 2nd 2022, 10:10am)


Erickh

Beginner

  • "Erickh" started this thread

Posts: 4

Location: France

Occupation: Watercolour painter and illustrator

  • Send private message

6

Saturday, December 3rd 2022, 2:53am

Well, I come back but I'm nearly at the same point.
I precise it's the very first time I try to use krpano with js and code
and my aims is not to have a solution but understand.
Indeed I allready imagine the mountains of possibilities it offers form many projects I have!
Well,

I tried many things firstly to get hlookat and write it...
The only thing I managed to do is inspired by this example and exploring the code:

https://krpano.com/releases/1.20.11/view…ples/index.html
-> When I copy all code and integrate my pano in my tour.html whith my own xml, all is ok.
-> but when I insert the same fonctions in my pano in fullscreen, buttons doesn't do anything. I don't know why.

Concerning the template and your indications, I can't go further without help.
Do I have to copy it in vtourskin: onidle write parameters every 0.5 sec (automatic saves)
or I've got to launch functions since html tour? in wich file do I have work?

Well, I hope you explain me a bit more so I can go further.
Thanks for your help,

Erickh

Similar threads