Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ Trouble with WindowAddHotspot

Trouble with WindowAddHotspot

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Norbert   USA  (61 posts)  Bio
Date Sun 24 Aug 2008 03:49 AM (UTC)
Message
I can't seem to get my hotspots to add. I took these examples from the help and still cannot get the hotspots to add. I'm using version 4.35 on a Vista computer. WindowHotspotList is always nil.

WindowCreate ("test", 0, 0, 200, 200, 6, 0, ColourNameToRGB("slategray"))
WindowAddHotspot("test", "hs1",  
                 0, 0, 200, 200,   -- rectangle
                 "mouseover", 
                 "cancelmouseover", 
                 "mousedown",
                 "cancelmousedown", 
                 "mouseup", 
                 "Click here to be healed",  -- tooltip text
                 1, 0)  -- hand cursor
function mouseover (flags, hotspot_id)
  Note ("we moused over hotspot " .. hotspot_id)
end -- mouseover
WindowShow("test", true)
-- show all hotspots
hotspots = WindowHotspotList("test")

if hotspots then
  for _, v in ipairs (hotspots) do 
    Note (v) 
  end
end -- if any 


Norbert

-Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens
It's a dumb question... skip it.
Top

Posted by Nick Gammon   Australia  (23,068 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 24 Aug 2008 04:59 AM (UTC)
Message
It helps to wrap a function call with "check", especially if you are having problems. This only applies to functions that are documented to return eOK, and other codes. Like this:


check (WindowAddHotspot("test", "hs1",  
                 0, 0, 200, 200,   -- rectangle
                 "mouseover", 
                 "cancelmouseover", 
                 "mousedown",
                 "cancelmousedown", 
                 "mouseup", 
                 "Click here to be healed",  -- tooltip text
                 1, 0))  -- hand cursor


When I tried that I got:


Run-time error
World: smaug 2
Immediate execution
[string "Immediate"]:2: Only a plugin can do this
stack traceback:
        [C]: in function 'error'
        [string "Check function"]:1: in function 'check'
        [string "Immediate"]:2: in main chunk


Were you doing this in a plugin?


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Norbert   USA  (61 posts)  Bio
Date Reply #2 on Sun 24 Aug 2008 06:36 AM (UTC)
Message
I'm building the script in my world script file then plan to move it to a plugin once I have it all working. I'm trying to recreate a compass like Darwin's for the mud I play on. Does this mean I need to move it to a plugin now and maybe it'll work?

Norbert

-Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens
It's a dumb question... skip it.
Top

Posted by Darwin   USA  (125 posts)  Bio
Date Reply #3 on Sun 24 Aug 2008 08:19 AM (UTC)
Message
That's exactly what it means. The hotspot functions will only work once inside a plugin file. I ran into the same problem.
Top

Posted by Norbert   USA  (61 posts)  Bio
Date Reply #4 on Mon 25 Aug 2008 02:32 AM (UTC)
Message
Thanks works great.

Norbert

-Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens
It's a dumb question... skip it.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,244 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.