|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
AntonVit Advanced Cheater Reputation: 0
Joined: 25 Jan 2014 Posts: 73
|
Posted: Thu Jan 12, 2017 12:31 am Post subject: EditBox Value Protect |
|
|
Hi alll
Is this possible to ptotect EditBox value from wrong text
For example
Editbox must have only values
1 , 2 , 3 , 4
or
-1 , -2 , -3 , -4
or
1.1 , 2.1 , 3.1
or
-1.1 , -2.1 , -3.1
or
0.123
or
-0.123
For apply its value will be create button. So if text will be have
value like these
abc
or
abc1
or
.1 , .2 , .3
or
-.1 , -.2 , -.3
or
000.1 , 00.2 , 00-1.2
and some like these, must be show messabe "wrong value, cant be appled"
So, need protect editbox from wrong values. Must be only numbers, currently number, integer. float, negative values.
|
|
Back to top |
|
|
akumakuja28 Master Cheater Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Thu Jan 12, 2017 2:05 am Post subject: |
|
|
Code: |
f = createForm()
e = createEdit(f)
e.left = 200
e.top = 70
function check()
for w in string.gmatch (e.text, "%a+") do
print ("no letter")
end
if e.text > '4' then
print("Too High")
elseif e.text > '-4' then
print('Too Low')
end
end
e.OnChange = check
|
_________________
|
|
Back to top |
|
|
AntonVit Advanced Cheater Reputation: 0
Joined: 25 Jan 2014 Posts: 73
|
Posted: Thu Jan 12, 2017 3:48 am Post subject: |
|
|
akumakuja28 wrote: | Code: |
f = createForm()
e = createEdit(f)
e.left = 200
e.top = 70
function check()
for w in string.gmatch (e.text, "%a+") do
print ("no letter")
end
if e.text > '4' then
print("Too High")
elseif e.text > '-4' then
print('Too Low')
end
end
e.OnChange = check
|
|
Thank, but i still can use value like
.1
/0
I used this script for protect from abc and /*&
Code: | function KEYPROTECTcarset(sender, key)
local keynr=string.byte(key)
if (keynr~=8) and (keynr~=45) and (keynr~=46) and ((keynr<48) or (keynr>57)) then
key=nil
end
return key
end |
With this code i can write to editbox only numbers and i can use only button delete and - and . and backspace
But i still can write wrong value and CE give me error or game freeze and crash
This value for example
.012
00.12
0.-12
0.12-
1-2-3-
and other combinations like this
**********************************************************
Now work fine
I use XYZ teleport from 3 Editboxes values
CE automaticly correct value
from
.12
to
0.12
or
from
12.
to
12.0
or
from
-.1
to
-0.1
Also it set always 0 if value
12-
1-2
1-.1
1--1
and with other not corect value CE set globalalloc to 0
So, with protect for teleport if globalalloc = 0 i can use it Editboxes very well
Code: |
LUA---------------------1---------------------
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
writeFloat("PLACEeditbocesCoords",Dirt_Rally_Packer.CEEdit2.Text)
writeFloat("PLACEeditbocesCoords+4",Dirt_Rally_Packer.CEEdit3.Text)
writeFloat("PLACEeditbocesCoords+8",Dirt_Rally_Packer.CEEdit4.Text)
AA---------------------2---------------------
globalalloc(PLACEeditbocesCoords,2000)
.....
cmp [PLACEeditbocesCoords],#0
je @f
cmp [PLACEeditbocesCoords+4],#0
je @f
cmp [PLACEeditbocesCoords+8],#0
je @f
.....create teleporting
@@:
..... |
|
|
Back to top |
|
|
akumakuja28 Master Cheater Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Thu Jan 12, 2017 3:02 pm Post subject: |
|
|
Code: |
f = createForm()
e = createEdit(f)
e.left = 200
e.top = 70
la = createLabel(f)
la.Left = 40
la.Top = 70
function check()
local Num = tonumber(e.text)
la.Caption = "Valid Number"
if Num == nil then
la.Caption = "Not a Valid Number"
end
end
e.OnChange = check
|
Here ya go. Throw a brother a Rep (just kidding unless your gonna do it).
This should work exactly as expected. I was very confused at what you wanted in the initial post. Might not be your fault i have my learning disabilities
Code: |
f = createForm()
e = createEdit(f)
e.left = 200
e.top = 70
e2 = createEdit(f)
e2.left = 200
e2.top = 100
e3 = createEdit(f)
e3.left = 200
e3.top = 130
function check(sender)
local Num = tonumber(sender.text)
sender.font.color = "0x00ff0000"
if Num == nil then
sender.font.color = "0x000000ff"
end
end
e3.OnChange = check
e2.OnChange = check
e.OnChange = check
|
_________________
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Jan 12, 2017 5:24 pm Post subject: |
|
|
To give you some other coding ideas: Code: | local values = {
"1 , 2 , 3 , 4",
"-1 , -2 , -3 , -4",
"1.1 , 2.1 , 3.1",
"-1.1 , -2.1 , -3.1",
"0.123",
"-0.123",
"abc",
"abc1",
".1 , .2 , .3",
"-.1 , -.2 , -.3",
"000.1 , 00.2 , 00-1.2"
}
function fixNumber(value)
local fixed = ""
for split in value:gmatch("[^,]+") do
local number = tonumber(split)
if number == nil then
return nil
end
if #fixed > 0 then
fixed = fixed .. " , "
end
fixed = fixed .. number
end
return fixed
end
for _,value in ipairs(values) do
print("*****")
print(value)
print(fixNumber(value) or "Invalid Number")
end |
|
|
Back to top |
|
|
akumakuja28 Master Cheater Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Thu Jan 12, 2017 6:01 pm Post subject: |
|
|
@Zanzer . Glad im not the only one who interpreted the original post tht way. I think he wants edit boxes for map coords with "protection" against non float values.
_________________
|
|
Back to top |
|
|
AntonVit Advanced Cheater Reputation: 0
Joined: 25 Jan 2014 Posts: 73
|
Posted: Fri Jan 13, 2017 12:55 am Post subject: |
|
|
Thank akumakuja28
Zanzer wrote: | To give you some other coding ideas: Code: | local values = {
"1 , 2 , 3 , 4",
"-1 , -2 , -3 , -4",
"1.1 , 2.1 , 3.1",
"-1.1 , -2.1 , -3.1",
"0.123",
"-0.123",
"abc",
"abc1",
".1 , .2 , .3",
"-.1 , -.2 , -.3",
"000.1 , 00.2 , 00-1.2"
}
function fixNumber(value)
local fixed = ""
for split in value:gmatch("[^,]+") do
local number = tonumber(split)
if number == nil then
return nil
end
if #fixed > 0 then
fixed = fixed .. " , "
end
fixed = fixed .. number
end
return fixed
end
for _,value in ipairs(values) do
print("*****")
print(value)
print(fixNumber(value) or "Invalid Number")
end |
|
Thanks, but i mean some another idea when wrote this -
Editbox must have only values
1 , 2 , 3 , 4
or
-1 , -2 , -3 , -4
I mean type of values like this
1 , 2 , 3 , 4
or
-1 , -2 , -3 , -4
So, your script can be very big script, couse it can be milions and more values
1, 2 , 3 , 4 ...... , 1000000
Sorry for my bad explayning,
Anyway, i find what i want, and yestarday i tested it, work i think normal
In first CE copy values from Editbox(X) to Alloc(Not coords alloc) (If value wrong or it text, CE automaticly set value in adress - 0
In second if Alloc(Not coords alloc)== 0, CE skip write it value to Alloc of Coord and show message (or change color of it editbox to red)
if Alloc(Not coords alloc)~= 0, CE copy value from Alloc(Not coords alloc) to Alloc of Coord
Code: | function CEButton6Click(sender)
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
writeFloat("PLACEeditbocesCoords+100",Dirt_Rally_Packer.CEEdit2.Text)
writeFloat("PLACEeditbocesCoords+104",Dirt_Rally_Packer.CEEdit3.Text)
writeFloat("PLACEeditbocesCoords+108",Dirt_Rally_Packer.CEEdit4.Text)
end end end end
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
if readInteger("PLACEeditbocesCoords+100") == 0 then
Dirt_Rally_Packer.CEEdit2.Color = "$00999DE6"
end end end end end
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
if readInteger("PLACEeditbocesCoords+104") == 0 then
Dirt_Rally_Packer.CEEdit3.Color = "$00999DE6"
end end end end end
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
if readInteger("PLACEeditbocesCoords+108") == 0 then
Dirt_Rally_Packer.CEEdit4.Color = "$00999DE6"
end end end end end
if readFloat("PLACEeditbocesCoords") ~= nil then
if Dirt_Rally_Packer.CEEdit2.Text ~= "" then
if Dirt_Rally_Packer.CEEdit3.Text ~= "" then
if Dirt_Rally_Packer.CEEdit4.Text ~= "" then
if readInteger("PLACEeditbocesCoords+100") ~= 0 then
if readInteger("PLACEeditbocesCoords+104") ~= 0 then
if readInteger("PLACEeditbocesCoords+108") ~= 0 then
writeFloat("PLACEeditbocesCoords",Dirt_Rally_Packer.CEEdit2.Text)
writeFloat("PLACEeditbocesCoords+4",Dirt_Rally_Packer.CEEdit3.Text)
writeFloat("PLACEeditbocesCoords+8",Dirt_Rally_Packer.CEEdit4.Text)
Dirt_Rally_Packer.CEEdit2.Color = "$00CAEEBF"
Dirt_Rally_Packer.CEEdit3.Color = "$00CAEEBF"
Dirt_Rally_Packer.CEEdit4.Color = "$00CAEEBF"
end end end end end end end
end |
In third, if i press hotkey in game, and if Alloc of Coord ~= 0, my car have teleport
[/quote]
|
|
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
|
|