I need a 96.8 temperature.

jmnevil54
01 Feb 2021, 02:08

How do I get something like a 96.8 degrees Fahrenheit temperature to show in the status pane? I have two attributes, game.temperature and game.temperature2.
I have a string dictionary like this:

game.statusattributes = NewStringDictionary()
player.statusattributes = NewStringDictionary()
dictionary add (player.statusattributes, "hitpoints", "Hit points: !")
dictionary add (game.statusattributes, "temperature", "Temperature: !")

So what do I do?


DarkLizerd
01 Feb 2021, 04:35

One way...
Temperature= 986 degrees...
then /10 to show 98.6...
Someone else, else ware used that idea because the CPU can work with integers faster than floating point numbers.


mrangel
01 Feb 2021, 13:04

So when you want to change the game's temperature, you'd do

game.temperature = 98.6

I don't think there should be a problem with that.

@DarkLizerd if you're storing it as an int you'd want to / 10.0 to get the display value without rounding. Or (temperature / 10)+"."+(temperature % 10) as a quick way to get a fixed decimal.


jmnevil54
01 Feb 2021, 13:17

Both game.temperature and game.temperature2 are actually changing. I made a turn script for both that rolls an internet, and then sets the temperature as the roll.

I am making a dragon stomach simulator, I want the temperature to be constantly changing.

Edit: I guess I'll just look at ThePixie's clock code.