Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how to make simple plugin?[New Edit to last POST!]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source -> Plugin development
View previous topic :: View next topic  
Author Message
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Sun Jul 10, 2011 6:43 pm    Post subject: how to make simple plugin?[New Edit to last POST!] Reply with quote

subject says it all. I don't know any c or c++ but am very good with java. I have the code i want the plugin to run but i have no idea how to make a plugin. A wiki page told me that it needs 3 function.

Where do i read a tutorial on making and compiling a plugin.


Last edited by giuseppe105 on Thu Aug 18, 2011 5:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Mon Jul 11, 2011 5:10 am    Post subject: Reply with quote

can java create native windows dll's ?

If not, then use C or delphi or another language that does and call your java stuff from there (perhaps calling it as a command prompt parameter and fetch the results when done)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Mon Jul 11, 2011 7:17 am    Post subject: Reply with quote

thank you for the reply dark byte

I understand that java is useless in this situation.

The code i have is either c of c++ code.

All the code does is press the keys h e l l o on the keyboard automaticaly

I have 2 questions.

1. What are plguns used for?

2. Can i use a plugin to make a bot?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Mon Jul 11, 2011 7:46 am    Post subject: Reply with quote

1: To add extra features to Cheat Engine. Like reading physical memory, or an alternate method of accessing a process, or a packet editor, etc...

2: sure, you don't even need it to be aplugin, you can do it manually as well. As a plugin it might help though because you get the targeted process, and easy routines for memory reading so you can react to stuff


Also, for what you intend to do you don't specifically need a plugin, you can also do that with the lua script engine
Look into "doKeyPress" and Timer objects (e.g: every 100 ms do a keypress for the current character that needs to be pressed)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Mon Jul 11, 2011 7:49 am    Post subject: Reply with quote

for the DoKeypress and timer are we talking Lua script? And how woluld i run my lua script on my game?

K i think i found how to do the lua.

For the doKeyPress(key) function what do i provide for "key" do i give it a character for example 'H' or do i provide a hex value?


Well i found some thing talking about keysyms so i took some values from there. I found some code on timer. So i have 2 ways to do this code. I dont know lua so i dont even know if this code works.
Code:

timer.performWithDelay(500, work, 0)

local function work()
   doKeyEvent(9)
   doKeyEvent(49)
end

Code:

while true do
        doKeyEvent(9)
   doKeyEvent(49)
   sleep(5000)
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Mon Jul 11, 2011 1:55 pm    Post subject: Reply with quote

These examples are close, but not compatible

You don't want to use a infinite loop because that will block the main thread, and the timer setup is different.

anyhow, check defines.lua for some common key codes (e.g VK_TAB (9) , VK_1 (49) and VK_H (72) )


Also, I see there's a bug with doKeyPress

Anyhow, here is a script that writes hello constantly
Code:

stringtotype={}
stringtotype[0]=VK_H
stringtotype[1]=VK_E
stringtotype[2]=VK_L
stringtotype[3]=VK_L
stringtotype[4]=VK_O

currentChar=0;

function typer()

  keyDown(stringtotype[currentChar])
  sleep(50)
  keyUp(stringtotype[currentChar])

  currentChar=(currentChar + 1);

  if (stringtotype[currentChar] == nil) then
    currentChar=0
  end

end

t=createTimer(nil, false)
timer_setInterval(t, 100)
timer_onTimer(t, typer)
timer_setEnabled(t, true)


if you only want to do it once, replace
Code:

   if (stringtotype[currentChar] == nil) then
    currentChar=0
  end

with
Code:

timer_setEnabled(t, false)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Mon Jul 11, 2011 5:40 pm    Post subject: Reply with quote

Thank you for providing the code. I don't think my effort was good enough.

It works but it only works when i have the chat bar open in the game.

I want to be able to press a hot key as well but it wont press a hot key.

Is the keypress i am sending a character or is it simulating a key press.

Say I want to open the inventory if i modified the code to send VK_I it wont open the inventory.

but if i have the chat open it presses I
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Mon Jul 11, 2011 5:59 pm    Post subject: Reply with quote

are you sure it is still sending the I when you're back in the game? (also, does a second time I close the inventory? If so, could be it's opening and closing too quickly)

If not, try adding a delay when testing (sleep of 10000 or something for 10 seconds)

Also, if it's an online game with protection it might just not work. I can quickly write a usb program that emulates a real keyboard, but you'll have to buy a programmable usb device, and that might be a bit overkill

Quote:
Is the keypress i am sending a character or is it simulating a key press.

a keypress, you can also do a combination, like VK_CTRL and VK_C both down and then both up to simulate them both down

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping


Last edited by Dark Byte on Mon Jul 11, 2011 6:29 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Mon Jul 11, 2011 6:28 pm    Post subject: Reply with quote

Yes i slowed the code down to 5 seconds (5000) milisecond. and while the program was running i pressed enter to start the chat. and it typed I then i pressed enter again to leave chat and the inventory never opened.

That would be cool but i don't know where to buy a programmable usb device.

On the other hand i used some code i found on the internet to move the mouse and click. But it will only work if the application has focus. How do i make it work when it has lost focus?

I got the idea to make the program use the onscreen keyboard. Since that works. and it bypasses securtiy XD

This is the program.

using visual c++ 2010

Code:

#include "stdafx.h"
#include<iostream>
#include<windows.h>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
   Sleep(5000);
   while (true)
   {
      SetCursorPos(75, 110);
      Sleep(50);
      mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
      Sleep(50);

      
      SetCursorPos(75, 90);
      Sleep(50);
      mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

      Sleep(5000);
   }
   return 0;
}


The sleep keeps the cpu in check i think. And 5 seconds gives me enough time to close the program. when i need too

This application is running in a dos prompt someone mentioned something about making a pif. that sounds complicated im gonna try making an application.

Well it works when i made the win32 application. But when im in the game it dosen't work.

would the application work if it was inside a plugin?

Or maybe i could make a proxy to modify the on screen keyboard itself?

I remember makeing a dll you inject into notepad to make it print the time. in a popup window
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Tue Jul 12, 2011 7:09 am    Post subject: Reply with quote

no, it would work inside a plugin. Perhaps if it's injected in the target process, but if it's a protected process the dll injection can be blocked as well

also, http://www.pjrc.com/teensy/

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
giuseppe105
How do I cheat?
Reputation: 0

Joined: 10 Jul 2011
Posts: 8

PostPosted: Tue Jul 12, 2011 7:20 am    Post subject: Reply with quote

Cheat engines speed hack is a DLL that is injected into the game process. And it works.

The teensy thing is cool. But i cant buy things online XD.

I was thinking of taking apart an old keyboard and using a 555timer to put a signal though the button i want pressed but last time i opened a keybaord i ended up throwing it away.

EDIT:
So its been 2 days now i know everyone has a busy life but im gona put my question out there again from my OP

How do i make a plugin for Cheat engine? The example in the plugin folder is corrupt. When i try to open it with visual C++ 2010 it tells me the project is corrupt. There are no other tutorials or guides online.

EDIT:
Ok so its been a while. I'm still thinking about this.
I managed to stumble around and i found out that It can type in the game but not press a in game key because DirectInput doesn't recognize the key press.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source -> Plugin development All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites