Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 01-24-2014, 01:44 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
There are a few things you could change with what you have written up so far..

We'll start from the beginning, excluding the onSelect event...we'll get back to that, but first:

PHP Code:
//#CLIENTSIDE
/*ignore this...
function Tools.onSelect(temp.i) {
  if (row == 0){
    player.chat = this.items[temp.i][0] SPC "Selected";
  }
}
keep ignoring this..*/

//THIS:
this.tools = {
  {
"Boots"1"no-icon.gif"}, 
  {
"a"2"no-icon.gif"}
}; 
Try not to define arrays or variables outside of a function or an event (if it is not a constant.)
Putting this inside of onCreated() { this.tools = {blah...}; } will work, but I'd recommend an alternative method for defining the tools list (possibly something serverside if this is a shop menu and sending it to the client).

Continuing on...

PHP Code:
function onCreated() {
  new 
GuiWindowCtrl("MyGUI_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "180,218";

    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Tools";
    
1170// <----THIS... 
Alright...so what that's saying is it needs to start at 1170 pixels from the left of the screen, but not every user has a screen/w!ndow that wide

Use
PHP Code:
GraalControl.width this.width
That takes into account the width of their graal/client w!ndow and positions the new menu where you want it...

In your code, your list control is this:
PHP Code:
    new GuiTextListCtrl("Test_List") {
     
profile GuiBlueTextListProfile;
     
0;
     
width 140;
     
fitparentwidth true;
 
     
clearrows();
      for (
temp.ithiso.tools) {
          
addrow(temp.ntemp.i[0]);
          
temp.n++;
        }
     
setSelectedRow(0);
      } 
"Test_List", but in the function you are drawing up or testing, you reference it as "Tools" -- but there is not a control with the name tools...

It should be:

PHP Code:
function Test_List.onSelect(entryid,entrytext,entryindex) {
  
// use entryid, entrytext, or entryindex however you want
  
echo("Clicked " entrytext);

Also, please note, that this ECHO will have to be viewed by pressing F2 and looking at the output there since this is clientside.
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
 


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 05:17 AM.


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