Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NecroDayz

macrumors newbie
Original poster
Feb 25, 2013
5
0
So I want to make a complex dialog with text + variable but I cant figure it out:(

Code:
Code:
if possibility is equal to "You find something" then
		set actionsomething to display dialog "What now?" buttons {"Examine", "Nothing"}
		set actionsomething to button returned of actionsomething
		if actionsomething is equal to "Examine" then
			set actionexamine to some item of {"Gold", "Strange Object"}
			if actionexamine is equal to "Gold" then
				set amount to random number from 1 to 100
				display dialog "You found" and amount and "Gold"
 
Your code snippet seems to be missing a few lines - each multiple line if statement needs to be balanced with an end if.

The and keyword is a boolean operator - the string concatenation operator is the ampersand (&), so your statement would be something like:

Code:
display dialog "You found " & amount & " Gold"
 
Thanks for the help, the missing end ifs are just me forgetting to copy them
 
display dialog doesn't return text. This works:

Code:
if possibility is equal to "You find something" then
	set actionsomething to button returned of (display dialog "What now?" buttons {"Examine", "Nothing"})
	
end if
if actionsomething is equal to "Examine" then
	set actionexamine to some item of {"Gold", "Strange Object"}
end if

if actionexamine is equal to "Gold" then
	set amount to random number from 1 to 100
	display dialog "You found " & amount & " Gold"
end if
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.