I am still working on my choose-your-own-adventure game, and I want
to determine which button was pressed. Right now, I use this code:
on clicked theObject
--Option 1
if theObject is equal to button id 2 of window id 1 then
display dialog "Option 1 was chosen"
end if
--Option 2
if theObject is equal to button id 3 of window id 1 then
display dialog "Option 2 was chosen"
end if
end clicked
Right now, when the first button that I press first becomes gets
handled as "Option 1" and the second button pressed becomes "Option
2". I don't want it to change from run to run depending on what
the user does, I would like me to be able to say on the start
screen "Press any button to continue..." Right now, I am working
around this problem by forcing the user to press the button "Option
1". Any help will be greatly appreciated!
Set the names of the buttons to be something meaningful in IB then
use this
on clicked theObject
if name of theObject is "Yes" then
display dialog "Button 1"
else if name of theObject is "No" then
display dialog "Button 2"
else
display dialog "Button 3, maybe"
end
end