I had this working for a while, even tested it. Then it stopped working and I don’t know why. All of a sudden it’s not specific enough. Anyway, here’s my code:
Heat is a kind of value. The heats are frosty, really cold, cold, chilly, cool, room temperature, luke-warm, warm, hot, sizzling, and roasting. Everything has a heat. The heat of a thing is usually room temperature.
Every turn when the heat of something is greater than room temperature:
let the current heat be the heat of the item;
if the current heat is not room temperature, change the heat of the item to the heat before the current heat.
I’ve changed this so many times now, I can’t remember what it looked like when it worked. Anyway, does anyone have a suggestion to make this work.
Thank you, but no matter how I rearrange it (and I’ve been at this for hours now) I still get this message:
In the sentence ‘Every turn when the heat of something (called item) is greater than room temperature’ , it looks as if you intend ‘the heat of something (called item)’ to be a property, but ‘a thing’ is not specific enough about who or what the owner is.
Thank you zarf. I feel myself getting less stoopid. Now my heat ray and freeze ray work like a charm.
HERE IS MY WORKING HEAT CODE!!!
Heat is a kind of value. The heats are frosty, frigid, cold, chilly, cool, room temperature, luke-warm, warm, hot, sizzling, and roasting. Everything has a heat. The heat of a thing is usually room temperature.
Definition: A thing is over-temp if its heat is greater than room temperature.
Definition: A thing is under-temp if its heat is less than room temperature.
Every turn: if something (called potato) is over-temp, change the heat of potato to the heat before the heat of the potato.
Every turn: if something (called potato) is under-temp, change the heat of potato to the heat after the heat of the potato.
Your code samples will be easier if you put them inside code tags. You can highlight the code and click the “code” button above the edit window, or you can just type [open bracket]code[close bracket] at the beginning and [open bracket][forward slash]code[close bracket] at the end.
That’s true zarf, but for the moment that’s good enough for me. I need to keep going or I’ll never finish this game. I’ll go back and fix the heat thing later. Maybe after I’ve finished writing a whole game, I’ll have a better grasp of this stuff.
Part of writing IF is deciding what things need to be specific and what things need to be general. If you were writing a “temperatures” extension, you’d definitely want to cover all cases, but maybe you only have one object in the game that changes temperature. If you do, you might actually want to be more specific:
Every turn when the temperature of the coffee mug is not room temperature:
Being specific can save yourself some work, make your game smaller and faster, and sometimes even improve the player’s experience by directing attention to the more “interesting” features of the environment. So there’s no need to be ashamed! Also, saving details for the testing phase is a totally reasonable approach. You might even end up duplicating your efforts if you try to work out all the possibilities too early and later additions add complications you hadn’t anticipated.
Sometimes what I do is add a comment:
[TODO: Make sure this works if more than one object is not at room temperature]
Quick and easy, and then you can forget about it for a while. Later, you can just search your code for “TODO.”