New to Twine, Hella Dumb. Help.

Aug 15, 2020
25
24
This is an anchor post, for lack of better terms, I am working in
TWINE
SUGARCUBE 2.2x.xx
(Intending to follow updates)
I have no real experience as a programmer or game dev, but I am looking to make a game that is a bit more visual novel, than rpg but with some elements of rpgs. I am going to ask questions here, and would love to hear your answers, and suggested paths to them.

Now the current issue, I am currently trying to make a Lust Bar in the UI of the side bar, I have been trying to figure this out for a bit, and am at something of an inpimpasse. I see a Javascript file from " " has meters, but I don't know how to use Javascript files with twine either. Answers to both of these questions would be certifiably rad, and appreciated. However, a single one answered would be very nice too. Thanks for taking the time to read this, regardless.
 

Deleted member 609064

Well-Known Member
May 11, 2018
1,249
1,590
Find another game with a meter or bar in it, and reverse engineer how it was placed. Most TWINE games have a meter (or many of them).

Also, give this a read

 

Rafster

Bear chaser
Game Developer
Mar 23, 2019
2,099
4,087
The stat bars are a thing that I try to avoid in my game, I struggle to understand them, a lot. But sometime I'll have to make one. I dread that day.
 
Aug 15, 2020
25
24
Find another game with a meter or bar in it, and reverse engineer how it was placed. Most TWINE games have a meter (or many of them).

Also, give this a read

Good advice, friend. I'll give it a try! I think I need to know how to use javascript in twine.

The stat bars are a thing that I try to avoid in my game, I struggle to understand them, a lot. But sometime I'll have to make one. I dread that day.
Have you made a twine game before, I dont see anything under your profile? (edit:Asking to see if you could suggest other ways to go about this, not trying to sound instigate-ey)
 

Rafster

Bear chaser
Game Developer
Mar 23, 2019
2,099
4,087
Have you made a twine game before, I dont see anything under your profile? (edit:Asking to see if you could suggest other ways to go about this, not trying to sound instigate-ey)
I'm on the process of making one, I started on November 2020 (just like you, I didn't know anything about twine, HTML or Javascript. I have experience as a programmer, but I had zero experience on this field). I'm getting near of the point I can make a dev thread here on F95 and post a demo soon.

Stat bars would make my game look nicer, but I'm focusing on other aspects first before I get to it.
 
Last edited:
Aug 15, 2020
25
24
I'm on the process of making one, I started on November 2020 (just like you, I didn't know anything about twine, HTML or Javascript. I have experience as a programmer, but I had zero experience on this field). I'm getting near of the point I can make a dev thread here on F95 and post a demo soon.

Stat bars would make my game look nicer, but I'm focusing on other aspects first before I get to it.
I think that's a good idea, so I'll just set some base variables for it, and move on for now. Good luck with your project my dude, let me know how it turns out!
 

guest1492

Member
Apr 28, 2018
350
288
This is some of what I came up with while trying to make my own game:
Code:
::StoryCaption
<<nobr>>
    /* stuff */
    <table id="playerStats">
        <tr><td>Health</td><td><div id="ui_health_bar"/></td><td id="ui_health_num"/></tr>
        <tr><td>Libido</td><td><div id="ui_libido_bar"/></td><td id="ui_libido_num"/></tr>
        <tr><td>Sanity</td><td><div id="ui_sanity_bar"/></td><td id="ui_sanity_num"/></tr>
    </table>
    <<UI_health>><<UI_libido>><<UI_sanity>><hr>
    /* more stuff */
<</nobr>>


:: UIwidgets [widget]
<<widget UI_health>><<silently>>
    <<set _txt = "<span style='width: " + $people.grey.health + "%; background-color: hsl(" + ($people.grey.health * 1.2) + ", 100%, 50%)'/>">>
    <<replace "#ui_health_bar">>_txt<</replace>>
    <<replace "#ui_health_num">>$people.grey.health<</replace>>
<</silently>><</widget>>

<<widget UI_libido>><<silently>>
    <<set _txt = "<span style='width: " + $people.grey.libido + "%; background-color: hsl(" + (120 - $people.grey.libido * 1.2) + ", 100%, 50%)'/>">>
    <<replace "#ui_libido_bar">>_txt<</replace>>
    <<replace "#ui_libido_num">>$people.grey.libido<</replace>>
<</silently>><</widget>>

<<widget UI_sanity>><<silently>>
    <<set _txt = "<span style='width: " + $people.grey.sanity + "%; background-color: hsl(" + ($people.grey.sanity * 1.2) + ", 100%, 50%)'/>">>
    <<replace "#ui_sanity_bar">>_txt<</replace>>
    <<replace "#ui_sanity_num">>$people.grey.sanity<</replace>>
<</silently>><</widget>>


:: StatusWidgets [widget]
<<widget health>><<silently>>
    <<if ndef $args[0]>>
        <<run console.log("Widget 'health' missing variable input.")>>
    <<else>>
        <<= '<<set $people.grey.health += ' + $args.join(" ") + '>>' >>
        <<set $people.grey.health = Math.clamp($people.grey.health, 0, 100)>>
        <<UI_health>>
    <</if>>
<</silently>><</widget>>

<<widget libido>><<silently>>
    <<if ndef $args[0]>>
        <<run console.log("Widget 'libido' missing variable input.")>>
    <<else>>
        <<= '<<set $people.grey.libido += ' + $args.join(" ") + '>>' >>
        <<set $people.grey.libido = Math.clamp($people.grey.libido, 0, 100)>>
        <<UI_libido>>
    <</if>>
<</silently>><</widget>>

<<widget sanity>><<silently>>
    <<if ndef $args[0]>>
        <<run console.log("Widget 'sanity' missing variable input.")>>
    <<else>>
        <<= '<<set $people.grey.sanity += ' + $args.join(" ") + '>>' >>
        <<set $people.grey.sanity = Math.clamp($people.grey.sanity, 0, 100)>>
        <<UI_sanity>>
    <</if>>
<</silently>><</widget>>
And the CSS:
Code:
#playerStats {
    width: 100%;
}
#playerStats td:first-child {
    text-align: left;
}
#playerStats td:nth-child(2) {
    width: 100%;
    padding: 0.25em;
}
#playerStats td:last-child {
    text-align: right;
}
#playerStats td:nth-child(2) > div {
    background-color: #555;
    height: 1em;
    width: 100%;
    border-radius: 0.5em;
}
#playerStats td:nth-child(2) > div > span {
    display: block;
    height: 100%;
    border-radius: 0.5em;
}
I had all my characters as properties inside $people so $people.grey was my MC.
 
Aug 15, 2020
25
24
Trying to make the lust variable decay when it's between 90-100, so you don't just jizz in the middle of the street (unless you have a perk for it,) any suggestions on how to do that? I tried setting up the code I have included in "StoryInit" and it didn't work, so figured I'd ask.

Code:
<<if $lp >= 90 && $lp <= 100>>
<<$lp -=1 loop>>
<</if>>
 
  • Haha
Reactions: Cul

guest1492

Member
Apr 28, 2018
350
288
Trying to make the lust variable decay when it's between 90-100, so you don't just jizz in the middle of the street (unless you have a perk for it,) any suggestions on how to do that? I tried setting up the code I have included in "StoryInit" and it didn't work, so figured I'd ask.
"StoryInit" only runs when you start a new game and doesn't run again afterwards. How to do it really depends on how you have your game set up. As an example, this is something else I put together while trying to make a game:
Code:
:: TimeWidget [widget]
<<widget time>><<silently>>
    <<if ndef $args[0]>>
        <<set _delta = 1>>
    <<else>>
        <<= '<<set _delta = ' + $args.join(" ") + '>>' >>
    <</if>>
    <<set $gameTime += _delta>>
    /* stuff */
    <<health _delta * 3>>
    <<libido _delta * 3>>
    /* more stuff */
<</silently>><</widget>>
So whenever I wanted time to pass in the game, I called the <<time>> widget and then inside the widget it takes care of stuff that should happen every time period. In the code above, I gave the player 3 health regeneration and increased libido by 3 every period. If you have something similar, you could add a conditional to check what the player's lust is and just lower that if it's too high.
 
  • Like
Reactions: Action-B4stard
Aug 15, 2020
25
24
"StoryInit" only runs when you start a new game and doesn't run again afterwards. How to do it really depends on how you have your game set up. As an example, this is something else I put together while trying to make a game:
Code:
:: TimeWidget [widget]
<<widget time>><<silently>>
    <<if ndef $args[0]>>
        <<set _delta = 1>>
    <<else>>
        <<= '<<set _delta = ' + $args.join(" ") + '>>' >>
    <</if>>
    <<set $gameTime += _delta>>
    /* stuff */
    <<health _delta * 3>>
    <<libido _delta * 3>>
    /* more stuff */
<</silently>><</widget>>
So whenever I wanted time to pass in the game, I called the <<time>> widget and then inside the widget it takes care of stuff that should happen every time period. In the code above, I gave the player 3 health regeneration and increased libido by 3 every period. If you have something similar, you could add a conditional to check what the player's lust is and just lower that if it's too high.
I really appreciate you trying to help, thank you. I dont understand how to create a widget (or for that matter use more than one javascript at a time, which I think is related?) I just looked it up on motoslave, and it's still not clear to me. If a widget does something in the background, to make what I need, should I do a...

Code:
<<widget "cum">>
    <<if $lp > 90 >> lp -= 1 <<elseif $lp >= 100 && $premature = true>> Popup event about jizzing in pants <<elseif>> $lp >= 100 set $lp to 100 , set $climaxstate to true <</if>>
<</widget>>
 

guest1492

Member
Apr 28, 2018
350
288
You can think of a widget as a custom function you can write. If you don't know what a function is, it's basically a set of instructions. When I use <<time>> the engine is supposed to execute all the code that I wrote for the time widget. If I didn't write the widget, then I would have to include all that code each time I wanted to advance time in the game.
And there are many situations where you would want to advance time: talking to someone, working, going to sleep, etc.

All my previous posts contain examples of how to write a widget. As for how to use a widget, here are some simple examples:
Code:
<<link "Wait">><<time>><</link>>
<<link [[Go to work|Work]]>><<time 2>><</link>>
<<link "Go to bed">><<time 3>><<goto "Sleep">><</link>>
 
Aug 15, 2020
25
24
Okay, so I've been doing some homework, and I think I am getting somewhere now! I'm going to post the code I've gotten thus far, and I would love to hear thoughts on it. Again, this is essentially the info on either jizzing in your pants or not. (Considering adding a weird curse that turns it into a DC 5 roll like a D&D skill check later on for non-premature, but that's later.)
Code:
<<widget cum>><<silently>>
    <<if $lp >= 90>>
        <<set $lp -= 1>>
    <<elseif $lp <= 100>>
        <<if $premature isnot "true">>
            <<set $lp to 100>>
        <<else>>
            <<if $populated is "true">>
            <!--Show content for cumming on the street, considering a DC 10+/- stealth check to see how well you hid it, maybe give modifiers in how you get rid of it?--->
            <<else>>
            <!--show content for jizzing in the less populated areas, maybe there is a way to check a number for passages and have some variety to it?--->
            <</if>>
        <</if>>
    <</if>>
<</silently>><</widget>>
 

Alcahest

Engaged Member
Donor
Game Developer
Jul 28, 2017
3,483
4,325
My next game will be made in Twine/Sugarcube 2. Having no experience with Twine/HTML games, the first thing I did was to follow these instructions for setting up a health bar. It works fine.
 
Aug 15, 2020
25
24
My next game will be made in Twine/Sugarcube 2. Having no experience with Twine/HTML games, the first thing I did was to follow these instructions for setting up a health bar. It works fine.
Thank you for the link! I just checked this out, I've still been working. I'm trying to make a system where clothing covers slots now, and I just saw that the link you posted could probably help! thank you.
 
Aug 15, 2020
25
24
I've got an equipment system figured out, now I want to know how to make a system for tracking how much cum is on you.
 

guest1492

Member
Apr 28, 2018
350
288
Given what you said before about how your MC might jizz in the middle of the street, your MC should be male. So can't you just use a variable to track how much cum is left in his balls (and regenerate it over time)?

If your game is going to be gay (no judgment) and you're going to have other people cum on the MC, then can't you just keep a separate variable for that? Or if you're going to track it by body part, use an array?
 
Aug 15, 2020
25
24
Given what you said before about how your MC might jizz in the middle of the street, your MC should be male. So can't you just use a variable to track how much cum is left in his balls (and regenerate it over time)?

If your game is going to be gay (no judgment) and you're going to have other people cum on the MC, then can't you just keep a separate variable for that? Or if you're going to track it by body part, use an array?
The game is gonna be hella gay, arguably the gayest. As far as tracking with a variable, I'm currently trying to, but the issue is I want to have jizz be a currency for specific events, and tracking it all has been difficult for some reason. I think I have some systems for it more figured out now, and just need to implement them, so I'll be sure to give updates.

Do I have to include combat in a fantasy game? I have no interest in it, and dont get why people want it in lewd rpg's but if it is such a must, I suppose I could figure something out. (I'd literally rather just see the lewd encounter play out, but that's me.)