Hi,
I’m currently learning Ruby and practicing scripting in RPG Maker XP. I’ve been experimenting with meta-interactions, and I want to make a Windows alert box (like MessageBoxA) pop up when the player steps on a tile.
I know this might involve using Win32API, but I’m not sure how to call it correctly or where to place the code in XP’s script editor. I tried a few things, but I either get errors or nothing happens.
Here’s what I’ve tried so far
def show_alert(message, title = "Message from beyond")
if defined?(Win32API)
api = Win32API.new("user32", "MessageBoxA", ['L', 'P', 'P', 'L'], 'I')
api.call(0, message, title, 0)
else
print("#{title}: #{message}")
end
end
Thank you in advance
(I’m still learning, but I want to understand how it works — not just copy-paste.)
I’m currently learning Ruby and practicing scripting in RPG Maker XP. I’ve been experimenting with meta-interactions, and I want to make a Windows alert box (like MessageBoxA) pop up when the player steps on a tile.
I know this might involve using Win32API, but I’m not sure how to call it correctly or where to place the code in XP’s script editor. I tried a few things, but I either get errors or nothing happens.
Here’s what I’ve tried so far
def show_alert(message, title = "Message from beyond")
if defined?(Win32API)
api = Win32API.new("user32", "MessageBoxA", ['L', 'P', 'P', 'L'], 'I')
api.call(0, message, title, 0)
else
print("#{title}: #{message}")
end
end
Thank you in advance
(I’m still learning, but I want to understand how it works — not just copy-paste.)