Ultimate Noob Coding

I was hoping to have them have some text way after their decision to heal (healing takes time, was hoping to reflect that) but it’s kool. I figured it out with a bit of help from my friends.

I asked this before elsewhere but now I can’t find it and I don’t remember what the solution was. ;-;

I’ve also forgotten how to explain anything apparently at this ungodly hour.

Armor has health bar.
Armor takes damage. Too much damage for armor in this instance.
Extra damage must go to actual health bar.
How do?

Leathers-25 gets me a number but I need that number to subtract from another number.

*Edit:

Wait, am I overthinking this?

25 total damage in this instance…

*set Health+Leathers-25 ?

Mathematically, it works. Code-wise, I have no idea…

adding leather directly to health in a single formula might not be the best idea, let’s say:

health: 100
leather: 30
damage: 25

your formula will yields health: 105 which is funny

I think you can do it like this:

leather = leather - damage
*if leather < 0
health = health + leather

you wait until leather health depletes then apply it to actual health

Ye. I did this (full code)

*if (Leathers >= 25)
  *set Leathers -25
  *goto FacilityEvac
*if (Leathers < 25)
  *set Health + Leathers -25
  *goto FacilityEvac

You’d need parentheses in there to give CS only two things at a time to parse, but

*set (Health+Leathers)-25

or

*set Health+(Leathers-25)

should work.

1 Like

Thanks

I need to put in a checkpoint to reset several temp variables and undo *hide_reuse commands that were used earlier.

Is there any way that this can be done? The variables I know I can do by hand but I have no idea for the *hide_reuse on how to undo those.

If you want to be able to undo hiding an option, I’d suggest using *if variables rather than *hide_reuse for the hiding. The latter will only undo if you’re using the new save_checkpoint functionality; if that’s what you mean by “put in a checkpoint,” then you don’t need to do any of it by hand. But if you’ve got a choice block you want people to be able to come back to separately from restoring a save point, then any hidden options in that block should I think be done using variables.

2 Likes

save_checkpoint? When did that become a thing and how do I use it?

Edit:

I don’t see *save_checkpoint on the wiki. It’s either really new or I’m an idiot (and both are equally possible)

1 Like

It is new.

(I believe you can reset hide_reuse by visiting another scene file though, although I could be wrong.)

2 Likes

I love you.

1 Like

And this will also reset all the variables? It will follow the same path backwards or does it work akin to a *goto where it just searches for the label?

I’m not sure what you mean.

I have I think close to 200 variables to balance right now. If they use the checkpoint system, does it reset those variables itself? Or would I still need to do that?

Edit:

174 variables, not including temporary variables

1 Like

That link I gave you should have all the info you need about that (including some links with extra info).

2 Likes

Do I need a *gosub file for each *gosub ? How does the code distinguish which *gosub to go to if not?

Apologies if this seems like a noob question. I’m not sure how complicated *gosub is but I’m running into a need for them.

you can have multiple *gosub commands in a single file. The code distinguishes which *gosub to go to based on the label you provide after the *gosub command.

For example:

*label TEXT HERE
*gosub text1
*gosub text2

*label text1
Hello!
*return

*label text2
Goodbye!
*return

1 Like

Thanks Coal.

Is there ever any reason at all to have multiple gosub files? Or not really?

1 Like

in most cases not really ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

1 Like

*gosub doesn’t go to a different file, though. It points to a label in the same file.
It’s *gosub_scene that would be used to go to labels in a dedicated gosub file.
(unless that’s been canged in the last few years?)

Having multiple files can be nice if you have a lot of technical subroutines, that you call a lot.
Like, if every stat-raise requires a subroutine, it can be nice to have them in one file, to easily be able to find them. But you might want to keep subroutines that does something completely different in another file.
And if you have all your romance scenes being accessed by *gosub commands, you might want to have them in their own file as well.

It’s all mainly a question of structure and organisation.
Technically, you could write your entire game in a single scene file, though my brain shudders at the thought.

2 Likes