Greetings! As some of you may know, I’m working on using ChoiceScript in an educational setting. I’ve hammered out a number of issues, but now I’m stuck… And this won’t be the only time…
I’d like to give my students some visual cues to what they are reading. I’ve got the italic and bold down, but is there a way I can change the font color? And can I change it from scene to scene? Or can I change it within a scene?
A different idea would be to change the background color of the “Next” button at the bottom of the scene. Can I do that within a scene?
Or can I change the title (the gameTitle class in the index.html file) from scene to scene?
And I’ll go ahead and put this out there: I’m willing to pay (some, I’m only a college professor) to have a customized set of files for my educational use. This might mean some specialized tokens/words that would work in my environment, but not in the regular ChoiceScript universe… I’m spending enough time just writing the material, I’m not really ready to invest more time to write the code to suit my own needs to display the material…
@CJW Is there any real tutorial on this? 'Cause I like to think I got my hand around CS, but what you wrote flew right over my head. I get the gist of the idea, but I’d have no clue as to how to actually implement it.
If there is no tutorial, could you give me a couple of quick ideas so I can try to fill in the blanks and write one up for the wiki?
There is not. It’s not choicescript, but javascript.
The *script command just allows external function calls. I’m not really sure we could write a tutorial based on purely editing choicescript’s appearance with javascript - - you’d very much be better off just learning the javascript. So far I’ve tried to avoid tutorials on it because quite frankly, there is already a million and one other places that do it much better than we ever could.
We’ve got to draw a line between teaching choicescript and teaching web coding. If you get what I’m saying?
Only the *script line would be present in the text file, all it does is CALL or “RUN” the javascript function (which changes the element “text”'s style properties).
Make a new file for e. g. functions.js stick it with ui and and scene etc. Make sure to add an extra line in index.html’s head in order to load it. Then call it with *script when you wish to use it.
I can copy and paste a practical example when I get home if you like?
Looks neat @CJW, gonna give it a try when I get to my machine.
Quick questions though:
Can I slap these couple lines of js onto one of the existing js files that come with the CoG kit (so I don’t create a new js file) and if so, would you have a preference as to which one of the js files to modify? Or would that be risking, I dunno, new bug potential.
@FcA - Yep, no problem.
It’s just easier to debug and remove if separate. Particularly when you have a lot of them.
You could probably actually put it at the bottom of mygame.js.
Of course. I think I remember Jason saying that it shouldn’t ever really cause any problems (so I’ll probably mention that too), but at the very least need to clarify it so that people don’t try to bring up JS problems.
@lordirishdas - As much as I wish they could, mods don’t make a good story (or a good game for that matter!), so don’t spend too much time implementing each and every one of them!
All-
Thanks very much for the conversation. I found mostly what I was looking for. Here’s where:
The ui.js file:
specifically, the first function defined: printx. There are a number of .replace instructions, and in there you can see the code for bold & italic. So I just copied and pasted and came up with a new code (I used “t” for Title) and then used the inline styles to define what I wanted to see. Here’s the two I added:
p style="font-family:arial;color:red;font-size:35px;
And then various versions thereof…
As you can see, these are all paragraph formatting. A little more work and I might be able to get it to work inline with the text. But this does what I want, and since the ui.js file will go with my lectures, I can use a different color/font combo with different lectures.