I am co-creating a new Cog but know the basics I'm talking choice and reaction I really need help my first question is how to make stats in advance I would like to say thanks for the help
First, to be taken seriously as a writer, it's better to write out full words rather than using cellphone abbreviations.
To make variables, you should open your mygame.js file in a text editor and add all the variables you need to the list. For example, if you want a stat for strength, add a variable called strength. Give it a value, similar to those already listed (the variables used in the example program). Let's put 50 for now.
Next, you need to have that variable count in your game. To do this, you will need a question or choice that determines your strength. For example:
Are you strong or weak? *choice __#Strong ____*set strength +25 ____You are a strong person. ____*goto fight __#Weak ____*set strength -25 ____You are a weak person. ____*goto fight
Now you have split the strength variable. Some people will be strong. Some will be weak. This is a very basic example. Yours can be more complex and you could end up with many different levels of strength, anywhere from 1-100 (or more or less, but I'd recommend limiting to these boundaries for the stats page, later).
Okay, let's see the strength check in action:
*label fight The big hairy ogre approaches you with his club. Will you fight or run? *choice __#Fight ____*if strength >60 ______You kill the ogre and laugh manically as his blood dribbles out around you. ______*set heroism +10 ______*goto next_scene ____*else ______With one swing, the ogre knocks you to the ground. He then kills you. Oh dear. ______*goto_scene game_over __#Run ____You run away. You may be a coward, but you live to fight another day. ____*set heroism -5 ____*goto next_scene
Here, the hero has two choices. He can fight or run. If he runs, regardless of his strength, he will lose heroism, another stat we can create in the same way as strength.
If he fights, then the outcome is determined by his strength. If he is strong, he will win and gain herosim. If he is weak, he will die and that's that.
Note: Here, there is always a way for the hero to survive.
Finally, showing your stat value would be done through the choicescript_stats.txt file. Open in up and add a statchart like this:
*stat_chart __percent Strength __percent Heroism
Every time you click on stats, it will display the strength and heroism of your hero.
I was rushing, and missed a few things. For one, doing text then the name of the varible uppercased makes the stat have an uppercase letter, if you make it lowercased, it shows as a lowercased letter. I'm going to show you how to do it in the scene files, not the mygame.js, this will be an althrough explanation of *input text name. First, in the scene files: *create name *set name "Unknown (or something else like this)"
and then where you want the person to define their name: *input text name No *page_break is needed.
You can't create permanent variables without mygame.js. You MAY try to the *create command, but I don't encourage it. It's much easier to have your permanent variables all in one place.
Try studying a little basic programming to get the idea of what a variable is. It's a lot to explain.
You could put all of your *create commands at the beginning of your first scene file instead of using mygame.js, and that would serve to keep them all in one place. I don't know if there are any performance issues with doing it that way.
is your mygame.js sceneNavigator written exactly the same as it was provided from CoG? Also, did you edit any other CS JavaScript files? (that end in .js)
Re-download choicescript and replace all the .js files from the web folder with the ones you downloaded. Then, make sure mygame.js's structure is the same with the one you downloaded..
perhaps you made a variable in mygame.js like this: ----,Strength: 10 Instead of "Strength", write "strength" (always use lowercase letters). And, check the name of that variable in mygame.js and then the name of that variable you use on the line the error is; make sure they match. http://choicescriptdev.wikia.com/wiki/Error_messages Here, you can find more info on that specific error (the 3rd one on the list) ^^
i am good at almost everything else but stats. I am doing everthing that it says but when i go to the stats screen it says line 5: non exsitent varible (I dont know where the line is!) please help.
Line 5 is most likley in one of your scenes. What it is telling you is you have not defined a varible. Does the error message say which varible does not exisit? If so just create the varible, other wise you need to look for it in the scenes. It should be line 5 usaly something you are trying to set. That's what I have run into, hope this helps.
if the error shows when you enter the stat page, check line 5 in the "choicescript_stats.txt" file. That's where a variable is called that doesn't exist.
Any new variables required (numeric, string or boolean) should just be added to the bottom of the list of default starting variables (mygame.js calls these stats), so in your case that particular section of mygame.js might then look like this:
strength: 50 ,leadership: 50 ,first_name: "none"
This would define first_name with a starting value of "none", enclosed in "quote marks" because you want it to be a string variable (i.e. one that holds text; those first two are numeric variables because they contain just a number). You can now use this string variable with such as:
*input_text first_name
And it will replace the first_name string value ("none") with whatever the player enters. If you then use:
${first_name}
in your scripting or Stats screen, it will display the actual text currently stored as first_name.
That particular error comes from not laying out the *choice #options in the normal (i.e. "expected") fashion. Hard to say for sure what it might be without knowing which is your actual line 37 or seeing the indentation you've used, but the first of your two #options does not finish in the prescribed manner -- they should both have a *goto, *finish or similar after those *set commands.
I'd recommend reading about the proper requirements for *choice:
Your error is because of doing the indentation wrong; you need to add a line (i.e. space, tab, more spaces; whatever you use as default indentation) on the line after the *if command:
I still cant figure out the *if and else commands im willing to pm the text to someone because for the life of me I cant figure out what the problem is but you have to promise to not publish the game or show anybody.
Hey i'm sorry but I don't get *if and else I've tried everything I was wondering if anybody would try to fix it and tell me where I went wrong but you can't share the coding with anybody. Thank you
If you need help, you're going to have to share your code. It's un-compiled anyway so as soon as you publish your game we'll be able to see it, so stop being so don't be so protective over it. You'll cause more harm than good.