61
Modification Help / Re: How to align player to north/south/east/west through console
« on: September 05, 2015, 06:57:02 PM »
Client sided or server sided?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Alright guys listen up, there are a lot of weird things you are going to encounter with guiMouseEventCtrl and I only discovered all of this by using them extensively for the last couple of years.
Bug 1: guiControl::setName() does not automatically associate a guiMouseEventCtrl with the various ::onMoulove() functions that you would expect to be called. This means that if you create a guiMouseEventCtrl in the gui editor, and then name it "mymousecontrol" or whatever, it will not call mymousecontrol::onMoulove() for that mouse control. You can fix this by doing a cut-paste of the mouse control in place. That way it is created already with a name, and will work correctly.
Bug 2: guiMouseEventCtrl::onMouseMove() and the drag functions are only called on one axis at a time. This means that if you move your mouse on a diagonal, you will get two calls for ::onMouseMove() in a row. One of them will be for the change in x, one for the change in y. This means that if you try to make a paint program or something, the user will see something that looks like steps when they try to draw a diagonal line.
There are also a lot of subtle ways the mouse controls handle entering and leaving that may or may not be considered bugs but are extremely complex.
I'm sorry, but I'll hijack this thread for a second and a half to ask what is TorqueEdit?
http://forum.blockland.us/index.php?topic=284897.0
Well, currently I'm using GuiBitmapButtonCtrl::onMouseEnter because when I use GuiMouseEventCtrl on the buttons for the main menu, the buttons cannot be clicked on.
I know using names is a lot better, but if you had a lot of names but had to use something like this, it's a lot of writing (laziness).
Also, I just did what you said with the current support code, but adding a parent at the end, it doesn't even call the onMouseEnter for the start button, but for the rest of the buttons, they work. (Doesn't make any sense)
if(!isFunction(MM_StartButton, onMouseEnter))
eval("function MM_StartButton::onMouseEnter(%a, %b, %c, %d){}");
(packaged)
function GuiBitmapButtonCtrl::onMouseEnter(%this, %modifier, %mousePoint, %mouseClickCount)
{
if(!%this.isAwake())
return;
if(isFunction("mEventHandler_" @ %this.eventType @ "_onMouseEnter"))
call("mEventHandler_" @ %this.eventType @ "_onMouseEnter", %this, %modifier, %mousePoint, %mouseClickCount);
Parent::onMouseEnter(%this, %modifier, %mousePoint, %mouseClickCount);
}
If I remember, I don't think GuiControl::onMouseEnter would affect what GuiMouseEventCtrl::onMouseEnter does, but the other way around will be affected, I think GuiControl should be okay. Probably should be packaged, but doesn't need a parent because the game doesn't come with GuiControl::onMouseEnter in the first place.
Hmm, what about other functions that would use this?
Okay, I found another possible solution, this shouldn't interfere with any mods unless they use the exact function.
Would this work? Would it need to be packaged?
function GuiControl::onMouseEnter(%this, %modifier, %mousePoint, %mouseClickCount)
if(!isfunction("MM_StartButton", "onMouseEnter"))
{
eval("function MM_StartButton::onMouseEnter(%a,%b,%c,%d){}");
}
Oh sorry about that nexus, I should have sent you the files, Its the same release, nothing has changed, I'll remove the link.
Uh, when I parented them, some of the functions said "unable to call blah blah"
package MM_Sounds
{
function MM_StartButton::onMouseEnter(%this, %modifier, %mousePoint, %mouseClickCount)
{
parent::onMouseEnter(%this, %modifier, %mousePoint, %mouseClickCount);
//do your thing
}
};
activatePackage(MM_Sounds);
//this is so we don't get a console error when we call parent and the function hasn't been declared yet
if(!isfunction("MM_StartButton", "onMouseEnter"))
{
eval("function MM_StartButton::onMouseEnter(%a,%b,%c,%d){}");
}