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 


Script works inside CE but not when exported as exe

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

Joined: 09 Nov 2020
Posts: 2

PostPosted: Mon Nov 09, 2020 5:27 pm    Post subject: Script works inside CE but not when exported as exe Reply with quote

As the title says I have a script that works when ran from the lua script section of cheat engine but not when saved as an exe and im not too sure why its happening or how to fix it. (Im still pretty new to this so please excuse if the code is bad)

Code:

function WheelPlacementScan()
    ms = createMemScan(FMT_WheelPlacement.ProgressBar)
    ms.firstScan(soExactValue, vtByteArray, nil,"00 b0 ? ? ? ? 7f ? 00 80 ? ? ? ? 7f ? 00 b0 ? ? ? ? 7f ? 00 c0 f8 ? ? ? 7f ? 00 30 f9 ? ? ? 7f ? 00 40 ? ? ? ? 7f ? 00 90 ? ? ? ? 7f ? 00 80 ? ? ? ? 7f ? 00 e0", nil ,0 ,0xffffffffffffffff ,'+W-C', fsmNotAligned ,nil ,true ,true, false, false)
    ms.waitTillDone()
    local fl = createFoundList(ms)
    fl.initialize()
    BaseAddress="0x" .. ms.FoundList[0]
    FMT_WheelPlacement.ProgressBar.Position = FMT_WheelPlacement.ProgressBar.Min
    mr1=getAddressList().createMemoryRecord()
    mr1.description="Front Track Width"
    mr1.address="BaseAddress - 87"
    mr1.OffsetCount=7
    mr1.OffsetText[6]="98"
    mr1.OffsetText[5]="40"
    mr1.OffsetText[4]="0"
    mr1.OffsetText[3]="138"
    mr1.OffsetText[2]="30"
    mr1.OffsetText[1]="10"
    mr1.OffsetText[0]="254"
    mr1.Vartype=vtSingle
    FMT_WheelPlacement.TrackWidthFEdit.Text = mr1.Value
end


This code works properly and outputs the correct value to the ui element I want while in cheat engine but when exported as an exe it will only return ?? to the ui element and after some troubleshooting it looks like the pointer is invalid as it just shows P->??????? when I print mr1.AddressString.

I have ran the cheat engine and exe saved version side by side and compared the BaseAddress variable I get from the search and they have always appeared to be the same address so I dont actually know whats going wrong.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue Nov 10, 2020 1:59 am    Post subject: Reply with quote

Did you name the trainer .exe the same as the game?
_________________
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
ThatsJustLogic
How do I cheat?
Reputation: 0

Joined: 09 Nov 2020
Posts: 2

PostPosted: Tue Nov 10, 2020 10:20 am    Post subject: Reply with quote

Nope the trainer was always named differently from the game
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