Ultimate Noob Coding


#365

Quicktest, if questions about it here are any indication, is a bully.


#366

I’ve also run into that annoyance with setting variables to zero, too. I’ve just taken to setting my variables to 1 at the start. So like,
*temp triplet 1

And then setting it as the real thing before I use the variable in multireplace.


#367

I’m going to be real with y’all. Like, painfully real. And prove that I’m not as far removed from the noob I was at the top of this thread as my Hosted Games Author title implies.

I was just about to ask how to type the vertical line that divides the different options, and then I realized there’s a key on the keyboard for that. And I’m about 75% sure that key snuck on here somehow in the night, because that’s the only explanation for someone who has been using a computer for 20 years not recognizing a key on a keyboard. Right? Yeah, it snuck on there. I’m sticking with that.


#368

Fun fact it’s called a pipe!


#369

Huh, I called it separator bar.


#370

Trying to make some achievements, noticed the name variable $!{aname} shows up as exactly that in the text body of the achievement. Is there a reason it did not update when the variable was set, and can I fix it or is it just not possible?


#371

I’ll admit I’m guessing here, but there’s probably no fix. The achievement will persist across all subsequent play-throughs, while the value of aname absolutely won’t.


#373

@hustlertwo I just discovered this temp variable is technically unnecessary. Instead, you could do the following:

*stat_chart
    text ("$" & money) Money

Basically, at many points you’d stick a variable’s name, you could instead stick a pair of parentheses and do stuff to the variable inside those parentheses!

Except it’s not actually changing the variable itself, only changing the way the player sees the variable. The variable’s value is unchanged. And sometimes that’s exactly what you need!

In the example above, I used concatenation, but the process works just as well for arithmetic. Behold:

It's currently ${temperature}°F. That means it's
*if temperature > 32
    ${(temperature - 32)} degrees above
*if temperature = 32
    exactly
*if temperature < 32
    ${(32 - temperature)} degrees below
freezing.

I’m glad I decided to test this idea. It’s pretty neat.


#374

i was looking on the choice of games wiki for dice coding cause id like to have it so that i could make it harder for people to fight against a zombie hoard and i want to possibly make there a chance for the character to get bit and a chance for people to turn on you if you lead the group if you make an evil decision but also to give the player a buff with how much they fear you if you go down that route

i also was looking for a simple item collecting code to set up into stats menu that tells how much of the item you have and when you use it it goes down or find more of the item it goes up


#375
*create dice 0

...

*label roll_dice

*rand dice 1 6

You rolled a ${dice} on the die.

(alternatively)

You rolled a @{dice+1 |one|two|three|four|five|six} on the die.

Assuming your result is 2, you’ll see either

You rolled a 2 on the die.

or

You rolled a two on the die.

depending on how you output the result.


#376

If you don’t want them to see the results of the roll and have it work behind the scenes DM-style, you just do like will said, but instead of outputting the answer, you use an *if for each outcome.

Forgive the lack of indents in the following, I am on my phone.

For example:

*temp fightroll 0
*rand fightroll 1 3
*if (fightroll = 1)
     *goto youdie
*if (fightroll = 2)
    *goto youlive 
*if (fightroll = 3)
    *goto youwin


#377

Thank you both so much


#378

Okay, so I am wanting to institute a save feature for my WIP. I tried it with Nuclear Powered Toaster and it never worked right, but I am sure that’s because I didn’t ask about it here, where all the smart people hang out. How do I do this and have it actually function this time?


#379

Which one specifically, the on-the-fly or chapter restart save system?

For the former, all you need to do is check a box on dashingdon. For the latter you’d need to write one, where it takes a snapshot of all the var values at the start of the chapter and then restores them if the reader chooses to reload at the end. I do believe a subroutine (in a separate .txt scene) should be the most efficient here. Then you just use *gosub_scene.


#380

Two questions

  1. Do you want the save function to transfer over into the published version; a custom save feature?
  2. What are you expecting from your save feature? Checkpoint? Progress tracker? Save-and-load anywhere you like?

#381

The Dashingdon one is all I want. This is just to help my beta readers, not for the finished product. I clicked the box and it didn’t work. I inserted the code it mentions and it killed the whole demo (said it was an invalid command I believe). This is the same thing that happened when I tried it with NPT, except this time I have time enough to try and resolve it. What specifically is needed to use it?

I removed the code, since it made the demo unplayable. I can reinsert it later today or tomorrow to try again.


#382

You just need to insert it for your dashingdon version. *sm_init works in tandem with the checkbox thing in the site.

In your case, your error only comes up in your local version as you don’t have something to checkbox.


#383

I’d also like to add that you make sure that *sm_init goes after all the *create and *achievement lines in startup. Otherwise it’ll produce an error.

Yeap!


#384

Ah, that’s the issue. First I put it before everything, then after title but in the middle of the create list. It needs to literally be right above the start of the story I take it?

@Szaal I was testing it off the Dashingdon, for the brief time I had the version with the code uploaded. Does that mean it will prevent me testing locally though?


#385

If you want the feature to present in your local version, there’s more things to do. You can check it out on the saving plugin thread, but in the mean time, I’m at outside.

I’ll try to do something once I get back.