I am using Twine to create a learning module about geography and within this module there are some little quizzes.
I would like to be able to format the 2nd question in the same way that the first is formatted with how the 'correct' or 'incorrect' text comes up, but I can't get my colours to turn when I click. As there will be multiple quizzes with multiple sections I thought that setting a variable for correct and incorrect answer formatting would be good.
Eventually, I would also like to be able to track the number of correct answers an instance of the quiz gets and have that be automatically output into a csv file, with new results being appended on to the end that I the creator can see. I have seen some entries on the forums about JavaScript and or setting up a database. Is this the route I would have to take?
Thanks for the help.
Code is below.
[quote]Respond by clicking the appropriate answer
1. These lines run from north to south and converge at the poles
a)[Latitude]<c1| (click: ?c1)[ <font color="#D00000">''Not quite...''</font> (link-goto: "review section 1", "review section")]
b)[Longitude]<c2| (click: ?c2)[ <font color="#00FF00">//Correct!//</font>]
c)[Prime meridian]<c3| (click: ?c3)[ <font color="red">''//Are you sure about that...//''</font> (link-goto: "review section 3", "review section")]
OR
Respond by clicking the appropriate box
(set: $answery to (colour:"#00FF00"))
(set: $answern to (colour:"#D00000"))
2. The the unit of measure for latitude and longitude is...
a) Miles (link: "`[]`")[ (colour:"#D00000")//incorrect// (link-goto: "review section 1", "review section")]
b) Chains (link: "`[]`")[ $answern//incorrect// (link-goto: "review section 2", "review section")]
c) Degrees (link: "`[]`")[ (colour:"#00FF00")//correct!//]
Comments
Another question
I just realized I was testing with Harlowe, but my project is in Sugarcube because that is what we were using before the switch to Twine2 and we want to keep our content looking the same.
Is there a way to link from one story (in Sugarcube (the main module)) to another story (in Harlowe (the quizzes)) and have references back from the quiz answers to that initial Sugarcube module?
No, it doesn't.
In SugarCube, it could look something like this: You'd also want to setup the following in the Story Stylesheet:
[quote]Something like:
@ <a href="[[review section 2|review section]]" target="_blank"><</replace>> <</click>></span></a>
**my attempt doesn't actually work, I don't know how to combine the a href syntax with that of Twine.
1. The format of a manually created passage link:
If you look at the HTML code generated for a standard passage link while reading a SugarCube based story you will see something like the following: So the <a> tag part of your code would look like:
2. Making a new instance (in a second tab) of your story start on a passage indicated by a parameter:
I don't know if this is possible, the TheMadExile would be able to answer this better than me.
Do you need the review material opened side-by-side with the quiz or is your concern chiefly about returning the user to the same spot within the quiz?
In the perfect world only the passage part that I have highlighted in yellow would come up, but if it had to be the whole thing that works as well.
The process would be:
1) Open quiz
2) Attempt question 1
3) If they get the answer wrong click the review link that will open the passage where the answer was covered in a new window
4) They read the newly opened window and see where they went wrong
5) Close the review window and proceed to the next question in the quiz
*repeat steps 3-5 as necessary.
Thanks a tonne for your help.
Review Material (Dialog): This example opens the passage to review in one of SugarCube's dialogs. Note: Because the current release version of Twine 2 (as I write this, v2.0.2) contains the tag import failure bug, you'll need to edit the story and add the tag
widget
to theWidgets
passage to get this one to work.Review Material (New Tab): This example opens the passage to review in a new tab/window. Note: For the newly opened tabs/windows, the example is currently setup to remove the UI bar (I figured that it wasn't necessary for reviews). If you don't like that, simply remove the line
jQuery("#ui-bar").remove();
from theStoryInit
special passage (it's near the bottom).Both include custom styles at the bottom of the Story Stylesheet (I also included the Bleached style, above the custom bits, since your screenshots seemed to show that you're using it). Additionally, Review Material (New Tab) includes a little Story JavaScript.
Personally, unless your heart is set on opening up a new tab/window, I'd suggest going with the Review Material (Dialog) version.
Anyway, try them out and let me know if you have any questions.
1. The bullets from the initial passage that is being referenced disappear in the dialog box (doesn't matter what browser)
2. The user sees the link text at the bottom of the review passage dialog box because it is in the passage being referenced. (see image)
- While they should just click the 'x' to get out of the dialog box, there will be some who won't.
- Clicking the 'assessment' link causes nothing to happen as the main module is already on this page
- Clicking the 'next' link causes the page beneath the dialogue box to change, not the one in the box
Thoughts? Ideas?
Thanks!
Ah. A gaff on my part, one that is easily rectified.
I can't see it (you posed the same image as last time), however, I believe that I get the idea. Assuming that I do have the idea, your two issues could be solved by separating the core study material from the passage it's normally displayed in (via the
<<display>>
macro).Attached is a new version of the example. It contains the necessary modifications to fix the list problem and, hopefully, fully address the link issue. You will, again, need to edit the story and add the tag
widget
to theWidgets
passage.Let me know if you have any further issues or questions.
I think I got it.
I've attached an archive file that includes 2 paths, one that is labeled as _m which is the format my stuff in already in and then the other with the _TME label, which is what I interpreted your response to mean. What it comes down to is I have to redo the structure of my module from it being a direct flow one element to another to being a bunch of separate passages being referenced?
I've only attached a small section of the module, there will be 130 odd passages to change and I want to make sure this is what you meant before I start going down that road.
Also, if that is the case, my story will have around 270 passages. Will that be a problem for loading speed?
Thanks again!
_TME
path and it seemed to be working as intended.And no, 270 odd passages shouldn't be an issue (I've seen projects with far, far more).
You've been a huge help.
I have a page of acknowledgements that are going in to this, if I stick you in there do you want to me under your Twine handle or do you have a human name you'd rather use?
StoryTitle
passage. As noted in the Passage Names section of the Special Names docs, when using SugarCube in Twine 2, theStoryTitle
passage is not special* (and thus is not used by SugarCube) since the title is part of the story itself in Twine 2. So, you're going to want to rename your story to what you currently have inStoryTitle
passage eventually.*
StoryTitle
actually does work in the current release (v1.0.16). That is a bug, which has been fixed and will go live with the next release.I don't really have a preference, so if you do decide to toss me an acknowledgement, feel free to use whichever best fits into your project (TheMadExile or Thomas M. Edwards).
I tried to modify the dialogue box code you gave me for text in the review sections to work for images. I highlighted the bits in yellow that i think are making it muck up.
The process that I want to happen is:
On click of a thumbnail image leading to another larger image in it's own passage, display this large image in it's own dialog box with the option to print this larger image.
This is how I am calling the widget called 'image_print': <<image_print[img[alttext|LatLongExample_thumb.png][LatLongExample]]>>
The image also has a link to the story
You're partially correct about the issue (the
text
property passed to<<click>>
needs to go, however, the call to theprocessText()
method is still correct). The original<<review>>
receives link objects (from the[[link]]
markup), not image objects (from the[img[]]
markup), so things need to be a bit different. You want to pass the whole image object to<<click>>
, however, you also do not want it receiving thelink
property, since it would also forward you to the associated passage on click. So, we need to do a little surgery on the image object to cache and remove the passage link, which will later be used to populate the dialog, before calling<<click>>
.Here are updated versions of both widgets. (n.b. I've published an update to SugarCube (v1.0.17) addressing the issue which was forcing button bar styling on your unordered lists, so I was able to update both to remove the hackery needed to bypass the issue in the previous version.) Usage: I'm assuming that you're doing something like the following in the image review passages:
I am having trouble getting a print method to to work on my larger images.
If I try : It prints the entire page, not just the image in the dialog box.
Then I tried: in the JavaScript window, in combination with in the image windows, but that didn't work either.
What I want to happen: In the main document are smaller thumbnail images, and when you click them they bring up full sized (readable) images in a dialog box. I want the user to have the option to print these larger images.
Link here: http://www.uoguelph.ca/~meghanm/twine2/module.html
UISystem.open()
toUISystem.openPrintableDialog()
. For example: And you should be done. You can add a separate print link within the dialog, but you do not have to as the standard printing mechanisms (menu item and shortcut) will work.If you did want to add separate print link within the dialog, then I'd suggest adding a widget something like the following (the
noprint
class, from the styles above, make the link itself not print): Which you would use something like the following in your dialog setups (be careful of extraneous whitespace):