Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

This is always returning efficiency as 0, not sure if (or how) I made the mistake.

condition = self.thermal_state()
efficiency = self.efficiency()
ideal = 0
print("Running Heating Test.")
print(f"Current Conditions Are: {condition}.")
for w in range(10):
  self.set_power(w)
  sleep(2)
  print(f"{efficiency}% at {w} watts.")
  if efficiency == 100:
    ideal = w
print(f"Reached 100% efficiency for {condition} at {ideal}.")

Explicitly getting the component doesn't work either.

... I can just read it off the in-game display (that's what the sleep is for) but it's definitely bothering me.

Hi !

Two things going on. 

 efficiency = self.efficiency() at the top of the script captures the number 0 once into a variable. The print inside the loop is using that captured value, not re-calling the method. 

Also, notice there was a real one-tick lag bug where `efficiency()` returned the previous tick's value (so even a correct loop banked the wrong optimum); that's fixed in the latest demo build I'm pushing now. Should give you clean readings. With your sleep it would fine anyway.