Game idea i think is pretty cool And my dilemma

So the main idea of the story is gonna be how you decide to live your life will you chase love, riches, glory, redemption, power,etc Ive got the general idea mapped out and if i do this its gonna be quite the long story.
, i just had this idea for a choice-Script game so far this is what i have thought up: you are in a fantasy world with pretty much every kind of beast you can think off ie demons, angels, werewolves, vampires, dragons,etc
i plan on starting with you deciding on you family basically what where your parents what race, what social class, where did they live etc then a litle back story on them followed by your birth, this will happen form your parents point of view so they will look at you and you will choose your features from there. then there will be a couple of choice you will be able to make to start roughing out your character and then, depending on your previous choice they might die both,only one or neither.
that will trigger some events and you will be able to choose our strengths and your abilities. Then you will get adopted by sombody depending on your previouse choices they might treat you baddly or well depending and from there i plan on making it so that they are eventually killed by other people who want you dead and so your story unfolds.

Now my dilemma.
I have never made a game on choice script or any other thing like this. i read the “guide” on the main site but i’m still really confused on most of it. So i was wondering if anyone would care to enlighten me.

That’s not actually the definition of a dilemma.

Anyway, what is it which you are not clear about?

It isn’t? oh well anyways i can’t really understand how to put the stat things for choices or how to make a certain choice lead to a certain thing instead of them all leading to the same place and how to make them affect stats

There are five things you really need to know then: variables, if statements, labels/goto, the choice command, and what the hell all those files that came with the game are.

I’ll start off with the files. Games are in the web folder. When you downloaded choicescript, you got a free “demo game” thingy. You can find that in the folder mygame, which is in the folder web. You also got a mygame.js, an “index” thingy, and a scenes folder filled with text documents. The index thingy is how you access the game - double click it to start playing. Your story is pretty much located in the scenes folder, since that’s where you put your scenes. The mygame.js holds bunches of preliminary “before we get started” stuff. Basically it serves two purposes: storing important variables and telling everything in the game about them so you can throw them all over the place without the program getting mad, and storing a list of the various parts of your story in the order that they should happen so things chapter 1 happens before chapter 7. To edit your mygame.js, right click it and select “edit”. Below the highly unimportant copyright stuff you should see this:

`// Specify the list of scenes here, separated by commas, with no final comma

nav = new SceneNavigator([
“startup”**********
,“animal”
,“variables”
,“gosub”
,“ending”
,“death”

]);

// Specify the default starting stats here

stats = {
leadership: 50**************
,strength: 50
};

// Specify the stats to use in debug mode

debugStats = {
leadership: 50
,strength: 50
};

// or just use defaults
// debugStats = stats`

Except I added a bunch of asterisks/stars. The first place where there are a lot of stars is where you tell the game what order to read your text files in the scenes folder. The second is where you put your stats and other variables. Try to follow the syntax - if they have a comma before everything but the first one, do that.

And now for variables. A variable remembers a value. If I say *set this_is_my_variable_name 8, then this_is_my_variable_name stores the value “8”. Later I can ask it to recall the value I gave it earlier, and it’ll tell me “8”. Later you can tell the variable to hold/be “9”, and then it’ll give you “9” whenever you ask it what it has. That is what a stat is - a variable that can hold information. If you want a variable to hold strength, name it strength. You can name it variable1 or asdi3ohsa7wjpoz or something, but then you you’d forget what it was supposed to be. Then you can set strength to 1 for weaklings and 1,000,000 for strong guys (*set strength 1,000,000).You can also increase or decrease variables without knowing what they are. If the variable “increase_me” is 10, and I say *set increase_me +1, then increase_me will start storing 11. Can also do minus 1, times 108, and divided by negative 20. You can also use another variable in place of those wacky random numbers I just used. If you already have a variable called “meaning”, and it is, say, set to the value “42”, then you can say *set increase_me +meaning, or set it to directly equal meaning with no plus sign, or whatever. You can also set variables to hold strings of letters (called strings). Example: *set name "Gerblah". Make sure to use those quotation marks - if you don’t it will think you want to set name to the value held by the non-existant variable Gerblah, and then the computer will throw a hissy fit. Or give you an error message. There’s a special place made to display your stats in a nice way: the choicescripts_stats.txt in your scenes folder. You may recognize it as that one place that the game sends you to when you press that one button at the top-left in every choice game. If you open it up, it looks like this:

*stat_chart percent Leadership opposed_pair Strength Weakness text Leadership text Strength

I didn’t add any stars/asterisks this time. Before showing stats, say *stat_chart. Cause why not? But seriously, for some reason you need to do that to get the game ready to show stuffs. Then you can use the percent command, opposed_pair command, or text command to show off the value held by any variable (though you are more likely to use this to show someone “intellect” than “flirting_with_jacob” or “safe_unlocking_combination”). Percent gives you the number as a percent of 100. If tthe variable’s value is 50, then it will show a half-filled bar with the text “50%” on it. Opposed_pair is what they had in Choice of Dragon, where high brutality is synonymous with low finesse. In that weird opposed_pair case, it uses one variable. A low value for that variable means awesome brutality (or finesse) but terrible… the other one. Text is the most straight-forward one - it displays text. It is also the only one that can use text-y variables, like “player_name”.

And finally, the if statement. It is basically you telling the computer “here’s a bunch of stuff, but skip over it unless something is true”. Example:

*if peglegpenguin = "awesome" *set ending "good_ending" This is text that would be displayed if this was a real game! *if peglepenguin = "stupid" *set ending "great_ending" The old ghost town seems empty. Your friend does not seem to be happy that she is here.

Depending on what value I am equal to immediately before this part of the code, you’ll either end up with the variable “ending” set to “good_ending” or “great_ending”. Also, different text will be displayed. Totally forgot to mention that text without a command before it is just displayed as text. Anyway, take note of the indentations. The stuff between the two if statements is indented, meaning that it is inside of/belongs to/is “nested within” the thing above it that isn’t as indented. So that *set ending “good_ending” belongs to that first if statement, and won’t be read unless the if statement’s condition of me being equal to “awesome” is met. The other if statement does not belong to the first, and so it will be read regardless. It owns its own stuff, including that *set ending “great_ending” and that ghost town text. If statements can be nested into each other, and that means you add more indentation. Just make sure you are consistent in how many spaces you use to indent nested things, and how then how many spaces you use to indent nested things within nested things, ect. Other things use indentation too - if you look back I used it bunches of times before.

Now for labels. Labels are like bookmarks made of binary. Except completely different. You can place a label somewhere in the code with “label whatever_the_label_is_called”, and then jump from wherever you are straight to that point by saying “*goto whatever_the_label_is_called”.

And finally the choice command. Here’s one of them:
What is your name? *choice #Albert Foxwolf *set name "Albert Foxwolf" Awesome name! *goto next #Princess Tutu *set name "Princess Tutu" Very awesome name! *goto next #Velociraptor *set name "Velociraptor" Bad name. You die. *goto die

You need labels and gotos to get out of commands for some reason. Except that is a lie since there are ways to make choices that don’t need labels using the fake_choice command. I advise that you read about advanced commands like that. Anyway, this code should be self-explanatory. Indentation rules and when to use “#” should also be self-explanatory when making choice commands. Also, pretend I had labels somewhere else in my game called “die” and “next”.

I hope this helped, and that I didn’t forget to include anything massively important (though I probably did). Again, I really advice that you read on in the advanced command section - stuff like *gosub and *elseif aren’t necessary but they are pretty darn nice.

@Peglegpenguin
Awesome comment! I wish I had started a thread like this when I started messing around with choicescript, your comment would’ve saved me from a couple of headaches and some sleepless nights trying to figure out just what the hell it was I did wrong.
@alexxo97
From one choicescript novice to another. Bookmark both the choicescript forums and the tutorial page, you will be coming back to both very often. I usually leave both open in my browser will I am working with choicescript, and I refer to them often. If you run into a problem or if you have a question about how to do something in particular run a search on the forums, that has saved me asking a question numerous times, then if you can’t find it. Then start a new thread, chances are someone else has run into the same thing. Well, good luck with your game, it sounds like it could be really cool.

Peglegpenguin: thx for the help i really appreciate it.

Rob
:stuck_out_tongue: my hopes are high i hope i wont dissapoint :slight_smile:

And thus begins the painful process of debugging. Check indentation, make sure commands are spelled correctly (the computer isn’t smart enough to know that you meant *set if you write *sett), that all variables are spelled correctly and created in either the mygame.js or through other methods that I didn’t say anything about (like *create), make sure the mygame.js starts with the first text file in your game, make sure the mygame.js doesn’t have indent or spelling errors, and…

…check that one very important thing that I knew I forgot to mention earlier: make sure you end your scene with “*finish”. Make sure that, no matter what choices a player makes, they will always hit a *finish (or *goto_scene, but that’s something else) before they ever hit the end of the text file. The command “*finish” tells the game that you finished that text file, and are ready to move to the next in the list of text files in your mygame.js. If there is nothing next in the list then you’ll get an error message anyway (albeit a different one, I think).

Also definitely worth reading the error messages. They can give you hints as to where the error is or what type of error it is. For instance, if it said something about line 1 and indentation, then the error is probably on the first line of the scene you’re playing, and the error probably has to do with indentation.

Another good command to know: the *page_break command, which can be used to force the game to “pause” between pieces of your code so you can see which part makes it crash. It’s essentially those parts of a CoG story where you have no choice but a “Next” button.

If none of this solves the issue, download another copy of choicescript somewhere else on your computer and bring two copies of its unaltered mygame file into your web folder. Make sure that they run, and then make small changes to one of them. After each change, try to run the game. If it doesn’t work, then see what change you made that caused it to not work, and compare it to the unaltered version. Also good in general to have that unaltered copy to look back on and use to make copies that already have scenes folders and mygame.js’ and indexes that you can edit to make new games.

Oh, and I don’t know what you are using to view your .txt files. I was using just plain old notepad at first, but some people on the forums said that notepad++ is much better. But, I found Programmer’s Notepad in a google search, it’s free, and it seems to work very well for me. You can set it to display whitespace so you don’t screw up your indentation (which choicescript doesn’t like too much when you do, I’ve come to learn :smiley: ) and you can set it to use tabs or don’t so you don’t end up mixing tabs and spaces which it doesnt like either (you’re so hard to please choicescript) And another thing that took me a little bit to figure out, make sure you set your index.html to open with Internet Explorer, which reports errors much better than Firefox (which I was using). Hope that helps

ugh ive been having alot of error messages :these two happen whene i open my game in the index undeterminated string constant and this one:unable to get the value of the property ‘set starting stats clone’: object is null or undefined

this one is whene i open the stats screen:
unable to get the value of the property ‘scene’ object is null or undefined

this is gonna take somme getting used to:p

A lot of error messages doesn’t mean a lot of errors. The first error makes it sound like you tried to set something to a string value (like “Falalala” or “Jeff”), and there was some syntax mistake. Then when you ask the variable what string it has, it doesn’t have the “Falalala” you just tried to set it to (or anything really), and gets upset. Which reminds me: I completely forgot to explain that the use-quotation-marks-to-set-things-to-be-strings rule still applies to the mygame.js. If you wanted to set a variable “clone” or “scene” to be some value, you might do something like this:

`// Specify the default starting stats here

stats = {
clone: “n/a”
,scene: “birthday”
};`

I set clone to “n/a” because I didn’t have anything to set it to yet (maybe later I would set it to “alive” or “dead”, but at this point the player does not have a clone). I could also have set it to literally nothing by doing clone: "". It doesn’t really matter what you set it to so long as you set it and use quotation marks. “n/a” isn’t a special null value thing or anything, it’s just something with a clear meaning to future-you-who-forgot-stuff or any evil hackers that manage to get a look at your code. Always have to consider the feelings of evil hackers. Also, unless you have a variable called scene, I think it is having trouble going from scene to scene (could be that it wants to move onto the next scene without there being a next scene, for instance). Of course, I am saying this without trying to recreate the error messages, meaning there’s a small chance that anything I just said will be helpful.

ok thx il check it out cuz i only have one scene and even that won show up for now :frowning: and i dont have a scene or clone so il just put " " right?

i did what you said but it is still saying the same thing :frowning:

Ok the game sounds interesting I can’t wait to try it

Sounds cool looking forward to play it on here or downloading it on I-phone

:stuck_out_tongue: i’m happy to hear that.

@alexxo97 Can you be specific if your problem (I think a lot of us really don’t want to wade through a page of text to figure out what it might be.) If you’re having a specific problem, I’d recommend starting a new thread for it too.

He already did - it’s called “please help me”. The problem is that the game gives various error messages when run.

Oops, thanks pegle. I always end up looking at the last poster and in the list of discussions and think it’s the OP.