Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Show the weapon´s image? (https://forums.graalonline.com/forums/showthread.php?t=134262431)

callimuc 03-16-2011 05:34 PM

Show the weapon´s image?
 
Hey there.
I´m trying to make an own Inventory, and got sticked at one part. How could I let a GUI show the image of the selected weapon?
This are parts I got:
The GUI part of the Inventory_Weapon_Image:
PHP Code:

new GuiShowImgCtrl("Inventory_Weapon_Image") {
  
305;
  
54;
  
width 32;
  
height 32;
  
image "block.png";


When I press one Item at the lister:
PHP Code:

function Inventory_WeaponList.onMouseDown() {
  
temp.selected Inventory_WeaponList.getSelectedText();
  
Inventory_Weapon_Image.image findweapon(temp.selected).this.image;


And something added in the weapon:
PHP Code:

function onCreated() {
  
this.image "bomb.png";


The result is that I just get a big 0...

Deas_Voice 03-16-2011 05:45 PM

ahh, u almost got it.

PHP Code:

findweapon(temp.selected).image// without the "this." part 

"this" in a weapon, is the weapon object (this.name would be the name of the weapon),
and "findweapon()" is the weapon object (findweapon().name would be the name of the weapon)

0PiX0 03-16-2011 05:58 PM

You should use a GuiBitmapControl for this.
PHP Code:

new GuiBitmapCtrl("Inventory_Weapon_Image") { 
  
305
  
54
  
width 32
  
height 32
  
bitmap "block.png"


PHP Code:

function Inventory_WeaponList.onMouseDown() { 
  
temp.selectedtxt Inventory_WeaponList.getSelectedText(); 
  
temp.imagestring = (@temp.selectedtxt).weaponimage;
  
Inventory_Weapon_Image.setbitmap(temp.imagestring); 


PHP Code:

function onCreated() { 
  
this.weaponimage "bomb.png"



Crow 03-16-2011 06:10 PM

Quote:

Originally Posted by 0PiX0 (Post 1636757)
You should use a GuiBitmapControl for this.

GuiBitmapControls are for tiled or stretched images. There's no need for them here.

callimuc 03-16-2011 06:23 PM

Thx guys for your help :)

0PiX0 03-16-2011 06:37 PM

Quote:

Originally Posted by Crow (Post 1636758)
GuiBitmapControls are for tiled or stretched images. There's no need for them here.

I don't see why a GuiBitmapCtrl shouldn't be used. If his weapon icon is 32x32 it will neither be tiled nor stretched. A GuiShowImgCtrl holds an entire TShowImg object, while the bitmap control simply draws the specified image.

Crow 03-16-2011 06:52 PM

Quote:

Originally Posted by 0PiX0 (Post 1636762)
I don't see why a GuiBitmapCtrl shouldn't be used. If his weapon icon is 32x32 it will neither be tiled nor stretched. A GuiShowImgCtrl holds an entire TShowImg object, while the bitmap control simply draws the specified image.

It's not like that makes any difference. If you want to go that way, tell him to use showimg() instead because all controls inherit the GuiControl object.

callimuc 03-17-2011 12:36 AM

Well I´m fine with that, what Crow told me :) but thx for taking care


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

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