Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SCRIPT_START
{
LVAR_INT scplayer
LVAR_INT iChance iCurrentWeatherID iUpcomingWeatherID iDay iLastDay iMonth iLastMonth
GET_PLAYER_CHAR 0 (scplayer)
GET_CURRENT_DATE (iLastDay iLastMonth)
IF READ_INT_FROM_INI_FILE "CLEO/Rain Chance.ini" "Settings" "PercentChance" (iChance)
ELSE
iChance = 33
ENDIF
main_loop:
WAIT 0
GET_CURRENT_DATE (iDay iMonth)
IF iDay > iLastDay
OR iMonth > iLastMonth
IF CLEO_CALL Randomize 0 (iChance)
READ_MEMORY 0xC81318 2 FALSE (iCurrentWeatherID)
IF iCurrentWeatherID >= 0
AND iCurrentWeatherID <= 4
iUpcomingWeatherID = 4
ELSE
IF iCurrentWeatherID >= 5
AND iCurrentWeatherID <= 9
IF CLEO_CALL Randomize 0 (50)
iUpcomingWeatherID = 7
ELSE
iUpcomingWeatherID = 8
ENDIF
ELSE
IF iCurrentWeatherID >= 13
AND iCurrentWeatherID <= 16
IF CLEO_CALL Randomize 0 (50)
iUpcomingWeatherID = 15
ELSE
iUpcomingWeatherID = 16
ENDIF
ENDIF
ENDIF
ENDIF
WRITE_MEMORY 0xC8131C 2 iUpcomingWeatherID FALSE
ENDIF
iLastDay = iDay
iLastMonth = iMonth
ENDIF
GOTO main_loop
}
SCRIPT_END
{
LVAR_INT iPercent // In
LVAR_INT iEnd iRandom
Randomize:
GENERATE_RANDOM_INT_IN_RANGE 1 101 (iRandom)
IS_THING_GREATER_OR_EQUAL_TO_THING iPercent iRandom
CLEO_RETURN 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment