Calendar Help... (script?)

Ashton

Veteran
Veteran
Joined
Jun 9, 2014
Messages
129
Reaction score
21
First Language
English
Primarily Uses
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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$Wkd = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][$day + 1]


$monthname = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][$month]
 

Ashton

Veteran
Veteran
Joined
Jun 9, 2014
Messages
129
Reaction score
21
First Language
English
Primarily Uses
$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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Ashton

Veteran
Veteran
Joined
Jun 9, 2014
Messages
129
Reaction score
21
First Language
English
Primarily Uses
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:

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
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$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?
 

Ashton

Veteran
Veteran
Joined
Jun 9, 2014
Messages
129
Reaction score
21
First Language
English
Primarily Uses
$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...

...let me guess, that was the wrong thing to do, wasn't it?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top