 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Mon Nov 17, 2008 4:06 pm Post subject: solved |
|
|
I'm having a problem with autoskill for my bot. It is working if i only enable 1 autoskill but when i enable a second one it's not working as I want it to. I enable autoskill 1 and 2 and have different delays on both they still dont press the button after the delay, instead it waits for the autoskill before it is done and then the second one starts. I dont want them to stand in a line. I've tried many different ways and all with the same result..
This is what I got now | Code: | void AutoSkill()
{
int iDelay;
for(;;)
{
if(AS1 == true)
{
Lul("AutoSkill", "AutoSkill1");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill1Delay");
Sleep(iDelay);
}
if(AS2 == true)
{
Lul("AutoSkill", "AutoSkill2");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill2Delay");
Sleep(iDelay);
}
if(AS3 == true)
{
Lul("AutoSkill", "AutoSkill3");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill3Delay");
Sleep(iDelay);
}
if(AS4 == true)
{
Lul("AutoSkill", "AutoSkill4");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill4Delay");
Sleep(iDelay);
}
if(AS5 == true)
{
Lul("AutoSkill", "AutoSkill5");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill5Delay");
Sleep(iDelay);
}
Sleep(10);
}
} | When I get this to work I only have hotkeys left and my bot is finished .
Last edited by TraxMate on Tue Nov 18, 2008 7:28 am; edited 1 time in total |
|
| Back to top |
|
 |
BirdsEye Advanced Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 94
|
Posted: Mon Nov 17, 2008 4:17 pm Post subject: |
|
|
I think use multi-threading? (CreateThread)
Since you don't give alot: I only came up with this mess (no offense):
| Code: |
void AutoSkill()
{
int iDelay;
void AS1_TRUE()
{
Lul("AutoSkill", "AutoSkill1");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill1Delay");
Sleep(iDelay);
}
void AS2_TRUE()
{
Lul("AutoSkill", "AutoSkill2");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill2Delay");
Sleep(iDelay);
}
void AS3_TRUE()
{
Lul("AutoSkill", "AutoSkill3");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill3Delay");
Sleep(iDelay);
}
void AS4_TRUE()
{
Lul("AutoSkill", "AutoSkill4");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill4Delay");
Sleep(iDelay);
}
void AS5_TRUE()
{
Lul("AutoSkill", "AutoSkill5");
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
iDelay = ReadDelay("AutoSkill", "AutoSkill5Delay");
Sleep(iDelay);
}
for(;;)
{
if(AS1 == true)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AS1_TRUE, 0, 0, 0);
if(AS2 == true)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AS2_TRUE, 0, 0, 0);
if(AS3 == true)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AS3_TRUE, 0, 0, 0);
if(AS4 == true)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AS4_TRUE, 0, 0, 0);
if(AS5 == true)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AS5_TRUE, 0, 0, 0);
Sleep(10);
}
}
|
Last edited by BirdsEye on Mon Nov 17, 2008 4:51 pm; edited 1 time in total |
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Mon Nov 17, 2008 4:48 pm Post subject: |
|
|
| Already tried that it makes it even worse :/. But thx for trying to help.
|
|
| Back to top |
|
 |
BirdsEye Advanced Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 94
|
Posted: Mon Nov 17, 2008 4:50 pm Post subject: |
|
|
| Oh... I'm not sure with what you're doing. Auto skill is if you just auto attack using a skill right? (I think) So it looks like you're trying to do two skills at one time?
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Mon Nov 17, 2008 5:22 pm Post subject: |
|
|
you must use CreateThread, or else you cannot accomplish what you want. period.
@BirdsEye, why did you put the CreateThreads in a loop? you're gonna make 1000000000000 useless and spamming threads.
loop in the skill function.
_________________
|
|
| Back to top |
|
 |
BirdsEye Advanced Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 94
|
Posted: Mon Nov 17, 2008 7:35 pm Post subject: |
|
|
| kitterz wrote: | you must use CreateThread, or else you cannot accomplish what you want. period.
@BirdsEye, why did you put the CreateThreads in a loop? you're gonna make 1000000000000 useless and spamming threads.
loop in the skill function. |
Oh crap I forgot there was an infinite loop. How would you do it?
|
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Tue Nov 18, 2008 12:38 am Post subject: |
|
|
it doesn't work because you do WM_KEYDOWN but never WM_KEYUP..
so you can't press the same key Down 2 times.. without picking it back up again..
try it on your keyboard with your finger could you press the same key 2 times without picking your finger back up??
i mean sure maybe u could do it if you gotta press different keys which i think in this case u can..
but can u hold one key down the whole time while pressing another key? thats what i dont think u can..
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue Nov 18, 2008 12:55 am Post subject: |
|
|
@kitterz: I know I have to use CreateThread but then I have to enable how many skills i want before ticking the auto skill button. I want it so I dont have to re-enable it if I want to add/remove a autoskill.
@pkedpker: I don't have to use WM_KEYUP it works anyways. It's nothing wrong with the part where it presses the keys.
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Tue Nov 18, 2008 2:18 am Post subject: |
|
|
use the registry to store what autoskill u want to use...
Create a thread that semi - constantly checks ( 1 check every 5 secs or so) the registry value if it changes it should by able to locate and kill the thread running the AutoSkill, and also Index into the Thread Routines By Registry value and start the next Thread at Next AutoSkill Address
i would post some code but this stuff bores me..
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue Nov 18, 2008 7:28 am Post subject: |
|
|
| BanMe wrote: | use the registry to store what autoskill u want to use...
Create a thread that semi - constantly checks ( 1 check every 5 secs or so) the registry value if it changes it should by able to locate and kill the thread running the AutoSkill, and also Index into the Thread Routines By Registry value and start the next Thread at Next AutoSkill Address
i would post some code but this stuff bores me.. | I found out how to do it myself, but thx for the help :>.
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Tue Nov 18, 2008 8:11 am Post subject: |
|
|
Let me guess, you learned how to code just to make a bot for MapleStory, right...?
First learn how to code simple programs, solve problems... then make your code more efficient and readable, give your variables and functions normal names, not "LulzDisIsAFunctionzzz"...
For example, instead of 5 boolean variables you could've just had an integer where each bit represents a boolean value, or an array which you would've looped through each boolean, like this:
| Code: | for (int i = 0; i < 5; i++)
{
if (AS[i])
{
wsprintfA(String, "AutoSkill%d", i+1);
key = ReadKey("AutoSkill", String);
PostMsg(MapleWnd, WM_KEYDOWN, key, (MapVirtualKey(key, 0) << 16));
Sleep(ReadDelay("AutoSkill", String);
}
} |
That's more dynamic, shorter, nicer and more efficient.
Plus, you shouldn't make like 100 threads, 1 thread is enough (except for the main thread), calculate estimated time before doing something, every millisecond decrase that value by 1 and once it reaches 0 do whatever you need, for example:
| Code: |
T DoSomething(...)
{
..
..
Sleep(...);
return ...;
}
..
..
while (Botting)
{
for (int i = 0; i < sizeof(Times) / sizeof(int); i++)
{
Times[i]--;
if (Times[i] == 0)
DoSomething();
}
Sleep(1);
} |
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue Nov 18, 2008 9:31 am Post subject: |
|
|
| Symbol wrote: | | Let me guess, you learned how to code just to make a bot for MapleStory, right...? | From the beginning I only wanted to learn to code for making bots and hacks... But I thought it was fun so now I'm doing more then just hacks for maplestory.
| Symbol wrote: | | First learn how to code simple programs, solve problems... then make your code more efficient and readable, give your variables and functions normal names, not "LulzDisIsAFunctionzzz"... |
The reason why it's called "Lul" is because I did it quick to see if it worked because I had to redo it several times becuase it didn't work and I don't have a better name for it.
Those snippets you posted are way out of my league, I could never do like that since I only know the basics of programming. I mean it will take time before I can do that by my own.
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Tue Nov 18, 2008 9:41 am Post subject: |
|
|
That's why you learn doing stuff before doing stuff, especially if it's way beyond your abilities.
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue Nov 18, 2008 9:59 am Post subject: |
|
|
| The bot isn't beyond my abilities but the way you coded is.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|