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

[ANY]Native function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NiceT
Junior Member
Join Date: Mar 2019
Old 10-17-2019 , 06:53   [ANY]Native function
Reply With Quote #1

Maybe I can ask about the principle of SourcePawn for native function implementation ?
No community like AlliedModders for a coder who likes squirrels is very unfortunately.

I really enjoy using squirrel write the script of L4D2, I also use sourcepawn write plugins , although squirrel not as good as sourcepawn in many places, but this does not mean that squirrel is not good, just sometimes not so strong like sourcepawn.

But now I have an urgent problem to solve:
In L4D2's "include" folder, I find a file named "halflife.inc" and there are some print functions in this file such as:

Code:
/**
 * Prints a message to a specific client in the center of the screen.
 *
 * @param client		Client index.
 * @param format		Formatting rules.
 * @param ...			Variable number of format parameters.
 * @error				If the client is not connected an error will be thrown.
 */
native void PrintCenterText(int client, const char[] format, any ...);

/**
 * Prints a message to a specific client with a hint box.
 *
 * @param client		Client index.
 * @param format		Formatting rules.
 * @param ...			Variable number of format parameters.
 * @error				If the client is not connected an error will be thrown.
 */
native void PrintHintText(int client, const char[] format, any ...);
It adds a native tag in front of the return value type but I'm not really sure I understand the meaning of the tag, so I want to ask what the tag's effect.

And, I also want to know the underlying implementation principle of this function.
I browsed https://wiki.alliedmods.net/Creating_Natives_(SourceMod_Scripting).

But, I don't think I really understand it.
And I searched all the .inc files to find something about regarding implementation of these two functions but nothing I found.

I want to implement them using squirrel, but I don't know how to do it.

Functions are first class values like integer or strings and can be stored in table slots, local variables, arrays and passed as function parameters. Functions can be implemented in Squirrel or in a native language with calling conventions compatible with ANSI C.

Maybe someone can explain the meaning of the above sentence, it is hard for me to understand it.
Although I don't understand this sentence, I think squirrels can also implement native functions, but I can't.

Squirrel can display HUD on the screen, so there must be no problem in displaying the text, but now the problem is that displaying HUD is for all players, and I hope to find a way to display different information for each specific survivor.

If the community doesn't allow discussion about other languages, the administrator can delete this post directly, but I really hope to find a way to make squirrels work like sourcepawn.
NiceT is offline
 



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 02:45.


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