Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Dynamic Framesets? (https://forums.graalonline.com/forums/showthread.php?t=73929)

doomboy00 05-11-2007 05:20 PM

Dynamic Framesets?
 
I've recently been playing around with gui's and came across something that no matter how much trial and error i attempt i cannot get this to work.

Basically it's a gui with a dynamic number of tabs depending on a string being set. With a pane for each of these tabs, but for the life of me I cannot get the pane to show.

Any help would be greatly appreciated:

NPC Code:

function onSetup()
{
new GuiWindowCtrl("testWindow")
{
profile = "GuiBlueWindowProfile";
useownprofile = true;
extent = "400 600";
position = "30 30";
text = "testWindow";
destroyonhide = false;
canmaximize = false;
canresize = false;

new GuiTextCtrl("testTitle")
{
profile = "GuiBlueTextProfile";
useownprofile = true;
position = "120 25";
profile.fontsize = 20;
profile.fontcolor = {255,255,255};
profile.fontType = "Verdana";
text = "Dynamic Tabbing";
}

frameInd=1;
while(clientr.("imgstore"@frameInd))
{
new GuiFrameSetCtrl("mainFrame"@frameInd)
{
position = "20 80";
extent = "350 400";
rowcount = 5;
columncount = 4;
visible=false;
bordermovable="alwaysOff";
totalcount = rowcount*columncount;

for(imgInd=0;imgInd<totalcount;imgInd++)
{
new GuiControl("imgBox"@imgInd)
{
profile = "GuiBlueScrollProfile";
useownprofile = true;
hscrollbar = "dynamic";
vscrollbar = "dynamic";

new GuiShowImgCtrl("img"@imgInd)
{
position = "15 10";
extent = "48 48";
image = clientr.("imgstore"@frameInd)[imgInd]@".png";
offsetx = "-96";
thiso.catchevent(name,"onMouseDown","onImgSelect") ;
}
}
}
frameInd++;
}
}

new GuiTabCtrl("testTab")
{
profile = "GuiBlueTabProfile";
useownprofile = true;
position = "20 60";
extent = "380 20";
tabwidth = "70";

clearrows();
tabInd=1;
while(clientr.("imgstore"@tabInd))
{
with(addrow(tabInd-1,"Set " @tabInd))
{
this.pane="mainFrame"@tabInd;
}
tabInd++;
}

thiso.catchevent(name, "onSelect", "onTabSelect");
}
}
testTab.setSelectedById(0);
graalControl.addControl(testWindow);
}

function onTabSelect(tabs)
{
tabs.selected.pane.show();
}


Chandler 05-11-2007 06:33 PM

hmm easier to do
HTML Code:

//Do the basic row thing stuff here

temp.itemAmount = getstringkeys("clientr.imgstore").size();
for (temp.currentItem: temp.itemAmount)
{
  addrow(w/e here, true);
}

Hope this helps!

xXziroXx 05-11-2007 06:37 PM

Quote:

Originally Posted by Chandler (Post 1307049)
HTML Code:

//Do the basic row thing stuff here

temp.itemAmount = getstringkeys("clientr.imgstore").size();
for (temp.currentItem: temp.itemAmount)
{
  addrow(w/e here, true);
}


Why do you do:

PHP Code:

for (temp.currentItemtemp.itemAmount)
{
  
addrow(w/e heretrue);


when this is the exact same thing?

PHP Code:

for (currentItemtemp.itemAmount)
{
  
addrow(w/e heretrue);



Chandler 05-11-2007 06:43 PM

Why would you want to keep the VARIABLE data?
Here:
HTML Code:

function onCreated()
{
  temp.myList = {"hey", "hi", "lol"};
  for (currentItem: temp.myList)
    echo(currentItem);
  echo(currentItem);
  scheduleevent(3, "Repeat", "");
}
function onRepeat()
{
  echo(currentItem);
}

using temp. prefix's won't STORE the VARIABLE data.

xXziroXx 05-11-2007 06:47 PM

Quote:

Originally Posted by Chandler (Post 1307051)
Why would you want to keep the VARIABLE data?
Here:
HTML Code:

function onCreated()
{
  temp.myList = {"hey", "hi", "lol"};
  for (currentItem: temp.myList)
    echo(currentItem);
  echo(currentItem);
  scheduleevent(3, "Repeat", "");
}
function onRepeat()
{
  echo(currentItem);
}

using temp. prefix's won't STORE the VARIABLE data.

You obviously don't know how those kind of loops work.

temp.str is set (temporary variable)
PHP Code:

for (temp.strthis.strlist) { ... } 

When not using a prefix in these kind of loops, a TEMP. variable is set.
PHP Code:

for (strthis.strlist) { ... } 


Chandler 05-11-2007 06:47 PM

Quote:

Originally Posted by xXziroXx (Post 1307054)
When not using a prefix in these kind of loops, a TEMP. variable is set.
PHP Code:

for (strthis.strlist) { ... } 


Balls, you speak lies. :)

You obviously don't know gscript two.

Try the script that I posted.

xXziroXx 05-11-2007 06:49 PM

Quote:

Originally Posted by Chandler (Post 1307055)
Balls, you speak lies. :)

Yeah, sure.. Whatever you say. That's the way they work though, perhaps you should try if your script works before you post it.



PHP Code:

function onCreated()
{
  
temp.myList = {"hey""hi""lol"};
  for (
currentItemtemp.myList)
    echo(
currentItem);
  echo(
currentItem);
  
scheduleevent(3"Repeat""");
}
function 
onRepeat()
{
  echo(
currentItem);


When onRepeat() is called, it will echo absolutely nothing!

Chandler 05-11-2007 06:51 PM

Ok, I've lost alot of respect for you.

xXziroXx 05-11-2007 06:54 PM

Quote:

Originally Posted by Chandler (Post 1307058)
Ok, I've lost alot of respect for you.
You're a script idiot. Idiot scripter.

Whatever man. It's not like I like you anyways. :asleep:

Just don't say anything when someone more "respected" tell you how they work.

Chandler 05-11-2007 06:56 PM

Did you even try the script?

xXziroXx 05-11-2007 07:10 PM

No, I didn't, and.. Oh bugger. Guess I'll have to apologize for being narrow sighted. I just realized that I'm bull****ting myself. Of course it's not cleared afterwards. Don't know why I was thinking it would, must've confused myself there.

zokemon 05-12-2007 01:21 AM

Chandler: When you specify a variable without a prefix that isn't an existing variable of the current object, it automatically gets headed with "temp."

If it DOES exist on the current object, it automatically gets headed with "this."
You can't just have random variables floating around with no heading...Graal will automatically assign every variable to some object or another (with the assumption that "temp" is an object in this case)

Chandler 05-12-2007 07:36 AM

It's still setting it to the object, which can be called from a different function too. To me, that isn't a TEMP. prefix.

cbk1994 05-12-2007 02:31 PM

What would be the point of a variable without a prefix? I always use temp.i, except for params, and that's just from habit. If you needed something that was global on the client, client. variables (clientside). If you want something global to the NPC, this./thiso., if you want something global on the server, server. or serverr.

Someone care to explain what it is used for?

Chandler 05-12-2007 06:20 PM

Explain what?


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

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