Replacing alert()

Share your scripts and packages with other Mudlet users.
Post Reply
User avatar
Posts: 3
Joined: Sun Jan 16, 2022 9:24 am

Replacing alert()

Post by Mabuse »

I tried to use alert() on Windows 11 to attract the users attention and had to notice that MS made their icons flash in such a new manner that you will never notice this when working in other windows.

@demonnic has pointed me to the "showNotification" function, but I decided to do it my way:

I made a script which plays a small "ding" via "playSoundFile(...)" and then call a small function to let the whole window contents blink.
My Mudelt is never hidden by other windows in whole, so this blinking and "Ding" tells to react to some situations when "idling" around and doing other stuff.

Feel free to use this snippet if it is according to your situation:
Code: [show] | [select all] lua
function toNumber(number)
    local result = tonumber(number)
    if result ~= nil then
        return result
    return nil

function blink(count, time)
    if toNumber(count) == nil and toNumber(time) == nil then count = 3 end
    count = toNumber(count) or 1
    time = toNumber(time) or 0.4
    local main = Geyser.Container:new({name = "blinker", x=0,y=0,width="100%",height="100%"})
    if count > 1 then
        tempTimer(2 * time, [[ffblink(]] .. (count-1) ..  [[, ]] .. time .. [[)]])
Homer says: " Hello !? Operator ! Give me the number for 911 !!! "

Post Reply