Ask a Question related to Macromedia Director Lingo, Design and Development.
-
WickedSense webforumsuser@macromedia.com #1
Eliminating repeat calls from a list
Hi,
I am a student working on a childrens game. The concept is a spelling bee. A picture pops up, a voice speaks the word, and there is a field to input the text to spell the word. I have 50 words right now, in a list that associates the word, picture and sound. then I have a random number -random(50)- generated to pull a random item out of the list, each level of the spelling bee is only 10 questions long. I want to eliminate the chance of the same item being pulled from the list during play.
Here is my current script to generate the word picture and sound. (I shortened the database to make it easier to read, but there are 50 items in the list, each item containing the three elements.)
on displayquestion
pDatabase = [["acorn", "acornpic", "acornsound"],["apple", "applepic", "applesound"],["bag", "bagpic", "bagsound"],["ball", "ballpic", "ballsound"]]
pVariable = random(50)
pSet = pDatabase[integer(pVariable)]
sprite(4).member = pSet[2]
sprite(4).locH = 320
sprite(4).locV = 260
sprite(4).visible = true
pCorrectAnswer = pSet[1]
end
on checkquestion
if member("field").text = pCorrectAnswer then
pCorrect = pCorrect + 1
pQuestionnum = pQuestionnum + 1
member("field").text = ""
updatescore
else if member("field").text <> pCorrectAnswer then
pincorrect = pincorrect + 1
pQuestionnum = pQuestionnum + 1
member("field").text = ""
updatescore
end if
gPress = false
displayquestion
end
Again, I want to eliminate the chance of the same item being called from the list twice. Any help is greatly appreciated! THANKS!
Brad
WickedSense webforumsuser@macromedia.com Guest
-
How to Display Repeat List In Spry Tab Content
Hello, I am new to Spry. I thought I could just create an XML dataset, Insert a Spry Tabbed Panel, and then insert a Spry repeat list inside the... -
eliminating like items in dynamically loaded list boxes
Hello- I am currently learning coldfusion and I have just connected to a MS Access database and I have created some dynamically loaded list boxes.... -
background-repeat: repeat-x in HTML? Please help!
I want to have a "centered page" look full screen...I have made them using layers and CSS but if I need it to work in most browsers how do I do the... -
Can we place repeat region on dynamic list/menu
Hey y'all: Having some problems with inserting all fields in a table from SQL db. While we manage to call up teh 5 rows from SQL using a list... -
eliminating red eye
I downloaded my pictures to iphoto and eliminated the "red eye" in some of the pictures. When I open them in photoshop the red eye is still present.... -
Gabriel #2
Re: Eliminating repeat calls from a list
delete the item after you use it
and so, instead of random 50 you should
call random in to the remaining questions..
pVariable should be
pVariable = random( pDatabase.count() )
and at the end of the displayquestion
pDatabase.deleteAt( pVariable )
... just noticed ..
you should not initialize the list in the same handler that you use for
selecting and deleting (for obvious reasons.... )
so on startmovie should be a betterPlace ... or on beginsprite if you are
using a behaviour to control the questions..
hope this helps
gabriel
Gabriel Guest
-
WickedSense webforumsuser@macromedia.com #3
Re: Eliminating repeat calls from a list
Wow! Great, the advice worked out, no more duplicates!
Also, since there are three levels, and each level is scripted at a seperate marker (different locations in other words) I decided to establish my 3 databases like this within a movie script.
global gDatabase1, gDatabase2, gDatabase3
on preparemovie
gDatabase1 = [["acorn", "acornpic", "acornsound"],["apple", "applepic", "applesound"], etc.
gDatabase2 = [["airplane", "airplanepic", "airplanesound"],etc.
gDatabase3 = [["airplane", "airplanepic", "airplanesound"],etc.
end
This is working great, i thought i'd mention it because I am unsure of the pros and cons of using globals compared to properties
WickedSense webforumsuser@macromedia.com Guest



Reply With Quote

