Choicescript help pllz
  • zanezane July 2012
    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
  • andymwhyandymwhy July 2012
    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.

    Hope this helps!
  • zanezane July 2012
    @andymwhy thanks for the writing advance and the stats
  • zanezane August 2012
    also how do I include a make your own name option
  • DaisukeDaisuke August 2012
    *input_text name

    -------------------

    In the Stat Chart:

    text Name
  • AlexCosarcaAlexCosarca August 2012
    @Daisuke, in the Stat Chart it's more like
    text name Name (variable type - variable name - variable name that displays)

    Or am I again missing the fact that ChoiceScript changed and you just write the variable's name...?

    Also, don't use uppercase variables, ALWAYS make them lowercase (instead of Strength, use strength), just so you don't get any errors.
  • zanezane August 2012
    thank you that really helped me out
  • ReaperoaReaperoa August 2012
    @AlexCosarca Here (http://www.choiceofgames.com/make-your-own-games/customizing-the-choicescript-stats-screen/). Look for "Label the Stats Poetically" (IIRC this page of documentation isn't actually included in the master zip from Github.) The first example is how to capitalize stats.
  • AlexCosarcaAlexCosarca August 2012
    @Reaperoa, I can't believe I've read through all that and missed it when I learned ChoiceScript..oh, well, thanks for pointing that out anyways.
  • DaisukeDaisuke August 2012
    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.

    and finally, in the stats chart:
    text Name
  • zanezane September 2012
    how do i solve and expected choice body error
  • CJW September 2012

    *Choice
    #Yes
    You said yes <- This is a choice body<br />
    #No
    You said no <- This is a choice body<br />
  • zanezane September 2012
    how do i create permanent varibles and stats without mygame.js and please help explaining varibles
  • FarsideFarside September 2012
    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.
  • eposic September 2012
    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.
  • CJW September 2012
    It's deprecated, so I strongly advise against using it, there shouldn't however, be much difference in performance.
  • zanezane September 2012
    thank you @CJW @Farside and @eposic for your help but does anyone know how to define scene navigator in the mygame.js file
  • AlexCosarcaAlexCosarca September 2012
    Here's a link that explains what sceneNavigator does, and how to define scenes in it:
    http://choicescriptdev.wikia.com/wiki/Mygame.js
    The first part of the page is about it ^^
  • zanezane September 2012
    im still not sure
  • AlexCosarcaAlexCosarca September 2012
    What do you mean? If you want to define scenes in the sceneNavigator, that's how you do it..
  • zanezane September 2012
    it not the scenes in scenenavigator it says "scenenavigator" undefined Microsoft jscript runtime error line:1 char:1
  • AlexCosarcaAlexCosarca September 2012
    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)
  • zanezane September 2012
    no didnt change it it just doesnt work dont know why
  • AlexCosarcaAlexCosarca September 2012
    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..
  • zanezane September 2012
    thanks and how to fix non-exsitent varible
  • AlexCosarcaAlexCosarca September 2012
    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) ^^
  • zanezane September 2012
    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.
  • LordirishLordirish September 2012
    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.
  • AlexCosarcaAlexCosarca September 2012
    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.
  • zanezane September 2012
    *input_text name
    says line 36: non-exstient varible "name"
  • CJW September 2012
    *input_text var

    Where var is the variable (defined in mygame.js) that you wish to store the input information in.

    That error means you have not defined a variable in mygame. js called 'name' - note that variables are case sensitive. Name is not the same as name.
  • zanezane September 2012
    So I put it text_name
    strength: 50
    ,leadership: 50
  • zanezane September 2012
    how do i put first_name (input_text) into mygame.js
  • VendettaVendetta September 2012
    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.

    More info on the three data types: http://choicescriptdev.wikia.com/wiki/Data_types

    More info on mygame.js: http://choicescriptdev.wikia.com/wiki/Mygame.js
  • zanezane September 2012
    thank you @Vendetta now name is up and running

    *choice
    #kickboxing
    *set strength 70
    *set speed 40
    #brazilian ju-juitsu
    *set speed 70
    *set strength 40
    *finish

    tried doing *set one space the error is
    line 37:expected choice body
  • VendettaVendetta September 2012
    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:

    http://choicescriptdev.wikia.com/wiki/Choice

    As well as brushing up on the basic rules of correct Indentation:

    http://choicescriptdev.wikia.com/wiki/Indentation:_Howto&Tips
  • zanezane September 2012
    help with error please line 277: ,invalid indent,expected at least one line in if true block
  • AlexCosarcaAlexCosarca September 2012
    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:

    *if kickboxing
    *set speed 40

    At least, this is what I think causes your error. Also, as @Vendetta said..
    http://choicescriptdev.wikia.com/wiki/Indentation:_Howto&Tips
    the link above should be helpful if you encounter these errors often.
  • zanezane September 2012
    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.
  • CJW September 2012
    What's your issue exactly? Have you tried looking at the wiki?
    http://choicescriptdev.wikia.com/wiki/If

    Or COG's tutorial?
  • zanezane September 2012
    I tried everything but having an experinced author look at it
  • zanezane September 2012
    Is anybody willing to look at it?
  • VendettaVendetta September 2012
    Sure, I'll PM you my email.
  • zanezane September 2012
    Thank you alot
  • zanezane December 2012
    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
  • CJW December 2012
    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.
  • irule9344irule9344 December 2012
    here is how it goes
     the man creeps up on you wat do u do?
    *if (strength > 50)
    #kill him
    *if (strength < 50)
    #run
  • irule9344irule9344 December 2012
    so u have to use variables for the if command
  • irule9344irule9344 December 2012
    but ask cjw he is much more experienced
  • AlexCosarcaAlexCosarca December 2012
    There's a flaw in your design, @irule9344; what if strength = 50 ? But basically, that's how *if works with choices.
  • irule9344irule9344 December 2012
    ahh oh my bad :D
     
    *if (strength = 50)
    #pick up a weapon and beat him up

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter Sign In with Google Login with Facebook

Sign In Apply for Membership