Ultimate Noob Coding


#81

Yup.
Nailed it :point_left:

Edit: Wait. No

It should be

*disable_reuse #Boost stat
   texttexttext blablah
   *goto test

Just use the </> button (or Ctrl + Shift + C. A Shift-ed copy)


#82

If you want to go back to the top of the choice, you’ll need something like this (assuming you have *create my_stat 50 in startup, or something like this):


*label test
*choice
    #Choice One.
        Text here blah blah.
        *goto something_else
    #Choice Two.
        Some text here too, blah blah.
        *goto something_else
    *disable_reuse #Choice Three, which changes your stats.
        *set my_stat %+20
        Text here blah blah. Your 'my stat' is now higher! Woo! It equals ${my_stat}.
        *goto test
*label something_else

The test label needs to go above the *choice, or it will cause a bug. And if you use *choice and not *fake_choice, all the options will need to have a *goto included as well.


#83

I’m sure I know the answer to this but just for my info: When I have the disable and choice on the same line it’s color coded like a long command and ignores the choice’s color (CSIDE). I’m assuming that this is normal and that the compiler won’t care, correct?


#84

@CJW or maybe @Vendetta can confirm, but yes, that’s just part of CSIDE’s current syntax highlighter settings. Everything should be fine. (That said, if it does bring up an error when you run Quicktest, I’m sure the community would be happy to help figure out why! But it should work as given, I think.)


#85

It is a percent bar, actually. But it still seems like I should be able to change the displayed name with a variable, right?

I am trying to work around variables, as they have not come up much. I need to do one to determine which MC the player selected. Right now I am trying to do *if Alexi true for the Alexi branch and *if Alexi false for the Fiorella one. Is that way off base? And is it possible once I create those variables on startup and have them set by which choice the person makes between the two MCs to have it in the percent bar to say *if Alexi true Dumb Luck and *if Alexi false Mantra? I have tried it several ways with no success.


#86

Variables normally should be numeric for ease of use.
*create Alexi = 0
*set Alexi = 1 for the Alexi branch, *set Alexi = 2 for Fiorella

For the stats page:

*if Alexi =1 then
  *stats_chart Dumb_Luck
*else
  *stat_chart Mantra

and in start up you create both Dumb_Luck and Mantra

This should work.


#87

@hustlertwo Did you want to use the same variable for both characters, only displaying under a different name? If so, you could also try this (I used ‘shared_stat’ since I didn’t know your variable name):


*if (alexi)
    *stat_chart
        percent shared_stat Dumb Luck
*if (alexi = false)
    *stat_chart
        percent shared_stat Mantra

Would that suit?

There are some examples on this page of various ways to style up your stat screen.

Then it will look like this for Alexi:

And this for Fiorella:


#88

I tried this but as soon as I put *create Alexi = 0 I got this warning: invalid create instruction, value must be a number, true/false or a quoted string: Alexi = 0
@Fiogan Yes, the same stat just displayed differently sounds about right. I also need it to briefly display just as Special in the intro before the character is selected.


#89

So you could either use another variable (I like true/false booleans myself if I mostly have an either/or situation, makes it easier for me not to get confused), or use @Eiwynn’s number solution.

Like so, with true/false and an extra variable for the intro:


*create alexi true
*create still_special true

*if (still_special)
    *stat_chart
        percent shared_stat Special
*if (still_special = false)
    *if (alexi)
        *stat_chart
            percent shared_stat Dumb Luck
    *if (alexi = false)
        *stat_chart
            percent shared_stat Mantra

Or like so, with numbers as @Eiwynn suggested:


*if (alexi = 0)
    *stat_chart
        percent shared_stat Special
*if (alexi = 1)
    *stat_chart
        percent shared_stat Dumb Luck
*if (alexi = 2)
    *stat_chart
        percent shared_stat Mantra

The format for creating a number variable is:

*create alexi 0

without the equal symbol.


#90

If I do not use the equal sign in creating the variable, would that still be the case when setting it, so it would be *set alexi 1 instead of *set alexi = 1? Or is it *set alexi =1?


#91

*set alexi 1 is correct, yes. The equal sign is more for checks, such as (for instance):


*if (alexi = 1)
    *goto alexi_dialogue


#92

Ninjad by @Fiogan … they are the smart one … sorry for the confusion I create.


#93

@IronRaptor absolutely fine, though I can see why you’d be cautious. It’s an open debate whether we should be colouring it as a command or an option.


#94

This has actually come up in my game as well, except it’s where I let the player pick any two out of the five or six options, and then time is up. I can see from this code how to get them back to start with the option greyed out, but how then to make each option also able to take them to the next part of the story if it is the second one selected?

Sorry, I forget replies don’t automatically quote posts for some reason on here. It’s in reference to post 82 or so, regarding disable_reuse.


#95

A timer! I love timers. I just coded one the other day actually for an exploring sequence. (If you use them in more than one scene, you can *create it in startup instead, just remember to reset the timer to zero once you move out of the timed sequence.)


*temp my_stat 50
*temp timer 0
*label test
*choice
    *disable_reuse #Choice One.
        *set timer +1
        Text here blah blah.
        *if (timer = 1)
            *goto test
        *else
            *goto something_else
    *disable_reuse #Choice Two.
        *set timer +1
        Some text here too, blah blah.
        *if (timer = 1)
            *goto test
        *else
            *goto something_else
    *disable_reuse #Choice Three, which changes your stats.
        *set timer +1
        *set my_stat %+20
        Text here blah blah. Your 'my stat' is now higher! Woo! It equals ${my_stat}.
        *if (timer = 1)
            *goto test
        *else
            *goto something_else
*label something_else


#96

I have a question:

Is it possible to use a variable to create a different goto address?

For example:
In startup

*create note ""
*create happy false

In the game:

*if (happy)
  *set note "smile"
  *goto blah_blah
*else
  *set note "frown"

Then later in the game

*gosub ${note}
*label smile
Today is a great day!
*return
*label frown
Today is not a good day.
*return

This doesn’t work, as it’s not recognising ${note} as a place to go to. Using (note) or just putting note doesn’t work either. Does anyone have any ideas? The text I want it to write involves a lot of *line_breaks so setting the text as the variable wouldn’t work (at least I don’t think it would).


#97

Did you try {note}, with curly brackets and no $?


#98

I didn’t! But I just tried it and it didn’t work :frowning:

I can get around it using *if’s.

*if note = "frown"
  *gosub frown
*if note = "smile"
  *gosub smile

However, there are 20 different possibilities for note… that’s a lot of (potentially) unnecessary code…


#99

That’s odd…I just tried it, and it worked for me.


#100

I always call them counts. So interesting how our backgrounds influence our labeling.