I've set up a simple clock, it counts Seconds, Minutes, Hours, Days, Weeks, Months.
However, just to list the date (i.e. Monday, 1st of January) requires ~360 conditional loop statements! x_x
Is there an easy way to set variables for this? Possibly using a script?
My guess (not ruby code, mind you)
If ($day = 1) {$Wkd = "Sunday"} else { If ($day = 2) {$Wkd = "Monday"} else { If ($day = 3) {$Wkd = "Tuesday"} else { If ($day = 4) {$Wkd = "Wednesday"} else { If ($day = 5) {$Wkd = "Thursday"} else { If ($day = 6) {$Wkd = "Friday"} else { If ($day = 7) {$Wkd = "Saturday"} else { } } } } } }}$date = ($day - 1) + ($week * 7)If $month = 0 {$monthname = January} Else { If $month =1 {$monthname = February} Else { ((ETC))Then on any showtext, I could just use:
"According to this calendar, it's $Wkd, the $date of $MonthName"
Is there a way to do this? I'd really like to set up the game to have some festivals at different times of the year (and yes, because it's MY game, the calendar has exactly 28 days each month to keep things simple) But I dont want to have to write ~360 lines of code for each festival to do it x_x
Calendar Help... (script?)
● ARCHIVED · READ-ONLY
-
-
$Wkd = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][$day + 1]
$monthname = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][$month] -
Ok, using an array cleaned up the code, but how do I plug that into VXA so I can use call a simple variable to display the date or do date checking?$Wkd = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][$day + 1]
$monthname = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][$month] -
Instead of $Wkd and $monthname, use $game_variables[1] and $game_variables[2] (or whatever variables you want to assign them to).
Then in your show text command, use \v[1] and \v[2] to display the values. -
When I try to run it, it tells me:Instead of $Wkd and $monthname, use $game_variables[1] and $game_variables[2] (or whatever variables you want to assign them to).
Then in your show text command, use \v[1] and \v[2] to display the values.
Script "" Line 4: NameError Occurred.
Undefined local variable or method 'game_variables' for main:object
This is the code I wrote:
#Calendar Script# Days of the Week$game_variables[94] = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][$game_variables[99] + 1]# Month Names$game_variables[93] = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][$game_variables[100]]#Numeric date$game_variables[92] = $game_variables[95] * 7 + $game_variables[98]
Alternately, I tried without the $:
#Calendar Script# Days of the Weekgame_variables[94] = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']# Month Namesgame_variables[93] = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']#Numeric dategame_variables[92] = game_variables[95] * 7 + game_variables[98]I have a feeling it's a syntax error on my part since I'm used to other scripting langauges... >.<
EDIT:
correction, I'm getting that error for #2, for #1 (with the $s) I'm getting:
Script "" Line 4: NoMethodError Occured
Undefined method "[]" for nil:nillClass -
$game_variables only exists after you start a new game. Where are you actually putting this in your script? What class/method is it in?
-
I went into script editor, clicked on the first line, and pasted it into the code area at the side...$game_variables only exists after you start a new game. Where are you actually putting this in your script? What class/method is it in?
...let me guess, that was the wrong thing to do, wasn't it?