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 


getting range address and alignment paramater from text box

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Feb 02, 2017 6:31 am    Post subject: getting range address and alignment paramater from text box Reply with quote

Hi there,

Code:
startAdd = UDF1.CEEdit1.Text  --- default text is 0 or 0x0
stopAdd = UDF1.CEEdit2.Text  --- default text is 0xffffffffffffffff
vAlign = UDF1.CEEdit3.Text    --- default is empty text


-- Method :
-- firstScan(scanoption, vartype, roundingtype, input1, input2 ,startAddress ,stopAddress ,
--               protectionflags ,alignmenttype ,"alignmentparam" ,isHexadecimalInput ,
--              isNotABinaryString, isunicodescan, iscasesensitive);


How I get startAdd, stopAdd and vAlign since they state as string input from text boxes, so i can use them properly as firstScan method ?


Code:
if startAdd == "0" or startAdd == "0x0" then
 stardAdd = 0x0       ------------ give result 0
end

if stopAdd == "0xffffffffffffffff" then
 stopAdd = 0xffffffffffffffff       ----------- give result -1
end

if vAlign == "" then
 vAlign = tonumber("0")
 vAlign = string.format('"'..vAlign..'"')    ------- give result Error:"$"0"" is an invalid integer
 else
 vAlign = string.format('"'..tonumber(vAlign)..'"')
 end


-- syntax format must be e.q :
-- firstScan(scanoption, vartype, roundingtype, input1, input2 , "0", "0xffffffffffffffff", protectionflags,
alignmenttype, "4", false, false, false, false)

thanks
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Feb 02, 2017 6:45 am    Post subject: Reply with quote

Code:
startAdd = tonumber(startAdd)
stopAdd = tonumber(stopAdd)
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Thu Feb 02, 2017 7:10 am    Post subject: Reply with quote

firstScan will interpret string type addresss with getAddress like function automatically, just like address usage in AA script (not lua prefix 0x for hexidecimal, "100" will interpret as 256 numeric value).
It is not likely user have to input a decimal address, so probably no conversion need.
But you may check the address's validity before actually do the scan,
so that user can fix it in case of invalid input, (I've not checked, but firstScan seem not report error if addresses are invalid, may just fallback to default value)

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Thu Feb 02, 2017 7:23 am    Post subject: Reply with quote

on a quick glance i see you're not providing vInput2 when it's empty, you should
_________________
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
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Thu Feb 02, 2017 11:26 am    Post subject: Reply with quote

Make some test on inputs for start/end address, some probably irrelevant note:
Code:

If input is an integer, then the address is the numeric value;
If input is a string, then
  it should be evaluate with the backend function of GetAddress,
    if GetAddress cannot determined what the string input means,
      if errorOnLookupFailure state is true, an error will spawn,
      if errorOnLookupFailure state is false, it will return the address as 0,
      note if it is endAddress, likely no result will be found as the scan range is zero length.
    otherwise, the integer result is the address.
if startAddress+scanLength (4 for integer etc) > endAddress, no result will be found as the scan range is zero length.

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Feb 02, 2017 6:21 pm    Post subject: Reply with quote

Thanks DB...

Code:
if vInput2 == "" then
 memscan.firstScan(vScanOption, vVartype, vRounding, vInput1, nil,
                   startAdd, stopAdd, protect, vAlignment, alignparam,
                   isHex, isNotBin, isUniCode, isCaseSen)
 else
 memscan.firstScan(vScanOption, vVartype, vRounding, vInput1, vInput2,
                   startAdd, stopAdd, protect, vAlignment, alignparam,
                   isHex, isNotBin, isUniCode, isCaseSen)
 end



And thank panraven for told what to do, mean while i use :

Code:
memscan.firstScan(vScanOption, vVartype, vRounding, vInput1, vInput2,
                   0, 0xffffffffffffffff, protect, vAlignment, alignparam,
                   isHex, isNotBin, isUniCode, isCaseSen)



Until found the way to check all variables needed to do scan and until found how to define and get specific address given by user via text box.

first i need check is types for each vars :

fscanoption, vartype, roundingtype, protectionflags, alignmenttype = defined by CE already
input1 = string (or number)
input2 = string (or number), nil if not require
startAddress, stopAddress = ??
alignmentparam = number or (string number ?)
isHexadecimalInput , isNotABinaryString, isunicodescan, iscasesensitive = boelan

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