Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with loading a MIAW being selected from a list.

Status
Not open for further replies.

Eagels14

Technical User
May 13, 2004
3
US
I am creating a matching game which is already comeplete and functionable. (you know the game you flip over a card or picture and try to find its match if you get it they stay flipped over if not they both go back to the other side. You win when you make all the matches).
However I want to throw a little twist to it. When you get a match I would like a MIAW to open up and play a short video clip. I figured that I could put the video clips into a list and always play the first video in the list and after each time a video is played delete the first item in the list (therefore you don't ever play the same movie twice.)
I have some of the script but I just need a little help finetuning as this script doesn't work.


On startMovie
global gwlist
gwlist = ["info", "ecomm", "net"]
end


on vidrun
gwlist = ["info", "ecomm", "net"]
put gwlist
-- ["info", "ecomm", "net"]
gwlist.deleteat(1)
put gwlist
-- ["net"]

put
put list
-- <Void>
put gwlist
-- ["ecomm", "net"]

put gwlist
-- ["net"]
global ewindow
put gwlist[1]
-- "net"
ecomm = gwlist[1]
put ecomm
-- "net"
wecomm = window(gwlist[1])
open wecomm
gwlist.deleteat(1)
put gwlist
-- []
if gwlist = [] then


Please any help is very much appriciated.
 
This is perhaps what you're trying to do:
--
global gwlist

on startMovie
gwlist = ["info", "ecomm", "net"]
end startMovie

on vidrun
if gwlist.count < 1 then
nothing
-- or put some action here - there're nothing left in gwlist
else
window(gwlist[1]).open()
gwlist.deleteAt(1)
end if
end vidrun
--
 
I have tried to put this in instead and I get a script error of expected end if on vidrun?
I don't understand because the end if is there. I have included the entire script to look at. Again this is a matching game that I want a video (MIAW) to pop up when a match is made and when the video is over to go back to the point you were at in the game.
global gItemList, gSelected, gwlist

on startMovie
-- randomize items
gItemList = createList()

gSelected = 0

gwlist = ["ecomm", "net"]
end startMovie


on createList
-- create ordered list
templist = []
repeat with i = 1 to 8
add templist, i
add templist, i
end repeat

-- shuffle list
list = []
repeat while templist.count > 0
r = random(templist.count)
add list, templist[r]
deleteAt templist, r
end repeat

return list
end

-- this handler is called by the item sprites when the user clicks
-- 10 is subtracted from the sprite number because the items
-- start with sprite 11
on clickItem sNum
-- take control of sprite and turn over
puppetSprite sNum, TRUE
sprite(sNum).member = member(gItemList[sNum-10],"Items")

if gSelected = 0 then
-- first item turned over
gSelected = sNum

else if gSelected = sNum then
-- user clicked on selected item
-- do nothing

else if gItemList[sNum-10] = gItemList[gSelected-10] then
-- user clicked on matching item
-- make both go away
sprite(sNum).memberNum = 0
sprite(gSelected).memberNum = 0



on vidrun
if gwlist.count < 1 then
nothing
-- or put some action here - there're nothing left in gwlist
else
window(gwlist[1]).open()
gwlist.deleteAt(1)

end if
end vidrun




-- set items in list to 0
gItemList[sNum-10] = 0
gItemList[gSelected-10] = 0

-- reset selection
gSelected = 0

-- check for end of game
if checkForDone() then
go to frame "done"
end if

else
-- user clicked on wrong item
-- turn last item back over
sprite(gSelected).member = member("Blank")

-- item clicked in now one selected
gSelected = sNum
end if
end

on checkForDone
repeat with i in gItemList
-- found an item still there
if i <> 0 then return FALSE
end repeat

-- all were 0, so game is over
return TRUE
end

 
A quick note:
Your script is missing "end if" & "end" in "on clickItem" handler. Also the following commands appear without handlers:

-- set items in list to 0
gItemList[sNum-10] = 0
gItemList[gSelected-10] = 0

-- reset selection
gSelected = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top