having issues setting a float

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
User avatar
jelly time
Novice Cheater
Novice Cheater
Posts: 17
Joined: Wed Nov 29, 2017 11:08 pm
Reputation: 0

having issues setting a float

Post by jelly time »

trying to make a script which would set the timer for item restocks so it would be instant, but when I enable the script and buy something the game immediately crashes. This is my first time making a script from scratch but I have a feeling it has to do with the value being a float and me setting it as something wrong.

Code: Select all

{ Game   : Little Inferno.exe
  Version: 
  Date   : 2019-03-14
  Author : Jelly Time
}

define(address,"Little Inferno.exe"+E326)
define(bytes,D9 1C 01 5B 83 C4 1C)

[ENABLE]

assert(address,bytes)
alloc(newmem,$1000)

label(code)
label(return)

newmem:
mov [ecx+eax],#1
code:
  //fstp dword ptr [ecx+eax]
  //pop ebx
  //add esp,1C
  jmp return

address:
  jmp newmem
  nop
  nop
return:

[DISABLE]

address:
  db bytes
  // fstp dword ptr [ecx+eax]
  // pop ebx
  // add esp,1C

dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: "Little Inferno.exe"+E326

"Little Inferno.exe"+E307: 8B CA                 -  mov ecx,edx
"Little Inferno.exe"+E309: C1 E2 04              -  shl edx,04
"Little Inferno.exe"+E30C: 89 B4 02 64 01 00 00  -  mov [edx+eax+00000164],esi
"Little Inferno.exe"+E313: FF 80 60 01 00 00     -  inc [eax+00000160]
"Little Inferno.exe"+E319: D9 44 24 10           -  fld dword ptr [esp+10]
"Little Inferno.exe"+E31D: 5F                    -  pop edi
"Little Inferno.exe"+E31E: 5E                    -  pop esi
"Little Inferno.exe"+E31F: 83 C1 17              -  add ecx,17
"Little Inferno.exe"+E322: C1 E1 04              -  shl ecx,04
"Little Inferno.exe"+E325: 5D                    -  pop ebp
// ---------- INJECTING HERE ----------
"Little Inferno.exe"+E326: D9 1C 01              -  fstp dword ptr [ecx+eax]
"Little Inferno.exe"+E329: 5B                    -  pop ebx
"Little Inferno.exe"+E32A: 83 C4 1C              -  add esp,1C
// ---------- DONE INJECTING  ----------
"Little Inferno.exe"+E32D: C3                    -  ret 
"Little Inferno.exe"+E32E: CC                    -  int 3 
"Little Inferno.exe"+E32F: CC                    -  int 3 
"Little Inferno.exe"+E330: A1 AC 9E E6 00        -  mov eax,["Little Inferno.exe"+349EAC]
"Little Inferno.exe"+E335: 8B 0D B0 9E E6 00     -  mov ecx,["Little Inferno.exe"+349EB0]
"Little Inferno.exe"+E33B: 8B 15 B4 9E E6 00     -  mov edx,["Little Inferno.exe"+349EB4]
"Little Inferno.exe"+E341: 83 EC 18              -  sub esp,18
"Little Inferno.exe"+E344: 53                    -  push ebx
"Little Inferno.exe"+E345: A3 0C 9F E6 00        -  mov ["Little Inferno.exe"+349F0C],eax
"Little Inferno.exe"+E34A: A1 B8 9E E6 00        -  mov eax,["Little Inferno.exe"+349EB8]
}

GreenHouse
Expert Cheater
Expert Cheater
Posts: 852
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 896

Re: having issues setting a float

Post by GreenHouse »

Don't comment the entire code, as you're messing it up by not popping the ebx, etc. And If you're setting a float, you can do: mov [ecx+eax],(float)1

User avatar
jelly time
Novice Cheater
Novice Cheater
Posts: 17
Joined: Wed Nov 29, 2017 11:08 pm
Reputation: 0

Re: having issues setting a float

Post by jelly time »

it worked! Thanks again lol

Post Reply

Who is online

Users browsing this forum: No registered users