AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved what does that mean (https://forums.alliedmods.net/showthread.php?t=338816)

wilian159 07-27-2022 13:19

what does that mean
 
I was looking at some plugins around and I came across this, what does that mean, I had never seen it.

in plugin_precache

PHP Code:

register_message(get_user_msgid("DeathMsg"), "MsgHook_Death"); 

the public

PHP Code:

public MsgHook_Death() <FireBulletsEnabled>
{
    
set_msg_arg_string(4WEAPON_DEATH_NAME)



but right below there is this

PHP Code:

public MsgHook_Death()            </* Empty statement */>        { /* Fallback */ }
public 
MsgHook_Death()            <FireBulletsDisabled>        { /* Do notning */ 

what does this 'Fire Bullets' mean, and why does it have 3 publics too

Shadows Adi 07-27-2022 13:37

Re: what does that mean
 
That's an automaton which means "machine states" or, in this case, "plugin states".

You can learn more from here:
https://forums.alliedmods.net/showthread.php?t=85981

or from general topics about automatons.

damage220 07-27-2022 13:47

Re: what does that mean
 
I tried to compile a program with the code
PHP Code:

public MsgHook_Death() <FireBulletsDisabled>
{} 

and got error "warning 230: no implementation for state "" / function "MsgHook_Death", no fall-back".
pawn supports states and automatons (state machines) directly in the language, including state-local variables. Doing this in the compiler allows for flexibility and optimal performance, as well as having the compiler verify the constraints of the automaton.
Language features
More info is here, page 36.

wilian159 07-27-2022 14:07

Re: what does that mean
 
at the end of the day this doesn't affect performance gain these days, right?

HamletEagle 07-28-2022 14:13

Re: what does that mean
 
Quote:

Originally Posted by wilian159 (Post 2785018)
at the end of the day this doesn't affect performance gain these days, right?

No, without automatons your code will be 99999999x times slower and will not run at all without an i9 12900k overclocked on liquid nitrogen.

(Not every single feature in a programming language is about speed or efficiency or performance)


All times are GMT -4. The time now is 15:38.

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