Joined: 10/2/2015
Posts: 91
ok! thanks for the tip!
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Formatting...
Language: lua

while true do table = joypad.get(1) if table.Y then if table.right then memory.writeword(0x7E0E8B, 3) memory.writeword(0x7E0E8D, 2000) elseif table.left then memory.writeword(0x7E0E8B, -3) memory.writeword(0x7E0E8D, -2000) end else if table.right then memory.writeword(0x7E0E8B, 2) elseif table.left then memory.writeword(0x7E0E8B, -2) end end emu.frameadvance() end
Should be a little bit faster, too.
Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
Download downloadable-sample.lua
Language: lua

while true do table = joypad.get(1) if table.Y then if table.right then memory.writeword(0x7E0E8B, 3) memory.writeword(0x7E0E8D, 2000) elseif table.left then memory.writeword(0x7E0E8B, -3) memory.writeword(0x7E0E8D, -2000) end else if table.right then memory.writeword(0x7E0E8B, 2) elseif table.left then memory.writeword(0x7E0E8B, -2) end end emu.frameadvance() end
[code=downloadable-sample.lua] -- your code here [/code]
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/2/2015
Posts: 91
Last one for a while. Sorry guys! I'm trying to recreate hippie's 'cursed cart', ie X to fly. Do you know what I'm doing wrong? Download Cursed.lua
Language: lua

while true do table = joypad.get(1) if (table.X) then local reads = memory.readword(0x7E0EF5) memory.writeword(0x7E0EF5,reads + 5) end emu.frameadvance() end
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
also, my original code is acting funky. it seems that it glitches up the overworld. is there any way to have it active ONLY when a lvl is entered? Download fortheloveof.lua
Language: lua

while true do table = joypad.get(1) if table.right then memory.writeword(0x7E0E8B,2) end if table.left then memory.writeword(0x7E0E8B,-2) end if (table.Y) then if table.right then memory.writeword(0x7E0E8D,2000) memory.writeword(0x7E0E8B,3) end if table.left then memory.writeword(0x7E0E8D, -2000) memory.writeword(0x7E0E8B,-3) end end emu.frameadvance() end [code]
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
NEVERMIND! figured it out :) [code speed.lua] while true do local status= memory.readbyte(0x7E1B03) table = joypad.get(1) if (status == 1) then if table.Y then if table.right then memory.writeword(0x7E0E8B, 3) memory.writeword(0x7E0E8D, 2000) elseif table.left then memory.writeword(0x7E0E8B, -3) memory.writeword(0x7E0E8D, -2000) end else if table.right then memory.writeword(0x7E0E8B, 2) elseif table.left then memory.writeword(0x7E0E8B, -2) end end end emu.frameadvance() end [/code] i used RAM search to search for a value for whether or not im in a level. i found many, so i just picked one. then i used an if statement to only allow the speed alterations when im in a lvl.
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Player (151)
Joined: 5/1/2006
Posts: 150
RainbowSprinklez wrote:
also, my original code is acting funky. it seems that it glitches up the overworld. is there any way to have it active ONLY when a lvl is entered?
Calling your code with memory.registerwrite() on 0x7E0046 (a frame counter only active in playable stages, according to this) should probably work.
Language: lua

memory.registerwrite(0x7E0046, function() --[your stuff here] end) while true do emu.framveadvance() end
edit: Or whatever else works! Also, you can edit previous posts instead of multi-posting.
Joined: 10/2/2015
Posts: 91
Thanks! I should probably have done that, huh?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
is there any wait command in lua as i need to wait about a second from entering the stage to activate my speedhack or the camera freezes
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
You can count frames. timer = emu.frameadvance()+60 Check the framecount every frame, and if it's equal to your timer, fire your event.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/2/2015
Posts: 91
ok, makes sense. but frameadvance is a nil value? should i instead use get.frameadvance?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
Uh, it was supposed to be framecount.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/2/2015
Posts: 91
i got that, thanks. but my if clause is never entered. why? Download speed.lua
Language: lua

local count = 0 local timer while true do local status= memory.readbyte(0x7E1B03) table = joypad.get(1) if (status == 1) then count = count + 1 --This is to force if when stage entered. if (count == 1) then timer = emu.framecount() + 60 --Increments timer to 60 more than frame count on stafe entrance end if (timer == emu.framecount()) then if table.Y then if table.right then memory.writeword(0x7E0E8B, 3) memory.writeword(0x7E0E8D, 2000) elseif table.left then memory.writeword(0x7E0E8B, -3) memory.writeword(0x7E0E8D, -2000) end else if table.right then memory.writeword(0x7E0E8B, 2) elseif table.left then memory.writeword(0x7E0E8B, -2) end end end count = 0 end emu.frameadvance() end
-edit: i hate notepad++. it is formatted right when i send it im guessing tabs arent counted? ---edit:i added this code towards the end, replacing count = 0
elseif status == 0 then
		count = 0
		end
but it doesnt solve my problem -----edit: I SOLVED IT!!! Download speed.lua
Language: lua

local count = 0 local timer local setup while true do local status= memory.readbyte(0x7E1B03) table = joypad.get(1) if (status == 1) then count = count + 1 --This is to force if when stage entered. if (count == 1) then timer = emu.framecount() + 60 --Increments timer to 60 more than frame count on stafe entrance end if timer == emu.framecount() then setup = 1 end if (setup == 1) then if table.Y then if table.right then memory.writeword(0x7E0E8B, 3) memory.writeword(0x7E0E8D, 2000) elseif table.left then memory.writeword(0x7E0E8B, -3) memory.writeword(0x7E0E8D, -2000) end else if table.right then memory.writeword(0x7E0E8B, 2) elseif table.left then memory.writeword(0x7E0E8B, -2) end end end count = 5 elseif status == 0 then count = 0 setup = 0 end emu.frameadvance() end
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
RainbowSprinklez wrote:
it is formatted right when i send it im guessing tabs arent counted?
Replace tabs with spaces before copy'n'pasting it here.
Joined: 10/2/2015
Posts: 91
i have a question that may enhance it. is there anyway to recognize when a game turns off the inputs so i can do the same?
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
also, https://www.youtube.com/watch?v=9ZVwJfkM0Eg Download xtofly.lua
Language: lua

while true do table = joypad.get(1) if (table.X) then memory.writeword(0x7E0EF5, 1000) local reads = memory.readword(0x7E0EF5) local curse = reads + 4 memory.writeword(0x7E0EF5,curse) end emu.frameadvance() end
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
It's also useful to keep addresses as readable variables, makes a lot of sense when you start fiddling with lots of them.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Experienced player (817)
Joined: 5/2/2015
Posts: 671
Location: France
RainbowSprinklez wrote:
i have a question that may enhance it. is there anyway to recognize when a game turns off the inputs so i can do the same?
If I understood correctly, track the adress that tracks input and set it to end your script when it's set to 0 (no input).
Joined: 10/2/2015
Posts: 91
good idea! hey, does anybody know how to inject this in a ROM? itd be easier to show my friends without providing them more steps.
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Invariel
He/Him
Editor, Site Developer, Player (169)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
Now you're talking about ROM hacking, and not TASing, so you should probably research that. Alternately, you can share the Lua script with your friends, and they'll have access to your cool cheat if they want to use it.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Joined: 10/2/2015
Posts: 91
ok, i'll research separately. :D just checking
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
i really don't consider myself a TASer as i've not made any TAS yet... so i just clung to the idea of a hacker...
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)
Joined: 10/2/2015
Posts: 91
i'm sorry guys. i've been acting silly. i got caught up on hacks that i pushed TAS to the side, which I shouldn't have. it's just that making a TAS is a huge undertaking while hacks... aren't. i'm sorry. i goofed. plus, i'm in a very large shadow. however, one thing you guys MAY find interesting is i found a ram value that simulates a B press in a stage, so i'm sure there must be others. this is useful in that you could write code that fires ONLY when the game allows input. edit: i found this ram value: 7E16E7. it's roll with diddy. if you force to 1 you cant roll. it's 1 byte.
I didn't kill donkey, I saved it. Current projects: Misc Donkey hacks :) Past projects: Pacifist DKC1 DKC1 Entrance randomizer DKC2 Entrance randomizer DKDC (a troll hack of DKC1) DKC1 Enemy randomizer (among other things)