Rules for System Timers

This is a design and development forum for EQ2Emulator's extensive Rules System.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Rules for System Timers

Post by John Adams » Tue Dec 04, 2012 12:57 pm

I finally broke down and asked my C++ guys at work what it is called when you have a function "ZoneServer(...)", then a colon ":" followed by parameters "regenTimer(6000)" and then the code starts "{". I had no idea how to google this, because I didn't know what it was called. Apparently, they are known as Default Values

http://www.cplusplus.com/forum/beginner/30983/

Now that I know this, and the reason this is in the Rules forum, is because one of my TODO's is to enhance the rules system by allowing configurable timers without forcing a recompile. I learned that all of these default values would function just the same if they were down in the body of the constructor, too... and apparently, this is just a matter of preference (LE's original design).

If I wanted a regenTimer to actually be 3000, I'd have to change the value and recompile the code.

My idea is to make this a Rule, and call it from within the constructor (or actually a function call from the constructor to "Init()" or something safe), and set these timers based on our Rules System.

I am posting this question to see if our devs see anything wrong with this concept, or if I am missing something. This comes about because I was designing how to add a timer for Zone Weather, a TODO in 0.7.3 coming up next year. While I am here, maybe it would be a good time to Rule-ify these Zone and World timers?

Example:
Remove regenTimer(6000) from ZoneServer() : regenTimer(6000) and put it into the constructor like this:

Code: Select all

	regenTimer.Start(rule_manager.GetGlobalRule(R_Zone, RegenTimer)->GetInt32());
(which of course, could be incorrect and likely needs to be in an Init() call instead, but just for-exampling)

What do you think?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Rules for System Timers

Post by Scatman » Tue Dec 04, 2012 7:10 pm

I don't see a problem with this. At least not right now :P

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Rules for System Timers

Post by John Adams » Wed Dec 05, 2012 10:50 am

LOL Scat, well it compiles, so it must be good!

I'll be working on this the next couple days, and if testing goes okay I will commit for you guys to try, too.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests