Raised This Month: $51 Target: $400
 12% 

Macro suggestions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarkSnow
Senior Member
Join Date: Oct 2005
Location: 127.0.0.1
Old 10-20-2006 , 11:34   Macro suggestions
Reply With Quote #1

In a project of mine, i have it setup to load a huge ammount of settings from a config file. The plugin can have multiple configurations loaded simultaniously, and can switch between them.

Now im working on having a "macro" thingy, in where the plugin reads from a config file 4 parsed values:

Code:
#1. object
#2. condition
#3. value
#4. config id (rl)
An example from the macro file:

Code:
"mapname" "contain" "de_" "4"
//if mapname contains "de_" switch rl to #4

"mapname" "not_equal" "cs_assault" "2"
//if mapname != "cs_assault" switch rl to #2

So, im asking for suggestions on different "objects" and "conditions". Any help is apreciated
__________________
DarkSnow is offline
Send a message via MSN to DarkSnow
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-20-2006 , 12:07   Re: Macro suggestions
Reply With Quote #2

Here is some very abstract code. It uses simulated structs to organize some stuff. Also, you'll notice that the condition should be parsed from the file and set accordingly (example: if condition is "not_equal" then itsCondition should be set to CONDITION_NOTEQUAL).

Code:
enum Config {     itsObject[],     itsCondition, // Instead of using a string, when you parse the config, just set it has a cell.     itsValue[],     itsConfigID }; enum {     CONDITION_CONTAIN = 0,     CONDITION_NOTEQUAL     // Put your stuff here. }; #define MAX_CONFIGS 10 new gConfig[MAX_CONFIGS][Config]; // A very quick example on how you can use this: // ---- // Read config file bla bla bla set some stuff. // ---- new someConfig = 5; if (gConfig[someConfig][itsCondition] == CONDITION_NOTEQUAL) {        if (!equal(gConfig[someConfig][itsObject], gConfig[someConfig][itsValue]))     {         // Code...     } }
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
DarkSnow
Senior Member
Join Date: Oct 2005
Location: 127.0.0.1
Old 10-20-2006 , 12:29   Re: Macro suggestions
Reply With Quote #3

Zenith77:
Thanks, this will make the code alot clearer.

Do you have any suggestions on "objects" that might be of interest? Im kinda stuck on mapname, and have run out of ideas.
__________________
DarkSnow is offline
Send a message via MSN to DarkSnow
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-20-2006 , 19:08   Re: Macro suggestions
Reply With Quote #4

You can use/set it up the same way I did with conditions.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode