Image does not exist..problem

Blitz3D Forums/Blitz3D Beginners Area/Image does not exist..problem

luke101(Posted 2004) [#1]
Hello, I have an option in my game to change between full screen and windowed. When I make the change I redeclare all my graphics in a function. When the program reenters the main loop I get a image does not exist error.

Also, would you guys happen to know where can I find a free ide for blitz3d?


Warren(Posted 2004) [#2]
Whenever you change graphics mode, everything is flushed ... textures, meshes, etc. You need to reload them all whenever you use the "graphics" command.

It sounds like you are, but you apparently are not. :)


Ross C(Posted 2004) [#3]
Maybe your loading the images into local variables in the function, and they are lost when they come to be used in the main program.


luke101(Posted 2004) [#4]
I have all of my images as globals. I have RedeclareImages() function and Freeimages(). It seems like sometimes it works and some times it dosent. starting to believe it may be a Blitz bug. What do you think??


Ross C(Posted 2004) [#5]
Do you have any code, you could show?


jhocking(Posted 2004) [#6]
I'm starting to believe your RedeclareImages function isn't right. Nothing personal, I've just never had any problem like this. As Ross asked, it would be really useful if you could post some code demonstrating your problem. You don't need to post the actual images; we can swap in our own image files. Just the minimum code which demonstrates the problem.


luke101(Posted 2004) [#7]
code:
a
code:


luke101(Posted 2004) [#8]
[code]
print hello
[\code]


luke101(Posted 2004) [#9]
.start : print "hello" : goto start



luke101(Posted 2004) [#10]
how do i post code


luke101(Posted 2004) [#11]
AppTitle("Prime Word")
SeedRnd(MilliSecs())
Global AppPath$ = CurrentDir$()
Global MasterList$ = AppPath$ + "wordlist\sevenless.txt"
Global SubsLoc$ = AppPath$ + "subs.txt"
Global TotalWords% = 0
Global SevenLetterWords% = 0
Global dll$ = "blitzcpu.dll"
GetWordSum()
.startover1
Color 0, 0, 0

Global test9 = 0

Global loo% = 0

Dim Letter1$(7)
Dim lines$(SevenLetterWords%)
Dim AllWords$(TotalWords%)
Dim SubWords$(53)
Dim TempLetter3$(7)
Dim FlagScrambled$(8)
Dim ScanRackLetters$(7)
Dim ScanRackLetters1$(7)
Dim SevenLetterWordSubs%(SevenLetterWords%)
Dim GivenWord$(7)
Dim Con$(26)
Dim Vow$(5)
;----------------------------------------------------------------------------------------------------
Con$(0) = "b"
Con$(1) = "c"
Con$(2) = "d"
Con$(3) = "f"
Con$(4) = "g"
Con$(5) = "h"
Con$(6) = "j"
Con$(7) = "k"
Con$(8) = "l"
Con$(9) = "m"
Con$(10) = "n"
Con$(11) = "p"
Con$(12) = "q"
Con$(13) = "r"
Con$(14) = "s"
Con$(15) = "t"
Con$(16) = "v"
Con$(17) = "w"
Con$(18) = "x"
Con$(19) = "y"
Con$(20) = "z"

Vow$(0) = "a"
Vow$(1) = "e"
Vow$(2) = "i"
Vow$(3) = "o"
Vow$(4) = "u"
;-----------------------------------------------------------------------------------------
Dim temp9$(7)
Dim ScratchPad$(7)
Dim ScrambleScratchOld$(7)
Dim ScrambleScratchNew$(7)

Global BackSpace$ = "backspace"
Global Delete1$ = "delete"
Global Enter$ = "enter"

Global SubmitImageX% = 87
Global SubmitImageY% = 34
Global RewordItImageX% = 87
Global RewordItImageY% = 34
Global QuitButtonImageX% = 87
Global QuitButtonImageY% = 34
Global TackBackButtonImageX% = 87
Global TackBackButtonImageY% = 34
Global IntroSingleImageX% = 248
Global IntroSingleImageY% = 56
;----------Begin Conversation---------------------------------------------------------------
Global ConvTimer% = 0
Global ConvUp$ = False

Global ThreeConvUsed$ = False
Global FourConvUsed$ = False
Global FiveConvUsed$ = False
Global SixConvUsed$ = False
Global SevenConvUsed$ = False

Global HowManyConvSent3% = 0
Global HowManyConvSent4% = 0
Global HowManyConvSent5% = 0
Global HowManyConvSent6% = 0
Global HowManyConvSent7% = 0

Global ThreeShowConv$ = False
Global FourShowConv$ = False
Global FiveShowConv$ = False
Global SixShowConv$ = False
Global SevenShowConv$ = False

Global ShowConvTimer3% = 0
Global ShowConvTimer4% = 0
Global ShowConvTimer5% = 0
Global ShowConvTimer6% = 0
Global ShowConvTimer7% = 0

Global ThreeConvSent$ = ""
Global FourConvSent$ = ""
Global FiveConvSent$ = ""
Global SixConvSent$ = ""
Global SevenConvSent$ = ""

Global CompIntroTimer% = 0
Global LastTalkedTimer% = 0
Global ANice$ = False
Global ChatTimer% = 0
Global HowManyChat% = 0
Global ChatKeepUp$ = False
Global CompSay$ = ""
Global KeepUpTimer% = 0
;----------------End Conversation------------------------------------------------------------

Global HowManyThree% = 0
Global HowManyFour% = 0
Global HowManyFive% = 0
Global HowManySix% = 0
Global HowManySeven% = 0

Global Score = 0
Global ScoreTwo = 0
Global ScoreThree = 35
Global ScoreFour = 125
Global ScoreFive = 400
Global ScoreSix = 820
Global ScoreSeven = 1500

Global CompScore = 0
Global CompScoreTwo = 0
Global CompScoreThree = 35
Global CompScoreFour = 125
Global CompScoreFive = 400
Global CompScoreSix = 820
Global CompScoreSeven = 1500

Global SubWord$ = ""
Global count# = 0
Global count1% = 0
Global temp2$
Global Match$ = True
Global Mx = 0
Global My =0
Global HowManyMatches% = 0
Global space% = 70
Global SubLetter$
Global Hit% = 0
Global Hit1% = 0
Global ClickedY% = 165
Global NotClickedY% = 265
Global LetterSizeX% = 65
Global LetterSizeY% = 65
Global MoveX% = 120
Global CompTurn$ = False
Global YourTurn = True
Global CompLetterCount% = 0
Global CompWord$ = ""
Global HowManyCompWords% = 0
Global Turn = False
Global Round% = 1
Global Play% = 1
Global level% = 1
Global GameWait = False
Global ReturnTimer% = 0
Global DelayTimer% = 2000
Global ReturnPressed = False
Global DisableRack$ = False
Global AnimateScore$ = False
Global AnimDY% = 2
Global RevealWords$ = False
Global FPSTimer% = 15
Global Animating1$ = False
Global InRound% = 0
Global BelowTimer% = 0
Global pause = False
Global DisplayAllReadyGuessedBox = False
Global DisplayNotInListBox = False
Global ScrambledOldMain$ = ""
Global DisplayCompIntroUp$ = True
Global MousePosX% = 0
Global MousePosY% = 0
Global PutUpConvAll = False
Global CompSayAll$ = ""
Global CPU% = 0
Global InRoundChange$ = False
Global ScreenOptionsChange$ = False

Global MainMusic$ = True
Global MainSound$ = True
Global MainScreen$ = True

Dim SentCoachRound$(10)
Dim SentOppRound$(10)

Global RoundDone$ = True

Global PlayerWins% = 0
Global CompWins% = 0

Global FirstR% = Rnd(255)
Global FirstG% = Rnd(255)
Global FirstB% = Rnd(255)
Global SecondR% = Rnd(255)
Global SecondG% = Rnd(255)
Global SecondB% = Rnd(255)
Global ThirdR% = Rnd(255)
Global ThirdG% = Rnd(255)
Global ThirdB% = Rnd(255)
Global FourthR% = Rnd(255)
Global FourthG% = Rnd(255)
Global FourthB% = Rnd(255)
Global FifthR% = Rnd(255)
Global FifthG% = Rnd(255)
Global FiftthB% = Rnd(255)
Global SixthR% = Rnd(255)
Global SixthG% = Rnd(255)
Global SixthB% = Rnd(255)
Global SeventhR% = Rnd(255)
Global SeventhG% = Rnd(255)
Global SeventhB% = Rnd(255)

Global FirstR1% = Rnd(255)
Global FirstG1% = Rnd(255)
Global FirstB1% = Rnd(255)
Global SecondR1% = Rnd(255)
Global SecondG1% = Rnd(255)
Global SecondB1% = Rnd(255)
Global ThirdR1% = Rnd(255)
Global ThirdG1% = Rnd(255)
Global ThirdB1% = Rnd(255)
Global FourthR1% = Rnd(255)
Global FourthG1% = Rnd(255)
Global FourthB1% = Rnd(255)
Global FifthR1% = Rnd(255)
Global FifthG1% = Rnd(255)
Global FiftthB1% = Rnd(255)
Global SixthR1% = Rnd(255)
Global SixthG1% = Rnd(255)
Global SixthB1% = Rnd(255)
Global SeventhR1% = Rnd(255)
Global SeventhG1% = Rnd(255)
Global SeventhB1% = Rnd(255)


Global GotAllThree$ = False
Global GotAllFour$ = False
Global GotAllFive$ = False
Global GotAllSix$ = False
Global GotAllSeven$ = False

Global CompGotAllThree$ = False
Global CompGotAllFour$ = False
Global CompGotAllFive$ = False
Global CompGotAllSix$ = False
Global CompGotAllSeven$ = False

Global AllThreeBonus% = 1200
Global AllFourBonus% = 3000
Global AllFiveBonus% = 5000
Global AllSixBonus% = 7500
Global AllSevenBonus% = 10000

Global CompAllThreeBonus% = 1200
Global CompAllFourBonus% = 3000
Global CompAllFiveBonus% = 5000
Global CompAllSixBonus% = 7500
Global CompAllSevenBonus% = 10000

Global FirstClickedPos% = 0
Global SecondClickedPos% = 0
Global ThirdClickedPos% = 0
Global FourthClickedPos% = 0
Global FifthClickedPos% = 0
Global SixthClickedPos% = 0
Global SeventhClickedPos% = 0

Global FirstImagePos% = 1
Global secondImagePos% = 1
Global ThirdImagePos% = 1
Global FourthImagePos% = 1
Global FifthImagePos% = 1
Global sixthImagePos% = 1
Global SeventhImagePos% = 1

Global FirstAvailable = True
Global SecondAvailable = True
Global ThirdAvailable = True
Global FourthAvailable = True
Global FifthAvailable = True
Global SixthAvailable = True
Global SeventhAvailable = True

Global FirstImageClicked = False
Global SecondImageClicked = False
Global ThirdImageClicked = False
Global FourthImageClicked = False
Global FifthImageClicked = False
Global SixthImageClicked = False
Global SeventhImageClicked = False

Type ThreeL
Field Word$
Field guessed$
End Type
Type FourL
Field Word$
Field guessed$
End Type
Type FiveL
Field Word$
Field guessed$
End Type
Type SixL
Field Word$
Field guessed$
End Type
Type SevenL
Field Word$
Field guessed$
End Type

Type CompThreeL
Field Word$
Field guessed$
End Type
Type CompFourL
Field Word$
Field guessed$
End Type
Type CompFiveL
Field Word$
Field guessed$
End Type
Type CompSixL
Field Word$
Field guessed$
End Type
Type CompSevenL
Field Word$
Field guessed$
End Type

;-----------------------------------------------------------------------------------------------
Type CompWordsThee
Field Word$
End Type
;------------------------------------------------------------------------------------------------

Type Con
Field Letter$
End Type
Type ConCombo
Field Letters$
End Type
Type ConComboEnd
Field Letters$
End Type
Type Vow
Field Letter$
End Type
Type VowCombo
Field Letters$
End Type
Type CompWords
Field Word$
End Type
Type adde
Field Letters$
End Type
Type adds
Field Letters$
End Type

Type Buffer
Field Word$
End Type

Type ThreeConv
Field Sent$
End Type
Type FourConv
Field Sent$
End Type
Type FiveConv
Field Sent$
End Type
Type SixConv
Field Sent$
End Type
Type SevenConv
Field Sent$
End Type



Type ThreeAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type FourAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type FiveAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type SixAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type SevenAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type
;--------------------------------------------------------------------------------------

Type CompThreeAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type CompFourAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type CompFiveAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type CompSixAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type CompSevenAnimScore
Field Score%
Field Xpos%
Field Ypos#
End Type

Type chat
Field Talk$
End Type


For gh = 1 To 7
GivenWord$(gh) = "0"
Next

For df = 1 To 7
FlagScrambled$(df) = "1"
Next

For cc = 1 To 7
ScanRackLetters$(cc) = "0"
Next

For cp = 1 To 7
ScanRackLetters1$(cp) = "0"
Next


intro()

Global bcon$ = AppPath$ + "Game\bcon.txt"
Global econ$ = AppPath$ + "game\econ.txt"
Global midvow$ = AppPath$ + "game\midvow.txt"
Global adde$ = AppPath$ + "game\adde.txt"
Global adds$ = AppPath$ + "game\adds.txt"

Global DicBackGround = LoadImage(AppPath$ + "data1\LoadingDic.png")
Global WordsBackGround = LoadImage(AppPath$ + "data1\LoadingWords.png")
Global SubsBackGround = LoadImage(AppPath$ + "data1\LoadingSubs.png")

Global WrongWord = LoadSound(AppPath$ + "sounds\WrongWord.wav")
Global GoodWord = LoadSound(AppPath$ + "sounds\GoodWord.mp3")
Global Ticks = LoadSound(AppPath$ + "sounds\ticks.wav")
Global TimeOut = LoadSound(AppPath$ + "sounds\timeout.wav")

Global Startbutton = LoadImage(AppPath$ + "data1\start.png")
Global StartButtonClick = LoadImage(AppPath$ + "data1\startclick.png")
Global Mouse3 = LoadImage(AppPath$ + "data1\mouse.bmp")

Global Arrow
Global BackGround

Global Submit_Click
Global SubmitDisable

Global RewordIt_Click
Global ReworditDisable

Global TackBackButtonClick
Global TackBackButtonDisable

Global TurnTransitionFont

Global A
Global B
Global C
Global D
Global E
Global F
Global G
Global H
Global I
Global J
Global K
Global L
Global M
Global N
Global O
Global P
Global Q
Global R
Global S
Global T
Global U
Global V
Global W
Global X
Global Y
Global Z

Global num0
Global num1
Global num2
Global num3
Global num4
Global num5
Global num6
Global num7
Global num8
Global num9

Global compnum0
Global compnum1
Global compnum2
Global compnum3
Global compnum4
Global compnum5
Global compnum6
Global compnum7
Global compnum8
Global compnum9

Global Clock0
Global Clock1
Global Clock2
Global Clock3
Global Clock4
Global Clock5
Global Clock6
Global Clock7
Global Clock8
Global Clock9
;------------------------------------------------------------------------------------------------
Global pop1 = LoadSound(AppPath + "Game\Conv\1\pop.wav")
Global AllSeven = LoadSound(AppPath + "Sounds\allseven.wav")
Global Scramble = LoadSound(AppPath + "sounds\scramble.mp3")
Global chan1

Global FirstLetter
Global SecondLetter
Global ThirdLetter
Global FourthLetter
Global FifthLetter
Global SixthLetter
Global SeventhLetter
;------------------------------------------------------------------------------------------------
start% = MilliSecs()
GameStart% = MilliSecs()
SimTimer% = 0
frames% = 0
lframes% = 0

fileIn = ReadFile(MasterList$)

Global DicHeight% = 70
Global DicBox_x% = 80
Global DicBox_y% = 500

ConvTimer% = MilliSecs()
Global AnimTimer% = 0

While Not Eof(filein)
Local value# = 1
temp2$ = ReadLine(filein)

AllWords$(count#) = temp2$
count# = count# + 1.0

If count# Mod 1500 = 0 Then
Cls
value# = count#/51340.0
DrawImage DicBackGround, 0, 0
Color 105, 5, 5
Rect DicBox_x%, DicBox_y%, 647, DicHeight%, 1
Color 255, 255, 0
Rect DicBox_x%, DicBox_y%, (count#/51340) * 650, DicHeight%, 1
Flip
EndIf
If Len(temp2$) = 7 Then
lines$(count1%) = temp2$
count1% = count1% + 1
EndIf
Color 0, 0, 0

Wend
FreeImage DicBackGround
CloseFile(fileIn)

filein = ReadFile(SubsLoc$)
WordsValue# = 1

For hh# = 0 To SevenLetterWords% - 1
SevenLetterWordSubs%(hh) = ReadLine(filein)
If hh# Mod 1500 = 0 Then
Cls
DrawImage WordsBackGround, 0, 0
Color 105, 5, 5
Rect DicBox_x%, DicBox_y%, 647, DicHeight%, 1
Color 255, 255, 0
Rect DicBox_x%, DicBox_y%, (hh#/SevenLetterWords%) * 650, DicHeight%, 1
Flip
EndIf
Color 0, 0, 0
Next

FreeImage WordsBackGround

CloseFile(filein)

MaskImage mouse3, 255, 0, 0


Global wordToGuess$ = GetWord$()
Global TempWord$ = WordToGuess$
Global ScrambledWord$ = ScrambleLetters$()
GetSubWords()
BattleScreen(1)
LoadParts()
LoadWords()
LoadConv()
s()
Global GameTimer% = 10

ChatTimer% = MilliSecs()
CompIntroTimer% = MilliSecs()
LoadChat(1)
LoadLetters()
Global ChatTime% = GetChatTime%(level%)
Global Fast = CreateTimer(50)
Global med = CreateTimer(15)
Global Slow = CreateTimer(7)
Global millis% = 0


EraseLevelGraphics(1)
LoadLevelGraphics(1)
Repeat
Cls
CheckMouseCollisions()
If ScreenOptionsChange$ = True Then
EraseLevelGraphics(level%)
LoadLevelGraphics(level%)
ScreenOptionsChange$ = False
EndIf

DrawBlock BackGround, 0, 0
millis% = MilliSecs()
MousePosX% = MouseX()
MousePosY% = MouseY()

If (start% + 1000) <= Millis% Then
start% = millis%
lframes% = frames%
frames% = 0

Color 255, 255, 255
CPU% = CPUUsage()
Color 0, 0, 0

CalcTick()
EndIf

If ChatKeepUp$ = True Then Text 110, 5, CompSay$

If PutUpConvAll = True Then Text 110, 5, CompSayAll$

If CompTurn$ = True
If pause = False Then
If (SimTimer% + 200) <= millis% Then
CompMove()
SimTimer% = millis%
EndIf
EndIf
EndIf

CheckKeyStrokes()
PrintTimer()
DrawImages()
DrawCircles()
DrawLetters()
PrintResults()

PrintScore()
CompPrintScore()
CompPrintResults()
Color 0,0,0
Text 380, 476, GameTimer%
Text 650, 550, lframes%
Text 150, 550, WordToGuess$
Text 350, 550, CompWord$
Text 600, 380, MousePosX%
Text 600, 390, MousePosY%
Text 600, 410, ChatTime%
Text 430, 550, CPU%
Text 430, 570, AvailVidMem() / 1024.0 / 1024.0 + " MB"
Text 390, 5, "out"

frames% = frames% + 1

If Animating1$ = False Then
If MainScreen$ = True Then
WaitTimer(slow)
Else
WaitTimer(fast)
If CompTurn$ = False Then
CheckAnimateScore()
Else
CompCheckAnimateScore()
EndIf
EndIf
Else
WaitTimer(fast)
If CompTurn$ = False Then
CheckAnimateScore()
Else
CompCheckAnimateScore()
EndIf
EndIf

If KeyHit(1) Then
startover()
Goto startover1
EndIf

If MainScreen$ = True Then
Flip False
Else
DrawImage mouse3, MousePosX%, MousePosY%
Flip
EndIf
Forever

Function LoadLevelGraphics(value%)
BackGround = LoadImage(AppPath$ + "BackTemp.png")
Submit_Click = LoadImage(AppPath$ + "data1\submit_click.png")
SubmitDisable = LoadImage(AppPath$ + "data1\submitdisable.png")
RewordIt_Click = LoadImage(AppPath$ + "data1\Rewordit_Click.png")
ReworditDisable = LoadImage(AppPath$ + "data1\ReworditDisable.png")
TackBackButtonClick = LoadImage(AppPath$ + "data1\TakeBackButtonClick.png")
TackBackButtonDisable = LoadImage(AppPath$ + "data1\TakeBackButtonDisable.png")
Arrow = LoadImage(AppPath$ + "data1\arrow.png"):MaskImage arrow, 0, 0, 0
Startbutton = LoadImage(AppPath$ + "data1\start.png")
StartButtonClick = LoadImage(AppPath$ + "data1\startclick.png")

num0 = LoadImage(AppPath$ + "data1\num0.png")
num1 = LoadImage(AppPath$ + "data1\num1.png")
num2 = LoadImage(AppPath$ + "data1\num2.png")
num3 = LoadImage(AppPath$ + "data1\num3.png")
num4 = LoadImage(AppPath$ + "data1\num4.png")
num5 = LoadImage(AppPath$ + "data1\num5.png")
num6 = LoadImage(AppPath$ + "data1\num6.png")
num7 = LoadImage(AppPath$ + "data1\num7.png")
num8 = LoadImage(AppPath$ + "data1\num8.png")
num9 = LoadImage(AppPath$ + "data1\num9.png")

CompNum0 = LoadImage(AppPath$ + "data1\CompNum0.png"):MaskImage CompNum0, 0, 0, 0
CompNum1 = LoadImage(AppPath$ + "data1\CompNum1.png"):MaskImage CompNum1, 0, 0, 0
CompNum2 = LoadImage(AppPath$ + "data1\CompNum2.png"):MaskImage CompNum2, 0, 0, 0
CompNum3 = LoadImage(AppPath$ + "data1\CompNum3.png"):MaskImage CompNum3, 0, 0, 0
CompNum4 = LoadImage(AppPath$ + "data1\CompNum4.png"):MaskImage CompNum4, 0, 0, 0
CompNum5 = LoadImage(AppPath$ + "data1\CompNum5.png"):MaskImage CompNum5, 0, 0, 0
CompNum6 = LoadImage(AppPath$ + "data1\CompNum6.png"):MaskImage CompNum6, 0, 0, 0
CompNum7 = LoadImage(AppPath$ + "data1\CompNum7.png"):MaskImage CompNum7, 0, 0, 0
CompNum8 = LoadImage(AppPath$ + "data1\CompNum8.png"):MaskImage CompNum8, 0, 0, 0
CompNum9 = LoadImage(AppPath$ + "data1\CompNum9.png"):MaskImage CompNum9, 0, 0, 0

Clock0 = LoadImage(AppPath$ + "data1\Clock0.png"):MaskImage Clock0, 0, 0, 0
Clock1 = LoadImage(AppPath$ + "data1\Clock1.png"):MaskImage Clock1, 0, 0, 0
Clock2 = LoadImage(AppPath$ + "data1\Clock2.png"):MaskImage Clock2, 0, 0, 0
Clock3 = LoadImage(AppPath$ + "data1\Clock3.png"):MaskImage Clock3, 0, 0, 0
Clock4 = LoadImage(AppPath$ + "data1\Clock4.png"):MaskImage Clock4, 0, 0, 0
Clock5 = LoadImage(AppPath$ + "data1\Clock5.png"):MaskImage Clock5, 0, 0, 0
Clock6 = LoadImage(AppPath$ + "data1\Clock6.png"):MaskImage Clock6, 0, 0, 0
Clock7 = LoadImage(AppPath$ + "data1\Clock7.png"):MaskImage Clock7, 0, 0, 0
Clock8 = LoadImage(AppPath$ + "data1\Clock8.png"):MaskImage Clock8, 0, 0, 0
Clock9 = LoadImage(AppPath$ + "data1\Clock9.png"):MaskImage Clock9, 0, 0, 0

If mainscreen = False Then
Mouse3 = LoadImage(AppPath$ + "data1\mouse.bmp"):MaskImage mouse3, 255, 0, 0
Else
FreeImage Mouse3
EndIf
End Function

Function EraseLevelGraphics(value%)
FreeImage BackGround
FreeImage Submit_Click
FreeImage SubmitDisable
FreeImage RewordIt_Click
FreeImage ReworditDisable
FreeImage TackBackButtonClick
FreeImage TackBackButtonDisable
FreeImage Arrow
FreeImage mouse3
FreeImage Startbutton
FreeImage StartButtonClick

FreeImage num0
FreeImage num1
FreeImage num2
FreeImage num3
FreeImage num4
FreeImage num5
FreeImage num6
FreeImage num7
FreeImage num8
FreeImage num9

FreeImage CompNum0
FreeImage CompNum1
FreeImage CompNum2
FreeImage CompNum3
FreeImage CompNum4
FreeImage CompNum5
FreeImage CompNum6
FreeImage CompNum7
FreeImage CompNum8
FreeImage CompNum9

FreeImage Clock0
FreeImage Clock1
FreeImage Clock2
FreeImage Clock3
FreeImage Clock4
FreeImage Clock5
FreeImage Clock6
FreeImage Clock7
FreeImage Clock8
FreeImage Clock9

End Function

Function freeSoundandMusic(level%)
If value% = 1 Then
FreeSound WrongWord
FreeSound GoodWord
FreeSound Ticks
FreeSound TimeOut
FreeSound pop1
FreeImage AllSeven
FreeImage Scramble
EndIf
End Function

Function LoadSoundandMusic(level%)
If value% = 1 Then
WrongWord = LoadSound(AppPath$ + "sounds\WrongWord.wav")
GoodWord = LoadSound(AppPath$ + "sounds\GoodWord.mp3")
Ticks = LoadSound(AppPath$ + "sounds\ticks.wav")
TimeOut = LoadSound(AppPath$ + "sounds\timeout.wav")
pop1 = LoadSound(AppPath + "Game\Conv\1\pop.wav")
AllSeven = LoadSound(AppPath + "Sounds\allseven.wav")
Scramble = LoadSound(AppPath + "sounds\scramble.mp3")
EndIf
End Function

Function StartOver()
StopSound(level%)

FreeImage BackGround
FreeImage DicBackGround
FreeImage WordsBackGround
FreeImage SubsBackGround

FreeImage Opp1
FreeImage Opp2



FreeImage ScoreImage
FreeImage TimeImage
FreeImage RoundImage
FreeImage Person1
FreeImage TopBorder
FreeImage RightBorder
FreeImage BottomBorder
FreeImage LeftBorder
FreeImage PlayerBorder
FreeImage OtherBorder
FreeImage StartButton
FreeImage StartButtonClick

FreeImage Submit
FreeImage Submit_Click
FreeImage SubmitDisable
FreeImage RewordIt
FreeImage RewordIt_Click
FreeImage ReworditDisable
FreeImage QuitButton
FreeImage QuitButtonClick
FreeImage QuitButtonDisable
FreeImage TackBackButton
FreeImage TackBackButtonClick
FreeImage TackBackButtonDisable
FreeImage WordBox


FreeImage A
FreeImage B
FreeImage C
FreeImage D
FreeImage E
FreeImage F
FreeImage G
FreeImage H
FreeImage I
FreeImage J
FreeImage K
FreeImage L
FreeImage M
FreeImage N
FreeImage O
FreeImage P
FreeImage Q
FreeImage R
FreeImage S
FreeImage T
FreeImage U
FreeImage V
FreeImage W
FreeImage X
FreeImage Y
FreeImage Z

FreeImage FirstLetter
FreeImage SecondLetter
FreeImage ThirdLetter
FreeImage FourthLetter
FreeImage FifthLetter
FreeImage SixthLetter
FreeImage SeventhLetter

FreeImage Startbutton
FreeImage StartButtonClick
FreeImage Mouse3

FreeSound BackGround
FreeSound SubmitDisable
FreeSound pop1
FreeSound AllSeven
FreeSound GoodWord
FreeSound WrongWord
FreeSound Ticks
FreeSound TimeOut
FreeSound Scramble

;------------------------------------------------------------------------------------------------
FreeSound chan1

End Function

Function CalcTick()
If CompTurn$ = False Then
If GameWait = False And pause = False Then
If (GameStart% + 1000) <= millis% Then
GameTimer% = GameTimer% - 1
GameStart% = millis%
If GameTimer% <= 0 Then
TurnTransitionFont = LoadImage(AppPath$ + "data1\Compturn.png")
StopSound(level%)
If MainSound$ = True PlaySound TimeOut
freeSoundandMusic(level%)
Round% = Round% + 1
NextTurn()
GameWait = True
GameTimer% = 10
CompTurn = True
YourTurn = False
CompLetterCount% = 0
CompWord$ = ""
CompLetterCount% = 0
BelowTimer% = 0
ChatKeepUp$ = False
PutUpConvAll = False

EndIf
EndIf
EndIf

If (ChatTimer% + ChatTime%) <= millis% Then
If GameWait = False And ConvUp$ = False And CompTurn = False And pause = False Then
ChatKeepUp$ = True
ChatTimer% = millis% + 1
CompSay$ = GetRegularChat$()
KeepUpTimer% = millis%
ChatTime% = GetChatTime%(level%)
End If
EndIf

If ChatKeepUp$ = True Then
If GameWait = False And ConvUp$ = False And CompTurn = False And GameTimer >= 15 And pause = False Then
If (KeepUpTimer% + 15000) >= millis% Then
ChatKeepUp$ = True
Else
ChatKeepUp$ = False
EndIf
EndIf
Else
ChatKeepUp$ = False
EndIf

If (CompIntroTimer% + 9000) >= millis% Then
If ChatKeepUp$ = False And ConvUp$ = False And (pause = False And DisplayCompIntroUp$ = True) Then
DisplayCompIntroUp$ = True
Else
DisplayCompIntroUp$ = False
EndIf
Else
DisplayCompIntroUp$ = False
EndIf

If pause = False
CheckConv()
CheckConvAll()
Else
PutUpConvAll = False
EndIf

If ThreeShowConv$ = True Or FourShowConv$ = True Or FiveShowConv$ = True Or SixShowConv$ = True Or SevenShowConv$ = True Then
PutUpConvAll = True
DisplayCompIntroUp$ = False
Else
PutUpConvAll = False
EndIf
Else
If CompTurn$ = True Then
If GameWait = False And pause = False Then
If (GameStart% + 1000) <= millis% Then
GameTimer% = GameTimer% - 1
GameStart% = millis%
If GameTimer% <= 0 Then
StopSound(level%)
If MainSound$ = True PlaySound Timeout
freeSoundandMusic(level%)
turn = Not turn
NextTurn()
GameWait = True
YourTurn = True
CompLetterCount% = 0
ReturnPressed = False
Play% = Play% + 1
CalculateWins()
CompTurn = False
GameTimer% = 10
RevealWords$ = True
ChatTime% = GetChatTime%(level%)
If PlayerWins% < 2 And CompWins% < 2 Then
RoundChange(level%)
GotAllThree = False
GotAllFour = False
GotAllFive = False
GotAllSix = False
GotAllSeven = False
EndIf
BelowTimer% = 0
DisplayAllReadyGuessedBox = False
DisplayNotInListBox = False
ChatKeepUp$ = False
PutUpConvAll = False
millis% = MilliSecs()
EndIf
EndIf
EndIf
EndIf
EndIf

If GameTimer% < 11 Then
If GameWait = False And BelowTimer% > GameTimer% Then
BelowTimer% = GameTimer%
If MainSound$ = True PlaySound ticks
EndIf
EndIf

If BelowTimer% = 0 And GameTimer% < 11 Then BelowTimer% = GameTimer%

If MainMusic$ = True Then
If Not ChannelPlaying(chan1) Then
If pause = False And gamewait = False Then
If gamewait = False Then LoadMusicChannel(level%)
EndIf
EndIf
EndIf
End Function

Function PrintTimer()
Local temp$ = Str GameTimer

For jj% = 1 To Len(temp$)
TimerDrawNumber(Mid$(temp$, jj%, 1), jj%)
Next

End Function

Function TimerDrawNumber(value$, Pos%)
If Value$ = "0" Then
DrawImage Clock0, 165 + (Pos% * 22), 559
ElseIf Value$ = "1" Then
DrawImage Clock1, 165 + (Pos% * 22), 559
ElseIf Value$ = "2" Then
DrawImage Clock2, 165 + (Pos% * 22), 559
ElseIf Value$ = "3" Then
DrawImage Clock3, 165 + (Pos% * 22), 559
ElseIf Value$ = "4" Then
DrawImage Clock4, 165 + (Pos% * 22), 559
ElseIf Value$ = "5" Then
DrawImage Clock5, 165 + (Pos% * 22), 559
ElseIf Value$ = "6" Then
DrawImage Clock6, 165 + (Pos% * 22), 559
ElseIf Value$ = "7" Then
DrawImage Clock7, 165 + (Pos% * 22), 559
ElseIf Value$ = "8" Then
DrawImage Clock8, 165 + (Pos% * 22), 559
ElseIf Value$ = "9" Then
DrawImage Clock9, 165 + (Pos% * 22), 559
EndIf
End Function


Function CPUUsage()
Return CallDLL(dll$, "_CPUPercent")
End Function


Function OptionsScreen()
Local IntroScreen = LoadImage(AppPath$ + "smallbrick1.bmp")
Local SoundOn = LoadImage(AppPath$ + "data1\SoundOn.png")
Local SoundOff = LoadImage(AppPath$ + "data1\SoundOff.png")
Local MusicOn = LoadImage(AppPath$ + "data1\MusicOn.png")
Local MusicOff = LoadImage(AppPath$ + "data1\MusicOff.png")
Local FullScreen = LoadImage(AppPath$ + "data1\FullScreen.png")
Local Windowed = LoadImage(AppPath$ + "data1\windowed.png")
Local Continue = LoadImage(AppPath$ + "data1\continue.png")

Local Music = True
Local Sound = True
Local ScreenMode1 = True
Local Mouse2 = LoadImage(AppPath$ + "data1\mouse.bmp")
MaskImage mouse2, 255, 0, 0
Local filein = OpenFile(AppPath$ + "data1\op.txt")

Local MusicOnOff$ = ReadLine(filein)
Local SoundOnOff$ = ReadLine(filein)
Local ScreenMode$ = ReadLine(filein)

CloseFile(filein)

Local ButtonStartx = 278
Local ButtonStopx% = 275 + 245
Local ButtonStarty = 155
Local ButtonStopy = 150 + 53

Local Exit1$ = False

If MusicOnOff$ = "On" Or MusicOnOff$ = "on"
Music = True
Else
music = False
EndIf

If SoundOnOff$ = "On" Or SoundOnOff$ = "on"Then
Sound = True
Else
Sound = False
EndIf

If ScreenMode$ = "Windowed" Or ScreenMode$ = "windowed" Then
ScreenMode1 = True
Else
ScreenMode1 = False
EndIf

Local slow = CreateTimer(15)
Local fast = CreateTimer(50)

While Exit1 = False
Cls
If MainScreen$ = True Then
WaitTimer(slow)
Else
WaitTimer(fast)
EndIf

TileImage IntroScreen
If Sound = True Then
DrawBlock SoundOn, 275, 150
Else
DrawBlock SoundOff, 275, 150
EndIf

If Music = True Then
DrawBlock MusicOn, 275, 240
Else
DrawBlock MusicOff, 275, 240
EndIf

If ScreenMode1 = True Then
DrawBlock windowed, 275, 330
Else
DrawBlock FullScreen, 275, 330
EndIf

DrawBlock Continue, 200, 470

If MouseHit(1) Then
If (MouseX() >= ButtonStartx% And MouseX() <= ButtonStopx%) And (MouseY() >= 245 And MouseY() <= 288) Then
Music = Not Music
ElseIf (MouseX() >= ButtonStartx% And MouseX() <= ButtonStopx%) And (MouseY() >= ButtonStarty% And MouseY() <= ButtonStopy%) Then
Sound = Not Sound
ElseIf (MouseX() >= ButtonStartx% And MouseX() <= ButtonStopx%) And (MouseY() >= 330 And MouseY() <= 388) Then
ScreenMode1 = Not ScreenMode1
ElseIf (MouseX() >= 200 And MouseX() <= 445) And (MouseY() >= 470 And MouseY() <= 525) Then
Exit1 = True
EndIf
EndIf

If music = True Then
MusicOnOff$ = "On"
Else
MusicOnOff$ = "Off"
EndIf

If Sound = True Then
SoundOnOff$ = "On"
Else
SoundOnOff$ = "Off"
EndIf

If ScreenMode1 = True Then
ScreenMode$ = "Windowed"
Else
ScreenMode$ = "Full Screen"
EndIf
If MainScreen$ = False Then DrawImage mouse2, MouseX(), MouseY()
Flip
Wend

MainMusic$ = music
MainSound$ = sound
MainScreen$ = ScreenMode1

filein = WriteFile(AppPath$ + "data1\op.txt")

If music = True Then
WriteLine(filein,"On")
Else
WriteLine(filein,"Off")
EndIf

If sound = True Then
WriteLine(filein,"On")
Else
WriteLine(filein,"Off")
EndIf

If ScreenMode1 = True Then
WriteLine(filein,"Windowed")
Else
WriteLine(filein,"Full Screen")
EndIf
CloseFile(filein)

If ScreenMode$ = "Full Screen" Then MoveMouse 200, 300

FreeImage Mouse2
FreeImage IntroScreen
FreeImage SoundOn
FreeImage SoundOff
FreeImage MusicOn
FreeImage MusicOff
FreeImage FullScreen
FreeImage Windowed
FreeImage Continue
FreeTimer slow
FreeTimer fast
End Function

Function LoadOptionsInfo()
Local filein = OpenFile(AppPath$ + "data1\op.txt")

Local MainMusic1$ = ReadLine(filein)
Local MainSound1$ = ReadLine(filein)
Local MainScreen1$ = ReadLine(filein)

If MainMusic1$ = "On" Or MainMusic1$ = "on" Then
MainMusic$ = True
Else
MainMusic$ = False
EndIf

If MainSound1$ = "On" Or MainSound1$ = "on" Then
MainSound$ = True
Else
MainSound$ = False
EndIf

If MainScreen1$ = "Windowed" Or MainScreen1$ = "windowed" Then
MainScreen$ = True
Else
MainScreen$ = False
EndIf

CloseFile(filein)
End Function

Function StopSound(value%)
If value% = 1 Then
StopChannel chan1
EndIf
End Function

Function RoundChange(level%)
InRound% = 1


Local backgr = LoadImage(AppPath$ + "BackTempround.png")

Local HowManyLinesCoach% = 0
Local HowManyLinesOpp% = 0
Local NextLineOpp% = 0
Local StartImageX% = 92
Local StartClickImageX% = 39
Local StartImagePos% = 380
Local StartClickImagePos% = 500

InRoundChange$ = True
While InRound% = 1
Cls
DrawBlock backgr, 0, 0
CheckMouseCollisions()

CheckAnimateScore()

DrawLetters()
PrintResults()
PrintScore()
CompPrintScore()
CompPrintResults()

Color 0,0,0
Text 380, 476, GameTimer%
Text 650, 550, lframes%
Text 150, 550, WordToGuess$
Text 350, 550, CompWord$
Text 600, 380, MouseX()
Text 600, 390, MouseY()
Text 600, 410, ChatTime%
Text 300, 5, "in"
If MainScreen$ = False Then DrawImage mouse3, MouseX(), MouseY()

If MainScreen$ = True Then
WaitTimer(slow)
Flip False
Else
WaitTimer(fast)
VWait:Flip False
EndIf
Wend
FreeImage backgr
InRoundChange$ = False

InRound% = 0

filein = ReadFile(AppPath$ + "Rounds\" + level% + "\coach" + (Round% - 1) + ".txt")
HowManyLinesCoach% = ReadLine(filein)
For qq = 1 To HowManyLinesCoach%
SentCoachRound$(qq) = ReadLine(filein)
Next
CloseFile(filein)

filein = ReadFile(AppPath$ + "Rounds\" + level% + "\opp" + (Round% - 1) + ".txt")
HowManyLinesOpp% = ReadLine(filein)
For qq1 = 1 To HowManyLinesOpp%
SentOppRound$(qq1) = ReadLine(filein)
Next
CloseFile(filein)

If MainScreen = False Then
Local Mouse2 = LoadImage(AppPath$ + "data1\mouse.bmp")
EndIf

Local StartClick = LoadImage(AppPath$ + "data1\startclick.png")
Local CommentScreen1 = LoadImage(AppPath$ + "data1\comment1.png")

Local PassedOpp$ = False
Local PassedCoach$ = False
While Not KeyHit(1)
Cls
DrawBlock CommentScreen1, 0, 0

If (MouseX() >= StartImagePos% And MouseX() <= (StartImagePos% + SubmitImageX%)) And (MouseY() >= StartClickImagePos% And MouseY() <= (StartClickImagePos% + SubmitImageY%)) Then
DrawBlock StartClick, StartImagePos%, StartClickImagePos%
EndIf

If MouseHit(1) Then
If (MouseX() >= StartImagePos% And MouseX() <= (StartImagePos% + SubmitImageX%)) And (MouseY() >= StartClickImagePos% And MouseY() <= (StartClickImagePos% + SubmitImageY%)) Then
Exit
EndIf
EndIf

If PassedOpp$ = False Then
For qq2 = 1 To HowManyLinesOpp%
NextLineOpp% = NextLineOpp% + 15
type_text_Opp(30, 280 + NextLineOpp% , SentOppRound$(qq2), qq2)
Next
PassedOpp$ = True
EndIf

NextLineOpp% = 0

For ds = 1 To HowManyLinesOpp%
NextLineOpp% = NextLineOpp% + 15
Text 30, 280 + NextLineOpp%, SentOppRound$(ds)
Next
NextLineOpp% = 0

;-------------------------------------------------------------------------------------

If PassedCoach$ = False Then
For qq3 = 1 To HowManyLinesCoach%
NextLineCoach% = NextLineCoach% + 15
type_text_Coach(430, 280 + NextLineCoach% , SentCoachRound$(qq3), qq3, HowManyLinesOpp%)
Next
PassedCoach$ = True
EndIf

NextLineCoach% = 0

For ds = 1 To HowManyLinesCoach%
NextLineCoach% = NextLineCoach% + 15
Text 430, 280 + NextLineCoach%, SentCoachRound$(ds)
Next

NextLineCoach% = 0

If MainScreen$ = False Then DrawImage mouse2, MouseX(), MouseY()

If MainScreen$ = True Then
WaitTimer(slow)
Flip False
Else
WaitTimer(fast)
VWait:Flip False
EndIf

Wend
FreeImage StartClick
FreeImage CommentScreen1
If MainScreen = False Then FreeImage mouse2
FreeImage startclick
CompDeleteAnimateScore()
DeleteCheckAnimateScore()
End Function

Function type_text_Coach(x,y,t$, z, HowManyLinesOpp%)
Local CommentScreen1 = LoadImage(AppPath$ + "data1\commentscroll1.png")
Local NextLineCoach% = 0
Local NextLineOpp% = 0
Local TextLength% = Len(t$) + 1
Local buff$ = ""
Local wait = MilliSecs()
Local n = 1

Repeat
Cls
DrawBlock CommentScreen1, 0, 0

For ds = 1 To HowManyLinesOpp%
NextLineOpp% = NextLineOpp% + 15
Text 30, 280 + NextLineOpp%, SentOppRound$(ds)
Next

NextLineOpp% = 0

If z > 1 Then
For fg = 1 To z - 1
NextLineCoach% = NextLineCoach% + 15
Text 430, 280 + NextLineCoach%, SentCoachRound$(fg)
Next
NextLineCoach% = 0
EndIf

If MilliSecs() > wait + 40 Then
wait = MilliSecs()
Buff$ = Left(t, n)
n = n + 1
EndIf
Text x, y, Buff$

If MainScreen$ = True Then
WaitTimer(slow)
Flip False
Else
WaitTimer(fast)
VWait:Flip False
EndIf

Until n > TextLength%

FreeImage CommentScreen1
End Function

Function type_text_Opp(x,y,t$, z)
Local CommentScreen1 = LoadImage(AppPath$ + "data1\commentscroll1.png")
Local NextLineOpp% = 0
Local TextLength% = Len(t$) + 1
Local buff$ = ""
Local wait = MilliSecs()
Local n = 1

Repeat
Cls
DrawBlock CommentScreen1, 0, 0

If z > 1 Then
For fg = 1 To z - 1
NextLineOpp% = NextLineOpp% + 15
Text 30, 280 + NextLineOpp%, SentOppRound$(fg)
Next
NextLineOpp% = 0
EndIf

If MilliSecs() > wait + 40 Then
wait = MilliSecs()
Buff$ = Left(t, n)
n = n + 1
EndIf
WaitTimer(slow)
Text x, y, Buff$
Flip False
Until n > TextLength%

FreeImage CommentScreen1
End Function

Function GetChatTime%(value%)
SeedRnd(MilliSecs())
If value% = 1 Then
Return Rnd(50000, 75000)
ElseIf value% = 2 Then
Return Rnd(50000, 75000)
EndIf
End Function

Function CalculateWins()
If Score% > CompScore% Then
PlayerWins% = PlayerWins% + 1
Else
CompWins% = CompWins% + 1
EndIf
End Function

Function GetTime%()
Local time% = 7 * HowManyMatches%
If time% >= 150 Then
Return 150
ElseIf time% <= 60 Then
Return 60
Else
Return time%
EndIf
End Function

Function ScrambleMove()
DisplayAllReadyGuessedBox = False
DisplayNotInListBox = False
If FirstImageClicked = False And SecondImageClicked = False And ThirdImageClicked = False And FourthImageClicked = False And FifthImageClicked = False And SixthImageClicked = False And SeventhImageClicked = False And pause = False Then
Local temp1% = 0
Local Temp% = 0
Local AnimationDone$ = False
Local count = 0
Local ScrambledOld$ = ScrambledWord$
ScrambledOldMain$ = ScrambledOld$

Local FirstSpeed# = 0
Local SecondSpeed# = 0
Local ThirdSpeed# = 0
Local FourthSpeed# = 0
Local FifthSpeed# = 0
Local SixthSpeed# = 0
Local SeventhSpeed# = 0

Local FirstDone$ = False
Local SecondDone$ = False
Local ThirdDone$ = False
Local FourthDone$ = False
Local FifthDone$ = False
Local SixthDone$ = False
Local SeventhDone$ = False

Local OldFirstLetter% = space% + MoveX%
Local OldSecondLetter% = 2 * space% + MoveX%
Local OldThirdLetter% = 3 * space% + MoveX%
Local OldFourthLetter% = 4 * space% + MoveX%
Local OldFifthLetter% = 5 * space% + MoveX%
Local OldSixthLetter% = 6 * space% + MoveX%
Local OldSeventhLetter% = 7 * space% + MoveX%

For q1 = 1 To 7
ScrambleScratchOld$(q1) = Mid$(ScrambledOld$, q1, 1)
Next

Local FirstLetterOld = FirstLetter
Local SecondLetterOld = SecondLetter
Local ThirdLetterOld = ThirdLetter
Local FourthLetterOld = FourthLetter
Local FifthLetterOld = FifthLetter
Local SixthLetterOld = SixthLetter
Local SeventhLetterOld = SeventhLetter

ScrambledWord$ = ScrambleLetters$()
ReLoadLetters()
Local ScrambledNew$ = ScrambledWord$

For q2 = 1 To 7
ScrambleScratchNew$(q2) = Mid$(ScrambledNew$, q2, 1)
Next

Local NewFirstLetter% = 0
Local NewSecondLetter% = 0
Local NewThirdLetter% = 0
Local NewFourthLetter% = 0
Local NewFifthLetter% = 0
Local NewSixthLetter% = 0
Local NewSeventhLetter% = 0
If mainscreen = False Then
Local Mouse2 = LoadImage(AppPath$ + "data1\mouse.bmp"):MaskImage mouse2, 255, 0, 0
EndIf

Local Atemp% = 1

For w1 = 1 To 7
For w2 = 1 To 7
If ScrambleScratchOld$(w1) = ScrambleScratchNew$(w2) Then
If w1 = 1 Then
If w2 = 1 Then
NewFirstLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewFirstLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewFirstLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewFirstLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewFirstLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewFirstLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewFirstLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 2 Then
If w2 = 1 Then
NewSecondLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewSecondLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewSecondLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewSecondLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewSecondLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewSecondLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewSecondLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 3 Then
If w2 = 1 Then
NewThirdLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewThirdLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewThirdLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewThirdLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewThirdLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewThirdLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewThirdLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 4 Then
If w2 = 1 Then
NewFourthLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewFourthLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewFourthLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewFourthLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewFourthLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewFourthLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewFourthLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 5 Then
If w2 = 1 Then
NewFifthLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewFifthLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewFifthLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewFifthLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewFifthLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewFifthLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewFifthLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 6 Then
If w2 = 1 Then
NewSixthLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewSixthLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewSixthLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewSixthLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewSixthLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewSixthLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewSixthLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
ElseIf w1 = 7 Then
If w2 = 1 Then
NewSeventhLetter% = space% + MoveX%
ScrambleScratchNew$(1) = "0"
ElseIf w2 = 2 Then
NewSeventhLetter% = 2 * space% + MoveX%
ScrambleScratchNew$(2) = "0"
ElseIf w2 = 3 Then
NewSeventhLetter% = 3 * space% + MoveX%
ScrambleScratchNew$(3) = "0"
ElseIf w2 = 4 Then
NewSeventhLetter% = 4 * space% + MoveX%
ScrambleScratchNew$(4) = "0"
ElseIf w2 = 5 Then
NewSeventhLetter% = 5 * space% + MoveX%
ScrambleScratchNew$(5) = "0"
ElseIf w2 = 6 Then
NewSeventhLetter% = 6 * space% + MoveX%
ScrambleScratchNew$(6) = "0"
ElseIf w2 = 7 Then
NewSeventhLetter% = 7 * space% + MoveX%
ScrambleScratchNew$(7) = "0"
EndIf
Exit
EndIf
EndIf
Next
Next

FirstSpeed# = Abs(OldFirstLetter% - NewFirstLetter%) / 10
SecondSpeed# = Abs(OldSecondLetter% - NewSecondLetter%) / 10
ThirdSpeed# = Abs(OldThirdLetter% - NewThirdLetter%) / 10
FourthSpeed# = Abs(OldFourthLetter% - NewFourthLetter%) / 10
FifthSpeed# = Abs(OldFifthLetter% - NewFifthLetter%) / 10
SixthSpeed# = Abs(OldSixthLetter% - NewSixthLetter%) / 10
SeventhSpeed# = Abs(OldSeventhLetter% - NewSeventhLetter%) / 10

If MainSound$ = True PlaySound scramble

While AnimationDone$ = False
Cls
DrawBlock BackGround, 0, 0
Text 400, 500, space% + MoveX%
Text 400, 530, 2 * space% + MoveX%
Text 400, 560, ScrambleScratchNew$(5)
Text 380, 476, GameTimer%

CheckAnimateScore()
CheckConv()

If (CompIntroTimer% + 9000) >= MilliSecs() And ChatKeepUp$ = False And ConvUp$ = False Then
DisplayCompIntro()
EndIf

If (ChatTimer% + ChatTime%) <= MilliSecs() Then
If GameWait = False And ConvUp$ = False And CompTurn = False Then
ChatKeepUp$ = True
ChatTimer% = MilliSecs() + 1
CompSay$ = GetRegularChat$()
KeepUpTimer% = MilliSecs()
ChatTime% = GetChatTime%(level%)
End If
EndIf

If ChatKeepUp$ = True And GameWait = False And ConvUp$ = False And CompTurn = False And GameTimer >= 15 Then
If (KeepUpTimer% + 9000) >= MilliSecs() Then
Text 110, 5, CompSay$
Else
ChatKeepUp$ = False
EndIf
EndIf

DrawImages()
DrawCircles()
;---------------------------------------------------------------------------------

If FirstImageClicked = True Then
FirstDone$ = True
DrawImage FirstLetterOld, FirstImagePos% + MoveX%, ClickedY%
ElseIf OldFirstLetter% < NewFirstLetter% Then
OldFirstLetter% = OldFirstLetter% + FirstSpeed#
DrawImage FirstLetterOld, OldFirstLetter%, NotClickedY%
ElseIf OldFirstLetter% > NewFirstLetter% Then
OldFirstLetter% = OldFirstLetter% - FirstSpeed#
DrawImage FirstLetterOld, OldFirstLetter%, NotClickedY%
ElseIf OldFirstLetter% = NewFirstLetter% Then
OldFirstLetter% = NewFirstLetter%
FirstDone$ = True
DrawImage FirstLetterOld, NewFirstLetter%, NotClickedY%
EndIf

If SecondImageClicked = True Then
SecondDone$ = True
DrawImage SecondLetterOld, SecondimagePos% + MoveX%, ClickedY%
ElseIf OldSecondLetter% < NewSecondLetter% Then
OldSecondLetter% = OldSecondLetter% + SecondSpeed#
DrawImage SecondLetterOld, OldSecondLetter%, NotClickedY%
ElseIf OldSecondLetter% > NewSecondLetter% Then
OldSecondLetter% = OldSecondLetter% - SecondSpeed#
DrawImage SecondLetterOld, OldSecondLetter%, NotClickedY%
ElseIf OldSecondLetter% = NewSecondLetter% Then
OldSecondLetter% = NewSecondLetter%
SecondDone$ = True
DrawImage SecondLetterOld, NewSecondLetter%, NotClickedY%
EndIf

If ThirdImageClicked = True Then
ThirdDone$ = True
DrawImage ThirdLetterOld, ThirdimagePos% + MoveX%, ClickedY%
ElseIf OldThirdLetter% < NewThirdLetter% Then
OldThirdLetter% = OldThirdLetter% + ThirdSpeed#
DrawImage ThirdLetterOld, OldThirdLetter%, NotClickedY%
ElseIf OldThirdLetter% > NewThirdLetter% Then
OldThirdLetter% = OldThirdLetter% - ThirdSpeed#
DrawImage ThirdLetterOld, OldThirdLetter%, NotClickedY%
ElseIf OldThirdLetter% = NewThirdLetter% Then
OldThirdLetter% = NewThirdLetter%
ThirdDone$ = True
DrawImage ThirdLetterOld, NewThirdLetter%, NotClickedY%
EndIf

If FourthImageClicked = True Then
FourthDone$ = True
DrawImage FourthLetterOld, FourthImagePos% + MoveX%, ClickedY%
ElseIf OldFourthLetter% < NewFourthLetter% Then
OldFourthLetter% = OldFourthLetter% + FourthSpeed#
DrawImage FourthLetterOld, OldFourthLetter%, NotClickedY%
ElseIf OldFourthLetter% > NewFourthLetter% Then
OldFourthLetter% = OldFourthLetter% - FourthSpeed#
DrawImage FourthLetterOld, OldFourthLetter%, NotClickedY%
ElseIf OldFourthLetter% = NewFourthLetter% Then
OldFourthLetter% = NewFourthLetter%
FourthDone$ = True
DrawImage FourthLetterOld, NewFourthLetter%, NotClickedY%
EndIf

If FifthImageClicked = True Then
FifthDone$ = True
DrawImage FifthLetterOld, FifthImagePos% + MoveX%, ClickedY%
ElseIf OldFifthLetter% < NewFifthLetter% Then
OldFifthLetter% = OldFifthLetter% + FifthSpeed#
DrawImage FifthLetterOld, OldFifthLetter%, NotClickedY%
ElseIf OldFifthLetter% > NewFifthLetter% Then
OldFifthLetter% = OldFifthLetter% - FifthSpeed#
DrawImage FifthLetterOld, OldFifthLetter%, NotClickedY%
ElseIf OldFifthLetter% = NewFifthLetter% Then
OldFifthLetter% = NewFifthLetter%
FifthDone$ = True
DrawImage FifthLetterOld, NewFifthLetter%, NotClickedY%
EndIf

If SixthImageClicked = True Then
SixthDone$ = True
DrawImage SixthLetterOld, SixthImagePos% + MoveX%, ClickedY%
ElseIf OldSixthLetter% < NewSixthLetter% Then
OldSixthLetter% = OldSixthLetter% + SixthSpeed#
DrawImage SixthLetterOld, OldSixthLetter%, NotClickedY%
ElseIf OldSixthLetter% > NewSixthLetter% Then
OldSixthLetter% = OldSixthLetter% - SixthSpeed#
DrawImage SixthLetterOld, OldSixthLetter%, NotClickedY%
ElseIf OldSixthLetter% = NewSixthLetter% Then
OldSixthLetter% = NewSixthLetter%
SixthDone$ = True
DrawImage SixthLetterOld, NewSixthLetter%, NotClickedY%
EndIf

If SeventhImageClicked = True Then
SeventhDone$ = True
DrawImage SeventhLetterOld, SeventhImagePos% + MoveX%, ClickedY%
ElseIf OldSeventhLetter% < NewSeventhLetter% Then
OldSeventhLetter% = OldSeventhLetter% + SeventhSpeed#
DrawImage SeventhLetterOld, OldSeventhLetter%, NotClickedY%
ElseIf OldSeventhLetter% > NewSeventhLetter% Then
OldSeventhLetter% = OldSeventhLetter% - SeventhSpeed#
DrawImage SeventhLetterOld, OldSeventhLetter%, NotClickedY%
ElseIf OldSeventhLetter% = NewSeventhLetter% Then
OldSeventhLetter% = NewSeventhLetter%
SeventhDone$ = True
DrawImage SeventhLetterOld, NewSeventhLetter%, NotClickedY%
EndIf

If FirstDone$ And SecondDone And ThirdDone And FourthDone And FifthDone And SixthDone And SeventhDone Then
AnimationDone$ = True
EndIf

;---------------------------------------------------------------------------------
PrintResults()
PrintScore()
CompPrintScore()
CompPrintResults()
If MainScreen$ = False Then DrawImage mouse2, MouseX(), MouseY()

If MainScreen$ = True Then
Flip False
Else
VWait:Flip False
EndIf
Wend
EndIf

If MainScreen$ = False Then FreeImage mouse2
End Function

Function ResetCircleColors()
FirstR% = Rnd(255)
FirstG% = Rnd(255)
FirstB% = Rnd(255)
SecondR% = Rnd(255)
SecondG% = Rnd(255)
SecondB% = Rnd(255)
ThirdR% = Rnd(255)
ThirdG% = Rnd(255)
ThirdB% = Rnd(255)
FourthR% = Rnd(255)
FourthG% = Rnd(255)
FourthB% = Rnd(255)
FifthR% = Rnd(255)
FifthG% = Rnd(255)
FiftthB% = Rnd(255)
SixthR% = Rnd(255)
SixthG% = Rnd(255)
SixthB% = Rnd(255)
SeventhR% = Rnd(255)
SeventhG% = Rnd(255)
SeventhB% = Rnd(255)

FirstR1% = Rnd(255)
FirstG1% = Rnd(255)
FirstB1% = Rnd(255)
SecondR1% = Rnd(255)
SecondG1% = Rnd(255)
SecondB1% = Rnd(255)
ThirdR1% = Rnd(255)
ThirdG1% = Rnd(255)
ThirdB1% = Rnd(255)
FourthR1% = Rnd(255)
FourthG1% = Rnd(255)
FourthB1% = Rnd(255)
FifthR1% = Rnd(255)
FifthG1% = Rnd(255)
FiftthB1% = Rnd(255)
SixthR1% = Rnd(255)
SixthG1% = Rnd(255)
SixthB1% = Rnd(255)
SeventhR1% = Rnd(255)
SeventhG1% = Rnd(255)
SeventhB1% = Rnd(255)

End Function

Function DrawCircles()
Color FirstR%, FirstG%, FirstB%
Oval space% + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color SecondR%, SecondG%, SecondB%
Oval (space% * 2) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color ThirdR%, ThirdG%, ThirdB%
Oval (space% * 3) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color FourthR%, FourthG%, FourthB%
Oval (space% * 4) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color FifthR%, FifthG%, FifthB%
Oval (space% * 5) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color SixthR%, SixthG%, SixthB%
Oval (space% * 6) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1
Color SeventhR%, SeventhG%, SeventhB%
Oval (space% * 7) + MoveX% + 5, NotClickedY% + 7, 39, 39, 1

Color FirstR1%, FirstG1%, FirstB1%
Oval space% + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color SecondR1%, SecondG1%, SecondB1%
Oval (space% * 2) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color ThirdR1%, ThirdG1%, ThirdB1%
Oval (space% * 3) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color FourthR1%, FourthG1%, FourthB1%
Oval (space% * 4) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color FifthR1%, FifthG1%, FifthB1%
Oval (space% * 5) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color SixthR1%, SixthG1%, SixthB1%
Oval (space% * 6) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0
Color SeventhR1%, SeventhG1%, SeventhB1%
Oval (space% * 7) + MoveX% + 5, NotClickedY% + 7, 39, 39, 0

Color 0, 0, 0
End Function

Function CompDeleteAnimateScore()
For CompAnim3.CompThreeAnimScore = Each CompThreeAnimScore
Delete CompAnim3
Next

For CompAnim4.CompFourAnimScore = Each CompFourAnimScore
Delete CompAnim4
Next

For CompAnim5.CompFiveAnimScore = Each CompFiveAnimScore
Delete CompAnim5
Next

For CompAnim6.CompSixAnimScore = Each CompSixAnimScore
Delete CompAnim6
Next

For CompAnim7.CompSevenAnimScore = Each CompSevenAnimScore
Delete CompAnim7
Next
End Function

Function DeleteCheckAnimateScore()
For Anim3.ThreeAnimScore = Each ThreeAnimScore
Delete Anim3
Next

For Anim4.FourAnimScore = Each FourAnimScore
Delete Anim4
Next

For Anim5.FiveAnimScore = Each FiveAnimScore
Delete Anim5
Next

For Anim6.SixAnimScore = Each SixAnimScore
Delete Anim6
Next

For Anim7.SevenAnimScore = Each SevenAnimScore
Delete Anim7
Next
End Function

Function CheckAnimateScore()

If Animating1$ = True Then
Local count8% = 0
For Anim3.ThreeAnimScore = Each ThreeAnimScore
Text 400, Anim3\Ypos#, "+" + Anim3\Score%
Anim3\Ypos# = Anim3\Ypos# - AnimDY%
count8% = count8% + 1
Next

For Anim3.ThreeAnimScore = Each ThreeAnimScore
If Anim3\Ypos# <= 0 Then
Delete Anim3
count8% = count8% - 1
EndIf
Next
For Anim4.FourAnimScore = Each FourAnimScore
Text 400, Anim4\Ypos#, "+" + Anim4\Score%
Anim4\Ypos# = Anim4\Ypos# - AnimDY%
count8% = count8% + 1
Next
For Anim4.FourAnimScore = Each FourAnimScore
If Anim4\Ypos# <= 0 Then
Delete Anim4
count8% = count8% - 1
EndIf
Next

For Anim5.FiveAnimScore = Each FiveAnimScore
Text 400, Anim5\Ypos#, "+" + Anim5\Score%
Anim5\Ypos# = Anim5\Ypos# - AnimDY%
count8% = count8% + 1
Next
For Anim5.FiveAnimScore = Each FiveAnimScore
If Anim5\Ypos# <= 0 Then
Delete Anim5
count8% = count8% - 1
EndIf
Next

For Anim6.SixAnimScore = Each SixAnimScore
Text 400, Anim6\Ypos#, "+" + Anim6\Score%
Anim6\Ypos# = Anim6\Ypos# - AnimDY%
count8% = count8% + 1
Next
For Anim6.SixAnimScore = Each SixAnimScore
If Anim6\Ypos# <= 0 Then
Delete Anim6
count8% = count8% - 1
EndIf
Next

For Anim7.SevenAnimScore = Each SevenAnimScore
Text 400, Anim7\Ypos#, "+" + Anim7\Score%
Anim7\Ypos# = Anim7\Ypos# - AnimDY%
count8% = count8% + 1
Next
For Anim7.SevenAnimScore = Each SevenAnimScore
If Anim7\Ypos# <= 0 Then
Delete Anim7
count8% = count8% - 1
EndIf
Next
If count8% <= 0 Then Animating1$ = False
EndIf
End Function

Function CompCheckAnimateScore()
If Animating1$ = True Then
Local count% = 0
For CompAnim3.CompThreeAnimScore = Each CompThreeAnimScore
Text 400, CompAnim3\Ypos#, "+" + CompAnim3\Score%
CompAnim3\Ypos# = CompAnim3\Ypos# - AnimDY%
count% = count% + 1
Next

For CompAnim3.CompThreeAnimScore = Each CompThreeAnimScore
If CompAnim3\Ypos# <= 0 Then
Delete CompAnim3
count% = count% - 1
EndIf
Next

For CompAnim4.CompFourAnimScore = Each CompFourAnimScore
Text 400, CompAnim4\Ypos#, "+" + CompAnim4\Score%
CompAnim4\Ypos# = CompAnim4\Ypos# - AnimDY%
count% = count% + 1
Next
For CompAnim4.CompFourAnimScore = Each CompFourAnimScore
If CompAnim4\Ypos# <= 0 Then
Delete CompAnim4
count% = count% - 1
EndIf
Next

For CompAnim5.CompFiveAnimScore = Each CompFiveAnimScore
Text 400, CompAnim5\Ypos#, "+" + CompAnim5\Score%
CompAnim5\Ypos# = CompAnim5\Ypos# - AnimDY%
count% = count% + 1
Next
For CompAnim5.CompFiveAnimScore = Each CompFiveAnimScore
If CompAnim5\Ypos# <= 0 Then
Delete CompAnim5
count% = count% - 1
EndIf
Next

For CompAnim6.CompSixAnimScore = Each CompSixAnimScore
Text 400, CompAnim6\Ypos#, "+" + CompAnim6\Score%
CompAnim6\Ypos# = CompAnim6\Ypos# - AnimDY%
count% = count% + 1
Next
For CompAnim6.CompSixAnimScore = Each CompSixAnimScore
If CompAnim6\Ypos# <= 0 Then
Delete CompAnim6
count% = count% - 1
EndIf
Next

For CompAnim7.CompSevenAnimScore = Each CompSevenAnimScore
Text 400, CompAnim7\Ypos#, "+" + CompAnim7\Score%
CompAnim7\Ypos# = CompAnim7\Ypos# - AnimDY%
count% = count% + 1
Next
For CompAnim7.CompSevenAnimScore = Each CompSevenAnimScore
If CompAnim7\Ypos# <= 0 Then
Delete CompAnim7
count% = count% - 1
EndIf
Next
Color 0, 0, 0
If count% <= 0 Then Animating1$ = False
EndIf
End Function

Function GameReset()
score% = 0
CompScore% = 0
DisableRack$ = False

GotAllThree$ = False
GotAllFour$ = False
GotAllFive$ = False
GotAllSix$ = False
GotAllSeven$ = False

ThreeConvUsed$ = False
SevenConvUsed$ = False

HowManyConvSent3% = 0

ConvTimer% = 0

ThreeShowConv$ = False
ShowConvTimer3% = 0

ThreeConvSent$ = ""
End Function

Function DisplayTurnTransition()
If CompTurn Then DrawImage TurnTransitionFont, 255, 345

If YourTurn Then
If PlayerWins% >= 2 Then
Text 255, 345, "You win"
ElseIf CompWins% >= 2 Then
Text 255, 345, "You Lose"
Else
Text 255, 345, "Round " + Round% + "...Press start"
EndIf
EndIf
End Function

Function SubmitClicked()
Local PassedWord$ = ""
For ee = 1 To 7
If GivenWord$(ee) = "0" Then Exit
PassedWord$ = PassedWord$ + GivenWord$(ee)
Next

If IsCompleteWord$() Then
ResetCircleColors()
If Len(PassedWord$) > 2 Then
If IsWord$(PassedWord$) Then
ClearRack()
If Not AllReadyGuessed$(PassedWord$) Then
FindTypePos(PassedWord$)
UpdateScore(Len(PassedWord$))
EndIf
Else
ClearRack()
EndIf
EndIf
EndIf

End Function

Function OthersHigher3$()
If FourConvUsed$ = True Then Return True
If FiveConvUsed$ = True Then Return True
If SixConvUsed$ = True Then Return True
If SevenConvUsed$ = True Then Return True
Return False
End Function

Function OthersHigher4$()
If FiveConvUsed$ = True Then Return True
If SixConvUsed$ = True Then Return True
If SevenConvUsed$ = True Then Return True
Return False
End Function

Function OthersHigher5$()
If SixConvUsed$ = True Then Return True
If SevenConvUsed$ = True Then Return True
Return False
End Function

Function OthersHigher6$()
If SevenConvUsed$ = True Then Return True
Return False
End Function

Function LoadChat(value%)
For chat1.chat = Each chat
Delete chat1
Next
HowManyChat% = 0

filein = ReadFile(AppPath$ + "Game\Conv\" + level% + "\Chat.txt")

While Not Eof(filein)
chat1.chat = New chat
chat1\Talk$ = ReadLine(filein)
HowManyChat% = HowManyChat% + 1
Wend

CloseFile(filein)
End Function

Function RegularChat()
Text 250, 7, GetRegularChat$()
End Function

Function CheckConvAll()
If ThreeShowConv$ = True Then
DisplayThreeConv()
ElseIf FourShowConv$ = True Then
DisplayFourConv()
ElseIf FiveShowConv$ = True Then
DisplayFiveConv()
ElseIf SixShowConv$ = True Then
DisplaySixConv()
ElseIf SevenShowConv$ = True Then
DisplaySevenConv()
EndIf

If ShowConvTimer3% <> 0 Then
If (ShowConvTimer3% + 7000) <= millis%
ThreeShowConv$ = False
ShowConvTimer3% = 0
ConvUp$ = False
LastTalkedTimer% = millis%
EndIf
ElseIf ShowConvTimer4% <> 0 Then
If (ShowConvTimer4% + 7000) <= millis%
FourShowConv$ = False
ShowConvTimer4% = 0
ConvUp$ = False
LastTalkedTimer% = millis%
EndIf
ElseIf ShowConvTimer5% <> 0 Then
If (ShowConvTimer5% + 7000) <= millis%
FiveShowConv$ = False
ShowConvTimer5% = 0
ConvUp$ = False
LastTalkedTimer% = millis%
EndIf
ElseIf ShowConvTimer6% <> 0 Then
If (ShowConvTimer6% + 7000) <= millis%
SixShowConv$ = False
ShowConvTimer6% = 0
ConvUp$ = False
LastTalkedTimer% = millis%
EndIf
ElseIf ShowConvTimer7% <> 0 Then
If (ShowConvTimer7% + 7000) <= millis%
SevenShowConv$ = False
ShowConvTimer7% = 0
ConvUp$ = False
LastTalkedTimer% = millis%
EndIf
EndIf
End Function


Function CheckConv()
If GotAllThreeWords$() = True And HowManyThree% > 1 And OthersHigher3$() = False And ChatKeepUp = False Then
If ThreeConvUsed$ = False Then
ConvTimer% = millis%
ThreeShowConv$ = True
ShowConvTimer3% = millis%
ThreeConvSent$ = GetConvAllThree$()
ConvUp$ = True
EndIf
EndIf
If GotAllFourWords$() = True And HowManyFour% > 1 And OthersHigher4$() = False And ChatKeepUp = False Then
If FourConvUsed$ = False Then
ConvTimer% = millis%
FourShowConv$ = True
ShowConvTimer4% = millis%
FourConvSent$ = GetConvAllFour$()
ConvUp$ = True

ThreeShowConv$ = False
EndIf
EndIf
If GotAllFiveWords$() = True And HowManyFive% > 1 And OthersHigher5$() = False And ChatKeepUp = False Then
If FiveConvUsed$ = False Then
ConvTimer% = millis%
FiveShowConv$ = True
ShowConvTimer5% = millis%
FiveConvSent$ = GetConvAllFive$()
ConvUp$ = True

ThreeShowConv$ = False
FourShowConv$ = False
EndIf
EndIf
If GotAllSixWords$() = True And HowManySix% > 1 And OthersHigher6$() = False And ChatKeepUp = False Then
If SixConvUsed$ = False Then
ConvTimer% = millis%
SixShowConv$ = True
ShowConvTimer6% = millis%
SixConvSent$ = GetConvAllSix$()
ConvUp$ = True
ANice$ = True

ThreeShowConv$ = False
FourShowConv$ = False
FiveShowConv$ = False
EndIf
EndIf
If GotAllSevenWords$() = True And HowManySeven% > 0 And ChatKeepUp = False Then
If SevenConvUsed$ = False Then
ConvTimer% = millis%
SevenShowConv$ = True
ShowConvTimer7% = millis%
SevenConvSent$ = GetConvAllSeven$()
ConvUp$ = True
ANice$ = True

ThreeShowConv$ = False
FourShowConv$ = False
FiveShowConv$ = False
SixShowConv$ = False
EndIf
EndIf
End Function

Function LoadConv()
filein = ReadFile(AppPath$ + "Game\Conv\1\allthree.txt")

While Not Eof(filein)
Sent.ThreeConv = New ThreeConv
Sent\Sent$ = ReadLine(filein)
HowManyConvSent3% = HowManyConvSent3% + 1
Wend
CloseFile(filein)


filein = ReadFile(AppPath$ + "Game\Conv\1\allfour.txt")

While Not Eof(filein)
Sent1.FourConv = New FourConv
Sent1\Sent$ = ReadLine(filein)
HowManyConvSent4% = HowManyConvSent4% + 1
Wend
CloseFile(filein)


filein = ReadFile(AppPath$ + "Game\Conv\1\allfive.txt")

While Not Eof(filein)
Sent2.FiveConv = New FiveConv
Sent2\Sent$ = ReadLine(filein)
HowManyConvSent5% = HowManyConvSent5% + 1
Wend
CloseFile(filein)

filein = ReadFile(AppPath$ + "Game\Conv\1\allSix.txt")

While Not Eof(filein)
Sent3.SixConv = New SixConv
Sent3\Sent$ = R


luke101(Posted 2004) [#12]
i know this is alot of code here


jhocking(Posted 2004) [#13]
Cor, I said the just the minimum which demonstrates your problem. Oh well, I got nothing better to do right now, I'll have a look.

ADDITION: This is just an early guess since I haven't really sifted through all your code, but it looks like you are calling EraseLevelGraphics (and thus, FreeImage) after changing the screen mode. Changing the screen mode will clear all the graphics out of your scene, so calling FreeImage on an image which is already gone will result in an error. Try removing EraseLevelGraphics after the screen change.


luke101(Posted 2004) [#14]
wow..i'll try that


Ross C(Posted 2004) [#15]
You should maybe look into using arrays too, to reduce the amount of typing. Becasue you have things like.

compvar1
compvar2
compvar3
...
compvar10

:)


jhocking(Posted 2004) [#16]
It's hard to tell what's going on since I can't seem to find any call to the Graphics command. How are you initializing graphics and changing the screenmode?

Hm, is this a BlitzPlus app? Because I know little about the GUI functions. If you're using that stuff, I probably won't be much help.


luke101(Posted 2004) [#17]
i have it in the Intro() function
and the CheckMouseCollisions() function


luke101(Posted 2004) [#18]
Hooray...I think I fixed it..
I tolk jhockings advice and avoided clearing images that did not have to be cleared. Now I dont have an image does not exist error any more!!!!!

thx


Zethrax(Posted 2004) [#19]
Regarding your question on how to post a code block, the code below was basically correct except that you need to use a forward slash instead of a backward one.

[code]
print hello
[\code]


Rob(Posted 2004) [#20]
this slash /


luke101(Posted 2004) [#21]
print hello



Ice9(Posted 2004) [#22]
Ohhhh it was a "hello world" app ;)


_PJ_(Posted 2004) [#23]
bit long for just that :)