Jump to content

Default Craft Menu opening key conflicts with my Konami code easter egg.


ethanwdp

Recommended Posts

I've noticed that my Konami Code easter egg has been broken because of the default crafting menu key (B)

 

So when I press Up Up, Down Down, Left Right, Left Right, B, A it is interrupted when pressing "B" unless if I change the key binding.

 

How would I prevent that from firing?

 

CheatCoreCM.IsUp = 0CheatCoreCM.IsDown = 0CheatCoreCM.IsUpUp = 0CheatCoreCM.IsDownDown = 0CheatCoreCM.IsLeft = 0CheatCoreCM.IsRight = 0CheatCoreCM.IsLeftRight = 0CheatCoreCM.IsB = 0CheatCoreCM.IsA = 0CheatCoreCM.IsBA = 0CheatCoreCM.IsCodeSuccess = 0CheatCoreCM.IsGLM = 0CheatCoreCM.NoSecretsHere = function(_keyPressed) -- go away. nothing to see here.	if _keyPressed == 200 then		CheatCoreCM.IsUp = CheatCoreCM.IsUp + 1		if CheatCoreCM.IsUp > 2 then			CheatCoreCM.IsUp = 0		end	end		if _keyPressed == 208 then		CheatCoreCM.IsDown = CheatCoreCM.IsDown + 1		if CheatCoreCM.IsDown > 2 then			CheatCoreCM.IsDown = 0		end	end		if _keyPressed == 203 then		CheatCoreCM.IsLeft = CheatCoreCM.IsLeft + 1		if CheatCoreCM.IsLeft > 1 then			CheatCoreCM.IsLeft = 0		end	end		if _keyPressed == 205 then		CheatCoreCM.IsRight = CheatCoreCM.IsRight + 1		if CheatCoreCM.IsRight > 1 then			CheatCoreCM.IsRight = 0		end	end		if _keyPressed == 48 then		CheatCoreCM.IsB = CheatCoreCM.IsB + 1		if CheatCoreCM.IsB > 1 then			CheatCoreCM.IsB = 0		end	end		if _keyPressed == 30 then		CheatCoreCM.IsA = CheatCoreCM.IsA + 1		if CheatCoreCM.IsA > 1 then			CheatCoreCM.IsA = 0		end	end		if CheatCoreCM.IsUp == 2 and CheatCoreCM.IsDown == 0 then		CheatCoreCM.IsUpUp = 1		CheatCoreCM.IsUp = 0	end		if CheatCoreCM.IsUpUp == 1 and CheatCoreCM.IsDown == 2 then		CheatCoreCM.IsDownDown = 1		CheatCoreCM.IsDown = 0	end		if CheatCoreCM.IsRight == 1 and CheatCoreCM.IsLeft == 0 then		CheatCoreCM.IsRight = 0		CheatCoreCM.IsLeft = 0	end		if CheatCoreCM.IsLeftRight <= 2 and CheatCoreCM.IsA == 1 and CheatCoreCM.IsB == 0 or CheatCoreCM.IsLeftRight < 2 and CheatCoreCM.IsA == 1 and CheatCoreCM.IsB == 1 then		CheatCoreCM.IsA = 0		CheatCoreCM.IsB = 0	end				if CheatCoreCM.IsLeftRight == 2 and CheatCoreCM.IsB == 1 and CheatCoreCM.IsA == 1 then		CheatCoreCM.IsBA = 1		CheatCoreCM.IsB = 0		CheatCoreCM.IsA = 0	end		if CheatCoreCM.IsUpUp == 1 and CheatCoreCM.IsDownDown == 1 and CheatCoreCM.IsLeft == 1 and CheatCoreCM.IsRight == 1 then		if CheatCoreCM.IsLeftRight <= 2 then			CheatCoreCM.IsLeftRight = CheatCoreCM.IsLeftRight + 1		else			CheatCoreCM.IsLeftRight = 0		end		CheatCoreCM.IsLeft = 0		CheatCoreCM.IsRight = 0	end		if CheatCoreCM.IsUpUp == 1 and CheatCoreCM.IsDownDown == 1 and CheatCoreCM.IsLeftRight == 2 and CheatCoreCM.IsBA == 1 then		CheatCoreCM.IsUpUp = 0		CheatCoreCM.IsDownDown = 0		CheatCoreCM.IsLeftRight = 0		CheatCoreCM.IsBA = 0		CheatCoreCM.IsCodeSuccess = 1	end		if CheatCoreCM.IsCodeSuccess == 1 and CheatCoreCM.IsGLM == 0 then		CheatCoreCM.IsCodeSuccess = 0		CheatCoreCM.IsGLM = 1		CheatCoreCM.MLGmode()	end		if CheatCoreCM.IsCodeSuccess == 1 and CheatCoreCM.IsGLM == 1 then		CheatCoreCM.IsCodeSuccess = 0		CheatCoreCM.IsGLM = 0		CheatCoreCM.MLGmode()	endendCheatCoreCM.MLGmode = function()	if CheatCoreCM.IsGLM == 1 then		--getSoundManager():PlaySound("MLG", false, 1);		if CheatCoreCM.ToggleAllStats == false then			CheatCoreCM.AllStatsToggle()		end		CheatCoreCM.DoMaxAllSkills()		getPlayer():setGhostMode(true)		CheatCoreCM.IsAmmo = true		CheatCoreCM.IsGod = true		getPlayer():Say("MLG MODE ACTIVATED")		--getSoundManager():PlaySound("MLGsong", true, 1);	end		if CheatCoreCM.IsGLM == 0 then		--getSoundManager():Purge()		getPlayer():setGhostMode(false)		if CheatCoreCM.ToggleAllStats == true then			CheatCoreCM.AllStatsToggle()		end		CheatCoreCM.IsAmmo = false		CheatCoreCM.IsGod = false		getPlayer():Say("MLG MODE DEACTIVATED")	endendif isClient() == false and isAdmin() == false then	Events.OnKeyPressed.Add(CheatCoreCM.NoSecretsHere);end
Link to comment
Share on other sites

Looks like the crafting menu swallows keypresses. I'll post a new ticket in the bug tracker.

Btw.: Here's a shorter version of your code using a look-up-table:

local keys = {};-- The look up table for the Konami code.local lut = {    30, -- A    48, -- B    205, -- Right    203, -- Left    205, -- Right    203, -- Left    208, -- Down    208, -- Down    200, -- Up    200, -- Up}local function onKeyPress(key)    print(key);    -- Insert the pressed key at the first index and shift all other keypresses.    table.insert(keys, 1, key);    if #keys < #lut then        -- Return early if we haven't got 11 key presses yet.        return;    elseif #keys > #lut then        -- Discard old keypresses.        keys[#lut + 1] = nil;    end    -- Traverse table from behind.    local code = true;    for i = #keys, 1, -1 do        -- Compare keypresses to look-up-table.        if keys[i] ~= lut[i] then            code = false;        end    end    if code then        -- Call your cool stuff here.        print('KONAMI CODE YAY!');    endendEvents.OnKeyPressed.Add(onKeyPress);

Issue is here: http://theindiestone.com/forums/index.php?app=tracker&showissue=2060

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...