Page 1 of 1

teaseStorage Help

Posted: Sun Aug 24, 2025 5:13 pm
by SpeshDetective
Hello all,

With the ability to upload new images to teases currently off the table, I have been unable to develop my tease further outside of improving how the base mechanics function. The final thing on my list to work on now, that isn't adding more content, is sorting out the teaseStorage so that player progress is saved when the tease is closed and reopened.

I have not done this before so would appreciate some assistance from someone that has.

The way I currently understand it is simply to set values and then get values. But knowing how to implement this properly is where my lack of experience is hindering me.

My tease works in a Rogue-Like fashion, so that the player completes multiple runs before getting strong enough through meta progression to take on the final boss of the tease. The player goes into battle and fights enemies, earning gold and experience, but also purchasing potions to increase stats that only effect the current run, with exp being spent on permanent stat increases.

I have a system that works where current-run stats get reset at the end of a run, but permanent stat increases are counted and used to calculate starting stats on a new run.

If I wanted to save progress during a run, I assume I would want to use teaseStorage.setItem() to save the values for Day, Time, Player Health, Gold, Exp etc after a battle or after a shop purchase.

Would I need to run a bunch of teaseStorage.getItem() to retrieve these values on the Start page? to essentially load the player into the state they were in the last time the game "saved"?

Re: teaseStorage Help

Posted: Mon Aug 25, 2025 7:53 am
by Thamrill
SpeshDetective wrote: Sun Aug 24, 2025 5:13 pm Hello all,

With the ability to upload new images to teases currently off the table, I have been unable to develop my tease further outside of improving how the base mechanics function. The final thing on my list to work on now, that isn't adding more content, is sorting out the teaseStorage so that player progress is saved when the tease is closed and reopened.

I have not done this before so would appreciate some assistance from someone that has.

The way I currently understand it is simply to set values and then get values. But knowing how to implement this properly is where my lack of experience is hindering me.

My tease works in a Rogue-Like fashion, so that the player completes multiple runs before getting strong enough through meta progression to take on the final boss of the tease. The player goes into battle and fights enemies, earning gold and experience, but also purchasing potions to increase stats that only effect the current run, with exp being spent on permanent stat increases.

I have a system that works where current-run stats get reset at the end of a run, but permanent stat increases are counted and used to calculate starting stats on a new run.

If I wanted to save progress during a run, I assume I would want to use teaseStorage.setItem() to save the values for Day, Time, Player Health, Gold, Exp etc after a battle or after a shop purchase.

Would I need to run a bunch of teaseStorage.getItem() to retrieve these values on the Start page? to essentially load the player into the state they were in the last time the game "saved"?
Basically, yes. You write values in the storage when you save and retrieve them when you load. If you have a lot of variables, you may consider some optimization of the code to reduce the number of saved variables, but as an initial just try and see how it works.

Just remember to give a default value for a load:

Code: Select all

var spacerString=teaseStorage.getItem("spS")||"B239";
This code loads the variable named spS in the spaceString variable; if the value is not found, it assigns it the default value "B239"

Re: teaseStorage Help

Posted: Mon Aug 25, 2025 10:06 am
by SpeshDetective
Thamrill wrote: Mon Aug 25, 2025 7:53 am Basically, yes. You write values in the storage when you save and retrieve them when you load. If you have a lot of variables, you may consider some optimization of the code to reduce the number of saved variables, but as an initial just try and see how it works.

Just remember to give a default value for a load:

Code: Select all

var spacerString=teaseStorage.getItem("spS")||"B239";
This code loads the variable named spS in the spaceString variable; if the value is not found, it assigns it the default value "B239"
My initial script currently assigns values like this:

Code: Select all

Attempt = 0;
Health = 100;
Max_Health = 100;
Gold = 0;
Exp = 0;
Stamina = 100;
Max_Stamina = 100;
Day = 1;
Time = 9;
Would I need to change these to look like this:

Code: Select all

var Attempt=teaseStorage.getItem("Atm")||"0";
var Health=teaseStorage.getItem("H")||"100";
var Max_Health=teaseStorage.getItem("MH")||"100";
var Gold=teaseStorage.getItem("G")||"0";
var Exp=teaseStorage.getItem("XP")||"0";
var Stamina=teaseStorage.getItem("Sta")||"100";
var Max_Stamina=teaseStorage.getItem("MSta")||"100";
var Day=teaseStorage.getItem("D")||"1";
var Time=teaseStorage.getItem("T")||"9";
If I'm understanding correctly, it should then get these values from Storage and if there is no value set, it will set them to the initial value as normal? And then I can run a check that says if Attempt > 0 load direct to the main page and skip the intro? or something similar to that.

I have read on the forums that other people have had trouble hitting max storage space, so I know there is a limit, hence the Storage variable names being abbreviations of the actual variable, so I plan on having 1-2 character variable names in the storage and having a key on my notepad to know what the matching names are.


My final question would be, does this work through the preview link I have sent out for people to test? As in would I be able to test that this is working without publishing the tease?

Re: teaseStorage Help

Posted: Mon Aug 25, 2025 1:57 pm
by Thamrill
SpeshDetective wrote: Mon Aug 25, 2025 10:06 am
My initial script currently assigns values like this:

Code: Select all

Attempt = 0;
Health = 100;
Max_Health = 100;
Gold = 0;
Exp = 0;
Stamina = 100;
Max_Stamina = 100;
Day = 1;
Time = 9;
Would I need to change these to look like this:

Code: Select all

var Attempt=teaseStorage.getItem("Atm")||"0";
var Health=teaseStorage.getItem("H")||"100";
var Max_Health=teaseStorage.getItem("MH")||"100";
var Gold=teaseStorage.getItem("G")||"0";
var Exp=teaseStorage.getItem("XP")||"0";
var Stamina=teaseStorage.getItem("Sta")||"100";
var Max_Stamina=teaseStorage.getItem("MSta")||"100";
var Day=teaseStorage.getItem("D")||"1";
var Time=teaseStorage.getItem("T")||"9";

If I'm understanding correctly, it should then get these values from Storage and if there is no value set, it will set them to the initial value as normal? And then I can run a check that says if Attempt > 0 load direct to the main page and skip the intro? or something similar to that.
Yes, the only thing I'm not certain about this is the conversion between string and number, you're probably ok with setting the values without quotes (e.g., var Exp=teaseStorage.getItem("XP")||0;), try and see. I'm no expert of Javascript, probably when you save the value as a number you load it as a number.

edit: I confirm it, if you want to work with numbers you can avoid the quotes and use them only for strings:

Code: Select all

	var Exp=teaseStorage.getItem("XP")||0;
	var Name=teaseStorage.getItem("name")||"Hero";
also, you may also setup the code so that in the init you do:

Code: Select all

	Health = 100;
and then in the loading code you do:

Code: Select all

	Health=teaseStorage.getItem("H")||Health;
SpeshDetective wrote: Mon Aug 25, 2025 10:06 am
I have read on the forums that other people have had trouble hitting max storage space, so I know there is a limit, hence the Storage variable names being abbreviations of the actual variable, so I plan on having 1-2 character variable names in the storage and having a key on my notepad to know what the matching names are.
Don't worry, unless you have many many variables, you shouldn't have any issue; is better to have descriptive names, so you don't mess up accidentally.
SpeshDetective wrote: Mon Aug 25, 2025 10:06 am
My final question would be, does this work through the preview link I have sent out for people to test? As in would I be able to test that this is working without publishing the tease?
Yes, it works also on previews and also for not-logged-in users.

Re: teaseStorage Help

Posted: Tue May 12, 2026 1:22 pm
by react
there is a way to keep the game active when I upload my tease for an upgrade?

After I reupload the tease, score get back to 0 for exemple.

Re: teaseStorage Help

Posted: Wed May 13, 2026 9:03 am
by Thamrill
react wrote: Tue May 12, 2026 1:22 pm there is a way to keep the game active when I upload my tease for an upgrade?

After I reupload the tease, score get back to 0 for exemple.
You mean like upload a new tease and you want to be able to access the data of another? If that's the case, then no, it's not possible. What you can do is implement a way to export/import data. It's not super difficult to implement but it depends a lot on the quantity and type of variables you want ot include.

Re: teaseStorage Help

Posted: Wed May 13, 2026 12:41 pm
by react
Thamrill wrote: Wed May 13, 2026 9:03 am You mean like upload a new tease and you want to be able to access the data of another? If that's the case, then no, it's not possible. What you can do is implement a way to export/import data. It's not super difficult to implement but it depends a lot on the quantity and type of variables you want ot include.
No I mean I've made a tease with an introduction. When complete, the introduction skip into a menu when you do the tease again. But I have make some changes on the tease and upload it again like a v1.2. After that when I come back on the tease I don't have acces anymore, I have to do the intro again.

I think when you upload again the same tease, it keep the same url. So I don't understand why everything in the teasestorage get back to default

EDIT: My bad I must be stupid. I think I just wasn't login :lol:

Re: teaseStorage Help

Posted: Thu May 14, 2026 6:56 am
by Thamrill
react wrote: Wed May 13, 2026 12:41 pm
Thamrill wrote: Wed May 13, 2026 9:03 am You mean like upload a new tease and you want to be able to access the data of another? If that's the case, then no, it's not possible. What you can do is implement a way to export/import data. It's not super difficult to implement but it depends a lot on the quantity and type of variables you want ot include.
No I mean I've made a tease with an introduction. When complete, the introduction skip into a menu when you do the tease again. But I have make some changes on the tease and upload it again like a v1.2. After that when I come back on the tease I don't have acces anymore, I have to do the intro again.

I think when you upload again the same tease, it keep the same url. So I don't understand why everything in the teasestorage get back to default

EDIT: My bad I must be stupid. I think I just wasn't login :lol:
Glad to know you were able to figure it out :wave: