Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   gui lister (https://forums.graalonline.com/forums/showthread.php?t=134262243)

callimuc 02-27-2011 05:34 AM

gui lister
 
Hey guys, i tried around with the GuiPopUpMenuCtrl(" ") and got two questions. First:

I placed the following into a NPC:
PHP Code:

function onCreated() {
  
this.join("test1");
}
//#CLIENTSIDE
function onCreated() {
  
this.bla1 "bla";
  
this.bla2 "bla";


and this is a part of the class "test1":
PHP Code:

new GuiPopUpMenuCtrl("test1_List") {
  
width 130;
  
height 20;
  
10;
  
77;
  
cleararrows();   
  
addrow(0,this.bla1);
  
addrow(1,this.bla2);
  
sort();
  
setSelectedRow(0);


So when I make it that way, it won´t say the this.bla1 or this.bla2. How could I make it that it will say that?

Seccond question:
I figured out, how to make it listing the player.weapons.
PHP Code:

for (temp.weapon player.weapons) {
        if (! 
weapon.name.starts("-")) {
          
addRow(0weapon.name);
        }
      } 

But how could I make it list like when I got a flag called:
clientr.test = 1,2,3,4
That it will list the clientr.test?

fowlplay4 02-27-2011 07:18 AM

Well "this.bla1" won't work because this. will be referring to the test1_List, so you have to use thiso instead.

Quote:

Originally Posted by fowlplay4 (Post 1632730)
No, only in the sections where you try to set GUI text to "this." values.

Reason: this. when used in the scope of another object refers to that object, so you have to get the values from the origin "thiso." object.

If you look at the output you'll see what's going on.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.example "Hello World!";
  new 
GuiWindowCtrl("Example") {
    
0;
    
0;
    
width height 200;

    
// Check F2 Logs for Output
    
echo("this.name: " this.name " this.example: " this.example);
    echo(
"thiso.name: " thiso.name " thiso.example: " thiso.example);

    
text thiso.example;
  }



If clientr.test is how you say it is, than it is an array and you can easily use a for each loop like this...

PHP Code:

clientr.test = {1234};
for (
temp.valueclientr.test) {
  echo(
temp.value); // echos: 1, 2, 3, 4


A quick guide for arrays: http://forums.graalonline.com/forums...21&postcount=4

callimuc 02-27-2011 01:15 PM

Thx man I´ll try it out :D


All times are GMT +2. The time now is 01:52 PM.

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