[EOS] Adding Saves to Established Tease

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
User avatar
ritewriter
Explorer At Heart
Explorer At Heart
Posts: 454
Joined: Sun Jan 02, 2022 6:51 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

[EOS] Adding Saves to Established Tease

Post by ritewriter »

Hi all,

I'm trying to add saves to my EVIL STEPMOMMY tease. I followed the tutorial on how to enable persistent data and I think I successfully created that part. But what I'm hoping is to save several variables and also create a positional save at a dozen or so predetermined save gates, then let the returning player jump back to where they left off.

I'm not a programmer at all, so I'm clueless about all of that.

PROBLEM ONE: Creating and using save points. I was thinking of creating a persistent variable called "place" then have a few points where I can set place=x at key points in the game. What I'd love is to have a way to have a GOTO command that would GOTO PLACE triggered by a CONTINUE PREVIOUS GAME choice on the START page. I guess I could do:

If PLACE == 1 Then GOTO Pagename.
If PLACE == 2 Then GOTO Pagename.
If PLACE == 3 Then GOTO Pagename.

But I'd rather not build a giant If/Then tree. Is there a more elegant way to do this?

PROBLEM TWO: Loading variables. I have many many variables. Do I have to create a Set.item command for each one? Where do I do that? In InitScript? Or do I have the game save the variable at the same time I have it save the PLACE variable. Do I have to write a separate GetItem command for each variable right at the beginning?

I'm in way above my head but I think my game is getting big enough save states would be useful.

Any help would be greatly appreciated.
Thamrill
Explorer At Heart
Explorer At Heart
Posts: 301
Joined: Thu Jan 03, 2013 4:55 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

Re: [EOS] Adding Saves to Established Tease

Post by Thamrill »

ritewriter wrote: Thu Aug 04, 2022 12:07 am PROBLEM ONE: Creating and using save points. I was thinking of creating a persistent variable called "place" then have a few points where I can set place=x at key points in the game. What I'd love is to have a way to have a GOTO command that would GOTO PLACE triggered by a CONTINUE PREVIOUS GAME choice on the START page. I guess I could do:

If PLACE == 1 Then GOTO Pagename.
If PLACE == 2 Then GOTO Pagename.
If PLACE == 3 Then GOTO Pagename.

But I'd rather not build a giant If/Then tree. Is there a more elegant way to do this?
If you save directly the page name simply use pages.goto('Pagename'), or define pages named something like "CheckpointX", save just the number and use pages.goto('Checkpoint'+PLACE)
ritewriter wrote: Thu Aug 04, 2022 12:07 am PROBLEM TWO: Loading variables. I have many many variables. Do I have to create a Set.item command for each one? Where do I do that? In InitScript? Or do I have the game save the variable at the same time I have it save the PLACE variable. Do I have to write a separate GetItem command for each variable right at the beginning?

I'm in way above my head but I think my game is getting big enough save states would be useful.
If you don't have a good knowledge of how to pack many variable into one, then you better write one set and get item per variable, it's cumbersome but less prone to error. Set have to be called whenever you want to save a variable, so if you plan to have chekpoin it's better to save all variables at those specific points, otherwise it may mess up the game logic.
Image

Image

Image
User avatar
ritewriter
Explorer At Heart
Explorer At Heart
Posts: 454
Joined: Sun Jan 02, 2022 6:51 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: [EOS] Adding Saves to Established Tease

Post by ritewriter »

Thamrill wrote: Thu Aug 04, 2022 5:48 am
If you save directly the page name simply use pages.goto('Pagename'), or define pages named something like "CheckpointX", save just the number and use pages.goto('Checkpoint'+PLACE)
Thank you!

Just to be clear, since I'm a moron with coding, if I have a page called pool, is the command:
pages.goto('pool')
or
pages.goto(pool)
?
User avatar
ritewriter
Explorer At Heart
Explorer At Heart
Posts: 454
Joined: Sun Jan 02, 2022 6:51 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: [EOS] Adding Saves to Established Tease

Post by ritewriter »

Thamrill wrote: Thu Aug 04, 2022 5:48 am
If you save directly the page name simply use pages.goto('Pagename'), or define pages named something like "CheckpointX", save just the number and use pages.goto('Checkpoint'+PLACE)
Also, do I have to do something like:

INIT: checkpoint=null

START PAGE:
EVAL: teaseStorage.getItem(checkpoint)
EVAL: pages.goto(checkpoint)

CHECKPOINT PAGE
EVAL: teaseStorage.setItem(checkpoint,pool)

Is that correctly formatted? Should it be ('checkpoint') or (checkpoint)

Much appreciated!
Thamrill
Explorer At Heart
Explorer At Heart
Posts: 301
Joined: Thu Jan 03, 2013 4:55 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

Re: [EOS] Adding Saves to Established Tease

Post by Thamrill »

ritewriter wrote: Thu Aug 04, 2022 5:33 pm
Thamrill wrote: Thu Aug 04, 2022 5:48 am
If you save directly the page name simply use pages.goto('Pagename'), or define pages named something like "CheckpointX", save just the number and use pages.goto('Checkpoint'+PLACE)
Also, do I have to do something like:

INIT: checkpoint=null

START PAGE:
EVAL: teaseStorage.getItem(checkpoint)
EVAL: pages.goto(checkpoint)

CHECKPOINT PAGE
EVAL: teaseStorage.setItem(checkpoint,pool)

Is that correctly formatted? Should it be ('checkpoint') or (checkpoint)

Much appreciated!
everytime you use text you should use ' ', you use text without single quote only if it is a variable name.

So for example you would write:

console.log('Hello world')

to call the log method of the console object with the string Hello world. This is referred to as using a literal argument.

If you define a variable such as:

var varName='Hello world';

then you define a variable named varName(mind you, variable names must start with a letter and can contain only letters, digits and underscores (I think)) which contains the literal Hello world.

Then you may use the variable in place of its content:

console.log(varName);

which would be the same as:

console.log('Hello world');

In your case it would be:

INIT: checkpoint='';

START PAGE
Be careful here: if you start the tease for the first time there is no 'checkpoint' variable in the teaseStorage and this would not work
EVAL: checkpoint=teaseStorage.getItem('checkpoint')

I've seen people use this type of instruction to give a default value to the variable; obviously replace page1 one to the name of the page where you should go with a new game

checkpoint=teaseStorage.getItem('checkpoint')|'page1'

EVAL: pages.goto(checkpoint)

CHECKPOINT PAGE
EVAL: teaseStorage.setItem('checkpoint','pool')
Image

Image

Image
User avatar
ritewriter
Explorer At Heart
Explorer At Heart
Posts: 454
Joined: Sun Jan 02, 2022 6:51 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: [EOS] Adding Saves to Established Tease

Post by ritewriter »

I think I understand that.

So if I have a numerical variable called edge, which represents the number of times the MC has edged.

In INIT I add an EVAL:
edge=0

At the save point I EVAL:
teaseStorage.setItem('edge',edge)

Then on startup I EVAL:
edge=teaseStorage.getItem('edge')

Does that look right?

Does the same thing apply to strings? IE if I have a string variable yourname, which is the MC's name, entered via a PROMPT, do I do...

INIT:
yourname="null"

SAVE POINT:
teaseStorage.setItem('yourname',yourname)

STARTUP:
yourname=teaseStorage.getItem('yourname')

Thanks again for the help. I'd be lost without it.
Thamrill
Explorer At Heart
Explorer At Heart
Posts: 301
Joined: Thu Jan 03, 2013 4:55 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

Re: [EOS] Adding Saves to Established Tease

Post by Thamrill »

ritewriter wrote: Thu Aug 04, 2022 8:15 pm I think I understand that.

So if I have a numerical variable called edge, which represents the number of times the MC has edged.

In INIT I add an EVAL:
edge=0

At the save point I EVAL:
teaseStorage.setItem('edge',edge)

Then on startup I EVAL:
edge=teaseStorage.getItem('edge')

Does that look right?

Does the same thing apply to strings? IE if I have a string variable yourname, which is the MC's name, entered via a PROMPT, do I do...

INIT:
yourname="null"

SAVE POINT:
teaseStorage.setItem('yourname',yourname)

STARTUP:
yourname=teaseStorage.getItem('yourname')

Thanks again for the help. I'd be lost without it.
Yes, but a I guess it should be:

INIT:
yourname=null

if you set it to 'null' it contains the string null, while if you set it null, you set it to a sort-of unset status
Image

Image

Image
User avatar
ritewriter
Explorer At Heart
Explorer At Heart
Posts: 454
Joined: Sun Jan 02, 2022 6:51 am
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: [EOS] Adding Saves to Established Tease

Post by ritewriter »

Thank you! I think I have all I need to add some save spots now.

I appreciate the help.
Post Reply