Break ON CLS $gNull=SetOption("Explicit","ON") $gNull=SetOption("Ascii","ON") Dim $iThreadMax ; Maximum threads. Dim $iThread ; Thread number being acrivated. Dim $sKeyPress ; Key pressed. $iThreadMax=60 Dim $aStates[$iThreadMax] ; An array of thread states Global $gasBitMap[24,80] ; For colour change Global $gasColours_Standard $gasColours_Standard=Split("g+/n g/n n+/n n/n") Global $gasColours_Highlight $gasColours_Highlight=Split("r+/n r/n y/n y/n") ; Seed random number SRND(@MSECS*10000+@MSECS*1000+@MSECS*100+@MSECS*10+@MSECS) LoadBitMap() $iThreadMax=$iThreadMax-1 While $sKeyPress <> "q" ; Step each thread. $iThread=0 For $iThread=0 To $iThreadMax $aStates[$iThread]=StepThread($aStates[$iThread]) Next If KBHit() Get $sKeyPress EndIf Loop Cls Exit 0 Function StepThread($aState) Dim $i Dim $x,$y ; Initialise state if the process is being called the first time. If Not VarType($aState) Redim Preserve $aState[7] EndIf If $aState[2] ; Thread no-op mode (thread brake) $aState[2]=$aState[2]-1 Else Select Case $aState[5] ; Lengthening $aState[5]=$aState[5]-1 $aState[6]=$aState[6]+1 $aState[0]=$aState[0]+Chr(150+Rnd(100)) For $i=1 To $aState[6] $x=$aState[4]+$i $y=$aState[3] If $gasBitMap[$x,$y] Color $gasColours_HighLight[CInt(CDbl($aState[6]-$i))/$aState[7]] Else Color $gasColours_Standard[CInt(CDbl($aState[6]-$i))/$aState[7]] EndIf At($x,$y) SubStr($aState[0],$i,1) Next Case $aState[6] ; Shortening $x=$aState[4]+1 $y=$aState[3] If Not $gasBitMap[$x,$y] At($x,$y) " " EndIf $aState[6]=$aState[6]-1 $aState[4]=$aState[4]+1 $aState[0]=SubStr($aState[0],2) For $i=1 To $aState[6] $x=$aState[4]+$i $y=$aState[3] If $gasBitMap[$x,$y] Color $gasColours_Highlight[3-(CInt(CDbl($i)/$aState[7]))] Else Color $gasColours_Standard[3-(CInt(CDbl($i)/$aState[7]))] EndIf At($x,$y) SubStr($aState[0],$i,1) Next Case "Uninitialised" ; Uninitialised ; Set thread speed, higher=slower, skew to fastest $aState[1]=Rnd(10) If $aState[1]>6 $aState[1]=0 EndIf ; Set X and Y start $aState[3]=Rnd(79) ; Horizontal offset $aState[4]=Rnd(23) ; Vertical offset $aState[5]=Rnd(10)+3 ; Maximum length $aState[7]=Cdbl($aState[5])/3.0 ; Colour fade If ($aState[4]+$aState[5])>23 $aState[5]=24-$aState[4] EndIf EndSelect $aState[2]=$aState[1] ; Set brake EndIf $StepThread=$aState EndFunction Function LoadBitMap() Dim $iRow,$iColumn,$iValue,$RunLength,$iLen,$iCounter For Each $RunLength In Split("@@ @@ @@ @@ @@ XBHC WCGD CEBFDACCFC DCCDECCCDC` DCBDGAECBCGBGFDGDB" +" DHOFGCLBCFDC DHFDGCGEFGDCEE DCBDFCFEGCFBDBDCFC DCCDECECACFCBACBCCDCFCBA" +" DCDDDCDCCCEEEDABDCFE CECFAECCDCECGBBBCEFC YCFD XB") $iColumn=0 $iValue=0 For $iLen=1 To Len($RunLength) For $iCounter=1 To (Asc(SubStr($RunLength,$iLen))-64) $gasBitMap[$iRow,$iColumn]=$iValue $iColumn=$iColumn+1 Next If $iValue $iValue=0 Else $iValue=1 EndIf Next $iRow=$iRow+1 Next EndFunction
|