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

[ANY]Native function


Post New Thread Reply   
 
Thread Tools Display Modes
NiceT
Junior Member
Join Date: Mar 2019
Old 10-18-2019 , 03:33   Re: [ANY]Native function
Reply With Quote #11

Quote:
Originally Posted by Silvers View Post
I was just pointing out something, not an answer to your question.

I still don't understand what you're trying to do. Why don't you write in SourcePawn? If you really need to call some VScript functions you can do for example:

PHP Code:
        // Credit to Timocop on VScript function
        
static int iScriptLogic INVALID_ENT_REFERENCE;
        if(
iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
        {
            
iScriptLogic EntIndexToEntRef(CreateEntityByName("logic_script"));
            if(
iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic))
                
LogError("Could not create 'logic_script");

            
DispatchSpawn(iScriptLogic);
        }

        
char sBuffer[96];
        
Format(sBuffersizeof(sBuffer), "GetPlayerFromUserID(%d).Stagger(Vector(%d,%d,%d))"useridRoundFloat(vPos[0]), RoundFloat(vPos[1]), RoundFloat(vPos[2]));
        
SetVariantString(sBuffer);
        
AcceptEntityInput(iScriptLogic"RunScriptCode");
        
AcceptEntityInput(iScriptLogic"Kill"); 



I've written a script with more than 3000 lines of squirrel code, and I think in some ways it's no worse or even more efficient than sourcepawn.

Now I just want to implement a function which I implemented in sourcepawn, but I can't find a way to display different text in the center of each specific player's screen like sourcepawn, so I'm looking for a solution.

But if I can't find a way, it's OK to give up.

In my script, the main function is to let players switch between some customized game modes, control the director system and so on, and let players customize their game playing modes.

In short, although sourcepawn is a powerful tool that can implement many functions, it is too difficult for an ordinary L4D2 player to install it. Not every player has chance to access to this tool.

But the script is not the same, do not need to install any additional tools, I can even packaged as a VPK file and then publish in Workshop after completing the script, and then for any ordinary player, they can simply click subscribe and enjoy the convenience from this script, this is my initial thoughts and desires.

Last edited by NiceT; 10-18-2019 at 03:34.
NiceT is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-18-2019 , 07:41   Re: [ANY]Native function
Reply With Quote #12

Quote:
Originally Posted by NiceT View Post
Maybe I didn't express the meaning clearly before. what I want is to implement the function of sourcepawn through vscript, not vscript through sourcepawn. but, thanks everyone.
I see now, you did mention wanting to recreate those two functions in Squirrel. Got lost among the rest of the things that needed clarification given the topic title.

You'll mostly be stuck with whatever Valve provides through VScripts, which in this case, doesn't seem to expose the ability to transmit the TextMsg or HintText user messages to individual players, which those functions need.

The game_text entity would be close (since it looks like you can fire off entity inputs), but is bugged in L4D2.

I don't believe you can register your own VScript / Squirrel functions in the way you describe (making it just work after a one-click install from the Workshop).
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
NiceT
Junior Member
Join Date: Mar 2019
Old 10-18-2019 , 11:21   Re: [ANY]Native function
Reply With Quote #13

Quote:
Originally Posted by nosoop View Post
I see now, you did mention wanting to recreate those two functions in Squirrel. Got lost among the rest of the things that needed clarification given the topic title.

You'll mostly be stuck with whatever Valve provides through VScripts, which in this case, doesn't seem to expose the ability to transmit the TextMsg or HintText user messages to individual players, which those functions need.

The game_text entity would be close (since it looks like you can fire off entity inputs), but is bugged in L4D2.

I don't believe you can register your own VScript / Squirrel functions in the way you describe (making it just work after a one-click install from the Workshop).

At the beginning, I wanted to use HINT to implement it, but HINT has a key problem. It will not conflict with the previously generated HINT.

What are the consequences?
Such as I use HINT to display the HP remain text of special infected they hurt:
like this:
HP ##########------------

I try to use a HINT in front of the player's screen to display the text, or on top of the special infected's head they attack.

I implemented it. It does display a HINT on the player's screen, but if the damage caused many times in a short time, it will cause a very serious problem.
like this:
HP #############------
HP ###########---------
HP ######------------------
HP ###-----------------------
HP #---------------------------

The last HINT hasn't disappeared. the next one will appear.
And the text of HINT in vscript is not like CenterText or HintText in SourcePawn. If the previous text does not disappear, it will directly overwrite the previous text(In sourcepawn).
The vscript's HINT(in essence, it's some tips in the game, like if you shout your teammates, the game will show a instructor: Don't shout your teammate!), If you turn on the game instructor option in the game, you can see many instructors in some scenes at the same time.
So it doesn't work like sourcepawn.
The worst thing is that there is no way to control when to turn it off directly, only to set a specific time to turn it off.

It's right to give up I think.
NiceT is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 10-18-2019 , 11:36   Re: [ANY]Native function
Reply With Quote #14

Print multiple blank messages to clear the previous? Not sure if that would work. Also I advise against using instructor hints, quite a few people have them turned off.

If it's only HP you're displaying, what about using the progress bar and SetProgressBarText. Would look better instead of #####----- stuff.
__________________
Silvers is offline
NiceT
Junior Member
Join Date: Mar 2019
Old 10-18-2019 , 11:51   Re: [ANY]Native function
Reply With Quote #15

Quote:
Originally Posted by Silvers View Post
Print multiple blank messages to clear the previous? Not sure if that would work. Also I advise against using instructor hints, quite a few people have them turned off.

If it's only HP you're displaying, what about using the progress bar and SetProgressBarText. Would look better instead of #####----- stuff.

SetProgressBarText will return the progress bar as a string, it didn't provide the location of the display, so I wanted to find a way to solve the problem.
A common way to use it is through HUD display, but it is displayed to all players, not to a specific player.

Blank lines are meaningless, because this hint needs to show an icon. Even if there is no text, the icon will still be displayed. If the icon is not specified,it will use the default icon, or an error will occur.

Last edited by NiceT; 10-18-2019 at 11:53.
NiceT 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 02:58.


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