Main Menu
  • Welcome to The RPG Maker Resource Kit.

Adding a Numerical function?

Started by da good king, December 30, 2008, 01:38:06 PM

0 Members and 1 Guest are viewing this topic.

da good king

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?

tSwitch

incoming peseudocode


if (value % 2) == 0
   blah blah blah even
else
   blah blah blah odd
end


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

da good king

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?

tSwitch

I think you'll find an answer on google, I'm not sure.
I'm 99.5% sure someone did that already.


FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon

modern algebra

#4
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

da good king

I think Homer would say, "Doh!" Thanks algebra. ;)