Author Topic: Using Blockland's energy system in functions other than Jump, Run and Jet?  (Read 668 times)

Hello guys, Once again I need your help. How do I use the energy system of blockland efficently?
I tried looking at Agile Player's code, but it was absolute ew, so now I'm asking you guys.
I tried If check for getEnergyLevel and setting %this.setEnergyLevel( %this.getEnergyLevel - 5 ) but it didn't work. Any ideas why?
By the way, console returns no errors and the functions with energy stuff won't run. It thinks there's not enough energy or something :V

not sure if getEnergyLevel() is a function or not, but this may be your issue:
%this.setEnergyLevel( %this.getEnergyLevel() - 5 );

Edit: Just to clarify, you must use parentheses after a function's name even if you don't need to define any more variables.

The engine will read %client.getEnergyLevel() as a function, however, it will read %client.getEnergylevel (lacking parentheses) as a variable stored on %client.
« Last Edit: July 30, 2012, 04:50:40 AM by Wheatley »

not sure if getEnergyLevel() is a function or not, but this may be your issue:
Edit: Just to clarify, you must use parentheses after a function's name even if you don't need to define any more variables.

The engine will read %client.getEnergyLevel() as a function, however, it will read %client.getEnergylevel (lacking parentheses) as a variable stored on %client.
Well, I added ()'s, but it still won't work. No console errors as well. Here's my code:
Code: [Select]
if ( %this.GetEnergyLevel < 10 )
{
return;
}
*stuff*
%this.SetEnergyLevel( %this.GetEnergyLevel() - 10 );

Well, I added ()'s, but it still won't work. No console errors as well. Here's my code:
Code: [Select]
if ( %this.GetEnergyLevel < 10 )
{
return;
}
*stuff*
%this.SetEnergyLevel( %this.GetEnergyLevel() - 10 );


You still have %this.getEnergyLevel. Take your time and review your code.

You still have %this.getEnergyLevel. Take your time and review your code.
Holy stuff I fixed it!
Huge thanks to you and Wheatley! I knew it had something to do with if check: I missed ()'s there.
Locking because problem solved.
Unlocking because I have been told I should not lock coding topics. V:
« Last Edit: July 31, 2012, 04:19:25 AM by Crystalwarrior »