Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Another 'my code is optimized?' thread.

Ask for help
Post Reply
nyce
Neophyte
Neophyte
Posts: 17
Joined: 16.06.2016 19:48

Another 'my code is optimized?' thread.

Post by nyce »

Hello, its me again :roll: with another question :lol:

What i plan with this script is drop 1 item for each tile around the character, using max distance allowed (2). 5x5, 25 tiles.

I feel it's taking a bit long to drop all 25, anything i can do to make it faster?

The server i play theres no delay to drop itens into ground.

Code: Select all

Procedure drop;
var x, y, myx, myy, myz : Integer;

begin
  myx := GetX(self);
  myy := GetY(self);
  myz := GetZ(self);
  DropDelay := 0; 
  for x := -2 to 2 do
  begin
    for y := -2 to 2 do
    begin
      FindType($1EBB,Backpack);
      MoveItem(FindItem,1,ground,myx+x,myy+y,myz);
    end;
  end;
end;

begin
  drop;
end.
Last edited by nyce on 29.06.2016 20:25, edited 1 time in total.
nyce
Neophyte
Neophyte
Posts: 17
Joined: 16.06.2016 19:48

Re: Another 'my code is optimized?' thread.

Post by nyce »

any faster way to do this?

need advice.
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Another 'my code is optimized?' thread.

Post by Vizit0r »

nyce wrote:I feel it's taking a bit long to drop all 20, anything i can do to make it faster?
No.
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
Post Reply