Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-20-2011, 10:17 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Updating Co-Ordinates GUI

I have made a very simple GUI which displays the players X and Y. But, i want it to update every 0.05 seconds. I don't yet know how to set timeouts so any help would be greatly appreciated.

PHP Code:
//#CLIENTSIDE 


function onCreated() {
    
setTimer(0.05);
    new 
GuiWindowCtrl("CoOrds_Window1") {
        
profile GuiBlueWindowProfile;
        
clientrelative true;
        
clientextent "109,56";

        
canclose false;
        
canmaximize false;
        
canminimize false;
        
canmove false;
        
canresize false;
        
closequery false;
        
destroyonhide false;
        
text "Co-Ordinates";
        
1045;
        
596;

        new 
GuiTextCtrl("CoOrds_Text1") {
            
profile GuiBlueTextProfile;
            
height 20;
            
text "player.x";
            
width 40;
            
9;
            
7;
        }
        new 
GuiTextCtrl("CoOrds_Text2") {
            
profile GuiBlueTextProfile;
            
height 20;
            
text "player.y";
            
width 41;
            
58;
            
7;
        }
        new 
GuiTextEditCtrl("CoOrds_TextEdit1") {
            
profile GuiBlueTextEditProfile;
            
height 20;
            
text player.x;
            
width 47;
            
6;
            
26;
        }
        new 
GuiTextEditCtrl("CoOrds_TextEdit2") {
            
profile GuiBlueTextEditProfile;
            
height 20;
            
text player.y;
            
setTimer(0.05);
            
width 47;
            
53;
            
26;
        }
    }

__________________
Reply With Quote
  #2  
Old 05-20-2011, 10:25 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
why exactly do you want the windows to move? Are you more interested in just actually updating the player x/y text?

if so, just add

PHP Code:
function onTimeout(){
  
Co0rds_TextEdit2.text player.y;
  
Co0rds_TextEdit1.text player.x;
  
setTimer(.05);

Reply With Quote
  #3  
Old 05-20-2011, 10:42 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
This displays a sting of errors in RC.
__________________
Reply With Quote
  #4  
Old 05-20-2011, 11:04 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Hey so i updated the script and it is still not displaying te x and y every .05 seconds.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  new 
GuiWindowCtrl("MyGuiTest_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "126,98";

    
canclose false;
    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Co-Ordinates";
    
1028;
    
554;

    new 
GuiTextEditCtrl("MyGuiTest_TextEdit1") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 80;
      
text player.y;
      
23;
      
26;
    }
    new 
GuiTextEditCtrl("MyGuiTest_TextEdit2") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 80;
      
text player.x;
      
23;
      
67;
    }
    new 
GuiTextCtrl("MyGuiTest_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Player: X";
      
width 43;
      
39;
      
6;
    }
    new 
GuiTextCtrl("MyGuiTest_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Player: Y";
      
width 44;
      
42;
      
48;
    }
  }
}
function 
onTimeout(){
  
Co0rds_TextEdit2.text player.y;
  
Co0rds_TextEdit1.text player.x;
  
setTimer(.05);

__________________
Reply With Quote
  #5  
Old 05-20-2011, 11:15 PM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
In the onCreated() event, put
PHP Code:
onTimeout(); 
That will start the timeout loop. The code within the onCreated() event is triggered when the weapon is created (Pretty obvious). However, the onTimeout() event needs to be triggered by either calling it directly, or by setting a specific time with
PHP Code:
setTimer(x); 
http://gscript.graal.net/onTimeout
__________________

Reply With Quote
  #6  
Old 05-21-2011, 02:52 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
you should also use the correct gui names
__________________
Reply With Quote
  #7  
Old 05-21-2011, 10:59 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Ok i fixed it thanks guys.
__________________
Reply With Quote
  #8  
Old 05-21-2011, 11:00 AM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
...or you could just click F5 =p

e; you should start renaming the gui-controls name after you created it with the GUI Editor (or stop using it, and do it manually), such as making "tool_button2" to the relevance it has, such as "tool_closebutton".
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #9  
Old 05-21-2011, 01:54 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I know i could just click f5 lol but im learning slowly. It was just a test really.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:54 PM.


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