Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Script hindering movement, the use of the tab key, and word input. (https://forums.graalonline.com/forums/showthread.php?t=134260088)

Jiroxys7 08-05-2010 11:15 PM

Script hindering movement, the use of the tab key, and word input.
 
Okay, so I've been working on this system to show how many buffs you have. And after some trial and error (as well as plenty of Access violations :p) I had finally got it working. Everything was fine for a while, but now all of a sudden I've found that I cant move unless I rapidly click the mouse on the screen while holding down a direction, I cant use the chat box unless i hit tab and click on the screen at the same time, and if i do manage to bring up the chat box, it wont let me type anything. however the other default functions seems to work just fine (sword, open inventory, grab, etc)

I narrowed down the problem to the portion of this script that I was working on.. but theres nothing in it that would normally hinder movement ( it doesnt include movement speed mods nor player.freezetimes)

So I'm kind of lost on what's causing this. I have a hunch that it might be that the icons suddenly feel like taking focus when theyre made, but I'm not totally sure. And I cant check since I dont know the commands that manipulate the focus of a GUI. But this may not even be the case.

Here's the section of the code. The function is called every 0.05 seconds by the timeout function:

PHP Code:

function doCheckBuffs(){

  
temp.buffs clientr.buffs.tokenize(",");
  
temp.count temp.buffs.tokenize(",").size();
      
      if(
temp.iconnumbers == 0){      
        for(
temp.0temp.<= 100temp.++){   
          
makevar("Test_ShowImg_" temp.a).destroy();
        }
        
temp.iconnumbers 0;        
      }
      
      for(
temp.0temp.temp.counttemp.++){        
        new 
GuiShowImgCtrl("Test_ShowImg_" temp.b) {
             
192 + (32*temp.b);
             
130;
             
width 60;
             
height 60;
             
image "j7_buff_alternate.png";
             
temp.iconnumbers += 1;
        }
      }



Any ideas what's causing my problem?

cbk1994 08-05-2010 11:24 PM

How often is that being called? The problem is that it's stealing focus from the GraalControl.

Crow 08-05-2010 11:41 PM

It'd be a good idea to first create the GUI controls (in the onCreated event), and then just alter the image or whatever of it in that function. No sense in creating these controls over and over again, and it just steals focus.

Jiroxys7 08-05-2010 11:47 PM

Quote:

Originally Posted by cbk1994 (Post 1591659)
How often is that being called? The problem is that it's stealing focus from the GraalControl.

Is there any way to manipulate the focus? I think jerret uses such techniques on zodiac GUIs.

Quote:

Originally Posted by Crow (Post 1591660)
It'd be a good idea to first create the GUI controls (in the onCreated event), and then just alter the image or whatever of it in that function. No sense in creating these controls over and over again, and it just steals focus.

Sounds like a good idea. I'll try that later, thanks :)

fowlplay4 08-05-2010 11:54 PM

Instead of having a getfocus() function like any normal programming language, Graal has..

Object.makefirstresponder(true);

So if the show/hiding of a GUI grabs focus, and you want to return control back to your Graal char, you do: GraalControl.makefirstresponder(true);

cbk1994 08-06-2010 12:06 AM

Quote:

Originally Posted by Jiroxys7 (Post 1591662)
Is there any way to manipulate the focus? I think jerret uses such techniques on zodiac GUIs.

Yes but you shouldn't be creating/destroying them except when they change.

PHP Code:

GraalControl.makeFirstResponder(true); 



All times are GMT +2. The time now is 04:12 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.