Aaagghh!
I don't know if it's a bug, or it's something I'm doing wrong.
Working in Metacard 2.4.
The objective is simple: when the user clicks a button, the cursor
changes to a different image, and follows the mouse until a user
clicks another button. Then the cursor changes again, until the user
clicks anywhere.
I didn't see any choices for changing the cursor image to one of my
own, so I chose to hide the cursor, and show a button with the image
I want, and have that button follow the mouse.
It works fine until the line marked with ###. For some reason, it
considers the mouse to be down already, so it never traps for another
"mouse is down". I tried:
repeat until the mouseClick
repeat until mouseDoubleDown
repeat until the mouse is up
and several other variations, including "if the mouseClick then exit
repeat" etc.
and variations of those such as mouseClick() and adding/subtracting
"the" etc. It hangs in the repeat loop with the ###.
I tried showing the cursor, in case it didn't get messages with the
cursor hidden.
This should be so simple! But it just hangs there until I Command-Period.
Anybody? I've been at this for about 5 hours, and I'm baffled. (You
can email me privately as I get this in digest form, and I'll get any
ideas quicker that way.)
on mouseUp
set the icon of cd btn "curse" to 2828
show cd btn "curse"
set the cursor to none
repeat until the mouse is down
set the loc of cd btn "curse" to the mouseLoc
end repeat
send changeCurse to btn id 2660
end mouseUp
on changeCurse
global whichItem,useItem
repeat with x = 1 to 10
if the mouseLoc is within the rect of cd btn ("Item" && x) then
put "Item" && x into whichItem
put (the short name of image id(the icon of cd btn ("Item" &&
x))) into useItem
if useItem is "pencil" then
hide cd btn "curse"
send inWhat to btn id 2654
else if useItem is "eraser" then
set the icon of cd btn "curse" to useItem
send inWhat to btn id 2654
end if
end if
end repeat
end changeCurse
on inWhat -- 22
global inny,btnA
repeat with x = 1 to 16
put "Thing" && x into btnA
if intersect(cd btn "Dog",cd btn btnA) and the visible of cd btn
btnA is true then
put (the short name of image id(the icon of cd btn btnA)) into inny
send doWhat to btn id 2655
exit inWhat
end if
end repeat
repeat until the mouse is down ####### script hangs here
set the loc of cd btn "curse" to the mouseLoc
end repeat
repeat with x = 1 to 10
put "Item" && x into btnA
if intersect(cd btn "Curse",cd btn btnA) and the visible of cd
btn btnA is true then
put (the short name of image id(the icon of cd btn btnA)) into inny
send doWhat to btn id 2655
exit repeat
end if
end repeat
end inWhat
--
--Shareware Games for the Mac--
http://www.gypsyware.com
http://www.gypsygames.com