[HELP]Fiestabot

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

[HELP]Fiestabot

#1 Post by blub » Fri Jan 11, 2008 7:39 pm

Hey first of all thank you for all your work and help!
So now to my problem, I searched and read all of the topics had lots of problems but fixed that... Now I got a new strange problem. Every time I start the bot, nothing happens for a sec than it says scroll used... than nothing happens at all.
I took a screenshot maybe that helps dunno :X
And yes ive ran admin... comp...
windowmode, right resolution etc... ^^


http://img161.imageshack.us/img161/7928/problemqu5.jpg

------------------
System Information
------------------
Operating System: Windows Vistaâ„¢ Home Premium
Language: English (Regional Setting: English)
System Manufacturer: alienware
System Model: alienware
BIOS: )Phoenix - Award WorkstationBIOS v6.00PG
Processor: AMD Athlon(tm) 64 X2 Dual Core Processor 5600+ (2 CPUs), ~2.8GHz
Memory: 2046MB RAM
Page File: 1869MB used, 2443MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 10
DX Setup Parameters: Not found
DxDiag Version: 6.00.6000.16386 32bit Unicode


Here My log.txt

Fri Jan 11 19:22:42 2008 : MicroMacro v0.95
Fri Jan 11 19:22:42 2008 : Processor Type: 2X 586, OS: Windows XP Service Pack 2
Fri Jan 11 19:22:42 2008 : Lua initialized successfully.
Fri Jan 11 19:22:42 2008 : Lua libs opened successfully.
Fri Jan 11 19:22:42 2008 : Lua glues exported.
Fri Jan 11 19:22:42 2008 : Configurations run.
Fri Jan 11 19:22:45 2008 : Executing script "fiestabot.lua".
==================================================


Here my fiestabot.lua

-- Credits:
-- A. M. "MystikFox"
-- "Mangler"

-------------------------
-- do NOT edit these!!
CLASS_KNIGHT = 0;
CLASS_CLERIC = 1;
CLASS_MAGE = 2;
CLASS_ARCHER = 3;


-- EDIT THESE!
-------------------------
class = CLASS_ARCHER; -- class determins the logic to take
HP_restamt = 150; -- HP to rest at (not used for cleric's)
HP_potion = 150; -- Use a HP potion (or heal skill for cleric)
HP_stone = 90; -- Use a HP stone
SP_restamt = 30; -- SP to rest at
SP_potion = 50; -- Use a SP potion
SP_stone = 60; -- Usa a SP stone


key_attack = key.VK_1; -- normal melee attack
key_pickup = key.VK_2; -- pickup items
key_skill1 = key.VK_5; -- offensive and defensive spells...
key_skill2 = key.VK_6; -- check your class's fight function
key_skill3 = key.VK_7; -- for documentation on what each skill
key_skill4 = key.VK_8; -- will be used for

key_scroll1 = key.VK_9; -- offensive and defensive spells...
key_scroll2 = key.VK_0; -- check your class's fight function
key_scroll3 = key.VK_DASH; -- for documentation on what each skill
key_scroll4 = key.VK_EQUAL; -- will be used for

key_hppotion = key.VK_3; -- CLERICS: map this to your heal spell
key_hpstone = key.VK_Q;
key_sppotion = key.VK_4;
key_spstone = key.VK_E;

-- NOTE: if SP_potion is higher than SP_restatm, you will use SP potions
-- instead of resting, unless you do not have any left. same goes for HP potions.
-- you will always use potions while fighting if the values fall below
-- the emergency amount.
-------------------------




-- Scroll settings (read instructions below Buff settings first)
-------------------------
scroll1_duration = 3500000;
scroll_1 = 1;
scroll2_duration = 3500000;
scroll_2 = 1;
scroll3_duration = 3500000;
scroll_3 = 0;
scroll4_duration = 3500000;
scroll_4 = 0;
-------------------------


-- Buff settings (only for clerics)
-------------------------
buff1_duration = 3500000;
buff_1 = 1;
buff2_duration = 3500000;
buff_2 = 1;
buff3_duration = 3500000;
buff_3 = 0;
buff4_duration = 3500000;
buff_4 = 0;

-- NOTE: set on 59 minutes
-- buff / scroll durations in msec time = minutes x 60000
-- to de- activate non used buffs / scrolls replace "1" with "0"
-- to activate buff / scroll replace "0" with "1"
-- scrolls can be used too as buff
-------------------------






-- should not need to be changed, except for HP_addr/SP_addr when
-- a patch makes them no longer work
proc = 0;
win = 0;
HP_addr = "00758FE7";
SP_addr = "00758FEB";
restcheck_addr = "01F66B04";
HP = 10000; -- default, this corrects itself (don't change it!)
SP = 10000; -- default, this corrects itself (don't change it!)
buff1_needed = true;
buff2_needed = true;
buff3_needed = true;
buff4_needed = true;
scroll1_needed = true;
scroll2_needed = true;
scroll3_needed = true;
scroll4_needed = true;
need_heal = false;
can_rest = true;
-------------------------


function fight_timer()
keyboardHold(key_attack);
yrest(50);
keyboardRelease(key_attack);
end



-- fighting functions
-----------------------------------------------------
-- fight as a knight
function knight_fight()
-- skill1 : offensive skill
-- skill2 : offensive skill
-- skill3 : offensive skill
-- skill4 : offensive skill

keyboardHold(key_attack);
yrest(50);
keyboardRelease(key_attack);

registerTimer("fight_timer", 3000, fight_timer);
while(have_target()) do
if( HP < HP_potion) then hp_potion(); end
if( HP < HP_stone) then hp_stone(); end
if( SP < SP_potion) then sp_potion(); end
if( SP < SP_stone) then hp_stone(); end

keyboardHold(key_attack);
yrest(50);
keyboardRelease(key_attack);

if( math.random(100) > 92 ) then
if( math.random(100) >= 50 ) then
keyboardHold(key_skill1);
yrest(50);
keyboardRelease(key_skill1);
else
keyboardHold(key_skill2);
yrest(50);
keyboardRelease(key_skill2);
end
end

yrest(200);
end
unregisterTimer("fight_timer");

for i = 0,8 do
pickup();
yrest(50);
end

can_rest = false;
registerTimer("can_rest_timer", 3000, can_rest_timer);

end

-- fight function for cleric
function cleric_fight()
-- skill1 : buff 1
-- skill2 : buff 2
-- skill3 : buff 3
-- skill4 : buff 4

keyboardHold(key_attack);
yrest(50);
keyboardRelease(key_attack);

registerTimer("fight_timer", 3000, fight_timer);
while(have_target()) do
if( HP < HP_potion) then hp_potion(); end
if( HP < HP_stone) then hp_stone(); end
if( SP < SP_potion) then sp_potion(); end
if( SP < SP_stone) then sp_stone(); end

yrest(100);
end
unregisterTimer("fight_timer");

for i = 0,8 do
pickup();
yrest(50);
end

can_rest = false;
registerTimer("can_rest_timer", 3000, can_rest_timer);
end

-- fight as a mage
function mage_fight()
-- skill1 : offensive spell
-- skill2 : offensive spell
-- skill3 : offensive spell
-- skill4 : offensive spell

while(have_target()) do
if( HP < HP_potion) then hp_potion(); end
if( HP < HP_stone) then hp_stone(); end
if( SP <SP_potion) then sp_potion(); end
if( SP < SP_stone) then hp_stone(); end

keyboardHold(key_skill1);
yrest(200);
keyboardRelease(key_skill1);

yrest(100);

keyboardHold(key_skill2);
yrest(200);
keyboardRelease(key_skill2);

yrest(100);

keyboardHold(key_skill3);
yrest(200);
keyboardRelease(key_skill3);

yrest(100);
end

for i = 0,8 do
pickup();
yrest(50);
end

can_rest = false;
registerTimer("can_rest_timer", 3000, can_rest_timer);
end


-- fight as an archer
function archer_fight()
-- skill1 : DOT / offensive skill (entry attack)
-- skill2 : DOT / offensive skill (entry attack)
-- skill3 : offensive skill
-- skill4 : offensive skill

-- entry skill
if( math.random(100) >= 50 ) then
keyboardHold(key_skill1);
yrest(50);
keyboardRelease(key_skill1);
else
keyboardHold(key_skill2);
yrest(50);
keyboardRelease(key_skill2);
end
yrest(500);

keyboardHold(key_attack);
yrest(50);
keyboardRelease(key_attack);

registerTimer("fight_timer", 3000, fight_timer);
while(have_target()) do
if( HP < HP_potion) then hp_potion(); end
if( HP < HP_stone) then hp_stone(); end
if( SP < SP_potion) then sp_potion(); end
if( SP < SP_stone) then hp_stone(); end

--keyboardHold(key_attack);
--yrest(50);
--keyboardRelease(key_attack);

if( math.random(100) > 80 ) then
if( math.random(100) >= 50 ) then
keyboardHold(key_skill2);
yrest(50);
keyboardRelease(key_skill2);
else
keyboardHold(key_skill3);
yrest(50);
keyboardRelease(key_skill3);
end
yrest(200);
end

yrest(200);
end
unregisterTimer("fight_timer");

for i = 0,8 do
pickup();
yrest(100);
end

can_rest = false;
registerTimer("can_rest_timer", 3000, can_rest_timer);
end
-----------------------------------------------------





-- toggle cast needed for buff1
function buff1_timer()
buff1_needed = true;
end

-- toggle cast needed for buff2
function buff2_timer()
buff2_needed = true;
end

-- toggle cast needed for buff3
function buff3_timer()
buff3_needed = true;
end

-- toggle cast needed for buff4
function buff4_timer()
buff4_needed = true;
end

-- toggle cast needed for scroll1
function scroll1_timer()
scroll1_needed = true;
end

-- toggle cast needed for scroll2
function scroll2_timer()
scroll2_needed = true;
end

-- toggle cast needed for scroll3
function scroll3_timer()
scroll3_needed = true;
end

-- toggle cast needed for scroll4
function scroll4_timer()
scroll4_needed = true;
end


-- you have died! oh noes!
function death_return()
keyboardPress(key.VK_SNAPSHOT);
print(os.date("Looks like somebody got you killed. %X"))
print("A screen capture has been taken. Open MS Paint and paste it.");
stopPE(); -- this turns the macro off!
coroutine.yield(); -- yield to make sure the protected environment stops
end

-- moves forward a bit...makes you seem less bot-like.
-- allows you to cover more ground
function move_forward()
keyboardHold(key.VK_W);
if( math.random(100) >= 80 )
then keyboardHold(key.VK_A);
else if( math.random(100) >= 80 )
then keyboardHold(key.VK_D); end
end

yrest( math.random(2000) );

keyboardRelease(key.VK_W);
keyboardRelease(key.VK_A);
keyboardRelease(key.VK_D);
end


-- rotate camera
function rotate_cam()
wx,wy = windowRect(win);

mouseSet(wx+512, wy+384);
yrest(100);
mouseRHold();
yrest(100);
mouseSet(wx+514, wy+384);
yrest(100);
mouseRRelease();
yrest(100);
end

-- pickup nearby items
function pickup()
keyboardHold(key_pickup);
yrest(50);
keyboardRelease(key_pickup);
yrest(50);
end

-- selects a nearby monster
function target_monster()
keyboardHold(key.VK_TAB);
yrest(50);
keyboardRelease(key.VK_TAB);
end

-- checks if you have a target
function have_target()
r,g,b = getPixel(hdc, 540, 1);

-- check for the gray in the monster's HP window
if( r >= 229 and r <= 240 and g >= 245 and g <= 255 and b >= 250 ) then
return true;
else
return false;
end
end

-- updates variables from client
function update_vars()
HP = memoryReadInt(proc, HP_addr);
SP = memoryReadInt(proc, SP_addr);
end


-- toggle can_heal to true, disable timer
function can_rest_timer()
unregisterTimer("can_rest_timer");
can_rest = true;
end

-- tell heal_rest we no longer need rest
function heal_rest_timer()
need_heal = false;
end

-- rest untill healed
function rest_heal()
if( can_rest == false ) then return; end

printf("Entering rest state\t%s\n", os.date("%X"));

keyboardHold(key.VK_HOME);
yrest(500);
keyboardRelease(key.VK_HOME);

-- set a timer to toggle healing in 30 seconds
registerTimer("heal_rest_timer", 30000, heal_rest_timer);

need_heal = true;
last_hp = HP;
while( need_heal ) do
yrest(100);
if (HP < last_hp) then
print("Under attack! Exiting rest.");
can_rest = false;
registerTimer("can_rest_timer", 3000, can_rest_timer);
break;
else
last_hp = HP;
end
end

while( 1 ) do
keyboardHold(key.VK_HOME);
yrest(500);
keyboardRelease(key.VK_HOME);

yrest(500);
local val = memoryReadByte(proc, restcheck_addr);
printf("Rest check val: %d\n", val);

if( val ~= 1 ) then -- 1 = resting, 2 = standing
break; end; -- so if not resting, exit
end

printf("Exiting rest state\t%s\n", os.date("%X"));
end

-- use a hp potion!
function hp_potion()
keyboardHold(key_hppotion);
yrest(100);
keyboardRelease(key_hppotion);

yrest(500);
end

-- use a hp stone!
function hp_stone()
keyboardHold(key_hpstone);
yrest(100);
keyboardRelease(key_hpstone);
print("HP stone used.")

yrest(500);
end

-- use a sp potion!
function sp_potion()
keyboardHold(key_sppotion);
yrest(100);
keyboardRelease(key_sppotion);

yrest(500);
end

-- use a sp stone!
function sp_stone()
keyboardHold(key_spstone);
yrest(100);
keyboardRelease(key_spstone);
print("SP stone used.")

yrest(500);
end








function main()
win = findWindow("FiestaOnline");
hdc = openDC(win);
proc = openProcess( findProcess("FiestaOnline") );
attach(win);

registerTimer("update_vars", 100, update_vars);

if( class == CLASS_CLERIC ) then
registerTimer("buff1_timer", buff1_duration, buff1_timer);
registerTimer("buff2_timer", buff2_duration, buff2_timer);
registerTimer("buff3_timer", buff3_duration, buff3_timer);
registerTimer("buff4_timer", buff4_duration, buff4_timer);
end

registerTimer("scroll1_timer", scroll1_duration, scroll1_timer);
registerTimer("scroll2_timer", scroll2_duration, scroll2_timer);
registerTimer("scroll3_timer", scroll3_duration, scroll3_timer);
registerTimer("scroll4_timer", scroll4_duration, scroll4_timer);

while( 1 ) do
if( HP == 0 ) then death_return(); end
if( HP < HP_potion ) then hp_potion(); end
if( HP < HP_stone ) then hp_stone(); end
if( SP < SP_potion ) then sp_potion(); end
if( SP < SP_stone ) then sp_stone(); end
if( HP < HP_restamt and can_rest == true ) then rest_heal(); end
if( SP < SP_restamt and can_rest == true ) then rest_heal(); end

yrest(100);

target_monster();
yrest(200);
if( have_target() ) then
can_rest = false; -- prevent resting during battle
-- for the few that have this bug
if( class == CLASS_KNIGHT ) then knight_fight(); end
if( class == CLASS_CLERIC ) then cleric_fight(); end
if( class == CLASS_MAGE ) then mage_fight(); end
if( class == CLASS_ARCHER ) then archer_fight(); end
can_rest = true;
else


-- cleric only logic
if( class == CLASS_CLERIC ) then
if( buff_1 == 1 ) then
if( buff1_needed ) then
keyboardHold(key_skill1);
yrest(100);
keyboardRelease(key_skill1);
print(os.date("buff 1 casted %X"))
buff1_needed = false;
yrest(2000);
end
end

if( buff_2 == 1 ) then
if( buff2_needed ) then
keyboardHold(key_skill2);
yrest(100);
keyboardRelease(key_skill2);
print(os.date("buff 2 casted %X"))
buff2_needed = false;
yrest(2000);
end
end

if( buff_3 == 1 ) then
if( buff3_needed ) then
keyboardHold(key_skill3);
yrest(100);
keyboardRelease(key_skill3);
print(os.date("buff 3 casted %X"))
buff3_needed = false;
yrest(2000);
end
end

if( buff_4 == 1 ) then
if( buff4_needed ) then
keyboardHold(key_skill4);
yrest(100);
keyboardRelease(key_skill4);
print(os.date("buff 4 casted %X"))
buff4_needed = false;
yrest(2000);
end
end
end

if( scroll_1 == 1 ) then
if( scroll1_needed ) then
keyboardHold(key_scroll1);
yrest(100);
keyboardRelease(key_scroll1);
print(os.date("scroll 1 used %X"))
scroll1_needed = false;
yrest(3200);
end
end

if( scroll_2 == 1 ) then
if( scroll2_needed ) then
keyboardHold(key_scroll2);
yrest(100);
keyboardRelease(key_scroll2);
print(os.date("scroll 2 used %X"))
scroll2_needed = false;
yrest(3200);
end
end

if( scroll_3 == 1 ) then
if( scroll3_needed ) then
keyboardHold(key_scroll3);
yrest(100);
keyboardRelease(key_scroll3);
print(os.date("scroll 3 used %X"))
scroll3_needed = false;
yrest(3200);
end
end

if( scroll_4 == 1 ) then
if( scroll4_needed ) then
keyboardHold(key_scroll4);
yrest(100);
keyboardRelease(key_scroll4);
print(os.date("scroll 4 used %X"))
scroll4_needed = false;
yrest(3200);
end
end


rotate_cam();
if( math.random(100) > 90 ) then
move_forward(); end
end

pickup();
end

detach();
closeProcess(proc);
end

startMacro(main);

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

Re: [HELP]Fiestabot

#2 Post by Administrator » Fri Jan 11, 2008 8:01 pm

Please use code tags next time. This, but without spaces:
[ code ]
All of the code here
[ /code ]

Anyways, what you see is actually normal. You have the script set to use scrolls, so it will try to use them. Each scroll has a 4 second cast time.

Go to this part of the script, and change the 1s to 0s

Code: Select all

-- Scroll settings  (read instructions below Buff settings first)
-------------------------
scroll1_duration 	= 3500000;
scroll_1		= 1; -- change this to 0
scroll2_duration 	= 3500000;
scroll_2         	= 1; -- change this to 0
scroll3_duration 	= 3500000;
scroll_3	       	= 0;
scroll4_duration 	= 3500000;
scroll_4	       	= 0;
If you want to use the scrolls, remember to hotkey them, and turn them back on. Scroll 1 and 2 are keys 9 and 0 on your hotkey bar.

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#3 Post by blub » Fri Jan 11, 2008 9:16 pm

hey sorry about the code part, i changed that now nothing happens :D last time it at least showed the scrolls in the bot log but didnt do anything in the game now it does nothing at all, game or in micromacro

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

Re: [HELP]Fiestabot

#4 Post by Administrator » Fri Jan 11, 2008 9:43 pm

Is XTrap still running? I haven't actually tested this, but somebody reported they have disabled it.

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#5 Post by blub » Fri Jan 11, 2008 10:46 pm

yep off

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

Re: [HELP]Fiestabot

#6 Post by Administrator » Sat Jan 12, 2008 2:06 am

Hmm, so the bot worked for you before, correct? Since it has worked, have you downloaded a new version MicroMacro?

If you have, I have a feeling that perhaps the syscall code for Vista isn't behaving correctly. This would cause the keyboard and mouse inputs to not function correctly (though, I would expect MicroMacro to crash).

Let me make sure that you've got it setup correctly, though. Are you certain that you've followed the Vista fix in the help file?
1. Vista Compatibility

In order to get MicroMacro to run properly in Windows Vista, you must change some settings.
First, right click on micromacro.exe, and select Properties.
Now, check "Run as Administrator", and run in compatibility mode for
Windows XP Service Pack 2. Now you can open micromacro.exe and all should
work just fine.
And one final question for now: the macro does absolutely nothing? Does it even rotate the camera?

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#7 Post by blub » Sat Jan 12, 2008 5:32 pm

no i never got it to work tried all type of things :X read the 1000 posts etc... and yes i did the admin comp like i said before

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

Re: [HELP]Fiestabot

#8 Post by Administrator » Sat Jan 12, 2008 10:16 pm

Ok, I'm thinking that it must be because of the syscall code. It must not be functioning under Vista. Try using micromacro.exe from the attachment and see if that works. Also, report if the UAC code is working (It should automatically pop up and ask for the admin password rather than having to use the Vista fix).

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#9 Post by blub » Mon Jan 14, 2008 7:12 pm

you where right that was the problem everything works fine now, only thing that doesnt work is the looting cause i assume its a archer class and doesnt run to the mob to collect well who cares :D thx m8

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

Re: [HELP]Fiestabot

#10 Post by Administrator » Mon Jan 14, 2008 9:39 pm

You're forgetting: I'm always right. And yes, you will not run after items to pick them up; it will only get items near you.

Can you confirm if the UAC worked properly?

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#11 Post by blub » Wed Jan 16, 2008 2:03 am

it worked excellent until today lol :X started to get some messages

Tue Jan 15 18:54:02 2008 : WARNING: Failure reading memory from 0x10C at 0x01F66B04 in memoryReadByte().
Error code: 299

Tue Jan 15 18:54:02 2008 : WARNING: Read zero bytes from 0x10C at 0x01F66B04 in memoryReadByte().

so what it does now is when i start it it says hp stone used entering rest modus ... than the bot goes crazy and open ups other windows right clicks on my desktop etc..

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

Re: [HELP]Fiestabot

#12 Post by Administrator » Wed Jan 16, 2008 3:55 am

Post your log. I have no idea what you did. Make sure it's running with admin privileges, Xtrap isn't running, and that you are running the game in 1024*768 resolution with the game window on top of all others when you press F5.

blub
Posts: 7
Joined: Fri Jan 11, 2008 7:24 pm

Re: [HELP]Fiestabot

#13 Post by blub » Wed Jan 16, 2008 8:45 pm

that is my log... and ofc ive done all the things :D but anyways it works again but that appears in the log dunno why as long as it works who cares :D

charmingiv
Posts: 12
Joined: Mon Feb 18, 2008 4:52 pm

Re: [HELP]Fiestabot

#14 Post by charmingiv » Mon Feb 18, 2008 5:16 pm

Thanks for all the help. Now I have a problem after I start my bot it kills one monster and then it starts using buffs and scrolls on the DOS window but in the fiesta window will tell me that it cannot find target... I placed the bash skill in 5 -> = ans still wont use, ;( Do I need to open another slot bar?
Here is the code:

Code: Select all

-- Credits:
--   A. M.  "MystikFox"
--          "Mangler"


version = getVersion();
if( version < 96 ) then
  printf("ERROR! You are using an old version of MicroMacro that is not compatable with this script.\n");
  printf("Please download a newer version from http://solarimpact.servegame.com\n");
  return;
end;

-------------------------
-- do NOT edit these!!
CLASS_KNIGHT 	= 0;
CLASS_CLERIC 	= 1;
CLASS_MAGE 	= 2;
CLASS_ARCHER 	= 3;


-- EDIT THESE!
-------------------------
class           = CLASS_CLERIC; -- class determins the logic to take
HP_restamt 	= 10; 		-- HP to rest at   (not used for cleric's)
HP_potion	= 60; 		-- Use a HP potion (or heal skill for cleric)
HP_stone	= 13; 		-- Use a HP stone
SP_restamt 	= 10; 		-- SP to rest at
SP_potion	= 12;      	-- Use a SP potion
SP_stone	= 13;          -- Usa a SP stone


key_attack 	= key.VK_1; 	-- normal melee attack
key_pickup      = key.VK_2;     -- pickup items
key_skill1 	= key.VK_5; 	-- offensive and defensive spells...
key_skill2 	= key.VK_6; 	-- check your class's fight function
key_skill3 	= key.VK_7; 	-- for documentation on what each skill
key_skill4 	= key.VK_8; 	-- will be used for

key_scroll1 	= key.VK_9; 	-- offensive and defensive spells...
key_scroll2 	= key.VK_0; 	-- check your class's fight function
key_scroll3 	= key.VK_DASH; 	-- for documentation on what each skill
key_scroll4 	= key.VK_EQUAL; -- will be used for

key_hppotion 	= key.VK_3;     -- CLERICS: map this to your heal spell
key_hpstone 	= key.VK_Q;
key_sppotion 	= key.VK_4;
key_spstone 	= key.VK_E;

-- NOTE: if SP_potion is higher than SP_restatm, you will use SP potions
-- instead of resting, unless you do not have any left. same goes for HP potions.
-- you will always use potions while fighting if the values fall below
-- the emergency amount.
-------------------------




-- Scroll settings  (read instructions below Buff settings first)
-------------------------
scroll1_duration 	= 3500000;
scroll_1		= 1;
scroll2_duration 	= 3500000;
scroll_2         	= 1;
scroll3_duration 	= 3500000;
scroll_3	       	= 0;
scroll4_duration 	= 3500000;
scroll_4	       	= 0;
-------------------------


-- Buff settings (only for clerics)
-------------------------
buff1_duration 		= 3500000;
buff_1			= 1;
buff2_duration 		= 3500000;
buff_2         		= 1;
buff3_duration 		= 3500000;
buff_3	       		= 0;
buff4_duration 		= 3500000;
buff_4	       		= 0;

-- NOTE:  set on 59 minutes
-- buff / scroll durations in msec 	time = minutes x 60000
-- to de- activate non used buffs / scrolls replace "1" with "0"
-- to activate buff / scroll replace "0" with "1"
-- scrolls can be used too as buff
-------------------------






-- should not need to be changed, except for HP_addr/SP_addr when
-- a patch makes them no longer work
proc 		  = 0;
win 		  = 0;
HP_addr 	  = "00758FE7";
HPmax_addr        = "007590B8";
SP_addr 	  = "00758FEB";
SPmax_addr        = "007590BC";
restcheck_addr    = "01F66B04";
HP 		  = 10000; 	-- default, this corrects itself (don't change it!)
HPmax             = HP; 	-- default, this corrects itself (don't change it!)
SP 		  = 10000;	-- default, this corrects itself (don't change it!)
SPmax             = SP;         -- default, this corrects itself (don't change it!)
buff1_needed 	  = true;
buff2_needed 	  = true;
buff3_needed 	  = true;
buff4_needed 	  = true;
scroll1_needed 	  = true;
scroll2_needed 	  = true;
scroll3_needed 	  = true;
scroll4_needed 	  = true;
need_heal 	  = false;
can_rest 	  = true;
-------------------------


function fight_timer()
  keyboardHold(key_attack);
  yrest(50);
  keyboardRelease(key_attack);
end



-- fighting functions
-----------------------------------------------------
-- fight as a knight
function knight_fight()
  -- skill1 : offensive skill
  -- skill2 : offensive skill
  -- skill3 : offensive skill
  -- skill4 : offensive skill

  keyboardHold(key_attack);
  yrest(50);
  keyboardRelease(key_attack);

  registerTimer("fight_timer", 3000, fight_timer);
  while(have_target()) do
    if( HP < HP_potion) then hp_potion(); end
	if( HP < HP_stone) then hp_stone(); end
    if( SP < SP_potion) then sp_potion(); end
    if( SP < SP_stone) then hp_stone(); end

    keyboardHold(key_attack);
    yrest(50);
    keyboardRelease(key_attack);

    if( math.random(100) > 92 ) then
      if( math.random(100) >= 50 ) then
        keyboardHold(key_skill1);
        yrest(50);
        keyboardRelease(key_skill1);
      else
        keyboardHold(key_skill2);
        yrest(50);
        keyboardRelease(key_skill2);
      end
    end

    yrest(50);
  end
  unregisterTimer("fight_timer");

  for i = 0,8 do
    pickup();
    yrest(50);
  end

  can_rest = false;
  registerTimer("can_rest_timer", 3000, can_rest_timer);

end

-- fight function for cleric
function cleric_fight()
  -- skill1 : buff 1
  -- skill2 : buff 2
  -- skill3 : buff 3
  -- skill4 : buff 4

  keyboardHold(key_attack);
  yrest(50);
  keyboardRelease(key_attack);

  registerTimer("fight_timer", 3000, fight_timer);
  while(have_target()) do
    if( HP < HP_potion) then hp_potion(); end
    if( HP < HP_stone) then hp_stone(); end
    if( SP < SP_potion) then sp_potion(); end
    if( SP < SP_stone) then sp_stone(); end

    yrest(100);
  end
  unregisterTimer("fight_timer");

  for i = 0,8 do
    pickup();
    yrest(50);
  end

  can_rest = false;
  registerTimer("can_rest_timer", 3000, can_rest_timer);
end

-- fight as a mage
function mage_fight()
  -- skill1 : offensive spell
  -- skill2 : offensive spell
  -- skill3 : offensive spell
  -- skill4 : offensive spell

  while(have_target()) do
    if( HP < HP_potion) then hp_potion(); end
    if( HP < HP_stone) then hp_stone(); end
    if( SP <SP_potion) then sp_potion(); end
    if( SP < SP_stone) then hp_stone(); end

    keyboardHold(key_skill1);
    yrest(200);
    keyboardRelease(key_skill1);

    yrest(100);

    keyboardHold(key_skill2);
    yrest(200);
    keyboardRelease(key_skill2);

    yrest(100);

    keyboardHold(key_skill3);
    yrest(200);
    keyboardRelease(key_skill3);

    yrest(100);
  end

  for i = 0,8 do
    pickup();
    yrest(50);
  end

  can_rest = false;
  registerTimer("can_rest_timer", 3000, can_rest_timer);
end


-- fight as an archer
function archer_fight()
  -- skill1 : DOT / offensive skill (entry attack)
  -- skill2 : DOT / offensive skill (entry attack)
  -- skill3 : offensive skill
  -- skill4 : offensive skill

  -- entry skill
  if( math.random(100) >= 50 ) then
    keyboardHold(key_skill1);
    yrest(50);
    keyboardRelease(key_skill1);
  else
    keyboardHold(key_skill2);
    yrest(50);
    keyboardRelease(key_skill2);
  end
  yrest(500);

  keyboardHold(key_attack);
  yrest(50);
  keyboardRelease(key_attack);

  registerTimer("fight_timer", 3000, fight_timer);
  while(have_target()) do
    if( HP < HP_potion) then hp_potion(); end
    if( HP < HP_stone) then hp_stone(); end
    if( SP < SP_potion) then sp_potion(); end
    if( SP < SP_stone) then hp_stone(); end

    --keyboardHold(key_attack);
    --yrest(50);
    --keyboardRelease(key_attack);

    if( math.random(100) > 80 ) then
      if( math.random(100) >= 50 ) then
        keyboardHold(key_skill2);
        yrest(50);
        keyboardRelease(key_skill2);
      else
        keyboardHold(key_skill3);
        yrest(50);
        keyboardRelease(key_skill3);
      end
      yrest(200);
    end

    yrest(200);
  end
  unregisterTimer("fight_timer");

  for i = 0,8 do
    pickup();
    yrest(100);
  end

  can_rest = false;
  registerTimer("can_rest_timer", 3000, can_rest_timer);
end
-----------------------------------------------------





-- toggle cast needed for buff1
function buff1_timer()
  buff1_needed = true;
end

-- toggle cast needed for buff2
function buff2_timer()
  buff2_needed = true;
end

-- toggle cast needed for buff3
function buff3_timer()
  buff3_needed = true;
end

-- toggle cast needed for buff4
function buff4_timer()
  buff4_needed = true;
end

-- toggle cast needed for scroll1
function scroll1_timer()
  scroll1_needed = true;
end

-- toggle cast needed for scroll2
function scroll2_timer()
  scroll2_needed = true;
end

-- toggle cast needed for scroll3
function scroll3_timer()
  scroll3_needed = true;
end

-- toggle cast needed for scroll4
function scroll4_timer()
  scroll4_needed = true;
end


-- you have died! oh noes!
function death_return()
  keyboardPress(key.VK_SNAPSHOT);
  print(os.date("Alguien te mato.	%X"))
  print("A screen capture has been taken. Open MS Paint and paste it.");
  stopPE(); -- this turns the macro off!
  coroutine.yield(); -- yield to make sure the protected environment stops
end

-- moves forward a bit...makes you seem less bot-like.
-- allows you to cover more ground
function move_forward()
  keyboardHold(key.VK_W);
  if( math.random(100) >= 80 )
    then keyboardHold(key.VK_A);
  else if( math.random(100) >= 80 )
    then keyboardHold(key.VK_D); end
  end

  yrest( math.random(2000) );

  keyboardRelease(key.VK_W);
  keyboardRelease(key.VK_A);
  keyboardRelease(key.VK_D);
end


-- rotate camera
function rotate_cam()
  wx,wy = windowRect(win);

  mouseSet(wx+512, wy+384);
  yrest(100);
  mouseRHold();
  yrest(100);
  mouseSet(wx+514, wy+384);
  yrest(100);
  mouseRRelease();
  yrest(100);
end

-- pickup nearby items
function pickup()
  keyboardHold(key_pickup);
  yrest(50);
  keyboardRelease(key_pickup);
  yrest(50);
end

-- selects a nearby monster
function target_monster()
  keyboardHold(key.VK_TAB);
  yrest(50);
  keyboardRelease(key.VK_TAB);
end

-- checks if you have a target
function have_target()
  local r,g,b = getPixel(hdc, 540, 1);

  -- check for the gray in the monster's HP window
  if( r >= 229 and r <= 240 and g >= 245 and g <= 255 and b >= 250 ) then
    return true;
  else
    return false;
  end
end

-- updates variables from client
function update_vars()
  HP = memoryReadInt(proc, HP_addr);
  HPmax = memoryReadInt(proc, HPmax_addr);
  SP = memoryReadInt(proc, SP_addr);
  SPmax = memoryReadInt(proc, SPmax_addr);
end


-- toggle can_heal to true, disable timer
function can_rest_timer()
  unregisterTimer("can_rest_timer");
  can_rest = true;
end

-- rest untill healed
function rest_heal()
  if( can_rest == false ) then return; end

  printf("Entering rest state\t%s\n", os.date("%X"));

  keyboardHold(key.VK_HOME);
  yrest(500);
  keyboardRelease(key.VK_HOME);

  need_heal = true;
  last_hp = HP;
  while( need_heal ) do
    yrest(100);

    if( HP == HPmax and SP == SPmax ) then
      need_heal = false;
    end;

    if (HP < last_hp)  then
      print("Under attack! Exiting rest.");
      can_rest = false;
      registerTimer("can_rest_timer", 3000, can_rest_timer);
      break;
    else
      last_hp = HP;
    end
  end

  -- BROKEN!! IGNORE THIS!
  --while( 1 ) do
  --  keyboardHold(key.VK_HOME);
  --  yrest(500);
  --  keyboardRelease(key.VK_HOME);
  --
  --  yrest(500);
  --  local val = memoryReadByte(proc, restcheck_addr);
  --  printf("Rest check val: %d\n", val);
  --
  --  if( val ~= 1 ) then -- 1 = resting, 2 = standing
  --    break; end;       -- so if not resting, exit
  --end

  printf("Exiting rest state\t%s\n", os.date("%X"));
end

-- use a hp potion!
function hp_potion()
  keyboardHold(key_hppotion);
  yrest(100);
  keyboardRelease(key_hppotion);

  yrest(500);
end

-- use a hp stone!
function hp_stone()
  keyboardHold(key_hpstone);
  yrest(100);
  keyboardRelease(key_hpstone);
  print("HP stone used.")

  yrest(500);
end

-- use a sp potion!
function sp_potion()
  keyboardHold(key_sppotion);
  yrest(100);
  keyboardRelease(key_sppotion);

  yrest(500);
end

-- use a sp stone!
function sp_stone()
  keyboardHold(key_spstone);
  yrest(100);
  keyboardRelease(key_spstone);
  print("SP stone used.")

  yrest(500);
end








function main()
  win = findWindow("FiestaOnline");
  local wx,wy,ww,wh = windowRect(win);

  if( ww ~= 1024 or wh ~= 768 ) then
    printf("Error! You must run Fiesta in 1024*768 resolution.\n");
    return;
  end;

  if( win == 0 ) then printf("Error! Could not locate Fiesta window!\n"); return; end;
  hdc = openDC(win);
  proc = openProcess( findProcess("FiestaOnline") );
  attach(win);

  registerTimer("update_vars", 100, update_vars);

  if( class == CLASS_CLERIC ) then         
	registerTimer("buff1_timer", buff1_duration, buff1_timer);
 	registerTimer("buff2_timer", buff2_duration, buff2_timer); 
    registerTimer("buff3_timer", buff3_duration, buff3_timer);
    registerTimer("buff4_timer", buff4_duration, buff4_timer);
  end
  
  registerTimer("scroll1_timer", scroll1_duration, scroll1_timer);
  registerTimer("scroll2_timer", scroll2_duration, scroll2_timer);
  registerTimer("scroll3_timer", scroll3_duration, scroll3_timer);
  registerTimer("scroll4_timer", scroll4_duration, scroll4_timer);

  while( 1 ) do
    if( HP == 0 ) then death_return(); end
    if( HP < HP_potion ) then hp_potion(); end
    if( HP < HP_stone ) then hp_stone(); end
    if( SP < SP_potion ) then sp_potion(); end
    if( SP < SP_stone ) then sp_stone(); end
    if( HP < HP_restamt and can_rest == true ) then rest_heal(); end
    if( SP < SP_restamt and can_rest == true ) then rest_heal(); end

    yrest(100);

    target_monster();
    yrest(200);
    if( have_target() ) then
      can_rest = false; -- prevent resting during battle
                        -- for the few that have this bug
      if( class == CLASS_KNIGHT ) then knight_fight(); end
      if( class == CLASS_CLERIC ) then cleric_fight(); end
      if( class == CLASS_MAGE )   then mage_fight();   end
      if( class == CLASS_ARCHER ) then archer_fight(); end
      can_rest = true;
    else
    

      -- cleric only logic
   	if( class == CLASS_CLERIC ) then
       	if( buff_1 == 1 ) then 
        	if( buff1_needed ) then
        	  	keyboardHold(key_skill1);
        		yrest(100);
       	  	  	keyboardRelease(key_skill1);
	 		print(os.date("buff 1 casted	%X"))
          		buff1_needed = false;
          		yrest(2000);
        	end
          end

        if( buff_2 == 1 ) then 
			if( buff2_needed ) then
          		keyboardHold(key_skill2);
          		yrest(100);
          		keyboardRelease(key_skill2);
          		print(os.date("buff 2 casted	%X"))
          		buff2_needed = false;
          		yrest(2000);
        	end
          end
        
        if( buff_3 == 1 ) then 
			if( buff3_needed ) then
         		keyboardHold(key_skill3);
          		yrest(100);
          		keyboardRelease(key_skill3);
	  		print(os.date("buff 3 casted	%X"))
          		buff3_needed = false;
          		yrest(2000);
        	end
          end

        if( buff_4 == 1 ) then 
			if( buff4_needed ) then
          		keyboardHold(key_skill4);
          		yrest(100);
          		keyboardRelease(key_skill4);
	  		print(os.date("buff 4 casted	%X"))
          		buff4_needed = false;
          		yrest(2000);
        	end
      	end
    end
    
    if( scroll_1 == 1 ) then
        if( scroll1_needed ) then
        	keyboardHold(key_scroll1);
        	yrest(100);
       	   	keyboardRelease(key_scroll1);
	 		print(os.date("scroll 1 used	%X"))
          	scroll1_needed = false;
          	yrest(3200);
    	   end
	end
	
	if( scroll_2 == 1 ) then
        if( scroll2_needed ) then
        	keyboardHold(key_scroll2);
        	yrest(100);
       	   	keyboardRelease(key_scroll2);
	 	print(os.date("scroll 2 used	%X"))
          	scroll2_needed = false;
          	yrest(3200);
    	   end
	end
	
    if( scroll_3 == 1 ) then
        if( scroll3_needed ) then
        	keyboardHold(key_scroll3);
        	yrest(100);
       	   	keyboardRelease(key_scroll3);
	 	print(os.date("scroll 3 used	%X"))
          	scroll3_needed = false;
          	yrest(3200);
    	   end
	end
	
	if( scroll_4 == 1 ) then
        if( scroll4_needed ) then
        	keyboardHold(key_scroll4);
        	yrest(100);
       	   	keyboardRelease(key_scroll4);
	 	print(os.date("scroll 4 used	%X"))
          	scroll4_needed = false;
          	yrest(3200);
    	   end
	end


      rotate_cam();
      if( math.random(100) > 90 ) then
        move_forward(); end
    end

    pickup();
  end

  detach();
  closeProcess(proc);
end


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

Re: [HELP]Fiestabot

#15 Post by Administrator » Mon Feb 18, 2008 10:42 pm

-- skill1 : buff 1
-- skill2 : buff 2
-- skill3 : buff 3
-- skill4 : buff 4
1 -> attack
2 -> pickup
3 -> heal
4 -> SP potion
5 -> buff
6 -> buff
7 -> buff
8 -> buff
9 -> scroll
0 -> scroll
_ -> scroll
= -> scroll

It won't bash. I've answered this question one too many times. In fact, I've lost count.

charmingiv
Posts: 12
Joined: Mon Feb 18, 2008 4:52 pm

Re: [HELP]Fiestabot

#16 Post by charmingiv » Tue Feb 19, 2008 6:01 pm

Sorry, I get it now!!! I am new with this prog language, altough now I have the perfect codes for mage and clerics low levels like 25 under !!!!
IF you need help with a code ask, I can help not fast help tough!

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests