Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Showimg HUD, possible V6 beta bug? (https://forums.graalonline.com/forums/showthread.php?t=134262373)

AlexanderK 03-10-2011 03:50 PM

Showimg HUD, possible V6 beta bug?
 
1 Attachment(s)
I just downloaded the new V6 beta and my hud is messed up.
This is my script:
PHP Code:

//FULLHEARTS

  
if (!this.heartsfirstdisplayed || this.maxhearts != clientr.maxhearts) {
    
hideimgs(1100, 1299);
    for (
i = 0; i < clientr.maxhearts; i++) {
      
showimg(1100 + i, "sorna_hud_heart_background.png", 64 + 110 + 18 * i, 12);
      
changeimgvis(1100 + i, 5);

      
showimg(1200 + i, "sorna_hud_heart.png", 64 + 110 + 18 * i + 1, 12);
      
changeimgvis(1200 + i, 5);
    }
    
this.maxhearts = clientr.maxhearts;
    
this.hearts = clientr.maxhearts + 1;
    
this.heartsfirstdisplayed = true;
  }

  
//HEARTS

  
if (this.hearts != clientr.hearts) {
    for (
i = 0;i < clientr.maxhearts; i++) {
      if (
clientr.hearts > i) {
        
findimg(1200 + i).image = "sorna_hud_heart.png";
        
findimg(1200 + i).alpha = 1;
        if (
i > clientr.hearts - 1)
          switch (
clientr.hearts % 1) {
            case 
0:
              
findimg(1200 + i).image = "sorna_hud_heart.png";
              break;
            case 
0.25:
              
findimg(1200 + i).image = "sorna_hud_heart_quarter.png";
              break;
            case 
0.5:
              
findimg(1200 + i).image = "sorna_hud_heart_half.png";
              break;
            case 
0.75:
              
findimg(1200 + i).image = "sorna_hud_heart_threequarters.png";
              break;
          }

      } else {
        
findimg(1200 + i).alpha = 0;
      }
    }
    
this.hearts = clientr.hearts;
  } 

There are always some extra hearts displayed next to the actual hearts and I have no idea why. On V5 it works fine and I think it did on the last beta too.

Also somehow my ALT+2 is messed up and everything is blue. :/

oo_jazz_oo 03-10-2011 10:48 PM

Smurf Server? o.o

xAndrewx 03-10-2011 11:17 PM

Why are you using images over index 1000? Over 200 is clientside anyway

Admins 03-10-2011 11:29 PM

I remember that setting the alpha of showimgs to zero is not necessary making it hide, but it was the same in v5.

AlexanderK 03-11-2011 12:17 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1635666)
Smurf Server? o.o

See my original post:
Quote:

Originally Posted by AlexanderK (Post 1635576)
Also somehow my ALT+2 is messed up and everything is blue. :/

This is the possible V6 bug I mention in the title. The colors of screenshots I make with ALT+2 are messed up.
Quote:

Originally Posted by xAndrewx (Post 1635670)
Why are you using images over index 1000? Over 200 is clientside anyway

I just picked the indexes at random, but that doesn't cause the problem, I just temporaryly replaced them and it was still the same.

Quote:

Originally Posted by Stefan (Post 1635675)
I remember that setting the alpha of showimgs to zero is not necessary making it hide, but it was the same in v5.

I just replaced the alpha-part with hideimg and showimg and it still doesn't work.




I still don't understand this at all. It works fine for me in V5, it worked fine for me in the last beta.
Displaying mana uses the exact same script, only a little lower, with higher indexes and different variables and images and it works fine too.

It just doesn't make sense that there are 3 extra images displayed.
If I put hideimgs(1200,1202); behind the code I posted above, all the heart images disappear, so it seems like the extra images are somehow displayed within the showimgs? I don't get it. :(

Deas_Voice 03-11-2011 12:24 AM

Quote:

Originally Posted by AlexanderK (Post 1635689)
It just doesn't make sense that there are 3 extra images displayed.
If I put hideimgs(1200,1202); behind the code I posted above, all the heart images disappear, so it seems like the extra images are somehow displayed within the showimgs? I don't get it. :(


i think of it like this, hideimgs(from, to);

so, if i had showimg's at 200, 201, 203, 204, putting (201,203) would hide the index'es 201, 202 and 203

AlexanderK 03-11-2011 12:59 AM

Quote:

Originally Posted by Deas_Voice (Post 1635690)
i think of it like this, hideimgs(from, to);

so, if i had showimg's at 200, 201, 203, 204, putting (201,203) would hide the index'es 201, 202 and 203

I know that. And I'm not confused about hideimgs(). I only mentioned that here to emphasise my problem.
The images I want displayed have the indexes 1200,1201,1202. But somehow, within these TShowImgs are 3 extra images that shouldn't be there. Check the attachment in my original post, next to the three heart images in the hud, that are supposed to be there, there are 3 extra ones.

It's frustrating how none of the posts in this thread seem to respond to my problem.

callimuc 03-11-2011 03:34 AM

Well I checked the server (I´m running v5) and also have the same with the extra hearts, but at mine everything got the original color (no blue effect). So I don´t think the problem is on v6 with the hearts.

fowlplay4 03-11-2011 04:27 AM

I would try using a variable other than "this.hearts" it may be getting messed around with by the engine.

Try this:

PHP Code:

//#CLIENTSIDE

function drawHearts() {
  if (
clientr.maxhearts != this.lastmaxhearts) {
    
hideimgs(1100, 1230);
    for (
temp.i = 0; temp.i < clientr.maxhearts; temp.i++) {
      
with (findimg(1100 + temp.i)) {
        
x = 64 + 110 + 18 * temp.i + 1;
        
y = 12;
        
layer = 5;
        
image = "sorna_hud_heart_background.png";
      }
    }
    
this.lastmaxhearts = clientr.maxhearts;
    
updateHearts(true);
  } else {
    
updateHearts();
  } 
}

function 
updateHearts(force) {
  if (
clientr.hearts != this.lasthearts || force) {
    
hideimgs(1200, 1230);
    for (
temp.i = 0; temp.i < clientr.hearts; temp.i++) {
      if ((
temp.i+1) > clientr.hearts) {
        
temp.heartpart = temp.i % 1;
      } else {
        
temp.heartpart = 0;
      }
      
with (findimg(1200 + temp.i)) {
        
x = 64 + 110 + 18 * temp.i + 1;
        
y = 12;
        
layer = 6;
        switch (
temp.heartpart) {
          case    
0: image = "sorna_hud_heart.png"; break;
          case 
0.25: image = "sorna_hud_heart_quarter.png"; break;
          case 
0.50: image = "sorna_hud_heart_half.png"; break;
          case 
0.75: image = "sorna_hud_heart_threequarters.png"; break;
        }
      }
    }
    
this.lasthearts = clientr.hearts;
  }  
} 


AlexanderK 03-11-2011 11:25 AM

It's working now, thanks!


All times are GMT +2. The time now is 08:35 PM.

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