Hello!
So far I'm getting my head around the more advanced techniques of coding, and already feel like I'm making excellent progress, although currently I feel as though I am at an impasse.
I have seen this particular tool implemented in other stories, where you click on a non-link type variable and (I'm not sure if this changes any 'Set' variables or not) it changes the highlighted text, which can be changed back and forth between the two (could there be more for implementation?) with ease.
E.G.
I feel 'good'*click*'bad' today.
"GOOD"/"BAD" being the variable to change.
On the Sugarcube 2 macro page, I tested the macro for the replace tool (thinking that this was the most viable option), and I can change the text from something to something else, but changing it back is a different story. It seems to be only able to change text that isn't part of the actual <<'click'>> either (or from what I tried at least). This also isn't my first choice in this area as it takes a troublesome amount of coding to implement for something that actually sounds rather simple in practice.
Is there any alternative to this method? Not sure if it's just me, or that I'm using the wrong macro.
Thanks guys.
Comments
Usage would look something like this: The corresponding link will cycle between "good" and "bad", setting $feel appropriately (n.b. note the quotes around $feel; while you should not normally quote $variables given to macros, the quotes here are required).
I checked, and I realize this sounds daft, but I didn't realize that sugar cube is always 1x, regardless of whether you had twine 2 or not. Obviously you can change it with the add format function however (as I had found), but it seems to take a significant amount of time with 'loading' on the add new format page where sugar cube 2.0 is concerned.
In fact I don't think it ever finishes loading x) anyhow I closed that window because I thought to myself 'it *MUST* be done by now!' Afterwards, I checked to see if the cycling link macro would implement itself and it constantly and stubbornly refused, stating that 'sugarcube 2.0 must be installed.' Even though it's right there in the 'Story format' window.
Seriously have no idea why this is happening. I even cleared out my stories in twine (after publishing them of course) in the hopes that this trouble would cease, but no, it continues relentlessly! I know this is a somewhat unrelated issue, but yet again I feel like a like a helpless idiot who has no idea what he's doing. Please help me!
My file path on twine 2 import format is;
file:///C:/Users/RaddersHQ/My Documents/Twine/StoryFormats/SugarCube-2/format.js
Even after coming back to it after a while it still does the same routine, even after turning off the anti virus. Should I just reinstall Twine 2 or is there another way?
Regardless, if you let it churn for a bit, it does actually seem to add the story format, even though it never completes properly (I simply closed the Formats window after 15 seconds or so). If you open the Formats window now to look at your available story formats, do you actually see SugarCube 2 or no?
If you do see it, then it probably (maybe) did get installed. You should simply be able to go to your story, open its edit menu and select Change Story Format, and then check SugarCube 2.
More recently I've noticed that changing the story format to Sugarcube 2 also changes the format and layout of the story/page, regardless of what the stylesheet says (tried and tested).
Is there perhaps an older version then that doesn't have this particular issue?
There are differences between SugarCube 1.x and 2.x, so if you've made significant changes to the layout based on SugarCube 1.x, then you'll either need to stick with 1.x or make the necessary style updates for 2.x.
If staying on 1.x would be easier, then you can find a SugarCube 1.x compatible <<cyclinglink>> download on its website under Downloads > Add-ons (the original link from one of my earlier posts was to SugarCube 2's website, since that's what you'd stated you were using at the time).
If you'd like to stick with 2.x, then it would probably be easier to just show your styles here, so I can suggest updates (though looking at the SugarCube 2.x CSS docs might help; there's not much to them, currently, so maybe not).
Older version of what, which doesn't have which issue? Multiple things have been discussed and it's not clear which you're referring to here.
Well that's annoying.. Never mind, think I'll stick with Sugarcube 1 then, unless there's any particular point that would make it worth switching to 2.x?
http://twinery.org/forum/utility/thumbnail/687/Uploader/7a/01567e7110d3054dacbef7a3e99209.jpg
Just tried installing the one you gave me from that link and it came up with that. The last one came up with something that was, if not identical, very similar.
You copy the contents of the cyclinglink-macro.min.js file and paste it into the Story JavaScript (and had there been a CSS file, its contents would go into the Story Stylesheet).
Feel like a fool of epic proportions now, but it was an honest mistake..
I did quite like the UI bar of Sugarcube 2, not sure if that could be implemented in 1 but It's making me tempted to switch over if not.
Might end up switching one day anyway but we'll see x) one thing at a time first I think.
Just a quick query, I have a cycling link like this;
<<set $Skills to 10>> $Skills </b>
<<cyclinglink "$Charisma" "Mysterious" "Introvert" "Sociable">>
<<set "$Charisma" to {"Introvert", "Sociable"}>>
<<if $Charisma ["Sociable"] is true>>
<<set $Skills to - 1>>
<<endif>>
<<if $Charisma ["Introvert"] is true>>
<<set $Skills to + 1>>
<<endif>>
Tested this, but it didn't work. Of course it's been about a week or so since I last used twine macro so I may be a little rusty x) could you help me fix it? Just know it would take me ages otherwise :S
If you have the time yourself of course
Thanks again Mad Exile!
Also, if you wanted the value of $Skills to be dynamically updated on the page when the player cycles through the possible values of $Charisma, then this isn't going to work as-is (again, because the <<if>> macros have already completed before the player is presented with the <<cyclinglink>>). There are ways to do that sort of thing, however, they're a bit more involved.
You do not quote $variables in a <<set>> (you generally do not quote $variables period). The only times you should quote $variables are generally noted in the docs of the macro in question.
What are you attempting to initialize $Charisma to and why are you attempting to initialize it after the call to <<cyclinglink>>? You use the object literal curly braces, but then provide no property names as if it were an array. I'm assuming you were trying for an array, but confused curly braces for square brackets. Regardless, you likely do not need the <<set>> at all.
Do not test a boolean variable for (in)equality to the boolean literals. The expression you give to the <<if>> macro is treated as a conditional expression (i.e. it all boils down to a boolean value in the end), so simply use the variable as the expression.
Beyond that, the value of $Charisma is a string, not a boolean, so your conditional expression is erroneous anyway.
I'm assuming you were trying to raise/lower the value of $Skills there, rather than simply setting it to 1/-1. If so, that's not how you do it.
Try this for the first passage: Try this for the follow on passage: There are more concise ways to raise/lower the value of $Skills, especially if you simply want to increment/decrement it, but that will suffice for this example.
It's been very useful in order to ascertain the next steps in my project, and honestly, I doubt I could have gotten much further without your help .
After brainstorming for a bit and playing around with different ideas, I felt as though 3 different variables for each stat simply did not bring enough variety or individuality to the table from a player's POV.
So, In order to combat this issue I have implemented a new system which merely implements numbered stats instead; e.g 'Introvert' Would now be 8 out of a stats page maximum of 15 and a default of 10.
This new system somewhat rends the 'cycling link' system obsolete, but now I face a new challenge..
I've seen a post on here about a similar process; whereby each "Stats" number would be raised or lowered on either side of the text, but I was wondering whether this would all be implementable into one passage, with the 'RAISE' and 'LOWER' integers Raising/Lowering the number of the appropriate Stat and Skill points to allocate, or whether I would have to create identical passages with a 0 second transition in order to make it appear as though it is the same page.
Thanks again, every bit of help in these endeavors do not go forgotten
file://C:/SugarCube-2/format.js
Rather than C:\SugarCube-2\format.js, which seems to leave it hanging.
Good luck!