Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-16-2011, 05:34 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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...
Reply With Quote
  #2  
Old 03-16-2011, 05:45 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
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)
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #3  
Old 03-16-2011, 05:58 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
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"

__________________
Reply With Quote
  #4  
Old 03-16-2011, 06:10 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by 0PiX0 View Post
You should use a GuiBitmapControl for this.
GuiBitmapControls are for tiled or stretched images. There's no need for them here.
Reply With Quote
  #5  
Old 03-16-2011, 06:23 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Thx guys for your help
Reply With Quote
  #6  
Old 03-16-2011, 06:37 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by Crow View Post
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.
__________________
Reply With Quote
  #7  
Old 03-16-2011, 06:52 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by 0PiX0 View Post
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.
Reply With Quote
  #8  
Old 03-17-2011, 12:36 AM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Well I´m fine with that, what Crow told me but thx for taking care
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:37 AM.


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