Quiz variables
Posted: Mon May 15, 2023 6:33 pm
Hi!
I am new to coding and livecode. I am working on a project for class and part of it is a quiz where depending on the answer they select it will recommend different movies. I tried to use global variables but it is not working how I want it. The last card under the quiz section, it should input the movie recommendation into the field based on their selections. Any help is appreciated!
This is the code of my result card :
global gGenreType, gRatingType, gRunTime
on openCard
put (gGenreType && gRatingType && gRunTime) into theResult
-- put theResult into msg
if (gGenreType is "Psychological") and (gRatingType is "Rotten Tomato") and (gRunTime is "More than 2hrs") then
put "Us 2019" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Audience Score") and (gRunTime is "More than 2hrs") then
put "Shutter Island 2010" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Rotten Tomato") and (gRunTime is "Less than 2hrs") then
put "Get out 2017" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Audience Score") and (gRunTime is "Less than 2hrs") then
put "Us 2019" into field "Movie Result"
end if
end openCard
This is the code on my one of my buttons
global gRunTime
on mouseUp
put the short name of me into gRunTime
go to card "Movie Result"
end mouseUp
I am new to coding and livecode. I am working on a project for class and part of it is a quiz where depending on the answer they select it will recommend different movies. I tried to use global variables but it is not working how I want it. The last card under the quiz section, it should input the movie recommendation into the field based on their selections. Any help is appreciated!
This is the code of my result card :
global gGenreType, gRatingType, gRunTime
on openCard
put (gGenreType && gRatingType && gRunTime) into theResult
-- put theResult into msg
if (gGenreType is "Psychological") and (gRatingType is "Rotten Tomato") and (gRunTime is "More than 2hrs") then
put "Us 2019" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Audience Score") and (gRunTime is "More than 2hrs") then
put "Shutter Island 2010" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Rotten Tomato") and (gRunTime is "Less than 2hrs") then
put "Get out 2017" into field "Movie Result"
end if
if (gGenreType is "Psychological") and (gRatingType is "Audience Score") and (gRunTime is "Less than 2hrs") then
put "Us 2019" into field "Movie Result"
end if
end openCard
This is the code on my one of my buttons
global gRunTime
on mouseUp
put the short name of me into gRunTime
go to card "Movie Result"
end mouseUp