Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(t ~= nil) then -- if script is already running then
- timer_setEnabled(t, false) -- stop the script
- object_destroy(t)
- t = nil
- end
- if(attachtimer ~= nil) then -- if script is already running then
- timer_setEnabled(t, false) -- stop the script
- object_destroy(t)
- t = nil
- end
- errorOnLookupFailure(false) -- wont throw a shitload of errors when not in a match
- --[[----------------------------------------------------------------------------
- Variables
- --]]----------------------------------------------------------------------------
- tickrate = 50 -- How often main() is called in milliseconds. 50ms is once every 3 frames.
- attachrate = 5000 -- How often CE will attempt to attach to the LL process.
- injectcountdown = -1
- hotkeycooldown = 0
- cooldown = 0 -- Reduces by 1 every tick. Hotkeys can not be used if cooldown > 0
- freezeballspeed = false -- When true, ball speed can not change.
- infspecialmeter = false -- When true, special meter will always be full
- frozenspeed = 0 -- the value that ballspeed will be frozen to
- editmode = true
- ballstateonhit = 5
- anglemode = "no repeat"
- p2directionmode = "saved"
- endwait = 1200
- p2spawndirection = 0
- balldirection = 0
- ResetServeHotkey = 200
- SpawnCorpseHotkey = 200
- EditModeHotkey = 200
- NeutralAttackHotkey = 200
- --[[----------------------------------------------------------------------------
- Addresses
- --]]----------------------------------------------------------------------------
- ballx = '[ballcoords]+18'
- bally = '[ballcoords]+1c'
- ballexists = '[ballstate]+1d'
- ballspeed = '[ballstate]+12c'
- balltag = '[ballstate]+130'
- ballxspeed = '[ballstate]+13c'
- ballyspeed = '[ballstate]+140'
- ballstate = '[ballstate]+144'
- serveresettimer = '[ballstate]+178'
- servelowertimer = '[ballstate]+17c'
- p1specialmeter = '[p1state]+150'
- p1respawntimer = '[p1state]+14c'
- p2direction = '[p2state]+4'
- p2exists = '[p2state]+1d'
- p2floats = '[p2state]+1e'
- p2state = '[p2state]+134'
- p2respawntimer = '[p2state]+14c'
- p2xcoord = '[p2coords]+18'
- p2ycoord = '[p2coords]+1c'
- servespawnx = '[ballrespawn]+12c'
- stagexorigin = '[stagebase]+1c'
- stagexsize = '[stagebase]+24'
- --[[----------------------------------------------------------------------------
- Gets addresses for various memory regions using code injection
- --]]----------------------------------------------------------------------------
- function getAddresses()
- autoAssemble([[
- aobscanmodule(ball_inject_point,lethalleague.exe,8B 81 CC 00 00 00 8B 50 70 8B 86 A8 02 00 00 57)
- aobscanmodule(dev_inject_point,lethalleague.exe,8D 8E 80 00 00 00 FF 15 ?? ?? ?? ?? 8B 08 89 8E 90 00 00 00)
- aobscanmodule(stage_inject_point,lethalleague.exe,BB 01 00 00 00 89 45 FC 8B 87 A4 00 00 00 DB 45 FC)
- aobscanmodule(charselect_p_inject_point,lethalleague.exe,8B F1 8B 4E 10 57 E8 ?? ?? ?? ?? 8B 8E 98 00 00 00 8B 01)
- aobscanmodule(player_inject_point,lethalleague.exe,8B F1 8B 46 70 8B 88 CC 00 00 00 8B 51 70 8B 86 9C 02 00 00)
- aobscanmodule(reset_inject_point,lethalleague.exe,8D 8D 28 FF FF FF 68 ?? ?? ?? ?? 51 E8 ?? ?? ?? ?? 83 C4 08 50 E8 ?? ?? ?? ?? 83 C4 08 50 E8 ?? ?? ?? ?? 83 C4 08 39 5E 30)
- aobscanmodule(ballrespawn_inject_point,lethalleague.exe,89 8E F0 00 00 00 8B 5D 08 83 BF 10 01 00 00 08)
- registersymbol(ball_inject_point)
- registersymbol(ballrespawn_inject_point)
- registersymbol(dev_inject_point)
- registersymbol(stage_inject_point)
- registersymbol(charselect_p_inject_point)
- registersymbol(player_inject_point)
- registersymbol(reset_inject_point)
- alloc(code,1024)
- label(ball_code)
- label(ball_return)
- label(dev_code)
- label(dev_return)
- label(stage_code)
- label(stage_return)
- label(charselect_p_code)
- label(charselect_p_end)
- label(charselect_p_return)
- label(player_code)
- label(player_code_notp1base)
- label(player_end)
- label(player_return)
- label(reset_code)
- label(reset_return)
- label(ballrespawn_code)
- label(ballrespawn_return)
- globalalloc(ballbase, 4)
- globalalloc(ballcoords, 4)
- globalalloc(ballstate, 4)
- globalalloc(ballrespawn, 4)
- globalalloc(devbase, 4)
- globalalloc(stagebase, 4)
- globalalloc(charselect_p1, 4)
- globalalloc(charselect_p2, 4)
- globalalloc(charselect_p3, 4)
- globalalloc(charselect_p4, 4)
- globalalloc(charselect_currentplayer, 4)
- globalalloc(p1base, 4)
- globalalloc(p2base, 4)
- globalalloc(p3base, 4)
- globalalloc(p4base, 4)
- globalalloc(currentplayer, 4)
- globalalloc(p1coords, 4)
- globalalloc(p2coords, 4)
- globalalloc(p3coords, 4)
- globalalloc(p4coords, 4)
- globalalloc(p1state, 4)
- globalalloc(p2state, 4)
- globalalloc(p3state, 4)
- globalalloc(p4state, 4)
- code:
- int 3
- int 3
- int 3
- int 3
- ball_code:
- mov eax,[ecx+000000CC]
- mov [ballbase],esi
- mov esi,[esi+14]
- mov [ballcoords],esi
- mov esi,[ballbase]
- mov esi,[esi+194]
- mov [ballstate],esi
- mov esi,[ballbase]
- jmp ball_return
- ballrespawn_code:
- mov [esi+000000F0],ecx
- mov [ballrespawn],esi
- jmp ballrespawn_return
- dev_code:
- lea ecx,[esi+00000080]
- mov [devbase],esi
- jmp dev_return
- stage_code:
- mov ebx,00000001
- mov [stagebase],ecx
- jmp stage_return
- charselect_p_code:
- mov esi,ecx
- mov ecx,[esi+10]
- push eax
- push ecx
- mov eax,[charselect_currentplayer]
- mov ecx,10
- mul ecx
- mov [charselect_p1+eax],esi
- mov eax,[charselect_currentplayer]
- inc al
- cmp al,04
- jb charselect_p_end
- mov al,00
- charselect_p_end:
- mov [charselect_currentplayer],al
- pop ecx
- pop eax
- jmp charselect_p_return
- player_code:
- mov esi,ecx
- mov eax,[esi+70]
- push eax
- push ebx
- push ecx
- mov eax,[currentplayer]
- cmp [p1base],esi
- jne player_code_notp1base
- mov al,00
- mov [currentplayer],al
- player_code_notp1base:
- mov ecx,10
- mul ecx
- mov [p1base+eax],esi
- mov ebx,[esi+14]
- mov [p1coords+eax],ebx
- mov ebx,[esi+194]
- mov [p1state+eax],ebx
- mov eax,[currentplayer]
- inc al
- cmp al,04
- jb player_end
- mov al,00
- player_end:
- mov [currentplayer],al
- pop ecx
- pop ebx
- pop eax
- jmp player_return
- reset_code:
- lea ecx,[ebp-000000D8]
- mov [ballbase],00000000
- mov [ballstate],00000000
- mov [ballcoords],00000000
- mov [ballrespawn],00000000
- mov [stagebase],00000000
- mov [charselect_p1],00000000
- mov [charselect_p2],00000000
- mov [charselect_p3],00000000
- mov [charselect_p4],00000000
- mov [charselect_currentplayer],00000000
- mov [p1base],00000000
- mov [p2base],00000000
- mov [p3base],00000000
- mov [p4base],00000000
- mov [currentplayer],00000000
- mov [p1coords],00000000
- mov [p2coords],00000000
- mov [p3coords],00000000
- mov [p4coords],00000000
- mov [p1state],00000000
- mov [p2state],00000000
- mov [p3state],00000000
- mov [p4state],00000000
- jmp reset_return
- ball_inject_point:
- jmp ball_code
- nop
- ball_return:
- ballrespawn_inject_point:
- jmp ballrespawn_code
- nop
- ballrespawn_return:
- dev_inject_point:
- jmp dev_code
- nop
- dev_return:
- stage_inject_point:
- jmp stage_code
- stage_return:
- charselect_p_inject_point:
- jmp charselect_p_code
- charselect_p_return:
- player_inject_point:
- jmp player_code
- player_return:
- reset_inject_point:
- jmp reset_code
- nop
- reset_return:
- ]])
- end
- --[[----------------------------------------------------------------------------
- Injects into neutral attack functions and defines 4 variables
- forceattack: Set to 1 to set "forcedplayer" to do a neutral attack
- forcedplayer: Set to 0 for p1, 1 for p2, etc
- aimdown: set to 1 and forcedplayer will aim their next attack down
- aimup: set to 1 and forcedplayer will aim their next attack up (down takes priority)
- --]]----------------------------------------------------------------------------
- function hookNeutralAttack()
- autoAssemble([[
- aobscanmodule(nattack_inject_point,lethalleague.exe,FF D2 8B CE 84 C0 74 0B 6A 00 E8 ?? ?? ?? ?? 5E C2 04 00)
- aobscanmodule(aimdown_inject_point,lethalleague.exe,FF D2 84 C0 74 40 8B 87 ?? ?? ?? ?? 80 78 1E 00)
- aobscanmodule(aimdown_extrajump,lethalleague.exe,8B 17 8B 82 B0 00 00 00 6A 00 8B CF FF D0 84 C0 74 11)
- aobscanmodule(aimup_inject_point,lethalleague.exe,FF D0 84 C0 74 11 8B 8F 74 02 00 00 89 0E 8B 97)
- aobscanmodule(aimup_extrajump,lethalleague.exe,5F 8B C6 5E 5B 5D C2 08 00 55 8B EC 53 56 57 8B)
- registersymbol(nattack_inject_point)
- registersymbol(aimdown_inject_point)
- registersymbol(aimdown_extrajump)
- registersymbol(aimup_inject_point)
- registersymbol(aimup_extrajump)
- alloc(ncode,1024)
- label(nattack_code)
- label(nattack_end)
- label(nattack_return)
- label(aimdown_code)
- label(aimdown_end)
- label(aimdown_return)
- label(aimup_code)
- label(aimup_end)
- label(aimup_return)
- globalalloc(forceattack, 4)
- globalalloc(forcedplayer, 4)
- globalalloc(aimdown, 4)
- globalalloc(aimup, 4)
- ncode:
- int 3
- int 3
- int 3
- int 3
- nattack_code:
- call edx
- mov ecx,esi
- push ebx
- push eax
- mov eax,[forcedplayer]
- mov ebx, 10
- mul ebx
- cmp ecx,[p1base+eax]
- pop eax
- pop ebx
- jne nattack_end
- cmp [forceattack],01
- jne nattack_end
- mov al,01
- mov [forceattack],00
- nattack_end:
- test al,al
- jmp nattack_return
- aimdown_code:
- call edx
- cmp [aimdown],01
- jne aimdown_end
- mov al,01
- mov [aimdown],0
- aimdown_end:
- test al,al
- je aimdown_extrajump
- jmp aimdown_return
- aimup_code:
- call eax
- cmp [aimup],01
- jne aimup_end
- mov al,01
- mov [aimup],0
- aimup_end:
- test al,al
- je aimup_extrajump
- jmp aimup_return
- nattack_inject_point:
- jmp nattack_code
- nop
- nattack_return:
- aimdown_inject_point:
- jmp aimdown_code
- nop
- aimdown_return:
- aimup_inject_point:
- jmp aimup_code
- nop
- aimup_return:
- ]])
- end
- --[[----------------------------------------------------------------------------
- This function is called whenever a hotkey togglebox is clicked.
- If a togglebox is toggled on, it will set hotkeycooldown to 25. This will
- dissalow any other togglebox from being toggled on until main() is called 25 times.
- If the togglebox is on already and is toggled off manually, it will set
- hotkeycooldown to 0 so that another togglebox can be toggled immediately.
- --]]----------------------------------------------------------------------------
- function hotkeyToggleBoxChange(sender)
- -- if the box is toggled on and no other box is toggled on
- if sender.getState() == 1 and hotkeycooldown == 0 then
- hotkeycooldown = 25 -- no box can be toggled on for 25 ticks
- -- if the box is toggled on, and another box is already toggled on
- elseif sender.getState() == 1 and hotkeycooldown ~= 0 then
- sender.setState(0) -- toggle the box back off
- -- if the box is toggled off before the hotkeycooldown runs out
- elseif sender.getState() == 0 and hotkeycooldown ~= 0 then
- hotkeycooldown = 0 -- set hotkeycooldown to 0 so other boxes can be toggled
- end
- end
- --[[----------------------------------------------------------------------------
- This function will run once for every togglebox every time main() is called.
- Returns the VK code of a hotkey if the togglebox is waiting for a key. If
- the hotkeycooldown gets to 0, it will toggle it off and clear the caption.
- --]]----------------------------------------------------------------------------
- function checkHotkey(togglebox, previousHotkey)
- -- if the togglebox is not toggled
- if togglebox.getState() == 0 then
- return previousHotkey
- -- if the togglebox is toggled on and the hotkeycooldown is still ticking down
- elseif togglebox.getState() == 1 and hotkeycooldown ~= 0 then
- togglebox.setCaption("[waiting]") -- indicate that it is waiting for a keypress
- key = getKeyPress() -- get the VK code of the key that is pressed
- if key ~= nil then -- if a key is pressed
- cooldown = 5 -- set the cooldown to 20 so the hotkey isnt activated right as its binded.
- hotkeycooldown = 0 -- free up other boxes to be toggled
- togglebox.setState(0) -- untoggle the box
- if key == 27 then -- if the key is 27 (ESC key)
- togglebox.setCaption("[click to bind]") -- clear the caption
- return 200 -- end the function, clear the keybind (200 is not a valid VK code)
- end
- togglebox.setCaption(convertKeyComboToString(key)) -- set the boxes caption to the key pressed
- return key -- return the key so it can be used elsewhere in the script
- else return previousHotkey -- don't change the hotkey
- end
- -- if the togglebox is toggled on and the hotkeycooldown runs out
- elseif togglebox.getState() == 1 and hotkeycooldown == 0 then
- togglebox.setState(0) -- toggle the box off
- togglebox.setCaption("[click to bind]") -- restore the "[click to bind]" caption
- return 200 -- end the function, clear the keybind (200 is not a valid VK code)
- end
- end
- --[[----------------------------------------------------------------------------
- Returns the Virtual-Key Code of a key that is pressed when this function is
- called. If multiple keys are pressed, then it will return the one with the lower
- Virtual-Key Code. http://wiki.cheatengine.org/index.php?title=Virtual-Key_Code
- --]]----------------------------------------------------------------------------
- function getKeyPress()
- vk = 3 -- start at 3 so left and right mouse button arent bindable
- while vk <= 165 do -- end at 165 becase its the last VK code
- if isKeyPressed(vk) then return vk end
- vk = vk + 1
- end
- end
- --[[----------------------------------------------------------------------------
- This function resets the ball to the serve position
- --]]----------------------------------------------------------------------------
- function resettoserve()
- writeBytes(getAddress(ballstate), 14) -- sets the ballstate to respawn mode
- writeInteger(getAddress(serveresettimer), 300000) -- skips the wait to respawn
- sleep(200) -- wait 200ms before lowering the ball
- writeInteger(getAddress(servelowertimer), 140000) -- lowers the ball early
- end
- --[[----------------------------------------------------------------------------
- This function kills p2 to spawn a corpse, and then instantly respawns and moves
- p2 back to the position they were at previously with the same orientation.
- --]]----------------------------------------------------------------------------
- function spawnCorpse()
- --Despawns the ball so it doesnt get in the way of corpse combos, but checks if
- --you are in training mode first. So you can't accidentally despawn the ball in
- --training mode. Reading a P2 value is an easy way to check if you are in training mode
- --because p2 is not in training mode.
- --Toggling edit mode in versus mode will bring the ball back
- if readBytes(getAddress(p2direction)) ~= nil then
- writeBytes(getAddress(ballexists), 0)
- end
- --save position and direction p2 is facing so that he can be respawned to his
- --previous position right after he dies.
- c_savedp2direction = readInteger(getAddress(p2direction))
- c_savedp2xcoord = readInteger(getAddress(p2xcoord))
- c_savedp2ycoord = readInteger(getAddress(p2ycoord))
- writeInteger(getAddress(p2state), 3) --kill p2 to spawn a corpse
- writeInteger(getAddress(p2respawntimer), 200000) --skip the respawn wait for p2
- sleep(50) --wait 6 frames to give time for p2 to spawn
- --move p2 back to the saved coordinates and facing the right direciton.
- writeInteger(getAddress(p2xcoord), c_savedp2xcoord)
- writeInteger(getAddress(p2ycoord), c_savedp2ycoord)
- writeInteger(getAddress(p2direction), c_savedp2direction)
- --makes p2 float so we can get corpses spawned from the air.
- writeBytes(getAddress(p2floats), 1)
- end
- --[[----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Spawns p2
- Parameters
- x: xcoord of p2
- y: ycoord of p2
- dir: direction p2 is facing, 1 = right, 0 = left
- floats: controls if p2 falls or not. 1 = p2 floats, 0 = p2 falls
- --]]----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- function spawnP2(x, y, dir, floats)
- writeInteger(getAddress(p2xcoord), x)
- writeInteger(getAddress(p2ycoord), y)
- writeBytes(getAddress(p2direction), dir)
- writeBytes(getAddress(p2floats), floats)
- writeBytes(getAddress(p2exists), 1)
- end
- --[[----------------------------------------------------------------------------
- This function resets the ball to the serve position fast
- --]]----------------------------------------------------------------------------
- function fastresettoserve()
- writeBytes(getAddress(ballstate), 14) -- sets the ballstate to respawn mode
- writeInteger(getAddress(serveresettimer), 300000) -- skips the wait to respawn
- sleep(20) -- wait 200ms before lowering the ball
- writeInteger(getAddress(servelowertimer), 164892) -- lowers the ball early
- end
- --[[----------------------------------------------------------------------------
- --]]----------------------------------------------------------------------------
- function toggleEditMode()
- if editmode then
- editmode = false
- writeBytes(getAddress(p2exists), 0) -- p2 dissapears
- writeBytes(getAddress(ballexists), 0) -- ball dissapears
- --save coordinates and direction for p2
- savedp2xcoord = readInteger(getAddress(p2xcoord))
- savedp2ycoord = readInteger(getAddress(p2ycoord))
- savedp2direction = readInteger(getAddress(p2direction))
- elseif not editmode then
- editmode = true
- spawnP2(savedp2xcoord, savedp2ycoord, savedp2direction, 1)
- writeBytes(getAddress(ballexists), 1)
- writeInteger(getAddress(p1respawntimer), 0)
- writeInteger(getAddress(p2respawntimer), 0)
- fastresettoserve()
- end
- end
- --[[----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Chooses the direction p2 will face on ball hit depending on the p2directionmode
- Parameters
- dir: The direction p2 was facing on the previous hit
- Return Value: New direction of p2 (1 = right, 0 = left)
- --]]----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- function chooseP2Direction(dir)
- if p2directionmode == "random" then return math.random(0,1) -- p2spawndirection is randomized (0 or 1)
- elseif p2directionmode == "saved" then return savedp2direction -- p2spawndirection uses the savedp2direction
- elseif p2directionmode == "cycle" then -- p2spawndirection cycles from 1 to 0
- if dir == 0 then
- return 1
- elseif dir == 1 then
- return 0
- end
- end
- end
- --[[----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Chooses the direction of the ball depending on the anglemode
- Parameters
- dir: the direction of the ball on the previous hit
- Return Value: New direction of the ball (-1 = down, 0 = straight, 1 = up)
- --]]----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- function chooseBallDirection(dir)
- if anglemode == "no repeat" then -- Gets a random direction, but never repeats the last direction.
- old = dir
- while dir == old do -- while the direction is still the same as the last direction
- dir = math.random(-1, 1) -- get a random direction
- end
- return dir
- elseif anglemode == "cycle" then -- Cycles through directions.
- if dir == 0 then return 1
- elseif dir == 1 then return -1
- elseif dir == -1 then return 0
- end
- elseif anglemode == "random" then return math.random(-1, 1)
- elseif anglemode == "up" then return 1 -- Direction is always up.
- elseif anglemode == "straight" then return 0 -- Direction is always straight.
- elseif anglemode == "down" then return -1 -- Direction is always down.
- end
- end
- --[[----------------------------------------------------------------------------
- --]]----------------------------------------------------------------------------
- function hitBall(p2x, p2y, p2dir, balldir, state)
- spawnP2(p2x, p2y, p2dir, 1)
- if balldir == 1 then --if ball direction is up
- writeBytes(getAddress("aimup"), 1) -- set symbol aimup to 1
- elseif balldir == -1 then --if ball direction is down
- writeBytes(getAddress("aimdown"), 1) -- set symbol aimdown to 1
- end
- writeBytes(getAddress("forcedplayer"), 1) -- set the player that attacks to p2
- writeBytes(getAddress("forceattack"), 1) -- forces player to attack
- --moves ball into p2's hitbox
- writeInteger(getAddress(ballx), readInteger(getAddress(p2xcoord)))
- writeInteger(getAddress(bally), readInteger(getAddress(p2ycoord)))
- writeBytes(getAddress(ballstate), state) -- set the ball state
- writeBytes(getAddress(ballexists), 1)
- sleep(50) -- wait for the ball to get hit
- oldballx = readInteger(getAddress(ballx)) --
- while oldballx == readInteger(getAddress(ballx)) do -- wait for the ball to start moving
- sleep(50)
- end
- sleep(250) -- wait a bit longer for p2 to return to neutral state
- writeBytes(getAddress(p2exists), 0) -- despawn p2
- sleep(endwait) -- give more time for the ball to move
- writeBytes(getAddress(ballexists), 0) -- despawn the ball
- end
- --[[----------------------------------------------------------------------------
- This function is called when the "Infinite Special Meter" checkbox is changed.
- It changes the infspecialmeter boolean to true when it is checked, and false
- when unchecked.
- --]]----------------------------------------------------------------------------
- function ISCheckBoxChange(sender)
- if sender.getState() == 1 then
- infspecialmeter = true
- else
- infspecialmeter = false
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called when the "Freeze Ballspeed" checkbox is changed. When
- checked it changes the freezeballspeed boolean to true and saves the current
- ballspeed so we know what to freeze it to. If it is unchecked then it changes
- the freezeballspeed boolean to false.
- --]]----------------------------------------------------------------------------
- function FBCheckBoxChange(sender)
- if sender.getState() == 1 then
- freezeballspeed = true
- frozenspeed = readInteger(getAddress(ballspeed))
- else
- freezeballspeed = false
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called when the "Remove Corpse Combo Limit" checkbox is changed.
- When the checkbox is checked, the limit is removed. When it is unchecked the
- limit is not removed.
- --]]----------------------------------------------------------------------------
- function RCLCheckBoxChange(sender)
- if sender.getState() == 1 then
- autoAssemble([[
- aobScanModule(corpselimit,lethalleague.exe,83 B8 54 01 00 00 05)
- corpselimit:
- cmp dword ptr [eax+00000154],-01
- ]])
- elseif sender.getState() == 0 then
- autoAssemble([[
- aobScanModule(corpselimit,lethalleague.exe,83 B8 54 01 00 00 FF)
- corpselimit:
- cmp dword ptr [eax+00000154],5
- ]])
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called with the Angle Mode combo box is changed. It gets the
- current index of the combo box and sets the anglemode variable to the
- corresponding mode.
- --]]----------------------------------------------------------------------------
- function AMComboBoxChange(sender)
- i = sender.getItemIndex()
- if i == 0 then anglemode = "no repeat"
- elseif i == 1 then anglemode = "random"
- elseif i == 2 then anglemode = "cycle"
- elseif i == 3 then anglemode = "up"
- elseif i == 4 then anglemode = "straight"
- elseif i == 5 then anglemode = "down"
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called with the Direction Mode combo box is changed. It gets the
- current index of the combo box and sets the p2directionmode variable to the
- corresponding mode.
- --]]----------------------------------------------------------------------------
- function DMComboBoxChange(sender)
- i = sender.getItemIndex()
- if i == 0 then p2directionmode = "saved"
- elseif i == 1 then p2directionmode = "random"
- elseif i == 2 then p2directionmode = "cycle"
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called with the Hitpause Mode combo box is changed. It gets the
- current index of the combo box and sets the ballstateonhit variable to the
- corresponding value.
- --]]----------------------------------------------------------------------------
- function HMComboBoxChange(sender)
- i = sender.getItemIndex()
- if i == 0 then ballstateonhit = 5 --ballstate 5 is a neutral attack
- elseif i == 1 then ballstateonhit = 10 --ballstate 10 is bunted
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called when the text in the end wait edit box is changed.
- --]]----------------------------------------------------------------------------
- function EWEditChange(sender)
- text = getProperty(sender, "Text") -- get the "Text" property of the text box
- if text == "" then -- if the text box is empty (has been cleared by the user)
- endwait = 0 -- set the endwait to 0
- setProperty(sender, "Text", endwait) -- set the text to the endwait (0)
- elseif tonumber(text) == nil then -- if the text can not be converted to a number
- setProperty(sender, "Text", endwait) -- roll back the change (only numbers can be used in the box)
- elseif tonumber(text) > 100000 then -- if editmode is greater than 100000 (100 seconds)
- setProperty(sender, "Text", endwait) -- roll back the change (above 100 seconds is not allowed)
- else -- if the text box isnt empty and can be converted to a number
- endwait = tonumber(text) -- set the new endwait
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called when the Serve Position radio group is changed.
- It gets the index of the radio group and then calculates and sets the x coordinate
- of the serve spawn position.
- --]]----------------------------------------------------------------------------
- function ServePosChangeBounds(sender)
- leftwall = readInteger(getAddress(stagexorigin)) -- get the x coord of the left wall
- width = readInteger(getAddress(stagexsize)) -- get the width of the stage
- rightwall = leftwall + width -- get the x coord of the right wall
- i = sender.getItemIndex()
- if i == 0 then -- if the serve position is set to "Left Wall"
- -- write the x coord for the left wall serve position
- -- (xcoord of the left wall + 25% of the width of the stage + 50px) * 2^16
- writeInteger(getAddress(servespawnx), (leftwall + (width * 0.25) + 50) * 2^16)
- elseif i == 1 then -- if the serve position is set to "Mid Stage"
- -- write the x coord for middle of the stage
- -- (xcoord of the left wall + 50% of the width of the stage) * 2^16
- writeInteger(getAddress(servespawnx), (leftwall + (width * 0.5)) * 2^16)
- elseif i == 2 then -- if the serve position is set to "Right Wall"
- -- write the x coord for the right wall serve position
- -- (xcoord of the right wall - 25% of the width of the stage - 50px) * 2^16
- writeInteger(getAddress(servespawnx), (rightwall - (width * 0.25) - 50) * 2^16)
- end
- end
- --[[----------------------------------------------------------------------------
- This function is called when the "About" button is clicked. It displays the
- about message
- --]]----------------------------------------------------------------------------
- function AboutClick()
- showMessage("LL Advanced Training 2.0 created by Smellyhobo101 for Lethal Leauge 1.0.7.12. Check the readme for usage instructions.")
- end
- --[[----------------------------------------------------------------------------
- This function is called when the "Close" button is clicked. It closes CE.
- --]]----------------------------------------------------------------------------
- function CloseClick()
- closeCE()
- return caFree
- end
- --[[----------------------------------------------------------------------------
- Attempts to attach to the lethal leauge process. Runs every 5000ms. If it attaches
- sucessfully it will then run getAddresses() and hookNeutralAttack() the next
- time the function is called.
- --]]----------------------------------------------------------------------------
- function attach()
- -- Get the Process ID of the Lethal Leauge process
- GameID = getProcessIDFromProcessName("LethalLeague.exe")
- -- If Lethal League is running AND CE is not attached to the right process
- if GameID ~= nil and GameID ~= getOpenedProcessID() then
- openProcess("LethalLeague.exe") -- Attach to the LL process
- injectcountdown = 20 -- run injection stuff after 20 main() ticks (1 second)
- end
- end
- --[[----------------------------------------------------------------------------
- This is the main function. Is is called every 50ms.
- --]]----------------------------------------------------------------------------
- function main()
- -- when the inject countdown reaches 0
- if injectcountdown == 0 then
- -- Call injection stuff
- getAddresses()
- hookNeutralAttack()
- injectcountdown = -1 -- Don't inject the next time
- end
- --reduce the cooldowns by 1 every tick until they are 0
- if cooldown > 0 then cooldown = cooldown - 1 end
- if hotkeycooldown > 0 then hotkeycooldown = hotkeycooldown - 1 end
- if injectcountdown > 0 then injectcountdown = injectcountdown - 1 end
- --if the ball speed is currently frozen, then set it to the frozenspeed
- if freezeballspeed then writeInteger(getAddress(ballspeed), frozenspeed) end
- --if infspecialmeter is true, then set the special meter to 4 bars.
- if infspecialmeter then writeInteger(getAddress(p1specialmeter), 6553600) end
- --when editmode is off make p1 and p2 respawn immediately
- if not editmode then
- writeInteger(getAddress(p1respawntimer), 200000)
- writeInteger(getAddress(p2respawntimer), 200000)
- end
- -- Checks for changes to any of the hotkeys
- ResetServeHotkey = checkHotkey(AdvancedTraining.RSToggleBox, ResetServeHotkey)
- SpawnCorpseHotkey = checkHotkey(AdvancedTraining.SCToggleBox, SpawnCorpseHotkey)
- EditModeHotkey = checkHotkey(AdvancedTraining.EMToggleBox, EditModeHotkey)
- NeutralAttackHotkey = checkHotkey(AdvancedTraining.NAToggleBox, NeutralAttackHotkey)
- if cooldown == 0 then --if the cooldown is 0
- if isKeyPressed(SpawnCorpseHotkey) and editmode then
- spawnCorpse() --spawn a corpse from p2
- cooldown = 5
- elseif isKeyPressed(ResetServeHotkey) then
- resettoserve() --Reset the ball to the serve position
- writeInteger(getAddress(p1specialmeter), 0) --reset p1's special meter
- cooldown = 5
- elseif isKeyPressed(EditModeHotkey) then
- toggleEditMode()
- cooldown = 5
- elseif isKeyPressed(NeutralAttackHotkey) and not editmode then
- p2spawndirection = chooseP2Direction(p2spawndirection)
- balldirection = chooseBallDirection(balldirection)
- hitBall(savedp2xcoord, savedp2ycoord, p2spawndirection, balldirection, ballstateonhit)
- end
- end
- end
- --[[----------------------------------------------------------------------------
- --]]----------------------------------------------------------------------------
- form_show(AdvancedTraining) -- show the mod window
- AdvancedTraining.OnClose = CloseClick -- A tutorial said to do this. I don't know why.
- t = createTimer(nil, false) -- create a Timer object and assign it to variable t.
- timer_onTimer(t, main) -- When the timer ticks, call the function main
- timer_setInterval(t, tickrate) -- Sets the tickrate of the timer in milliseconds
- timer_setEnabled(t, true) -- Turns the timer on
- attach_timer = createTimer(nil, false) -- create a Timer object and assign it to variable t.
- timer_onTimer(attach_timer, attach) -- When the timer ticks, call the function attach
- timer_setInterval(attach_timer, attachrate) -- Sets the interval of the timer in milliseconds
- timer_setEnabled(attach_timer, true) -- Turns the timer on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement