Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   TShowImg ? (https://forums.graalonline.com/forums/showthread.php?t=134262639)

PhilSmith 04-01-2011 05:01 AM

TShowImg ?
 
I'm working with an hud system and I'm trying to display the health via hearts (similar to what the normal hud has). My problem is, is that I'm having trouble getting the hearts to show and/or reset when you get hit. I suspect it is the way I am calling the image. I have done a little research and am trying to look into using TShowImg, however, I can't seem to find examples of how to use it. I don't know if it is similar to calling a GUI or calling showimg() or something completely different. I don't want someone to post what MY script should look like, rather an example on how to use TShowImg, and, if I have more questions, we'll go from there. Thx!

fowlplay4 04-01-2011 05:33 AM

It's an internal data-type used by Graal.

I'm fairly sure showimg/findimg objects and GuiShowImgCtrl() inherit it's functionality.

Go GUI if you want the additional functionality of GuiControl, otherwise showimg/findimg will work perfectly fine.

PhilSmith 04-01-2011 06:32 AM

Ive been trying to work with GUI's but I can't get them to update in a timeout.

PHP Code:

function onTimeout(){
  for(
temp.i=0;temp.i<player.heartstemp.i++){
    new 
GUIShowImgControl("PhilSmith_Hearts_"@i){
      
//set the hearts and stuff
    
}
  }
  
setTimer(.05);


Would this work? Is it possible, given the correct values, that the script would just "delete"(not show) an image? Just wondering if you can edit a GUIShowImg() by setting new values to the same name.

fowlplay4 04-01-2011 06:49 AM

The thing about GUIs is that you create them first, then update/edit them later. I.e:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
createGUI();
  
setTimer(0.05);
}

function 
createGUI() {
  for (
temp.0temp.player.fullheartstemp.i++) {
    new 
GuiShowImgCtrl("GUIHearts_" temp.i) {
      
// hearts and stuff
    
}
  }
  
this.lastfullhearts player.fullhearts;
}

function 
onTimeout() {
  
// Check for change in full hearts
  
if (this.lastfullhearts != player.fullhearts) {
    
// Re-create GUI
    
createGUI();
  }
  
// Update hearts
  
for (temp.0temp.player.fullheartstemp.i++) {
    
// Toggle Heart Visibility
    
(@"GUIHearts_" temp.i).visible = (player.hearts >= temp.i);
  }
  
setTimer(0.05);




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

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