properly destroying GUI controls?
I'm currently having issues with a custom sign system I am creating. I think the bug exists because the GUI controls aren't being destroyed properly (working theory for right now). This is how I am destroying the controls:
PHP Code:
Quote:
|
For future knowledge this was an issue with how I was calling the next function and not an issue with destroy(). It works as intended.
I would like to know a decent method for destroying a GUI control if the player is warped. If anyone has advice on that I'd like to hear. Thanks! |
I've run into another problem and I'm not entirely certain how to get around it or what is causing it. I am checking if a specific key is pressed when a control is active:
PHP Code:
|
You can use findobject("objectname") to check if an object exists before destroying it.
For clearing out GUIs when you leave a level(assuming you are creating the GUI's in a level script) you can try a serverside onPlayerLeaves(), like so: PHP Code:
PHP Code:
For the other issue you can try keeping track of when an object is going to be destroyed. Just so you know, objects can also have dynamic variables assigned to them. PHP Code:
PHP Code:
PHP Code:
|
I'm trying to what you suggested, but I am still having issues with the keydown repeating. Maybe showing exactly what I'm doing will shine more light on my problem.
PHP Code:
Also after testing a little bit it doesn't look like onPlayerLeaves is called, at least if the player uses "unstick me". I am going to look into that a bit more. |
Make sure onPlayerLeaves() {} is being used serverside, not clientside.
As for the issue you're encountering with the list selection... sometimes Graal is gonna be Graal. You can try using something other than getselectedrow(), like getselectedid() and assign ID's starting at 1 or such. That way if Graal returns 0 or such you'll know it's not a valid input and to just ignore it. |
For future reference, onPlayerLeaves works. When I was joining the class it was on CLIENTSIDE.
|
How does GuiScrollCtrl.scrollto(int, int) work? I am having issues with scrolling a GuiTextListCtrl inside of a GuiScrollCtrl. For whatever reason when using the arrow keys to navigate the menu the control won't scroll to the highlighted option / row. Scrolling with the mouse wheel is the only way to see further down the page.
Also can I catch if a player resizes GraalControl? |
Quote:
PHP Code:
|
I broke down and placed my script inside of a weapon NPC which has fixed a lot of the issues I was having before. Currently I am calling it in a level NPC like this:
PHP Code:
PHP Code:
Quote:
Now I just need to understand this scrolling bug. |
okay to resolve the issue I used
PHP Code:
|
I'm actually having more trouble with that hack workaround. Is there any way to find the position of a row and then scroll to it that way? To me it is pretty ridiculous that it doesn't automatically scroll to a selected row when the row is highlighted. It might be a byproduct of my script, but I really don't think so.
|
Can someone clarify the different between onKeyDown and keydown? I read somewhere that keydown works off the mapped keys in the options menu, and onKeyDown does not. If I wanted to allow the player to use mapped keys inside of a Gui would I have to use keydownglobal?
|
All times are GMT +2. The time now is 05:20 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.