Quote: "You should post some code at the very least as your problem could be just about anything."
Ok I will try but it will need some explaining. There are six 'screens' which have this problem. Two of them are the results screen which state who or which team has one. The other four are all input pages; two for team mode, two for torniment mode. I will show you for code for the first page of the team mode input. This is very similar to the other four input pages and is the most complex. I will also add the code for both of the results pages as this may help and they are handled by the same function.
Page One of the Team Input Page:
`There is already a page full of input boxes displayed when this begins. There is a background picture and 18 text boxes. There are 2 collumns of 8 text boxes and two at the top for the team names. There is also a back button and an enter button, as well as a next page button.
function PageOne()
sync on
nSelectedTxtBox = 0
REM *** Check for Commands ***
repeat
sync
nMouse = 0
sKey$ = ""
nKey = 0
repeat ` This checks for inputs to the form
nMouse = mouseclick()
sKey$ = inkey$()
nTime = timer()
repeat
nKey = scancode()
until timer() - nTime > 50
WaitScreenOne(1)
sync
until nMouse = 1 OR sKey$ <> "" OR nKey = 14 `14 is delete
nMouseX = mousex()
nMouseY = mousey()
REM *** Perform Commands ***
REM *** Open Character Slot Command ***
for c = 101 TO 116
if ButtonClick(c,nMouseX,nMouseY) = 1 AND nMouse = 1 `button click returns one if the sprite representing the button has been clicked on
if aPlayers(c - 100).bOpen = 1 ` aPlayers is an array from 0 to 32/ bOpen signifies that that character slot in the array will be used in the next game
for e = c TO 132
set sprite frame e,1 ` next to each text box is a check box to 'open' the character slot. If a character slot is closed, all the character slots after it are also closed using this code.
next e
for e = c + 200 TO 332
set sprite frame e,1
next e
for e = c + 300 TO 432
set sprite frame e,1
next e
for e = c + 400 TO 532
set sprite frame e,1
next e
for e = c - 100 TO 32
aPlayers(e).bOpen = 0
next e
for e = c - 100 TO 32
aPlayers(e).sName = ""
next e
if nSelectedTxtBox >= c
nSelectedTxtBox = 0
endif
WaitScreenOne(150) ` WaitScreenOne is a function which loops for the time in brackets and is used to display the screen. I have added it below.
else
if c = 101 ` this code checks that all previous character slots are open before opening the requested one
set sprite frame c,2
aPlayers(c - 100).bOpen = 1
WaitScreenOne(150)
else
d = c - 101
if aPlayers(d).bOpen = 1
set sprite frame c,2
aPlayers(c - 100).bOpen = 1
WaitScreenOne(150)
endif
endif
endif
endif
next c
REM *** Random Teams Command ***
for c = 201 TO 216 `this tells the computer that it must select random teams and as such, it removes the team selection options from the form by greying them out
if ButtonClick(c,nMouseX,nMouseY) = 1 AND nMouse = 1
d = c - 200
if aPlayers(d).bOpen = 1
if bRandom = 0
for e = 201 TO 232
set sprite frame e,2
next e
for e = 301 TO 332
set sprite frame e,3
next e
for e = 401 TO 432
set sprite frame e,3
next e
bRandom = 1
WaitScreenOne(150)
else
for e = 201 TO 232
set sprite frame e,1
next e
for e = 301 TO 332
set sprite frame e,1
next e
for e = 401 TO 432
set sprite frame e,1
next e
bRandom = 0
WaitScreenOne(150)
endif
endif
endif
next c
REM *** Join Team One Command ***
for c = 301 TO 316
if ButtonClick(c,nMouseX,nMouseY) = 1 AND nMouse = 1
d = c - 300
if aPlayers(d).bOpen = 1
if bRandom = 0
d = c - 300
aPlayers(d).nTeam = 1
set sprite frame c,2
d = c + 100
set sprite frame d,1
WaitScreenOne(150)
endif
endif
endif
next c
REM *** Join Team Two Command ***
for c = 401 TO 416
if ButtonClick(c,nMouseX,nMouseY) = 1 AND nMouse = 1
d = c - 400
if aPlayers(d).bOpen = 1
if bRandom = 0
d = c - 400
aPlayers(d).nTeam = 2
set sprite frame c,2
d = c - 100
set sprite frame d,1
WaitScreenOne(150)
endif
endif
endif
next c
REM *** Text Boxes ***
for c = 501 TO 516
d = c - 500
if aPlayers(d).bOpen = 1
if ButtonClick(c,nMouseX,nMouseY) = 1 AND nMouse = 1
if nSelectedTxtBox = c
set sprite frame c,1
nSelectedTxtBox = 0
else
for d = 501 TO 534
set sprite frame d,1
next d
set sprite frame c,2 `frame 2 of a text box is the highlighted version of it
nSelectedTxtBox = c
endif
WaitScreenOne(150)
endif
endif
next c
REM *** Other Commands ***
if ButtonClick(533,nMouseX,nMouseY) = 1 AND nMouse = 1 ` this is one of the two team name input text boxes
if nSelectedTxtBox = 533
set sprite frame 533,1
nSelectedTxtBox = 0
else
for d = 501 TO 534
set sprite frame d,1
next d
set sprite frame 533,2
nSelectedTxtBox = 533
endif
WaitScreenOne(150)
endif
if ButtonClick(534,nMouseX,nMouseY) = 1 AND nMouse = 1 ` this is the other team name text box. Both have capsions displayed as png files.
if nSelectedTxtBox = 534
set sprite frame 534,1
nSelectedTxtBox = 0
else
for d = 501 TO 534
set sprite frame d,1
next d
set sprite frame 534,2
nSelectedTxtBox = 534
endif
WaitScreenOne(150)
endif
if ButtonClick(606,nMouseX,nMouseY) = 1 AND nMouse = 1 ` this is the next page button
exitfunction 2
endif
if ButtonClick(611,nMouseX,nMouseY) = 1 AND nMouse = 1 ` this is the back button
set sprite frame 611,2
sync
sTeamOne = "Team One"
sTeamTwo = "Team Two"
bBack = 1
nScreenLoad = 4
WaitScreenOne(500)
exitfunction 3
endif
if ButtonClick(613,nMouseX,nMouseY) = 1 AND nMouse = 1 ` this is the enter button
nOK = 1
nTeamOneHasMember = 0
nTeamTwoHasMember = 0
for p = 1 TO 32
if aPlayers(p).nTeam = 1
nTeamOneHasMember = 1
endif
if aPlayers(p).nTeam = 2
nTeamTwoHasMember = 1
endif
next
if aPlayers(1).bOpen <> 1 or aPlayers(2).bOpen <> 1
nOK = 0
else
for d = 1 TO 32
if aPlayers(d).bOpen = 1
if aPlayers(d).nTeam < 1 and bRandom <> 1
nOK = 0
else
if aPlayers(d).sName = ""
nOK = 0
endif
endif
endif
next d
endif
if sTeamOne = "" or sTeamTwo = ""
nOK = 0
endif
if sTeamOne = sTeamTwo
nOK = 0
endif
if (nTeamTwoHasMember = 0 or nTeamOneHasMember = 0) and bRandom = 0
nOK = 0
endif
set sprite frame 613,2
WaitScreenOne(1)
sync
WaitScreenOne(500)
if nOK = 1
CountPlayers()
exitfunction 3
else
set sprite frame 613,1
endif
endif
REM *** Text Input Commands ***
if sKey$ <> ""
if nSelectedTxtBox > 0
d = nSelectedTxtBox - 500
if nSelectedTxtBox <= 532
if len(aPlayers(d).sName) < 14
aPlayers(d).sName = aPlayers(d).sName + sKey$
endif
else
if nSelectedTxtBox = 533
if len(sTeamOne) < 14
sTeamOne = sTeamOne + sKey$
endif
else
if len(sTeamTwo) < 14
sTeamTwo = sTeamTwo + sKey$
endif
endif
endif
endif
WaitScreenOne(150)
endif
REM *** Delete Command ***
if nKey = 14
if nSelectedTxtBox > 0
d = nSelectedTxtBox - 500
if nSelectedTxtBox <= 532
if len(aPlayers(d).sName) > 0
aPlayers(d).sName = left$(aPlayers(d).sName,(len(aPlayers(d).sName)-1))
endif
else
if nSelectedTxtBox = 533
if len(sTeamOne) > 0
sTeamOne = left$(sTeamOne,(len(sTeamOne)-1))
endif
else
if len(sTeamTwo) > 0
sTeamTwo = left$(sTeamTwo,(len(sTeamTwo)-1))
endif
endif
endif
endif
WaitScreenOne(1)
sync
endif
until nEnterPressed = 1
sync off
endfunction 3
function WaitScreenOne(nTime)
nCounter = timer()
repeat ` this is where all of the text is displayed
for c = 501 TO 516
if check display mode (1280,1024,32) = 1
set cursor sprite x(c) - (sprite width(c) / 2) + 5,sprite y(c) - 15
else
set cursor sprite x(c) - (sprite width(c) / 2) + 5,sprite y(c) - 8
endif
d = c - 500
if nSelectedTxtBox = c
print aPlayers(d).sName + "|"
else
print aPlayers(d).sName
endif
next c
if check display mode (1280,1024,32) = 1
set cursor sprite x(533) - (sprite width(533) / 2) + 5,sprite y(533) - 15
else
set cursor sprite x(533) - (sprite width(533) / 2) + 5,sprite y(533) - 8
endif
if nSelectedTxtBox = 533
print sTeamOne + "|"
else
print sTeamOne
endif
if check display mode (1280,1024,32) = 1
set cursor sprite x(534) - (sprite width(534) / 2) + 5,sprite y(534) - 15
else
set cursor sprite x(534) - (sprite width(534) / 2) + 5,sprite y(534) - 8
endif
if nSelectedTxtBox = 534
print sTeamTwo + "|"
else
print sTeamTwo
endif
until timer() - nCounter > nTime
endfunction
The Multiplayer Results Page:
function MultiPlayerResultsPage()
REM *** Check for Back ***
if bBack = 1
exitfunction
endif
REM *** Clear Screen ***
hide all sprites
stop animation 1
place animation 1,0,-100,0,-100
SetMultiSpriteFrames()
show mouse ` I hide it during the games (they work fine)
if nTeamOrTorn = 1 ` meaning that team mode is on
REM *** Draw Screen ***
stop music 2
loop music 3
set sprite alpha 39,80
show sprite 39
show sprite 12
if check display mode (1280,1024,32) = 1
move sprite 12,-220
else
move sprite 12,-90
endif
show sprite 613
nEnterPressed = 0
if nTeamOneWins > nTeamTwoWins
sTeam$ = sTeamOne
endif
if nTeamTwoWins > nTeamOneWins
sTeam$ = sTeamTwo
endif
if nTeamOneWins = nTeamTwoWins
sTeam$ = "Nobody"
endif
if check display mode (1280,1024,32) = 1
set text size 60
else
set text size 30
endif
repeat
nMouse = 0
repeat
if check display mode (1280,1024,32) = 1
set cursor screen width() / 4,screen height() / 4 * 3
print sTeam$," is Victorious!!!"
set cursor screen width() / 30,screen height() / 4 * 3 + 40
print "The final score was:"
set cursor screen width() / 30,screen height() / 4 * 3 + 90
print sTeamOne," : ",nTeamOneWins
set cursor screen width() / 30,screen height() / 4 * 3 + 140
print sTeamTwo," : ",nTeamTwoWins
else
set cursor screen width() / 4,screen height() / 4 * 3
print sTeam$," is Victorious!!!"
set cursor screen width() / 30,screen height() / 4 * 3 + 20
print "The final score was:"
set cursor screen width() / 30,screen height() / 4 * 3 + 45
print sTeamOne," : ",nTeamOneWins
set cursor screen width() / 30,screen height() / 4 * 3 + 70
print sTeamTwo," : ",nTeamTwoWins
endif
nMouse = mouseclick()
until nMouse = 1
nMouseX = mousex()
nMouseY = mousey()
REM *** Perform Commands *** ` checks to see if the player want to leave the page
if ButtonClick(613,nMouseX,nMouseY) = 1
nEnterPressed = 1
set sprite frame 613,2
nTime = timer()
repeat
if check display mode (1280,1024,32) = 1
set cursor screen width() / 4,screen height() / 4 * 3
print sTeam$," is Victorious!!!"
set cursor screen width() / 30,screen height() / 4 * 3 + 40
print "The final score was:"
set cursor screen width() / 30,screen height() / 4 * 3 + 90
print sTeamOne," : ",nTeamOneWins
set cursor screen width() / 30,screen height() / 4 * 3 + 140
print sTeamTwo," : ",nTeamTwoWins
else
set cursor screen width() / 4,screen height() / 4 * 3
print sTeam$," is Victorious!!!"
set cursor screen width() / 30,screen height() / 4 * 3 + 20
print "The final score was:"
set cursor screen width() / 30,screen height() / 4 * 3 + 45
print sTeamOne," : ",nTeamOneWins
set cursor screen width() / 30,screen height() / 4 * 3 + 70
print sTeamTwo," : ",nTeamTwoWins
endif
until timer() - nTime > 500
endif
until nEnterPressed = 1
else ` meaning that torniment mode has just been played
REM *** Calculate the Winner ***
nWinner = 0
nSecond = 0
if aPlayers(nPlayerOne).bAlive = 1
nWinner = nPlayerOne
nSecond = nPlayerTwo
else
nWinner = nPlayerTwo
nSecond = nPlayerOne
endif
REM *** Check/ Update Highscores ***
ReadHighScoresData() ` does just that, reads the data from a file into a global array type
if nNoOfPlayers > aHighscoresData(10).nNumericData
UpdateHighScoresTorniment(nWinner)
endif
REM *** Draw Screen ***
stop music 2
loop music 3
set sprite alpha 39,80
show sprite 39
show sprite 12
if check display mode (1280,1024,32) = 1
move sprite 12,-220
else
move sprite 12,-90
endif
show sprite 613
nEnterPressed = 0
if check display mode (1280,1024,32) = 1
set text size 60
else
set text size 30
endif
repeat
nMouse = 0
repeat
set cursor screen width() / 4,screen height() / 4 * 3
print "In 1st Place : ",aPlayers(nWinner).sName
set cursor screen width() / 4,screen height() / 4 * 3 + 60
print "In 2nd Place : ",aPlayers(nSecond).sName
nMouse = mouseclick()
until nMouse = 1
nMouseX = mousex()
nMouseY = mousey()
REM *** Perform Commands ***
if ButtonClick(613,nMouseX,nMouseY) = 1
nEnterPressed = 1
set sprite frame 613,2
nTime = timer()
repeat
set cursor screen width() / 4,screen height() / 4 * 3
print "In 1st Place : ",aPlayers(nWinner).sName
set cursor screen width() / 4,screen height() / 4 * 3 + 60
print "In 2nd Place : ",aPlayers(nSecond).sName
nMouse = mouseclick()
until timer() - nTime > 500
endif
until nEnterPressed = 1
endif
if check display mode (1280,1024,32) = 1
move sprite 12,220
else
move sprite 12,90
endif
endfunction
I have put notes through the code to try and make it easier to understand. I hope this helps and any hints you can give me are most welcome. If you want any more code or any explanations, do feel free to ask. Thanks again, Lucas