Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove HUD element
#11
(09-14-2011, 06:57)AZUMIKKEL Wrote: HudLevelName[self.pers["LVL"]-1]

which, let's say, would be

HudLevelName[2] is just a hud element.

When the function is first called, if self.pers["LVL"] is 0, then you would create two elements with index's 0 and 1. Then, in the for loop, you write

PHP Code:
if(ret == "powerup_kill")
{
        
HudLevelName[self.pers["LVL"]-1delete();
        
/* Code snipped */


Wouldn't that reference the -1 index? I don't know if I'm missing something, it's just quite confusing Tongue
Reply

#12
Like OrangePL said, have you tried destroyElem?
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply

#13
self.pers["LVL"] starts at and doesn't go any lower than 1.

I'll try destroyElem when I get home.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#14
Where is 'HudLevelName' declared as an array?

Also, you need to add elements to the array starting at 0, and if 'self.pers["LVL"]' never goes below 1, then this won't happen.
Reply

#15
Also, your code confuses me. First you declare HudLevelValue as a HUDElem (fontstring) and then you try to change the alpha by accessing it like an array? wtf.
It should look like this:
Code:
HudLevelValue.alpha = 1; //Kinda useless anyway, a HUDElem has an alpha of 1 by default

At the start of your code you had this:
I'm assuming that the current value of self.pers["LVL"] at that point is 1.
Code:
HudLevelName[self.pers["LVL"]] = self createFontString( "objective", 3 );
so really, it's this:
Code:
HudLevelName[1] = self createFontString( "objective", 3 );

Then you try to execute this.
Code:
HudLevelName[self.pers["LVL"]-1] delete();
which really is this:
Code:
HudLevelName[0] delete();

The reason it probably has a lag spike is because HudLevelName[0] is never declared.... Bad usage of arrays is bad. I don't even see where self.pers["LVL"] is incremented or anything...

Also this:
Code:
if(isDefined(HudLevelName[self.pers["LVL"+1]])) //Bad syntax, probably will try to access self.pers["LVL1"]

----

If you could let me see the mod I could probably help but otherwise there's not enough code there to give an accurate fix.
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
Reply

#16
(09-14-2011, 11:43)master131 Wrote: Also, your code confuses me. First you declare HudLevelValue as a HUDElem (fontstring) and then you try to change the alpha by accessing it like an array? wtf.
It should look like this:
Code:
HudLevelValue.alpha = 1; //Kinda useless anyway, a HUDElem has an alpha of 1 by default

At the start of your code you had this:
I'm assuming that the current value of self.pers["LVL"] at that point is 1.
Code:
HudLevelName[self.pers["LVL"]] = self createFontString( "objective", 3 );
so really, it's this:
Code:
HudLevelName[1] = self createFontString( "objective", 3 );

Then you try to execute this.
Code:
HudLevelName[self.pers["LVL"]-1] delete();
which really is this:
Code:
HudLevelName[0] delete();

The reason it probably has a lag spike is because HudLevelName[0] is never declared.... Bad usage of arrays is bad. I don't even see where self.pers["LVL"] is incremented or anything...

Also this:
Code:
if(isDefined(HudLevelName[self.pers["LVL"+1]])) //Bad syntax, probably will try to access self.pers["LVL1"]

----

If you could let me see the mod I could probably help but otherwise there's not enough code there to give an accurate fix.

HudLevelName[self.pers["LVL"]] is a HUD element
HudLevelName[self.pers["LVL"]].alpha is changing the .alpha of the HUD element
I don't want to change the settings or delete every HUD element in the array, so
HudLevelName.alpha is BAD.
HudLevelName[self.pers["LVL"]-1] delete(); will never be called if the level is not above 1.


Meh.
If you can't make HUD elements with an array, I'll just go spend a couple more hours on coding a new HUD Fuu
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#17
have you tried destroyelem?
[Image: lQDUjba.jpg]
Reply

#18
(09-14-2011, 15:28)OrangePL Wrote: have you tried destroyelem?

Causes spike too.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#19
WHAT IS THIS BULL?

http://pastebin.com/Tvn2cRBL
ctrl+f for *tag*
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#20
From line 22 - 26, change: "HudLevelName[self.pers["LVL"]]" to "HudLevelName"
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it safe exactly when i remove the battery from the laptop? checkitnowa 2 3,164 09-13-2013, 08:15
Last Post: CJGreenLabel
  Help remove timer Dynasty 15 8,305 08-25-2013, 13:56
Last Post: hillbilly
  how to remove commands in the chat ExoGamer* 6 4,449 07-20-2013, 09:24
Last Post: Pozzuh
  Help Remove Death Barriers? Help Please! camxxcore 1 2,563 06-28-2013, 09:38
Last Post: Yamato
  Help threading remove EnVi Sweden Rocks 3 3,272 01-28-2013, 15:26
Last Post: JariZ
Sad Help - HUD element Crash Server ((( xtreme2010 4 3,869 01-20-2013, 09:22
Last Post: archit
  Help Remove Threading/tidyup hillbilly 4 4,587 09-16-2012, 11:09
Last Post: zxz0O0
  [Request] plugin to remove all secondary ammo ALEXFDR 1 2,360 09-08-2012, 23:32
Last Post: Nekochan
  Remove mini map moosa67 2 2,598 08-22-2012, 21:26
Last Post: Nukem
  how to remove the boot dlc Beliy.IV 0 1,878 07-02-2012, 18:16
Last Post: Beliy.IV

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.