![]() |
"hooking" functions?
Hi,
is there a way to "hook" functions? like to modify them or put own code on them? or to fully rewrite them? |
What exactly are you trying to do?
|
Basically changing functions
or Events like onPlayerTouchsMe or like changing the gui controls to use other template setup or stretch/dont stretch images etc xD or to make own syntaxhighlightning at the guitext ctrls |
The way you format your posts makes it hard for me to understand what you are talking about.
I am under the impression that you want to override built-in functions/events? I am pretty sure that you can't. What you can do, though, is script your own. |
He wants to rescript default events/functions. :D
|
Ajira got it xD
or simply add something to them |
As far as I know you can't override the default functions, but you can always make your own. If you mold your server properly then you can have certain NPCs handle certain events instead of having 45973497534 NPCs that could be combined for efficiency and editability (and yes, it is a word, I just made it up so get over it).
|
Yeah you can make your own but that means fully redoing the function instead of changing it X_x
|
Quote:
|
Projectshifter, have you ever used the GUI controls in Graal?
|
Quote:
|
Well look at GuiControls
they are nice but u cant change the template(well you cant change positioning/use/size of it XD |
Quote:
|
Hmm, using catchevent() would probably be the closest thing you could do to 'hooking functions'
|
AFAIK you can change the image it uses and by that changing its style but i dont know of changing the template it uses o_o like having an other order of the elements on the image etc or adding new things
|
playertouchsme is the strangest event handler in the sense that you can't modify it. There are several instances in which you might want to, but you just can't.
You can most easily control certain clientside events if you can disable them (consider disableweapons). However, you can't control all serverside events quite as efficiently. I'm pretty sure you could tell an NPC not to recognize an event and use the trigger function to call it whenever you needed it, but it would be hard to mimick serverside with the lack of a timeout (especially for playertouchsme). I'm hoping Stefan will release at least one more event handler, being similar to playertouchsme, for the player overlapping or bordering the NPC. Playertouchsme doesn't do that specifically, but there are a lot of places it could be used if you simply wanted a script to be based on a field and use the npc's x,y,width,height to define that field. Perhaps damage fields, or even any coordinate dependent zones that activate some other script functionality. Damage fields would be what I would immediately use this for, but the concept can certainly cover other aspects of things as well. I would probably think the best implementation would be something like: onPlayerEntersMyShape() and onPlayerLeavesMyShape(). It would be comparable to having onPlayerEnters() and onPlayerLeaves(), but the player only enters a part of the level that's defined by an NPC's x,y,w,h... or leaves a part of the level that's defined by an NPC's x,y,w,h. It would make sense to call the onPlayerLeavesMyShape() for the NPC the player has not left the shape of before the player leaves the level. I ought to post this in my other thread about playertouchsme. It would certainly help a bit to have such functionality. |
Quote:
|
with template i mean the order of the elements on the bitmap it uses
|
Quote:
|
Quote:
There would be no way to create that functionality serverside without crashing the NPC server. If you don't see the use of it being added, it's your sad day. Here's one scenario: say we have a sparring area within a level. You want to lock the sparring area when two players are in the arena and warp anyone else out. What you would never be able to script as effectively without this event handler: PHP Code:
|
In the past, we've used x's and y's or setshape, but yeah, I would like this. It would also have to be modify...able. You would have to be able to control the area around it. Maybe even an option of using radius, so you can have a circle. (in my oppinion, this would be an exelent addition, i'm tired of sine, cosine, a^2 and so on).
|
Generally this is done with a trigger and/or a timeout. I'm comprehending what you're saying you want, and why you seem to think you need it, I just really don't see it being that big of a deal and something that cannot be accomplished in other ways just fine.
|
Quote:
Quote:
|
| All times are GMT +2. The time now is 09:47 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.