Shaiya bot

For any other game that doesn't have its own section.
Message
Author
basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#381 Post by basiclight » Sat May 23, 2009 8:38 pm

get this error when i try to exe shaiya.lua

Sat May 23 21:21:52 2009 : Executing script "shaiya.lua".
==================================================

Sat May 23 21:22:04 2009 : findProcessByExe() returned 0. Process not found or other error occured.
Sat May 23 21:22:04 2009 : Error attempting to open process 0x0. Error code: 87 (The parameter is incorrect.).

stack traceback:
C:\Users\ll\Desktop\micromacro\lib\lib.lua:476: in function 'startMacro'
C:\Users\ll\Desktop\micromacro\scripts\shaiya.lua:357: in main chunk

----------TRACEBACK END----------

Sat May 23 21:22:04 2009 : C:\Users\ll\Desktop\micromacro\scripts\shaiya.lua:226: bad argument #1 to 'memoryReadIntPtr' ((null))
Sat May 23 21:22:04 2009 : Execution of shaiya.lua complete.
Sat May 23 21:22:04 2009 : Execution error: Runtime error
Sat May 23 21:22:04 2009 : Collecting garbage...
Sat May 23 21:22:04 2009 : 24KB freed.

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Shaiya bot

#382 Post by Administrator » Sat May 23, 2009 8:58 pm

Looks like you haven't bypassed GameGuard. Fix it.

basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#383 Post by basiclight » Sat May 23, 2009 9:30 pm

your right, i was to fast on on the post sorry to wast your time.

I do one more for you if you got the time, everything working now But for some reason cant get it to use Hp pots have them on bar 1 and 2 slot 8 just like in the config but no luck any idea thanks

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Shaiya bot

#384 Post by Administrator » Sat May 23, 2009 9:39 pm

The offsets probably changed. If I have some time later, I'll update the scripts.

basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#385 Post by basiclight » Sat May 23, 2009 9:40 pm

and again thanks

basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#386 Post by basiclight » Sun May 24, 2009 11:50 am

I see this been going on for some time now
Nasa210 wrote:my guy doesnt uise potions at all... is there something wrong?

Code: Select all

-------------------------------------------------------------------
-------------------------------------------------------------------
-- Title:           Shaiya Bot                                   --
-- Author:          Elverion                                     --
-- Date:            May 29, 2008                                 --
-- Requirements:    MicroMacro v0.97                             --
-- License:         Public Domain                                --
-------------------------------------------------------------------
-------------------------------------------------------------------
-- This script is public domain. You may use it in any way you   --
-- find appropriate without restriction. This includes, but is   --
-- not limited to, modification and distribution, whether it be  --
-- commercial or not.                                            --
-------------------------------------------------------------------
-------------------------------------------------------------------




------------------------------------------------
-- HOTKEYS
------------------------------------------------
startKey = key.VK_INSERT;
stopKey = key.VK_DELETE;

key_switchtarget = key.VK_TILDE;

key_attack  = key.VK_1;
key_pickup  = key.VK_2;

key_skill1  = key.VK_3;
key_skill2  = key.VK_4;
key_skill3  = key.VK_5;

key_buff1   = key.VK_6;
key_buff2   = key.VK_7;

key_hp_potion = key.VK_8;
key_mp_potion = key.VK_9;
key_sp_potion = key.VK_0;

key_sit       = key.VK_C;


------------------------------------------------
-- SKILLS
------------------------------------------------
-- Set to 0 if you don't want to use a skill
skill1_time = secondsToTimer(15);
skill2_time = secondsToTimer(18);
skill3_time = secondsToTimer(20);


------------------------------------------------
-- BUFFS
------------------------------------------------
-- Set a buff to 0 if you don't want to use it
buff1_time = minutesToTimer(5);
buff2_time = minutesToTimer(10);

------------------------------------------------
-- POTIONS
------------------------------------------------
-- All potion use values are specified in %
-- Set the values to 0 to not use that potion
HP_potion_use = 50;
MP_potion_use = 40;
SP_potion_use = 35;


------------------------------------------------
-- SITTING
------------------------------------------------
-- All sitting values are specified in %
-- We will only sit while out of battle
-- Set the values to 0 to not use sitting
HP_sit = 90;
MP_sit = 20;
SP_sit = 10;


--[[*********************************************************************
**************************************************************************
    DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
**************************************************************************
************************************************************************]]

------------------------------------------------
-- Memory addresses
------------------------------------------------
playerptr_addr = 0x00825CB4;

HP_offset = 0x12C; 
MaxHP_offset = 0x130; -- 304
MP_offset = 0x134; --308;
MaxMP_offset = 0x138; --312;
SP_offset = 0x13C; --316;
MaxSP_offset = 0x140; --320;

targetid_addr = 0x006d0bc4; -- short, 65535 if none selected

sitcheck_addr = 0x006E5D40; -- byte, 0 = standing, 7 = sitting


------------------------------------------------
-- Variable setup
------------------------------------------------
HP = 10000;
MaxHP = HP;
MP = 10000;
MaxMP = MP;
SP = 10000;
MaxSP = SP;

skill1_ready = true;
skill2_ready = true;
skill3_ready = true;

buff1_ready = true;
buff2_ready = true;

sittingTempDisabled = false; -- don't change this. it's just temporary.

------------------------------------------------
-- Functions
------------------------------------------------

skill1_toggle = function () skill1_ready = true; end;
skill2_toggle = function () skill2_ready = true; end;
skill3_toggle = function () skill3_ready = true; end;

buff1_toggle = function () buff1_ready = true; end;
buff2_toggle = function () buff2_ready = true; end;


function use_hp_potion()
  keyboardPress(key_hp_potion);
  printf("Using HP potion\n");
end


function use_mp_potion()
  keyboardPress(key_mp_potion);
  printf("Using MP potion\n");
end


function use_sp_potion()
  keyboardPress(key_sp_potion);
  printf("Using SP potion\n");
end

function tempDisableSitting()
  sittingTempDisabled = true;

  registerTimer("reenable_sitting", secondsToTimer(5),
    function () sittingTempDisabled = false unregisterTimer("reenable_sitting") end );
end

function sit()
  if( HP_sit == 0 ) then
    return; end

  printf("Sitting.\n");

  local sitting = false;
  while( sitting == false ) do
    keyboardPress(key_sit);
    yrest(1000);

    sitting = memoryReadByte(proc, sitcheck_addr) ~= 0;
  end

  local lasthp = HP;

  while( true ) do
    if( HP == MaxHP and MP == MaxMP and SP == MaxSP ) then
      switch_target();
      break;
    end

    if( HP < (lasthp - 10) ) then
      printf("Exiting rest...under attack\n");
      tempDisableSitting(); -- so we don't end up sitting right away again
      break;
    else
      lasthp = HP;
    end

    yrest(100);
  end

  sitting = true;
  while( sitting ) do
    keyboardPress(key_sit);
    yrest(1000);

    sitting = memoryReadByte(proc, sitcheck_addr) ~= 0;
  end

  printf("Standing... Resuming bot\n");
  yrest(1000);
end


function pickup()
  printf("Pickup!\n");
  if( key_pickup == 0 ) then return; end

  local i;
  for i = 0, 5 do
    keyboardPress(key_pickup);
    yrest(500);
  end

  yrest(1000);
end


function update_vars()
  HP = memoryReadIntPtr(proc, playerptr_addr, HP_offset);
  MaxHP = memoryReadIntPtr(proc, playerptr_addr, MaxHP_offset);

  MP = memoryReadIntPtr(proc, playerptr_addr, MP_offset);
  MaxMP = memoryReadIntPtr(proc, playerptr_addr, MaxMP_offset);

  SP = memoryReadIntPtr(proc, playerptr_addr, SP_offset);
  MaxSP = memoryReadIntPtr(proc, playerptr_addr, MaxSP_offset);
end


function have_target()
  local readid = memoryReadShort(proc, targetid_addr);

  return ( readid ~= 0xFFFF );
end

function find_target()
  keyboardPress(key_attack);
end

function switch_target()
  keyboardPress(key_switchtarget);
end


------------------------------------------------
-- FIGHT
------------------------------------------------
function fight()
  local beginTime = os.time();
  local attack_ready = true;

  local attack_toggle = function () attack_ready = true; end;
  registerTimer("attack_timer", secondsToTimer(3), attack_toggle); 

  local targetid = memoryReadByte(proc, targetid_addr);
  printf("TARGETID: %d\n", targetid);

  while( have_target() ) do
    local curtarget = memoryReadByte(proc, targetid_addr);
    if( targetid ~= curtarget ) then break; end;

    local currentTime = os.time();
    if( os.difftime(currentTime, beginTime) > 60 ) then -- more than 1 minute has passed
      keyboardPress(key_switchtarget);
      break; -- exit combat
    end

    if( skill1_ready  and skill1_time > 0 ) then
      keyboardPress(key_skill1); skill1_ready = false; yrest(1000);
      registerTimer("skill1_toggle", skill1_time, skill1_toggle);
    end;

    if( skill2_ready and skill2_time > 0) then
      keyboardPress(key_skill2); skill2_ready = false; yrest(1000);
      registerTimer("skill2_toggle", skill2_time, skill2_toggle);
    end;

    if( skill3_ready and skill3_time > 0) then
      keyboardPress(key_skill3); skill3_ready = false; yrest(1000);
      registerTimer("skill3_toggle", skill3_time, skill3_toggle);
    end;

    if( attack_ready ) then
      keyboardPress(key_attack); attack_ready = false; yrest(1000); end;

    if( (HP/MaxHP*100) < HP_potion_use and HP_potion_use > 0 ) then use_hp_potion(); end
    if( (MP/MaxMP*100) < MP_potion_use and MP_potion_use > 0 ) then use_mp_potion(); end
    if( (SP/MaxSP*100) < SP_potion_use and SP_potion_use > 0 ) then use_sp_potion(); end

    if( buff1_ready  and buff1_time > 0 ) then
      keyboardPress(key_buff1); buff1_ready = false; yrest(2000); end;
    if( buff2_ready  and buff2_time > 0 ) then
      keyboardPress(key_buff2); buff2_ready = false; yrest(2000); end;

    yrest(100);
  end

  printf("Target lost.\n");

  unregisterTimer("attack_timer");

  pickup()
end


------------------------------------------------
-- MAIN
------------------------------------------------
function main()
  proc = openProcess(findProcessByExe("game.exe"));
  win = findWindow("Shaiya");
  setPriority(PRIORITY_HIGH);

  registerTimer("update_vars", 100, update_vars);

  if( skill1_time ) then registerTimer("skill1_toggle", skill1_time, skill1_toggle); end
  if( skill2_time ) then registerTimer("skill2_toggle", skill2_time, skill2_toggle); end
  if( skill3_time ) then registerTimer("skill3_toggle", skill3_time, skill3_toggle); end

  if( buff1_time ) then registerTimer("buff1_toggle", buff1_time, buff1_toggle); end;
  if( buff2_time ) then registerTimer("buff2_toggle", buff2_time, buff2_toggle); end;

  while( true ) do
    find_target();

    yrest(200);

    if( have_target() ) then
      fight();
    end

    if( buff1_ready  and buff1_time > 0 ) then
      keyboardPress(key_buff1); buff1_ready = false; yrest(2000); end;
    if( buff2_ready  and buff2_time > 0 ) then
      keyboardPress(key_buff2); buff2_ready = false; yrest(2000); end;

    if( (HP/MaxHP*100) < HP_potion_use and HP_potion_use > 50 ) then use_hp_potion(); end
    if( (MP/MaxMP*100) < MP_potion_use and MP_potion_use > 50 ) then use_mp_potion(); end
    if( (SP/MaxSP*100) < SP_potion_use and SP_potion_use > 50 ) then use_sp_potion(); end

    if( not sittingTempDisabled ) then
      if( (HP/MaxHP*100) < HP_sit and (HP_sit > 0) ) then sit(); end
      if( (MP/MaxMP*100) < MP_sit and (MP_sit > 0) ) then sit(); end
      if( (SP/MaxSP*100) < SP_sit and (SP_sit > 0) ) then sit(); end
    end
    
  end
end

startMacro(main);

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: Shaiya bot

#387 Post by vvayinsane » Sun May 24, 2009 3:26 pm

guys you need to update the bot. Open it up and replace with im going to give you bellow
playerptr_addr = 0x0083DDF4;

HP_offset = 12c;
MaxHP_offset = 130;
MP_offset = 134;
MaxMP_offset = 138;
SP_offset = 13c;
MaxSP_offset = 140;

targetid_addr = 0x002ABFF0; -- short, 65536 if none selected

sitcheck_addr = 0x006FDE90; -- byte, 0 = standing, 7 =
sitting

basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#388 Post by basiclight » Sun May 24, 2009 4:45 pm

Fixed just replace this line playerptr_addr = 0x0083DDF4; not all the other works for me


This came up in yellow

Sun May 24 17:32:41 2009 : C:\Users\ll\Desktop\micromacro\scripts\shaiya.lua:93: malformed number near '12c'
Sun May 24 17:32:41 2009 : Execution of shaiya.lua complete.
Sun May 24 17:32:41 2009 : Execution error: Syntax error
Sun May 24 17:32:41 2009 : Collecting garbage...
Sun May 24 17:32:41 2009 : 32KB freed.

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: Shaiya bot

#389 Post by vvayinsane » Sun May 24, 2009 5:05 pm

sorry thats my bad..
for the offsets make sure the have 0x so
HP_offset = 0x12c;
MaxHP_offset = 0x130;
MP_offset = 0x134;
MaxMP_offset = 0x138;
SP_offset = 0x13c;
MaxSP_offset = 0x140;

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: Shaiya bot

#390 Post by vvayinsane » Sun May 24, 2009 6:15 pm

I saw someone wanted more hp spots so i decited to add them for you.

UPDATED shaiya.lua
Attachments
shaiya.lua
Whats Added
1 more skill spot
2 more buff spots
6 hp spots
2 sp spots
2 mp spots
(13.48 KiB) Downloaded 337 times

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Shaiya bot

#391 Post by Administrator » Sun May 24, 2009 7:51 pm

I went ahead and attached your fix to the original post. I just hope it all works, because I didn't bother to test it.

basiclight
Posts: 9
Joined: Sat May 23, 2009 8:35 pm

Re: Shaiya bot

#392 Post by basiclight » Sun May 24, 2009 9:58 pm

works fine just need to change the % when to use hp mp sp pots other then that works nice
Administrator wrote:I went ahead and attached your fix to the original post. I just hope it all works, because I didn't bother to test it.

shakey
Posts: 56
Joined: Sun Nov 16, 2008 4:02 am

Re: Shaiya bot

#393 Post by shakey » Mon May 25, 2009 4:29 am

Works great until it goes to sit. If it's attacked or otherwise it stands and sits, repeatedly. Otherwise it's fine...Pots well and all that.

vvayinsane
Posts: 148
Joined: Fri Mar 21, 2008 9:10 pm

Re: Shaiya bot

#394 Post by vvayinsane » Mon May 25, 2009 5:09 am

That is my bad..the only thing i didnt check..

sitcheck_addr = 0x0083DDF4

sadow
Posts: 21
Joined: Mon May 25, 2009 10:19 am

Re: Shaiya bot

#395 Post by sadow » Mon May 25, 2009 11:04 am

i got the script working fine and so, but if i have the sit function enabled it attacks the mobs for a while and then starts pressing c c c c and doesnt attack anymore, i tried to set mp sp to 0 so it wouldnt sit when they ran out and hp to 500 but even with 700 hp it starts sitting after a while, when i have sit function disabled it works fine execpt the looting aint perfect either, sometimes it takes some loot but half of the loot stays there, how to make it pickup loot more frequently ?

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Shaiya bot

#396 Post by Administrator » Tue May 26, 2009 11:12 am

sadow wrote:i got the script working fine and so, but if i have the sit function enabled it attacks the mobs for a while and then starts pressing c c c c and doesnt attack anymore, i tried to set mp sp to 0 so it wouldnt sit when they ran out and hp to 500 but even with 700 hp it starts sitting after a while, when i have sit function disabled it works fine execpt the looting aint perfect either, sometimes it takes some loot but half of the loot stays there, how to make it pickup loot more frequently ?

Code: Select all

function pickup()
  printf("Pickup!\n");
  if( key_pickup == 0 ) then return; end

  local i;
  for i = 0, 5 do
    keyboardPress(key_pickup);
    yrest(500);
  end

  yrest(1000);
end
Find that code in shaiya.lua. Change the 5 to something higher to pick up more items.
I'm not sure what the problem with sitting is. I'll check it later.

sadow
Posts: 21
Joined: Mon May 25, 2009 10:19 am

Re: Shaiya bot

#397 Post by sadow » Tue May 26, 2009 12:21 pm

well this bot works pretty fine exect the sitting part, it uses all my buffs and attacks skills well but problem is i will die if i keep the bot up too long, if it would sit to gain full hp and then startover it would run smootly ;P

Stevon
Posts: 2
Joined: Tue May 26, 2009 1:25 pm
Location: Wales, UK

Re: Shaiya bot

#398 Post by Stevon » Tue May 26, 2009 1:36 pm

Hey all :D , thought id help out the community, the sitting problem you all are having is pretty easy to fix, open up shaiya.lua look for the line of code THERE ARE 2 LINES WITH THIS CODE IN THE FILE:

Code: Select all

sitting = memoryReadByte(proc, sitcheck_addr) ~= 0;
and just change it too

Code: Select all

sitting = memoryReadBytePtr(proc, sitcheck_addr, 0xdc) ~= 0;
i am not sure if that is the "proper" way to fix it but works for me. If you are still confuesed about the offsets and whatnot

Code: Select all

playerptr_addr = 0x83DDF4;
HP_offset = 0x12C; 
MaxHP_offset = 0x130; -- 304
MP_offset = 0x134; --308;
MaxMP_offset = 0x138; --312;
SP_offset = 0x13C; --316;
MaxSP_offset = 0x140; --320;

targetid_addr = 0x6E8BE0; -- short, 65535 if none selected

sitcheck_addr = 0x83DDF4; -- byte, 0 = standing, 7 = sitting
these are mine and my bot runs near enough perfectly while i sleep.

Steve

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Shaiya bot

#399 Post by Administrator » Tue May 26, 2009 10:43 pm

Good work, Steve. I have found that changing your sitcheck_addr to 0x6FDE80 also seems to work right without the need of changing any other code.

sadow
Posts: 21
Joined: Mon May 25, 2009 10:19 am

Re: Shaiya bot

#400 Post by sadow » Wed May 27, 2009 9:19 am

for i = 0, 5 do <--- that 5 to 10 or 15... can u explain me what i means, is 5 to pickup loot every 5 sec or what -_-

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests