Hi... anyone...?
I am using Twine 2 (linux) with SugarCube 2 (yes, installed).
I'm not very experienced with
- Twine (discovered a month or less)
- nor forum posting*
- nor coding (well I AM an IT student but 1. I'll say I have experience after at least 5 years)
(- nor proper english writing, vive la France.)
[Ranting part - ok to skip]
* I feel like it's the first time I NEED to post, usually I easily find what I'm looking in answers to other people's questions like many others do I guess. But the past 4 days or so I've been trying to learn how to Twine and it feels... hard, frustrating, confusing (i.e. http://twinery.org/forum/discussion/2853/what-do-i-consider-when-choosing-1-x-or-2-x or https://www.reddit.com/r/twinegames/comments/2rgikc/is_there_any_comprehensive_guide_yet_for_twine_2/)...
I've been wondering if I am the only person that feels this way : when you search for something Twine-related most of the time you end up either with something "outdated", or not the format/version you're explicitly asking for (in my case SugarCube 2 for Twine 2) so also useless, or just the same generic results no matter what you type in the bar :
- Twine wiki, which I don't like (confusing, not extensive nor concise)
- Harlowe's reference, which I like (and had me use Harlowe but then I went to SugarCube but... I can't remember why)
- Adam Hammond'guides (I prefer reading pdf) - neat and concise and clear but very "short", I wish they'd go "deeper"
- the "Motoslave site", which I quite like - neat, clear, concise, quite extensive (maybe one of the reasons why I switched to SugarCube)
Sometimes I feel like I should just give up but I've seen people MAKING GREAT THINGS with Twine so it's possible.
Overall I feel like there's several "introduction to...", "getting started...", "quick guide..." but once you've passed that (or feel like you did) and want something more, you just stumble on some people's blog who created great macros and give the code but you lack the intermediary explanations between the "beginner's guide" and the "pro's custom macro" to understand what's really going on... and I don't want to copy and paste, I want to understand how to build my own things...
That's a question inside the question : How/where did they find that missing step to learn? OR (drama mode) How many YEARS of failure does it take?
[end of Ranting part]
[Question Part]
I've decided to create a custom macro called "scoreDisplay".
GOAL : pass X and Y to scoreDisplay, X being the number of correct answers and Y incorrect ones
so that scoreDisplay... displays the percentage of correct answer AND displays it in a certain color depending on how good it is (i.e. red for a low percentage).
[process part - you can also skip]
I've tried using this : http://www.motoslave.net/sugarcube/2/docs/api-macro.html (Macro.add)
to understand how I should do but... well it says "Example of a very simple <<if>>/<<elseif>>/<<else>> macro." and it looks like chinese to me so now I feel like the dumbest person in the world.
So I found http://eturnerx.blogspot.fr/2012/12/how-to-create-custom-macros-in-twine.html which explains more but is dated/ not for the versions I'm using so I'm still confused....
Tired of always finding dated / various different ways of doing macros I gave up and decided to stick with the SugarCube 2 guide and bump my head on my keyboard until it works (yes, sometimes it DOES).
[end of process part]
Here's what I came up with (which of course does NOT work) and why in comment :
the GOAL is simplified : display the sum of a + b
/* Later on I'd like to pass a and b as arguments but right now I don't know how I should do that since "Macro handlers are called with no arguments" - motoslave says and then "but with this set to an execution context object." - motoslave also says and I'm still trying to figure out what that means (remember the "it looks like chinese to me so now I feel like the dumbest person in the world"). */
1) Story JavaScript :
/* testMacro */
Macro.add("testMacro", { // I use the motoslave way to declare a new macro
handler: function(){ // this part seems common to all ways so it can't be wrong..?
try {
var a = 10;
var b = 5;
document.getElementById("test").innerHTML = a + b; // I tell it to display the sum in the "test" span
} catch () {return this.error("error");} // I intend to check how to do precise error handling properly
} // handler function
} // definition
); // macro
2) StoryPassage ("Test") :
/* place to display the result */
<span id="test"></span>
/* calling the macro */
<<testMacro>>
What I get is the catch error message and I'd like to understand what's wrong.
(And after that :
Error: macro <<testMacro>> does not exist)
Any help or suggestion or link to a guide is welcome !
(I'd even understand and accept "Duh, you don't make any sense at all, just. go. away.")
I am using Twine 2 (linux) with SugarCube 2 (yes, installed).
I'm not very experienced with
- Twine (discovered a month or less)
- nor forum posting*
- nor coding (well I AM an IT student but 1. I'll say I have experience after at least 5 years)
(- nor proper english writing, vive la France.)
[Ranting part - ok to skip]
* I feel like it's the first time I NEED to post, usually I easily find what I'm looking in answers to other people's questions like many others do I guess. But the past 4 days or so I've been trying to learn how to Twine and it feels... hard, frustrating, confusing (i.e. http://twinery.org/forum/discussion/2853/what-do-i-consider-when-choosing-1-x-or-2-x or https://www.reddit.com/r/twinegames/comments/2rgikc/is_there_any_comprehensive_guide_yet_for_twine_2/)...
I've been wondering if I am the only person that feels this way : when you search for something Twine-related most of the time you end up either with something "outdated", or not the format/version you're explicitly asking for (in my case SugarCube 2 for Twine 2) so also useless, or just the same generic results no matter what you type in the bar :
- Twine wiki, which I don't like (confusing, not extensive nor concise)
- Harlowe's reference, which I like (and had me use Harlowe but then I went to SugarCube but... I can't remember why)
- Adam Hammond'guides (I prefer reading pdf) - neat and concise and clear but very "short", I wish they'd go "deeper"
- the "Motoslave site", which I quite like - neat, clear, concise, quite extensive (maybe one of the reasons why I switched to SugarCube)
Sometimes I feel like I should just give up but I've seen people MAKING GREAT THINGS with Twine so it's possible.
Overall I feel like there's several "introduction to...", "getting started...", "quick guide..." but once you've passed that (or feel like you did) and want something more, you just stumble on some people's blog who created great macros and give the code but you lack the intermediary explanations between the "beginner's guide" and the "pro's custom macro" to understand what's really going on... and I don't want to copy and paste, I want to understand how to build my own things...
That's a question inside the question : How/where did they find that missing step to learn? OR (drama mode) How many YEARS of failure does it take?
[end of Ranting part]
[Question Part]
I've decided to create a custom macro called "scoreDisplay".
GOAL : pass X and Y to scoreDisplay, X being the number of correct answers and Y incorrect ones
so that scoreDisplay... displays the percentage of correct answer AND displays it in a certain color depending on how good it is (i.e. red for a low percentage).
[process part - you can also skip]
I've tried using this : http://www.motoslave.net/sugarcube/2/docs/api-macro.html (Macro.add)
to understand how I should do but... well it says "Example of a very simple <<if>>/<<elseif>>/<<else>> macro." and it looks like chinese to me so now I feel like the dumbest person in the world.
So I found http://eturnerx.blogspot.fr/2012/12/how-to-create-custom-macros-in-twine.html which explains more but is dated/ not for the versions I'm using so I'm still confused....
Tired of always finding dated / various different ways of doing macros I gave up and decided to stick with the SugarCube 2 guide and bump my head on my keyboard until it works (yes, sometimes it DOES).
[end of process part]
Here's what I came up with (which of course does NOT work) and why in comment :
the GOAL is simplified : display the sum of a + b
/* Later on I'd like to pass a and b as arguments but right now I don't know how I should do that since "Macro handlers are called with no arguments" - motoslave says and then "but with this set to an execution context object." - motoslave also says and I'm still trying to figure out what that means (remember the "it looks like chinese to me so now I feel like the dumbest person in the world"). */
1) Story JavaScript :
/* testMacro */
Macro.add("testMacro", { // I use the motoslave way to declare a new macro
handler: function(){ // this part seems common to all ways so it can't be wrong..?
try {
var a = 10;
var b = 5;
document.getElementById("test").innerHTML = a + b; // I tell it to display the sum in the "test" span
} catch () {return this.error("error");} // I intend to check how to do precise error handling properly
} // handler function
} // definition
); // macro
2) StoryPassage ("Test") :
/* place to display the result */
<span id="test"></span>
/* calling the macro */
<<testMacro>>
What I get is the catch error message and I'd like to understand what's wrong.
(And after that :
Error: macro <<testMacro>> does not exist)
Any help or suggestion or link to a guide is welcome !
(I'd even understand and accept "Duh, you don't make any sense at all, just. go. away.")