Interesting. You are wanting it to automatically change the cursor on mouse over based on a prefix setting. That's a nice idea.
Quick note: You should include another query to check if you are currently holding an item, otherwise it will change the cursor, but you will still be holding said item, which might confuse the player as they will probably think the item has been dropped but will find out otherwise when they try to click on something.
Here's the function I use for setting cursors in the current project I'm working on...
function setCursor(n)
if game.UsedItem:isEmpty() then
startAction("Actions[set_cursor_" .. n .. "]")
end
end
to set a cursor I create an execute an action part inside of each objects on mouse enter action containing something like...
...if item is not held then it will trigger a called by other action I created called "set_cursor_use", which contains a set cursor action part. I use the same method for resetting the cursor via the on mouse leave action with...
You method does sound more interesting to me though. I would recommend adding it to the mouseEvent handler function instead of mainLoop handler as it should only need to be checked on mouse cursor move instead of each system loop.