Removing Accelerator doesn't work in ver 5.05

Posted by WillFa on Sat 24 Jun 2017 03:59 PM — 2 posts, 14,152 views.

USA #0
Back about 11 years ago, Ked made a request (bbsubject_id=6634) to remove an Accelerator from the AcceleratorList. This change was added in version 3.75.

Setting an Accelerator to an empty string no longer removes it.


What I'm trying to do: my mud gives exits in the room_short description when wandering around. I'm trying to remap some convenient keys to non-standard exits.

a sample room_short: A Vortex (s,w,e,enter)

my code:

acclerators = {"CTRL+PAGEUP", "CTRL+PAGEDOWN", "SHIFT+PAGEUP", "SHIFT+PAGEDOWN"}
StandardDirs = {n=true, nw = true, ne = true, w=true, e=true, s=true, sw=true, se=true, d=true, u=true}
function onRoomShort( t,l,w,sr )
    for k,v in ipairs(acclerators) do Accelerator(v,"") end
    --tprint(AcceleratorList())
    
    local exitText = l:match("%((.+)%)")
    local rooms = utils.split(exitText, ",")
    local roomIndex = 1
    while rooms[roomIndex] do
        if StandardDirs[rooms[roomIndex]] then 
            table.remove(rooms, roomIndex)
        else
            roomIndex = roomIndex+1
        end
    end
    --tprint(rooms)

    for k,v in ipairs(rooms) do
        Accelerator(acclerators[k], v)
    end

    --tprint(AcceleratorList())

end

shows that Ctrl+PageUp and Ctrl+PageDown are both mapped now. I'm not positive that PageDown was added in a previous buggy version of my code, and not being added each time.


Also, a script entered from the command line: Accelerator("Ctrl+PageDown", "") doesn't get rid of it. I'd like the Accelerators removed so that in the next room, I don't fat finger the wrong key and send bad/deadly commands to the mud.
USA Global Moderator #1
It looks to me like the accelerator does get removed. It just doesn't get changed in whatever display list AcceleratorList() is pulling from.

If I do Accelerator("Ctrl+PageDown", ""), the accelerator stops working, but AcceleratorList still shows the old setting.