L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Thread Closed 
 
Thread Rating:
  • 20 Vote(s) - 2.6 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question regarding scripts and proccessing
Author Message
amiroooo Offline
Beta Tester

Posts: 1,270
Joined: Sep 2011
Reputation: 412
Version: 1.4.2.142
Post: #1
question regarding scripts and proccessing

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?
12-31-2011 21:13 PM
Find all posts by this user
ClockMan Offline
All Mighty
*******

Posts: 2,886
Joined: Jan 2011
Reputation: 499
Version: 1.4.3.143
Post: #2
RE: question regarding scripts and proccessing

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...

[Image: owner.gif]
12-31-2011 23:08 PM
Visit this user's website Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  L2 Dragon question about bot, working or not kaan22747 0 2,809 02-15-2017 21:10 PM
Last Post: kaan22747
  Question about bot kiciulica66 0 1,949 12-03-2016 01:00 AM
Last Post: kiciulica66
F.A.Q. Sources question teris19942 1 2,812 06-04-2016 02:41 AM
Last Post: gamias1
Rainbow Solo iss+summoner scripts combo welkinds 119 255,532 12-09-2015 02:18 AM
Last Post: redline10
  Multi-Box software question.. plixplox 3 3,464 11-19-2015 23:17 PM
Last Post: valakas123
  Premium+scripts questions krums 13 8,835 07-10-2015 08:19 AM
Last Post: TheQQmaster
  WTB Auto accept mail scripts or plugins king200527 0 2,385 07-07-2015 11:39 AM
Last Post: king200527
F.A.Q. Question (??) budarox 0 2,063 07-04-2015 07:49 AM
Last Post: budarox
  newbie question vipernestas 2 3,283 04-29-2015 16:35 PM
Last Post: tsounakas
  Start and Stop Scripts benbt91 4 5,132 03-20-2015 14:05 PM
Last Post: kerberos464



User(s) browsing this thread: