Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Choose-your-own-adventure gave #2




On Apr 22, 2005, at 8:32 PM, Connor Wakamo wrote:

Hello,

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


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-studio mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
References: 
 >Choose-your-own-adventure gave #2 (From: Connor Wakamo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.