maximusleroy

Member
Aug 26, 2016
147
562
Since you want to display stat changes, which would have changed when clicking something on the previous passage, you could change your stats macro to only calculate the value of the change and push it to an array:
variables().changes.push([stat, value]);

Then in the next passage you can call a macro that will display all the changes and empty the array
You don't have permission to view the spoiler content. Log in or register now.

All the player stat have been moved to a player object, and all addictions to an addiction object. That way if you were to add more addictions at some point you wouldn't have to rewrite functions that loop over all addiction like this:
You don't have permission to view the spoiler content. Log in or register now.
Since the addictions total will become stale as soon as any of the addictions change, it's better to assign it as a temporary var and only calculate it when needed. Otherwise it will become stale and, if you forget to recaculate it before using it again, could lead to unexpected outcomes.


If you want to display an image randomly, instead of:
<<randomInt 1>><<if $int eq 0>><img src="img/enemy1/01/tease1.jpg"><</if>><<if $int eq 1>><img src="img/enemy1/01/tease2.jpg"><</if>>
You could use this:
[img[`img/enemy1/01/${either('tease1', 'tease2')}.jpg`]]
 
Last edited:

Turbonerd

New Member
Feb 18, 2018
4
19
Does Lana being an aspirant make her less likely to get more content? Cuz I would love to have some kind of progression with her... or any futa character down the road. Great start! Hooray for girlcock addictions!
 

maximusleroy

Member
Aug 26, 2016
147
562
You might want to turn player into a class, keeps the code better organized.
Then you can keep the code in macros to a minimum.
You don't have permission to view the spoiler content. Log in or register now.
Edit: Classes need to be made compatible to be successfully stored within story variables.
You can stick with generic object and let SugarCube handle that on its own if you would prefer.
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

maximusleroy

Member
Aug 26, 2016
147
562
If you want to keep value within a certain range, you could define a function that does that

JavaScript:
Math.clamp = (val, min, max) => {
  min = parseInt(min) || -Infinity;
  max = parseInt(max) || Infinity;
  if (min > max) [min, max] = [max, min];
  
  return (val < min) ? min : (val > max) ? max : val;
}
 
4.40 star(s) 5 Votes