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)

sssssssssss 01-24-2012 06:42 AM

showimg on top of gui window
 
Is there a way to put my images using showimg on top of the gui window? It keeps putting the gui first, which I know is what it's supposed to do. I just don't feel like rescripting these items to be guiimages, and would really prefer to keep them like they are if there is a fix to this. I tried putting layer values in the gui windows and showimages, but that didn't work.

Crow 01-24-2012 08:47 AM

There's no way to achieve this, no. You can use GuiShowImgCtrl, though. A GUI Control which in its core is the same as a regular TShowImg object.

sssssssssss 01-25-2012 05:06 AM

It's just changing image numbers to gui names for the most part right? I think I just answered myself in that question, but eh.

DustyPorViva 01-25-2012 05:18 AM

No, GUI's fight for focus(not only render focus but input focus as well, like keyboard). You'll have to adjust them to make sure that they're being rendered appropriately and that they're not stealing input.

sssssssssss 01-25-2012 05:52 AM

Any documentation on this? I've searched and never heard of it. :X

sssssssssss 01-25-2012 06:20 AM

Maybe I'm better off asking why this doesn't work. :/ using showimg showed this up behind the gui. search_list isn't empty for sure.
PHP Code:

  for(temp.this.selected_num2temp.this.selected_num2 91temp.++) {
    
//player.chat = search_list[temp.v];
    
if (search_list[temp.v] != null ) {
    
      
//showImg(200+temp.v, "armageddon-iconbox.gif", new_x_position + 3, new_y_position + 30);
      //findImg(200+temp.v).layer = 5;
      //findImg(200+temp.v).mode = 1;
      
("shadow"@temp.v) = new GuiShowImgCtrl();
      (
"shadow"@temp.v).image "armageddon_inventory-iconbox.gif";
      (
"shadow"@temp.v).new_x_position 3;
      (
"shadow"@temp.v).new_y_position 30;
      (
"shadow"@temp.v).layer 5;
      (
"shadow"@temp.v).mode 1;
      
      
//showImg(600+temp.v, search_list[temp.v].image, new_x_position + 4, new_y_position + 5);
      //findImg(600+temp.v).layer = 6;
      //findImg(600+temp.v).mode = 1;
      
("weapon"@temp.v) = new GuiShowImgCtrl();
      (
"weapon"@temp.v).image search_list[temp.v].image;
      (
"weapon"@temp.v).new_x_position 4;
      (
"weapon"@temp.v).new_y_position 5;
      (
"weapon"@temp.v).layer 6;
      (
"weapon"@temp.v).mode 1


fowlplay4 01-25-2012 06:56 AM

Maybe try something like this:

PHP Code:

new GuiShowImgCtrl("Arm_Inventory_IconBox_" temp.v) {
  
new_x_position 3;
  
new_y_position 30;
  
image "armageddon_inventory-iconbox.gif";
  
mode 1;
  new 
GuiShowImgCtrl("Arm_Inventory_IconBox_" temp."_Icon") {
    
image search_list[temp.v].image;
    
4// Since it's a child of 'IconBox' it's x/y will be relative.
    
5// It should also draw above the icon box as well.
    
mode 1;
  }



Pelikano 01-25-2012 02:37 PM

Quote:

Originally Posted by sssssssssss (Post 1682658)
Maybe I'm better off asking why this doesn't work. :/ using showimg showed this up behind the gui. search_list isn't empty for sure.
PHP Code:

  for(temp.this.selected_num2temp.this.selected_num2 91temp.++) {
    
//player.chat = search_list[temp.v];
    
if (search_list[temp.v] != null ) {
    
      
//showImg(200+temp.v, "armageddon-iconbox.gif", new_x_position + 3, new_y_position + 30);
      //findImg(200+temp.v).layer = 5;
      //findImg(200+temp.v).mode = 1;
      
("shadow"@temp.v) = new GuiShowImgCtrl();
      (
"shadow"@temp.v).image "armageddon_inventory-iconbox.gif";
      (
"shadow"@temp.v).new_x_position 3;
      (
"shadow"@temp.v).new_y_position 30;
      (
"shadow"@temp.v).layer 5;
      (
"shadow"@temp.v).mode 1;
      
      
//showImg(600+temp.v, search_list[temp.v].image, new_x_position + 4, new_y_position + 5);
      //findImg(600+temp.v).layer = 6;
      //findImg(600+temp.v).mode = 1;
      
("weapon"@temp.v) = new GuiShowImgCtrl();
      (
"weapon"@temp.v).image search_list[temp.v].image;
      (
"weapon"@temp.v).new_x_position 4;
      (
"weapon"@temp.v).new_y_position 5;
      (
"weapon"@temp.v).layer 6;
      (
"weapon"@temp.v).mode 1


Did you actually add those to a GUIControl or anything?

Crow 01-25-2012 02:50 PM

Quote:

Originally Posted by Pelikano (Post 1682672)
Did you actually add those to a GUIControl or anything?

It's not like you have to.

Pelikano 01-25-2012 06:47 PM

Quote:

Originally Posted by Crow (Post 1682673)
It's not like you have to.

Yes you do...

If you don't want it to be inside a GUI, just do

GraalControl.addcontrol(yourImage);

if you want it to be inside your GUI just use your GuiControl instead of the GraalControl

DustyPorViva 01-25-2012 07:09 PM

Quote:

Originally Posted by Pelikano (Post 1682680)
Yes you do...

If you don't want it to be inside a GUI, just do

GraalControl.addcontrol(yourImage);

if you want it to be inside your GUI just use your GuiControl instead of the GraalControl

No you don't... if you don't nest them inside another GUI then they won't be a child of another GUI...

Pelikano 01-25-2012 07:25 PM

Quote:

Originally Posted by DustyPorViva (Post 1682681)
No you don't... if you don't nest them inside another GUI then they won't be a child of another GUI...

Everything is a child of another GUI... even if it's just GraalControl...

The way he's doing it he will have to manually add it to the GraalControl using .addcontrol

Crow 01-25-2012 07:37 PM

Quote:

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

The way he's doing it he will have to manually add it to the GraalControl using .addcontrol

Controls are added to GraalControl by default. I'd be very grateful if you could just stop posting about things you apparently don't know jack about.

Pelikano 01-25-2012 08:54 PM

Quote:

Originally Posted by Crow (Post 1682683)
Controls are added to GraalControl by default. I'd be very grateful if you could just stop posting about things you apparently don't know jack about.

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.

Crow 01-25-2012 09:05 PM

Quote:

Originally Posted by Pelikano (Post 1682684)
Test it yourself.

I did in the past and I still have some code running somewhere where I do it just like the OP. It works either way and is added to GraalControl by default.

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.

Pelikano 01-26-2012 12:02 AM

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! 


nothing at all, same thing

Crow 01-26-2012 12:12 AM

Quote:

Originally Posted by Pelikano (Post 1682702)
Oh yeah you are NOT setting a variable to the object, which means your code is the same thing as:

That doesn't matter at all. Creating the control returns an object reference. Whether I use that directly or store it in a variable first doesn't matter. The outcome will be the same.


Quote:

Originally Posted by Pelikano (Post 1682702)
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

You're trying too hard.

Pelikano 01-26-2012 12:24 AM

Quote:

Originally Posted by Crow (Post 1682710)
That doesn't matter at all. Creating the control returns an object reference. Whether I use that directly or store it in a variable first doesn't matter. The outcome will be the same.




You're trying too hard.

The outcome is obviously the same, because several people have now tried it and the output wasn't the same.

But I'm sure with your uber skills you're never wrong.

Crow 01-26-2012 12:30 AM

Quote:

Originally Posted by Pelikano (Post 1682711)
The outcome is obviously the same, because several people have now tried it and the output wasn't the same.

But I'm sure with your uber skills you're never wrong.

The conversation ends here because of several reasons:
  • I don't even know what you're talking about anymore because you don't make much sense at all. You're just blabbering about some "outcome" without saying what you're referring to right now.
  • You're arguing like a child.
  • I really don't care.

I don't gain anything from doing this, either. I tried both ways, and either works for me. You say they don't. Now what? Seriously, what's the matter with this bull****? It's up to the coders to decide how to write their code. Whatever works. If this doesn't for you, that's cool with me.

Pelikano 01-26-2012 01:57 AM

Quote:

Originally Posted by Crow (Post 1682712)
The conversation ends here because of several reasons:
  • I don't even know what you're talking about anymore because you don't make much sense at all. You're just blabbering about some "outcome" without saying what you're referring to right now.
  • You're arguing like a child.
  • I really don't care.

I don't gain anything from doing this, either. I tried both ways, and either works for me. You say they don't. Now what? Seriously, what's the matter with this bull****? It's up to the coders to decide how to write their code. Whatever works. If this doesn't for you, that's cool with me.

you should reread the thread, try both variants supplied by me and you will see that both don't work

you are just very arrogant and ignorant to an extend that you can't see the fact of you not being right

but ok I'm obviously the child "who doesn't know jack about what he's talking about", I agree with ending the conversation here

sssssssssss 01-26-2012 05:55 AM

Alright, so I'm using:
PHP Code:

new GuiShowImgCtrl("Arm_Inventory_IconBox_" temp.v) { 
          
new_x_position
          
new_y_position 10
          
image "armageddon_inventory-iconbox.gif";
          
mode 1;
          new 
GuiShowImgCtrl("Arm_Inventory_Icon_" temp.v) { 
            
image search_list[temp.v].image
            
0// Since it's a child of 'IconBox' it's x/y will be relative. 
            
22// It should also draw above the icon box as well. 
            
mode 1;
          } 
      } 

but anything like this will not make it go away later in a different function. :(
And yes, I know I don't need 99999.
PHP Code:

for (v=0;v<99999;v++) {
    
Arm_Inventory_IconBox_(@temp.v).hide();
    
Arm_Inventory_Icon_(@temp.v).hide();


PHP Code:

for (v=0;v<99999;v++) {
    
"Arm_Inventory_IconBox_"(@temp.v).hide();
    
"Arm_Inventory_Icon_"(@temp.v).hide();


PHP Code:

for (v=0;v<99999;v++) {
    (
"Arm_Inventory_IconBox_"@temp.v).hide();
    (
"Arm_Inventory_Icon_"@temp.v).hide();


destroy() is what I really want, but it doesn't work either in a diff funciton.

Also tried doing it OP way with addcontrol, and setting them as this commands to call destroy later, but also didnt work.

PHP Code:

for (v=0;v<player.weapons.size();v++) {
    
this.("weapon"@temp.v).clearControls();
    
this.("shadow"@temp.v).clearControls();


I tried destroy and hide as well. Was just hoping with clearControls.

P.S.
The way I was doing it in my OP, I did have to add addcontrol for it to work like that. After adding that, it showed up fine. I just changed it to this way thinking it would be easier to make it disappear in a different function. :/

fowlplay4 01-26-2012 06:14 AM

Put it in a GUIControl. I.e:

PHP Code:

new GuiControl("Arm_Inventory") { // Assuming it's your inventory...
  
0;
  
0;
  
width 200// You'll probably have to adjust this to fit your GUI...
  
height 200;
  
// pay attention to the use of thiso
  
for (temp.thiso.selected_num2temp.thiso.selected_num2 91temp.++) { 
    
//new GuiShowImgCtrl(); stuff
  
}


Then you can do: Arm_Inventory.clearcontrols();

To destroy all the controls or just hide().

I'm not sure what your original script's purpose is but I feel like it's getting really complicated when it doesn't need to be.

sssssssssss 01-26-2012 06:16 AM

It's just a stupid inventory with tabs in a gui, I think I am making it much worse as well. :/ All on my own though and this is the only way I could think to do it. :x

sssssssssss 01-26-2012 06:18 AM

LOLOLOLOLOLOLOLOLOLOLOLOL

Instead of GraalControl.addcontrol(), it needed windowname.addcontrol() HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaa thanks guys. Man I'm dense when I'm tired.

fowlplay4 01-26-2012 06:23 AM

Quote:

Originally Posted by sssssssssss (Post 1682751)
it needed windowname.addcontrol()

Your snippets didn't indicate there was a 'windowname' object!

For future threads please provide more information about your problem. I.e: Purpose of the code, a general idea of what it does (or is supposed to do).


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

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