- Apr 25, 2019
- 93
- 371
Solved thanks to outsider artisan! I'll keep this up in case someone else has a similar problem in the future.
Im just gonna post the code up front but if you want more info read below.
Ive been in the process of porting an abandoned HTML game from Twine Snowman to Sugarcube as a way of teaching myself Twine & Sugarcube (dont worry you shouldnt have to know anything about twine/sugarcube to help with this). Ive worked with javascript before but it was maybe 6 years ago at this point (C++/python are my main forte). Tldr the game deals with sissification (so this is an important mechanic) and while i have a temporary solution in place (im just skipping right to that
I understand bits and pieces of this but the whole
Id try an ask the dev of the abandoned game but they havent logged into tfgames in months so that doesnt seem like itll be possible. Any help would be appreciated but if you cant figure it out either, no worries. Just figured id ask here before i go about spending hours trying to figure it out myself manually.
Im just gonna post the code up front but if you want more info read below.
JavaScript:
// Function 1 - the main one of concern here
window.harvest = function (t, n, i) {
void 0 === window.sources[t] && (window.sources[t] = i || 5), window.sources[t] -= n, window.sources[t] < 0 && (n += window.sources[t], window.sources[t] = 0), window.mc.sissy += n
}
// Rewritten for readability (at least this is how im trying to interpret it)
window.harvest = function (t, n, i) {
void 0 === window.sources[t] && (window.sources[t] = i || 5),
window.sources[t] -= n,
window.sources[t] < 0 && (n += window.sources[t],
window.sources[t] = 0),
window.mc.sissy += n
}
// Function 2 - that window.sources it's referencing (comes before func 1)
window.sources = {}
// How these funcs are called in the game code
window.harvest('washroom', 1, 8)
window.harvest('porn', 0.5)
window.mc.sissy += n
line), Id like to figure out whats this is doing in order to keep the game as close to the original at least.I understand bits and pieces of this but the whole
void 0 === window.sources[t]
part and window.sources[t] < 0 && (n += window.sources[t], window.sources[t] = 0)
completely throw me off.Id try an ask the dev of the abandoned game but they havent logged into tfgames in months so that doesnt seem like itll be possible. Any help would be appreciated but if you cant figure it out either, no worries. Just figured id ask here before i go about spending hours trying to figure it out myself manually.
Last edited: