[R>Programmer] Share Unpaid I really Need one time Twine Coding help

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
Hello Guys my name is Roy and i really need a coder to help me out

this is the link to my game page https://f95zone.to/threads/corruption-through-magic-and-science-v0-07-ajlee7385.30827/

hey guys ive mage a lot of progress last few days but still having issues i really really really need some to do me a solid and download this version and either check out my archive im still trying to fix areas for first path so some please just look at puts some codes in to get further along. ive been at this a week and feel like ive barely made a dent.


Ive been getting a lot of coding help on discord so im good for the moment ty guys
 
Last edited:

Arcticman

Newbie
Aug 29, 2018
63
74
Hi!

I've dabbled with Twine and Sugarcube before, and even though I don't have time to help write any significant amount of code for you I'd like to point you in the right direction.

Twine parses the StoryInit passage (In your story you have misspelled this passage, I think Twine is case sensitive in this case) before most other things, so it's in this file you want to do variable declarations. It's in this file you're going to create objects that represents your characters.

A working example:
Go to the Kelly's Bedroom passage and add the following code at the bottom after the <</if>> statement.

<<set $Kelly to {
name : 'Kelly',
affection : 0,
gender: 'female'
}>>

Below that add the following code:
<<= $Kelly.name>> is a <<= $Kelly.gender>> and has <<= $Kelly.affection>> affection towards you.

Now you can test the passage directly from the Twine dashboard and you will get the following result:

ProgrammingHelp.PNG

What do to next:
Create one object for each character in your game in the StoryInit passage. This should allow you to change the characters values when something happens in the game.

For example, if you want to increase the affection of Kelly you'd do:
<<set $Kelly.affection += 1>>

If you want to add options (such as specific sex acts) depending on a characters affection you can use something like the following:
<<if $Kelly.affection > 10>>
*Add options here*
<</if>>

I hope this will help you. If you have any further questions you can post them here and I'll try to reply when I can.

Good luck!
 

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
I firued out how to add the resources now i just gotta figure out how to add my story back in with ought breaking the game if first completed gives me missing if closer macro error if i chose elseif get some kind of outside the parent child macro error.
 
  • Like
Reactions: Canto Forte

Arcticman

Newbie
Aug 29, 2018
63
74
I firued out how to add the resources now i just gotta figure out how to add my story back in with ought breaking the game if first completed gives me missing if closer macro error if i chose elseif get some kind of outside the parent child macro error.
What do you mean adding your story back in? If you get an if closer macro error that sounds like you forgot a closing <</if>> statement for the <<if>> tag. The error of outside of "parent child macro" sounds like you put the <<elseif>> in to a passage without an <<if>> before it.
 
  • Like
Reactions: Canto Forte

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
after else

i added <<else if visited() is 0>>

then my story

even tried

<<else if energy < 10>>

[[Got to Bed|You bedroom]]

[[Go to Doctor|Doctors Office]]

this is what pops up

335868

both my story and the first else show up i thought else didn't need a closer
 

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
if its simply i need an if before it do i writ like this

<<if>> <<else if visited() is 0>>

or something else

i thought it might be a storyInit error as well but when i put in

<<set $visited Bedroom to 0>>

get bad exemption error whatever that means

then i tried putting



<< if visited() is 0>>

story.................

<<else>>


[[Back to the Hallway|Lobby]]
<</if>>


still get this

Error: child tag <</if>> was found outside of a call to its parent macro <<if>>
 
Last edited:

Arcticman

Newbie
Aug 29, 2018
63
74
I recommend that you look in the SugarCube documentation for the if-statement syntax.:

The general format of the if-statement is as follows:
<<if conditional>> … [<<elseif conditional>> …] [<<else>> …] <</if>>

You can't have an elseif after an else as else handles anything not covered by the ifor elseif statements.

In the scene you posted it seems as though you've forgotten a closing statement <</if>>.
 
  • Like
Reactions: Canto Forte

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
i look just so frustrated LOL i figured out one thing then its another

if im not getting the bad evaluation error ii'm getting the cant find the closing one
 

Arcticman

Newbie
Aug 29, 2018
63
74
i look just so frustrated LOL i figured out one thing then its another

if im not getting the bad evaluation error ii'm getting the cant find the closing one
Programming can be very challenging and frustrating at times. The most important thing is to not loose your cool. Do small changes, see if there's a difference. Follow available examples in the documentation I linked.There's not really much else to do.
 
  • Like
Reactions: Canto Forte

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
all im trying to do though unlock location while still trying to add one page of story should not be this hard LOL
 

Arcticman

Newbie
Aug 29, 2018
63
74
all im trying to do though unlock location while still trying to add one page of story should not be this hard LOL
Could you please try to explain more in detail what you're trying to achieve? Are you trying to lock/unlock certain passages depending on for example energy?
 

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
ok if you play should see this

[[Casey Kisses Trans Check Bedroom Neutral Path]] i change it to bedroom

when i enter room wanna see the story i need first time i enter it

then instead of clicking next link in story exit room and explore the house unlocking the explore house stuff

then if i come back see the else stuff this your bedroom blah blah you can go to sleep to recharge energy
 

Arcticman

Newbie
Aug 29, 2018
63
74
Let me give you an example of how you could unlock new passages depending on variables.

If you add the following code:
(The nobr-tag removes linebreaks created by the code.)

<<nobr>>
<<set $Kelly to {
name : 'Kelly',
affection : 0,
gender: 'female'
}>>

<<if $Kelly.affection > 1>>
[[Fuck Kelly|Sex]]
<<elseif $Kelly.affection > 0>>
[[Get a handjob|Handjob]]
<<else>>
Kelly doesn't like you enough to have sex with you.
<</if>>
<</nobr>>

Between the passages in "Kelly's Bedroom" and the closing <</if>> statement you'll get three different results depending on what the affection variable currently is. This is under the assumption that you created two new passages, Sex and Handjob.

If $Kelly.affection is 0.

Kelly1.PNG

If $Kelly.affection is 1.

Kelly2.PNG

If $Kelly.affection is 2.
Kelly3.PNG

This way you can add or remove different passages depending on stats. I hope that was what you're looking for.
 

Arcticman

Newbie
Aug 29, 2018
63
74
ok if you play should see this

[[Casey Kisses Trans Check Bedroom Neutral Path]] i change it to bedroom

when i enter room wanna see the story i need first time i enter it

then instead of clicking next link in story exit room and explore the house unlocking the explore house stuff

then if i come back see the else stuff this your bedroom blah blah you can go to sleep to recharge energy
Post the entirety of your code in the passage that is a problem and I'll help you debug it.
 

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
im trying to use this example but i cant get it to work

If using variables. Instead of using a boolean flag, use an integer counter. For example, in the StoryInit special passage:

<<set $visitedSomePlace to 0>>

And then in the specific passage:

<<set $visitedSomePlace++>>\
<<if $visitedSomePlace is 1>>\
First visit - first description
<<elseif $visitedSomePlace is 2>>\
Second visit - second description
<<else>>\
Subsequent visits - third description
<</if>>

while at the same time doing what you just did

example i enter beed room see the story first tim exit room then go to kelly and then ask her about the hand job
 

Arcticman

Newbie
Aug 29, 2018
63
74
im trying to use this example but i cant get it to work

If using variables. Instead of using a boolean flag, use an integer counter. For example, in the StoryInit special passage:

<<set $visitedSomePlace to 0>>

And then in the specific passage:

<<set $visitedSomePlace++>>\
<<if $visitedSomePlace is 1>>\
First visit - first description
<<elseif $visitedSomePlace is 2>>\
Second visit - second description
<<else>>\
Subsequent visits - third description
<</if>>

while at the same time doing what you just did
Each passage already has a hidden counter that tracks how many times the user has visited them.


<<if visited() is 1>>…this is the first visit to the current passage…<</if>>

Use this code if you want something special to happen the first time someone visits your passage.
 

AJLee7385

Well-Known Member
Game Developer
Jun 25, 2019
1,412
778
<<set $visitedBedroom to 0>>

<<if visited () is 0>>

wanna put my storry here

[[Leave the room|Lobby]

<<else>>

<center><img src="C:\CTMAS\media\images\Buildings\Player Bed Room.jpg" height="100%" width="100%"></center>

This is your Bedroom if you are low on energy you can rest here and regenerate 100 energy. However that will add 10 turns.

<</if>>