CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Html tutorial

Aug 3, 2020
35
31
Hello everyone, I'm interested in developing the classic html porn game.

I've been using twine and followng some tutorials for some basic things, but there's something I can't find.

For the classic scenario of a repetable task which shows a random gif of a selection, can someone give me some pointers?

I'd be really grateful
 

armyofrobots

Active Member
Game Developer
May 26, 2018
644
1,584
Hello everyone, I'm interested in developing the classic html porn game.

I've been using twine and followng some tutorials for some basic things, but there's something I can't find.

For the classic scenario of a repetable task which shows a random gif of a selection, can someone give me some pointers?

I'd be really grateful
You mean that every time someone hits that scene one of a variety of gifs will be played?

We try to make sure if you refresh the page it doesn't change what's shown or a random roll value, so we do this:

<<if Fresh()>><<set $randomRollA = random(1,5)>><<endif>>

This will set the variable randomRollA equal to a random value between 1 and 5.

Then inside the table we display things in:

<table>
<tr>
<td style="vertical-align: top">
<<if $randomRollA is 1>><span class="sectionimage">[img[img\chars\rachel\rachel_sex01.gif]</span><<endif>><<if $randomRollA is 2>><span class="sectionimage">[img[img\chars\rachel\rachel_sex02.gif]]</span><<endif>><<if $randomRollA is 3>><span class="sectionimage">[img[img\chars\rachel\rachel_sex03.gif]]</span><<endif>><<if $randomRollA is 4>><span class="sectionimage">[img[img\chars\rachel\rachel_sex04.gif]]</span><<endif>><<if $randomRollA is 5>><span class="sectionimage">[img[img\chars\rachel\rachel_sex05.gif]]</span><<endif>>
</td>
<td style="vertical-align: top"> [Text that appears in the section next to the image]
</td>
</tr>
</table>

Now if you're using a video file like a webm, the span looks like this:

<<if $randomRollA is 1>><span class="sectionimage"><video width="650" autoplay loop><source src="img\chars\rachel\sex1.webm" type=video/webm; codecs="vp8, vorbis"></video></span>

Hope that helps!
 
  • Like
Reactions: asfhgloasdfsdf
Aug 3, 2020
35
31
Yeah that's what I was looking for, thank you.
The solution I found after looking for a while was using an array and picking the urls from there, but my solution seems a bit spaghetti so I'll try your way!
 
  • Like
Reactions: armyofrobots
Aug 3, 2020
35
31
Happy to help!
Also one last question if you happen to know it.
I'm trying to force an event so it activates no matter the passage you're in so you can't unintenionally skip something important. The idea is that no matter where you are (classic beach, gym, whatever) the protagonists decides to go back home. I tried passageready and goto but that doesn't seem to work, it just displays an empty page. I'm kinda lost here.
 

Alcahest

Engaged Member
Donor
Game Developer
Jul 28, 2017
3,493
4,336
Also one last question if you happen to know it.
I'm trying to force an event so it activates no matter the passage you're in so you can't unintenionally skip something important. The idea is that no matter where you are (classic beach, gym, whatever) the protagonists decides to go back home. I tried passageready and goto but that doesn't seem to work, it just displays an empty page. I'm kinda lost here.
If you mean going home is triggered by some condition, then you can put this in your javascript.
JavaScript:
Config.navigation.override = function (dest) {
    if (State.variables.somevariable == "something") {
        return "goinghomepassage";
    }
}
 
  • Like
Reactions: armyofrobots
Aug 3, 2020
35
31
If you mean going home is triggered by some condition, then you can put this in your javascript.
JavaScript:
Config.navigation.override = function (dest) {
    if (State.variables.somevariable == "something") {
        return "goinghomepassage";
    }
}
Nice, thanks a lot, I will try that