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 


Why my scripts isnt working :( ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
benja14
How do I cheat?
Reputation: 0

Joined: 22 Jun 2015
Posts: 5

PostPosted: Fri Nov 20, 2015 1:00 am    Post subject: Why my scripts isnt working :( ? Reply with quote

This should change Address2 value to "x-value" if Addres1 is > than "target",
if it doesn't change to "x-value2".
Also i want to add a Loop (if someone wants to help me)
Code:
function Main()

local cross = readInteger'Address1'
local attack = readInteger'Address2'
target = 1766523135

if ( cross > target) then
       writeInteger(attack, 128)
else
       writeInteger(attack, 0)
   end
end


Thanks for the help!
Back to top
View user's profile Send private message
Daijobu
Master Cheater
Reputation: 13

Joined: 05 Feb 2013
Posts: 301
Location: the Netherlands

PostPosted: Fri Nov 20, 2015 1:50 am    Post subject: Reply with quote

Loop, pseudo:

Code:
if condition == 1 then
   if ( cross > target ) then
      writeInteger( attack, 128 )
   else
      writeInteger( attack, 0 )
   end
else
   exitmyloop / break /whatever
end

-or-

while (condition == 1) do
   if ( cross > target ) then
      writeInteger( attack, 128 )
   else
      writeInteger( attack, 0 )
   end
end


Just set condition to be toggle-able by you.

Example:

Code:

{$asm}

alloc( conditionvar, 4 )
registersymbol( conditionvar )

{$lua}

condition = getAddress( "conditionvar" )


I've not utilized lua in cheatengine myself so just going by logic here. If I'm mistaken I'll likely be promptly corrected.

_________________
Scripts/tables from scratch. Relation to other scripts is coincidental. Use of posted code is credited properly.
Euro Truck Simulator 2 Backwards Compatible Cheat
American Truck Simulator Backwards Compatible Cheat
Back to top
View user's profile Send private message
benja14
How do I cheat?
Reputation: 0

Joined: 22 Jun 2015
Posts: 5

PostPosted: Fri Nov 20, 2015 12:58 pm    Post subject: Reply with quote

Still doesnt work :v
If u got an idea to make it work with other way im open to hear
it doesnt need to be in lua
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Nov 20, 2015 4:20 pm    Post subject: Reply with quote

Did you register "Address1" and "Address2" properly?
Is "Address2" a pointer to some address? Cause that's how you're using it.
Are you actually executing "Main()" someplace?
What does "isn't working" mean?
Are there errors?
Is the address being set to the wrong value?
Does nothing change at all?
Back to top
View user's profile Send private message
benja14
How do I cheat?
Reputation: 0

Joined: 22 Jun 2015
Posts: 5

PostPosted: Fri Nov 20, 2015 8:13 pm    Post subject: Reply with quote

Im sorry for too many question..

My complete scripts is what i write before.

If i dont use pointer in the address it will not work? Sad

Im new in this stuff..

I write some code in C++ and i succesfully compile it but still doesnt change the address value..
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