Getting data from a list

how do i get the returned data

what i want is


set set somelist to {"stuff", "other"}
set awesome to result of (choose from list somelist with prompt "chosse something!")
if awesome = "stuff" then
do something
else if awesome = "other" then
do something else
end if

when i run a script like that i get the error "cant get result of “other”
i also tried text returned of

how do you get what is picked from the menu into a variable?

and when i tried

set cool to (choose from list somelist)
if
cool = "something" then
do something
else if cool ="someone" then
do something else
end if

when i did this it skipped all the if then statements and got no errors

Even though you might only be getting one item from the list, the choice returns a list unless the choice is cancelled, which returns false. Check your User Interaction in the Standard Additions dictionary. You have the option of allowing/disallowing multiple selections and allowing/disallowing an empty selection.

set somelist to {"apples", "oranges", "bananas"}
set thechoice to choose from list somelist with prompt "Choose Your Fruit" OK button name "Fruit" cancel button name "Nah" with multiple selections allowed without empty selection allowed
if thechoice is not false then
	set mychoice to item 1 of thechoice
	if mychoice is "apples" then
		display dialog "You picked " & mychoice buttons {mychoice} default button 1 with icon note giving up after 30
	else if item 1 of thechoice is "oranges" then
		display dialog "You picked " & mychoice buttons {mychoice} default button 1 with icon note giving up after 30
	else if item 1 of thechoice is "bananas" then
		display dialog "You picked " & mychoice buttons {mychoice} default button 1 with icon note giving up after 30
	end if
else
	display dialog "User cancelled" buttons {"Boo"} default button 1 with icon stop giving up after 30
end if

that didnt work…

here is the exact script i am working with, yes its a pokemon game its for my sister


set rivald to 1
set yourd to 1
repeat
		display dialog your_poke & " Level: " & your_poke_level & " Health: " & your_poke_current_health & "/18" & return & enemy_poke & " Level: " & rival_poke_level & " Health: " & rival_poke_current_health & "/18"
		set attack to choose from list first_attacks with prompt "Choose Attack" OK button name "Attack" cancel button name "Nothing" with multiple selections allowed without empty selection allowed
		
		
		if attack = "Tail Whip" then
			if rivald = 1 then
				set rivald to rivald - 1
				
				display dialog enemy_poke & "'s defence has fallen!"
			else if rivald is not equal to 0 then
				display dialog enemy_poke & "'s defence can't fall any more!"
			end if
			
			
		else if attack = "Tackle" then
			set damage to random number from 2 to 3
			set damage to damage - rivald
			set totaldamage to (damage * your_poke_level) - (rival_poke_level - rivald)
			set rival_poke_current_health to rival_poke_current_health - totaldamage
			display dialog "Your tackle attack did " & totaldamage & " damage" buttons {"Ok"} default button 1
			
		else if attack = "Growl" then
			if rivald = 1 then
				set rivald to rivald - 1
				display dialog ""
			else if rivald is not equal to 0 then
				display dialog enemy_poke & "'s defence cant fall any more!"
			end if
			
		else if attack = "Thunder Shock" then
			set damage to random number from 2 to 4
			set damage to damage - rivald
			set totaldamage to (damage * your_poke_level) - (rival_poke_level + rivald)
			set rival_poke_current_health to rival_poke_current_health - totaldamage
			display dialog "Your Thunder Shock attack did " & totaldamage & " damage!"
			
			
		else if attack = "Scratch" then
			set damage to random number from 2 to 4
			set damage to damage - rivald
			set totaldamage to (damage * your_poke_level) - (rival_poke_level + rivald)
			set rival_poke_current_health to rival_poke_current_health - totaldamage
			display dialog "Your Scratch attack did " & totaldamage & " damage!"
		end if
		
		
		
		set attack to item (random number from 1 to (length of enemy_attack_list)) of enemy_attack_list
		
		
		if rival_poke_current_health < 1 then
			display dialog "You have won your first battle!" buttons {"Alright!"} default button 1
			display dialog "and " & your_pokemon_name & "has advanced to level 6!" buttons {"Yes!"} default button 1
			set your_poke_level to 6 as integer
			exit repeat
			
		else if your_poke_current_health < 1 then
			display dialog "You have lost you first battle" buttons {"Fine"} default button 1
		end if
		
	end repeat

that whenever you pick the attack it seems to skip all the if them statements and restart the loop.

But you didn’t follow blankreb’s advice. You need to extract the string from the 1-item list that “choose from list” returns:

...
		set attack to choose from list first_attacks with prompt "Choose Attack" OK button name "Attack" cancel button name "Nothing" with multiple selections allowed without empty selection allowed

		-- debugging
		--
		-- return attack --> { "Tail Whip" }, a single item list

		set attack to item 1 of attack --> "Tail Whip"

		if attack = "Tail Whip" then
...

Also, I noted that you used “with multiple selections allowed” for the “choose from list” command, meaning that the user can select more than one attack. In that case, you could do this:

...
	set attackList to choose from list (...blah...) with multiple selections allowed

	if ( attackList contains {"Tail Whip"} ) then

		-- do Tail Whip attack

	end if -- end this attack

	if ( attackList contains {"Can of Whoop-Ass"} ) then

		-- do the next user-selected attack

	end if -- end this attack
...