Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   showimg on top of gui window (https://forums.graalonline.com/forums/showthread.php?t=134265626)

DustyPorViva 01-25-2012 10:01 PM

Quote:

Originally Posted by Pelikano (Post 1682682)
Everything is a child of another GUI... even if it's just GraalControl...

Exactly, where do you think it defaults to a child of if you don't specify a parent?

Pelikano 01-25-2012 10:30 PM

you guys are pretty ignorant aren't you? Just place the code I supplied inside some weapon and try it out, if you set a variable to a TShowImg object it will not be added to the GraalControl, you have to do it manually.

however, it might be some v5, v6 issue, I am running v6

salesman 01-25-2012 11:11 PM

Quote:

Originally Posted by Pelikano (Post 1682684)
Controls are only added to GraalControl by default if you do:

PHP Code:

  new GuiShowImgCtrl("SomeImg") {
    
50;
    
50;
    
width 71;
    
height 96;
    
image "era_sam_hiddencard.png";
    
visible true;
  } 

But, if you do it like the OP and create a GuiShowImgCtrl object first, then set it's attributes you have to add it to GraalControl manually:

PHP Code:

  temp.guiImage = new GuiShowImgCtrl("SomeImg");
  
guiImage.50;
  
guiImage.50;
  
guiImage.width 71;
  
guiImage.height 96;
  
guiImage.image "era_sam_hiddencard.png";
  
guiImage.visible true;
  
// Will not show! 

Test it yourself. I'd be very grateful if you'd stop being totally arrogant and obviously you are the one who has no idea in this case.

The first case will create a new GuiControl and assign it to a global variable called SomeImg.
In the second case, you're creating a new GuiControl and just assigning it to a temporary variable.

I don't have RC anywhere and haven't tried anything (so I'm not saying you're wrong), but both cases are just creating a new object. It seems silly that the two cases would be treated differently...

Pelikano 01-25-2012 11:17 PM

Quote:

Originally Posted by salesman (Post 1682691)
The first case will create a new GuiControl and assign it to a global variable called SomeImg.
In the second case, you're creating a new GuiControl and just assigning it to a temporary variable.

I don't have RC anywhere and haven't tried anything (so I'm not saying you're wrong), but both cases are just creating a new object. It seems silly that the two cases would be treated differently...

try it out homie

Crow 01-25-2012 11:18 PM

Quote:

Originally Posted by Pelikano (Post 1682689)
Just place the code I supplied inside some weapon and try it out

Quote:

Originally Posted by Crow (Post 1682686)
I did in the past and I still have some code running somewhere where I do it just like the OP.

Guess what.

Pelikano 01-25-2012 11:19 PM

some time in the past I had some code running somewhere that could predict the future

Crow 01-25-2012 11:31 PM

Quote:

Originally Posted by Pelikano (Post 1682694)
some time in the past I had some code running somewhere that could predict the future

That's great! Thing is, as I said, I still have this code running in one of my testing WNPCs, and I've confirmed that it works just as well. So what the heck do you want anyway? This isn't exactly on topic anymore.

salesman 01-25-2012 11:32 PM

Quote:

Originally Posted by Crow (Post 1682697)
That's great! Thing is, as I said, I still have this code running in one of my testing WNPCs, and I've confirmed that it works just as well. So what the heck do you want anyway? This isn't exactly on topic anymore.

post the code that works?

Crow 01-25-2012 11:38 PM

Quote:

Originally Posted by salesman (Post 1682698)
post the code that works?

It's really not that complicated..

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with (new GuiWindowCtrl("Crow_TestWindow")) {
    
width height 256;
    
text "Rawr!";
  }


Is pretty much it. I removed unrelated things. Still works though.

Pelikano 01-25-2012 11:43 PM

That's not the same thing the OP is doing, I think you should read his code carefully then read yours, you might notice the difference.

Oh yeah you are NOT setting a variable to the object, which means your code is the same thing as:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  new 
GuiWindowCtrl("Crow_TestWindow") {
    
width height 256;
    
text "Rawr!";
  }


It's just sad how ignorant some people can be and instead of apologizing for claiming people have no idea they won't admit that for once it's them doing something wrong lol

Fulg0reSama 01-25-2012 11:46 PM

All above me:

http://i0.kym-cdn.com/photos/images/...2516906111.png

salesman 01-25-2012 11:52 PM

Just tested on Testbed because I was curious:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
// This doesn't work
  
temp.gui = new GuiWindowCtrl();
  
temp.gui.width temp.gui.height 256;
  
temp.gui.text "Test!";
  
  
// but it works if you uncomment this line:
  //GraalControl.addControl(temp.gui);


edit: I thought maybe it didn't work because the GuiControl was just destroyed as soon as the reference to temp.gui was lost (i.e. when onCreated() returns), but it didn't work if I maintained a reference either (such as with this.gui instead of temp.gui).

Pelikano 01-25-2012 11:54 PM

Quote:

Originally Posted by salesman (Post 1682705)
Just tested on Testbed because I was curious:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
// This doesn't work
  
temp.gui = new GuiWindowCtrl();
  
temp.gui.width temp.gui.height 256;
  
temp.gui.text "Test!";
  
  
// but it works if you uncomment this line:
  //GraalControl.addControl(temp.gui);


edit: I thought maybe it didn't work because the GuiControl was just destroyed as soon as the reference to temp.gui was lost (i.e. when onCreated() returns), but it didn't work if I maintained a reference either (such as with this.gui instead of temp.gui).

Yeah, that's the same thing I posted. And it makes sense too if you think about it, you can't just make it add to GraalControl by default, because what if you want to add it to another GuiControl rather than GraalControl?

Tolnaftate2004 01-25-2012 11:58 PM

Quote:

Originally Posted by salesman (Post 1682705)
Just tested on Testbed because I was curious:
...

What happens if you give it a name?

salesman 01-26-2012 12:02 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1682707)
What happens if you give it a name?

Same result. I didn't check if it was still creating a global variable with the name, though.


All times are GMT +2. The time now is 09:31 AM.

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