Lineage 2 Tower Forum

Full Version: question regarding scripts and proccessing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to know if those two script codes use same proccessor resources or which consume less.

    LUA Programming
GetTargetSave = GetTarget();
		if (GetTargetSave ~= nil) then
			if (GetTargetSave:GetRangeTo(GetMe()) < 600) and (GetTargetSave:GetHp() ~= 0) and (GetTargetSave:IsMyPartyMember()) and (GetMe():GetMp() > 207) then
				if (GetTargetSave:GetHpPercent() < 30) then
					Command("/useskill Panic Heal");
				elseif (GetSkills():FindById(11755):IsSkillAvailable() == true) and (GetTargetSave:GetMaxHp() - GetTargetSave:GetHp() < 3000) and (GetTargetSave:GetHpPercent() < 80) and (GetMe():GetMp() > 138) then
					Command("/useskill Radiant Heal");				
				end;
			end;
		end;




    LUA Programming
if (GetTarget() ~= nil) then
			if (GetTarget():GetRangeTo(GetMe()) < 600) and (GetTarget():GetHp() ~= 0) and (GetTarget():IsMyPartyMember()) and (GetMe():GetMp() > 207) then
				if (GetTarget():GetHpPercent() < 30) then
					Command("/useskill Panic Heal");
				elseif (GetSkills():FindById(11755):IsSkillAvailable() == true) and (GetTarget():GetMaxHp() - GetTarget():GetHp() < 3000) and (GetTarget():GetHpPercent() < 80) and (GetMe():GetMp() > 138) then
					Command("/useskill Radiant Heal");				
				end;
			end;
		end;


the only difference is first one i defiened
GetTargetSave = GetTarget();
does that makes proccess less data?
first one for sure will be faster, but you may not see big difference...

Game, Plugins using same resources, if plugins will be slow then you will see fps drop.
Scripts works on different thread.


But remember, you still have one processor in computer.

GetMe() also save to some var, and set var as "local"..
Call to GetTargetSave:IsMyPartyMember is faster than GetHP, put it first...

This may return nil: GetSkills():FindById(11755)
This GetSkills() creates copy of skills, and operate on it, is very slow, put it at end...
Reference URL's