The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: da good king on December 30, 2008, 01:38:06 PM

Title: Adding a Numerical function?
Post by: da good king on December 30, 2008, 01:38:06 PM
After working ALOT with numbers in scripts (naturally...) I'm getting tired of having to create my silly boolean for determining numbers as "Odd" or "Even" everytime I make a Window Selectable that I want to use an alternating placement structure.

E.G.
NORMAL:
1
2
3
4

ALTERNATING:
1 2
3 4

Anyhow, I find myself repeatedly using this method for menus and having to make a boolean for it. I already realize I can just add the boolean structure to Window_Selectable itself as a new argument for the class being "Alternating" or "Normal" sorting method. (I have done so before.)
However, I also find myself needing this in other situations besides sorting methods...And so, I am wondering:

How do I go about adding a "Odd" or "Even" determinating function to the Numerical class? Or in that case, adding a function to any pre-existent class in RMXP?
Title: Re: Adding a Numerical function?
Post by: tSwitch on December 30, 2008, 02:10:10 PM
incoming peseudocode


if (value % 2) == 0
   blah blah blah even
else
   blah blah blah odd
end
Title: Re: Adding a Numerical function?
Post by: da good king on December 31, 2008, 01:08:55 AM
Hahaha well, I suppose I am still new to the shortcuts and ways of scripting. All the methods and such aren't quite in my brain yet. Well, thanks :).

Also, I had a veyr pressing question...If I need to make another topic for it don't hesitate to direct me to do so >.<. Anyhow, I want a Game Clock for my game that is real-time. i.e. If you're playing at 12:30 A.M. It's dark out, and so on. Of course, the game can't process when it isnt running, so this is impossible unless I sumhow access an outside program, like Window's own clock and calendar.

So, how do I access computer data such as Window's clock and use it as a variable or set of variables?
Title: Re: Adding a Numerical function?
Post by: tSwitch on December 31, 2008, 01:58:58 AM
I think you'll find an answer on google, I'm not sure.
I'm 99.5% sure someone did that already.
Title: Re: Adding a Numerical function?
Post by: modern algebra on December 31, 2008, 03:58:58 AM
Time.now


Remember, the RMXP Help File is your best friend. A serch for Time will bring you to everything you need to know about the Time class
Title: Re: Adding a Numerical function?
Post by: da good king on January 01, 2009, 01:03:53 AM
I think Homer would say, "Doh!" Thanks algebra. ;)