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

Module: Cvar Utilities (v1.6)


Post New Thread Reply   
 
Thread Tools Display Modes
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-05-2011 , 12:48   Re: Cvar Utilities
Reply With Quote #41

Wow man ! Mind blowing, the cache thing is really awesome now we wont be using [get|set]_[pcvar|cvar]_[num|float|string]
__________________

My Plugins For ZP

Inactive due to College and Studies

Last edited by abdul-rehman; 09-05-2011 at 12:52.
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-06-2011 , 19:16   Re: Cvar Utilities
Reply With Quote #42

I'm not sure if your module does this, but it would be helpful if CvarHookChange, or CvarCache would cache the current value when the hook is created, or call the function when it is created. Even though it isn't changing technically, the default value might interfere with the custom value.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2011 , 03:46   Re: Cvar Utilities
Reply With Quote #43

Sorry again to be stupid, I don't understand well. When you call CvarCache, the current value of the cvar is set by default in the global var. Not sure why you're talking about hook and such.
__________________
Arkshine is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-07-2011 , 05:52   Re: Cvar Utilities
Reply With Quote #44

I got confused a little , If i cache a cvar's value, the variable which will contain the cahed value will be auromatically update, without the need of calling any natives/forwards/hooks etc right ?
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2011 , 05:53   Re: Cvar Utilities
Reply With Quote #45

Of course ! Otherwise such native would be useless.
__________________
Arkshine is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-07-2011 , 09:32   Re: Cvar Utilities
Reply With Quote #46

Quote:
Originally Posted by Arkshine View Post
Of course ! Otherwise such native would be useless.
The whole community should use this then , its way more effecient.
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-07-2011 , 12:34   Re: Cvar Utilities
Reply With Quote #47

Quote:
Originally Posted by Arkshine View Post
Sorry again to be stupid, I don't understand well. When you call CvarCache, the current value of the cvar is set by default in the global var. Not sure why you're talking about hook and such.
You're anything but stupid, lol. I'm just bad ad explaining sometimes. Well, for instance, I use a CVAR with flags ("abcdefg"), and I store it internally as a bitsum to help save processing the flag into bits every time I need it. When the plugin starts, I want to cache this value, but using CvarHook will only be called when the cvar is changed and not when it is first set, so I have to set it manually.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2011 , 12:40   Re: Cvar Utilities
Reply With Quote #48

What you describe is well what I said before so : when you use CvarCache the current value of this CVAR is well set into the global variable right away and doesn't wait a value change to update the variable. It would not make sense to not do that !

About CvarHookChange, this behavior happens only at server start when cvars are not registered, it would be called with a null old value. But after a restart, cvar is now registered, and for sure it won't be called. Maybe should add something for that ? Is it really useful ?
__________________

Last edited by Arkshine; 09-07-2011 at 12:50.
Arkshine is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-07-2011 , 13:45   Re: Cvar Utilities
Reply With Quote #49

Quote:
Originally Posted by Arkshine View Post
What you describe is well what I said before so : when you use CvarCache the current value of this CVAR is well set into the global variable right away and doesn't wait a value change to update the variable. It would not make sense to not do that !

About CvarHookChange, this behavior happens only at server start when cvars are not registered, it would be called with a null old value. But after a restart, cvar is now registered, and for sure it won't be called. Maybe should add something for that ? Is it really useful ?
I'm not sure if I follow you still. What I have is something like this. What I wanted to know was whether or not hookFlagsChanged() gets called with the current cvar value when CvarHookChange() is registered.

Code:
new cvar = CvarRegister();
CvarHookChange(cvar, "hookFlagsChanged");

public hookFlagsChanged() {

g_bits = read_flags(value)

}
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2011 , 14:15   Re: Cvar Utilities
Reply With Quote #50

Wait. lol

Just looking my code and what I say is stupid (again).

At restart the module deletes all datas stored and the module when it registers the first time a cvar and you hook it, the default behavior should be to call the forward the first time, so like you say.

It seems my code does the reverse what I wanted to do. -_-"

Let me check what I have done...
__________________

Last edited by Arkshine; 09-07-2011 at 14:24.
Arkshine 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 00:12.


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