CS Auto Advance and Timed Choice Mod [V. 2.2 is UP! (New Update)]


#1

Hey there peoples of the COG forum, I come to you today, out from under the box fort o’er there in the corner (a box fort because moving is fun (read: ow, my back.) and because I have yet to find a rock big enough that I could live under without being rendered a pancake) to present you with (what I hope will be) a handy tool:

Ahem-hem, presenting:

CS Auto Advance and Timed Choice mod

What is this obnoxiously named and boldly titled thing you refer to above you ask?

It’s a mod I’ve developed over the past couple of days that lets you create psuedo-cinematic sequences in CS (much like ones you see in Visual Novels, y’know, where the text auto advances without user input (i.e. a mouseclick)) and create choices with a sense of urgency and dilemma, if you’ve ever played one of EA’s attempts at a Visual Novel style game on the app store (most notably Cause of Death) you know exactly what I mean, or even if you’ve played or seen gameplay of pretty much any Telltale Games game in the past few years, you’ve seen that kind of mechanic in action.

So now that that’s explained, let’s get on to an even more obnoxiously titled section of this post that’ll show ya’ how to work this thing, the section being:

Malebranche’s Mod Manual

(don’t say I didn’t warn ya’)

  1. Installation: installation of this mod is much, much simpler than the installation of my previous mod, mainly due to me being somewhat less scrubby at JS than I used ta’ be but that’s another story, so, to install, simply download the autoAdvance.js file and throw it into your “web” folder in your CS files, then go and edit the index.html file in your “mygame” folder, all y’need to do is copy this line here:
    < script src="…/autoAdvance.js">< /script>
    and paste it right under the line that looks like this:
    < script src="…/scene.js">< /script>
    of course, make sure to take out the blank spaces between the “<”'s above or otherwise it won’t work.
    And like that, you’ve installed the mod.

[Note: Everything beyond this point is depreciated, from here on out, one should refer to this post in the thread for the mod manual for autoAdvance V.2.0]

  1. Usage: Alrighty, now we’ve finally gotten t’the juicy part, let’s start. Everything begins and hinges on one simple command, *auto. The *auto command has 4 parameters/arguments that all need to be listed, they are:
    seconds togglehide togglecounter countercolor
    (Did I forget to mention that this mod comes with a visual, albeit simple looking, (it was certainly wasn’t simple to code the math logic, my brain still smarts (ha ha, get it? Smarts? Brain? ahah… ha… I’ll uh… I’ll show myself out now))) JS animated countdown timer?)
    These 4 parameters/arguments correspond to 4 things, seconds corresponds to how long you want the mod to take before it triggers the next button and expects a simple number as it’s value (i.e. 102 or 50), togglehide corresponds to whether you want the next button to show up or not (this doesn’t trigger for anything that isn’t a *page_break) and expects either a string of either “hide” or “show”, togglecounter corresponds to whether you want the countdown timer to show up on the page or not and expects a string of either “on” or “off”, and finally countercolor corresponds to the countdown timer’s color and expects a string of the color you want’s hexcolor code.
    So a normal auto command would look something like this:
    *auto 10 “hide” “off” “#fff (even though we have the counter set to “off” we still need include the countercolor parameter/argument since the mod expects all four parameters/arguments to have a value, will be fixed later on).

  2. Examples:
    Autoadvance sans the counter, with next button hidden:
    *auto 10 “hide” “off” "#fff"
    Outputs:


    Autoadvance sans the counter, with next button shown:
    *auto 10 “show” “off” "#fff"
    Outputs:

    Autoadvance with counter, with next button hidden:
    *auto 10 “hide” “on” "#cc0000"
    Outputs:

    Autoadvance with counter, with next button shown:
    *auto 20 “show” “on” "#cc0000"
    Outputs:

    Autoadvance with counter, on choice:
    *auto 20 “show” “on” "#cc0000"
    Ouputs:

  3. Notes: There is no maximum amount of seconds, there is however a minimum of 1 second. This code should be compatible IE 7 and up but I can’t be sure, at the very least it’s widely compatible.

And that’s that, hope you can find this thing at the very least no less than serviceable in your own games, I know I’m going to be using it a good bit. If there are any errors or if you have any cool suggestions (within reason) that pop up, do feel free to post them here or send me a PM, and I’ll do my best to fix and improve things. Enjoy!


#2

Wow, awesome thanks dude!

@Kelvin


#3

I thank you very much for such a mod, it surely is going to be very good for future use.
This surely is going to be a great help for spontanious choices in my game ^^
Thanks!


#4

@Malebranche I may be missing something but what is the point of the timer if the next button appears?


#5

Could annoy some people though if you’re a slow reader or need to put the game down for a bit. Personally it’s a feature I dislike in the tell tale series although I can see why it’s used. Might be ok if it’s just a one liner with a few options and you need the sense of urgency. (ie The bomb is about to explode in 10 seconds. Do you cut the red, green or blue wire?)


#6

Y’aren’t missing anything, I just wanted to show that you can do that configuration if need be, because while I myself can’t exactly think of a situation where that would particularly be useful, I’m sure someone might have use for that sorta’ thing …and also because I’m too lazy to code set configurations :stuck_out_tongue_winking_eye:.

Also, in general:

An error with the timer activating after the user clicks the next button of their own volition before the timer runs out has been fixed, the autoAdvance.js file in the OP has been updated accordingly.


#7

Well, after suffering through hard work into wee hours of the morning, much error-induced infuriation, and a terrible, terrible accident that resulted in a boo boo on my left index finger (Y’see, I really, really like knives, but for some reason, knives don’t seem ta’ like me back y’know? Whaddaya’ gonna’ do? :weary:) I am very, very happy to announce that autoAdvance V. 2.0 is live and y’can grab the new version from the same link in the OP that has the text autoAdvance.js.
This update is a hefty one, hence the straight jump to V. 2.0, adding roundabout another 400 lines of code, and completely changes how the mod worked up till now, so listen up, all who wish to know, because we’re jumping straight into (you guessed it):

Malebranche’s Mod Manual [V.2.0]

  1. Installation: is exactly the same as before, nothing new here.

  2. Features:
    New version supports:
    1.Pausing while in the stats screen.
    2.Three separate timer functions for three separate purposes, which, fun fact, is about how many timers ringing at once I’ll need to actually wake up at a decent hour in the morning after finishing this post.
    3.Advanced timekeeping, this means that for 2/3 timer functions the moment you come back
    from the stats screen time will continue ticking from the exact moment you left for the stat screen,
    sorry, no more cheesing it anymore.
    4.Enhanced timer display, you can now set the color of the numbers on the js animated timer bar as
    well as the background color, in addition, the bar will continue to dwindle down from the point it left off
    when a user goes to the stat screen, this feature alone took me almost two days to get working correctly
    due to the self adjusting mathses involved (let it never be said that I can’t do the arithmetics! …With a calculator).
    5.And finally, if not the biggest and most important part of the update, Consequences. Yep, that’s right,
    letting the timer run out entirely can lead to some nasty things happening if author of whichever game
    uses this mod so chooses. Now that we’ve run through all that it’s time to put your attention gear on
    (Brain: where the hell do you get attention gear? Me: Same place y’buy thinkin’ caps from. Brain:… *sigh *)
    because we’re jumpin’ right inta’ usage.

  3. Usage: Let’s begin, in features, I mentioned 3 separate timer functions, these are: *auto, *countdown and *overarch, we’re gonna go through em’ one by one:
    1.*auto: The auto command is strictly for pseudo-cinematic purposes and should only be used as such, it takes two arguments separated by a pipe (this thing -> | ) the arguments being seconds|togglehide. The seconds argument is exactly as it sounds, it expects a number, e.g. 5 or 12, and corresponds to how many seconds you want the timer to run though before click()-ing the next button and advancing the story, the togglehide argument controls whether the next button should even appear on page at all, giving the user freedom to continue on by themselves without waiting for the timer but sacrificing the pseudo-cinematic effect, or not, it expects either on or off. In short, an *auto command should look something like this: *auto 5|on. A note on the *auto command, it’s the only timer of the three to start completely from scratch the moment the user returns from the stats screen, simply because it’s meant for pseudo-cinematics, so if you go to the stat screen in the middle of the 3rd second, once you come back, the timer will again tick down 5 seconds, not two. That’s it for the *auto command, onto the next.
    2.*countdown: This is where we start to get to the serious timers, the *countdown command is a one time use per page bar timer, and takes a maximum of 5 arguments, but only really requires 4, though I’d be hard pressed to find a good reason for not using all five, these five arguments (again, separated by a pipe-> | ) are: seconds|togglehide|bgcolor|textcolor|consequence. The seconds and togglehide argument should be familiar to you already since you’ve gone through the breakdown of the *auto command above (and if ya’ haven’t… well, the heck’rya sitting around here for? I’m not gonna explain them again here), the bgcolor and textcolor arguments are pretty much birds of a feather so I’ll explain both of them here… just plug in either a full hexcolor code or a shorthand hexcolor code, s’that simple, (if you don’t know what a hexcolor code is, venture forth into the lands of google my good fellow, you’ll find an answer right quick) so a *countdown command with the 4 required arguments should look something like this: *countdown 5|off|#fff|#cc0000. Now for the final argument, consequence, again, it’s role is fairly self explanatory (goes to a label of your choice the second the time runs out) and is fairly straightforward to use, simply put in the name of a label you’ve already defined and you’re good to go, a *countdown command with all 5 of it’s arguments filled out should look something like this: *countdown 10|off|#fff|#cc0000|my_label. Notes on the *countdown command, it will pause while you’re in the stats screen, but will start right back up where it left off the moment you come back.
    3.*overarch: Named as such because the *overarch command is a one time, multi-page lasting, bar timer, that continues to count down till you hit the *cleartimer command (more on that later), arching over as many pages as you’d like… hence, *overarch (yes, I am fully aware that my naming sense is the 8th wonder of the world, ranking right behind the 9th, a.k.a. the potato). The *overarch command takes the exact same arguments as the *countdown command, and acts exactly the same, save for its overarching properties (why does it sound like I’m trying to sell someone cosmetics?), it should come as no surprise then, that it pauses while in the stats screen, and resumes from where it left off once the user returns to game.
    4.The *overarch exclusive command, *cleartimer, simply execute the command by putting *cleartimer in the place in your game’s code you want the *overarch to stop once the user reaches there, and viola! Say no more and *overarch knows where it’s a third wheel, and will slink off back to it’s apartment in the scene object in the prototype building waiting at it’s phone for another call from Story-chan (dev joke + weeb joke… what have I wrought???), …er, ahem, … to put it in laymen’s terms, it’ll stop counting down.

And that’s all they wrote, folks. Hopefully you’ll enjoy working with the new and improved mod, if nothing else I hope the above post was semi-entertaining reading material. For anyone who’s curious, I’m about 90% sure the mod is compatible IE 7 and up, though if you want to look through the code be my guest, and feel free to correct me. Speaking of if you are interested in looking through the code, it’s mostly commented, so you can kinda get a feel for how things’re going on in there if y’wanna. And hey, if you’ve got any suggestions or y’run into any errors, feel free t’post 'em here of send me a PM, I’m more than open to either.

And if you find it within your heart,
leave a like,
FOR THE POTATOES!!!
O-or for the (bad) jokes, t-the jokes is good too.


#8

@Malebranche I have a question!

Because I love the idea of this mod! Thing is, if I download and install this mod on my computer, changing the index file… does that mean it won’t work when I compile the game, because there is no index folder for the game for anyone playing it through a link on say, dropbox, on their computer, to modify?

Or is the change to the index file incorporated into a compile? ('cause really, it seems like it just about has to be to be useable by anyone other than an author)


#9

If I’m remembering correctly it shouldn’t be an issue since compile basically takes all resources and compresses into one .html file. So you wouldn’t need to worry about that. The only reason we use the index file to add scripts and mods externally is that it’s far more convenient than copy/pasting it (the script/mod’s code) directly.


#10

Alright, my good people of the COG Forum, we’re back (and by that I mean a collective of me, myself, I, and yours truly) and we’re here to handout another update to the Mod, pushing it to V. 2.2, link in the OP’s been updated to suit, two new features in this version a couple (no, literally, a couple) of fixes and a good bit of code-end optimization, namely:

Fixes:
Fixed issue with restart button throwing timers out of whack when clicked.
Fixed issue with timers overwriting the styles and timing of each other.

New Features:

*countdown and *overarch can now run side by side at the same time:
If just pressuring someone to finish a section within a limited amount of time wasn’t already enough, now you can do that, and give them only a couple seconds to make a choice at the same time, you sick, sick, sadistic villain you [waggles finger]. Just pop in a *countdown command like normal while an *overarch is running and you’re good to go.

New Command:
*timetransmodify (naming sense points, +10):
“Good sir”, you may be asking right about now, "what in the blue blazes, is a *timetransmodify???"
Well, it’s exactly what it sounds like! It, err… transmodifies time, yes, in the counter sense anywho. What’s transmodify mean? Ah, well umm… h-hold on a tic, [commence google search], hmm, um, well, it ah, it would a appear that I’m at a loss for that one, there’s no actual definition that I could find, if it helps, it’s the name of a Yu-Gi-Oh Card?

Ahem, pardon for that, in all seriousness and whatnot, the new *timetransmodify command lets you add, subtract, divide or multiply the time in the timers, it takes two arguments, operator and modifier separated by a pipe (this thing-> | ). The operator argument is for what operation you want to do and accepts any one of these * (multiplication), / (division), + (addition), and - (subtraction). The modifier argument is basically the number (of seconds, in the case of adding and subtracting) you want to divide, multiply, add, or subtract by, so a *timetransmodify command would look something like this *timetransmodify -|3.

And that’s that, as always, if’n there’s a bug or you’ve an idea or anything of the sort, feel free to post here about it or send me a PM, both work just as well.