A ChoiceScript Tutorial


#1

Okay, I’ve been sitting on this for a while now (a very long while, actually, and it’s gone through many different iterations), but, despite constant attempts, I have yet to get up and finish it (like everything else I’ve done >.> ) So, this post is two fold. The first (obvious) bit is to announce that I’m working on it. The second is to see (and ask) if anyone else is interested in contributing.

Okay, as for what I’m actually talking about. I’m trying to draw up a tutorial for ChoiceScript. Something that starts at the basics (as in the very absolute, I’m assuming you know how to work the internet but that’s about it basics), and covers everything to go from concept to hosted game.

A link to the guide itself: https://dl.dropbox.com/u/45314691/CoG%20Games/ChoiceScriptGuide/index.html


Trouble using Choicescript?
#2

Superb idea, much needed IMO, and I love the fact that you’re using ChoiceScript itself for this. It might not be the most practical way to do a help system, but it’s eminently fitting.

I’d be happy to help out down the line if still needed, but it would be a few weeks away for me as I’ve a lot on my plate right now.


#3

Yea, I tried a video tutorial first… that was a horrible idea. I can’t do something like that. I couldn’t really think of anything that was better than a simple written tutorial after that (the current documentation is a bit, inadequate IMO), so it was kinda obvious for me to end up using CS. (Plus it was an excuse for me to force myself to keep working on something even as I procrastinated my game. :-p)

As for help, if you had any particular tricks, I know the ‘save state’ one for saving, but copying all necessary variable to duplicates, but did you ever look into using the in built save function for CS? (I remember mentioning something about it to either you or Jim.)


#4

The problem with the current help is (only) that it was written by someone with a thorough technical knowledge of the subject so is very . . . unclear to someone with no such knowledge or experience, making it all seem far more confusing than it actually is. It’s probably perfectly clear to someone with even a modicum of experience–as it is to me now, when I look back over it, but initially it was a real struggle. I don’t know if a different approach would actually make things easier for the unitiated but it’s certainly worth a try.

I’m not sure if I have any particular useful tricks of my own devising, but certainly there are some things I’ve come to do a certain way to make things easier overall (the result of painful trial and error, more often than not). I’ll give it some thought and also now make some notes as I go, for possible future inclusion.

I never did get around to looking into the possibility of a proper save feature in any detail, having decided to drop that in my brother’s lap (he’s a real programmer, with a much better grasp of these things) once my game had progressed enough to really need the feature. It’s still something I’d very much like to include, though, even at the playtesting stage–some games, like mine, are just too big for a soft save to suffice.


#5

This is a great idea and implementation.

I have done an inventory system and can send you the code if you need it. Also, can send my equipment selection system if others would like it. Really, anything from ZE that people may want to reuse, I’m happy to hand over the code.

Also, one easy trick I often use is to modify a variable based on another. For example, this changes a relationship variable by a percentage based on charisma.

*set candace_faction %+(charisma + 5)


#6

Thanks @JimD. Was there any particular trick to how you did inventory, or is it mostly booleans tied to toggling choices? I know already know how to get the list to display in a pleasing manner with commas and all that.

Oh, and nice find about the Fairmath, I’ll include that.

@Vendetta Yea, the first paragraph is basically exactly what I though. (For me) The real struggle wasn’t figuring out how to use CS. It was figuring out how to start implementing it (as in, to do *this, go edit this text file/edit mygame.js). The only reason I caught on quickly enough was because I’ve played around with html a few times, so it was a very similar concept. Also, before your brother goes off and codes a whole save function (:-p), do note that the one used in Affairs of the Court is already included in CS… I think. The last few lines of scene.js include a list of valid commands, which include show_password and save_game. I might end up playing with them soon (for EgoChoice), so if you want I can send you what I find.


#7

Much, much needed. I’d try and get CoG to host this when your done, get as many people to see it as possible.

I didn’t read through it all but if you haven’t yet I’d do a bit of basic logic/programming explanation “What is a variable”/a boolean/a string vs number Etc

This is because all you don’t have to be a programmer I figure it helps if you know the thinking behind it, just the logical operations so to speak. I’ve had past programming experience (but am no hardcore programmer) and didn’t struggle at all really to understand choicescript, most likely because of that experience.

If you’ve already done that I can’t really fault it, an excellent method of portraying it as well, help people learn choicescript with choicescript ^^


#8

Great idea was thinking of doing one myself but finding the time to work on my current project and start another was impossible. If I find a little time I will send what ever I can to help the project. Do want it posted here or to email?


#9

@Reaperoa yes, the inventory system is just lots of if statements and booleans.


#10

@CJW I’m trying to build it a bit ‘two faced’. First, there’s the basics, which covers the essential ideas of variables and all the basic commands, with some attempt to ease the reader into some of the lingo, but mostly concentrating on the understanding ‘how’ to do things over ‘why’. Then, there’s the advanced parts, which dump things like foo/bar into your lap all at once (if just to make sure you know them), and assumes you can follow along well enough.

@JimD If there’s a particularly helpful trick you’ve found to making it easier, sure. (Or I can just sneak over and take a look at the code myself, again, if you’d rather. :-P)


#11

@Reaperoa It won’t be a separate save system–he knows Javascript and JQuery and whatever else ChoiceScript might use ‘behind the scenes’ so I’m hoping he’ll be able to figure out how it actually uses the *save stuff and be able to advise accordingly. The fact that it obviously must write back to CoG’s own database by default could be a stumbling block for us (that will be reserved for official releases, and rightly so) but it might be possible to point this elsewhere so we can save our own playtesters’ game data. I’ll keep you informed of any progress we make on this. Please do mention anything you find out, in case you get around to it before he does! (I’ve now sent him all the files).

As for tips, it occurs to me that I did very recently discover something not mentioned in the existing helpfiles–you can actually use a current variable value in *rand, e.g. . .

*temp diceroll
*rand diceroll 1 leadership

. . . will give ‘diceroll’ a random value between 1 and whatever is the current value of ‘leadership’ variable. I haven’t yet had time to play with it beyond this but it probably means other useful variations are also likely to be possible, for different ways of using randomness in your game.


#12

I was looking through the tutorial and the link for the more “robust” text editor doesn’t direct me to a download page.


#13

@Xseleon Thanks. I see the problem (for some reason, the link is acting as though it’s supposed to be internal (it not, it’s external). Maybe it needs http in front of it for it to know it supposed to be an external link?

Edit: Yea, it appears that if you don’t put the http:// the *link commands decided that you mean for it to be an internal link.


#14

I was just wondering if you were playing on continuing development on this, because so far it has been a great help for allowing myself and probably others to, of understanding how the system works.

I hope you do continue this.


#15

I will, It’s just the same problem as my game(s) no time to write.


#16

I will just say I learned all I could learn from it and it was really helpful and when you do start writing more just take your time. you got all the time in the world


#17

Are you still writing on this? It’s really been helping my out alot!


#18

Persperational