Forum

> > CS2D > Scripts > Hooks system
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hooks system

8 replies
To the start Previous 1 Next To the start

old Hooks system

aleksix
User Off Offline

Quote
Does anyone know the algorithm used in hook system? It looks like you can't attach more than 3 functions with the default priority to one hook without any problems. They just cease to work!

old Re: Hooks system

Alistaire
User Off Offline

Quote
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.

old Re: Hooks system

aleksix
User Off Offline

Quote
Quote
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.


Sure, but it makes code harder to read.

Quote
Well, that's why the priority function does exists.


Still,I didn't see any scripts using it. This fact causes some bugs and "conflicts".

old Re: Hooks system

Alistaire
User Off Offline

Quote
user aleksix has written
Quote
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.


Sure, but it makes code harder to read.

Quote
Well, that's why the priority function does exists.


Still,I didn't see any scripts using it. This fact causes some bugs and "conflicts".


If you just throw everything in the same hook, it looks way better. And don't ever use multiple addhooks in one script, it looks terrible and people can tell you're a noob.

old Re: Hooks system

Avo
User Off Offline

Quote
More than one function isn't bad as well, but you have to use 3rd argument to addhook. You can deactivate easily part of your code in-game then. In the other hand, user Alistaire is right - usually newbies use it, becouse pro-scripters don't get mind blocker seeing everything in one function.

old Re: Hooks system

aleksix
User Off Offline

Quote
Backward-engineering is not that good. Someone would like to change the code. Even a good,well-documented code can be rather tricky to learn/remember.

old Re: Hooks system

Alistaire
User Off Offline

Quote
user aleksix has written
Backward-engineering is not that good. Someone would like to change the code. Even a good,well-documented code can be rather tricky to learn/remember.


Where the fuck are you trying to go with this post.

old Re: Hooks system

Starkkz
Moderator Off Offline

Quote
All the time I've done scripts I never used the priority parameter, it gives a lot of bugs when you are using more functions. So I agree with user Alistaire, you should put your script inside a single hooked function to avoid bugs.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview