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 


[help] i need 4 things pls reply with scripts

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  

is it easy to do?
yes
100%
 100%  [ 4 ]
no
0%
 0%  [ 0 ]
Total Votes : 4

Author Message
hackerd00mer
How do I cheat?
Reputation: 0

Joined: 24 Feb 2018
Posts: 2

PostPosted: Sat Feb 24, 2018 7:49 am    Post subject: [help] i need 4 things pls reply with scripts Reply with quote

1.how to convert a float value in my ct to a variable
2.how to put that float value inside a cecaption (following the divide 32 rule)
3.how to have the float variable divide by 32 before writing/reading
4.how to make the value editable in ceedit (following the divide 32 rule)

_________________
Hello, I am hackerd00mer. I am a newbie to CE.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Sat Feb 24, 2018 8:04 pm    Post subject: Reply with quote

Before goes to answer your questions, first we talk is about you mean with "divide 32 rule". Correct me if I misunderstood.
On my understanding, 32 rule is :

a fraction (23 bits), an exponent (8 bits), and a sign (1 bit) from a number. so that the number is approximately equal to (in Lua) :

Code:
math.ldexp(fraction, exponent - 127) * (sign == 1 and -1 or 1)


and then packs the generated values into 32 bits.

So, a better way to pack numbers is the IEEE754 single-precision floating-point format in Lua
But, a certain function in the math library in Lua say :

Code:
The frexp function breaks down the floating-point value (v) into a mantissa (m) and an exponent (n), such that the absolute value of m is greater than or equal to 0.5 and less than 1.0, and v = m * 2^n.

 Note that math.ldexp is the inverse operation.


However, the mantissa returned by this function is not an integer.

So, let we go to discuss your question one by one (make attention, I'm not answer your questions, it's more like a discuss).

1. how to convert a float value in my ct to a variable ?
What is a variable ?. A Variable is an element, feature, or factor that is liable to vary or change. In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction s that tell the computer what to do and data that the program uses when it is running.
So in other way a variables or variables is part of data.

As same as data, a variable contain : value, type an given name.
In your case : we know your value is float, so float type is number and then to store that float value as a variable, we need give it a name.

Code:
example :
myVar = 2 / 7.5  --> result is 0.26666666666667  is a floating value
myVar = variable name
myVar type  = math operation = float = number


So, in your case to 'CONVERT' a float value to a variable, just do :
Code:

your_variable_name = your_float_value


in CT, to give name as a variable, double-click description field and change description with yours.


2.how to put that float value inside a cecaption (following the divide 32 rule) ?
This 'cecaption', need more references about this mean. Is this 'cecaption' put inside a CE Trainer or where ?.
Anyhow, because this said 'caption', then this mean type of text or string and because float value type is number, then we need convert float number to string.

Code:
Example using CE 6.7 which has adapted Lua 5.3 (should be give different result if use Lua 5.1 / Lua 5.2)

x = 2 / 7.5
print(x)             ----> result : 0.26666668057442
print(type(x))    ----> result : number

x1 = tostring(x)
print(x1)           ----> result : 0.26666668057442
print(type(x1))  ----> result : string

--- next we can use : cecaption.Caption = tostring(your float value)


But, I'm not sure x = 2 / 7.5 result is a float value. It more as a integer value. Note : in Lua all number should be adapted as integer value.
To get accurate precision number from result of 2 / 7.5 should be use IEEE754 single-precision floating-point format as mentioned above.


3.how to have the float variable divide by 32 before writing/reading ?
I am skip this. Need more detail references.

4.how to make the value editable in ceedit (following the divide 32 rule)
Point to no.2 above, ceedit also type a text / string by CE default. To convert string to number we use common CE Lua command 'tonumber(string)'

Code:
Test :
z = '2.345343235434767'
print(type(z))              ----> result : string
z1 = tonumber(z)       
print(z1)                     ---->  result : 2.345343235434767
print(type(z1))            ---->  result : number

y = 3E-5
print(type(y))           ---->  result : number

y = '3E-5'
print(type(y))          ----> result : string
y1 = tonumber(y)
print(y1)                 ----> result : 3e-005
print(type(y1))        ---->  result : number

more ='hahaha'
more_n_more = tonumber(more)   
print(more_n_more)             ------> result : nil
print(type(more_n_more))   -------> result : empty (unexpected)

_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
Lynxz Gaming
Advanced Cheater
Reputation: 1

Joined: 01 Jul 2017
Posts: 64

PostPosted: Sun Feb 25, 2018 4:11 am    Post subject: Re: [help] i need 4 things pls reply with scripts Reply with quote

hackerd00mer wrote:
1.how to convert a float value in my ct to a variable
2.how to put that float value inside a cecaption (following the divide 32 rule)
3.how to have the float variable divide by 32 before writing/reading
4.how to make the value editable in ceedit (following the divide 32 rule)



loooollll hi

_________________
Hello Hitler !
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