Broken as heck number maths my goodness [help]

I’ve been at this for probably 6 hours now and basically i wanna make a number code which the equation is calculated by which note on a instrument that you play: so that the game can check if the code is valid and then proceed to react, I honestly have tried 40 different approaches that don’t seem to want to work, even if someone could tell me why its not working that would be great

The script details 3 phases of blowing a horn, the player can select a note from A-G during any of the 3 phases, the phase will depend on the number in the code which changes using maths, the first phase being in the hundred units, the second phase being in the tens units and the third phase being in singular digit units. so if i were to play
E (500) C (30) A (1)
the code should be 531 as told by the number which varies: Hornmelody

The game keeps telling me it equals WEIRD things: like 513 or 53 or 503 or 510 but the maths is all the same no matter which approach i go for so i am stuck

if anyone can help thanks, im sorry for such an obscure question

``````Hornsounding is a number that varies. Hornsounding is 0.
Hornproceeding is a number that varies. Hornproceeding is 0.

HornMelody is a number that varies.

Blowing Horn is an action applying to one thing

CheckingHornCode is an action out of world.
understand "check horn code" as Checkinghorncode.
carry out checkinghorncode:
say "[hornmelody]";

an instrument is a kind of thing.
a wind-instrument is a kind of instrument.

Understand "blow [wind-instrument]" as blowing horn.

Horncounter is a number that varies. Horncounter is 1

every turn:
if horncounter is 3:
say "You finish your melody upon the horn. [line break]";
say "[HornMelody]";
now Hornsounding is 0;
now Hornproceeding is 0;
now horncounter is 4;

every turn:
if horncounter is 4:
the blowing horn decodes in 1 turns from now.

every turn:
say "[Hornmelody]"

at the time when the blowing horn decodes:
if hornproceeding is 0:
say "[Hornmelody]";
now Hornmelody is 0.

Carry out Blowing Horn:
if player has The Blowing Horn:
say "You hold the horn to your lips...[line break]";
say "[bold type] Choose a note to blow [Roman type] [Paragraph break] [Bold type] -A [line break] -B [line break] -C [line break] -D [line break] -E [line break] -F [line break] -G [line break] Nevermind";
now Hornsounding is 1;
continue the action.

Understand "A" as a mistake.
Understand "B" as a mistake.
Understand "C" as a mistake.
Understand "D" as a mistake.
Understand "E" as a mistake.
Understand "F" as a mistake.
Understand "G" as a mistake.

After reading a command when Hornsounding is 1:
if the player's command matches "A":
say "You blow an A note";
play the sound of HornA on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 100;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 10;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelode;
try silently waiting;
otherwise if the player's command matches "B":
say "You blow a B note";
play the sound of HornB on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 200;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 20;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "C":
say "You blow a C note";
play the sound of HornC on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 300;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 30;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "D":
say "You blow a D note";
play the sound of HornD on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 400;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 40;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "E":
say "You blow an E note";
play the sound of HornE on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 500;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 50;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "F":
say "You blow an F note";
play the sound of HornF on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 600;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 60;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "G":
say "You blow a G note";
play the sound of HornG on foreground;
now Hornproceeding is 1;
if horncounter is 0:
now Horncounter is 1;
now HornMelody is HornMelody + 700;
try silently waiting;
otherwise if horncounter is 1:
now Horncounter is 2;
now HornMelody is HornMelody + 70;
try silently waiting;
otherwise if horncounter is 2:
now Horncounter is 3;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
increment Hornmelody;
try silently waiting;
otherwise if the player's command matches "Nevermind":
say "You stop playing the horn.";
now Hornsounding is 0;
now Hornproceeding is 0;
now HornMelody is 0;
Reject the player's command.

The Blowing Horn is a wind-instrument in Path to Canyons.
``````

I haven’t checked in detail all the code yet, but I do see a typo:

``````increment HornMelody;
``````

Ah! Fair sorry that would be the 6 hours of trying to make it work hahahaha

I did infact have it as

``````Now hornmelody is hornmelody + (single unit)
``````

Prior to that mistake but thank you for spotting that omg​:smiling_face_with_tear:

After fixing this typo i can confirm E C A still equals a solid 53

``````Horncounter is a number that varies. Horncounter is 1
``````

You start counting at 1. playing two notes would put it at 3. The code suggests you should start counting from 0…

Omg no wayyy
Im genuinely embarassed at overlooking these two things

1 Like

Liam, please don’t feel embarassed. The fencepost error is one of the most common ones.

Best regards from Italy,
dott. Piergiorgio.

1 Like

I appreciate that alot friend - thank you

Hey, Liam!

I reverted your first message so people could see the original question and the answers in context.

You don’t need to be embarrassed for asking questions or making a mistake, and we’d prefer you don’t erase your original question when answered - especially if there are replies - so the thread makes sense and can provide instruction to people reading the forum in the future. That’s the best way for people to learn!

(Don’t worry, we’ve all done the "I’ve been working this for six hours and my only problem was I forgot a comma!)

Many times just typing out your issue in detail so others to understand can help you understand and solve it yourself. I’ve typed out a question and then been like “I already know the answer” before hitting post. We’re all happy to help with this kind of thing because typos are notoriously missable sometimes until you until you get someone else’s eyes on it.

3 Likes

Thanks Hanon, i just wasnt sure whether it was a topic worth keeping up because it was such a simple fix

1 Like

There are two hard problems in computer science: cache invalidation, naming things, and off-by-one errors.

– Leon Bambrick

6 Likes