View previous topic :: View next topic |
Author |
Message |
herrick92 Newbie cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 17
|
Posted: Fri Dec 16, 2016 4:01 am Post subject: Help with lua scripting |
|
|
I want to make a trainer that if i put a number on the box, the script will read the number.
Can someone help me with the lua script? thank you
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4657
|
Posted: Fri Dec 16, 2016 9:50 am Post subject: |
|
|
Use either the OnChange event or the OnExit event. The OnChange event will be called whenever the text of the editbox is changed, while the OnExit event will be called when the editbox looses focus.
Code: | function CEEdit1Change(sender)
print(tonumber(sender.Text))
end |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
herrick92 Newbie cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 17
|
Posted: Fri Dec 16, 2016 1:11 pm Post subject: |
|
|
what im trying to do is like for example when i put number in the box, another script will use that number for the script.
so lets say i put 50
then another script is like when "this address" value is below 50 then send keystroke B.
does that make sense?
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4657
|
Posted: Fri Dec 16, 2016 1:59 pm Post subject: |
|
|
Code: | function CEEdit1Change(sender)
someGlobal = tonumber(sender.Text) or someGlobal
end |
Code: | -- somewhere else
if someGlobal < 50 then doKeyPress(VK_B) end |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
herrick92 Newbie cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 17
|
Posted: Fri Dec 16, 2016 7:40 pm Post subject: |
|
|
thank you! i will try doing the full script later
*edit: actually i dont want to write 50 on the script, what i meant is that whatever number i put on the box, the script will automatically get that number
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Fri Dec 16, 2016 7:51 pm Post subject: |
|
|
Code: | getfrEdit = control_getCaption(UDF1.CEEdit1)
if tonumber(getfrEdit) == nil or type(getfrEdit) == 'string' then
showMessage('Input is not number')
end
if type(getfrEdit) == "number" and getfrEdit < 50 then --- remove "and getfrEdit < 50 to allow input any number
doKeyPress(VK_B)
//.... or do stuff here
end |
|
|
Back to top |
|
 |
herrick92 Newbie cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 17
|
Posted: Fri Dec 16, 2016 7:53 pm Post subject: |
|
|
@Corroder
Some misunderstanding, my bad.
I dont want the script to write anything about 50, I meant that whatever number i put on the box will be use by another script.
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Fri Dec 16, 2016 7:55 pm Post subject: |
|
|
see on that script it said :
Code: | --- remove "and getfrEdit < 50" to allow input any number |
that mean user can input what ever number as user want on edit box. then this is script :
Code: | getfrEdit = control_getCaption(UDF1.CEEdit1)
if tonumber(getfrEdit) == nil or type(getfrEdit) == 'string' then
showMessage('Input is not number')
end
if type(getfrEdit) == "number" then
doKeyPress(VK_B)
//.... or do stuff here
end |
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 61
Joined: 01 Oct 2008 Posts: 958
|
Posted: Fri Dec 16, 2016 8:14 pm Post subject: |
|
|
Using ParkourPenguin's code
Code: | function CEEdit1Change(sender)
MinimumSpeed = tonumber(sender.Text) or MinimumSpeed or 0
end |
Code: | -- somewhere else
MinimumSpeed = MinimumSpeed or 0 -- in case MinimumSpeed not initialized as number type yet
if MinimumSpeed > readFloat"BusSpeed" or 99999999 --[[if not readable, do nothing]] then doKeyPress(VK_B) end |
btw, Edit should use Text instead of Caption.
_________________
- Retarded. |
|
Back to top |
|
 |
herrick92 Newbie cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 17
|
Posted: Fri Dec 16, 2016 9:12 pm Post subject: |
|
|
thanks guys, lemme play with it for a bit.
im really new to lua scripting and its hard to make it works right away
|
|
Back to top |
|
 |
|