Please proofread my script

Las0mbra

What is cheating?
Mar 17, 2017
21
0
1
#1
The script appears to work as it should but I have just a bit of experience with lua and almost no experience using it in CE.

So if anyone has the time to look it over I'd appreciate it.

The "bpointer" was found using a AA script beforehand.
Code:
[ENABLE]
{$lua}
  errorOnLookupFailure(false)

  isAlly = "[bpointer]+30"
  maxTroops = "[bpointer]+38"
  curTroops = "[bpointer]+3C"


  function GodMode()

    unitAlly = readBytes(isAlly, 1)
    unitMaxTroops = readInteger(maxTroops)
    unitCurTroops = readInteger(curTroops)

    if (unitAlly and unitMaxTroops and unitCurTroops) then
      if (unitAlly == 1)
        then writeInteger(curTroops, unitMaxTroops)
      end
    end
  end


  RepeatTimer = createTimer(nil,true)
  RepeatTimer.Interval = 250
  RepeatTimer.onTimer = GodMode

{$asm}

[DISABLE]
{$lua}

  RepeatTimer.enabled = false

{$asm}
 

seikur0

Novice Cheater
Aug 26, 2017
161
0
16
#2
Seems good, though you could probably do it with autoassembler instead of lua in a much easier way by finding some code that's accessing the current troops and injecting there.
 

Las0mbra

What is cheating?
Mar 17, 2017
21
0
1
#3
seikur0 post_id=25122 time=1510851811 user_id=8101 said:
Seems good,
Thanks for looking it over. I'm glad there is nothing major wrong with it.
seikur0 post_id=25122 time=1510851811 user_id=8101 said:
though you could probably do it with autoassembler instead of lua in a much easier way by finding some code that's accessing the current troops and injecting there.
Yeah probably. At the time lua seemed easier to figure out.
 

seikur0

Novice Cheater
Aug 26, 2017
161
0
16
#4
One thing that came to mind just now: You should delete the timer object in your disable section with RepeatTimer.destroy().
 

Las0mbra

What is cheating?
Mar 17, 2017
21
0
1
#5
Replaced the RepeatTimer.enabled = false with RepeatTimer.destroy(). Thanks.