ScenEdit_SetWeather and numbers

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

ScenEdit_SetWeather and numbers

Post by Whicker »

Undercloud is supposed to be 0 to 1.0 in .10 increments.

is it ok to pass in larger numbers like 1.2? it works great, it just gets treated as 1.0.

Also, I get really long decimals when I put in values - like 8/10 frequently becomes .799 or something.

Everything is working really well, it just chooses what ever is closest to an accepted value. Just seeing if this is unsupported or normal/approved behavior.

For example I modify the undercloud by .04 either up or down every xx minutes to give a smooth transition over time. So my undercloud values are never 1 decimal place. Being able to pass in 1.2 is great as it makes the bad weather last longer if my modifier is small. So at midnight a random number is generated between .7 and 1.2 and passed in to the undercloud- if you get 1.2 it will stay foggy for a long time.
Rory Noonan
Posts: 2419
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: ScenEdit_SetWeather and numbers

Post by Rory Noonan »

If it's working as expected and doesn't throw an error, then there's no problem.

The 8/10 returning .799 is unusual though. Happy to take a look at that, just post the scenario with the script in it (and let me know where to look)
Image
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: ScenEdit_SetWeather and numbers

Post by Whicker »

try this in the cosole:

local x = 8/10;
ScenEdit_SetWeather(15,0,x,1);
local scenarioWeather = ScenEdit_GetWeather();
print (scenarioWeather);

I get undercloud as an 18 digit decimal. I can't post it as I am too new, it thinks it is a phone number.
Rory Noonan
Posts: 2419
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: ScenEdit_SetWeather and numbers

Post by Rory Noonan »

Yeah. That is weird. I'll add a ticket for the code guys to look into it.

Thanks for the heads up!
Image
User avatar
michaelm75au
Posts: 11889
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: ScenEdit_SetWeather and numbers

Post by michaelm75au »

Will add some validation to the function to keep the numbers in the expected range.
Michael
Post Reply

Return to “Lua Legion”