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 


control_getCaption , CEEdit control instructions
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Apr 24, 2013 2:07 pm    Post subject: Reply with quote

iroku wrote:
Code:
 CECheckbox1Change()
      sleep(100) --well so it won't toggle to quick
      else
      checkbox_setState(UDF1_CECheckbox1, 0)
      CECheckbox1Change()
      sleep(100) --well so it won't toggle to quick
   end


this makes it work ?

edit, this is working Smile i am happy about that but dont understand how that made it work...

Its quite easy .-. look again.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Wed Apr 24, 2013 2:16 pm    Post subject: Reply with quote

I tried implementing this code on the previous existing forms.
UDF1 and UDF2

But i get a weird bug. When i run .CT and try to set hotkeys he returns access error, but if i click on show Lua script change NOTHING, and run code again, it works...

It might be the way the code is formatted, but i don't know, is there a way to better organize this code to make it work ? i tried changing the functions that change/setState to to end of the script but at some point it wouldn't even do anything...

Code:

form_show(UDF1)
if StopTimerStatus_Timer~=nil then object_destroy(StopTimerStatus_Timer) -- Game Timer object destruction conditions
StopTimerStatus_Timer=nil
end


stringlist_add(getAutoAttachList(),"ggpofba.exe") -- run auto process Search



function myONtimerFunc() -- reads/writes to adress
    writeBytes("[[ggpofba.exe+719748]+1ff80]+108", 99)
  end



 function CECheckbox1()
local bool = (checkbox_getState(UDF1_CECheckbox1)==1)
  timer_setEnabled(StopTimerStatus_Timer, bool)
end
checkbox_onChange(UDF1_CECheckbox1, 'CECheckbox1')




StopTimerStatus_Timer = createTimer(nil,false) -- Game Timer timer starting conditions
timer_onTimer(StopTimerStatus_Timer, myONtimerFunc)-- Starts StopTimerStatus_Timer creation function  at myONtimerFunc event
timer_setInterval(StopTimerStatus_Timer,150)


function CELabel1Click(sender)
form_show(UDF2)
end



--hotkey form
h     = {}
h[0]  = UDF2
h[1]  = UDF2_CEListBox1
h[2]  = UDF2_CEListBox2
h[3]  = UDF2_CEToggleBox1


ListOneItems={}
function addListOne(NumOne, DesOne)
  ListOneItems[NumOne]=DesOne
end
addListOne(0, 'VK_LBUTTON')
addListOne(1, 'VK_RBUTTON')
addListOne(2, 'VK_CANCEL')
addListOne(3, 'VK_MBUTTON')
addListOne(4, 'VK_BACK')
addListOne(5, 'VK_TAB')
addListOne(6, 'VK_CLEAR')
addListOne(7, 'VK_RETURN')
addListOne(8, 'VK_SHIFT')
addListOne(9, 'VK_CONTROL')
addListOne(10, 'VK_MENU')
addListOne(11, 'VK_PAUSE')
addListOne(12, 'VK_CAPITAL')
addListOne(13, 'VK_ESCAPE')
addListOne(14, 'VK_SPACE')
addListOne(15, 'VK_PRIOR')
addListOne(16, 'VK_NEXT')
addListOne(17, 'VK_END')
addListOne(18, 'VK_HOME')
addListOne(19, 'VK_LEFT')
addListOne(20, 'VK_UP')
addListOne(21, 'VK_RIGHT')
addListOne(22, 'VK_DOWN')
addListOne(23, 'VK_SELECT')
addListOne(24, 'VK_PRINT')
addListOne(25, 'VK_EXECUTE')
addListOne(26, 'VK_SNAPSHOT')
addListOne(27, 'VK_INSERT')
addListOne(28, 'VK_DELETE')
addListOne(29, 'VK_HELP')
addListOne(30, 'VK_0')
addListOne(31, 'VK_1')
addListOne(32, 'VK_2')
addListOne(33, 'VK_3')
addListOne(34, 'VK_4')
addListOne(35, 'VK_5')
addListOne(36, 'VK_6')
addListOne(37, 'VK_7')
addListOne(38, 'VK_8')
addListOne(39, 'VK_9')
addListOne(40, 'VK_A')
addListOne(41, 'VK_B')
addListOne(42, 'VK_C')
addListOne(43, 'VK_D')
addListOne(44, 'VK_E')
addListOne(45, 'VK_F')
addListOne(46, 'VK_G')
addListOne(47, 'VK_H')
addListOne(48, 'VK_I')
addListOne(49, 'VK_J')
addListOne(50, 'VK_K')
addListOne(51, 'VK_L')
addListOne(52, 'VK_M')
addListOne(53, 'VK_N')
addListOne(54, 'VK_O')
addListOne(55, 'VK_P')
addListOne(56, 'VK_Q')
addListOne(57, 'VK_R')
addListOne(58, 'VK_S')
addListOne(59, 'VK_T')
addListOne(60, 'VK_U')
addListOne(61, 'VK_V')
addListOne(62, 'VK_W')
addListOne(63, 'VK_X')
addListOne(64, 'VK_Y')
addListOne(65, 'VK_Z')
addListOne(66, 'VK_LWIN')
addListOne(67, 'VK_RWIN')
addListOne(68, 'VK_APPS')
addListOne(69, 'VK_NUMPAD0')
addListOne(70, 'VK_NUMPAD1')
addListOne(71, 'VK_NUMPAD2')
addListOne(72, 'VK_NUMPAD3')
addListOne(73, 'VK_NUMPAD4')
addListOne(74, 'VK_NUMPAD5')
addListOne(75, 'VK_NUMPAD6')
addListOne(76, 'VK_NUMPAD7')
addListOne(77, 'VK_NUMPAD8')
addListOne(78, 'VK_NUMPAD9')
addListOne(79, 'VK_MULTIPLY')
addListOne(80, 'VK_ADD')
addListOne(81, 'VK_SEPARATOR')
addListOne(82, 'VK_SUBTRACT')
addListOne(83, 'VK_DECIMAL')
addListOne(84, 'VK_DIVIDE')
addListOne(85, 'VK_F1')
addListOne(86, 'VK_F2')
addListOne(87, 'VK_F3')
addListOne(88, 'VK_F4')
addListOne(89, 'VK_F5')
addListOne(90, 'VK_F6')
addListOne(91, 'VK_F7')
addListOne(92, 'VK_F8')
addListOne(93, 'VK_F9')
addListOne(94, 'VK_F10')
addListOne(95, 'VK_F11')
addListOne(96, 'VK_F12')
addListOne(97, 'VK_F13')
addListOne(98, 'VK_F14')
addListOne(99, 'VK_F15')
addListOne(100, 'VK_F16')
addListOne(101, 'VK_F17')
addListOne(102, 'VK_F18')
addListOne(103, 'VK_F19')
addListOne(104, 'VK_F20')
addListOne(105, 'VK_F21')
addListOne(106, 'VK_F22')
addListOne(107, 'VK_F23')
addListOne(108, 'VK_F24')
addListOne(109, 'VK_NUMLOCK')
addListOne(110, 'VK_SCROLL')
addListOne(111, 'VK_LSHIFT')
addListOne(112, 'VK_LCONTROL')
addListOne(113, 'VK_LMENU')
addListOne(114, 'VK_RSHIFT')
addListOne(115, 'VK_RCONTROL')
addListOne(116, 'VK_RMENU')
lo1 = listbox_getItems(h[1])
strings_clear(lo1) -- Lets clean it up =)
for i = 0,116 do
  strings_add(lo1, ListOneItems[i])
end


ListTwoItems={}
function addListTwo(NumTwo, DesTwo)
  ListTwoItems[NumTwo]=DesTwo
end
addListTwo(0, 'VK_LBUTTON')
addListTwo(1, 'VK_RBUTTON')
addListTwo(2, 'VK_CANCEL')
addListTwo(3, 'VK_MBUTTON')
addListTwo(4, 'VK_BACK')
addListTwo(5, 'VK_TAB')
addListTwo(6, 'VK_CLEAR')
addListTwo(7, 'VK_RETURN')
addListTwo(8, 'VK_SHIFT')
addListTwo(9, 'VK_CONTROL')
addListTwo(10, 'VK_MENU')
addListTwo(11, 'VK_PAUSE')
addListTwo(12, 'VK_CAPITAL')
addListTwo(13, 'VK_ESCAPE')
addListTwo(14, 'VK_SPACE')
addListTwo(15, 'VK_PRIOR')
addListTwo(16, 'VK_NEXT')
addListTwo(17, 'VK_END')
addListTwo(18, 'VK_HOME')
addListTwo(19, 'VK_LEFT')
addListTwo(20, 'VK_UP')
addListTwo(21, 'VK_RIGHT')
addListTwo(22, 'VK_DOWN')
addListTwo(23, 'VK_SELECT')
addListTwo(24, 'VK_PRINT')
addListTwo(25, 'VK_EXECUTE')
addListTwo(26, 'VK_SNAPSHOT')
addListTwo(27, 'VK_INSERT')
addListTwo(28, 'VK_DELETE')
addListTwo(29, 'VK_HELP')
addListTwo(30, 'VK_0')
addListTwo(31, 'VK_1')
addListTwo(32, 'VK_2')
addListTwo(33, 'VK_3')
addListTwo(34, 'VK_4')
addListTwo(35, 'VK_5')
addListTwo(36, 'VK_6')
addListTwo(37, 'VK_7')
addListTwo(38, 'VK_8')
addListTwo(39, 'VK_9')
addListTwo(40, 'VK_A')
addListTwo(41, 'VK_B')
addListTwo(42, 'VK_C')
addListTwo(43, 'VK_D')
addListTwo(44, 'VK_E')
addListTwo(45, 'VK_F')
addListTwo(46, 'VK_G')
addListTwo(47, 'VK_H')
addListTwo(48, 'VK_I')
addListTwo(49, 'VK_J')
addListTwo(50, 'VK_K')
addListTwo(51, 'VK_L')
addListTwo(52, 'VK_M')
addListTwo(53, 'VK_N')
addListTwo(54, 'VK_O')
addListTwo(55, 'VK_P')
addListTwo(56, 'VK_Q')
addListTwo(57, 'VK_R')
addListTwo(58, 'VK_S')
addListTwo(59, 'VK_T')
addListTwo(60, 'VK_U')
addListTwo(61, 'VK_V')
addListTwo(62, 'VK_W')
addListTwo(63, 'VK_X')
addListTwo(64, 'VK_Y')
addListTwo(65, 'VK_Z')
addListTwo(66, 'VK_LWIN')
addListTwo(67, 'VK_RWIN')
addListTwo(68, 'VK_APPS')
addListTwo(69, 'VK_NUMPAD0')
addListTwo(70, 'VK_NUMPAD1')
addListTwo(71, 'VK_NUMPAD2')
addListTwo(72, 'VK_NUMPAD3')
addListTwo(73, 'VK_NUMPAD4')
addListTwo(74, 'VK_NUMPAD5')
addListTwo(75, 'VK_NUMPAD6')
addListTwo(76, 'VK_NUMPAD7')
addListTwo(77, 'VK_NUMPAD8')
addListTwo(78, 'VK_NUMPAD9')
addListTwo(79, 'VK_MULTIPLY')
addListTwo(80, 'VK_ADD')
addListTwo(81, 'VK_SEPARATOR')
addListTwo(82, 'VK_SUBTRACT')
addListTwo(83, 'VK_DECIMAL')
addListTwo(84, 'VK_DIVIDE')
addListTwo(85, 'VK_F1')
addListTwo(86, 'VK_F2')
addListTwo(87, 'VK_F3')
addListTwo(88, 'VK_F4')
addListTwo(89, 'VK_F5')
addListTwo(90, 'VK_F6')
addListTwo(91, 'VK_F7')
addListTwo(92, 'VK_F8')
addListTwo(93, 'VK_F9')
addListTwo(94, 'VK_F10')
addListTwo(95, 'VK_F11')
addListTwo(96, 'VK_F12')
addListTwo(97, 'VK_F13')
addListTwo(98, 'VK_F14')
addListTwo(99, 'VK_F15')
addListTwo(100, 'VK_F16')
addListTwo(101, 'VK_F17')
addListTwo(102, 'VK_F18')
addListTwo(103, 'VK_F19')
addListTwo(104, 'VK_F20')
addListTwo(105, 'VK_F21')
addListTwo(106, 'VK_F22')
addListTwo(107, 'VK_F23')
addListTwo(108, 'VK_F24')
addListTwo(109, 'VK_NUMLOCK')
addListTwo(110, 'VK_SCROLL')
addListTwo(111, 'VK_LSHIFT')
addListTwo(112, 'VK_LCONTROL')
addListTwo(113, 'VK_LMENU')
addListTwo(114, 'VK_RSHIFT')
addListTwo(115, 'VK_RCONTROL')
addListTwo(116, 'VK_RMENU')

lo2 = listbox_getItems(h[2])
strings_clear(lo2) -- Lets clean it up =)
for i = 0,116 do
  strings_add(lo2, ListOneItems[i])
end

function GetHotKey()
if str=="VK_LBUTTON" then
  str = 1
elseif str=="VK_RBUTTON" then
  str = 2
elseif str=="VK_CANCEL" then
  str = 3
elseif str=="VK_MBUTTON" then
  str = 4
elseif str=="VK_BACK" then
  str = 8
elseif str=="VK_TAB" then
  str = 9
elseif str=="VK_CLEAR" then
  str = 12
elseif str=="VK_RETURN" then
  str = 13
elseif str=="VK_SHIFT" then
  str = 16
elseif str=="VK_CONTROL" then
  str = 17
elseif str=="VK_MENU" then
  str = 18
elseif str=="VK_PAUSE" then
  str = 19
elseif str=="VK_CAPITAL" then
  str = 20
elseif str=="VK_ESCAPE" then
  str = 27
elseif str=="VK_SPACE" then
  str = 32
elseif str=="VK_PRIOR" then
  str = 33
elseif str=="VK_NEXT" then
  str = 34
elseif str=="VK_END" then
  str = 35
elseif str=="VK_HOME" then
  str = 36
elseif str=="VK_LEFT" then
  str = 37
elseif str=="VK_UP" then
  str = 38
elseif str=="VK_RIGHT" then
  str = 39
elseif str=="VK_DOWN" then
  str = 40
elseif str=="VK_SELECT" then
  str = 41
elseif str=="VK_PRINT" then
  str = 42
elseif str=="VK_EXECUTE" then
  str = 43
elseif str=="VK_SNAPSHOT" then
  str = 44
elseif str=="VK_INSERT" then
  str = 45
elseif str=="VK_DELETE" then
  str = 46
elseif str=="VK_HELP" then
  str = 47
elseif str=="VK_0" then
  str = 48
elseif str=="VK_1" then
  str = 49
elseif str=="VK_2" then
  str = 50
elseif str=="VK_3" then
  str = 51
elseif str=="VK_4" then
  str = 52
elseif str=="VK_5" then
  str = 53
elseif str=="VK_6" then
  str = 54
elseif str=="VK_7" then
  str = 55
elseif str=="VK_8" then
  str = 56
elseif str=="VK_9" then
  str = 57
elseif str=="VK_A" then
  str = 65
elseif str=="VK_B" then
  str = 66
elseif str=="VK_C" then
  str = 67
elseif str=="VK_D" then
  str = 68
elseif str=="VK_E" then
  str = 69
elseif str=="VK_F" then
  str = 70
elseif str=="VK_G" then
  str = 71
elseif str=="VK_H" then
  str = 72
elseif str=="VK_I" then
  str = 73
elseif str=="VK_J" then
  str = 74
elseif str=="VK_K" then
  str = 75
elseif str=="VK_L" then
  str = 76
elseif str=="VK_M" then
  str = 77
elseif str=="VK_N" then
  str = 78
elseif str=="VK_O" then
  str = 79
elseif str=="VK_P" then
  str = 80
elseif str=="VK_Q" then
  str = 81
elseif str=="VK_R" then
  str = 82
elseif str=="VK_S" then
  str = 83
elseif str=="VK_T" then
  str = 84
elseif str=="VK_U" then
  str = 85
elseif str=="VK_V" then
  str = 86
elseif str=="VK_W" then
  str = 87
elseif str=="VK_X" then
  str = 88
elseif str=="VK_Y" then
  str = 89
elseif str=="VK_Z" then
  str = 90
elseif str=="VK_LWIN" then
  str = 91
elseif str=="VK_RWIN" then
  str = 92
elseif str=="VK_APPS" then
  str = 93
elseif str=="VK_NUMPAD0" then
  str = 96
elseif str=="VK_NUMPAD1" then
  str = 97
elseif str=="VK_NUMPAD2" then
  str = 98
elseif str=="VK_NUMPAD3" then
  str = 99
elseif str=="VK_NUMPAD4" then
  str = 100
elseif str=="VK_NUMPAD5" then
  str = 101
elseif str=="VK_NUMPAD6" then
  str = 102
elseif str=="VK_NUMPAD7" then
  str = 103
elseif str=="VK_NUMPAD8" then
  str = 104
elseif str=="VK_NUMPAD9" then
  str = 105
elseif str=="VK_MULTIPLY" then
  str = 106
elseif str=="VK_ADD" then
  str = 107
elseif str=="VK_SEPARATOR" then
  str = 108
elseif str=="VK_SUBTRACT" then
  str = 109
elseif str=="VK_DECIMAL" then
  str = 110
elseif str=="VK_DIVIDE" then
  str = 111
elseif str=="VK_F1" then
  str = 112
elseif str=="VK_F2" then
  str = 113
elseif str=="VK_F3" then
  str = 114
elseif str=="VK_F4" then
  str = 115
elseif str=="VK_F5" then
  str = 116
elseif str=="VK_F6" then
  str = 117
elseif str=="VK_F7" then
  str = 118
elseif str=="VK_F8" then
  str = 119
elseif str=="VK_F9" then
  str = 120
elseif str=="VK_F10" then
  str = 121
elseif str=="VK_F11" then
  str = 122
elseif str=="VK_F12" then
  str = 123
elseif str=="VK_F13" then
  str = 124
elseif str=="VK_F14" then
  str = 125
elseif str=="VK_F15" then
  str = 126
elseif str=="VK_F16" then
  str = 127
elseif str=="VK_F17" then
  str = 128
elseif str=="VK_F18" then
  str = 129
elseif str=="VK_F19" then
  str = 130
elseif str=="VK_F20" then
  str = 131
elseif str=="VK_F21" then
  str = 132
elseif str=="VK_F22" then
  str = 133
elseif str=="VK_F23" then
  str = 134
elseif str=="VK_F24" then
  str = 135
elseif str=="VK_NUMLOCK" then
  str = 144
elseif str=="VK_SCROLL" then
  str = 145
elseif str=="VK_LSHIFT" then
  str = 160
elseif str=="VK_LCONTROL" then
  str = 162
elseif str=="VK_LMENU" then
  str = 164
elseif str=="VK_RSHIFT" then
  str = 161
elseif str=="VK_RCONTROL" then
  str = 163
elseif str=="VK_RMENU" then
  str = 165
else return showMessage("Really awkward =)")
end
end

function testing()
   if checkbox_getState(UDF1_CECheckbox1)==0 then -- 0 = Unchecked
      checkbox_setState(UDF1_CECheckbox1, 1)
      CECheckbox1()
      sleep(100) --well so it won't toggle to quick
      else
      checkbox_setState(UDF1_CECheckbox1, 0)
      CECheckbox1()
      sleep(100) --well so it won't toggle to quick
   end
end
testhk = createHotkey(testing, nil, nil)

function SettingHotkey()
check = 0
key1 = nil
key2 = nil

    if check==0 then
      In1 = listbox_getItemIndex(h[1])
      if In1<0 then
        key1=nil
        check=1
        else
      str = strings_getString(lo1, In1)
      GetHotKey()
      key1 = str
        check=1
        end
   end

   if check==1 then
      In2 = listbox_getItemIndex(h[2])
      if In2<0 then
        key2=nil
        else
      str = strings_getString(lo2, In2)
      GetHotKey()
      key2 = str
        end
   end

if key1~=nil and key2~= nil then
generichotkey_setKeys(testhk, key1, key2)
elseif key1~=nil and key2==nil then
generichotkey_setKeys(testhk, key1)
elseif key1==nil and key2~=nil then
generichotkey_setKeys(testhk, key2)
else
showMessage("No hotkeys were selected!")
end
end
function Enable()
local bool = (checkbox_getState(UDF1_CECheckbox1)==1)
  timer_setEnabled(StopTimerStatus_Timer, bool)
end

function Disable()
local bool = (checkbox_getState(UDF1_CECheckbox1)==0)
  timer_setEnabled(StopTimerStatus_Timer, bool)
end


control_onClick(h[3],SettingHotkey)



PROT12.CT
 Description:

Download
 Filename:  PROT12.CT
 Filesize:  790.88 KB
 Downloaded:  442 Time(s)

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 Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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