Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Freezing when shown (https://forums.graalonline.com/forums/showthread.php?t=134257647)

Schetti 01-13-2010 07:39 PM

Freezing when shown
 
I've got the following problem:
When I for example do this script
HTML Code:

//#CLIENTSIDE
function onWeaponFired() {
this.on = !this.on;
if (this.on) {
  new GuiWindowCtrl("Test") {
    profile = GuiBlueWindowProfile;
    clientrelative = true;
    clientextent = "320,240";

    canmove = true;
    canresize = true;
    closequery = false;
    destroyonhide = false;
    text = "Window 1";
    x = 666;
    y = 351;

  }
 }elseif ( !this.on) {
Test.destroy();
 }
}

And press D, the window will shop up, yea all ok, BUT I can't hit D again without klicking onto the screen before, else it wont destroy the window, I hope you know what I mean.
What I want to have, is that I can hit D again and again without having to klick onto the screen before.

Im sorry for this circumbendibus.

DustyPorViva 01-13-2010 07:51 PM

The window is stealing focus.

This might be of interest:
http://forums.graalonline.com/forums...96&postcount=9

fowlplay4 01-13-2010 09:32 PM

You should be creating the GUI, then just toggling it's visibility like so:

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
showGUI();
}

function 
showGUI() {
  
// Check if the Window has been made.
  
if (isObject("Test")) {
    
// Toggle Visibility
    
Test.visible = !Test.visible;
    
// Exit Script
    
return;
  }
  
// Create GUI
  
new GuiWindowCtrl("Test") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "320,240";

    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Window 1";
    
666;
    
351;
  }
  
// Sets Focus to Graal
  
GraalControl.makefirstresponder(true);




All times are GMT +2. The time now is 03:51 PM.

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