First webstease - Coding help for getting items

All about the past, current and future webteases and the art of webteasing in general.
---
Post Reply
Thusa
Curious Newbie
Curious Newbie
Posts: 4
Joined: Wed Dec 02, 2015 8:27 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

First webstease - Coding help for getting items

Post by Thusa »

Hello !

I've benn playing teases for a long time and now I was thinking I wanted to create one that would be "game like" (like Futa Island on CHYOA if you know it). I'd like to make the player be able to pick up items to use later with a check if they have them. Should I do something like "Item=True;" ?

I understand coding (I think) but I've never studied it. So does anybody has either a ressource that would help so I won't ask for every problem I have or the direct solution for this one ?
User avatar
Augustulus
Explorer At Heart
Explorer At Heart
Posts: 659
Joined: Fri Dec 25, 2015 4:27 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: First webstease - Coding help for getting items

Post by Augustulus »

Hey :wave:,

great, that you want to try and make your first tease :-).
I may not the best to help you especially with teases but I have decent experience with coding.
I also skipped only a little bit through "Futa Island", but couldn't really determine how items are handled there.

In general I would say that you should go with less variables to keep the overview. You can for example have a variable called "playerUnderwear". You then assign a string to this variable with the type of underwear the player is currently wearing. For example if the player removes all his clothes it could be something like this: playerUnderwear = "none";
If then the player buys a thong you would set the variable to playerUnderwear = "thong";
There is also the possibility to create arrays, that hold more than one value. Like if you want to have an inventory for the player.
You might find help here: Also you might search that site for more help.

Lastly: creating things (like teases) that are not linear can get really complex in a short time. From my experience it is best to start with as little as possible and then consecutively add new things. Therefore you might want to think about a simple to use and extendable system for your items before doing too much of the story.

Hope that I could help a little bit,
Augustulus
fapnip
Explorer At Heart
Explorer At Heart
Posts: 431
Joined: Mon Apr 06, 2020 1:54 pm

Re: First webstease - Coding help for getting items

Post by fapnip »

Thusa wrote: Fri Jul 23, 2021 11:54 pm does anybody has either a ressource that would help so I won't ask for every problem I have or the direct solution for this one ?
I would start here:
viewtopic.php?f=2&t=22570
Thusa
Curious Newbie
Curious Newbie
Posts: 4
Joined: Wed Dec 02, 2015 8:27 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: First webstease - Coding help for getting items

Post by Thusa »

I'm already using this as a reference and it's amazing.
Having a few issues with the true/false statments but thanks !
fapnip
Explorer At Heart
Explorer At Heart
Posts: 431
Joined: Mon Apr 06, 2020 1:54 pm

Re: First webstease - Coding help for getting items

Post by fapnip »

Thusa wrote: Sat Jul 24, 2021 7:04 pm I'm already using this as a reference and it's amazing.
Having a few issues with the true/false statments but thanks !
In your Init Script, do something like:

Code: Select all

var items = {
 a: false,
 b: false,
 c: false,
 // and so on...
}
(Keep the property names short, like the a, b, c in the example -- this allows you to more easily save the items object to "tease storage" should you ever want to do so, allowing game state to be saved/restored. We're only allowed 1KB for storage however, including all the encoding needed, hence the need to keep things terse on variables/objects that you may want to store. You could even use 0 and 1 instead of true and false to shorten things up even more.)

Then, in an eval action where you want to enable in item, do:

Code: Select all

items.a = true // set item "a"

// or you could do

items.b = true // set item "b"

// and so on...
Now, in an IF action, you could add the following as its condition:

Code: Select all

items.a
If items.a is true (or 1), the IF action will fall through to its "then" actions, if any. if false (or 0), it wall fall through to thr else actions, if any.
Thusa
Curious Newbie
Curious Newbie
Posts: 4
Joined: Wed Dec 02, 2015 8:27 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: First webstease - Coding help for getting items

Post by Thusa »

Wow thanks that's awsome !

I'll need to play around with that to fully understand but that's tremendous help.
Just to be sure, do i need to write the // ?
Thusa
Curious Newbie
Curious Newbie
Posts: 4
Joined: Wed Dec 02, 2015 8:27 pm
Gender: Male
Sexual Orientation: Straight
I am a: None of the above

Re: First webstease - Coding help for getting items

Post by Thusa »

Ok i just tried with the IF and it works, it enven solved an issue I had when i stored everything not in tables (i don't know if that's the term).

Thank you again
Post Reply