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  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Tue Apr 23, 2013 12:00 pm    Post subject: Reply with quote

mm not sure if its setting the state.
Before the function was just asking for state and i still had access error

if i take out that function i am able to write whatever into CEEdit boxes, so i assume it has something to do with that function, or whatever function that is calling for UDF2_clickbox1 state.

ill re make a trainer make new objects and re type Lua code. If it doesnt work ill look into setProperty()

ty, btw. lol
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 23, 2013 12:36 pm    Post subject: Reply with quote

what is clickbox1?
The Access violation probably because of clickbox1

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Tue Apr 23, 2013 1:18 pm    Post subject: Reply with quote

Flash hacker wrote:
what is clickbox1?
The Access violation probably because of clickbox1


sorry i meant UDF2_CECheckbox1

k, so here is the script...
simple print("hi") function and trying to set user input hotkey



prototest.CT
 Description:
Function print hello

Download
 Filename:  prototest.CT
 Filesize:  393.2 KB
 Downloaded:  1724 Time(s)

Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 23, 2013 1:53 pm    Post subject: Reply with quote

Use this
Code:
checkbox_setAllowGrayed(UDF1_CECheckbox1, false)

form_show(UDF1)
form_centerScreen(UDF1)--because its located -979 or somethning >.<


FirstKey=nil
SecondKey=nil

function ToggleCheckBoxStatus()
   print("test")
end

ToggleCheckBoxHotkey=createHotkey(ToggleCheckBoxStatus, nil)

function CEEdit1Change(sender)
  if (control_getCaption(UDF2_CEEdit1)=="CONTROL") then
    FirstKey=VK_CONTROL
    if FirstKey==nil or SecondKey==nil then return end
    generichotkey_setKeys(ToggleCheckBoxHotkey, FirstKey, SecondKey)
    end
end


function CEEdit2Change(sender)
 if (control_getCaption(UDF2_CEEdit2)=="F1") then
    SecondKey=VK_F1
    if FirstKey==nil or SecondKey==nil then return end
    generichotkey_setKeys(ToggleCheckBoxHotkey, FirstKey, SecondKey)
    end
end

function CECheckbox1Change(sender)
   Timer_enabledOrDisabled = (checkbox_getState(sender)==1)
    timer_setEnabled(StopTimerStatus_Timer, Timer_enabledOrDisabled) -- creates a timer if clicked true
end

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

function myONtimerFunc()
   print("hi")
end

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,1000)

function CELabel1Click(sender)
form_show(UDF2)
end

--function ToggleCheckBoxHotkey(sender)
--checkbox_setState(UDF1_CECheckbox1, not checkbox_getState(UDF1_CECheckbox1))
--end

The access violation reason is
Code:
function ToggleCheckBoxHotkey(sender)
checkbox_setState(UDF1_CECheckbox1, not checkbox_getState(UDF1_CECheckbox1))
end

p.s
I edited it little bit to check and figure out where&what the error.
Change it the way you want.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Tue Apr 23, 2013 2:15 pm    Post subject: Reply with quote

i know :/
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 23, 2013 3:21 pm    Post subject: Reply with quote

btw what you did is working fine with setting 'custom' hotkeys =).
_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Tue Apr 23, 2013 3:37 pm    Post subject: Reply with quote

Flash hacker wrote:
btw what you did is working fine with setting 'custom' hotkeys =).


what do you mean ? code is working for you ?
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 23, 2013 4:01 pm    Post subject: Reply with quote

This does work
Code:
FirstKey=nil
SecondKey=nil

function ToggleCheckBoxStatus()
   print("test")
end

ToggleCheckBoxHotkey=createHotkey(ToggleCheckBoxStatus, nil)

function CEEdit1Change(sender)
  if (control_getCaption(UDF2_CEEdit1)=="CONTROL") then
    FirstKey=VK_CONTROL
    if FirstKey==nil or SecondKey==nil then return end
    generichotkey_setKeys(ToggleCheckBoxHotkey, FirstKey, SecondKey)
    end
end


function CEEdit2Change(sender)
 if (control_getCaption(UDF2_CEEdit2)=="F1") then
    SecondKey=VK_F1
    if FirstKey==nil or SecondKey==nil then return end
    generichotkey_setKeys(ToggleCheckBoxHotkey, FirstKey, SecondKey)
    end
end

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Apr 23, 2013 4:48 pm    Post subject: Reply with quote

@iroku, I would help you if I could find more free time.

Currently I have fun with D3DHook. I never tried this before, I only tested tutorial scripts (without understanding). So, for now, I'm absorbed with D3D.

When I finish D3D training, I will try to help you with those hotkeys.

I have side (unfinished) project, I'm making "save settings & custom hotkeys" script anyway, unfortunately, it will probably only work with newest CheatEngine. Save settings part is finished.



@Flash hacker, hi. Well, as you see, I started learning how to create "D3D Trainer" with CE6.2+. Currently I'm on my Borderlands2 project, my D3D training. It will be compass pointing to hidden "Vault Symbols". After I finish this I will back to "save settings & custom hotkeys".

_________________
Back to top
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 23, 2013 6:19 pm    Post subject: This post has 1 review(s) Reply with quote

mgr.inz.Player wrote:
@iroku, I would help you if I could find more free time.

Currently I have fun with D3DHook. I never tried this before, I only tested tutorial scripts (without understanding). So, for now, I'm absorbed with D3D.

When I finish D3D training, I will try to help you with those hotkeys.

I have side (unfinished) project, I'm making "save settings & custom hotkeys" script anyway, unfortunately, it will probably only work with newest CheatEngine. Save settings part is finished.



@Flash hacker, hi. Well, as you see, I started learning how to create "D3D Trainer" with CE6.2+. Currently I'm on my Borderlands2 project, my D3D training. It will be compass pointing to hidden "Vault Symbols". After I finish this I will back to "save settings & custom hotkeys".

Cool mate =)
You probably gonna take it to the next level =P.

P.S
Heres an working script, if you could edit it in a better way, like looping better than I do, it would be great + adding this http://forum.cheatengine.org/viewtopic.php?t=564464 to it.

Alright here something that should work for you to set hotkeys =).
Change edit it the way you want.
And edit the hotkey name
Code:
--hotkey form
h     = {}
h[0]  = createForm()
h[1]  = createListBox(h[0])
h[2]  = createListBox(h[0])
h[3]  = createButton(h[0])

control_setSize(h[0], 250,155)
x,y = control_getSize(h[0])
control_setSize(h[1], (x-10)/2,y-40)
control_setSize(h[2], (x-10)/2,y-40)
control_setPosition(h[1],5,2)
x,y = control_getPosition(h[1])
we,he = control_getSize(h[1])
control_setPosition(h[2],x+we+1,y)
we,he = control_getSize(h[0])
control_setPosition(h[3],we-78, he-30)
setProperty(h[0], 'BiDiMode', 'bdLeftToRight')
control_setCaption(h[3],'Set Hotkeys!')
control_setCaption(h[0],'Change Hotkeys')

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()
print("yup working")
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

control_onClick(h[3],SettingHotkey)

_________________
I'm rusty and getting older, help me re-learn lua.


Last edited by daspamer on Wed Apr 24, 2013 12:55 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Wed Apr 24, 2013 12:10 pm    Post subject: Reply with quote

problem remains.

See your script has a list of hotkeys(true its all the VK variables) but it setting hotkeys to function print "hello"

Not, setting hotkeys to start the function that print "hello"

in this case what triggers the function print "hello" is a togglebox/clickbox

so your code should be setting hotkeys to enable/desable the togglebox/clickbox. and when the clickbox is enabled, it prints "hello"

sure doesnt sound like it makes a difference in this case. But, if instead of print "hello" on hotkey function i have control_getState something, than i get the acess violoation error.

see your code works and so does the previous posted code. what doesnt work is the function itself. if the function was a simple print "" it would work. But if you ask to getState of a clickbox it causes an error.

I dont know if its the same with other objects.

so i was thinking, what if, instead of having a function that checks for state and does something and then have the hotkey function call for it
have a code that simulates left mouse button click on the clickbox

ex:

Code:
function CECheckbox1Change(sender)
Timer_enabledOrDisabled = (checkbox_getState(sender)==1)
  timer_setEnabled(StopTimerStatus_Timer, Timer_enabledOrDisabled) -- creates a timer if clicked true
 end


the checkbox on change(sender) event function checks for state 1 and starts a timer bla bla bla

the function is
Code:

function test()
print "hello"
end


ok, i click on clickbox it prints herro


now instead of having

Code:

testhk = createHotkey(CECheckbox1Change(sender)
, nil, nil)


the hotkey is calling for the Checkbox(sender) function (that is doing a getState and doesnt work, if it was doing a print, it would work)

i have the hotkey function calling for:

Code:

functiion mouseclick()
 doKeyPress(VK_LBUTTON) on checkbox1
end


and hotkey function would be:

Code:
esthk = createHotkey("mouseclick", nil, nil)


is this possible ?
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Apr 24, 2013 12:53 pm    Post subject: Reply with quote

Just add to the testing functions
Code:
--hotkey form
h     = {}
h[0]  = createForm()
h[1]  = createListBox(h[0])
h[2]  = createListBox(h[0])
h[3]  = createButton(h[0])

control_setSize(h[0], 250,155)
x,y = control_getSize(h[0])
control_setSize(h[1], (x-10)/2,y-40)
control_setSize(h[2], (x-10)/2,y-40)
control_setPosition(h[1],5,2)
x,y = control_getPosition(h[1])
we,he = control_getSize(h[1])
control_setPosition(h[2],x+we+1,y)
we,he = control_getSize(h[0])
control_setPosition(h[3],we-78, he-30)
setProperty(h[0], 'BiDiMode', 'bdLeftToRight')
control_setCaption(h[3],'Set Hotkeys!')
control_setCaption(h[0],'Change Hotkeys')

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()
print("yup working")
   if checkbox_getState(UDF1_CECheckbox1)==0 then -- 0 = Unchecked
       checkbox_setState(UDF1_CECheckbox1, 1)
       Enable() --calls the Enable function
       else
       checkbox_setState(UDF1_CECheckbox1, 0)
       Disable() --calls the Disable function
   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()
print'ON'
end

function Disable()
print'OFF'
end

control_onClick(h[3],SettingHotkey)

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Wed Apr 24, 2013 1:12 pm    Post subject: Reply with quote

that enables/desables state

doesnt start
Code:
function CECheckbox1Change(sender)
Timer_enabledOrDisabled = (checkbox_getState(sender)==1)
  timer_setEnabled(StopTimerStatus_Timer, Timer_enabledOrDisabled) -- creates a timer if clicked true
 end


i tried changing it to

Code:

function CECheckbox1Change()
local bool = (checkbox_getState(UDF1_CECheckbox1)==1)
  timer_setEnabled(StopTimerStatus_Timer, bool)
end
checkbox_onChange(UDF1_CECheckbox1, "CECheckbox1Change")


so that it doesnt matter if its sender or not.

but its same... wont work...
even with your func added.

reposted trainer, i keep working on my 2nd moniter and form pops out on 2nd moniter as well.



prototest.CT
 Description:

Download
 Filename:  prototest.CT
 Filesize:  405.62 KB
 Downloaded:  1677 Time(s)

Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Apr 24, 2013 1:26 pm    Post subject: Reply with quote

Copy-paste this into your LUA engine.
Code:
checkbox_setAllowGrayed(UDF1_CECheckbox1, false)

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

function myONtimerFunc()
  print("hi")
  end



function CECheckbox1Change()
local bool = (checkbox_getState(UDF1_CECheckbox1)==1)
  timer_setEnabled(StopTimerStatus_Timer, bool)
end
checkbox_onChange(UDF1_CECheckbox1, "CECheckbox1Change")



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,1000)



--hotkey form
h     = {}
h[0]  = createForm()
h[1]  = createListBox(h[0])
h[2]  = createListBox(h[0])
h[3]  = createButton(h[0])

control_setSize(h[0], 250,155)
x,y = control_getSize(h[0])
control_setSize(h[1], (x-10)/2,y-40)
control_setSize(h[2], (x-10)/2,y-40)
control_setPosition(h[1],5,2)
x,y = control_getPosition(h[1])
we,he = control_getSize(h[1])
control_setPosition(h[2],x+we+1,y)
we,he = control_getSize(h[0])
control_setPosition(h[3],we-78, he-30)
setProperty(h[0], 'BiDiMode', 'bdLeftToRight')
control_setCaption(h[3],'Set Hotkeys!')
control_setCaption(h[0],'Change Hotkeys')

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)
      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
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)

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
iroku
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2012
Posts: 54

PostPosted: Wed Apr 24, 2013 1:36 pm    Post subject: Reply with quote

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...
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  Next
Page 2 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