SB_Fileset> Start>VBC309.sb< GraphicsWindow.Height = 700 GraphicsWindow.Width = 800 GraphicsWindow.PenWidth=1 GraphicsWindow.BackgroundColor ="Gray GraphicsWindow.BrushColor ="#000001 GraphicsWindow.FillRectangle(0,0,800,700) GraphicsWindow.PenColor="Black e=2.717 For X = -400 To 400 GraphicsWindow.Title=math.Round ((x+400)/8)+"%" LastZ = 700 For Y = -600 To 700 Step 10 'Z = math.cos(Math.SquareRoot(X * X + Y * Y)/10) * 20 z=ldmath.sin(2*x)*ldmath.cos(2*y)*30 DisplayZ = (400 - (Y * 0.6 + Z) ) If DisplayZ < LastZ Then 'GraphicsWindow.PenColor = LDColours.HSLtoRGB ((x+400)/2.6,1,0.6) GraphicsWindow.DrawLine (x+400, DisplayZ,x+401, DisplayZ-1) LastZ = DisplayZ EndIf EndFor EndFor x=1 While x<600 px=math.GetRandomNumber (800) py=math.GetRandomNumber (700) cc=graphicsWindow.GetPixel(px,py) GraphicsWindow.Title=math.Round (x/6)+"%" If cc="#000001" Then LDGraphicsWindow.FloodFill(px,py,LDColours.HSLtoRGB(py/2,0.1+0.8*py/700,0.1+0.7*(1-Math.Abs(py-350)/350)) ) x=x+1 endif EndWhile End>VBC309.sb< Start>VBF928.sb< maximumInterest = 50 TextWindow.Write("Bank Total: ") bankTotalInput = TextWindow.ReadNumber() Path = Program.Directory Directory_Path = Path + "\resources" File_Path = Directory_Path + "\text.txt" ' The following line could be harmful and has been automatically commented. ' Get_Path = File.GetDirectories(Directory_Path) ' The following line could be harmful and has been automatically commented. ' File_Get_Path = File.GetFiles(Directory_Path + "text.txt") If Get_Path = "FAILED" or File_Get_Path = "FAILED" Then ' The following line could be harmful and has been automatically commented. '   File.CreateDirectory(Directory_Path) ' The following line could be harmful and has been automatically commented. '   File.WriteContents(File_Path, bankTotalInput)   EndIf TextWindow.Write("Deposit Total: ") principalInput = TextWindow.ReadNumber() If principalInput < 0 Then   TextWindow.WriteLine("Deposit cannot be negative")   TextWindow.PauseWithoutMessage()   Program.End() Else   TextWindow.Write("Tax Percentage: ")   interestInput = TextWindow.ReadNumber()   If interestInput < 0 or interestInput = maximumInterest Then     TextWindow.WriteLine("Interest cannot be negative or greater than " + maximumInterest)   Else     TextWindow.Write("Year duration: ")     durationInput = TextWindow.ReadNumber()     duration = durationInput     bankInput = bankTotalInput     TextWindow.WriteLine("")     TextWindow.WriteLine("Bank Total Before = " + bankInput)     TextWindow.WriteLine("Deposited = " + principalInput)     TextWindow.WriteLine("Tax Percentage = " + interestInput + "%")     TextWindow.WriteLine("Duration = " + duration + " years")     TextWindow.WriteLine("")       year = 1   While year <= duration     'interestPaid = principalInput * (interestInput / 100)     'principalInput = principalInput - interestPaid     TextWindow.WriteLine(year + ": - " + principalInput)     year = year + 1     'principalInput = principalInput + bankInput   'EndWhile   TextWindow.WriteLine("InterestInput: "+interestinput+" principleinput: "+principalinput)     interestPaid = principalInput * (interestInput / 100)     total = principalInput - interestPaid + bankInput     TextWindow.WriteLine("")     TextWindow.WriteLine("Tax paid = " + interestPaid)     TextWindow.WriteLine("Bank Total Now = " + total) bankInput = total endwhile   EndIf       TextWindow.WriteLine("")   TextWindow.WriteLine("Press Any Key to terminate program")   TextWindow.PauseWithoutMessage()   Program.End() EndIf End>VBF928.sb< Start>VBJ291-0.sb< ' Challenge of the Month - March 2017 KUMIKO pattern by NaochanON VBJ291-0 dL="1=40;2=8" ' half Length of side of triangle dL=dL+";H1="+(dL[1]/math.SquareRoot(3)*2)+";H2="+(dL[2]/math.SquareRoot(3)*2) Color="0=Transparent;1=#752100;2=#7B6C3E;3=#EE7800" YN=6 XN=10 GraphicsWindow.BackgroundColor="Black" GraphicsWindow.Width=dL[1]*(XN*2-1) GraphicsWindow.Height=dL[1]*math.SquareRoot(3)*YN For N=1 to YN for M=1 to XN _C="X="+(2*dL[1]*(M-1)+dL[1]-Math.Remainder(N,2)*dL[1])+";Y="+(dL["H1"]+dL[1]*math.SquareRoot(3)*(N-1)) make_triangle() _C="X="+(2*dL[1]*(M-1)+Math.Remainder(N,2)*dL[1])+";Y="+(dL["H1"]+dL[1]*math.SquareRoot(3)*(N-1)-dL["H1"]/2) make_triangle2() endfor endfor sub make_triangle GraphicsWindow.BrushColor=Color[0] GraphicsWindow.PenColor=Color[1] GraphicsWindow.PenWidth=4 tri[M+":"+N][1]= Shapes.AddTriangle(0,-dL["H1"],-dL[1],dL["H1"]/2,dL[1],dL["H1"]/2) 'Outer Large Triangle Shapes.Animate(tri[M+":"+N][1],_C["X"],_C["Y"],500) GraphicsWindow.PenColor=Color[2] tri[M+":"+N][2]= Shapes.AddTriangle(-dL[2],-dL["H2"]/2,0,dL["H2"],dL[2],-dL["H2"]/2) 'Inner Small Triangle Shapes.animate(tri[M+":"+N][2],_C["X"],_C["Y"],500) GraphicsWindow.PenColor=Color[3] GraphicsWindow.PenWidth=2 L[M+":"+N][1]=Shapes.AddLine(_C["X"],_C["Y"]-dL["H1"],_C["X"]-dL[2],_C["Y"]-dL["H2"]/2) L[M+":"+N][2]=Shapes.AddLine(_C["X"]-dL[2],_C["Y"]-dL["H2"]/2,_C["X"]-dL[1],_C["Y"]+dL["H1"]/2) L[M+":"+N][3]=Shapes.AddLine(_C["X"]-dL[1],_C["Y"]+dL["H1"]/2,_C["X"],_C["Y"]+dL["H2"]) L[M+":"+N][4]=Shapes.AddLine(_C["X"],_C["Y"]+dL["H2"],_C["X"]+dL[1],_C["Y"]+dL["H1"]/2) L[M+":"+N][5]=Shapes.AddLine(_C["X"]+dL[1],_C["Y"]+dL["H1"]/2,_C["X"]+dL[2],_C["Y"]-dL["H2"]/2) L[M+":"+N][6]=Shapes.AddLine(_C["X"]+dL[2],_C["Y"]-dL["H2"]/2,_C["X"],_C["Y"]-dL["H1"]) Program.Delay(100) EndSub sub make_triangle2 GraphicsWindow.BrushColor=Color[0] GraphicsWindow.PenColor=Color[2] GraphicsWindow.PenWidth=4 tri[M+":"+N][3]= Shapes.AddTriangle(-dL[2],dL["H2"]/2,0,-dL["H2"],dL[2],dL["H2"]/2) 'Inner Small Triangle Shapes.Animate(tri[M+":"+N][3],_C["X"],_C["Y"],500) GraphicsWindow.PenColor=Color[3] GraphicsWindow.PenWidth=2 L[M+":"+N][1]=Shapes.AddLine(_C["X"],_C["Y"]-dL["H2"],_C["X"]-dL[1],_C["Y"]-dL["H1"]/2) L[M+":"+N][2]=Shapes.AddLine(_C["X"]-dL[1],_C["Y"]-dL["H1"]/2,_C["X"]-dL["H2"],_C["Y"]+dL["H2"]/2) L[M+":"+N][3]=Shapes.AddLine(_C["X"]-dL["H2"],_C["Y"]+dL["H2"]/2,_C["X"],_C["Y"]+dL["H1"]) L[M+":"+N][4]=Shapes.AddLine(_C["X"],_C["Y"]+dL["H1"],_C["X"]+dL["H2"],_C["Y"]+dL["H2"]/2) L[M+":"+N][5]=Shapes.AddLine(_C["X"]+dL["H2"],_C["Y"]+dL["H2"]/2,_C["X"]+dL[1],_C["Y"]-dL["H1"]/2) L[M+":"+N][6]=Shapes.AddLine(_C["X"]+dL[1],_C["Y"]-dL["H1"]/2,_C["X"],_C["Y"]-dL["H2"]) Program.Delay(100) EndSub End>VBJ291-0.sb< Start>VBM477.sb< NewGame() 'Welcome() Sub Welcome GraphicsWindow.Clear() Controls.AddButton("Play",0,0) Controls.ButtonClicked = NewGame EndSub Sub NewGame Init() Start() Finish() EndSub Sub Init difficulty = "" dead="" GraphicsWindow.Clear() paddle = Shapes.AddRectangle(120, 12) ball = Shapes.AddEllipse(16, 16) GraphicsWindow.FontSize = 14 GraphicsWindow.MouseMove = OnMouseMove score = 0 PrintScore() x = 0 y = 0 deltaX = 1 deltaY = 2 gh = GraphicsWindow.Height EndSub Sub Start While dead="" Play() EndWhile EndSub Sub Play CalcDelay() x = x + deltaX y = y + deltaY gw = GraphicsWindow.Width gh = GraphicsWindow.Height If (x >= gw - 16 Or x <= 0) Then deltaX = -deltaX EndIf If (y <= 0) Then deltaY = -deltaY EndIf padX = Shapes.GetLeft(paddle) If (y = gh - 28 And x >= padX And x <= padX + 120) Then Sound.PlayClick() score = score + 10 PrintScore() deltaY = -deltaY EndIf Shapes.Move(ball, x, y) Program.Delay(delay) If (y >= gh) then dead="true" EndIf EndSub Sub Finish GraphicsWindow.ShowMessage(message, "") Welcome() EndSub Sub OnMouseMove paddleX = GraphicsWindow.MouseX Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) EndSub Sub PrintScore ' Clear the score first and then draw the real score text GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(10, 10, 200, 20) GraphicsWindow.BrushColor = "Black" message = "Score: " + score + " Difficulty: " + Math.Abs(delay- 5) GraphicsWindow.DrawText(10, 10, message ) EndSub Sub CalcDelay If difficulty = "" then difficulty = 100 EndIf difficulty = difficulty - .0025 ' how much it gets faster, higher = sooner delay = Math.Round(difficulty / 20) If oldDelay <> delay Then Sound.PlayChime() ' friendly warning oldDelay = delay EndIf EndSub End>VBM477.sb< Start>VBN634.sb< ' Sum of Digits ' ' Write a program to recrsively sum all the digits in a number ' There is a pattern for any number divisible by 9 ' ' For example 561096 : 5+6+1+0+9+6 = 27 : 2+7 = 9 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' While "True" TextWindow.WriteLine("Write a number to sum all his digits.") NumberGivenFromTheUser = TextWindow.ReadNumber() NumberLength = Text.GetLength(NumberGivenFromTheUser) Divisor = Math.Power(10, NumberLength - 1) x[0] = NumberGivenFromTheUser / Divisor For k = 0 To NumberLength DigitNo[k + 1] = Math.Floor(x[k]) x[k + 1] = (x[k] - DigitNo[k + 1]) * 10 EndFor For l = 1 To NumberLength TextWindow.Write(DigitNo[l]) If l < NumberLength Then TextWindow.Write("+") EndIf EndFor TextWindow.Write("=") sum = 0 For m = 1 To NumberLength sum = sum + DigitNo[m] EndFor TextWindow.WriteLine(sum) TextWindow.WriteLine("") EndWhile End>VBN634.sb< Start>VBN835.sb< 'Meteor Shower 'An original game concept by codingCat aka Matthew L. Parets 'Product Parets Programming 'Originally developed in Extended Basic for the TI-99/4a circa 1983 'Redeveloped for SmallBasic in March/April of 2015. 'Released under Creative Commons Attribution-NonCommercial- 'ShareAlike 4.0 International License. 'Free to use, share and modify as you as you tell them I said hi. 'HOW TO PLAY: '----> Move the ship from the home base (left) to the far base (right) '----> Double the muliplier by continuing right past the far base. '----> Avoid the Metseors. Each hit damages your ship. '--------> Damage sets the multipler back to 1 '--------> Game is over when damage = 100% '----> Points awared: (100 per meteor + time bonus) * multipier '--------> Points cut in half if shields used '--------> Final bonus at games end = score * number of meteors '----> Control the ship: Arrow keys '----> Activate Shields: Space Bar (available twice after each docking) '----> GOOD LUCK!! '*** To enable saving of high scores uncomment lines: 1456 and 1522 '----------------------------------------------------------------------------------------------------------- 'Initial setup - Only happens once, each time you run the program '----------------------------------------------------------------------------------------------------------- GraphicsWindow.Show() GraphicsWindow.CanResize = "false" GraphicsWindow.BackgroundColor = "black" gameTitleText = "Meteor Shower" GraphicsWindow.Title = gameTitleText meteorCharacter = Text.GetCharacter(9733) 'Unicode character used for meteor - Replaced: 9732 shipCharacter = Text.GetCharacter(10148) 'Unicode character used for ship shieldCharacter = Text.GetCharacter(11094)'Unicode character used for shield LoadHighScore() 'Build the games shapes (messages and ships) PlayerShapesBuild() TitleScreenMessageBuild() GameOverScreenMessageBuild() TitleMessageCrawlBuild() GameOverMessageCrawlBuild() InitialsEntryBuild() FlashBackGround() 'reset the background following the build GraphicsWindow.KeyDown = OnKeyDown '----------------------------------------------------------------------------------------------------------- 'Main Program Loop - happens for each game played '----------------------------------------------------------------------------------------------------------- exiting = "False" 'User interaction - Has the escape key been pressed While exiting = "False" 'Set the inital game state pressed = "False" 'User interaction - Has a key been pressed? shipCourseChange = "False" 'Has the ship changed course? progressingLevel = "False" 'Are we between levels? meteorStart = 5 'How many meteors start out on the screen shieldsPerRound = 2 'How many shields can be used per round shieldDurration = 2500 'How long do shields last? 2500 = 2.5 seconds frameRate = 13 'Minimum Milliseconds per frame - the smaller the number, the more often the screen is updated shotLength = 10000 'Number of milliseconds in the shot clock. Reach the base before zero for a bonus scoreMultiplier = 1 'No multiplier at the start of the game 'Setup initial game conditions MeteorInitialPlacement() RelocateBase() SetInitialShipConditions() 'Title and Instruction Screen TitleScreenMessageShow() CrawlStartOpeningMessage() '----------------------------------------------------------------------------------------------------------- 'Opening Screen - Introduction to the game '----------------------------------------------------------------------------------------------------------- keyPressed = "False" 'Loop until a key is pressed While keyPressed = "False" And exiting = "False" frameStart = Clock.ElapsedMilliseconds paceMessage = paceMessage + 1 'Message crawl and ready message happn out of sync with meteor updates If Math.Remainder(paceMessage,3) = 0 Then CrawlUpdateMessage() FlashReadyMessage() endif UpdateMeteors() WaitKey() EndWhile CrawlMessageHide() 'Hide the start screen as the game begins OutlinedMessageHide() clClr = "Black" ClearColor() gameOver = "False" 'Setup the main game loop ShowPlayerShapes() ShowStatus() FlashHome() shotClock = Clock.ElapsedMilliseconds 'Start the bonus clock for the first time '----------------------------------------------------------------------------------------------------------- 'Main Game Loop - Processing of the main game '----------------------------------------------------------------------------------------------------------- While gameOver = "False" And exiting = "False" frameStart = Clock.ElapsedMilliseconds GameKeyCheck() 'Read the keyboard MoveTheShip() 'Respond to user interaction DetectBaseCollision() 'Interaction with other objects DetectMeteorCollision() UpdateMeteors() 'Move the meteors, pause afterward to pace the frame rate endWhile HidePlayerShapes() 'Game over Man - GAME OVER!! ------------------------------------------------------------------- ShowFinalBonusMessage() 'Flash the screen as the bonus is calculated GameOverScreenMessageShow() ShowStatus() '----------------------------------------------------------------------------------------------------------- 'High Score Initial entry '----------------------------------------------------------------------------------------------------------- If score > highscore[10] Then 'Was the score in the top 10 of all time? FinalScoreMessage() initialEntryShow() 'Keep going until enter or escape is pressed While InitEntry = "True" And exiting = "False" frameStart = Clock.ElapsedMilliseconds EnterInitials() paceMessage = paceMessage + 1 'Score flash happens out of sync with meteors and ey presses If Math.Remainder(paceMessage,3) = 0 Then FlashScoreMessage() EndIf UpdateMeteors() WaitKey() EndWhile InitialEntryHide() EndIf 'Setup the game over screen UpdateHighScore() 'Save the high scores to a file, update the crawl CrawlStartGameOverMessage() FinalScoreMessage() FinalStatus() '----------------------------------------------------------------------------------------------------------- 'Score / Credits / Restart Screen '----------------------------------------------------------------------------------------------------------- keyPressed = "False" While keyPressed = "False" And exiting = "False" frameStart = Clock.ElapsedMilliseconds paceMessage = paceMessage + 1 If Math.Remainder(paceMessage,3) = 0 Then FlashRestartMessage() FlashScoreMessage() CrawlUpdateMessage() endif UpdateMeteors() WaitKey() EndWhile CrawlMessageHide() OutlinedMessageHide() clClr = "Black" ClearColor() endwhile Program.End() 'close the window and exit 'Sub Routines ------------------------------------------------------------------------------------------- '--- ShowFinalBonusMessage ------------------------------------------------------------------------ '--- Displayed the bonus screen a the end of each game. Bonus is current score times '-- the number of meteors '----------------------------------------------------------------------------------------------------------- Sub ShowFinalBonusMessage FlashScoreStart = score sfbm = Clock.ElapsedMilliseconds flashTotalDur = 3000 'How long should bonus flashing be (in millesconds)? flashPartDur = (flashTotalDur * 0.8) / meteorCount 'The multipler flash should take 80% of the time available multiplierIncrement = math.Floor(FlashScoreStart / (flashPartDur / frameRate)) flashPartStart = Clock.ElapsedMilliseconds multiplierDisplay = 1 flashFinalBonusBackground = "True" keyPressed = "False" While Clock.ElapsedMilliseconds - sfbm < flashTotalDur And exiting = "False" frameStart = Clock.ElapsedMilliseconds If Clock.ElapsedMilliseconds - sfbm > (flashTotalDur * 0.8) And flashFinalBonusBackground = "True" Then 'Bonus update is complete, prevent over flow of the score flashFinalBonusBackground = "False" score = FlashScoreStart * meteorCount multiplierDisplay = meteorCount clClr = "Black" 'set background stays black ClearColor() EndIf If flashFinalBonusBackground = "True" Then If score < FlashScoreStart * meteorCount then score = score + multiplierIncrement GraphicsWindow.Title = score EndIf If Clock.ElapsedMilliseconds - flashPartStart > flashPartDur And multiplierDisplay < meteorCount then multiplierDisplay = multiplierDisplay + 1 flashPartStart = Clock.ElapsedMilliseconds EndIf FlashBackGroundOnce() EndIf FlashFinalBonusMessage() UpdateMeteors() WaitKey() EndWhile clClr = "Black" ClearColor() EndSub '--- FlashFinalBonusMessage ------------------------------------------------------------------------ '--- Keep the message flashing in different colors. Multiple calls to FlashAnyMessage '----------------------------------------------------------------------------------------------------------- Sub FlashFinalBonusMessage flshMsg = "FINAL BONUS" flshMX = 3 flshMY = 30 GraphicsWindow.FontSize = 90 GraphicsWindow.FontItalic = "False" GraphicsWindow.FontBold = "True" FlashAnyMessage() flshMsg = "x" + multiplierDisplay flshMX = 200 flshMY = 100 GraphicsWindow.FontSize = 150 GraphicsWindow.FontItalic = "False" GraphicsWindow.FontBold = "True" FlashAnyMessage() commaNumber = score AddCommasToNumber() nudgeNum = ((Text.GetLength(commaNumber)-1) - math.Floor(Text.GetLength(commaNumber) / 4)) * 45 nudgeCom = math.Floor(Text.GetLength(commaNumber) / 4) * 19 nudge = nudgeNum + nudgeCom FlashScoreMessage() FlashAnyMessage() EndSub '--- FlashReadyMessage ------------------------------------------------------------------------------ '--- Repaint the ready message in a random color '----------------------------------------------------------------------------------------------------------- Sub FlashReadyMessage flshMsg = "< < < Ready Player One - Press Any Key to Begin > > >" flshMX = 50 flshMY = 250 GraphicsWindow.FontSize = 20 GraphicsWindow.FontItalic = "True" GraphicsWindow.FontBold = "False" FlashAnyMessage() EndSub '--- FlashRestartMessage ------------------------------------------------------------------------------ '--- Repaint the restart message in a random color '----------------------------------------------------------------------------------------------------------- Sub FlashRestartMessage flshMsg = "< < < Press Any Key for the Next Player > > >" flshMX = 220 flshMY = GraphicsWindow.Height - 15 GraphicsWindow.FontSize = 10 GraphicsWindow.FontItalic = "True" GraphicsWindow.FontBold = "False" FlashAnyMessage() EndSub '--- FlashScoreMessage ------------------------------------------------------------------------------- '--- Repaint the final score message in a random color '----------------------------------------------------------------------------------------------------------- Sub FlashScoreMessage flshMX = 560 - nudge flshMY = 350 flshMsg = commaNumber GraphicsWindow.FontSize = 70 GraphicsWindow.FontBold = "true" GraphicsWindow.FontItalic = "True" FlashAnyMessage() EndSub '--- FlashAnyMessage --------------------------------------------------------------------------------- '--- Generic flash routine. Picks a mid-range color at random and displays the message '----------------------------------------------------------------------------------------------------------- Sub FlashAnyMessage flashMsgClr = GraphicsWindow.GetColorFromRGB(Math.GetRandomNumber(180)+75,Math.GetRandomNumber(180)+75,Math.GetRandomNumber(180)+75) GraphicsWindow.BrushColor = flashMsgClr GraphicsWindow.DrawText(flshMX,flshMY,flshMsg) EndSub '--- ClearColor ------------------------------------------------------------------------------------------ '--- Clear the screen to the selected color - This routine is used instead of '--- graphicswindow.clear to avoid disrupting the shapes '----------------------------------------------------------------------------------------------------------- Sub ClearColor GraphicsWindow.BrushColor = clClr GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,GraphicsWindow.Height) EndSub '--- ShowPlayerShapes ------------------------------------------------------------------------------- '--- Turn on the shapes used by the player during the came '----------------------------------------------------------------------------------------------------------- Sub ShowPlayerShapes Shapes.ShowShape(base) Shapes.ShowShape(home) Shapes.ShowShape(ship) EndSub '--- HidePlayerShapes -------------------------------------------------------------------------------- '--- Turn off the shapes used by the player during the came '----------------------------------------------------------------------------------------------------------- Sub HidePlayerShapes GraphicsWindow.BrushColor = "black" 'clear the green home base GraphicsWindow.FillRectangle(homex,homey, 20,15) HideShield() Shapes.HideShape(home) Shapes.HideShape(base) Shapes.HideShape(Ship) EndSub '--- FinalScoreMessage ------------------------------------------------------------------------------- '--- Display the end of game message showing the players final progress '----------------------------------------------------------------------------------------------------------- sub FinalScoreMessage GraphicsWindow.FontSize = 40 GraphicsWindow.FontBold = "true" GraphicsWindow.FontItalic = "true" GraphicsWindow.BrushColor = "white" msg = "Score amongst " + meteorCount + " meteors =" GraphicsWindow.DrawText(11,306, msg) GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(10,305, msg) GraphicsWindow.FontSize = 70 'Setup for flashing score commaNumber = score 'format the score with commas and right justify it AddCommasToNumber() nudgeNum = ((Text.GetLength(commaNumber)-1) - math.Floor(Text.GetLength(commaNumber) / 4)) * 45 nudgeCom = math.Floor(Text.GetLength(commaNumber) / 4) * 19 nudge = nudgeNum + nudgeCom GraphicsWindow.BrushColor = "white" 'display he white shaddow GraphicsWindow.DrawText(563 - nudge,353, commaNumber) EndSub '--- GameKeyCheck ----------------------------------------------------------------------------------- '--- Keyboard check routine used during game loop '----------------------------------------------------------------------------------------------------------- Sub GameKeyCheck If pressed = "True" Then 'has a key been pressed since the last key press? homeBase = "False" 'Any key press launchs from home base Shapes.HideShape(home) key = GraphicsWindow.LastKey If key = "Left" Then 'Check for direction keys If shipmovex = -1 Then 'Double tap backwards to fly straight shipmovey = 0 EndIf shipmovex = -1 ElseIf key = "Right" then If shipmovex = 1 then 'Double tap forward to fly straight shipmovey = 0 EndIf shipmovex = 1 ElseIf key = "Up" then shipmovey = -1 ElseIf key = "Down" then shipmovey = 1 ElseIf key = "Space" then 'Space bar invokes the shields shieldUse = shieldUse + 1 If shieldUse <= shieldsPerRound then 'if we have not used the shields this round shieldStrength = 100 shieldStart = Clock.ElapsedMilliseconds EndIf ElseIf key = "Escape" then 'hide the window and crash out of game GraphicsWindow.Hide() exiting = "True" EndIf If key <> "Space" And lastPressed <> key Then 'track if the ship has changed direction shipCourseChange = "True" 'This check is to prevent the player from gliding for multiple rounds without changing directions EndIf lastPressed = key pressed = "False" 'Reset, waiting for next key to be pressed EndIf EndSub '--- WaitKey ------------------------------------------------------------------------------------------- '--- keyboard check routine used in places that are not the game itself. '----------------------------------------------------------------------------------------------------------- Sub WaitKey If pressed = "True" Then 'The difference between pressed and keyPress is subtle, and 'keyPressed is not strictly needed. It is used to smooth the 'logic and separate the physical key press (handled by the 'key event and the pressed varaible) from the logic 'of determining what key has been pressed keyPressed = "True" key = GraphicsWindow.LastKey If key = "Escape" then GraphicsWindow.Hide() exiting = "True" EndIf pressed = "False" endif EndSub '--- MoveTheShip ------------------------------------------------------------------------------------- '--- Animate the ship. Updates its location on the screen '----------------------------------------------------------------------------------------------------------- Sub MoveTheShip shipx = shipx + shipmovex 'New ship location shipy = shipy + shipmovey If shipx > GraphicsWindow.Width - 5 Then 'Handle the edges of the screen PushLevel() ElseIf shipx < 1 then shipx = 1 shipmovex = 0 endif If shipy > GraphicsWindow.Height - 12 Then shipy = GraphicsWindow.Height - 12 shipmovey = 0 ElseIf shipy < -2 then shipy = -2 shipmovey = 0 EndIf Shapes.Move(Ship,shipx, shipy) 'Move the ship If shieldStrength > 1 Then 'Handle the sheilds ShieldFade() EndIf EndSub '--- ShieldFade ----------------------------------------------------------------------------------------- '--- While flashing the colors, fade the shield from full to the '----------------------------------------------------------------------------------------------------------- Sub ShieldFade shieldStrength = 100 - (((Clock.ElapsedMilliseconds - shieldStart) * 100) / shieldDurration) Shapes.SetOpacity(shield[shieldNum],shieldStrength) If shieldStrength > 1 Then Shapes.HideShape(shield[shieldNum]) shieldCnt = shieldCnt + 1 shieldNum = math.Remainder(shieldCnt,Array.GetItemCount(shield)) + 1 Shapes.Move(shield[shieldNum],shipx-10,shipy-14) Shapes.ShowShape(shield[shieldNum]) EndIf EndSub '--- HideShield ----------------------------------------------------------------------------------------- '--- Turn off the shield entirly - hide their shapes '----------------------------------------------------------------------------------------------------------- Sub HideShield For hpsi = 1 To array.GetItemCount(shield) Shapes.HideShape(shield[hpsi]) endfor EndSub '--- DetectBaseCollision ------------------------------------------------------------------------------ '--- Detect Base - Has the ship made it to the remote base? '----------------------------------------------------------------------------------------------------------- Sub DetectBaseCollision ' Top left of ship inside of base bottom right inside of base? bottom left top right If ((shipx > basex And shipx < basex + 20) And (shipy + 2 > basey And shipy + 2 < basey + 15)) or ((shipx + 10 > basex And shipx + 10 < basex + 20) And (shipy + 12 > basey And shipy + 12 < basey + 15)) or ((shipx > basex And shipx < basex + 20) And (shipy + 12 > basey And shipy + 12 < basey + 15)) or ((shipx + 10 > basex And shipx + 10 < basex + 20) And (shipy + 2 > basey And shipy + 2 < basey + 15)) Then 'Setup for next level Shapes.HideShape(Ship) HideShield() CalculateScore() homeBase = "True" 'Reset for next level shieldUse = 0 shipmovex = 0 shipmovey = 0 FlashBase() NextLevel() shipx = 7 shipy = homey Shapes.Move(Ship,shipx, shipy) Shapes.ShowShape(ship) FlashHome() ShowStatus() shotClock = Clock.ElapsedMilliseconds EndIf EndSub '--- DetectMeteorCollision --------------------------------------------------------------------------- '--- Detect colision with meteor - Is the ship occupying the same space as a meteor '----------------------------------------------------------------------------------------------------------- Sub DetectMeteorCollision If homeBase = "False" Then 'Ignore if at home base and no key has been pressed, or the shields are up For i = 1 To meteorCount If ((shipx > meteorX[i] And shipx < meteorX[i]+18) And (shipy + 2 > meteorY[i]+6 And shipy + 2 < meteorY[i]+21)) or ((shipx + 10 > meteorX[i] And shipx + 10 < meteorX[i]+18) And (shipy + 12 > meteorY[i]+6 And shipy + 12 < meteorY[i]+21)) or ((shipx > meteorX[i] And shipx meteorY[i]+6 And shipy + 12 < meteorY[i]+21)) or ((shipx + 10 > meteorX[i] And shipx + 10 < meteorX[i]+18) And (shipy + 2 > meteorY[i]+6 And shipy + 2 < meteorY[i]+21)) Then If shieldStrength > 1 then 'If the shields are up meteorX[i] = meteorX[i] + meteorSpeed[i] 'Push the meteor back metydir = Math.GetRandomNumber(3) - 2 'random up or down, or straight meteorY[i] = meteorY[i] + (3 * metydir) 'push the vertical Else 'No shields 'SpinHome and setup for restart homeBase = "True" UpdateDamage() ShowStatus() SpinHome() FlashHome() ShowStatus() scoreMultiplier = 1 EndIf endif EndFor endif EndSub '--- ShowStatus ----------------------------------------------------------------------------------------- '--- Update the title bar with the score, number of meteors and ship damage '----------------------------------------------------------------------------------------------------------- Sub ShowStatus title = "Score: " commaNumber = score AddCommasToNumber() title = title + commaNumber title = title + " - Meteors: " title = title + meteorCount title = title + " - Damage: " title = title + damage title = title + "%" GraphicsWindow.Title = title EndSub '--- FinalStatus ----------------------------------------------------------------------------------------- '--- Update the status bar at the end of the game with the final status '----------------------------------------------------------------------------------------------------------- Sub FinalStatus title = "Score = " commaNumber = score AddCommasToNumber() title = title + commaNumber title = title + " - Meteors = " title = title + meteorCount title = title + " - " title = title + Text.GetSubTextToEnd(rankingMsg2,9) GraphicsWindow.Title = title EndSub '--- UpdateDamage ------------------------------------------------------------------------------------ '--- Process the damage taken after a collision with a meteor '----------------------------------------------------------------------------------------------------------- Sub UpdateDamage damage = damage + (5 * meteorSpeed[i]) If damage >= 100 Then damage = 100 gameOver = "True" EndIf EndSub '--- FlashHome ----------------------------------------------------------------------------------------- '--- Flash the homebase base at the start of each level '----------------------------------------------------------------------------------------------------------- Sub FlashHome holdb = base 'flash the home base location base = home holdbx = basex basex= homex holdby = basey basey = homey FlashBase() base = holdb basex = holdbx basey = holdby shipmovex = 0 'stop the ship from moving shipmovey = 0 homeBase = "True" 'We are docked at the home base pressed = "False" 'no key has been currently pressed (don't buffer) endsub '--- FlashBase ------------------------------------------------------------------------------------------ '--- Flash the remote base as the player completes the level '----------------------------------------------------------------------------------------------------------- Sub FlashBase Shapes.HideShape(base) fbnow = Clock.ElapsedMilliseconds While Clock.ElapsedMilliseconds - fbnow < 1000 frameStart = Clock.ElapsedMilliseconds color = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(basex, basey, 20, 15) UpdateMeteors() EndWhile GraphicsWindow.BrushColor = "green" GraphicsWindow.fillRectangle(basex,basey, 20,15) Shapes.ShowShape(base) EndSub '--- UpdateMeteors ------------------------------------------------------------------------------------ '--- Move the meteors. If they fly of the screen at the left, replace them at the right '----------------------------------------------------------------------------------------------------------- sub UpdateMeteors For ium = 1 to meteorCount 'GraphicsWindow.PenColor = "black" 'Test code -- will clear the hit boxes around the meteors 'GraphicsWindow.DrawRectangle(meteorX[ium],meteory[ium]+6,20,15) meteorX[ium] = meteorX[ium] - meteorSpeed[ium] 'respawn if the screen edge is reached If meteorX[ium] < 0 - 13 Then '18 is the width of the meteors smsPos = ium SetMeteorStart() EndIf 'GraphicsWindow.PenColor = "green" 'Test code -- will display the hit boxes around the meteors 'GraphicsWindow.DrawRectangle(meteorX[ium],meteory[ium]+6,20,15) Shapes.Move(meteor[ium], meteorX[ium], meteorY[ium]) EndFor 'Spin in place to pace the game While Clock.ElapsedMilliseconds - frameStart < frameRate endwhile endsub '--- SetMeteorStart ------------------------------------------------------------------------------------ '--- Place the current meteor at a random y position off the screen to the right '----------------------------------------------------------------------------------------------------------- Sub SetMeteorStart meteorX[smsPos] = GraphicsWindow.Width 'location just off screen to the right If shipCourseChange = "False" And homeBase = "False" Then 'Has the ship changed course since the last level push? meteorY[smsPos] = shipy - 6 'target the ship directly with a rock shipCourseChange = "True" Else 'choose a random location for this rock meteorY[smsPos] = Math.GetRandomNumber(GraphicsWindow.Height) - 5 'subtract half the height of the meteor - this will let the meteor hug the top and bottom EndIf speedbump = Math.Round(meteorCount / 5) 'Increase the top speed every fifth new meteor meteorSpeed[smsPos] = Math.GetRandomNumber(30 + ((speedbump-1) * 5)) / 10 If meteorSpeed[smsPos] > 10 Then 'If the speed bump gets out of hand meteorSpeed[smsPos] = 10 'Set it to its maximum EndIf If progressingLevel Then 'Warp speed if we are in the process of moving from one level to another meteorSpeed[smsPos] = meteorSpeed[smsPos] + (GraphicsWindow.Width / stepCount) EndIf EndSub '--- MeteorInitialPlacement -------------------------------------------------------------------------- '--- Meteor reset at start of game - clear old meteors, create the default number of new ones '----------------------------------------------------------------------------------------------------------- Sub MeteorInitialPlacement If Array.GetItemCount(meteor) > 0 then 'Remove any meteors in the list - reset from previous game For mip = 1 To meteorCount shapes.Remove(meteor[mip]) shapes.Remove(meteorX[mip]) shapes.Remove(meteorY[mip]) shapes.Remove(meteorSpeed[mip]) EndFor EndIf meteorCount = 0 'Start at zero, raised to meteorStart by AddNewMeteor For mip = 1 to meteorStart 'Add the first meteors AddNewMeteor() endfor EndSub '--- AddNewMeteor ------------------------------------------------------------------------------------ '--- Create and add a new meteor to the list, setting its initail position and speed. '----------------------------------------------------------------------------------------------------------- Sub AddNewMeteor meteorCount = meteorCount + 1 'Increase number of meteors GraphicsWindow.FontSize = 20 'set the size shape and color of meteor GraphicsWindow.FontItalic = "False" GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(Math.GetRandomNumber(100) + 155,0,0) meteor[meteorCount] = Shapes.AddText(meteorCharacter) 'Create the meteor shape Shapes.Rotate(meteor[meteorCount], 26) 'Rotate from default to face left smsPos = meteorCount 'Set its initial position SetMeteorStart() Shapes.Move(meteor[meteorCount], meteorX[meteorCount], meteorY[meteorCount]) EndSub '--- RelocateBase --------------------------------------------------------------------------------------- '--- Move the far base to a new random location '----------------------------------------------------------------------------------------------------------- Sub RelocateBase GraphicsWindow.BrushColor = "black" GraphicsWindow.FillRectangle(basex,basey, 20,15) 'clear the non-shape background GraphicsWindow.FillRectangle(homex,homey, 20,15) homey = basey 'Home takes over location of far base Shapes.Move(home, homex, homey) 'relocate home basey = Math.GetRandomNumber(GraphicsWindow.Height - 19) + 2 Shapes.Move(base, basex, basey) 'relocate the far base EndSub '--- CalculateScore ------------------------------------------------------------------------------------- '--- '----------------------------------------------------------------------------------------------------------- Sub CalculateScore prevScore = score 'Keep track of the current score shieldMultiplier = 1 If shieldUse >= shieldsPerRound Then 'Half the multiplier if the shields are used shieldMultiplier = shieldMultiplier / 2 endif roundScore = meteorCount * 100 'Base score is 100 points per meteor timeToBase = clock.ElapsedMilliseconds - shotClock 'Bonus of 1 point per millisecond for time left in shot clock If timeToBase > shotLength Then 'Make sure there isn't an odd wrapping situation timebonus = 0 Else timebonus = shotLength - timeToBase EndIf 'Calculate the score - score multiplier is doubled each time you push past the far base score = score + ((roundScore + timebonus) * scoreMultiplier * shieldMultiplier) score = Math.Round(score) EndSub '--- AddCommasToNumber -------------------------------------------------------------------------- '--- Add commas every three digits in a number '----------------------------------------------------------------------------------------------------------- Sub AddCommasToNumber commaNumber = "G" + commaNumber + "Q" 'random letters added to enforce concatenation rather than additon commaResult = "M" commaPos = 0 For actni = text.GetLength(commaNumber)-1 To 2 Step -1 'Stepping backwards through the number commaSub = Text.GetSubText(commaNumber,actni,1) 'The next digit commaPos = commaPos + 1 'The next position in the result If math.Remainder(commaPos-1,3) = 0 and text.GetLength(commaResult) > 3 Then 'time for a comma? commaResult = "," + commaResult 'Add a comma EndIf commaResult = commaSub + commaResult 'Add the next digit to the result EndFor commaNumber = text.GetSubText(commaResult,1,Text.GetLength(commaResult)-1) 'Return the number EndSub '--- 'NoTheName ----------------------------------------------------------------------------------------- '--- '----------------------------------------------------------------------------------------------------------- Sub SpinHome 'Use of animate is almost cheating given the design of this program. It is hard to resist given its simplicity Shapes.Animate(ship, homex, homey, 1000) 'Send the ship home - 1000ms = 1 second starthome = Clock.ElapsedMilliseconds rotateAngle = 0 rotatehome = Clock.ElapsedMilliseconds ShowPow() While Clock.ElapsedMilliseconds - starthome < 1000 ' Take a full second fly home, regardless of distance frameStart = Clock.ElapsedMilliseconds 'Spin while moving home - update the spin every 50 mils If Clock.ElapsedMilliseconds - rotatehome < 50 then rotateAngle = rotateAngle + 5 Shapes.Rotate(Ship,rotateAngle) rotatehome = Clock.ElapsedMilliseconds EndIf 'Flash message to let the user know the multipler has been lost multiplierCount = multiplierCount + 1 'Do this only one in five times through the loop If math.Remainder(multiplierCount, 5) = 0 Then If GraphicsWindow.Title = "" then 'Alternate between clear and display GraphicsWindow.Title = "Score Multiplier Lost" Else GraphicsWindow.Title = "" EndIf EndIf 'Pow - zoom and fade during spin home powTimePercent = ((Clock.ElapsedMilliseconds - starthome) * 100) / 1000 powSize = 3 * (powTimePercent/100) ' Multiplier, how many times its original size will it be when its done? powFade = 100-powTimePercent Shapes.Zoom(pow,powsize,powsize) Shapes.SetOpacity(pow,powfade) UpdateMeteors() 'Keep the meteors in motion during this process EndWhile shipx = 7 shipy = homey shipmovex = 0 shipmovey = 0 Shapes.Move(Ship,shipx, shipy) Shapes.Rotate(Ship,0) GraphicsWindow.Title = "Score Multiplier Lost" HidePow() EndSub '--- PushLevel ----------------------------------------------------------------------------------------- '--- push to next level - has the ship gone past the right edge of the Window? '----------------------------------------------------------------------------------------------------------- Sub PushLevel shipVisible = "True" shieldStrength = 100 shieldStart = Clock.ElapsedMilliseconds scoreMultiplier = scoreMultiplier * 2 ProgressLevel() shipx = 1 GraphicsWindow.BrushColor = "green" GraphicsWindow.fillRectangle(homex,homey, 20,15) homeBase = "False" ShowStatus() EndSub '--- NextLevel ------------------------------------------------------------------------------------------- '--- Following dock with the far base, push to the next level. make use of progress level '--- to save on code and increase maintablity. '----------------------------------------------------------------------------------------------------------- 'Setup for the level jump Sub NextLevel shipVisible = "False" Shapes.HideShape(ship) ProgressLevel() Shapes.ShowShape(home) Shapes.ShowShape(ship) EndSub '--- ProgressLevel ------------------------------------------------------------------------------------- '--- Push to the next level following either docking with far base, or when the ship moves '--- to the next level (increasing the multiplier) '----------------------------------------------------------------------------------------------------------- Sub ProgressLevel progressingLevel = "True" 'needed to prevent duplicating code in UpdateMeteors stepCount = 100 'The number of steps (the speed) to move the base to the home position scoreUpStep = score - prevScore GraphicsWindow.BrushColor = "black" GraphicsWindow.FillRectangle(basex,basey, 20,15) GraphicsWindow.FillRectangle(homex,homey, 20,15) Shapes.HideShape(home) 'Increase the difficulty by adding another meteor AddNewMeteor() 'Set the speed of the meteors to get everything to the edge of the screen in stepCount number of jumps For nlc = 1 To meteorCount meteorSpeed[nlc] = meteorSpeed[nlc] + (GraphicsWindow.Width / stepCount) EndFor 'Jump to the next level, quickly moving everything from one edge of the screen to the other For driftCnt = 1 To stepCount frameStart = Clock.ElapsedMilliseconds basex = basex - (GraphicsWindow.Width / stepCount) 'Move the base Shapes.Move(base, basex, basey) If shipVisible="True" Then 'Move the ship - when pushing a level rather than docking shipx = shipx - (GraphicsWindow.Width / stepCount) Shapes.Move(ship, shipx, shipy) ShieldFade() 'Shields are up during push multiplierCount = multiplierCount + 1 If math.Remainder(multiplierCount, 5) = 0 Then 'Flash multiplier message during push If GraphicsWindow.Title = "" then GraphicsWindow.Title = "Multiplier Increased To: " + scoreMultiplier Else GraphicsWindow.Title = "" EndIf EndIf Else 'Spin the score up prevScore = math.Round(prevScore + (scoreUpStep / stepCount)) scoreMsg = "Score = " + prevScore GraphicsWindow.Title = scoreMsg endif UpdateMeteors() EndFor 'Slow the meteors down again For nlc = 1 To meteorCount meteorSpeed[nlc] = meteorSpeed[nlc] - (GraphicsWindow.Width / stepCount) EndFor Shapes.HideShape(base) homey = basey Shapes.Move(home, homex, homey) basex = GraphicsWindow.Width - 22 basey = Math.GetRandomNumber(GraphicsWindow.Height - 19) + 2 Shapes.Move(base, basex, basey) Shapes.ShowShape(base) shipCourseChange = "False" 'tracked to force the player to manuver progressingLevel = "False" 'needed to prevent duplicating code in UpdateMeteors EndSub '--- SetInitialShipConditions ------------------------------------------------------------------------- '--- Ship conditions at the start of the game '----------------------------------------------------------------------------------------------------------- Sub SetInitialShipConditions shipx = 7 shipy = homey shipmovex = 0 shipmovey = 0 homeBase = "True" score = 0 damage = 0 Shapes.Move(ship, shipx, shipy) EndSub '--- PlayerShapesBuild -------------------------------------------------------------------------------- '--- Construct the player resrouces - Ship, Shield, Crash messages, and Bases, '----------------------------------------------------------------------------------------------------------- Sub PlayerShapesBuild 'Place the ship clClr = "Blue" 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = "blue" Ship = Shapes.AddText(shipCharacter) Shapes.HideShape(ship) Shapes.Rotate(ship,0) 'Construct and hide the shields clClr = "magenta" ClearColor() GraphicsWindow.BrushColor = "magenta" GraphicsWindow.FontSize = 30 shield[1] = Shapes.AddText(shieldCharacter) Shapes.HideShape(shield[1]) clClr = "cyan" ClearColor() GraphicsWindow.BrushColor = "cyan" shield[2] = Shapes.AddText(shieldCharacter) Shapes.HideShape(shield[2]) 'Place the Pow powMsgLst[1] = "POW" powMsgLst[2] = "BAM" powMsgLst[3] = "ZAP" powMsgLst[4] = "OUCH" powMsgLst[5] = "ARGH" powMsgLst[6] = "DRAT" powMsgLst[7] = "EEK" powMsgLst[8] = "HEY" powMsgLst[9] = "MEH" powMsgLst[10] = "OOPS" powMsgLst[11] = "RATS" powMsgLst[12] = "UGGH" GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(255,175,255) clClr = GraphicsWindow.BrushColor 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.FontItalic = "True" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 15 For pbi = 1 To Array.GetItemCount(powMsgLst) powShape[pbi] = Shapes.AddText(powMsgLst[pbi]) Shapes.HideShape(powShape[pbi]) Shapes.SetOpacity(powShape[pbi],0) Shapes.Rotate(powShape[pbi],-20) Shapes.Move(powShape[pbi],300,200) EndFor 'Place the Bases clClr = "orange" 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = "orange" GraphicsWindow.PenColor = "orange" home = Shapes.AddRectangle(20,15) Shapes.HideShape(home) base = Shapes.AddRectangle(20,15) Shapes.HideShape(base) homex = 2 homey = 0 basex = GraphicsWindow.Width - 22 basey = GraphicsWindow.Height / 2 EndSub '--- ShowPow ------------------------------------------------------------------------------------------- '--- Turn on a random pow shape. Setup for the fade and zoom effect '----------------------------------------------------------------------------------------------------------- Sub ShowPow powChoice = Math.GetRandomNumber(Array.GetItemCount(powMsgLst)) pow = powShape[powChoice] powSize = 1 powFade = 100 Shapes.Move(pow, shipx, shipy) Shapes.ShowShape(pow) EndSub '--- HidePow ------------------------------------------------------------------------------------------- '--- Tirm off the current pow message '----------------------------------------------------------------------------------------------------------- Sub HidePow Shapes.HideShape(pow) EndSub '--- TitleScreenMessageBuild ------------------------------------------------------------------------ '--- Builds the multi-cololor outlined message used as the title for the opening screen '----------------------------------------------------------------------------------------------------------- Sub TitleScreenMessageBuild olmColors[1] = "white" olmColors[2] = "Yellow" olmColors[3] = "green" olmColors[4] = "blue" olmColors[5] = "red" outlinedMessage = gameTitleText olmx = 9 olmy = 75 olmOffset = 1 GraphicsWindow.FontSize = 78 GraphicsWindow.FontBold = "true" GraphicsWindow.FontItalic = "True" OutlinedMessageBuild() TitleMessageShapes = olmshp EndSub '--- TitleScreenMessageShow ------------------------------------------------------------------------ '--- Show the title screen shapes '----------------------------------------------------------------------------------------------------------- Sub TitleScreenMessageShow GraphicsWindow.Title = gameTitleText olmshp = TitleMessageShapes OutlinedMessageShow() EndSub '--- TitleScreenMessageHide ------------------------------------------------------------------------- '--- Hide the title screen shapes '----------------------------------------------------------------------------------------------------------- Sub TitleScreenMessageHide olmshp = TitleMessageShapes OutlinedMessageHide() EndSub '--- GameOverScreenMessageBuild ----------------------------------------------------------------- '--- Builds the multi-cololor outlined message used as the title for the game over screen '----------------------------------------------------------------------------------------------------------- Sub GameOverScreenMessageBuild olmColors[1] = "white" olmColors[2] = "Yellow" olmColors[3] = "green" olmColors[4] = "blue" olmColors[5] = "red" outlinedMessage = "Game Over" olmx = 4 olmy = 30 olmOffset = 2 GraphicsWindow.FontSize = 105 GraphicsWindow.FontItalic = "True" GraphicsWindow.FontBold = "True" OutlinedMessageBuild() GamesOverMessageShapes = olmshp EndSub '--- GameOverScreenMessageShow ---------------------------------------------------------------- '--- Show the game over screen shapes '----------------------------------------------------------------------------------------------------------- Sub GameOverScreenMessageShow olmshp = GamesOverMessageShapes OutlinedMessageShow() EndSub '--- GameOverScreenMessageHide ----------------------------------------------------------------- '--- Hide the game over screen shapes '----------------------------------------------------------------------------------------------------------- Sub GameOverScreenMessageHide olmshp = GamesOverMessageShapes OutlinedMessageHide() EndSub '--- OutlinedMessageBuild ---------------------------------------------------------------------------- '--- Create the shapes used for an outlined message. The message, color and location '--- are all set during the build process. This allows the message to be quickly show '--- when it is needed, and hidden again without the need to clear the screen '--- For each color used draw create four shapes for the message, each at different offsets '--- from the center where the final copy is placed '----------------------------------------------------------------------------------------------------------- Sub OutlinedMessageBuild For olmcnt = 1 To 5 clClr = olmColors[olmcnt] 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = olmColors[olmcnt] olmshp[olmcnt][1] = Shapes.AddText(outlinedMessage) Shapes.Move(olmshp[olmcnt][1], olmx + (olmOffset*(5-olmcnt)), olmy + (olmOffset*(5-olmcnt))) Shapes.HideShape(olmshp[olmcnt][1]) olmshp[olmcnt][2] = Shapes.AddText(outlinedMessage) Shapes.Move(olmshp[olmcnt][2], olmx + (olmOffset*(5-olmcnt)), olmy - (olmOffset*(5-olmcnt))) Shapes.HideShape(olmshp[olmcnt][2]) olmshp[olmcnt][3] = Shapes.AddText(outlinedMessage) Shapes.Move(olmshp[olmcnt][3], olmx - (olmOffset*(5-olmcnt)), olmy + (olmOffset*(5-olmcnt))) Shapes.HideShape(olmshp[olmcnt][3]) olmshp[olmcnt][4] = Shapes.AddText(outlinedMessage) Shapes.Move(olmshp[olmcnt][4], olmx - (olmOffset*(5-olmcnt)), olmy - (olmOffset*(5-olmcnt))) Shapes.HideShape(olmshp[olmcnt][4]) EndFor EndSub '--- OutlinedMessageShow --------------------------------------------------------------------------- '--- Turn the outlined message on by showing the shapes it is composed of. '----------------------------------------------------------------------------------------------------------- Sub OutlinedMessageShow For olmcnt = 1 To 5 For olmclr = 1 To 4 shapes.ShowShape(olmshp[olmcnt][olmclr]) EndFor EndFor endsub '--- OutlinedMessageHide ---------------------------------------------------------------------------- '--- Turn the outline message off by hiding the shapes it is composed of. '----------------------------------------------------------------------------------------------------------- Sub OutlinedMessageHide For olmcnt = 1 To 5 For olmclr = 1 To 4 shapes.HideShape(olmshp[olmcnt][olmclr]) EndFor EndFor EndSub '--- FlashBackGround --------------------------------------------------------------------------------- '--- flash the background to make the background color change to hide '--- the shape building process seem on purpose '----------------------------------------------------------------------------------------------------------- Sub FlashBackGround For i = 1 To 10 FlashBackGroundOnce() Program.Delay(25) EndFor clClr = "black" 'Set background to brush color to hide shape creation ClearColor() EndSub '--- FlashBackGroundOnce --------------------------------------------------------------------------- '--- Clear the backgroun to a random color '----------------------------------------------------------------------------------------------------------- Sub FlashBackGroundOnce clClr = GraphicsWindow.GetRandomColor() ClearColor() EndSub '--- 'GameOverMessageCrawlBuild ----------------------------------------------------------------- '--- Set up the shapes for the message crawl on the game over screen '--- Blanks will be filled in at the end of each game '----------------------------------------------------------------------------------------------------------- Sub GameOverMessageCrawlBuild 'High score message text highScoreMsg[1] = "Your Score:" highScoreMsg[2] = " " highScoreMsg[3] = " " highScoreMsg[4] = " " highScoreMsg[5] = "Leader Board" highScoreMsg[6] = " " highScoreMsg[7] = " " highScoreMsg[8] = " " highScoreMsg[9] = " " highScoreMsg[10] = " " highScoreMsg[11] = " " highScoreMsg[12] = " " highScoreMsg[13] = " " highScoreMsg[14] = " " highScoreMsg[15] = " " highScoreMsg[16] = " " highScoreMsg[17] = " " highScoreMsg[18] = "Product Parets Programming." highScoreMsg[19] = gameTitleText + " is an original game" highScoreMsg[20] = "concept by codingCat aka Matthew L. Parets." highScoreMsg[21] = "Originally developed in ExtendedBasic" highScoreMsg[22] = "for the TI-99/4a circa 1983. Redeveloped" highScoreMsg[23] = "for SmallBasic in March/April of 2015." highScoreMsg[24] = "Released under Creative Commons:" highScoreMsg[25] = "Attribution-NonCommercial-ShareAlike 4.0" highScoreMsg[26] = "International License. Free to use, share" highScoreMsg[27] = "and modify as long as you tell them I said hi." 'Call the routine to build the needed shapes crawlMsg = highScoreMsg crawlMsgLength = Array.GetItemCount(crawlMsg) crTexColor = GraphicsWindow.GetColorFromRGB(62,200,62) BuildCrawlMessage() 'Store them until needed highScoreMsgShpShad = msgshpshad highScoreMsgShp = msgshp EndSub '--- 'CrawlStartGameOverMessage ----------------------------------------------------------------- '--- Setup for the Game Over message crawl. Current high score values are replaced '--- at the end of eaach game '----------------------------------------------------------------------------------------------------------- Sub CrawlStartGameOverMessage 'Top left of the opening message crawl view port msgshpshad = highScoreMsgShpShad msgshp = highScoreMsgShp clClr = GraphicsWindow.GetColorFromRGB(62,200,62) 'Set background to brush color to hide shape creation ClearColor() crTexColor = GraphicsWindow.GetColorFromRGB(62,200,62) GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 12 crLinHei = 15 'Font size plus line spacing clClr = GraphicsWindow.GetColorFromRGB(87,87,87) 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(87,87,87) commaNumber = score 'Set the current score AddCommasToNumber() rankingMsg1 = " " + commaNumber + " against " + meteorCount + " Meteors" rankingMsg2 = " Ranking = " + (fndPos - 1) + " of " + (extraCount - 1) msgshpshad[2] = Shapes.AddText(rankingMsg1) Shapes.HideShape(msgshpshad[2]) msgshpshad[3] = Shapes.AddText(rankingMsg2) Shapes.HideShape(msgshpshad[3]) clClr = crTexColor 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = crTexColor msgshp[2] = Shapes.AddText(rankingMsg1) Shapes.HideShape(msgshp[2]) msgshp[3] = Shapes.AddText(rankingMsg2) Shapes.HideShape(msgshp[3]) For chsm = 1 To 10 'Include the top 10 scores commaNumber = highscore[chsm] AddCommasToNumber() msg = (chsm-1) + ") " + highname[chsm] + Text.GetCharacter(9657) + highlevel[chsm] + Text.GetCharacter(9657) + commaNumber clClr = GraphicsWindow.GetColorFromRGB(87,87,87) 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(87,87,87) msgshpshad[chsm + 5] = Shapes.AddText(" " +msg) Shapes.HideShape(msgshpshad[chsm + 5]) clClr = crTexColor 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = crTexColor msgshp[chsm + 5] = Shapes.AddText(" " +msg) Shapes.HideShape(msgshp[chsm + 5]) EndFor FlashBackGround() 'reset the background following the build crDispY = 140 crDispX = 200 crDspSiz = 11 'Size of view port should always be odd crStrtOff = 3 'Number of lines of invisible scroll before visible lines appear (3 = 0) CrawlStartEveryMessage() EndSub '--- TitleMessageCrawlBuild ------------------------------------------------------------------------- '--- Set up the shapes for the message crawl on the opening title screen '----------------------------------------------------------------------------------------------------------- Sub TitleMessageCrawlBuild openingMsg[1] = "-A death defying search for scientific " openingMsg[2] = ">riches amongst the rocks." openingMsg[3] = "-Use the arrow keys to move your ship. " openingMsg[4] = "-Avoid being hit by the meteors while you " openingMsg[5] = ">move from the home base (left) to the " openingMsg[6] = ">new base (right). If you bypass the new" openingMsg[7] = ">base, the multiplier is doubled." openingMsg[8] = "-Space Bar activates two seconds of shields." openingMsg[9] = ">Shields are recharged at each new base." openingMsg[10] = "-Each hit by a rock damages your ship, " openingMsg[11] = ">resets the multiplier and returns you to " openingMsg[12] = ">the home base. " openingMsg[13] = "-The speed and density of rocks increases " openingMsg[14] = ">as you travel deeper into the field. " openingMsg[15] = "-Points are awarded based on the multiplier " openingMsg[16] = ">value, density of the rocks, shield use and " openingMsg[17] = ">the time taken jumping from base to base. " openingMsg[18] = ">A final bonus is awarded based on how " openingMsg[19] = ">many meteors you faced." openingMsg[20] = "-Good luck! You are going to need it." 'Call the routine to build the needed shapes crawlMsg = openingMsg crawlMsgLength = Array.GetItemCount(crawlMsg) crTexColor = GraphicsWindow.GetColorFromRGB(0,200,0) BuildCrawlMessage() 'Store them until needed openingMsgShpShad = msgshpshad openingMsgShp = msgshp EndSub '--- CrawlStartOpeningMessage -------------------------------------------------------------------- '--- Setup to start the opening title screen crawl '----------------------------------------------------------------------------------------------------------- Sub CrawlStartOpeningMessage 'Top left of the opening message crawl view port msgshpshad = openingMsgShpShad msgshp = openingMsgShp crDispY = 295 crDispX = 175 crDspSiz = 7 'Size of view port should always be odd crStrtOff = 0 'Number of lines of invisible scroll before visible lines appear (0 = 3) CrawlStartEveryMessage() EndSub '--- BuildCrawlMessage ------------------------------------------------------------------------------ '--- Build the message shapes for the message crawls -- Title and Game Over screens '----------------------------------------------------------------------------------------------------------- Sub BuildCrawlMessage GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 12 crLinHei = 15 'Font size plus line spacing For i = 1 To crawlMsgLength 'For each line in the crawl message If Text.GetSubText(crawlMsg[i], 1,1) = "-" Then 'Outline entry msg = text.GetCharacter(10147) + " " + text.GetSubText(crawlMsg[i],2,Text.GetLength(crawlMsg[i])-1) ElseIf Text.GetSubText(crawlMsg[i], 1,1) = ">" then 'Secondary outline entry msg = " " + text.GetSubText(crawlMsg[i],2,Text.GetLength(crawlMsg[i])-1) Else 'Straight up message by itself msg = crawlMsg[i] EndIf clClr = GraphicsWindow.GetColorFromRGB(87,87,87) 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(87,87,87) 'shaddow msgshpshad[i] = Shapes.AddText(msg) Shapes.HideShape(msgshpshad[i]) clClr = crTexColor 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = crTexColor msgshp[i] = Shapes.AddText(msg) Shapes.HideShape(msgshp[i]) EndFor EndSub '--- CrawlStartEveryMessage ----------------------------------------------------------------------- '--- Start the crawl message. Setting position on the screen and starting point in array '--- Opening view into the crawl message array '----------------------------------------------------------------------------------------------------------- Sub CrawlStartEveryMessage crawlMsgLength = Array.GetItemCount(msgshp) startPnt = crawlMsgLength + crStrtOff 'Start at the end, the last line in the message endPnt = crawlMsgLength + (crDspSiz-1) + crStrtOff 'end down past the size of the view port (this starts the message at the bottom, undisplayed) crDspMid = math.Round(crDspSiz / 2) 'Find the middle. This should be a single line and is why the view port should be an odd number of lines crPrcntBefAft = 100 / (crDspMid - 1) 'Percentage step for each line before and then after middle crOpcyChngPerLine = crPrcntBefAft / crLinHei 'Percentage change of opacity for each pixel line moved umc = 1 'Starting point to loop through the dot lines of each line of text EndSub '--- 'CrawlUpdateMessage --------------------------------------------------------------------------- '--- Move each line in the view port one pixel line '--- Loop is external - umc must be set to 1 at the start of this process '----------------------------------------------------------------------------------------------------------- Sub CrawlUpdateMessage CrawlUpdateViewPort() umc = umc + 1 If umc > crLinHei then 'When text has completly scrolled from one line to another 'Hide the one at the top If startPnt <= crawlMsgLength then 'do not access display arrays if outside their range Shapes.HideShape(msgshpshad[startPnt]) Shapes.HideShape(msgshp[startPnt]) EndIf 'move the front of the array up (wrap if needed) startPnt = startPnt + 1 If startPnt > crawlMsgLength + (crDspSiz+3) then startPnt = 1 EndIf 'move the back of the array up (wrap if needed) endPnt = endPnt + 1 If endPnt > crawlMsgLength + (crDspSiz+3) then endPnt = 1 EndIf 'show the next one at the bottom If endPnt <= crawlMsgLength then 'do not access display arrays if outside their range Shapes.Move(msgshpshad[endPnt], crDispX+ 1, crDispY + (crLinHei * crDspSiz) + 1 - 1) Shapes.Move(msgshp[endPnt], crDispX, crDispY + (crLinHei * crDspSiz) - 1) Shapes.SetOpacity(msgshpshad[endPnt],0) Shapes.SetOpacity(msgshp[endPnt],0) Shapes.ShowShape(msgshpshad[endPnt]) Shapes.ShowShape(msgshp[endPnt]) EndIf umc = 1 EndIf EndSub '--- 'CrawlUpdateViewPort --------------------------------------------------------------------------- '--- Update each line of the viewport '--- Move and modify the opacity of each display line one step '----------------------------------------------------------------------------------------------------------- Sub CrawlUpdateViewPort mvDispPos = 1 'Track the display line crAryPos = startPnt 'Index into the display array For uel = 1 To crDspSiz 'for eah line in the display If crAryPos <= crawlMsgLength then 'do not access display arrays if outside their range 'Move the text Shapes.Move(msgshpshad[crAryPos], crDispX+ 1, crDispY + (crLinHei * mvDispPos) + 1 - umc) Shapes.Move(msgshp[crAryPos], crDispX, crDispY + (crLinHei * mvDispPos) - umc) 'Set the visibility level If uel = crDspMid then 'if the middle line, set fully visible Shapes.SetOpacity(msgshpshad[crAryPos],100) Shapes.SetOpacity(msgshp[crAryPos],100) Else 'Update visibity based on location in view If uel < crDspMid then 'above the middle of the view opcy = ( (uel - 1) * crPrcntBefAft ) + ((crLinHei-umc) * crOpcyChngPerLine) Else 'below the middle of the view opcy = ( (crDspSiz - uel) * crPrcntBefAft ) + (umc * crOpcyChngPerLine) EndIf Shapes.SetOpacity(msgshpshad[crAryPos],opcy) Shapes.SetOpacity(msgshp[crAryPos],opcy) endif EndIf mvDispPos = mvDispPos + 1 crAryPos = crAryPos + 1 If crAryPos > crawlMsgLength + (crDspSiz+3) Then 'Wrap the position in the array crAryPos = 1 EndIf EndFor EndSub '--- CrawlMessageHide ------------------------------------------------------------------------------- '--- Hide the current message, icluding setting its visibity (opacity) to zero '----------------------------------------------------------------------------------------------------------- Sub CrawlMessageHide For cri = 1 To crawlMsgLength Shapes.HideShape(msgshpshad[cri]) Shapes.HideShape(msgshp[cri]) Shapes.SetOpacity(msgshpshad[cri],0) Shapes.SetOpacity(msgshp[cri],0) EndFor EndSub '--- 'SortScores ----------------------------------------------------------------------------------------- '--- Once a new score has been added to the leader board, place it in its correct location '----------------------------------------------------------------------------------------------------------- Sub SortScores For si = 1 To 10 'a simple bubble sort For sj = 1 To 10 If highscore[si] > highscore[sj] Then holdscore = highscore[si] holdlevel = highlevel[si] holdname = highname[si] highscore[si] = highscore[sj] highlevel[si] = highlevel[sj] highname[si] = highname[sj] highscore[sj] = holdscore highlevel[sj] = holdlevel highname[sj] = holdname EndIf EndFor EndFor EndSub '--- UpdateExtraScores ------------------------------------------------------------------------------- '--- The array extraScores tracks the infinite leader board. Every unique score is sorted '--- into its correct position. Duplicates are discarded '----------------------------------------------------------------------------------------------------------- Sub UpdateExtraScores spos = 0 fndPos = -1 found = "False" 'Search for new scores position in the high score list While spos < extraCount And fndPos = -1 'while less then list size and not found spos = spos + 1 'next position please If extraScore[spos] = score Then 'did we find an exact match? fndPos = spos 'take note of matching position found = "True" 'note the fact that a match was found EndIf If score > extraScore[spos] Then 'is the score bigger than this position fndPos = spos 'note the position EndIf EndWhile If found = "False" Then 'did we find an exact match? extraCount = extraCount + 1 'expand the size of the list If fndPos <> -1 Then 'If not less then last on the list For sei = extraCount To fndPos + 1 Step - 1 'Push down the rest of the list - back to front extraScore[sei] = extraScore[sei - 1] 'Current equals next one up EndFor extraScore[spos] = score 'place the new value at the calcualted position Else 'Less the the last on the list? extraScore[extraCount] = score 'Place it at the end. fndPos = extraCount 'take note of the fact EndIf EndIf For sei = extraCount To 11 Step -1 'Drop any zeros off the list (ignore the top 10) If extraScore[sei] = 0 Then 'If the bottom on is zero extraCount = extraCount - 1 'Bring the bottom up by one EndIf EndFor EndSub '--- LoadHighScore ------------------------------------------------------------------------------------ '--- Load high score from file. If no file present, go with codingCat's high scores. '--- The scores are read into an array all at once before processing to minimise the number '--- of read commands making it easier to enable the system after importing. '----------------------------------------------------------------------------------------------------------- Sub LoadHighScore filename = Program.Directory + "\MeteorShowerScores.txt" readend = 31 For ih = 1 To readend readArray[ih] = "" 'needed to avoid error caused by autocomment of following line ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' readArray[ih] = File.ReadLine(filename,ih) If ih = 31 And readArray[ih] <> "" Then readend = readArray[ih] + 21 EndIf EndFor highname[1] = readArray[1] 'Load the first entry, name, score and level (meteor count) highscore[1] = readArray[2] highlevel[1] = readArray[3] extraScore[1] = highscore[1] 'track as part of infinite leader board If highscore[1] <= 0 Or highlevel[1] <=0 Then 'File was empty? Gotta beat codingCat for the top spot :-) highname[1] = "cC" 'cC's high score highscore[1] = 29599294023 highlevel[1] = 46 For ih = 2 To 10 'Fill in zeros for the rest of the top 10 highname[ih] = "cC" highscore[ih] = 0 extraScore[ih] = 0 highlevel[ih] = 0 EndFor extraCount = 10 Else 'File not empty? Load the remaining 9 of top 10 For ih = 2 To 10 highname[ih] = readArray[((ih-1)*3)+1] highscore[ih] = readArray[((ih-1)*3)+2] extraScore[ih] = highscore[ih] highlevel[ih] = readArray[((ih-1)*3)+3] EndFor extraCount = readArray[31] 'After the top ten, entires are just scores for the infinite leader board For ih = 11 To extraCount extraScore[ih] = readArray[31 - 10 + ih] EndFor EndIf EndSub '--- 'UpdateHighScore --------------------------------------------------------------------------------- '--- Update the highscore file '--- If the current score beats the best (better than position 10), update the high score file '--- The scores are compiled in an array before writing to the file all at once to minimize '--- the number of write commands making it easier to enable the system after importing. '----------------------------------------------------------------------------------------------------------- Sub UpdateHighScore If score > highscore[10] Then 'New to the to 10 list? highname[10] = initials 'Push the current position 10 off the list highscore[10] = score highlevel[10] = meteorCount SortScores() 'Sort the top 10 EndIf UpdateExtraScores() 'Update the infinite list - Sorting and dropping duplicates filename = Program.Directory + "\MeteorShowerScores.txt" FlashBackGroundOnce() For ih = 0 To 9 'top 10 first writeArray[(ih*3) + 1] = highname[ih+1] writeArray[(ih*3) + 2] = highscore[ih+1] writeArray[(ih*3) + 3] = highlevel[ih+1] endfor writeArray[31] = extraCount For ih = 11 To extraCount + 10 'Everyone else, infinite leader board writeArray[31 - 10 + ih] = extraScore[ih] WriteArrayLength = 31 - 10 + ih EndFor For ih = 1 To WriteArrayLength updateHSCount = updateHSCount + 1 If math.Remainder(multiplierCount, 5) = 0 Then FlashBackGroundOnce() 'Flash the background periodically to make sure the screen doesn't freeze endif ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(filename,ih,writeArray[ih]) EndFor EndSub '--- InitialsEntryBuild --------------------------------------------------------------------------------- '--- Set up and hide the shapes to be used in the initial entry process '----------------------------------------------------------------------------------------------------------- Sub InitialsEntryBuild initials = "" curWid = 50 curHei = 65 promptx = (GraphicsWindow.Width / 2) + (((curWid + 5) * 1) / 2) prompty = (GraphicsWindow.Height / 2) - 30 'Titles first. Inlcuding white shaddows fontnameHold = GraphicsWindow.FontName fontsizeHold = GraphicsWindow.FontSize fontboldHold = GraphicsWindow.FontBold fontitalicHold = GraphicsWindow.FontItalic GraphicsWindow.FontName = "Tahoma" GraphicsWindow.FontBold = "false" clClr = "white" 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 20 GraphicsWindow.FontItalic = "true" titleinitials1 = Shapes.AddText("You Scored in the Top 10!") GraphicsWindow.FontSize = 20 GraphicsWindow.FontItalic = "False" titleinitials2 = Shapes.AddText("Enter initials for the") GraphicsWindow.FontSize = 30 titleinitials3 = Shapes.AddText("Leader Board") Shapes.Move(titleinitials1, 50, prompty - 25) Shapes.HideShape(titleinitials1) Shapes.Move(titleinitials2, 50, prompty + 15) Shapes.HideShape(titleinitials2) Shapes.Move(titleinitials3, 50, prompty + 40) Shapes.HideShape(titleinitials3) 'Cursor flashes betwee three colors cclrnam[1] = "cyan" cclrnam[2] = "magenta" cclrnam[3] = "yellow" For cci = 1 To Array.GetItemCount(cclrnam) clClr = cclrnam[cci] 'Set background to brush color to hide shape creation ClearColor() GraphicsWindow.PenColor = cclrnam[cci] GraphicsWindow.BrushColor = cclrnam[cci] cursor[cci] = Shapes.AddRectangle(curWid,curHei) Shapes.HideShape(cursor[cci]) EndFor GraphicsWindow.FontName = fontnameHold GraphicsWindow.FontSize = fontsizeHold GraphicsWindow.FontBold = fontboldHold GraphicsWindow.FontItalic = fontitalicHold EndSub '--- initialEntryShow ---------------------------------------------------------------------------------- '--- Show (unhide) the inital entry shapes. This is done at the start of the entry process '----------------------------------------------------------------------------------------------------------- Sub initialEntryShow curcnt = Array.GetItemCount(cursor) Shapes.ShowShape(titleinitials1) Shapes.ShowShape(titleinitials2) Shapes.ShowShape(titleinitials3) cur = 1 pressed = "False" pos = 0 InitEntry = "true" EnterHighScore = "True" initials = "" EndSub '--- InitialEntryHide ---------------------------------------------------------------------------------- '--- When the initial entry process is complete, hide the shapes used in the process '----------------------------------------------------------------------------------------------------------- sub InitialEntryHide GraphicsWindow.BrushColor = "black" For ii = 1 To Text.GetLength(initials) GraphicsWindow.FillRectangle(promptx + ((curWid + 5) * (pos-ii)),prompty+5,curWid,curHei) EndFor For ii = 1 To curcnt Shapes.HideShape(cursor[ii]) EndFor Shapes.HideShape(titleinitials1) Shapes.HideShape(titleinitials2) Shapes.HideShape(titleinitials3) endsub '--- EnterInitials --------------------------------------------------------------------------------------- '--- Prompt for initials when a high score has been earned. This routine handles a single '--- step in the process. The loop is handled elsewhere. '----------------------------------------------------------------------------------------------------------- Sub EnterInitials If keyPressed = "True" Then If key = "Return" then 'Finished if enter pressed InitEntry = "False" EndIf If key = "Space" then 'Process the space bar key = " " endif If Text.GetLength(key) = 2 and Text.GetSubText(key,1,1) = "D" then 'Convert D keys to normal key = Text.GetSubTextToEnd(key,2) endif If (key = "Back" Or key = "Left") and pos > 0 then 'Backing up for backspace or left GraphicsWindow.BrushColor = "black" GraphicsWindow.FillRectangle(promptx + ((curWid + 5) * (pos-1)),prompty+5,curWid,curHei) initials = Text.GetSubText(initials,1,Text.GetLength(initials)-1) pos = pos - 1 ElseIf pos < 3 then 'Room for more characters? If Text.GetLength(key) = 1 then keycode = Text.GetCharacterCode(key) 'Ascii code for the key If keycode >= 97 And keycode <= 122 then 'convert upper to lower case keycode = keycode - 32 EndIf If keycode = 32 or (keycode >= 65 and keycode <= 90) or (keycode >= 48 and keycode < 57) then 'Numbers or letters? key = Text.GetCharacter(keycode) 'draw it with a background initials = initials + key fontnameHold = GraphicsWindow.FontName fontsizeHold = GraphicsWindow.FontSize fontboldHold = GraphicsWindow.FontBold fontitalicHold = GraphicsWindow.FontItalic GraphicsWindow.FontName = "Courier New" GraphicsWindow.FontBold = "True" GraphicsWindow.FontItalic = "False" GraphicsWindow.FontSize = 70 GraphicsWindow.BrushColor = "darkgray" GraphicsWindow.DrawText(promptx + (((curWid + 5) * pos+1)) + 2 + 2,prompty + 2,key) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(promptx + (((curWid + 5) * pos+1)) + 2,prompty,key) GraphicsWindow.FontName = fontnameHold GraphicsWindow.FontSize = fontsizeHold GraphicsWindow.FontBold = fontboldHold GraphicsWindow.FontItalic = fontitalicHold pos = pos + 1 endif EndIf endif keyPressed = "False" EndIf If Math.Remainder(paceMessage,5) = 0 Then 'Only do this every fifth time through Shapes.HideShape(cursor[cur]) 'Change cursors (flashing) cur = cur + 1 If cur > curcnt Then cur = 1 EndIf Shapes.Move(cursor[cur],promptx + ((curWid + 5) * pos),prompty+5) Shapes.ShowShape(cursor[cur]) EndIf endsub 'Event Subroutines ------------------------------------------------------------------------------------ '--- 'OnKeyDown --------------------------------------------------------------------------------------- '--- Take note of the fact that a key has been pressed. This event is '--- needed because the GraphicsWindow.lastkey property never '--- clears. Making otherwise impossible to distinguish between '--- multiple presses of the same key '----------------------------------------------------------------------------------------------------------- Sub OnKeyDown pressed = "True" EndSub End>VBN835.sb< Start>VBP237.sb< '**************************************************************** 'TIC TAC TOE - colours and design by my kids '**************************************************************** '**************************************************************** ' Some basic initialisation '**************************************************************** 'Create window gw = 600 gh = gw 'A square window is good for this GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Tic-Tac-Toe" GraphicsWindow.Left = (Desktop.Width-gw)/2 'Centre window in screen GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.BackgroundColor = "Blue" GraphicsWindow.PenWidth = 4 GraphicsWindow.FontName = "Courier New" 'Fixed width font to make centering it easier textsize = 70 GraphicsWindow.FontSize = textsize GraphicsWindow.FontBold = "True" 'Zero scores Score[0] = 0 'Draws Score[1] = 0 'Human Wins Score[2] = 0 'Computer Wins gridSize = gw/3 '1/3 of window width for each square radius = 30 'Coin radius animateTime = 1000 'Coin animation time (ms) - Game play speed 'Start mouse and key click events GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.KeyDown = OnKeyDown '**************************************************************** ' Main Play Code '**************************************************************** While ("True") Initialise() 'New game setup PlayGame() 'Play a game Program.Delay(500+5*animateTime) 'Delay then start again EndWhile '**************************************************************** ' Subroutines '**************************************************************** Sub Initialise 'Initialise variables gamePlaying = "True" 'Flag that game is not ended (i.e. still playing) 'Randomly set starting player iPlayer = Math.GetRandomNumber(2) '1 for human and 2 for computer 'Reset grid variables (effectively delete them) grid = "" coins = "" 'Setup screen GraphicsWindow.Clear() GraphicsWindow.BrushColor = "DeepPink" If (iPlayer = 1) Then textOutput = "Human" ElseIf (iPlayer = 2) Then textOutput = "Computer" EndIf GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,0,textOutput) textOutput = "to play first" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,60,textOutput) textOutput = "Set computer" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,150,textOutput) textOutput = "skill level" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,210,textOutput) textOutput = "1(very easy)" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,300,textOutput) textOutput = "2(easy)" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,360,textOutput) textOutput = "3(medium)" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,420,textOutput) textOutput = "4(hard)" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,480,textOutput) 'Skill level for computer player (1-easy to 4-hard) iSkill = 0 While (iSkill = 0) Program.Delay(100) 'Wait for key to be pressed or mouse click and set skill level to start EndWhile Sound.PlayClickAndWait() 'Game grid screen GraphicsWindow.Clear() 'Draw the grid GraphicsWindow.PenColor = "Orange" For i = 1 To 2 GraphicsWindow.DrawLine(0,i*gridSize,gw,i*gridSize) 'Horizontal GraphicsWindow.DrawLine(i*gridSize,0,i*gridSize,gh) 'Vertical EndFor GraphicsWindow.PenColor = "Black" EndSub Sub PlayGame While (gamePlaying) 'Continue playing until game ends If (iPlayer = 1) Then 'Player move - only accept a click that that has not already been processed in an empty square If (iClick And grid[iGrid][jGrid] = "") Then 'player has clicked an empty square grid[iGrid][jGrid] = "X" DrawMove() 'Reset click and set iPlayer for computer to move iClick = "False" iPlayer = 2 EndIf Else 'Computer move If (iSkill > 1) Then 'Winning move check For iGrid = 1 To 3 For jGrid = 1 To 3 If (grid[iGrid][jGrid] = "") Then 'computer has clicked an empty square grid[iGrid][jGrid] = "O" CheckWinner() If (Winner > 0) then ' We have found a winning position Goto finished Else ' look for next possible winner - reset this square as empty grid[iGrid][jGrid] = "" EndIf EndIf EndFor EndFor EndIf If (iSkill > 2) Then 'Blocking move check For iGrid = 1 To 3 For jGrid = 1 To 3 If (grid[iGrid][jGrid] = "") Then 'computer has clicked an empty square grid[iGrid][jGrid] = "X" CheckWinner() If (Winner > 0) then ' We have found a blocking position - the human would win in this square - so put the computer go here grid[iGrid][jGrid] = "O" Goto finished Else ' look for next possible block grid[iGrid][jGrid] = "" EndIf EndIf EndFor EndFor EndIf 'To make the computer better always choose the centre, then corner squares if available If (iSkill > 3) then iGrid = 2 jGrid = 2 If (grid[iGrid][jGrid] = "") Then 'computer has clicked empty centre square grid[iGrid][jGrid] = "O" Goto finished EndIf For iGrid = 1 To 3 Step 2 For jGrid = 1 To 3 Step 2 If (grid[iGrid][jGrid] = "") Then 'computer has clicked empty corner square grid[iGrid][jGrid] = "O" Goto finished EndIf EndFor EndFor EndIf 'Random move - only if we haven't already found a square While ("True") iGrid = Math.GetRandomNumber(3) jGrid = Math.GetRandomNumber(3) If (grid[iGrid][jGrid] = "") Then 'computer has clicked an empty square grid[iGrid][jGrid] = "O" Goto finished EndIf EndWhile 'We have found a place for the computer to go finished: 'Draw computer move DrawMove() 'Human player to move next iPlayer = 1 EndIf 'Check for winner or a draw CheckWinner() 'Winner found If (Winner = 1) Then ' Human player win textOutput = "You win" gamePlaying = "False" ElseIf (Winner = 2) Then 'Computer player win textOutput = "You lose ha ha" gamePlaying = "False" Else 'Check for a tie gamePlaying = "False" For i = 1 To 3 For j = 1 To 3 If (grid[i][j] = "") Then gamePlaying = "True" 'An empty square means the game is still going and therefore not a tie EndIf EndFor EndFor If (gamePlaying = "False") Then 'gamePlaying still false means all squares have been taken and the game is a draw textOutput = "Draw" EndIf EndIf EndWhile 'Game ended - Transparent coins so scores are visible For i = 1 To 3 For j = 1 To 3 Shapes.SetOpacity(coins[i][j],20) EndFor EndFor 'Output finishing text GraphicsWindow.BrushColor = "DeepPink" GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,0,textOutput) 'Attempt to centralise text a bit 'Keep score Winner = 1 (Human) 2(Computer) 0(Draw) Score[Winner] = Score[Winner]+1 textOutput = "Won "+Score[1] GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,200,textOutput) textOutput = "Lost "+Score[2] GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,260,textOutput) textOutput = "Drawn "+Score[0] GraphicsWindow.DrawText((gw-Text.GetLength(textOutput)*textsize*0.6)/2,320,textOutput) EndSub Sub DrawMove 'x and y are the centre of square x = (iGrid-0.5)*gridSize y = (jGrid-0.5)*gridSize 'Set colour according to player If (iPlayer = 1) Then GraphicsWindow.BrushColor = "SpringGreen" Else GraphicsWindow.BrushColor = "Yellow" EndIf 'Add a circle and position it randomly off screen coins[iGrid][jGrid] = Shapes.AddEllipse(2*radius,2*radius) angle = 0.001*Math.GetRandomNumber(1000)*2*Math.Pi Shapes.Move(coins[iGrid][jGrid],gw*(0.5+Math.Cos(angle)),gh*(0.5+Math.Sin(angle))) 'Animate player coin to grid position Shapes.Animate(coins[iGrid][jGrid],x-radius,y-radius,animateTime) Sound.PlayClick() 'Play a click with each move Program.Delay(animateTime) 'Wait for animation to finish EndSub Sub CheckWinner 'If Winner is set to 1 then the human player is the winner, if it is 2 then the winner is the computer 'If Winner remains 0, then no winner is found - we check for a draw inside Sub PlayGame after each move Winner = 0 'Horizontal For i = 1 To 3 If (grid[i][1] = "X" And grid[i][2] = "X" And grid[i][3] = "X") Then Winner = 1 EndIf If (grid[i][1] = "O" And grid[i][2] = "O" And grid[i][3] = "O") Then Winner = 2 EndIf EndFor 'Vertical For i = 1 To 3 If (grid[1][i] = "X" And grid[2][i] = "X" And grid[3][i] = "X") Then Winner = 1 EndIf If (grid[1][i] = "O" And grid[2][i] = "O" And grid[3][i] = "O") Then Winner = 2 EndIf EndFor 'Diagonal If (grid[1][1] = "X" And grid[2][2] = "X" And grid[3][3] = "X") Then Winner = 1 EndIf If (grid[1][1] = "O" And grid[2][2] = "O" And grid[3][3] = "O") Then Winner = 2 EndIf If (grid[1][3] = "X" And grid[2][2] = "X" And grid[3][1] = "X") Then Winner = 1 EndIf If (grid[1][3] = "O" And grid[2][2] = "O" And grid[3][1] = "O") Then Winner = 2 EndIf EndSub '**************************************************************** ' Events '**************************************************************** Sub OnMouseDown 'Mouse coordinates xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY If (iSkill = 0) Then 'Set skill level with mouse click over text iSkill = 1 + Math.Floor((yM-300)/60) If (iSkill < 1 Or iSkill > 4) Then iSkill = 0 EndIf Else 'Grid cell clicked iGrid = 1 + Math.Floor(xM/gridSize) jGrid = 1 + Math.Floor(yM/gridSize) 'Flag that a click has been made - this flag will be checked for and reset after the player move is made (so it is only made once) iClick = "True" EndIf EndSub Sub OnKeyDown key = GraphicsWindow.LastKey If (key = "D1") Then iSkill = 1 ElseIf (key = "D2") Then iSkill = 2 ElseIf (key = "D3") Then iSkill = 3 ElseIf (key = "D4") Then iSkill = 4 EndIf EndSub End>VBP237.sb< Start>VBQ274.sb< GraphicsWindow.Width=1600 GraphicsWindow.Height=900 GraphicsWindow.Top =10 GraphicsWindow.Left=10 GraphicsWindow.Title ="3D Objects Lab GraphicsWindow.BackgroundColor="teal view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"#77aaaaaa",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 .5) sl=LD3DView.AddspotLight(view3D,"white",5,25, 5 ,-1 ,-1 ,-1 90 150) LD3DView.AddAmbientLight(view3D,"#77555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") ii[1]=ImageList.LoadImage ("e:\sttne.jpg")'<-------------------put ur image of stone path here ii[7]=ImageList.LoadImage ("e:\leaf2.jpg") ii[5]=ImageList.LoadImage ("e:\soil.jpg") ii[3]=ImageList.LoadImage ("e:\grass.jpg") ii[6]=ImageList.LoadImage ("e:\water.jpg") ii[2]=ImageList.LoadImage ("e:\wood.jpg") ii[4]=ImageList.LoadImage ("e:\leaves.jpg") args=0 Sub addtree2 dx=args[1] dy=args[2] ss=LD3DView.AddCone (view3D 20 15 20 50 "white" "D") LD3DView.AddImage (view3D ss "" ii[7] "D") LD3DView.TranslateGeometry (view3D ss dx 20 dy) ss= LD3DView.AddCone (view3D 12 12 20 30 "white" "D") LD3DView.TranslateGeometry (view3D ss dx 0 dy) LD3DView.AddImage (view3D ss "" ii[1] "D") EndSub Sub pllw For y= 0 to 4 For x=0 to 6 cc=LD3DView.AddCube (view3D 10 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*10+args[1], -5, -15+y*10+args[2]) LD3DView.AddImage (view3D cc "" ii[4] "D") endfor endfor EndSub LDCall.Function2("addtree2" 0 0 ) cc=LD3DView.AddCube (view3D 40 "beige" "D") LD3DView.TranslateGeometry (view3D cc 0, -20 0) LD3DView.AddImage (view3D cc "" ii[2] "D") LDCall.Function2("addtree2" 190 0 ) cc=LD3DView.AddCube (view3D 40 "beige" "D") LD3DView.TranslateGeometry (view3D cc 190, -20 0) LD3DView.AddImage (view3D cc "" ii[2] "D") For z=0 to 1 For y= 0 to 20 For x=0 to 14 cc=LD3DView.AddCube (view3D 10 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*10, -35+z*10, -15+y*10) LD3DView.AddImage (view3D cc "" ii[2] "D") endfor endfor endfor For y= 0 to 20 For x=0 to 14 cc=LD3DView.AddCube (view3D 10 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*10, -15, -15+y*10) LD3DView.AddImage (view3D cc "" ii[7] "D") endfor endfor LDCall.Function2 ("pllw" 5 5) LDCall.Function2 ("pllw" 77 5) f5=45 LDEvents.MouseWheel=mww ya=51 r35=195 While "true For aa=0 To 360 Step .5 px= LDMath.Cos(aa) py= LDMath.sin (aa) 'GraphicsWindow.Title =GraphicsWindow.LastKey If text.IsSubText ("Space Back LeftCtrl LeftShift" GraphicsWindow.LastKey) Then aa=aa-.5 else LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndIf Program.Delay (22) EndFor EndWhile Sub mww If GraphicsWindow.LastKey ="Back" then r35=r35+ LDEvents.LastMouseWheelDelta*3 Else ya=ya+ LDEvents.LastMouseWheelDelta*3 EndIf 'GraphicsWindow.Title =ll endsub End>VBQ274.sb< Start>VBQ867.sb< ' program : yvan leduc ' avatar generator V1.34 ' program no: VVZ054-0 ' August 2th, 2016 ' August challenge proposed by Nonki Takahashi ' Small Basic MSDN Forum ' program no ' Not = "True=False;False=True;" GraphicsWindow.BackgroundColor="white" GraphicsWindow.Width=400 GraphicsWindow.height=400 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.KeyDown = OnKeyDown While "True" GraphicsWindow.Clear() x=1 y=1 f1=math.GetRandomNumber(60)+10 h1=math.GetRandomNumber(100)+300 h2=math.GetRandomNumber(100)+300 For x= 1 To 400 Step f1 a=math.GetRandomNumber(50) b=math.GetRandomNumber(45) c=math.GetRandomNumber(30) d=math.GetRandomNumber(10) c1=math.GetRandomNumber(255)+a c2=math.GetRandomNumber(255)-b c3=math.GetRandomNumber(255)+c color=GraphicsWindow.GetColorFromRGB(c1,c2,c3) f2=math.GetRandomNumber(60)+10 For y= 400 To 1 Step -f2 ' random colors, random circles, random triangle, random size, GraphicsWindow.BrushColor=color GraphicsWindow.DrawTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.FillTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.DrawTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.FillTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.DrawRectangle(b+x,a+y,b+x,d+y) GraphicsWindow.Fillrectangle(b+x,a+y,b+x,d+y) GraphicsWindow.DrawEllipse(b*d,d*a,c1,c2) GraphicsWindow.fillEllipse(b*d,d*a,c1,c2) GraphicsWindow.DrawTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.FillTriangle(c+x,b+y,d+x,c+y,b+x,c+y) EndFor endfor keyDown = "False" While Not[keyDown] Program.Delay(200) EndWhile EndWhile Sub OnKeyDown keyDown = "True" EndSub End>VBQ867.sb< Start>VBW773.sb< args=0 rcc="false GraphicsWindow.Height=600 Sub Br_line x0=args[1] y0=args[2] x1=args[3] y1=args[4] dx = math.Abs(x1 - x0) dy = math.Abs(y1 - y0) sx = -1 If x0 < x1 Then sx=1 EndIf sy =-1 If y0 < y1 Then sy=1 EndIf er =-math.Floor(dy/2) If dx > dy Then er=math.Floor( dx/2) EndIf While 1=1 GraphicsWindow.SetPixel(x0 y0 cllr) If (x0 = x1) And (y0 = y1) Then Goto xxx EndIf e2 = er If e2 > -dx Then Er = er-dy x0 = x0+sx EndIf If e2 < dy Then Er = er+dx y0 = y0+sy EndIf EndWhile xxx: EndSub Sub bezierquad' Bitmap/Bézier curves/Quadratic entry aa=LDText.Split(args[1] ":") bb=LDText.Split(args[2] ":") cc=LDText.Split(args[3] ":") x1=aa[1] y1=aa[2] x2=bb[1] y2=bb[2] x3=cc[1] y3=cc[2] n=args[4] For i = 0 To n t = i / n t1 = 1 - t a = t1 *t1 b = t * t1 * 2 c = t *t p[i][1] = math.Floor(a * x1 + b * x2 + c * x3 + .5) p[i][2] = math.Floor(a * y1 + b * y2 + c * y3 + .5) EndFor For i = 0 To n -1 ldcall.Function4("Br_line" p[i][1], p[i][2], p[i +1][1], p[i +1][2]) EndFor EndSub GraphicsWindow.BackgroundColor="teal While 1=1 For r200=50 To 250 Step 2 cllr=LDColours.HSLtoRGB(ccc 1 .5) ccc=math.Remainder(ccc+3 360) For rrr=0 To 360 Step 60 x1=LDMath.Cos(rrr+ccc/2)*r200+300 y1=LDMath.Sin(rrr+ccc/2)*r200+300 x2=LDMath.Cos(rrr+60+ccc/2)*r200+300 y2=LDMath.Sin(rrr+60+ccc/2)*r200+300 ldcall.Function4 ("bezierquad" x1+":"+y1 "300:300" x2+":"+y2 15 ) EndFor Program.Delay(22) ' GraphicsWindow.Clear() EndFor EndWhile End>VBW773.sb< Start>VBZ080.sb< rss: ss=0 GraphicsWindow.Title = "Balloons" Init() oo=Math.GetRandomNumber(150) For i = 1 To n GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() AddBalloon() x = i*40 y = LDMath.Sin(i*30+oo)*60+550 MoveBalloon() EndFor GraphicsWindow.MouseDown = OnMouseDown Timer.Interval = dt * 200 Timer.Tick = OnTick LDShapes.ShapeEvent=see sub see ls=LDShapes.LastEventShape if LDShapes.LastEventType="MouseDown" Then Shapes.Remove(ls) nm=Text.GetSubTextToEnd(ls 8) Shapes.Remove("Line"+nm) ss=ss+5 GraphicsWindow.Title="Score: "+ss EndIf EndSub Sub AddBalloon GraphicsWindow.PenWidth = 0 e[i] = Shapes.AddEllipse(ew, eh) LDShapes.SetShapeEvent(e[i]) LDEffect.DropShadow(e[i] "color=darkblue") GraphicsWindow.PenWidth = 2 t[i] = Shapes.AddLine(0 0 0 eh*2) v[i] = 0 a[i] = 0 EndSub Sub CheckBalloonClick balloonClicked = 0 For i = n To 1 Step -1 If ex[i] <= mx And mx <= ex[i] + ew And ey[i] <= my And my <= ey[i] + eh Then balloonClicked = i i = 1 ' exit For ElseIf tx[i] <= mx And mx <= tx[i] + tw And ty[i] <= my And my <= ty[i] + th Then balloonClicked = i i = 1 ' exit For EndIf EndFor EndSub Sub MoveBalloon ex[i] = x - ew / 2 ey[i] = y - eh / 2 Shapes.Move(e[i], ex[i], ey[i]) tx[i] = x ty[i] = y + eh/2 Shapes.Move(t[i], tx[i], ty[i]) EndSub Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY mouseDown = "True" EndSub while 1=1'--------------------------main loop---------- Program.Delay(2) if rrr Then rrr="false Timer.Pause() GraphicsWindow.Clear() GraphicsWindow.ShowMessage("Score: "+ss "Game Over") goto rss EndIf EndWhile'---------------------------------------------- Sub OnTick For _i = 1 To n _v = v[_i] v[_i] = _v + g * dt ey[_i] = ey[_i] - (_v + v[_i]) * dt / 2 if ey[_i]<-400 Then rrr="true EndIf Shapes.Move(e[_i], ex[_i], ey[_i]) ty[_i] = ty[_i] - (_v + v[_i]) * dt / 2 Shapes.Move(t[_i], tx[_i], ty[_i]) EndFor EndSub Sub Init gw = 800 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh LDUtilities.FixFlickr() ii=ImageList.LoadImage(Flickr.GetRandomPicture("clouds")) LDImage.EffectBlue(ii) LDImage.EffectLightness(ii 3) LDGraphicsWindow.BackgroundImage(ii) ew = 70 eh = 90 sqr2 = Math.SquareRoot(2) tw = ew / sqr2 th = eh / sqr2 / 2 n = 20 dt = 0.2 ' sec g = 3 ' px/sec^2 v0 = -20 ' px/sec EndSub End>VBZ080.sb< Start>VCB965.sb< 'go to line 1300 'High score: lvl 10 in 22 days TextWindow.WriteLine("What is your First name?") ddd=TextWIndow.Read() TextWindow.WriteLine("What is your Last name?") yyy=TextWIndow.Read() 'make a sell feature' 'levels and xp' While (1000000<>x) mainmenu: p=1 d=d+p lolman: TextWindow.ForegroundColor="cyan" 'You can use a subroutine to change the value of a variable you declared early in the program to a specific or random variable under certain conditions. TextWindow.ForegroundColor="green" TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Day:"+d) TextWindow.WriteLine("Today is: " + Clock.Date + ".") TextWindow.WriteLine("The current time is: " + Clock.Time + ".") TextWindow.WriteLine("The current day of the week is: " + Clock.Weekday + ".") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" This is a Card Fighting RPG") TextWindow.WriteLine("you will choose a card and then fight other cards of other elements") TextWindow.WriteLine("This is the MainMenu") TextWindow.ForegroundColor="lime" TextWindow.WriteLine(" P.S answer without Capitals User:"+ddd+" "+ yyy ) TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" Options") TextWindow.ForegroundColor="red" TextWindow.WriteLine("Plz Read This (Help)") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(Battle) Wins "+ win) TextWindow.WriteLine("(Cards) Loses "+ lose) TextWindow.WriteLine("(Leader boards) Jobs "+ jobs) TextWindow.WriteLine("(player stats) Total Damage "+ damage) TextWindow.ForegroundColor="green" TextWindow.WriteLine(" Money:"+m+" Total Money Earned "+ moneymade) TextWindow.WriteLine("exp:"+exp2+"/"+eexp) TextWindow.WriteLine("LvL:"+a) TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(Job)") TextWindow.ForegroundColor="red" TextWindow.WriteLine("(challenges)") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(trophies)") TextWindow.WriteLine("(special store items)") TextWindow.WriteLine("(store)") TextWindow.WriteLine("(Special store)") 'TextWindow.WriteLine(" (travel)") 'TextWindow.WriteLine(" (sell)") x=TextWindow.Read() If(x="cards")then Goto cards ElseIf(x="battle")then Goto battle2 ElseIf(x="job")then Goto job ElseIf(x="store")then Goto store ElseIf(x="trophies")then Goto trophies ElseIf(x="cheat")then Goto cheat ElseIf(x="cheat2")then Goto cheat2 ElseIf(x="exp")then Goto exp13 ElseIf(x="travel")then Goto travel ElseIf(x="help")then Goto help ElseIf(x="leader boards")then Goto leaderboards ElseIf(x="special store")then Goto specialstore ElseIf(x="special store items")then Goto specialstoreitems ElseIf(x="sell")then Goto sell ElseIf(x="challenges")then Goto challenges ElseIf(x="")then Goto lolman 'ElseIf(x="player stats" or x="playerstats")then ' Goto stats startz: v=Math.GetRandomNumber (50)+50 exp=Math.GetRandomNumber(50)+50 avf=1 lose=lose+avf moneymade=moneymade+v m=m+v TextWindow.WriteLine("You received $"+ v) exp2=exp2+exp TextWindow.WriteLine("You received "+exp+" exp") TextWindow.WriteLine(" ") TextWindow.WriteLine("Wow what a battle!") space: TextWindow.WriteLine("Press ((Space)) once then (enter)") x=TextWindow.Read() If(x=" ")then Goto exp13 ElseIf(x<>" ")then Goto space startzz: v=Math.GetRandomNumber (100)+ 100 exp=Math.GetRandomNumber(100) +100 fva=1 win=win+fva moneymade=moneymade+v m=m+v TextWindow.WriteLine("You received $"+ v) exp2=exp2+exp TextWindow.WriteLine("You received "+exp+" exp") TextWindow.WriteLine(" ") TextWindow.WriteLine("Wow what a battle!") space2: TextWindow.WriteLine("Press ((Space)) once then(enter)") x=TextWindow.Read() If(x=" ")then Goto exp13 ElseIf(x<>" ")then Goto space2 battle2: TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Which card would you like to battle with?") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" (1) Fire") TextWindow.WriteLine(" (2) Ice") TextWindow.WriteLine(" (3) Earth") TextWindow.WriteLine(" (4) Lightning") TextWindow.ForegroundColor="OrangeRed" TextWindow.WriteLine(" (5) Lava") TextWindow.ForegroundColor="BlueViolet" TextWindow.WriteLine(" (6) Darkness") TextWindow.ForegroundColor="SkyBlue" TextWindow.WriteLine(" (7) Steel") TextWindow.ForegroundColor="Peru" TextWindow.WriteLine(" (8) Ground ") TextWindow.ForegroundColor="PowderBlue" TextWindow.WriteLine(" (9) Flying") TextWindow.ForegroundColor="DarkViolet" TextWindow.WriteLine(" (10) Dragon") TextWindow.ForegroundColor="Lime" TextWindow.WriteLine(" (11) Grass ") TextWindow.WriteLine(" (12) Ghost") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") x=TextWindow.Read() If(x=1) Then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You have chosen Fire") Goto lola ElseIf(x=2) then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You have chosen Ice") Goto lola ElseIf(x=3) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Earth") ElseIf(x=4) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Lightning") Goto lola ElseIf(x=5) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Lava") Goto lola ElseIf(x=6) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Darkness") Goto lola ElseIf(x=7) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Steel") Goto lola ElseIf(x=8) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen ground") Goto lola ElseIf(x=9) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Flying") Goto lola ElseIf(x=10) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Dragon") Goto lola ElseIf(x=11) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Grass") Goto lola ElseIf(x=12) then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Ghost") Goto lola lola: TextWindow.ForegroundColor="yellow" TextWindow.WriteLine("((start)) when ready)") TextWindow.ForegroundColor="cyan" x=TextWindow.Read() If(x="start")then y=Math.GetRandomNumber (1200) If(y>0 And y<100)then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You will be fighting a (Fire) card") Goto starta ElseIf(y>101 And y<200)then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You will be fighting an (Ice) card") Goto starta ElseIf(y>201 And y<300)then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You will be fighting an (earth) card") Goto starta ElseIf(y>301 And y<400)then TextWindow.ForegroundColor="yellow" TextWindow.WriteLine("You will be fighting a (Lighting) card") Goto starta ElseIf(y>401 And y<500)then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You will be fighting an (Lava) card") Goto starta ElseIf(y>501 And y<600)then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You will be fighting an (Darkness) card") Goto starta ElseIf(y>601 And y<700)then TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("You will be fighting an (Steel) card") Goto starta ElseIf(y>701 And y<800)then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You will be fighting an (Ground) card") Goto starta ElseIf(y>801 And y<900)then TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("You will be fighting an (Flying) card") Goto starta ElseIf(y>901 And y<1000)then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You will be fighting an (Dragon) card") Goto starta ElseIf(y>1001 And y<1100)then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You will be fighting an (Grass) card") Goto starta ElseIf(y>1101 And y<1200)then TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("You will be fighting an (Ghost) card") Goto starta 'Fire card' starta: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("Attack,(10-20) Slash,(1-35) Bash,(5-25)") TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaaa ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaaa ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaaa aaaaa: l=h-r If (l=h-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaa startaa: u=100 r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=u-r If (p=u-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaab ElseIf(x=22)then r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaab ElseIf(x=33)then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaaab aaaab: w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaaa startaaa: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaabb ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaabb ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aaabb aaabb: l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaab startaab: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aabbb ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aabbb ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto aabbb aabbb: w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startabb startabb: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto abbbb ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto abbbb ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto abbbb abbbb: l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaac startaac: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbb ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbb ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbb bbbbb: w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startacc startacc: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbc ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbc ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbbc bbbbc: l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaad startaad: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbcc ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbcc ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbbcc bbbcc: w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startadd startadd: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbccc ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbccc ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bbccc bbccc: l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaae startaae: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(11)Attack, (22)Slash, (33)Bash") x=TextWindow.Read() If(x=11) then h=100 r=Math.GetRandomNumber (10) + 10 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bcccc ElseIf(x=22)then h=100 r=Math.GetRandomNumber (35) TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bcccc ElseIf(x=33)then h=100 r=Math.GetRandomNumber (25) +5 TextWindow.WriteLine("You did:"+r) damage=damage+r Goto bcccc bcccc: w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaee startaee: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz cards: TextWindow.WriteLine("1(Fire) 2(Ice) 3(Earth)") x=TextWindow.Read() If(x=1) Then Goto gh ElseIf(x=2) then Goto hg ElseIf(x=3) then Goto hhg gh: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:80") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:5 KP/H") TextWindow.WriteLine("Evade 12%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:70") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:7 KP/H") TextWindow.WriteLine("Evade 10%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hhg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:110") TextWindow.WriteLine("MP:50") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:4 KP/H") TextWindow.WriteLine("Evade 9%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu job: TextWindow.WriteLine("What job would you like to take") TextWindow.WriteLine(" Options") TextWindow.WriteLine("Miner") TextWindow.WriteLine("Worker") TextWindow.WriteLine("Teacher") x=TextWindow.Read() If(x="miner")then Goto miner ElseIf(x="worker")then Goto worker ElseIf(x="teacher")then Goto teacher miner: TextWindow.WriteLine("You chose to be a miner") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("You just made $125") j=125 If(j=125)then vas=Math.GetRandomNumber(100) exp2=exp2+vas m=m+j jobs4=1 jobs=jobs+jobs4 moneymade=moneymade+j TextWindow.WriteLine("You got "+vas+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (enter)") x=TextWindow.Read() If(x="")then Goto exp13 worker: TextWindow.WriteLine("You chose to be a Office Worker") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("You just made $140") i=140 If(i=140)then fgr=Math.GetRandomNumber(100) exp2=exp2+fgr m=m+i jobs3=1 jobs=jobs+jobs3 moneymade=moneymade+i TextWindow.WriteLine("You got "+fgr+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (enter)") x=TextWindow.Read() If(x="")then Goto exp13 teacher: TextWindow.WriteLine("You chose to be a Teacher") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("You just made $150") o=150 If(o=150) then vfg=Math.GetRandomNumber(100) exp2=exp2+vfg m=m+o jobs2=1 jobs=jobs+jobs2 moneymade=moneymade+o TextWindow.WriteLine("You got "+vfg+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (enter)") x=TextWindow.Read() If(x="")then Goto exp13 store: TextWindow.WriteLine("Welcome to the General store") TextWindow.WriteLine("what would you like to buy?") TextWindow.WriteLine(" Options") TextWindow.WriteLine("(1) Golden trophy $1000") TextWindow.WriteLine("(2) Silver trophy $800") TextWindow.WriteLine("(3) Bronze trophy $500") x=TextWindow.Read() If(x=1 And m>=1000)then Goto golden ElseIf(x=1 And m<1000)then Goto goldena ElseIf(x=2 And m>=800)then Goto silver ElseIf(x=2 And m<800)then Goto silvera ElseIf(x=3 And m>=500)then Goto bronze ElseIf(x=3 And m<500)then Goto bronzea goldena: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silvera: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronzea: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu golden: TextWindow.WriteLine("You bought the Golden trophy") b=1 j2=j2+b m=m-1000 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silver: TextWindow.WriteLine("You bought the Silver trophy") p=1 a2=a2+p m=m-800 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronze: TextWindow.WriteLine("You bought the Bronze trophy") l=1 r2=r2+l m=m-500 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu trophies: TextWindow.WriteLine("Golden trophies:"+j2) TextWindow.WriteLine("") TextWindow.WriteLine("Silver trophies:"+a2) TextWindow.WriteLine("") TextWindow.WriteLine("Bronze trophies:"+r2) TextWindow.WriteLine("(Mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu exp13: If(exp2>0 And exp2<=80)then Goto exp100 ElseIf(exp2>80 And exp2<=150)then Goto exp200 ElseIf(exp2>150 And exp2<=280)then Goto exp300 ElseIf(exp2>280 And exp2<=400)then Goto exp400 ElseIf(exp2>400 And exp2<=540)then Goto exp500 ElseIf(exp2>540 And exp2<=700)then Goto exp600 ElseIf(exp2>700 And exp2<=900)then Goto exp700 ElseIf(exp2>900 And exp2<=1150)then Goto exp800 ElseIf(exp2>1150 And exp2<=1400)then Goto exp900 ElseIf(exp2>1400 And exp2<=1700)then Goto exp000 ElseIf(exp2>1700 And exp2<=2000)then Goto exp010 exp100: TextWindow.ForegroundColor="cyan" a=0 eexp=80 Goto mainmenu exp200: TextWindow.ForegroundColor="cyan" a=1 eexp=150 Goto mainmenu exp300: TextWindow.ForegroundColor="DeepPink" a=2 eexp=280 goto mainmenu exp400: TextWindow.ForegroundColor="DeepPink" a=3 eexp=400 Goto mainmenu exp500: TextWindow.ForegroundColor="DeepPink" a=4 eexp=540 Goto mainmenu exp600: TextWindow.ForegroundColor="yellow" a=5 eexp=700 Goto mainmenu exp700: TextWindow.ForegroundColor="yellow" a=6 eexp=900 Goto mainmenu exp800: TextWindow.ForegroundColor="yellow" a=7 eexp=1150 Goto mainmenu exp900: TextWindow.ForegroundColor="blue" a=8 eexp=1400 Goto mainmenu exp000: TextWindow.ForegroundColor="blue" a=9 eexp=1700 Goto mainmenu exp010: TextWindow.ForegroundColor="purple" a=10 eexp=2000 Goto mainmenu cheat: m=m+10000 moneymade=moneymade+10000 Goto mainmenu cheat2: exp2=exp2+200 Goto exp13 help: TextWindow.WriteLine("This is a multi purpose program") TextWindow.WriteLine("it is mainly about money and fighting") TextWindow.WriteLine(" Here are all the features") TextWindow.WriteLine("fighting for money and exp") TextWindow.WriteLine("an exp system, you can lvl up") TextWindow.WriteLine("a money system, you can gain money") TextWindow.WriteLine("you can spend money on different types of trophies") TextWindow.WriteLine(" there is a clock at the top of the main menu") TextWindow.WriteLine("their is also a day counter") TextWindow.WriteLine("you can check you cards stats in the cards section") TextWindow.WriteLine("you can get a job and you will be paid for you efforts") TextWindow.WriteLine("Their is a special store where you buy new items with trophies") TextWindow.WriteLine("(mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 Goto exp13 'stats: ' TextWindow.WriteLine("Welcome to Your Stats") 'TextWindow.WriteLine("You will receive (5) skill points every lvl") 'TextWindow.WriteLine(" Skills ") 'TextWindow.WriteLine("Strength:"+aaa) 'TextWindow.WriteLine("Stamina:"+bbb) 'TextWindow.WriteLine("Health:"+ccc) 'TextWindow.WriteLine("Mana:"+ddd) 'TextWindow.WriteLine("Agility:"+eee) gg=0 ff=0 leaderboards: TextWindow.WriteLine(" Leader Boards") TextWindow.WriteLine("Money: "+m) TextWindow.WriteLine("Exp: "+exp2) TextWindow.WriteLine("(mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu specialstore: TextWindow.WriteLine("Special Store") TextWindow.WriteLine("You can Buy special items with trophies") TextWindow.WriteLine(" You currently have ") TextWindow.WriteLine("Golden trophies:"+j2) TextWindow.WriteLine("") TextWindow.WriteLine("Silver trophies:"+a2) TextWindow.WriteLine("") TextWindow.WriteLine("Bronze trophies:"+r2) TextWindow.WriteLine("") TextWindow.WriteLine("Would you like to buy somthing from the special shop?") TextWindow.WriteLine("(yes) (No)") x=TextWindow.Read() If(x="yes")then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Special shop") TextWindow.WriteLine("Which one would you like to buy?") TextWindow.WriteLine("") TextWindow.WriteLine("(1) Golden necklace $2 Gold") TextWindow.WriteLine("(2) Hammer of Wrath $3 Silver") TextWindow.WriteLine("(3) Ak-47 $1 Gold, $ 1 Silver, $ 1 Bronze") TextWindow.WriteLine("(4) Mini-UZi $2 Silver, $1 Bronze") TextWindow.WriteLine("(5) Diamond $5 Bronze") x=TextWindow.Read() If(x=1 And j2>=2) then Goto gold Elseif(x=1 And j2<2)then Goto golda ElseIf(x=2 And a2>=3)then Goto hammer ElseIf(x=2 And a2<3)then Goto hammera ElseIf(x=3 And j2>=1 And a2>=1 And r2>=1)then Goto ak ElseIf(x=3 And j2<1 And a2<1 And r2<1)then Goto aka ElseIf(x=4 And a2>=2 And r2>=1)then Goto mini ElseIf(x=4 And a2<2 And r2<1)then Goto minia ElseIf(x=5 And r2>=5)then Goto diamond ElseIf(x=5 And r2<5)then Goto diamonda gold: vvvv=1 gg2=gg2+vvvv ccc=2 j2=j2-ccc TextWindow.WriteLine("You Bought a Gold Necklace") x=TextWindow.Read() Goto mainmenu golda: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu hammer: aaaa=1 hhh2=hhh2+aaaa ccc=3 a2=a2-ccc TextWindow.WriteLine("You Bought a Hammer of Wrath") x=TextWindow.Read() Goto mainmenu hammera: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu ak: kkkk=1 lll2=lll2+kkkk ccc=1 kkk=1 ppp=1 a2=a2-ccc j2=j2-kkk r2=r2-ppp TextWindow.WriteLine("You Bought an AK-47") x=TextWindow.Read() Goto mainmenu aka: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu mini: uuuu=1 pppp2=pppp2+uuuu zzz=2 yyy=1 a2=a2-zzz r2=r2-yyy TextWindow.WriteLine("You Bought a Mini-UZi") x=TextWindow.Read() Goto mainmenu minia: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu Goto mainmenu diamond: qqqq=1 rrrr2=rrrr2+qqqq eee=5 r2=r2-eee TextWindow.WriteLine("You Bought a Diamond") x=TextWindow.Read() Goto mainmenu diamonda: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu specialstoreitems: TextWindow.WriteLine(" Your special store items ") TextWindow.WriteLine(" Gold necklace: "+gg2) TextWindow.WriteLine(" Hammer of Wrath: "+hhh2) TextWindow.WriteLine(" AK-47: "+lll2) TextWindow.WriteLine(" Mini-UZI: "+pppp2) TextWindow.WriteLine(" Diamond: "+rrrr2) x=TextWindow.Read() Goto mainmenu If(items>0 And items<=500)then Goto itemsa ElseIf(items>500 And items<=700)then Goto itemsb ElseIf(items>700 And items<=1000)then Goto itemsc itemsa: itemsaa=itemsaa+items challenges: TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Here are your challenges") TextWindow.WriteLine("buy all items in the special store") TextWindow.WriteLine("") TextWindow.WriteLine("win 10 battles") TextWindow.WriteLine("") TextWindow.WriteLine("do 10 jobs") TextWindow.WriteLine("") TextWindow.WriteLine("get to lvl 10") TextWindow.WriteLine("") TextWindow.WriteLine("use all cards in battle") TextWindow.WriteLine("") TextWindow.WriteLine("Press Enter") x=TextWindow.Read() damage=damage+r sell: items=1 travel: itemsb: itemsc: EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndWhile End>VCB965.sb< Start>VCG879.sb< 'IM FOLGENDEM HABE ICH DEIN PROGRAMM ETWAS UMSTRUKTURIERT. DADURCH KANNST DU DAS WIEDERHOLEN VON CODE VERMEIDEN! 'WENN DU FRAGEN ETC. HAST, KANNST DU MIR GERNE EINE E-MAIL SCHICKEN: timo-soechtig@hotmail.de IO_ini() Grafikfenster() Ereigniss() Sub IO_ini c = LDIOWarrior.Initialise() a = LDIOWarrior.GetSerialNumber(1) b = LDIOWarrior.GetName(1) EndSub Sub Grafikfenster GraphicsWindow.Title = "1.Warriorprogramm" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(420,20,200,c + " Gerät angeschlossen") GraphicsWindow.DrawBoundText(10,20,200,"Seriennummer: " + a) GraphicsWindow.DrawBoundText(220,20,200,"Gerätename: " + b) GraphicsWindow.DrawBoundText(80,60,150,"Zeit in sek eingeben") Zeitbox = Controls.AddTextBox(80,80) CB1 = LDControls.AddCheckBox("Rel 1") LDControls.CheckBoxState("Rel 1","False") Controls.Move(CB1,80,120) CB2 = LDControls.AddCheckBox("Rel 2") LDControls.CheckBoxState("Rel 2","False") Controls.Move(CB2,170,120) Start = Controls.AddButton("Start",130,180) aus = Controls.AddButton ("Relais aus",350,70) Controls.SetSize(a,150,30) ge = Controls.AddButton("Gerät einschalten",350,120) Controls.SetSize(ge,150,30) ga = Controls.AddButton("Geräte trennen",350,170) Controls.SetSize(ga,150,30) EndSub Sub Ereigniss Controls.ButtonClicked = Button Timer.Tick = Zeit EndSub Sub Button LCB = Controls.LastClickedButton 'Dadurch wird die Geschwindigkeit erhöht. Sonst müsste jedes Mal überprüft werden welcher der zuletzt geklickte Button ist. Bei einem so kleinem Programm fällt dies zwar kaum ins Gewicht, aber es ist gut wenn man sich dies für spätere, größere Projekte aneignet If LCB = aus Then Ausschalten() ElseIf LCB = ga Then LDIOWarrior.Detatch() ElseIf LCB = ge Then LDIOWarrior.Initialise() ElseIf LCB = Start Then Box() EndIf EndSub LDControls.CheckBoxChanged = Box Sub Box LB = LDControls.LastCheckBox If LB = CB1 Then Start1() ElseIf LB = CB2 Then Start2() EndIf EndSub Sub Zeit Timer.Pause() Ausschalten() EndSub Sub Ausschalten LDIOWarrior.GetReportSize(0) r[1] = 0 r[2] = 255 r[3] = 255 LDIOWarrior.Write(1,0,r) EndSub Sub Start1 LDIOWarrior.GetReportSize(0) r[1] = 0 r[2] = 254 r[3] = 255 LDIOWarrior.Write(1,0,r) ZeitSek = Controls.GetTextBoxText(Zeitbox) ZeitMil = ZeitSek*1000 Timer.Interval = ZeitMil EndSub Sub Start2 LDIOWarrior.GetReportSize(0) r[1] = 0 r[2] = 253 r[3] = 255 LDIOWarrior.Write(1,0,r) ZeitSek = Controls.GetTextBoxText(Zeitbox) ZeitMil = ZeitSek*1000 Timer.Interval = ZeitMil EndSub End>VCG879.sb< Start>VCK996.sb< pp[1]="309 155;224 261;295 373;428 329;438 196 pp[2]="293 370;267 489;370 572;494 537;526 411;428 325 pp[3]="428 323;437 195;535 153;635 240;631 363;526 408 pp[4]="527 407;494 537;578 559;658 457;632 364 pp[5]="371 572;336 636;212 583;170 500;267 489 pp[6]="170 498;107 403;135 279;222 260;293 369;267 489 pp[7]="134 278;123 202;148 164;184 124;208 105;295 85;307 153;223 258 pp[8]="293 85;400 45;517 79;535 153;440 195;305 153 pp[9]="517 78;554 90;592 119;631 162;664 215;638 241;537 155 pp[10]="210 103;294 84;400 42;332 50;297 57;250 75;209 103 pp[11]="122 203;134 278;107 403;92 395;88 352;89 308;100 258 GraphicsWindow.Title="Classic Soccer Ball cll="black white white black black white white white black black black cll=LDText.Replace(cll "white" "transparent") cc=LDText.Split(cll " ") GraphicsWindow.MouseMove=mmm GraphicsWindow.Width=700 GraphicsWindow.Height=700 ee=Shapes.AddEllipse(605 600) ldShapes.Centre(ee 390 342) LDShapes.BrushShape(ee LDShapes.BrushGradient("1=white;2=white;3=gray;4=darkgray" "DD")) sub mmm ' GraphicsWindow.Title=GraphicsWindow.MouseX+" : "+GraphicsWindow.MouseY EndSub GraphicsWindow.BackgroundColor="teal for f=1 to 11 gg=LDText.Split(pp[f] ";") hh="" for h=1 to Array.GetItemCount(gg) hh[h]=LDText.Split(gg[h] " ") ' TextWindow.WriteLine(hh[h]) EndFor po= LDShapes.AddPolygon(hh) LDShapes.BrushColour(po cc[f]) EndFor End>VCK996.sb< Start>VCL709-0.sb< LDPhysics.SetAABB(-100, 2000, -100, 200) 'Good for x up to 20000 LDPhysics.Reset() LDPhysics.LoadImagesAsCircles = "True" GraphicsWindow.BrushColor = "Black" wheel1 = Shapes.AddEllipse(39,39)'.AddImage("C:\Brick game\Wheel.png") wheel2 = Shapes.AddEllipse(39,39)'.AddImage("C:\Brick game\Wheel.png") car = Shapes.AddRectangle(100,50)'.AddImage("C:\Brick game\Bike.png") Jump1 = Shapes.AddRectangle(400,5) Floor = Shapes.AddRectangle(1000000,5) Shapes.Move(Floor,10,GraphicsWindow.Height) Shapes.Move(Jump1,1500,350) Shapes.Rotate(Jump1,-30) LDPhysics.AddFixedShape(Jump1,1,0) LDPhysics.AddFixedShape(Floor,1,0) LDPhysics.AddMovingShape(wheel1,10,0,5) LDPhysics.AddMovingShape(wheel2,10,0,1) 'LDPhysics.SetPosition(wheel2,250,400,0) LDPhysics.SetPosition(wheel1,200,400,0) LDPhysics.SetPosition(wheel2,300,400,0) LDPhysics.AddMovingShape(car,0.3,0.5,5) LDPhysics.SetPosition(car,250,345,0) LDPhysics.AttachShapesWithRotation(wheel1,car) LDPhysics.AttachShapesWithRotation(wheel2,car) LDPhysics.SetVelocity(car,0,0) LDScrollBars.Rasterize = "False" LDScrollBars.Add(50000,1000) LDScrollBars.Visibility = "False" LDScrollBars.HorizontalScroll = 200 LDPhysics.SetBoundaries(50000,50000,50000,50000) Text = Shapes.AddText("") mass = LDPhysics.GetMass(car) inerta = LDPhysics.GetInertia(wheel1) inertacar = LDPhysics.GetInertia(car) xx = 0 While ("True") xx = xx+1 Pos = LDPhysics.GetPosition(car) LDScrollBars.HorizontalScroll = (Pos[1] - 300) Shapes.SetText(Text,"X position = " + pos[1] + "("+xx+")") Shapes.Move(Text,pos[1],0) If LDUtilities.KeyDown("Down") Then LDPhysics.SetTorque(wheel1,-20*inerta) LDPhysics.SetImpulse(car,-mass,-0.1*mass) EndIf If LDUtilities.KeyDown("Up") Then LDPhysics.SetTorque(wheel1,20*inerta) LDPhysics.SetImpulse(car,mass,-0.1*mass) EndIf If LDUtilities.KeyDown("Right") Then LDPhysics.SetTorque(car,3*inertaCar) EndIf If LDUtilities.KeyDown("Left") Then LDPhysics.SetTorque(car,-3*inertaCar) EndIf LDPhysics.DoTimestep() Program.Delay(20) EndWhile End>VCL709-0.sb< Start>VCL709.sb< GraphicsWindow.BrushColor = "Black" wheel1 = Shapes.AddEllipse(39,39)'.AddImage("C:\Brick game\Wheel.png") wheel2 = Shapes.AddEllipse(39,39)'.AddImage("C:\Brick game\Wheel.png") car = Shapes.AddRectangle(100,50)'.AddImage("C:\Brick game\Bike.png") Jump1 = Shapes.AddRectangle(400,5) Floor = Shapes.AddRectangle(1000000,5) LDPhysics.LoadImagesAsCircles = "True" Shapes.Move(Floor,0,GraphicsWindow.Height) Shapes.Move(Jump1,1500,350) Shapes.Rotate(Jump1,-30) LDPhysics.AddFixedShape(Jump1,1,0) LDPhysics.AddFixedShape(Floor,1,0) LDPhysics.AddMovingShape(wheel1,10,0,5) LDPhysics.AddMovingShape(wheel2,10,0,1) 'LDPhysics.SetPosition(wheel2,250,400,0) LDPhysics.SetPosition(wheel1,200,400,0) LDPhysics.SetPosition(wheel2,300,400,0) LDPhysics.AddMovingShape(car,0.3,0.5,5) LDPhysics.SetPosition(car,250,345,0) LDPhysics.AttachShapesWithRotation(wheel1,car) LDPhysics.AttachShapesWithRotation(wheel2,car) LDPhysics.SetVelocity(car,0,0) LDScrollBars.Add(100000,1000) LDScrollBars.Visibility = "False" 'LDScrollBars.HorizontalScroll = 200 LDPhysics.SetBoundaries(50000,50000,50000,50000) Text = Shapes.AddText("") mass = LDPhysics.GetMass(car) inerta = LDPhysics.GetInertia(wheel1) inertacar = LDPhysics.GetInertia(car) While ("True") Var = LDPhysics.GetPosition(car) LDScrollBars.HorizontalScroll = (Var[1] - 300) Pos = LDPhysics.GetPosition(car) Shapes.SetText(Text,"X position = " + pos[1]) Shapes.Move(Text,pos[1],0) If LDUtilities.KeyDown("Down") Then LDPhysics.SetTorque(wheel1,-20*inerta) LDPhysics.SetImpulse(car,-mass,-0.1*mass) EndIf If LDUtilities.KeyDown("Up") Then LDPhysics.SetTorque(wheel1,20*inerta) LDPhysics.SetImpulse(car,mass,-0.1*mass) EndIf If LDUtilities.KeyDown("Right") Then LDPhysics.SetTorque(car,3*inertaCar) EndIf If LDUtilities.KeyDown("Left") Then LDPhysics.SetTorque(car,-3*inertaCar) EndIf LDPhysics.DoTimestep() Program.Delay(20) EndWhile End>VCL709.sb< Start>VCM525.sb< 'Challenge 1 September 2012 'Robin Andrews ' 'get string TextWindow.WriteLine("Please enter a string:") string = TextWindow.Read() ' 'set counter variable numberCount = 0 ' 'loop through string For m = 1 To (Text.GetLength(string)) currentChar = text.GetCharacterCode(Text.GetSubText(string,m,1)) For i = 48 To 57 If currentChar = i Then numberCount = numberCount + 1 EndIf EndFor EndFor ' 'display results If numberCount = 1 then TextWindow.WriteLine("There is " + numberCount + " numeral in the above string.") else TextWindow.WriteLine("There are " + numberCount + " numerals in the above string.") EndIf End>VCM525.sb< Start>VCR160.sb< ' Bowling Score Board ' Copyright © 2014 Nonki Takahashi. The MIT License. ' Version (pilot) ' Last update 2014-12-16 ' GraphicsWindow.Title = "BOWLING SCORE BOARD (pilot)" Init() While "True" Form() While Not[clicked] Program.Delay(500) EndWhile clicked = "False" Game() EndWhile Sub AddCursor GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Gray" cursor = Shapes.AddRectangle(fw / 2, fh / 2) Shapes.SetOpacity(cursor, 50) x = x0 + pw y = y0 + hh Shapes.Move(cursor, x, y) cursorOn = "True" Timer.Interval = 500 Timer.Tick = OnTick EndSub Sub DrawSpare ' param x, y - left top of the cursor If frame < 10 Then sw = fw / 2 Else sw = fw / 3 EndIf GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillTriangle(x, y + fh / 2, x + sw, y, x + sw, y + fh / 2) EndSub Sub DrawPoint ' param x, y - left top of the cursor ' param point - point ' param throw ' param frame ' param prevPoint GraphicsWindow.BrushColor = "Black" If 0 < point Then GraphicsWindow.DrawText(x + 2, y, point) Else If frame < 10 Then If throw = 1 Then GraphicsWindow.DrawText(x + 2, y, "G") Else GraphicsWindow.DrawText(x + 2, y, "-") EndIf Else If (prevPoint = 0) Or (prevPoint = 10) Then GraphicsWindow.DrawText(x + 2, y, "G") Else GraphicsWindow.DrawText(x + 2, y, "-") EndIf EndIf EndIf EndSub Sub DrawStrike ' param x, y - left top of the cursor If frame < 10 Then dx = fw / 2 sw = fw / 2 Else dx = 0 sw = fw / 3 EndIf GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillTriangle(x + dx, y, x + dx, y + fh / 2, x + dx + sw / 2, y + fh / 4) GraphicsWindow.FillTriangle(x + dx + sw / 2, y + fh / 4, x + dx + sw, y, x + dx + sw, y + fh / 2) EndSub Sub DrawTotal ' param frame ' param iPerson GraphicsWindow.BrushColor = "Black" _x = x0 + pw + (frame - 1) * fw _y = y0 + hh + (iPerson - 0.5) * fh total = 0 For _i = 1 To frame total = total + subtotal[iPerson][_i] EndFor GraphicsWindow.DrawText(_x + 2, _y, total) If frame = 10 Then _x = x0 + pw + frame * fw _y = y0 + hh + (iPerson - 1) * fh GraphicsWindow.DrawText(_x + 2, _y, total) EndIf EndSub Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "DarkCyan" GraphicsWindow.Clear() GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "DarkCyan" maxPerson = 8 hh = 22 pw = 100 fw = 44 fh = 44 bh = 26 x0 = (gw - pw - fw * 11) / 2 y0 = (gh - hh - fh * maxPerson - 4 - bh) / 2 GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(x0 + 1, y0 + 1, pw - 2, hh - 2) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(x0 + 2, y0, "NAME") For iFrame = 1 To 11 x = x0 + pw + (iFrame - 1) * fw GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(x + 1, y0 + 1, fw - 2, hh - 2) GraphicsWindow.BrushColor = "Black" If iFrame = 11 Then GraphicsWindow.DrawText(x + 2, y0, "TOTAL") Else GraphicsWindow.DrawText(x + 2, y0, iFrame) EndIf EndFor For iPerson = 1 To maxPerson y = y0 + hh + (iPerson - 1) * fh GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(x0 + 1, y + 1, pw - 2, fh - 2) GraphicsWindow.BrushColor = "Black" tboxName[iPerson] = Controls.AddTextBox(x0 + 1, y) Controls.SetSize(tboxName[iPerson], pw - 2, fh - 2) Controls.SetTextBoxText(tboxName[iPerson], name[row[iPerson]]) For iFrame = 1 To 11 x = x0 + pw + (iFrame - 1) * fw GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(x + 1, y + 1, fw - 2, fh - 2) If iFrame < 10 Then GraphicsWindow.DrawRectangle(x + fw / 2, y, fw / 2, fh / 2) spare[iPerson][iFrame] = 0 ElseIf iFrame = 10 Then GraphicsWindow.DrawRectangle(x, y, fw / 3, fh / 2) GraphicsWindow.DrawRectangle(x + fw / 3, y, fw / 3, fh / 2) GraphicsWindow.DrawRectangle(x + fw * 2 / 3, y, fw / 3, fh / 2) spare[iPerson][iFrame][1] = 0 spare[iPerson][iFrame][2] = 0 spare[iPerson][iFrame][3] = 0 EndIf EndFor EndFor y = y0 + hh + maxPerson * fh + 4 GraphicsWindow.BrushColor = "Black" Controls.AddButton("START", x0, y) clicked = "False" Controls.ButtonClicked = OnButtonClicked msg = "ENTER NAMES AND PUSH [START] BUTTON." help = Shapes.AddText(msg) Shapes.Move(help, x0 + 80, y + 6) EndSub Sub Game msg = "PUSH ONE OF 0~9, X, /, - AND G KEYS." Shapes.SetText(help, msg) subtotal = "" frame = 1 iPerson = 1 throw = 1 prevPoint = 0 AddCursor() keyDown = "False" gameset = "False" GraphicsWindow.KeyDown = OnKeyDown While Not[gameset] And Not[clicked] GetPerson() invalid = "True" While invalid And Not[clicked] While Not[keyDown] And Not[clicked] Program.Delay(500) EndWhile keyDown = "False" If Array.ContainsIndex(score, key) Then invalid = "False" EndIf EndWhile If clicked Then Goto return EndIf If score[key] = "/" Then If frame < 10 Then point = 10 - subtotal[iPerson][frame] Else point = 10 - prevPoint If point = 0 Then point = 10 EndIf EndIf Else point = score[key] EndIf If frame < 10 Then If 10 < point + subtotal[iPerson][frame] Then point = 10 - subtotal[iPerson][frame] EndIf Else If (1 < throw) And (prevPoint < 10) Then If 10 < point + prevPoint Then point = 10 - prevPoint EndIf EndIf EndIf subtotal[iPerson][frame] = subtotal[iPerson][frame] + point If (1 < frame) And (0 < spare[iPerson][frame - 1]) Then subtotal[iPerson][frame - 1] = subtotal[iPerson][frame - 1] + point spare[iPerson][frame - 1] = spare[iPerson][frame - 1] - 1 If spare[iPerson][frame - 1] = 0 Then frame = frame - 1 DrawTotal() frame = frame + 1 EndIf EndIf If (2 < frame) And (0 < spare[iPerson][frame - 2]) Then subtotal[iPerson][frame - 2] = subtotal[iPerson][frame - 2] + point spare[iPerson][frame - 2] = spare[iPerson][frame - 2] - 1 If spare[iPerson][frame - 2] = 0 Then frame = frame - 2 DrawTotal() frame = frame + 2 EndIf EndIf isSpare = "False" If (frame < 10) And (subtotal[iPerson][frame] = 10) Then isSpare = "True" ElseIf (frame = 10) And (point <> 10) And (1 < throw) And (spare[iPerson][frame][throw - 1] = 0) And (prevPoint + point = 10) Then isSpare = "True" EndIf If point = 10 Then ' strike If frame < 10 Then spare[iPerson][frame] = 2 Else spare[iPerson][frame][throw] = 2 EndIf DrawStrike() ElseIf isSpare Then If frame < 10 Then spare[iPerson][frame] = 1 Else spare[iPerson][frame][throw] = 1 EndIf DrawSpare() Else DrawPoint() If throw = 2 And frame < 10 Then DrawTotal() EndIf EndIf throw = throw + 1 nextPerson = "False" If frame < 10 Then If 2 < throw Then nextPerson = "True" ElseIf spare[iPerson][frame] = 2 Then nextPerson = "True" EndIf ElseIf frame = 10 Then If 3 < throw Then nextPerson = "True" ElseIf throw = 3 Then nextPerson = "True" If spare[iPerson][frame][1] = 2 Then nextPerson = "False" ElseIf 0 < spare[iPerson][frame][2] Then nextPerson = "False" EndIf EndIf If nextPerson Then DrawTotal() EndIf EndIf If nextPerson Then throw = 1 iPerson = iPerson + 1 If nPerson < iPerson Then iPerson = 1 frame = frame + 1 If frame = 10 Then Shapes.Remove(cursor) cursor = Shapes.AddRectangle(fw / 3, fh / 2) Shapes.SetOpacity(cursor, 50) ElseIf 10 < frame Then Shapes.Remove(cursor) gameset = "True" EndIf EndIf EndIf MoveCursor() prevPoint = point EndWhile return: While Not[clicked] Program.Delay(500) EndWhile EndSub Sub GetPerson name = "" For iRow = 1 To maxPerson name[iRow] = Controls.GetTextBoxText(tboxName[iRow]) EndFor row = Array.GetAllIndices(name) nPerson = Array.GetItemCount(name) EndSub Sub Init Not = "True=False;False=True;" score = "D0=0;D1=1;D2=2;D3=3;D4=4;D5=5;D6=6;D7=7;D8=8;D9=9;X=10;" score = score + "NumPad0=0;NumPad1=1;NumPad2=2;NumPad3=3;NumPad4=4;" score = score + "NumPad5=5;NumPad6=6;NumPad7=7;NumPad8=8;NumPad9=9;" score = score + "OemQuestion=/;Divide=/;" score = score + "OemMinus=0;Subtract=0;" name = "" EndSub Sub MoveCursor ' param iPerson ' param frame ' param throw If frame < 10 Then x = x0 + pw + (frame - 1) * fw + (throw - 1) * fw / 2 Else x = x0 + pw + (frame - 1) * fw + (throw - 1) * fw / 3 EndIf y = y0 + hh + (iPerson - 1) * fh Shapes.Move(cursor, x, y) EndSub Sub OnButtonClicked clicked = "True" EndSub Sub OnKeyDown key = GraphicsWindow.LastKey keyDown = "True" EndSub Sub OnTick cursorOn = Not[cursorOn] If cursorOn Then Shapes.ShowShape(cursor) Else Shapes.HideShape(cursor) EndIf EndSub End>VCR160.sb< Start>VCZ347.sb< ' Monochrome ' Version 0.1 ' Copyright © 2016 Nonki Takahashi. The MIT License. Init() While "True" tag = tags[Math.GetRandomNumber(5)] url = Flickr.GetRandomPicture(tag) img = ImageList.LoadImage(url) iw = ImageList.GetWidthOfImage(img) ih = ImageList.GetHeightOfImage(img) If gw < iw Then iw = gw - 20 ih = ih * (gw - 20) / iw EndIf If gh < ih Then ih = gh - 20 iw = iw * (gh - 20) / ih EndIf x = Math.Floor((gw - iw) / 2) y = Math.Floor((gh - ih) / 2) GraphicsWindow.Clear() GraphicsWindow.DrawResizedImage(img, x, y, iw, ih) GraphicsWindow.Title = url Process() Program.Delay(2000) EndWhile Sub Process For _y = y To y + ih - 1 n = 0 line[n] = "l=-1;" For i = 1 To iw p = GraphicsWindow.GetPixel(x + (i - 1), _y) hex = Text.GetSubText(p, 2, 2) Hex2Dec() r = dec hex = Text.GetSubText(p, 4, 2) Hex2Dec() g = dec hex = Text.GetSubText(p, 6, 2) Hex2Dec() b = dec min = Math.Min(Math.Min(r, g), b) l = min + Math.Round(((r - min) * 2 + (g - min) * 4 + (b - min)) / 7) If 153 < l Then c = 2 ElseIf 102 < l Then c = 1 Else c = 0 EndIf If c <> line[n]["c"] Then n = n + 1 line[n]["c"] = c line[n]["n"] = 1 Else line[n]["n"] = line[n]["n"] + 1 EndIf EndFor _x = x For i = 1 To n c = line[i]["c"] GraphicsWindow.BrushColor = color[c] 'GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(l, l, l) GraphicsWindow.FillRectangle(_x, _y, line[i]["n"], 1) _x = _x + line[i]["n"] EndFor EndFor EndSub Sub Init debug = "False" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenWidth = 1 tags = "1=toy;2=building;3=house;4=bird;5=flower;" color = "0=#222222;1=#CCCCCC;2=#EEEEEE;" EndSub Sub Hex2Dec ' param hex ' return dec len = Text.GetLength(hex) dec = 0 For k = 1 To len h = Text.ConvertToUpperCase(Text.GetSubText(hex, k, 1)) d = Text.GetIndexOf("123456789ABCDEF", h) dec = dec * 16 + d EndFor EndSub End>VCZ347.sb< Start>VDD596.sb< ' Zigsaw ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Last Update 2015-05-05 ' Version 0.2b ' GraphicsWindow.Title = "Zigsaw 0.2b" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh folder = "http://www.nonkit.com/smallbasic.files" nPiece = 4 For piece = 1 To nPiece If Math.Remainder(piece, 2) = 1 Then img[piece] = ImageList.LoadImage(folder + "/hpiece.png") Else img[piece] = ImageList.LoadImage(folder + "/vpiece.png") EndIf p[piece] = Shapes.AddImage(img[piece]) pw[piece] = ImageList.GetWidthOfImage(img[piece]) ph[piece] = ImageList.GetHeightOfImage(img[piece]) px[piece] = Math.GetRandomNumber(gw - pw[piece]) - 1 py[piece] = Math.GetRandomNumber(gh - ph[piece]) - 1 Shapes.Move(p[piece], px[piece], py[piece]) Shapes.SetOpacity(p[piece], 50) ' for debug EndFor mouseDown = "False" mouseMove = "False" GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove While "True" If mouseDown Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY GetPiece() If piece <> "" Then MovePiece() EndIf EndIf EndWhile Sub GetPiece ' param mx, my - mouse position ' return piece - piece index ' return ox, oy - offset of mouse position in the piece piece = "" For i = 4 To 1 Step -1 If px[i] <= mx And mx <= px[i] + pw[i] And py[i] <= my And my <= py[i] + ph[i] Then GraphicsWindow.DrawImage(img[i], px[i], py[i]) If GraphicsWindow.GetPixel(mx, my) = "#000000" Then ox = mx - px[i] oy = my - py[i] piece = i EndIf GraphicsWindow.BrushColor = "#FFFFFF" GraphicsWindow.FillRectangle(px[i], py[i], pw[i], ph[i]) If piece <> "" Then i = 1 ' break EndIf EndIf EndFor EndSub Sub MovePiece ' param piece While mouseDown If mouseMove Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY px[piece] = mx - ox py[piece] = my - oy Shapes.Move(p[piece], px[piece], py[piece]) mouseMove = "False" EndIf EndWhile EndSub Sub OnMouseDown mouseDown = "True" EndSub Sub OnMouseMove mouseMove = "True" EndSub Sub OnMouseUp mouseDown = "False" EndSub End>VDD596.sb< Start>VDF018.sb< ' Words sorting program October 2011 by NaoChanON Sentences_Sample() Show_Sample() Controls.ButtonClicked=onbuttonclick Sub Sorting ' sorting end_nn=nn Loop2: If end_nn=1 Then Goto end1 EndIf For j=2 To end_nn c12="" c22="" D11=WD[j-1] 'original word c11=text.ConvertToLowerCase(WD[j-1]) ' ConvertToLowerCase D21=WD[j] c21=text.ConvertToLowerCase(WD[j]) L1=Text.GetLength(c11) L2=Text.GetLength(c21) If L2" " Then ' space = delimiter b=text.Append(b,a) Goto end3 endif If b<>"" And a=" " Then nn=nn+1 WD[nn]=b ' word input b="" endif end3: EndFor EndSub sub onbuttonclick name=controls.LastClickedButton 'Last button name nm=controls.GetButtonCaption(name) ' Button's caption If nm="EXE" Then dm=controls.GetTextBoxText(textbox[1]) Else dm=nm EndIf Data_input() ' Sorting() ' rearrange EndSub Sub Show_Sample GraphicsWindow.Clear() GraphicsWindow.Title="Words Sorting" GraphicsWindow.BackgroundColor="Lightcyan" GraphicsWindow.left=50 GraphicsWindow.top=0 GraphicsWindow.Height=700 GraphicsWindow.Width=1200 GraphicsWindow.FontName="Coorie new" GraphicsWindow.Show() GraphicsWindow.FontItalic="True" GraphicsWindow.FontSize=25 GraphicsWindow.BrushColor="Navy" GraphicsWindow.DrawText(50,10,Sample[10]) GraphicsWindow.FontSize=18 GraphicsWindow.BrushColor="Red" For i=1 To 5 btn[i]=Controls.AddButton(Sample[i],50,50*i) ' show sample Controls.SetSize(btn[i],1000,40) EndFor textbox[1] = Controls.AddTextBox(50,350) ' textbox Controls.SetSize(textbox[1] ,1000,40) btn[6]=Controls.AddButton("EXE",1060,350) ' button Controls.SetSize(btn[i],50,40) Endsub Sub Sentences_Sample ' These samples ( Sample[1] -Sample[5] ) are written in MSN.UK head news. (2011/10/04 ) Sample[1]="Nobel prize officials face dilemma after unwittingly honouring dead scientist" Sample[2]="Why the PM seems to think jogging is a sign of political as well as physical strength" Sample[3]="Rihanna defends her sexy image in an interview with Vogue magazine" Sample[4]="A.K is due to fly home to Seattle after walking free from the Italian prison " Sample[5]="A similar event is also being held at Apple's US headquarters in California." Sample[10]="Select a sample sentences or input your sentences in textbox and click EXE button " EndSub End>VDF018.sb< Start>VDJ868.sb< 'MAIN PROGRAM GraphicsWindow.BackgroundColor = "Blue" 'Printing out the 3 choices the player has to choose from posx = 25 posy = 50 rock() posx = 250 posy = 50 paper() posx = 475 posy = 50 scissors() hand = 10 GraphicsWindow.MouseDown = OnMouseDown 'Printing the players hand While hand <= 3 'Making the program wait for a mouse click GraphicsWindow.Clear() If hand = 1 Then posx = 50 posy = 50 rock() ElseIf hand = 2 Then posx = 50 posy = 50 paper() ElseIf hand = 3 Then posx = 50 posy = 50 scissors() EndIf 'Computer comphand = Math.GetRandomNumber(3) If comphand = 1 Then posx = 450 posy = 50 rock() EndIf If comphand = 2 Then posx = 450 posy = 50 paper() EndIf If comphand = 3 Then posx = 450 posy = 50 scissors() EndIf 'Drawing "VS" into the graphics window GraphicsWindow.PenColor ="Black" GraphicsWindow.DrawBoundText(350,100,100,"VS") Program.Delay(2000) 'Who Won? if hand = comphand Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 tie() ElseIf hand = 1 and comphand = 2 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 lose() Elseif hand = 1 and comphand = 3 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 win() EndIf If hand = 2 And comphand = 3 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 lose() ElseIf hand = 2 and comphand = 1 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 win() ElseIf hand = 3 and comphand = 1 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 lose() Elseif hand = 3 and comphand = 2 Then GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 win() EndIf Endwhile 'SUBROUTINES '=================== 'ROCK IMAGE Sub rock GraphicsWindow.Width = 700 GraphicsWindow.Height = 250 rock06 = ImageList.LoadImage(Program.Directory + "\rock06.jpg") GraphicsWindow.DrawImage(rock06,posx,posy) EndSub '=============================================== 'PAPER IMAGE Sub paper GraphicsWindow.Width = 700 GraphicsWindow.Height = 250 paper1 = ImageList.LoadImage(Program.Directory + "\paper.jpg") GraphicsWindow.DrawImage(paper1,posx,posy) endsub '=============================================== 'SCISSORS IMAGE Sub scissors GraphicsWindow.Width = 700 GraphicsWindow.Height = 250 scissors = ImageList.LoadImage(Program.Directory + "\scissors.jpg") GraphicsWindow.DrawImage(scissors,posx,posy) Endsub '================================================= 'Turtle Graphics for a tie Sub tie GraphicsWindow.Clear() Program.Delay(2000) GraphicsWindow.BackgroundColor = "Blue" Turtle.Speed =8 Turtle.PenUp() Turtle.MoveTo(75,75) Turtle.Angle = -90 Turtle.Move(40) Turtle.Angle = 90 Turtle.PenDown() Turtle.Move(80) Turtle.PenUp() Turtle.Angle = -90 Turtle.Move(40) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(100) Turtle.Angle = 90 Turtle.PenUp() Turtle.Move(60) Turtle.PenDown() Turtle.Move(80) Turtle.Angle = -90 Turtle.PenUp() Turtle.Move(40) Turtle.Angle = 0 Turtle.PenDown() Turtle.Move(100) Turtle.PenUp() 'I Turtle.Angle = -90 Turtle.Move(40) Turtle.angle = 90 Turtle.PenDown() Turtle.Move(80) Turtle.PenUp() Turtle.Move(20) Turtle.PenDown() Turtle.Move(80) Turtle.PenUp() Turtle.Angle = -90 Turtle.Move(80) Turtle.PenDown() Turtle.Angle = 180 Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(40) Turtle.Angle = -90 Turtle.Move(40) Turtle.Angle = 180 Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(80) EndSub '================================================ 'Turtle Graphics for a win Sub win GraphicsWindow.Clear() Program.Delay(200) GraphicsWindow.BackgroundColor = "Blue" Turtle.Speed = 8 Turtle.PenUp() Turtle.moveto(35,75) 'W Turtle.PenDown() turtle.MoveTo(65,170) Turtle.MoveTo(80,125) Turtle.MoveTo(95,170) Turtle.MoveTo(120,75) 'I Turtle.PenUp() Turtle.Angle = 90 Turtle.Move(15) Turtle.PenDown() Turtle.Move(80) Turtle.PenUp() Turtle.Angle = -90 Turtle.Move(40) Turtle.PenDown() Turtle.Angle = 180 Turtle.Move(95) Turtle.Angle = -90 Turtle.PenUp() Turtle.Move(40) Turtle.Angle =90 Turtle.PenDown() Turtle.Move(80) Turtle.Angle = -90 Turtle.PenUp() Turtle.Move(40) Turtle.Angle = 0 Turtle.Move(95) Turtle.Angle =90 Turtle.Move(40) 'N number 1 Turtle.Move(25) Turtle.Angle = 180 Turtle.Move(95) Turtle.Angle = 0 Turtle.PenDown() Turtle.Move(95) Turtle.Angle = 145 Turtle.Move(118) Turtle.Angle = 0 Turtle.Move(105) Turtle.Angle = 90 Turtle.PenUp() EndSub '============================================ 'Turtle Graphics for a loss Sub lose GraphicsWindow.Clear() 'BackGround GraphicsWindow.BackgroundColor = "Blue" number = 1 pencolor = GraphicsWindow.PenColor While number = 1 pencolor = GraphicsWindow.GetRandomColor() If pencolor = "blue" Then number = 1 Else number = 2 EndIf EndWhile Turtle.Speed = 8 'L Turtle.PenUp() Turtle.MoveTo(30,75) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(100) Turtle.Angle = 90 Turtle.Move(60) 'o Turtle.PenUp() Turtle.Move(20) Turtle.Angle = 0 Turtle.Move(27) Turtle.PenDown() For i = 1 To 50 Turtle.Move(4) Turtle.turn(7.2) Endfor 's Turtle.PenUp() Turtle.Move(77) Turtle.Angle = 90 Turtle.Move(90) Turtle.PenDown() Turtle.Move(50) Turtle.PenUp() Turtle.Angle = -90 Turtle.Move(50) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(50) Turtle.Angle = 180 Turtle.Move(50) Turtle.Angle = -90 Turtle.Move(50) 'E Turtle.PenUp() Turtle.Angle = 90 Turtle.Move(70) Turtle.PenDown() Turtle.Move(50) Turtle.PenUp() Turtle.Angle = -90 Turtle.Move(50) Turtle.Angle = 0 Turtle.PenDown() Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(25) Turtle.Angle = -90 Turtle.PenUp() Turtle.Move(25) Turtle.Angle = 0 Turtle.PenDown() Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(50) EndSub '============================================================= 'Clicking the Pictures to set what the variable hand equals Sub OnMouseDown x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x >= 25 And x <= 225) And (y >= 50 And y <= 194) Then hand = 1 ElseIf (x >= 250 and x <= 450) and (y >= 50 and y <= 194) Then hand = 2 ElseIf (x >= 475 and x <= 675) and (y >= 50 and y <= 194) Then hand = 3 EndIf EndSub End>VDJ868.sb< Start>VDL527.sb< 'Początkowe wartości funkcji co_podpowiadac = 0 Kolor_pędzla = "black" Kolor_pisaka = "black" grubość_pisaka = 2 rozmiar_czcionki = 15 'Ustawienie ekranu powitalnego (logo, motto, podanie tytułu pracy i losowe cytaty) GraphicsWindow.Title = "Kenexer 2" GraphicsWindow.Top = 50 GraphicsWindow.Left = 50 GraphicsWindow.Height = 700 GraphicsWindow.Width = 800 GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "black" GraphicsWindow.FontSize = 150 GraphicsWindow.BrushColor = "#00CED1" Kenedix_logo = Shapes.AddText("Kenedix") Shapes.Move(Kenedix_logo,50,50) Program.Delay(2000) GraphicsWindow.Clear() początkowy_kolor_tła = Math.GetRandomNumber(3) If (początkowy_kolor_tła < 3) Then GraphicsWindow.BackgroundColor = "white" EndIf If (początkowy_kolor_tła = 3) Then GraphicsWindow.BackgroundColor = "black" EndIf GraphicsWindow.Title = "Kenexer 2" GraphicsWindow.FontSize = 120 GraphicsWindow.PenColor = "blue" GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(50,70,"Kenexer 2") GraphicsWindow.FontSize = 30 GraphicsWindow.PenColor = "green" GraphicsWindow.BrushColor = "green" GraphicsWindow.DrawText(54,250,"Tworzenie to czysta przyjemność") 'Cytaty GraphicsWindow.PenColor = "#483D8B" GraphicsWindow.BrushColor = "#483D8B" GraphicsWindow.FontSize = 12 Cytat_wybór = Math.GetRandomNumber(6) If (Cytat_wybór = 1) Then GraphicsWindow.DrawText(10,410,"Pielęgnuj swoje marzenia. Trzymaj się swoich ideałów. Maszeruj śmiało według muzyki, którą tylko Ty słyszysz. ") GraphicsWindow.DrawText(10,425,"Wielkie biografie powstają z ruchu do przodu, a nie z oglądania się do tyłu. - Paulo Coelho") EndIf If (Cytat_wybór = 2) Then GraphicsWindow.DrawText(10,410,"Praca oddala od nas trzy wielkie niedole - nudę, występek i ubóstwo. - Wolter") EndIf If (Cytat_wybór = 3) Then GraphicsWindow.DrawText(10,410,"Nie bój się wielkiego kroku. Nie przeskoczysz przepaści dwoma małymi. - George David Loyd") EndIf If (Cytat_wybór = 4) Then GraphicsWindow.DrawText(10,410,"Nie byłoby wielkiego geniuszu bez przymieszki szaleństwa. - Seneka ") EndIf If (Cytat_wybór = 5) Then GraphicsWindow.DrawText(10,410,"Często wielkie talenty pozostają w ukryciu. - Plaut") EndIf If (Cytat_wybór = 6) Then GraphicsWindow.DrawText(10,410,"Bez wielkiej cnoty cierpliwości nie dojrzewa nic co ludzkie. - Romano Guardini") EndIf GraphicsWindow.PenColor = "#0000CD" GraphicsWindow.BrushColor = "#0000CD" GraphicsWindow.DrawText(200,450,"Autor programu : kenex") GraphicsWindow.DrawText(200,470,"Program jest w pełni darmowy. Jeśli chcesz go modyfikować, musisz posiadać zgodę autora.") GraphicsWindow.DrawText(200,490,"Kontakt z autorem : mail - kadexgro@tlen.pl") GraphicsWindow.PenColor = "#32CD32" GraphicsWindow.BrushColor = "#32CD32" GraphicsWindow.DrawRectangle(100,550,140,20) 'Wczytywanie a w rzeczywistości danie czasu na przeczytanie Program.Delay(1000) GraphicsWindow.FillRectangle(100,550,30,20) Program.Delay(1000) GraphicsWindow.FillRectangle(130,550,30,20) Program.Delay(1000) GraphicsWindow.FillRectangle(160,550,30,20) Program.Delay(1000) GraphicsWindow.FillRectangle(190,550,30,20) Program.Delay(1000) GraphicsWindow.FillRectangle(220,550,20,20) Program.Delay(1000) GraphicsWindow.BackgroundColor = "white" 'Tworzenie interfejsu GraphicsWindow.Clear() 'Tworzenie pasków GraphicsWindow.PenColor = "#00BFFF" GraphicsWindow.BrushColor = "#00BFFF" prawy_pasek = Shapes.AddRectangle(230,600) Shapes.Move(prawy_pasek,600,0) Shapes.SetOpacity(prawy_pasek,30) dolny_pasek = Shapes.AddRectangle(830,130) Shapes.Move(dolny_pasek,0,600) Shapes.SetOpacity(dolny_pasek,30) GraphicsWindow.PenColor = "#00FFFF" GraphicsWindow.BrushColor = "#00FFFF" GraphicsWindow.DrawLine(0,600,600,600) GraphicsWindow.DrawLine(600,0,600,600) 'Tworzenie napisu kenexer2 GraphicsWindow.PenColor = "#0000CD" GraphicsWindow.BrushColor = "#0000CD" GraphicsWindow.FontSize = 15 GraphicsWindow.DrawText(605,5,"Kenexer 2 | Autor : kenex") 'Tworzenie miejsca pokazującego współrzędne GraphicsWindow.FontSize = 10 GraphicsWindow.PenColor = "#4B0082" GraphicsWindow.BrushColor = "#4B0082" GraphicsWindow.DrawText(605,25,"Współrzędne : ") Współrzędna_myszki_x = "???" Współrzędna_myszki_y = "???" Współrzędna_myszki_x_pole = Shapes.AddText("x = " + Współrzędna_myszki_x) Współrzędna_myszki_y_pole = Shapes.AddText("y = " + Współrzędna_myszki_y) Shapes.Move(Współrzędna_myszki_x_pole,685,25) Shapes.Move(Współrzędna_myszki_y_pole,735,25) 'Sprawdzanie pozycji myszki GraphicsWindow.MouseMove = mysz_przesunięta 'Tworzenie miejsca pokazującego KOLOR pędzla i pisaka GraphicsWindow.PenColor = "#2E8B57" GraphicsWindow.BrushColor = "#2E8B57" GraphicsWindow.DrawText(605,55,"Kolor pędzla : ") GraphicsWindow.BrushColor = Kolor_pędzla Shapes.Remove(pok_kolor_pędzla) pok_kolor_pędzla = Shapes.AddRectangle(15,15) Shapes.Move(pok_kolor_pędzla,685,55) Shapes.Remove(pokt_kolor_pędzla) pokt_kolor_pędzla = Shapes.AddText(Kolor_pędzla) Shapes.Move(pokt_kolor_pędzla,720,55) GraphicsWindow.DrawText(605,85,"Kolor pisaka : ") Shapes.Remove(pok_kolor_pisaka) GraphicsWindow.BrushColor = Kolor_pisaka pok_kolor_pisaka = Shapes.AddRectangle(15,15) Shapes.Move(pok_kolor_pisaka,685,85) Shapes.Remove(pokt_kolor_pisaka) pokt_kolor_pisaka = Shapes.AddText(Kolor_pisaka) Shapes.Move(pokt_kolor_pisaka,720,85) GraphicsWindow.BrushColor = Kolor_pędzla 'Tworzenie miejsca pokazującego grubość pisaka i rozmiar czcionki GraphicsWindow.PenColor = "#FF4500" GraphicsWindow.BrushColor = "#FF4500" GraphicsWindow.DrawText(605,115,"Grubość pisaka : ") Pokaż_grubość_pisaka = Shapes.AddText(grubość_pisaka) Shapes.Move(Pokaż_grubość_pisaka,695,115) GraphicsWindow.DrawText(605,130,"Rozmiar czcionki : ") Pokaż_rozmiar_czcionki = Shapes.AddText(rozmiar_czcionki) Shapes.Move(Pokaż_rozmiar_czcionki,705,130) 'Miejsce pokazujące zapisany kolor zap_kolor = "Nie zapisano" GraphicsWindow.BrushColor = "#2F4F4F" Pokaż_zap_kolor = Shapes.AddText("Zapisany kolor : " + zap_kolor) Shapes.Move(Pokaż_zap_kolor,605,160) GraphicsWindow.BrushColor = "green" 'Podpowiedzi GraphicsWindow.FontSize = 12 If (co_podpowiadac = 0) Then Podpowiedzi = Shapes.AddText("Witaj w programie Kenexer 2. Miłego rysowania :)") Shapes.Move(Podpowiedzi,10,680) EndIf co_podpowiadac = 1 'Pseudo przyciski GraphicsWindow.PenColor = "#00CED1" GraphicsWindow.BrushColor = "#00CED1" GraphicsWindow.MouseDown = MouseDown '1 GraphicsWindow.FillRectangle(610,250,40,40) '2 GraphicsWindow.FillRectangle(660,250,40,40) '3 GraphicsWindow.FillRectangle(710,250,40,40) '4 GraphicsWindow.FillRectangle(610,300,40,40) '5 GraphicsWindow.FillRectangle(660,300,40,40) '6 GraphicsWindow.FillRectangle(710,300,40,40) '7 GraphicsWindow.FillRectangle(610,350,40,40) '8 GraphicsWindow.FillRectangle(660,350,40,40) '9 GraphicsWindow.FillRectangle(710,350,40,40) '10 GraphicsWindow.FillRectangle(610,400,40,40) '11 GraphicsWindow.FillRectangle(660,400,40,40) '12 GraphicsWindow.FillRectangle(710,400,40,40) '13 GraphicsWindow.FillRectangle(610,450,40,40) '14 GraphicsWindow.FillRectangle(660,450,40,40) '15 GraphicsWindow.FillRectangle(710,450,40,40) '16 GraphicsWindow.FillRectangle(610,500,40,40) '17 GraphicsWindow.FillRectangle(660,500,40,40) '18 GraphicsWindow.FillRectangle(710,500,40,40) 'Obrazki na przyciskach 'Przycisk 1 - zmiana grubości pisaka GraphicsWindow.PenColor = "#000000" GraphicsWindow.BrushColor = "#000000" GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawLine(612,260,648,260) GraphicsWindow.PenWidth = 2 GraphicsWindow.DrawLine(612,270,648,270) GraphicsWindow.PenWidth = 3 GraphicsWindow.DrawLine(612,280,648,280) 'Przycisk 2 - zmiana koloru pisaka GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "#000080" GraphicsWindow.BrushColor = "#000080" GraphicsWindow.DrawLine(662,260,698,260) GraphicsWindow.PenColor = "#FF8C00" GraphicsWindow.BrushColor = "#FF8C00" GraphicsWindow.DrawLine(662,270,698,270) GraphicsWindow.PenColor = "#FF0000" GraphicsWindow.BrushColor = "#FF0000" GraphicsWindow.DrawLine(662,280,698,280) 'Przycisk 3 - zmiana koloru pędzla GraphicsWindow.FillRectangle(715,255,10,10) GraphicsWindow.PenColor = "#0000CD" GraphicsWindow.BrushColor = "#0000CD" GraphicsWindow.FillRectangle(715,275,10,10) GraphicsWindow.PenColor = "#4B0082" GraphicsWindow.BrushColor = "#4B0082" GraphicsWindow.FillRectangle(735,255,10,10) GraphicsWindow.PenColor = "#228B22" GraphicsWindow.BrushColor = "#228B22" GraphicsWindow.FillRectangle(735,275,10,10) 'Przycisk 4 - rozmiar czcionki GraphicsWindow.PenColor = "#000000" GraphicsWindow.BrushColor = "#000000" GraphicsWindow.FontSize = 7 GraphicsWindow.DrawText(612,310,"A") GraphicsWindow.FontSize = 14 GraphicsWindow.DrawText(620,310,"A") GraphicsWindow.FontSize = 21 GraphicsWindow.DrawText(632,310,"A") 'Przycisk 5 - tekst GraphicsWindow.FontSize = 11 GraphicsWindow.DrawText(662,310,"Abcde") 'Przycisk 6 - rysowanie linii prostej GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawLine(720,310,740,330) 'Przycik 7 - rysowanie prostokątów pustych w środku GraphicsWindow.DrawRectangle(615,360,30,20) 'Przycisk 8 - rysowanie kół pustych w środku GraphicsWindow.DrawEllipse(670,360,20,20) 'Przycisk 9 - rysowanie trokątów pustych w środku GraphicsWindow.DrawTriangle(720,380,730,360,740,380) 'Przycisk 10 - rysowanie prostokątów wypełnionych GraphicsWindow.FillRectangle(615,410,30,20) 'Przycisk 11 - rysowanie kół wypełnionych GraphicsWindow.FillEllipse(670,410,20,20) 'Przycisk 12 - rysowanie trójkątów wypełnionych GraphicsWindow.FillTriangle(720,430,730,410,740,430) 'Przycisk 13 - sprawdź kolor określonego piksela GraphicsWindow.BrushColor = "red" GraphicsWindow.FillRectangle(626,480,8,8) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine(630,485,630,465) GraphicsWindow.FillTriangle(620,465,630,452,640,465) 'Przycisk 14 - koloruj określony piksel GraphicsWindow.BrushColor = "red" GraphicsWindow.FillRectangle(676,480,8,8) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine(680,475,680,453) GraphicsWindow.FillTriangle(670,470,680,485,690,470) 'Przycisk 15 - ołówek GraphicsWindow.BrushColor = "#556B2F" GraphicsWindow.FillRectangle(740,455,5,25) GraphicsWindow.FillTriangle(740,480,742.5,485,745,480) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine(715,485,742.5,485) 'Przycisk 16 - zmiana tytułu obrazu GraphicsWindow.DrawText(612,510,"Tytuł") 'Przycisk 17 - wczytywanie obrazu GraphicsWindow.FillRectangle(665,530,30,5) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillTriangle(670,510,680,530,690,510) GraphicsWindow.BrushColor = "black" 'Przycisk 18 - wczytywanie obrazu ze zmienionymi rozmiarami GraphicsWindow.FillRectangle(715,530,30,5) GraphicsWindow.BrushColor = "green" GraphicsWindow.FillTriangle(720,510,730,530,740,510) GraphicsWindow.BrushColor = "black" '<><><><><><><><><><><><><><><><><><><><><> narazie_tutaj: 'Grubość pisaka. Informacje o grubości pisaka GraphicsWindow.PenWidth = grubość_pisaka Shapes.SetText(Pokaż_grubość_pisaka,grubość_pisaka) 'Kolor pisaka. Informacja o kolorze pisaka GraphicsWindow.PenColor = Kolor_pisaka 'Reszta info w miejscu odpowiedzialnym za naciśnięcie przycisku. 'Zdarzenia po naciśnięciu na dany przycisk / obszar GraphicsWindow.FontSize = 10 GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki 'Przycisk 1 - zmiana grubości pisaka If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 250 and y_po_nac < 280) Then co_robić = "grubość" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "grubość") Then TextWindow.Show() TextWindow.Left = 5 TextWindow.Top = 5 TextWindow.Title = "Grubość pisaka" TextWindow.Write("Podaj grubość pisaka : ") grubość_pisaka = TextWindow.ReadNumber() TextWindow.Hide() ' GraphicsWindow.FontSize = 12 ' GraphicsWindow.BrushColor = "green" ' Shapes.SetText(Podpowiedzi,"Ustaw grubość pisaka. Domyślna to 2.") ' GraphicsWindow.BrushColor = Kolor_pędzla ' GraphicsWindow.FontSize = rozmiar_czcionki ' pole_grubość_pisaka = Controls.AddTextBox(120,620) ' Controls.SetSize(pole_grubość_pisaka,50,25) ' ustaw_gr = Controls.AddButton("Ustaw",200,620) ' Controls.ButtonClicked = Klik_grubość co_robić = 0 EndIf 'Sub Klik_grubość 'zaw_pole_grubość_pisaka = Controls.GetTextBoxText(pole_grubość_pisaka) 'zaw_pole_grubość_pisaka = grubość_pisaka 'zaw_pole_grubość_pisaka = GraphicsWindow.PenWidth 'grubość_pisaka = GraphicsWindow.PenWidth 'Shapes.Remove(ustaw_gr) 'Shapes.Remove(pole_grubość_pisaka) 'Shapes.SetText(Podpowiedzi,"") 'EndSub 'Przycisk 2 - zmiana koloru pisaka If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 250 and y_po_nac < 280) Then co_robić = "kolor_pisaka" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "kolor_pisaka") Then TextWindow.Show() TextWindow.Left = 5 TextWindow.Top = 5 TextWindow.Title = "Kolor pisaka" TextWindow.Write("Podaj kolor pisaka np. green albo #008000 : ") kolor_pisaka = TextWindow.Read() TextWindow.Hide() GraphicsWindow.BrushColor = Kolor_pisaka Shapes.Remove(pok_kolor_pisaka) pok_kolor_pisaka = Shapes.AddRectangle(15,15) Shapes.Move(pok_kolor_pisaka,685,85) GraphicsWindow.FontSize = 10 Shapes.Remove(pokt_kolor_pisaka) pokt_kolor_pisaka = Shapes.AddText(Kolor_pisaka) Shapes.Move(pokt_kolor_pisaka,720,85) GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.BrushColor = Kolor_pędzla co_robić = 0 EndIf 'Przycisk 3 - zmiana koloru pędzla If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 250 and y_po_nac < 280) Then co_robić = "kolor_pędzla" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "kolor_pędzla") Then TextWindow.Show() TextWindow.Left = 5 TextWindow.Top = 5 TextWindow.Title = "Kolor pędzla" TextWindow.Write("Podaj kolor pędzla np. green albo #008000 : ") kolor_pędzla = TextWindow.Read() TextWindow.Hide() GraphicsWindow.BrushColor = Kolor_pędzla Shapes.Remove(pok_kolor_pędzla) pok_kolor_pędzla = Shapes.AddRectangle(15,15) Shapes.Move(pok_kolor_pędzla,685,55) GraphicsWindow.FontSize = 10 Shapes.Remove(pokt_kolor_pędzla) pokt_kolor_pędzla = Shapes.AddText(Kolor_pędzla) Shapes.Move(pokt_kolor_pędzla,720,55) GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf 'Przycisk 4 - rozmiar czcionki If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 300 and y_po_nac < 340) Then co_robić = "rozmiar_czcionki" EndIf If (co_robić = "rozmiar_czcionki") Then TextWindow.Show() TextWindow.Left = 5 TextWindow.Top = 5 TextWindow.Title = "Rozmiar czcionki" TextWindow.Write("Podaj rozmiar czcionki (liczbę) : ") rozmiar_czcionki = TextWindow.ReadNumber() TextWindow.Hide() Shapes.SetText(Pokaż_rozmiar_czcionki,rozmiar_czcionki) x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 co_robić = 0 EndIf 'Przycisk 5 - tekst If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 300 and y_po_nac < 340) Then co_robić = "tekst" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"W polu tekstowym podaj treść tekstu do wyświetlenia i naciśnij przycisk gotowe") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "tekst") Then tekst = Controls.AddTextBox(50,615) Controls.SetSize(tekst,300,40) GraphicsWindow.FontSize = 20 guzik_45 = Controls.AddButton("Gotowe!",400,615) Controls.ButtonClicked = zapisz_tekst GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf Sub zapisz_tekst tekst_wyś = Controls.GetTextBoxText(tekst) GraphicsWindow.MouseDown = Wsp_tekstu GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij teraz w miejsce w którym ma się pojawić tekst (lewy-górny róg tekstu)") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub Wsp_tekstu wsp_x = GraphicsWindow.MouseX wsp_y = GraphicsWindow.MouseY GraphicsWindow.DrawText(wsp_x,wsp_y,tekst_wyś) GraphicsWindow.MouseDown = MouseDown co_robić = "Usuń_pola" EndSub If (co_robić = "Usuń_pola") Then Controls.Remove(tekst) Controls.Remove(guzik_45) co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf 'Przycisk 6 - rysowanie linii prostej If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 300 and y_po_nac < 340) Then GraphicsWindow.MouseDown = Rysowanie_linii_1 EndIf Sub Rysowanie_linii_1 'Shapes.SetText(podpowiedzi,"Naciśnij dowolny przycisk myszy.") X1_linia = GraphicsWindow.MouseX Y1_linia = GraphicsWindow.MouseY rysowanie_linii_n = 1 EndSub If(rysowanie_linii_n = 1) Then GraphicsWindow.MouseDown = Rysowanie_linii_2 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt z którego ma się zaczynać linia prosta") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf Sub Rysowanie_linii_2 X2_linia = GraphicsWindow.MouseX Y2_linia = GraphicsWindow.MouseY rysowanie_linii_n = 2 GraphicsWindow.MouseDown = Rysowanie_linii_3 EndSub If (rysowanie_linii_n = 2) Then GraphicsWindow.MouseDown = Rysowanie_linii_3 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt końcowy linii prostej.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf Sub Rysowanie_linii_3 X3_linia = GraphicsWindow.MouseX Y3_linia = GraphicsWindow.MouseY GraphicsWindow.DrawLine(X3_linia,Y3_linia,X2_linia,Y2_linia) rysowanie_linii_n = 0 Shapes.SetText(podpowiedzi,"") GraphicsWindow.MouseDown = MouseDown x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndSub 'Przycisk 7 - rysowanie prostokątów pustych w środku If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 350 and y_po_nac < 390) Then co_robić = "ProstokP" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "ProstokP") Then GraphicsWindow.MouseDown = prostokP_lew_gór GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować lewy-górny róg prostokąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf Sub prostokP_lew_gór x1_prostokP = GraphicsWindow.MouseX y1_prostokP = GraphicsWindow.MouseY GraphicsWindow.MouseDown = prostokP_praw_dol GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować prawy-dolny róg prostokąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub prostokP_praw_dol x2_prostokP_1 = GraphicsWindow.MouseX y2_prostokP_1 = GraphicsWindow.MouseY GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki szer_prostokP = x2_prostokP_1 - x1_prostokP wys_prostokP = y2_prostokP_1 - y1_prostokP co_robić = "rys_prostok" EndSub If (co_robić = "rys_prostok") Then GraphicsWindow.DrawRectangle(x1_prostokP,y1_prostokP,szer_prostokP,wys_prostokP) co_robić = 0 GraphicsWindow.MouseDown = MouseDown EndIf 'Przycisk 8 - rysowanie kół pustych w środku If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 350 and y_po_nac < 390) Then co_robić = "KołoP" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "KołoP") Then GraphicsWindow.MouseDown = kołoP_lew_gór co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować lewy-górny róg elipsy.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf Sub kołoP_lew_gór x1_kołoP = GraphicsWindow.MouseX y1_kołoP = GraphicsWindow.MouseY GraphicsWindow.MouseDown = kołoP_praw_dol GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować prawy-dolny róg elipsy.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub kołoP_praw_dol x2_kołoP_1 = GraphicsWindow.MouseX y2_kołoP_1 = GraphicsWindow.MouseY GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki szer_kołoP = x2_kołoP_1 - x1_kołoP wys_kołoP = y2_kołoP_1 - y1_kołoP co_robić = "rys_kołoP" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.MouseDown = MouseDown EndSub If (co_robić = "rys_kołoP") Then GraphicsWindow.DrawEllipse(x1_kołoP,y1_kołoP,szer_kołoP,wys_kołoP) co_robić = 0 EndIf 'Przycisk 9 - rysowanie trokątów pustych w środku If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 350 and y_po_nac < 390) Then co_robić = "TrójP" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "TrójP") Then GraphicsWindow.MouseDown = trójP_1 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować pierwszy wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf Sub trójP_1 x1_trójP = GraphicsWindow.MouseX y1_trójP = GraphicsWindow.MouseY GraphicsWindow.MouseDown = trójP_2 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować drugi wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub trójP_2 x2_trójP = GraphicsWindow.MouseX y2_trójP = GraphicsWindow.MouseY GraphicsWindow.MouseDown = trójP_3 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować trzeci wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub trójP_3 x3_trójP = GraphicsWindow.MouseX y3_trójP = GraphicsWindow.MouseY GraphicsWindow.MouseDown = MouseDown GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = "TrójP_rys" EndSub If (co_robić = "TrójP_rys") Then GraphicsWindow.DrawTriangle(x1_trójP,y1_trójP,x2_trójP,y2_trójP,x3_trójP,y3_trójP) co_robić = 0 EndIf 'Przycisk 10 - rysowanie prostokątów wypełnionych If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 400 and y_po_nac < 440) Then co_robić = "ProstokW" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "ProstokW") Then GraphicsWindow.MouseDown = prostokW_lew_gór GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować lewy-górny róg prostokąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf Sub prostokW_lew_gór x1_prostokW = GraphicsWindow.MouseX y1_prostokW = GraphicsWindow.MouseY GraphicsWindow.MouseDown = prostokW_praw_dol GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować prawy-dolny róg prostokąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub prostokW_praw_dol x2_prostokW_1 = GraphicsWindow.MouseX y2_prostokW_1 = GraphicsWindow.MouseY GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki szer_prostokW = x2_prostokW_1 - x1_prostokW wys_prostokW = y2_prostokW_1 - y1_prostokW co_robić = "rys_prostokW" EndSub If (co_robić = "rys_prostokW") Then GraphicsWindow.FillRectangle(x1_prostokW,y1_prostokW,szer_prostokW,wys_prostokW) co_robić = 0 GraphicsWindow.MouseDown = MouseDown EndIf 'Przycisk 11 - rysowanie kół wypełnionych If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 400 and y_po_nac < 440) Then co_robić = "KołoW" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "KołoW") Then GraphicsWindow.MouseDown = kołoW_lew_gór co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować lewy-górny róg elipsy.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf Sub kołoW_lew_gór x1_kołoW = GraphicsWindow.MouseX y1_kołoW = GraphicsWindow.MouseY GraphicsWindow.MouseDown = kołoW_praw_dol GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować prawy-dolny róg elipsy.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub kołoW_praw_dol x2_kołoW_1 = GraphicsWindow.MouseX y2_kołoW_1 = GraphicsWindow.MouseY GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki szer_kołoW = x2_kołoW_1 - x1_kołoW wys_kołoW = y2_kołoW_1 - y1_kołoW co_robić = "rys_kołoW" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub If (co_robić = "rys_kołoW") Then 'GraphicsWindow.FillEllipse(x1_kołoW,y1_kołoW,szer_kołoW,wys_kołoW) GraphicsWindow.FillEllipse(x1_kołoW,y1_kołoW,szer_kołoW,wys_kołoW) co_robić = 0 GraphicsWindow.MouseDown = MouseDown EndIf 'Przycisk 12 - rysowanie trójkątów wypełnionych If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 400 and y_po_nac < 440) Then co_robić = "TrójW" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "TrójW") Then GraphicsWindow.MouseDown = trójW_1 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować pierwszy wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf Sub trójW_1 x1_trójW = GraphicsWindow.MouseX y1_trójW = GraphicsWindow.MouseY GraphicsWindow.MouseDown = trójW_2 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować drugi wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub trójW_2 x2_trójW = GraphicsWindow.MouseX y2_trójW = GraphicsWindow.MouseY GraphicsWindow.MouseDown = trójW_3 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt w którym ma się znajdować trzeci wierzchołek trójkąta.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub Sub trójW_3 x3_trójW = GraphicsWindow.MouseX y3_trójW = GraphicsWindow.MouseY GraphicsWindow.MouseDown = MouseDown GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = "TrójW_rys" EndSub If (co_robić = "TrójW_rys") Then GraphicsWindow.FillTriangle(x1_trójW,y1_trójW,x2_trójW,y2_trójW,x3_trójW,y3_trójW) co_robić = 0 EndIf 'Przycisk 13 - sprawdź kolor określonego piksela If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 450 and y_po_nac < 490) Then co_robić = "kol_pik" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "kol_pik") Then GraphicsWindow.MouseDown = kol_pik_2 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt, którego kolor ma zostać pobrany.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf Sub kol_pik_2 pik_x = GraphicsWindow.MouseX pik_y = GraphicsWindow.MouseY GraphicsWindow.MouseDown = MouseDown co_robić = "Pob_pik" EndSub If (co_robić = "Pob_pik") Then zap_kolor = GraphicsWindow.GetPixel(pik_x,pik_y) co_robić = "Pob_pik_2" EndIf If (co_robić = "Pob_pik_2") Then GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "#2F4F4F" Shapes.SetText(Pokaż_zap_kolor,"Zapisany kolor : " + zap_kolor) GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf 'Przycisk 14 - koloruj określony piksel If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 450 and y_po_nac < 490) Then co_robić = "pob_kol_pik" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"W oknie tekstowym podaj kolor piksela") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf If (co_robić = "pob_kol_pik") Then TextWindow.Show() TextWindow.Title = "Piksel" TextWindow.WriteLine("Podaj kolor piksela") podaj_kol_piksela = TextWindow.Read() TextWindow.Hide() co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij w oknie graficznym piksel, który ma zostać pokolorowany.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.MouseDown = kol_piksel EndIf Sub kol_piksel pik_x_2 = GraphicsWindow.MouseX pik_y_2 = GraphicsWindow.MouseY co_robić = "kol_pik_2" EndSub If (co_robić = "kol_pik_2") Then GraphicsWindow.SetPixel(pik_x_2,pik_y_2,podaj_kol_piksela) co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf 'Przycisk 15 - ołówek If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 450 and y_po_nac < 490) Then co_robić = "ołówek1" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij lewy przycisk myszy aby rysować. Naciśnij dowolny klawisz na klawiaturze, aby przestać.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndIf If (co_robić = "ołówek1") Then co_robić = 0 czy_rysować = 1 EndIf If (czy_rysować = 1) Then GraphicsWindow.MouseMove = OnMouseMove2 GraphicsWindow.MouseDown = OnMouseDown2 GraphicsWindow.KeyDown = stop EndIf Sub OnMouseDown2 prevX = GraphicsWindow.MouseX prevY = GraphicsWindow.MouseY EndSub Sub OnMouseMove2 x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown) Then GraphicsWindow.DrawLine(prevX, prevY, x, y) EndIf prevX = x prevY = y EndSub Sub stop czy_rysować = 0 GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseMove = mysz_przesunięta GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki EndSub 'Przycisk 16 - zmiana tytułu obrazu If(x_po_nac > 610 and x_po_nac < 650 and y_po_nac > 500 and y_po_nac < 540) Then co_robić = "tytuł" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "tytuł") Then TextWindow.Show() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"W oknie tekstowym, podaj jaki ma być tytuł Twojego arcydzieła") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki TextWindow.WriteLine("Podaj tytuł Twojego rysunku :") tytuł_rysunku = TextWindow.Read() GraphicsWindow.Title = "Kenexer 2 | " + tytuł_rysunku TextWindow.Hide() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf 'Przycisk 17 - wczytywanie obrazu If(x_po_nac > 660 and x_po_nac < 700 and y_po_nac > 500 and y_po_nac < 540) Then co_robić = "wczyt_1" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "wczyt_1") Then co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Podaj bezpośrednią ścieżkę do obrazka na komputerze lub serwerze. Gdy już to zrobisz, naciśnij przycisk wczytaj.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.FontSize = 13 wczytywacz = Controls.AddTextBox(50,615) Controls.SetSize(wczytywacz,400,25) guz_wczyt = Controls.AddButton("Wczytaj",480,615) GraphicsWindow.FontSize = rozmiar_czcionki Controls.ButtonClicked = wczytywanie EndIf Sub wczytywanie GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt na którym ma się znajdować lewy-górny róg obrazka.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.MouseDown = wczytywanie2 ścieżka = Controls.GetTextBoxText(wczytywacz) EndSub Sub wczytywanie2 wczyt_x = GraphicsWindow.MouseX wczyt_y = GraphicsWindow.MouseY co_robić = "wczytywanie3" GraphicsWindow.MouseDown = MouseDown EndSub If (co_robić = "wczytywanie3") Then GraphicsWindow.DrawImage(ścieżka,wczyt_x,wczyt_y) Controls.Remove(wczytywacz) Controls.Remove(guz_wczyt) GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf 'Przycisk 18 - wczytywanie obrazu ze zmienionymi rozmiarami If(x_po_nac > 710 and x_po_nac < 750 and y_po_nac > 500 and y_po_nac < 540) Then co_robić = "wczyt_2" x_po_nac = 0 x_po_nac = 0 y_po_nac = 0 y_po_nac = 0 EndIf If (co_robić = "wczyt_2") Then co_robić = 0 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Podaj bezpośrednią ścieżkę do obrazka na komputerze lub serwerze. Gdy już to zrobisz, naciśnij przycisk wczytaj.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.FontSize = 13 wczytywacz = Controls.AddTextBox(50,615) Controls.SetSize(wczytywacz,400,25) guz_wczyt = Controls.AddButton("Wczytaj",480,615) GraphicsWindow.FontSize = rozmiar_czcionki Controls.ButtonClicked = wczytywanie_2 EndIf Sub wczytywanie_2 GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"W oknie tekstowym podaj szerokość i wysokość obrazka.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki TextWindow.Show() TextWindow.Title = "Rozmiar wczytywanego obrazka" TextWindow.WriteLine("Podaj szerokość obrazka") szer_ob = TextWindow.ReadNumber() TextWindow.WriteLine("Podaj wysokość obrazka") wys_ob = TextWindow.ReadNumber() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"Naciśnij punkt na którym ma się znajdować lewy-górny róg obrazka.") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki GraphicsWindow.MouseDown = wczytywanie2_2 ścieżka = Controls.GetTextBoxText(wczytywacz) EndSub Sub wczytywanie2_2 wczyt_x = GraphicsWindow.MouseX wczyt_y = GraphicsWindow.MouseY co_robić = "wczytywanie3_2" GraphicsWindow.MouseDown = MouseDown EndSub If (co_robić = "wczytywanie3_2") Then GraphicsWindow.DrawResizedImage(ścieżka,wczyt_x,wczyt_y,szer_ob,wys_ob) Controls.Remove(wczytywacz) Controls.Remove(guz_wczyt) GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "green" Shapes.SetText(podpowiedzi,"") GraphicsWindow.BrushColor = Kolor_pędzla GraphicsWindow.FontSize = rozmiar_czcionki co_robić = 0 EndIf 'MouseDown Sub MouseDown x_po_nac = GraphicsWindow.MouseX y_po_nac = GraphicsWindow.MouseY EndSub Sub mysz_przesunięta Współrzędna_myszki_x = GraphicsWindow.MouseX Współrzędna_myszki_y = GraphicsWindow.MouseY Shapes.SetText(Współrzędna_myszki_x_pole,"X = " + GraphicsWindow.MouseX) Shapes.SetText(Współrzędna_myszki_y_pole,"Y = " + GraphicsWindow.MouseY) EndSub Goto narazie_tutaj End>VDL527.sb< Start>VDM030.sb< ' SmallBasic Version 1.2 ' Program: HSL-HSV/HSB (Color Conversions) Forum ' Changelog: 16.5 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/85911319-9ced-438e-9af4-d4ac1e9e9d12/small-basic-graphic-and-animations-and-more-2 ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: http://lodev.org/cgtutor/examples.html (QuickCG Functions) ' http://lodev.org/cgtutor/color.html (Light and Color) ' ' KEYS: C .. Copy ColorValues to Clipboard; S .. Save PaletteImage (again); ESC .. Exit ' Variables: ' ToDo: ' ================================================================================ gw = 360 gh = 256 args = "" crlf = Text.GetCharacter(13) + Text.GetCharacter(10) ' The following line could be harmful and has been automatically commented. ' 'selfImgPath = LDRegex.Replace(File.GetSettingsFilePath(), ".settings",".png", "") '' ALTERNAT1 ' The following line could be harmful and has been automatically commented. ' 'selfImgPath = LDText.Replace(File.GetSettingsFilePath(), ".settings",".png") '' ALTERNAT1 ' The following line could be harmful and has been automatically commented. ' selfImgPath = Program.Directory +"\"+ LDFile.GetFile(File.GetSettingsFilePath()) +".png" GraphicsWindow.Width = 2*gw GraphicsWindow.Height = gh GraphicsWindow.Title = "HSL vs HSV" LDGraphicsWindow.Icon = Program.Directory +"\Icons\HSL-HSV.ico" '' Try to load selfImgPath, if it's there with correct dimensions and use that, else DrawImage and SaveImage for future use. ' The following line could be harmful and has been automatically commented. ' If ImageList.GetWidthOfImage(selfImgPath) = 2*gw And ImageList.GetHeightOfImage(selfImgPath) = gh Then ' And LDFile.Exists(selfImgPath) GraphicsWindow.DrawImage(selfImgPath, 0,0) 'LDGraphicsWindow.BackgroundImage(selfImgPath) '' ALTERNAT2 done = "True" Else DrawImage() If done Then SaveImage() EndIf EndIf LDCursors.Cross() GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown ' ////////// SUBs \\\\\\\\\\ Sub DrawImage For x = 0 To gw-1 For y = 0 To gh-1 'col = HSLtoRGB(ColorHSL(x, 255, y)) '' convert color "hue=x, saturation=255, lightness=y" to RGB; HSL 0,0,0 - 360,100,255 col = LDColours.HSLtoRGB(x, 1, y/gh) GraphicsWindow.SetPixel(x, gh-1 -y, col) '' plot a pixel from the HSL model 'col = HSVtoRGB(ColorHSV(x,255, y)) '' convert color "hue=x, saturation=255, value=y" to RGB; HSV 0,0,0 - 360,100,255 col = LDCall.Function3("HSVtoRGB", x, 1, y/gh) GraphicsWindow.SetPixel(x+gw, gh-1 -y, col) '' plot a pixel from the HSV model EndFor EndFor done = "True" EndSub '' https://en.wikipedia.org/wiki/HSL_and_HSV '' http://www.codeproject.com/Articles/19045/Manipulating-colors-in-NET-Part (HSB to RGB) Sub HSVtoRGB ' (h, s, v) [0,360] [0,1] [0,1] -> #RRGGBB r = 0 g = 0 b = 0 If args[2] = 0 Then r = args[3] g = args[3] b = args[3] Else sectPos = args[1] / 60 sectNum = Math.Floor(sectPos) fractSect = sectPos - sectNum p = args[3] * (1 - args[2]) q = args[3] * (1 - fractSect * args[2]) t = args[3] * (1 - (args[2] * (1 - fractSect))) If sectNum = 0 Then r = args[3] g = t b = p ElseIf sectNum = 1 Then r = q g = args[3] b = p ElseIf sectNum = 2 Then r = p g = args[3] b = t ElseIf sectNum = 3 Then r = p g = q b = args[3] ElseIf sectNum = 4 Then r = t g = p b = args[3] ElseIf sectNum = 5 Then r = args[3] g = p b = q EndIf EndIf return = GraphicsWindow.GetColorFromRGB(255*r, 255*g, 255*b) EndSub Sub GetValue ' /Brightness r = LDColours.GetRed(col) g = LDColours.GetGreen(col) b = LDColours.GetBlue(col) min = Math.Min(r, Math.Min(g, b)) v = 2 * LDColours.GetLightness(col) - min/255 EndSub Sub SaveImage 'imgShot = LDGraphicsWindow.Capture("","") LDImage.SaveAs(LDGraphicsWindow.Capture("",""), selfImgPath) ' imgShot, selfImgPath) GraphicsWindow.ShowMessage("Palette image saved for future use:"+ crlf + selfImgPath, "Palette SAVED") EndSub ' ////////// EVENTs \\\\\\\\\\ Sub OnMouseDown If done Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY col = GraphicsWindow.GetPixel(mx,my) 'col = LDGraphicsWindow.GetPixel(mx,my) '' ALTERNAT2 GetValue() h = Math.Round(100 * LDColours.GetHue(col)) / 100 s = Math.Round(100 * LDColours.GetSaturation(col)) / 100 l = Math.Round(100 * LDColours.GetSaturation(col)) / 100 v = Math.Round(100 * v) / 100 hsl = h +", "+ s +", "+ l hsv = h +", "+ s +", "+ v rgb = r +", "+ g +", "+ b 'rgb = LDColours.GetRed(col) +","+ LDColours.GetGreen(col) +","+ LDColours.GetBlue(col) 'GraphicsWindow.Title = "HSL: "+ hsl +" | HSV: "+ hsv +" | RGB: "+ rgb +" | HEX: "+ col title = "HSL: "+ hsl +" | HSV: "+ hsv +" | RGB: "+ rgb +" | HEX: "+ col GraphicsWindow.Title = title If Mouse.IsRightButtonDown Then CopyValues() EndIf EndIf EndSub Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "S" And done Then SaveImage() ElseIf lastKey = "C" And rgb <> "" Then CopyValues() EndIf EndSub Sub CopyValues 'vals = "HSL: "+ hsl + crlf +"HSV: "+ hsv + crlf +"RGB: "+ rgb + crlf +"HEX: "+ col vals = LDText.Replace(title, " | ", crlf) LDClipboard.SetText(vals) EndSub End>VDM030.sb< Start>VDN421.sb< ' Ferris Wheel ' Version 0.1 ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Challenge 2016-05 ' title = "Ferris Wheel" GraphicsWindow.Title = title ems = Clock.ElapsedMilliseconds Form() ms = 100 Timer.Interval = ms Timer.Tick = OnTick Sub OnTick da = da + 2 * Math.Pi / (60000 / ms) op = (1 - Math.Cos(da)) / 2 Shapes.SetOpacity(sky, op * 100) For i = 1 To n a = i * 2 * Math.Pi / n + da x = x1 + r * Math.Sin(a) y = y1 - r * Math.Cos(a) + r2 Shapes.Move(gondola[i], x - (r2 + w / 2), y - (r2 + w / 2)) EndFor For i = 1 To n / 2 a = i * 2 * Math.Pi / n + da Shapes.Rotate(beam[i], Math.GetDegrees(a)) EndFor EndSub Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "SkyBlue" x1 = gw / 2 y1 = gh / 2 x2 = x1 - 50 y2 = gh - 15 x3 = x1 + 50 y3 = y2 r = 160 n = 12 ' even number r2 = 20 w = 4 GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Black" sky = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(sky, 0) GraphicsWindow.BrushColor = "DimGray" ground = Shapes.AddRectangle(gw, gh - y2) Shapes.Move(ground, 0, y2) GraphicsWindow.PenWidth = w GraphicsWindow.PenColor = "#CC0000" GraphicsWindow.BrushColor = "#00000000" For i = 1 To n gondola[i] = Shapes.AddEllipse(2 * r2, 2 * r2) a = i * 2 * Math.Pi / n x = x1 + r * Math.Sin(a) y = y1 - r * Math.Cos(a) + r2 Shapes.Move(gondola[i], x - (r2 + w / 2), y - (r2 + w / 2)) EndFor GraphicsWindow.PenColor = "White" Shapes.AddTriangle(x1, y1, x2, y2, x3, y3) wheel = Shapes.AddEllipse(2 * (r + w / 2), 2 * (r + w / 2)) Shapes.Move(wheel, x1 - (r + w / 2), y1 - (r + w / 2)) sqrt2 = Math.SquareRoot(2) For i = 1 To n / 2 a = i * 2 * Math.Pi / n beam[i] = Shapes.AddLine(0, 0, 0, 2 * r) Shapes.Move(beam[i], x1, y1 - r) Shapes.Rotate(beam[i], Math.GetDegrees(a)) EndFor EndSub End>VDN421.sb< Start>VDP129.sb< GraphicsWindow.BackgroundColor = "Black" x = 100 y = 100 For i = 1 To 100000 r = Math.GetRandomNumber(3) ux = 150 uy = 30 If (r = 1) then ux = 30 uy = 1000 EndIf If (r = 2) Then ux = 1000 uy = 1000 EndIf x = (x + ux) / 2 y = (y + uy) / 2 GraphicsWindow.SetPixel(x, y, "LightGreen") EndFor End>VDP129.sb< Start>VDQ130.sb< 'simple digital clock with sundial clock ' december 2016 challenge smal basic ' program by yled ' program no : THP418 GraphicsWindow.Top = 0 GraphicsWindow.left=0 GraphicsWindow.width=700 GraphicsWindow.height=700 draw_hour() GraphicsWindow.BrushColor = "#888899" GraphicsWindow.fontname= "IMPACT" GraphicsWindow.FontSize = 55 time_text = Shapes.AddText("") Shapes.Move(time_text,400,275) Timer.Tick = OnTick Timer.Interval = 1000 Sub OnTick Tm = Clock.Time Shapes.SetText(time_text,Tm) h=clock.Hour m=clock.Minute sundial() EndSub Sub sundial ' a midi le triangle devient un ligne ( 200:600) m=m/60*100 h=h+m/100 hx = Math.Power(h,2.25) hy=600 GraphicsWindow.DrawTriangle(200,50,200,350,hx,hy) GraphicsWindow.penColor = "#888899" GraphicsWindow.FillTriangle(200,50,200,350,hx,hy) EndSub Sub draw_hour GraphicsWindow.FontName="sylfaen" GraphicsWindow.fontsize="25" GraphicsWindow.BrushColor="black" t15 = Shapes.AddText("Ш") Shapes.Move(t15,440,610) T14 = Shapes.AddText("П") Shapes.Move(t14,380,610) T13 = Shapes.AddText("І") Shapes.Move(t13,320,610) T12 = Shapes.AddText("ХП") Shapes.Move(t12,255,610) T11 = Shapes.AddText("ХІ") Shapes.Move(t11,210,610) T10 = Shapes.AddText("Х") Shapes.Move(t10,170,610) T9 = Shapes.AddText("ІХ") Shapes.Move(t9,125,610) EndSub End>VDQ130.sb< Start>VDQ487-0.sb< '3.Now add friction/drag to this. 'http://smallbasic.com/program/?VDQ487-0 'https://www.grc.nasa.gov/www/k-12/airplane/falling.html 'Gravity is the downward force. It causes the speed to increase as it falls. 'As objects fall they meet wind resistance (drag). As the speed down increases ' the Drag increases. 'INITIALISE (setup) GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "Blue" ballSize = 30 ball = Shapes.AddEllipse(ballSize, ballSize) X = GraphicsWindow.Width / 2 - ballSize / 2 dY = 0 'No speed yet, standing start weight = 0.4 'Gravity drag = 0 '=================================================== 'GAME LOOP While 0=0 'Update Game drag = (dY*dY) * 0.01 F = weight - drag dY = dY + F Y = Y + dY 'UpdateFrame Shapes.Move(ball, X, Y) FrameRate() EndWhile '=================================================== 'SUBROUTINES Sub FrameRate delay = Clock.ElapsedMilliseconds - start If 15 - delay > 0 Then Program.Delay(15 - delay) EndIf start = Clock.ElapsedMilliseconds EndSub End>VDQ487-0.sb< Start>VDS895.sb< Controls.ButtonClicked = OnButtonClicked Init() LDControls.DataViewReadFromCSV(DV, "E:\Buchung/Buchung.csv", "False") Ende = 0 While Ende = 0 If BC = 1 Then LDControls.DataViewSaveAsCSV(DV, "E:\Buchung/Buchung.csv", "False") Program.End() EndIf EndWhile Sub OnButtonClicked BC = 1 EndSub 'OnButtonClicked Sub Init 'GraphicsWindow DTW = Desktop.Width DTH = Desktop.Height GWW = DTW - 10 GWH = DTH - 71 GWT = 0 GWL = -10 GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH GWFN = "Consolas" GWFS = 14 GraphicsWindow.FontName = GWFN GraphicsWindow.FontSize = GWFS BD = " Datum " BB = " € Betrag " BK = " Konto " BGK = " Gegenkonto " BT = "...............Buchungstext..............." headings[1] = BD headings[2] = BB headings[3] = BK headings[4] = BGK headings[5] = BT DV = LDControls.AddDataView(DTW -100, DTH - 200, headings) Shapes.Move(DV, 10, 30) K[1] = "10" KT[1] = "Kasse" K[2] = "12" KT[2] = "Bank" K[3] = "13" KT[3] = "Geldtransit" K[4] = "14" KT[4] = "Forderungen" K[5] = "16" KT[5] = "Verbindlichkeiten" K[6] = "40" KT[6] = "Lebensmittel" K[7] = "41" KT[7] = "Kleidung" K[8] = "45" KT[8] = "Fahrzeuge" K[9] = "49" KT[9] = "sonstige Kosten" K[10] = "80" KT[10] = "Einnahmen" For i = 1 To 10 KUT[i] = K[i] + " = " + KT[i] EndFor LDControls.DataViewSetColumnComboBox(DV,3,KUT) LDControls.DataViewSetColumnComboBox(DV,4,KUT) LDControls.DataViewColumnWidths(DV,"") LDControls.DataViewColAlignment(DV,2,"Right") Save = Controls.AddButton("Speichern", 10, DTH - 100) EndSub 'Init End>VDS895.sb< Start>VDV774.sb< ' Rotating ellipse using GraphicsWindow.DrawLine command ' (x-x0)^2/a^2+(y-y0)^2/b^2=1 ellipse PW=4 GraphicsWindow.PenColor="Red" GraphicsWindow.PenWidth=PW x0=200 y0=150 a=100 ' width b=60 ' height For x= -a To a y1=b*math.SquareRoot(1-X*X/a/a) y2=-y1 GraphicsWindow.DrawLine(x0+x,y1+y0,x0+x,y2+y0) EndFor X0=450 GraphicsWindow.BrushColor="white" While "True" angle=angle+5 rad= Math.GetRadians(angle) GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor() rotate_ellipse() Program.Delay(500) GraphicsWindow.FillRectangle(x0-a-PW,y0-a-PW,2*(a+PW),2*(a+PW)) endwhile Sub rotate_ellipse For x= -a To a y1=b*math.SquareRoot(1-X*X/a/a) y2=-y1 NewY1=x*math.Sin(rad)+y1*math.Cos(rad) NewY2=x*math.Sin(rad)+y2*math.Cos(rad) NewX1= x*math.Cos(rad)-y1*math.sin(rad) NewX2= x*math.Cos(rad)-y2*math.sin(rad) GraphicsWindow.DrawLine(x0+NewX1,y0+NewY1,x0+NewX2,y0+NewY2) EndFor EndSub End>VDV774.sb< Start>VDW132.sb< args=0 For m=1 To 15 app2="" l=Text.GetLength(a) For n=l To 1 Step -1 app=Text.GetSubText(a, n, 1) If app="R" Then app="L" Else app="R" EndIf app2=app2+app EndFor a=a+"R"+app2 EndFor GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.width=900 GraphicsWindow.Height=900 GraphicsWindow.Top=0 GraphicsWindow.Left=0 t_x=350 t_y=t_x+200 t_Angle =t_Angle +90 For n=1 To Text.GetLength(a) For r=1 To 5 d = Text.GetSubText(a, n, 1) If d="R" Then t_Angle =t_Angle +(18) Else t_Angle =t_Angle -18 EndIf ldcall.Function ("t_Move",0.4) GraphicsWindow.BrushColor =LDColours.HSLtoRGB (cc,1,0.5) cc=cc+.001 GraphicsWindow.FillEllipse (T_x, t_y 2 2) endfor endfor sub t_Move ds=args[1] mm=LDMath.Convert2Cartesian (t_x,t_y,ds, t_Angle-90 ) t_x= (mm[1]) t_y= (mm[2]) EndSub End>VDW132.sb< Start>VDX656.sb< Text = "Hallo Carmenello" GraphicsWindow.show() GraphicsWindow.FontBold = "False" X = 10 y = 10 GraphicsWindow.DrawText(x,y,Text) y = 40 GraphicsWindow.FontSize = 40 GraphicsWindow.DrawText(x,y,Text) y = 100 GraphicsWindow.FontSize = 24 GraphicsWindow.FontBold = "True" GraphicsWindow.DrawText(x,y,Text) y = 160 GraphicsWindow.FontName = "Consolas" GraphicsWindow.DrawText(x,y,Text) y = 220 GraphicsWindow.FontItalic = "True" GraphicsWindow.DrawText(x,y,Text) End>VDX656.sb< Start>VFC190.sb< ' Cherry 0.1 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 03/04/2013 Created. ' GraphicsWindow.Title = "Cherry 0.1" Colors_Init() param = "x=0;y=0;angle=90;0=SkyBlue;70=Gray;100=DimGray;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height FillLinearGradientRectangle() GraphicsWindow.BrushColor = "Pink" GraphicsWindow.PenWidth = 0 width = 7 height = 5 w2 = width / 2 h2 = height / 2 r = 5 While "True" AddCherry() EndWhile Sub AddCherry x = Math.GetRandomNumber(param["width"]) y = Math.GetRandomNumber(param["height"]) angle = Math.GetRandomNumber(360) For i = 1 To 5 degree = -i * 360 / 5 + angle radian = Math.GetRadians(degree) obj = Shapes.AddEllipse(width, height) Shapes.Move(obj, x + r * Math.Cos(radian) - w2, y + r * Math.Sin(radian) - h2) Shapes.Rotate(obj, degree) EndFor EndSub Sub FillLinearGradientRectangle ' param["x"], param["y"] - position of the rectangle ' param["width"], param["height"] - size of the rectangle ' param["angle"] - angle of gradient ' param["0"]..param["100"] - 0% to 100% colors x0 = param["x"] y0 = param["y"] width = param["width"] height = param["height"] angle = param["angle"] n = Array.GetItemCount(param) index = Array.GetAllIndices(param) color = "" For i = 1 To n If index[i] + 0 = index[i] And 0 <= index[i] And index[i] <= 100 Then color[index[i]] = param[index[i]] EndIf EndFor If color[0] = "" Then color[0] = GraphicsWindow.BrushColor EndIf If color[100] = "" Then color[100] = GraphicsWindow.BrushColor EndIf n = Array.GetItemCount(color) index = Array.GetAllIndices(color) a45 = Math.Remainder(angle, 45) If 0 <= angle And angle < 45 Then w45 = width h45 = height ElseIf 45 <= angle And angle < 90 Then w45 = height h45 = width a45 = 45 - a45 ElseIf 90 <= angle And angle < 135 Then w45 = height h45 = width ElseIf 135 <= angle And angle < 180 Then w45 = width h45 = height a45 = 45 - a45 ElseIf 180 <= angle And angle < 225 Then w45 = width h45 = height ElseIf 225 <= angle And angle < 270 Then w45 = height h45 = width a45 = 45 - a45 ElseIf 270 <= angle And angle < 315 Then w45 = height h45 = width ElseIf 315 <= angle And angle < 360 Then w45 = width h45 = height a45 = 45 - a45 EndIf If a45 = 0 Then For x = 0 To w45 percent = Math.Floor(x * 100 / w45) Color_PercentToRGB() x1 = x y1 = 0 x2 = x y2 = h45 DrawLine() EndFor ElseIf 0 < a45 And a45 <= 45 Then tan = Math.Tan(Math.GetRadians(a45)) If h45 <= w45 Then dx = Math.Floor(h45 * tan) For x = 0 To dx percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = 0 y2 = Math.Floor(x / tan) DrawLine() EndFor For x = dx To w45 percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = x - dx y2 = h45 DrawLine() EndFor For x = w45 To w45 + dx percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x - dx y1 = h45 x2 = w45 y2 = Math.Floor((x - w45) / tan) DrawLine() EndFor Else ' width < height dx = Math.Floor(h45 * tan - w45) dy = Math.Floor(w45 / tan) For x = 0 To w45 percent = Math.Floor(x * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = 0 y2 = Math.Floor(x / tan) DrawLine() EndFor For x = 0 To dx percent = Math.Floor((x + w45) * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = w45 y1 = Math.Floor(x / tan) x2 = 0 y2 = y1 + dy DrawLine() EndFor dy = h45 - Math.Floor(w45 / tan) For x = 0 To w45 percent = Math.Floor((x + w45 + dx) * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = x y1 = h45 x2 = w45 y2 = dy + Math.Floor(x / tan) DrawLine() EndFor EndIf EndIf EndSub Sub DrawLine ' param r, g, b - red, green blue ' param angle ' param x1, y1, x2, y2 - edges of line GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) If 0 <= angle And angle < 45 Then GraphicsWindow.DrawLine(x1 + x0, y1 + y0, x2 + x0, y2 + y0) ElseIf 45 <= angle And angle < 90 Then GraphicsWindow.DrawLine(y1 + x0, x1 + y0, y2 + x0, x2 + y0) ElseIf 90 <= angle And angle < 135 Then GraphicsWindow.DrawLine(-y1 + x0 + width, x1 + y0, -y2 + x0 + width, x2 + y0) ElseIf 135 <= angle And angle < 180 Then GraphicsWindow.DrawLine(-x1 + x0 + width, y1 + y0, -x2 + x0 + width, y2 + y0) ElseIf 180 <= angle And angle < 225 Then GraphicsWindow.DrawLine(-x1 + x0 + width, -y1 + y0 + height, -x2 + x0 + width, -y2 + y0 + height) ElseIf 225 <= angle And angle < 270 Then GraphicsWindow.DrawLine(-y1 + x0 + width, -x1 + y0 + height, -y2 + x0 + width, -x2 + y0 + height) ElseIf 270 <= angle And angle < 315 Then GraphicsWindow.DrawLine(y1 + x0, -x1 + y0 + height, y2 + x0, -x2 + y0 + height) ElseIf 315 <= angle And angle < 360 Then GraphicsWindow.DrawLine(x1 + x0, -y1 + y0 + height, x2 + x0, -y2 + y0 + height) EndIf EndSub Sub Color_PercentToRGB ' Color | Convert Percent to RGB ' param percent - percent ' param color[] - color table indexed percent ' param n - item count of color[] ' param index[] - all indices of color[] For i = 1 To n p1 = index[i] If index[i] = percent Then p2 = index[i] i = n + 1 ' break ElseIf index[i] < percent And percent < index[i + 1] Then p2 = index[i + 1] i = n + 1 ' break EndIf EndFor c = color[p1] Color_ColorToRGB() If p1 <> p2 Then r1 = r g1 = g b1 = b c = color[p2] Color_ColorToRGB() r2 = r g2 = g b2 = b r = Math.Floor(r1 + (r2 - r1) * (percent - p1) / (p2 - p1)) g = Math.Floor(g1 + (g2 - g1) * (percent - p1) / (p2 - p1)) b = Math.Floor(b1 + (b2 - b1) * (percent - p1) / (p2 - p1)) EndIf EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param c - color ' returns r, g, b - red, green and blue values If Text.StartsWith(c, "#") Then c = Text.ConvertToUpperCase(c) Else c = Text.ConvertToLowerCase(c) c = colors[c] EndIf sHex = Text.GetSubText(c, 2, 2) Math_Hex2Dec() r = iDec sHex = Text.GetSubText(c, 4, 2) Math_Hex2Dec() g = iDec sHex = Text.GetSubText(c, 6, 2) Math_Hex2Dec() b = iDec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' returns iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub Sub Colors_Init colors["aliceblue"]="#F0F8FF" colors["antiquewhite"]="#FAEBD7" colors["aqua"]="#00FFFF" colors["aquamarine"]="#7FFFD4" colors["azure"]="#F0FFFF" colors["beige"]="#F5F5DC" colors["bisque"]="#FFE4C4" colors["black"]="#000000" colors["blanchedalmond"]="#FFEBCD" colors["blue"]="#0000FF" colors["blueviolet"]="#8A2BE2" colors["brown"]="#A52A2A" colors["burlywood"]="#DEB887" colors["cadetblue"]="#5F9EA0" colors["chartreuse"]="#7FFF00" colors["chocolate"]="#D2691E" colors["coral"]="#FF7F50" colors["cornflowerblue"]="#6495ED" colors["cornsilk"]="#FFF8DC" colors["crimson"]="#DC143C" colors["cyan"]="#00FFFF" colors["darkblue"]="#00008B" colors["darkcyan"]="#008B8B" colors["darkgoldenrod"]="#B8860B" colors["darkgray"]="#A9A9A9" colors["darkgreen"]="#006400" colors["darkkhaki"]="#BDB76B" colors["darkmagenta"]="#8B008B" colors["darkolivegreen"]="#556B2F" colors["darkorange"]="#FF8C00" colors["darkorchid"]="#9932CC" colors["darkred"]="#8B0000" colors["darksalmon"]="#E9967A" colors["darkseagreen"]="#8FBC8F" colors["darkslateblue"]="#483D8B" colors["darkslategray"]="#2F4F4F" colors["darkturquoise"]="#00CED1" colors["darkviolet"]="#9400D3" colors["deeppink"]="#FF1493" colors["deepskyblue"]="#00BFFF" colors["dimgray"]="#696969" colors["dodgerblue"]="#1E90FF" colors["firebrick"]="#B22222" colors["floralwhite"]="#FFFAF0" colors["forestgreen"]="#228B22" colors["fuchsia"]="#FF00FF" colors["gainsboro"]="#DCDCDC" colors["ghostwhite"]="#F8F8FF" colors["gold"]="#FFD700" colors["goldenrod"]="#DAA520" colors["gray"]="#808080" colors["green"]="#008000" colors["greenyellow"]="#ADFF2F" colors["honeydew"]="#F0FFF0" colors["hotpink"]="#FF69B4" colors["indianred"]="#CD5C5C" colors["indigo"]="#4B0082" colors["ivory"]="#FFFFF0" colors["khaki"]="#F0E68C" colors["lavender"]="#E6E6FA" colors["lavenderblush"]="#FFF0F5" colors["lawngreen"]="#7CFC00" colors["lemonchiffon"]="#FFFACD" colors["lightblue"]="#ADD8E6" colors["lightcoral"]="#F08080" colors["lightcyan"]="#E0FFFF" colors["lightgoldenrodyellow"]="#FAFAD2" colors["lightgray"]="#D3D3D3" colors["lightgreen"]="#90EE90" colors["lightpink"]="#FFB6C1" colors["lightsalmon"]="#FFA07A" colors["lightseagreen"]="#20B2AA" colors["lightskyblue"]="#87CEFA" colors["lightslategray"]="#778899" colors["lightsteelblue"]="#B0C4DE" colors["lightyellow"]="#FFFFE0" colors["lime"]="#00FF00" colors["limegreen"]="#32CD32" colors["linen"]="#FAF0E6" colors["magenta"]="#FF00FF" colors["maroon"]="#800000" colors["mediumaquamarine"]="#66CDAA" colors["mediumblue"]="#0000CD" colors["mediumorchid"]="#BA55D3" colors["mediumpurple"]="#9370DB" colors["mediumseagreen"]="#3CB371" colors["mediumslateblue"]="#7B68EE" colors["mediumspringgreen"]="#00FA9A" colors["mediumturquoise"]="#48D1CC" colors["mediumvioletred"]="#C71585" colors["midnightblue"]="#191970" colors["mintcream"]="#F5FFFA" colors["mistyrose"]="#FFE4E1" colors["moccasin"]="#FFE4B5" colors["navajowhite"]="#FFDEAD" colors["navy"]="#000080" colors["oldlace"]="#FDF5E6" colors["olive"]="#808000" colors["olivedrab"]="#6B8E23" colors["orange"]="#FFA500" colors["orangered"]="#FF4500" colors["orchid"]="#DA70D6" colors["palegoldenrod"]="#EEE8AA" colors["palegreen"]="#98FB98" colors["paleturquoise"]="#AFEEEE" colors["palevioletred"]="#DB7093" colors["papayawhip"]="#FFEFD5" colors["peachpuff"]="#FFDAB9" colors["peru"]="#CD853F" colors["pink"]="#FFC0CB" colors["plum"]="#DDA0DD" colors["powderblue"]="#B0E0E6" colors["purple"]="#800080" colors["red"]="#FF0000" colors["rosybrown"]="#BC8F8F" colors["royalblue"]="#4169E1" colors["saddlebrown"]="#8B4513" colors["salmon"]="#FA8072" colors["sandybrown"]="#F4A460" colors["seagreen"]="#2E8B57" colors["seashell"]="#FFF5EE" colors["sienna"]="#A0522D" colors["silver"]="#C0C0C0" colors["skyblue"]="#87CEEB" colors["slateblue"]="#6A5ACD" colors["slategray"]="#708090" colors["snow"]="#FFFAFA" colors["springgreen"]="#00FF7F" colors["steelblue"]="#4682B4" colors["tan"]="#D2B48C" colors["teal"]="#008080" colors["thistle"]="#D8BFD8" colors["tomato"]="#FF6347" colors["turquoise"]="#40E0D0" colors["violet"]="#EE82EE" colors["wheat"]="#F5DEB3" colors["white"]="#FFFFFF" colors["whitesmoke"]="#F5F5F5" colors["yellow"]="#FFFF00" colors["yellowgreen"]="#9ACD32" EndSub End>VFC190.sb< Start>VFC996.sb< ' Publish code: KTP276 TextWindow.WriteLine("Please enter your initial deposit:") principle = TextWindow.ReadNumber() TextWindow.WriteLine("Please enter your APR:") apr = TextWindow.ReadNumber() TextWindow.WriteLine("Please enter the number of years:") years = TextWindow.ReadNumber() futureValue = principle * Math.Power((1 + (apr * .01)), years) TextWindow.WriteLine("Your account:") TextWindow.WriteLine(" Principal: $" + principle) TextWindow.WriteLine(" Interest rate: " + apr + "%") TextWindow.WriteLine(" Number of years: " + years + " yrs") TextWindow.WriteLine(" Future Value: $" + futureValue) End>VFC996.sb< Start>VFD117.sb< 'Matts Programming Language to SmallBasic Code Interpreter 'By DaCodeDude, December 2009 'Program Variables filePath = "C:\mpl\" ' set this to the path from which you want to load the file (or leave blank and specify full path when entering filename) dQuotes = Text.GetCharacter(34) 'Code for the " character 'StartUp Window Code TextWindow.Title = "MPL to SmallBasic Code Interpreter" TextWindow.WriteLine("MPL to SmallBasic Code Interpreter by DaCodeDude") TextWindow.WriteLine("Built on some code from: 'SB Textfile Editor by Davey~Wavey 2009'") TextWindow.WriteLine("") 'Main Code----------------------------------------------------------------------------------------- TextWindow.Write("Enter name of file to load: " + filePath) fileName = TextWindow.Read() ' only attempt to open file if a filename was specified If fileName <> "" Then openFile() EndIf TextWindow.WriteLine("Interpreting code...") 'Interpreter Counting Variables lineCount = 1 lineCount2 = 0 lineCount3 = 1 numLines = Array.GetItemCount(thisFile) While numLines <> 0 'Window Commands If (thisFile[lineCount] = "windowsize") Then 'Edit size of window, Graphics window only and uses given hight and widths in pixels lineCount2 = lineCount + 1 newFile[lineCount3] = "GraphicsWindow.Height = " + thisFile[lineCount2] lineCount3 = lineCount3 + 1 lineCount = lineCount + 1 newFile[lineCount3] = "GraphicsWindow.Width = " + thisFile[lineCount2] lineCount = lineCount + 1 numLines = numLines - 3 ElseIf (thisFile[lineCount] = "windowname") Then 'Edit window name 1=text window and 2=graphics window and uses given name lineCount2 = lineCount + 1 If (thisFile[lineCount2] = "1") Then lineCount2 = lineCount2 + 1 newFile[lineCount3] = "TextWindow.Title = " + dQuotes + thisFile[lineCount2] + dQuotes ElseIf (thisFile[lineCount2] = "2") Then lineCount2 = lineCount2 + 1 newFile[lineCount3] = "GraphicsWindow.Title = " + dQuotes + thisFile[lineCount2] + dQuotes EndIf lineCount = lineCount + 2 numLines = numLines - 3 ElseIf (thisFile[lineCount] = "backcolor") Then 'Edit window background color 1=text window and 2=graphics window and uses given color lineCount2 = lineCount + 1 If (thisFile[lineCount2] = "1") Then lineCount2 = lineCount2 + 1 newFile[lineCount3] = "TextWindow.BackgroundColor = " + dQuotes + thisFile[lineCount2] + dQuotes ElseIf (thisFile[lineCount2] = "2") Then lineCount2 = lineCount2 + 1 newFile[lineCount3] = "GraphicsWindow.BackgroundColor = " + thisFile[lineCount2] EndIf lineCount = lineCount + 2 numLines = numLines - 3 EndIf 'Input/Output Commands If (thisFile[lineCount] = "var") Then 'Declares a given variable name and gives it a starting value lineCount2 = lineCount + 1 lineCount4 = lineCount2 + 1 newFile[lineCount3] = thisFile[lineCount2] + " = " + thisFile[lineCount4] lineCount = lineCount + 2 numLines = numLines - 3 ElseIf (thisFile[lineCount] = "print") Then 'Prints given text/number to the screen, text window only lineCount2 = lineCount + 1 newFile[lineCount3] = "TextWindow.WriteLine(" + dQuotes + thisFile[lineCount2] + dQuotes + ")" lineCount = lineCount + 1 numLines = numLines - 2 ElseIf (thisFile[lineCount] = "printvar") Then 'Prints a given variable to the screen, text window only lineCount2 = lineCount + 1 newFile[lineCount3] = "textWindow.WriteLine(" + thisFile[lineCount2] + ")" lineCount = lineCount + 1 numLines = numLines - 2 ElseIf (thisFile[lineCount] = "ask") Then 'Displays a curser and accept input then when Enter is pressed return input in named variable lineCount2 = lineCount + 1 newFile[lineCount3] = thisFile[lineCount2] + " = TextWindow.Read()" lineCount = lineCount + 1 numLines = numLines - 2 EndIf 'Other Commands If (thisFile[lineCount] = "sub") Then 'Starts a sub named after given name lineCount2 = lineCount + 1 newFile[lineCount3] = "Sub " + thisFile[lineCount2] lineCount = lineCount + 1 numLines = numLines - 2 ElseIf (thisFile[lineCount] = "endsub") Then 'Ends a sub newFile[lineCount3] = "EndSub" numLines = numLines - 1 ElseIf (thisFile[lineCount] = "runsub") Then 'Runs given sub lineCount2 = lineCount + 1 newFile[lineCount3] = thisFile[lineCount2] + "()" lineCount = lineCount + 1 numLines = numLines - 2 EndIf lineCount3 = lineCount3 + 1 lineCount2 = 0 lineCount = lineCount + 1 EndWhile TextWindow.Write("Enter name of file to save as: " + filePath) fileName = TextWindow.Read() ' only attempt to save file if a filename was specified If fileName <> "" Then saveFile() EndIf 'Sub Codes------------------------------------------------------------------------- Sub openFile thisFile = "" ' blank the array to contain file data fileLength = 0 ' read each line from the file into our array ' and keep track of how many lines were read in 'fileLength' variable ' The following line could be harmful and has been automatically commented. ' thisLine = File.ReadLine( filePath + fileName, 1 ) While thisLine <> "Terminate" fileLength = fileLength + 1 thisFile[fileLength] = thisLine ' The following line could be harmful and has been automatically commented. ' thisLine = File.ReadLine( filePath + fileName, fileLength+1 ) EndWhile EndSub Sub saveFile fileLength = Array.GetItemCount(newFile) For thisLine = 1 To fileLength ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filePath + fileName, thisLine, newFile[thisLine]) EndFor TextWindow.WriteLine("") TextWindow.WriteLine( "FILE WRITTEN TO DISK.") EndSub End>VFD117.sb< Start>VFF095.sb< GraphicsWindow.PenWidth=0 cc="0=red;1=cyan GraphicsWindow.FontName="zx spectrum GraphicsWindow.FontBold="false GraphicsWindow.FontSize=18 For x=0 To 30 GraphicsWindow.BrushColor=cc[Math.Remainder(x 2)] s=Shapes.AddRectangle(700 30) Shapes.Move(s 0 x*30) EndFor GraphicsWindow.BrushColor="white r=Shapes.AddRectangle(GraphicsWindow.Width-130 GraphicsWindow.Height-90) For y=1 To -200 Step -2 LDGraphicsWindow.Reposition(1 1 0 y 0) Shapes.Move(r 60, -y+45) Program.Delay(22) EndFor GraphicsWindow.BrushColor="black ss=Shapes.AddText("Bytes: Screen") Shapes.Move(ss 66, -3000+5+45) LDGraphicsWindow.Reposition(1 1 0, 3000 0) Program.Delay(777) For y=1 To -120 Step -2 LDGraphicsWindow.Reposition(1 1 0 y 0) Shapes.Move(r 60, -y+45) Shapes.Move(ss 66 Shapes.GetTop(r)+5) Program.Delay(22) EndFor GraphicsWindow.Clear() cc=0 cc="1=yellow;2=darkblue ii=ImageList.LoadImage("e:\hr1.png") LDImage.ReplaceColour(ii "yellow" "transparent" 22) LDGraphicsWindow.Reposition(1 1 0 0 0) For x=0 To 50 GraphicsWindow.BrushColor=cc[Math.GetRandomNumber(2)] s[x]=Shapes.AddRectangle(700 10) Shapes.Move(s[x] 0 x*10) EndFor GraphicsWindow.BrushColor="white r=Shapes.AddRectangle(GraphicsWindow.Width-125 GraphicsWindow.Height-90) Shapes.Move(r 60 45) For m=1 To 1085 Step 2 For x=0 To 50 LDShapes.BrushColour(s[x] cc[Math.GetRandomNumber(2)]) EndFor Program.Delay(44) ix=LDImage.Copy(ii) LDImage.Crop(ix 0 0 500 m/3+1) Shapes.Remove(sq) sq=Shapes.AddImage(ix) Shapes.Move(sq 60 45) EndFor For x=0 To 50 Shapes.Remove(s[x]) EndFor GraphicsWindow.BrushColor="yellow For y=0 To 17 For x=0 To 25 s=Shapes.AddRectangle(20 20) LDShapes.ZIndex(sq 600) LDShapes.ZIndex(s 1) Shapes.Move(s x*20+60 y*20+45) Program.Delay(3) EndFor EndFor End>VFF095.sb< Start>VFK154.sb< GraphicsWindow.BackgroundColor ="#CCFFCC" ' Init.sb For NaochanON's shapes Editor STD116 GraphicsWindow.Width=1150 GraphicsWindow.Height=650 init() add_shapes() Sub add_shapes s=1 ' <----- change this value x0=0 ' <----- change this value y0=-80 ' <----- change this value For i = 1 To Array.GetItemCount(shape) GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.PenColor = shape[i]["pc"] GraphicsWindow.PenWidth = shape[i]["pw"]*s GraphicsWindow.FontSize=shape[i]["fsz"]*s If shape[i]["fn"] = "Pol" Then _pt= LDText.Split(shape[i]["pts"]," ") points="" For j=1 To Array.GetItemCount(_pt) points[j]= LDText.Split(_pt[j],",") EndFor _shp[i] = Ldshapes.AddPolygon(points) LDShapes.BrushColour(_shp[i] , shape[i]["bc"]) LDShapes.PenColour(_shp[i] , shape[i]["pc"]) LDShapes.Penwidth(_shp[i] , shape[i]["pw"]) elseIf shape[i]["fn"] = "Tex" Then _shp[i] = Shapes.Addtext( shape[i]["msg"]) Shapes.Zoom(_shp[i],shape[i]["zmw"]*s,shape[i]["zmh"]*s) ElseIf shape[i]["fn"] = "Img" Then _shp[i] = Shapes.AddImage(imagelist.LoadImage( shape[i]["Src"] )) Shapes.Zoom(_shp[i],shape[i]["zmw"]*s,shape[i]["zmh"]*s) EndIf Shapes.SetOpacity(_shp[i],shape[i]["op"]) Shapes.Move(_shp[i], x0 + shape[i]["x"]*s, y0 + shape[i]["y"]*s) Shapes.Rotate(_shp[i], shape[i]["ang"]) EndFor EndSub Sub init shape[1]="fn=Pol;x=99;y=225;pts=40,80 50.4,78.6 60,74.6 68.3,68.3 74.6,60 78.6,50.4 80,40 78.6,29.6 74.6,20 68.3,11.7 60,5.4 50.4,1.4 40,0 29.6,1.4 20,5.4 11.7,11.7 5.4,20 1.4,29.6 0,40 1.4,50.4 5.4,60 11.7,68.3 20,74.6 29.6,78.6;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#1E50A2;pw=1;" shape[2]="fn=Pol;x=240;y=260;pts=0,0 85,0 85,50 0,50;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#1E50A2;pw=1;" shape[3]="fn=Pol;x=374;y=305;pts=0.0,39.0 84.5,39.0 45.5,0.0;zmw=1;zmh=1;ang=0;op=100;bc=#00FF00;pc=#1E50A2;pw=3.0;" shape[4]="fn=Pol;x=517;y=234;pts=0,0.0 0,87.5 0,175.0;zmw=1;zmh=1;ang=12;op=100;bc=#BED3CA;pc=#FF0080;pw=10.0;" shape[5]="fn=Pol;x=334;y=353;pts=4,43 88,43 6,4;zmw=1;zmh=1;ang=0;op=100;bc=#00FF00;pc=#1E50A2;pw=5;" shape[6]="fn=Pol;x=105;y=321;pts=64,152 73,121 83,117 91,111 97,103 101,93 123,80 101,72 97,63 91,54 83,48 73,44 65,4 52,44 43,48 34,54 28,63 24,72 4,86 24,93 28,103 34,111 43,117 52,121;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#1E50A2;pw=1;" shape[7]="fn=Img;x=544;y=262;op=100;zmw=1;zmh=1;Src=http://farm1.static.flickr.com/489/32214223792_8a7142966d.jpg;ang=0;bc=;pc=;pw=;" shape[8]="fn=Tex;x=755;y=208;op=100;zmw=3;zmh=1.4;fsz=20;msg=Classic Car;ang=-6;bc=#FF8040;pc=;pw=;" shape[9]="fn=Pol;x=175;y=116;pts=59,117 67,98 77,94 94,97 91,80 109,71 97,60 95,49 107,24 85,31 77,25 73,8 57,20 46,21 24,4 28,31 22,40 6,48 17,60 18,70 4,95 28,88 37,94 46,98;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#1E50A2;pw=1;" EndSub End>VFK154.sb< Start>VFM200.sb< GraphicsWindow.BackgroundColor = "tan GraphicsWindow.PenWidth=0 GraphicsWindow.Title="Boxchars demo Sub inn args=0 f60=70 For i=1 To 9 LDCall.Function3("addc" i 100 0) EndFor For i=10 To 18 LDCall.Function3("addc" i 170 9) EndFor For i=19 To 27 LDCall.Function3("addc" i 240 18) EndFor chh="2 5 5 5 7 5 C;6 5 6 5 5 6 5;2 5 4 4 5 2 F;6 5 5 5 5 6 5;7 4 6 6 4 7 0;7 4 6 6 4 4 0;2 5 4 5 5 3 E;5 5 7 7 5 5 0;2 2 2 2 2 2 0;1 1 1 1 5 2 3;5 5 6 5 5 5 0;4 4 4 4 4 7 0;0 7 7 5 5 5 C;6 5 5 5 5 5 4;2 5 5 5 5 2 F;6 5 5 6 4 4 4;2 5 5 5 7 2 C;6 5 6 5 5 5 4;3 4 7 1 1 6 9;7 2 2 2 2 2 0;5 5 5 5 5 3 2;5 5 5 5 6 4 0;5 5 5 5 7 0 3;5 5 2 7 5 5 0;5 5 7 2 2 2 0;7 1 2 2 4 7 0;5 5 2 2 5 5 0;5 5 2 2 5 5 0;2 2 5 5 2 2 0; chm=LDText.Split(chh ";") For qr=1 To 29 nn=LDText.Split(chm[qr] " ") ss="" For f=1 To 6 ss=Text.Append(ss text.GetSubTextToEnd( LDMath.Decimal2Base(nn[f]+8 2) 2)) EndFor nnn=LDMath.Base2Decimal(nn[7] 16) c1=Text.GetCharacter(qr+64) ch[c1]=Text.Append(ss text.GetSubTextToEnd( LDMath.Decimal2Base(nnn+16 2) 2)) EndFor txx=LDText.Split("a b c d e f g h i j k l m n o p r t q s u v w x y z [" " ") cll="0=blue;1=transparent;2=darkred;3=transparent aa=Array.GetItemCount(txx) addch["o"]="1=0 0;2=2 0;3=0 4;4=2 4 addch["c"]="1=0 0;2=2 0;3=0 4;4=2 4 addch["b"]="1=2 0;2=2 4 addch["d"]="1=2 0;2=2 4 addch["u"]="1=0 4 addch["n"]="1=2 0 addch["p"]="1=2 0 addch["r"]="1=2 0 addch["s"]="1=0 0;2=2 4 addch["w"]="1=0 4;2=2 4 addch["j"]="1=0 4;2=2 4 addch["a"]="1=2 0;2=0 0 addch["q"]="1=2 0;2=0 0 addch["m"]="1=2 0;2=0 0 addch["g"]="1=0 0;2=2 0;3=0 4 sx=70 sy=100 mttc="1=darkred;0=blue EndSub inn() For m=1 To aa sx=10+Math.Remainder(m 9)*f60 sy=100+Math.Floor(m/9)*f60 chh=ch[txx[m]] If addch[txx[m]]="" Then Else ay=addch[txx[m]] For ff=1 To Array.GetItemCount(ay) GraphicsWindow.BrushColor=mttc[Math.Remainder(m 2)] ee=Shapes.AddEllipse(20 20) pp=LDText.Split(ay[ff] " ") if pp[1]+pp[2]=6 Then LDEffect.DropShadow(ee "") EndIf LDShapes.ZIndex(ee,-2) Shapes.Move(ee pp[1]*20+sx sy+pp[2]*10) ee=Shapes.AddEllipse(20 20) LDShapes.ZIndex(ee,2) Shapes.Move(ee pp[1]*20+sx sy+pp[2]*10) EndFor 'Program.Delay(5555) EndIf c=Math.Remainder(m 2) For rr=1 To 22 If Text.GetSubText(chh rr 1)="1" Then LDShapes.BrushColour(r[m][rr] cll[c*2]) Else If rr>18 Then LDShapes.BrushColour(r[m][rr] "transparent") Else LDShapes.BrushColour(r[m][rr] cll[c*2+1]) EndIf EndIf For n=m+1 To aa For rr1=1 To 22 LDShapes.BrushColour(r[n][rr1] GraphicsWindow.GetRandomColor()) EndFor EndFor EndFor EndFor Sub addc n=1 ii=args[1] y100=args[2] ij=ii-args[3] For y=0 To 5 For x=0 To 2 GraphicsWindow.BrushColor=GraphicsWindow.GetRandomColor() r[ii][n]=Shapes.AddRectangle(20 10) LDEffect.DropShadow(r[ii][n] "") Shapes.Move(r[ii][n] 10+x*20+ij*f60 y100+y*10) n=n+1 EndFor EndFor r[ii][n]=Shapes.AddRectangle(10 10) Shapes.Move(r[ii][n] 20+0*20+ij*f60 y100+0*10) n=n+1 r[ii][n]=Shapes.AddRectangle(10 10) Shapes.Move(r[ii][n] 10+2*20+ij*f60 y100+0*10) n=n+1 r[ii][n]=Shapes.AddRectangle(10 10) Shapes.Move(r[ii][n] 20+0*20+ij*f60 y100+5*10) n=n+1 r[ii][n]=Shapes.AddRectangle(10 10) Shapes.Move(r[ii][n] 10+2*20+ij*f60 y100+5*10) n=n+1 EndSub End>VFM200.sb< Start>VFP128-0.sb< ' Color Gradations 0.2b ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.2b 20/03/2013 Supported angle <= 45 [degree]. (VFP128-0) ' 0.1b 07/03/2013 Created but not implemented angle yet. (VFP128) ' GraphicsWindow.Title = "Color Gradations 0.2b" Colors_Init() percent = "1=0;2=70;3=100;" name= "1=Cyan;2=Navy;3=Indigo;" GraphicsWindow.BrushColor = "Black" abox = Controls.AddTextBox(10, 10) Controls.SetTextBoxText(abox, 45) Controls.SetSize(abox, 40, 22) For i = 1 To 3 pbox[i] = Controls.AddTextBox(10, 10 + i * 30) Controls.SetTextBoxText(pbox[i], percent[i]) Controls.SetSize(pbox[i], 40, 22) nbox[i] = Controls.AddTextBox(60, 10 + i * 30) Controls.SetTextBoxText(nbox[i], name[i]) EndFor Controls.AddButton("Paint", 10, 130) OnButtonClicked() Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked param = "x=0;y=0;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height param["angle"] = Controls.GetTextBoxText(abox) For i = 1 To 3 percent[i] = Controls.GetTextBoxText(pbox[i]) name[i] = Controls.GetTextBoxText(nbox[i]) EndFor Paint() EndSub Sub Paint For i = 1 To 3 p = percent[i] n = name[i] param[p] = n EndFor FillLinearGradientRectangle() EndSub Sub FillLinearGradientRectangle ' param["x"], param["y"] - position of the rectangle ' param["width"], param["height"] - size of the rectangle ' param["angle"] - angle of gradient ' param["0"]..param["100"] - 0% to 100% colors x0 = param["x"] y0 = param["y"] width = param["width"] height = param["height"] angle = param["angle"] n = Array.GetItemCount(param) index = Array.GetAllIndices(param) color = "" For i = 1 To n If index[i] + 0 = index[i] And 0 <= index[i] And index[i] <= 100 Then color[index[i]] = param[index[i]] EndIf EndFor If color[0] = "" Then color[0] = GraphicsWindow.BrushColor EndIf If color[100] = "" Then color[100] = GraphicsWindow.BrushColor EndIf n = Array.GetItemCount(color) index = Array.GetAllIndices(color) If angle = 0 Then For x = 0 To width percent = Math.Floor(x * 100 / width) Color_PercentToRGB() x1 = x + x0 y1 = y0 x2 = x1 y2 = y0 + height DrawLine() EndFor ElseIf 0 < angle And angle <= 45 Then tan = Math.Tan(Math.GetRadians(angle)) If height <= width Then dx = Math.Floor(height * tan) For x = 0 To dx percent = Math.Floor(x * 100 / (width + dx)) Color_PercentToRGB() x1 = x + x0 y1 = y0 x2 = x0 y2 = y0 + Math.Floor(x / tan) DrawLine() EndFor For x = dx To width percent = Math.Floor(x * 100 / (width + dx)) Color_PercentToRGB() x1 = x + x0 y1 = y0 x2 = x1 - dx y2 = y0 + height DrawLine() EndFor For x = width To width + dx percent = Math.Floor(x * 100 / (width + dx)) Color_PercentToRGB() x1 = x + x0 - dx y1 = y0 + height x2 = x0 + width y2 = y0 + Math.Floor((x - width) / tan) DrawLine() EndFor Else ' width < height dx = Math.Floor(height * tan - width) dy = Math.Floor(width / tan) For x = 0 To width percent = Math.Floor(x * 100 / (2 * width + dx)) Color_PercentToRGB() x1 = x + x0 y1 = y0 x2 = x0 y2 = y0 + Math.Floor(x / tan) DrawLine() EndFor For x = 0 To dx percent = Math.Floor((x + width) * 100 / (2 * width + dx)) Color_PercentToRGB() x1 = x0 + width y1 = y0 + Math.Floor(x / tan) x2 = x0 y2 = y1 + dy DrawLine() EndFor dy = height - Math.Floor(width / tan) For x = 0 To width percent = Math.Floor((x + width + dx) * 100 / (2 * width + dx)) Color_PercentToRGB() x1 = x0 + x y1 = y0 + height x2 = x0 + width y2 = y0 + dy + Math.Floor(x / tan) DrawLine() EndFor EndIf EndIf EndSub Sub DrawLine ' param r, g, b - red, green blue ' param x1, y1, x2, y2 - edges of line GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndSub Sub Color_PercentToRGB ' Color | Convert Percent to RGB ' param percent - percent ' param color[] - color table indexed percent ' param n - item count of color[] ' param index[] - all indices of color[] For i = 1 To n p1 = index[i] If index[i] = percent Then p2 = index[i] i = n + 1 ' break ElseIf index[i] < percent And percent < index[i + 1] Then p2 = index[i + 1] i = n + 1 ' break EndIf EndFor c = color[p1] Color_ColorToRGB() If p1 <> p2 Then r1 = r g1 = g b1 = b c = color[p2] Color_ColorToRGB() r2 = r g2 = g b2 = b r = Math.Floor(r1 + (r2 - r1) * (percent - p1) / (p2 - p1)) g = Math.Floor(g1 + (g2 - g1) * (percent - p1) / (p2 - p1)) b = Math.Floor(b1 + (b2 - b1) * (percent - p1) / (p2 - p1)) EndIf EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param c - color ' returns r, g, b - red, green and blue values If Text.StartsWith(c, "#") Then c = Text.ConvertToUpperCase(c) Else c = Text.ConvertToLowerCase(c) c = colors[c] EndIf sHex = Text.GetSubText(c, 2, 2) Math_Hex2Dec() r = iDec sHex = Text.GetSubText(c, 4, 2) Math_Hex2Dec() g = iDec sHex = Text.GetSubText(c, 6, 2) Math_Hex2Dec() b = iDec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' returns iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub Sub Colors_Init colors["aliceblue"]="#F0F8FF" colors["antiquewhite"]="#FAEBD7" colors["aqua"]="#00FFFF" colors["aquamarine"]="#7FFFD4" colors["azure"]="#F0FFFF" colors["beige"]="#F5F5DC" colors["bisque"]="#FFE4C4" colors["black"]="#000000" colors["blanchedalmond"]="#FFEBCD" colors["blue"]="#0000FF" colors["blueviolet"]="#8A2BE2" colors["brown"]="#A52A2A" colors["burlywood"]="#DEB887" colors["cadetblue"]="#5F9EA0" colors["chartreuse"]="#7FFF00" colors["chocolate"]="#D2691E" colors["coral"]="#FF7F50" colors["cornflowerblue"]="#6495ED" colors["cornsilk"]="#FFF8DC" colors["crimson"]="#DC143C" colors["cyan"]="#00FFFF" colors["darkblue"]="#00008B" colors["darkcyan"]="#008B8B" colors["darkgoldenrod"]="#B8860B" colors["darkgray"]="#A9A9A9" colors["darkgreen"]="#006400" colors["darkkhaki"]="#BDB76B" colors["darkmagenta"]="#8B008B" colors["darkolivegreen"]="#556B2F" colors["darkorange"]="#FF8C00" colors["darkorchid"]="#9932CC" colors["darkred"]="#8B0000" colors["darksalmon"]="#E9967A" colors["darkseagreen"]="#8FBC8F" colors["darkslateblue"]="#483D8B" colors["darkslategray"]="#2F4F4F" colors["darkturquoise"]="#00CED1" colors["darkviolet"]="#9400D3" colors["deeppink"]="#FF1493" colors["deepskyblue"]="#00BFFF" colors["dimgray"]="#696969" colors["dodgerblue"]="#1E90FF" colors["firebrick"]="#B22222" colors["floralwhite"]="#FFFAF0" colors["forestgreen"]="#228B22" colors["fuchsia"]="#FF00FF" colors["gainsboro"]="#DCDCDC" colors["ghostwhite"]="#F8F8FF" colors["gold"]="#FFD700" colors["goldenrod"]="#DAA520" colors["gray"]="#808080" colors["green"]="#008000" colors["greenyellow"]="#ADFF2F" colors["honeydew"]="#F0FFF0" colors["hotpink"]="#FF69B4" colors["indianred"]="#CD5C5C" colors["indigo"]="#4B0082" colors["ivory"]="#FFFFF0" colors["khaki"]="#F0E68C" colors["lavender"]="#E6E6FA" colors["lavenderblush"]="#FFF0F5" colors["lawngreen"]="#7CFC00" colors["lemonchiffon"]="#FFFACD" colors["lightblue"]="#ADD8E6" colors["lightcoral"]="#F08080" colors["lightcyan"]="#E0FFFF" colors["lightgoldenrodyellow"]="#FAFAD2" colors["lightgray"]="#D3D3D3" colors["lightgreen"]="#90EE90" colors["lightpink"]="#FFB6C1" colors["lightsalmon"]="#FFA07A" colors["lightseagreen"]="#20B2AA" colors["lightskyblue"]="#87CEFA" colors["lightslategray"]="#778899" colors["lightsteelblue"]="#B0C4DE" colors["lightyellow"]="#FFFFE0" colors["lime"]="#00FF00" colors["limegreen"]="#32CD32" colors["linen"]="#FAF0E6" colors["magenta"]="#FF00FF" colors["maroon"]="#800000" colors["mediumaquamarine"]="#66CDAA" colors["mediumblue"]="#0000CD" colors["mediumorchid"]="#BA55D3" colors["mediumpurple"]="#9370DB" colors["mediumseagreen"]="#3CB371" colors["mediumslateblue"]="#7B68EE" colors["mediumspringgreen"]="#00FA9A" colors["mediumturquoise"]="#48D1CC" colors["mediumvioletred"]="#C71585" colors["midnightblue"]="#191970" colors["mintcream"]="#F5FFFA" colors["mistyrose"]="#FFE4E1" colors["moccasin"]="#FFE4B5" colors["navajowhite"]="#FFDEAD" colors["navy"]="#000080" colors["oldlace"]="#FDF5E6" colors["olive"]="#808000" colors["olivedrab"]="#6B8E23" colors["orange"]="#FFA500" colors["orangered"]="#FF4500" colors["orchid"]="#DA70D6" colors["palegoldenrod"]="#EEE8AA" colors["palegreen"]="#98FB98" colors["paleturquoise"]="#AFEEEE" colors["palevioletred"]="#DB7093" colors["papayawhip"]="#FFEFD5" colors["peachpuff"]="#FFDAB9" colors["peru"]="#CD853F" colors["pink"]="#FFC0CB" colors["plum"]="#DDA0DD" colors["powderblue"]="#B0E0E6" colors["purple"]="#800080" colors["red"]="#FF0000" colors["rosybrown"]="#BC8F8F" colors["royalblue"]="#4169E1" colors["saddlebrown"]="#8B4513" colors["salmon"]="#FA8072" colors["sandybrown"]="#F4A460" colors["seagreen"]="#2E8B57" colors["seashell"]="#FFF5EE" colors["sienna"]="#A0522D" colors["silver"]="#C0C0C0" colors["skyblue"]="#87CEEB" colors["slateblue"]="#6A5ACD" colors["slategray"]="#708090" colors["snow"]="#FFFAFA" colors["springgreen"]="#00FF7F" colors["steelblue"]="#4682B4" colors["tan"]="#D2B48C" colors["teal"]="#008080" colors["thistle"]="#D8BFD8" colors["tomato"]="#FF6347" colors["turquoise"]="#40E0D0" colors["violet"]="#EE82EE" colors["wheat"]="#F5DEB3" colors["white"]="#FFFFFF" colors["whitesmoke"]="#F5F5F5" colors["yellow"]="#FFFF00" colors["yellowgreen"]="#9ACD32" EndSub End>VFP128-0.sb< Start>VFP128-1.sb< ' Color Gradations 0.3 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.3 23/03/2013 Completed. (VFP128-1) ' 0.2b 20/03/2013 Supported angle <= 45 [degree]. (VFP128-0) ' 0.1b 07/03/2013 Created but not implemented angle yet. (VFP128) ' GraphicsWindow.Title = "Color Gradations 0.3" Colors_Init() percent = "1=0;2=70;3=100;" name= "1=Cyan;2=Navy;3=Indigo;" GraphicsWindow.BrushColor = "Black" abox = Controls.AddTextBox(10, 10) Controls.SetTextBoxText(abox, 45) Controls.SetSize(abox, 40, 22) For i = 1 To 3 pbox[i] = Controls.AddTextBox(10, 10 + i * 30) Controls.SetTextBoxText(pbox[i], percent[i]) Controls.SetSize(pbox[i], 40, 22) nbox[i] = Controls.AddTextBox(60, 10 + i * 30) Controls.SetTextBoxText(nbox[i], name[i]) EndFor Controls.AddButton("Paint", 10, 130) OnButtonClicked() Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked param = "x=0;y=0;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height angle = Controls.GetTextBoxText(abox) angle = Math.Remainder(angle, 360) If angle < 0 Then angle = 360 + angle EndIf param["angle"] = angle For i = 1 To 3 percent[i] = Controls.GetTextBoxText(pbox[i]) name[i] = Controls.GetTextBoxText(nbox[i]) EndFor Paint() EndSub Sub Paint For i = 1 To 3 p = percent[i] n = name[i] param[p] = n EndFor FillLinearGradientRectangle() EndSub Sub FillLinearGradientRectangle ' param["x"], param["y"] - position of the rectangle ' param["width"], param["height"] - size of the rectangle ' param["angle"] - angle of gradient ' param["0"]..param["100"] - 0% to 100% colors x0 = param["x"] y0 = param["y"] width = param["width"] height = param["height"] angle = param["angle"] n = Array.GetItemCount(param) index = Array.GetAllIndices(param) color = "" For i = 1 To n If index[i] + 0 = index[i] And 0 <= index[i] And index[i] <= 100 Then color[index[i]] = param[index[i]] EndIf EndFor If color[0] = "" Then color[0] = GraphicsWindow.BrushColor EndIf If color[100] = "" Then color[100] = GraphicsWindow.BrushColor EndIf n = Array.GetItemCount(color) index = Array.GetAllIndices(color) a45 = Math.Remainder(angle, 45) If 0 <= angle And angle < 45 Then w45 = width h45 = height ElseIf 45 <= angle And angle < 90 Then w45 = height h45 = width a45 = 45 - a45 ElseIf 90 <= angle And angle < 135 Then w45 = height h45 = width ElseIf 135 <= angle And angle < 180 Then w45 = width h45 = height a45 = 45 - a45 ElseIf 180 <= angle And angle < 225 Then w45 = width h45 = height ElseIf 225 <= angle And angle < 270 Then w45 = height h45 = width a45 = 45 - a45 ElseIf 270 <= angle And angle < 315 Then w45 = height h45 = width ElseIf 315 <= angle And angle < 360 Then w45 = width h45 = height a45 = 45 - a45 EndIf If a45 = 0 Then For x = 0 To w45 percent = Math.Floor(x * 100 / w45) Color_PercentToRGB() x1 = x y1 = 0 x2 = x y2 = h45 DrawLine() EndFor ElseIf 0 < a45 And a45 <= 45 Then tan = Math.Tan(Math.GetRadians(a45)) If h45 <= w45 Then dx = Math.Floor(h45 * tan) For x = 0 To dx percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = 0 y2 = Math.Floor(x / tan) DrawLine() EndFor For x = dx To w45 percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = x - dx y2 = h45 DrawLine() EndFor For x = w45 To w45 + dx percent = Math.Floor(x * 100 / (w45 + dx)) Color_PercentToRGB() x1 = x - dx y1 = h45 x2 = w45 y2 = Math.Floor((x - w45) / tan) DrawLine() EndFor Else ' width < height dx = Math.Floor(h45 * tan - w45) dy = Math.Floor(w45 / tan) For x = 0 To w45 percent = Math.Floor(x * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = x y1 = 0 x2 = 0 y2 = Math.Floor(x / tan) DrawLine() EndFor For x = 0 To dx percent = Math.Floor((x + w45) * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = w45 y1 = Math.Floor(x / tan) x2 = 0 y2 = y1 + dy DrawLine() EndFor dy = h45 - Math.Floor(w45 / tan) For x = 0 To w45 percent = Math.Floor((x + w45 + dx) * 100 / (2 * w45 + dx)) Color_PercentToRGB() x1 = x y1 = h45 x2 = w45 y2 = dy + Math.Floor(x / tan) DrawLine() EndFor EndIf EndIf EndSub Sub DrawLine ' param r, g, b - red, green blue ' param angle ' param x1, y1, x2, y2 - edges of line GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) If 0 <= angle And angle < 45 Then GraphicsWindow.DrawLine(x1 + x0, y1 + y0, x2 + x0, y2 + y0) ElseIf 45 <= angle And angle < 90 Then GraphicsWindow.DrawLine(y1 + x0, x1 + y0, y2 + x0, x2 + y0) ElseIf 90 <= angle And angle < 135 Then GraphicsWindow.DrawLine(-y1 + x0 + width, x1 + y0, -y2 + x0 + width, x2 + y0) ElseIf 135 <= angle And angle < 180 Then GraphicsWindow.DrawLine(-x1 + x0 + width, y1 + y0, -x2 + x0 + width, y2 + y0) ElseIf 180 <= angle And angle < 225 Then GraphicsWindow.DrawLine(-x1 + x0 + width, -y1 + y0 + height, -x2 + x0 + width, -y2 + y0 + height) ElseIf 225 <= angle And angle < 270 Then GraphicsWindow.DrawLine(-y1 + x0 + width, -x1 + y0 + height, -y2 + x0 + width, -x2 + y0 + height) ElseIf 270 <= angle And angle < 315 Then GraphicsWindow.DrawLine(y1 + x0, -x1 + y0 + height, y2 + x0, -x2 + y0 + height) ElseIf 315 <= angle And angle < 360 Then GraphicsWindow.DrawLine(x1 + x0, -y1 + y0 + height, x2 + x0, -y2 + y0 + height) EndIf EndSub Sub Color_PercentToRGB ' Color | Convert Percent to RGB ' param percent - percent ' param color[] - color table indexed percent ' param n - item count of color[] ' param index[] - all indices of color[] For i = 1 To n p1 = index[i] If index[i] = percent Then p2 = index[i] i = n + 1 ' break ElseIf index[i] < percent And percent < index[i + 1] Then p2 = index[i + 1] i = n + 1 ' break EndIf EndFor c = color[p1] Color_ColorToRGB() If p1 <> p2 Then r1 = r g1 = g b1 = b c = color[p2] Color_ColorToRGB() r2 = r g2 = g b2 = b r = Math.Floor(r1 + (r2 - r1) * (percent - p1) / (p2 - p1)) g = Math.Floor(g1 + (g2 - g1) * (percent - p1) / (p2 - p1)) b = Math.Floor(b1 + (b2 - b1) * (percent - p1) / (p2 - p1)) EndIf EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param c - color ' returns r, g, b - red, green and blue values If Text.StartsWith(c, "#") Then c = Text.ConvertToUpperCase(c) Else c = Text.ConvertToLowerCase(c) c = colors[c] EndIf sHex = Text.GetSubText(c, 2, 2) Math_Hex2Dec() r = iDec sHex = Text.GetSubText(c, 4, 2) Math_Hex2Dec() g = iDec sHex = Text.GetSubText(c, 6, 2) Math_Hex2Dec() b = iDec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' returns iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub Sub Colors_Init colors["aliceblue"]="#F0F8FF" colors["antiquewhite"]="#FAEBD7" colors["aqua"]="#00FFFF" colors["aquamarine"]="#7FFFD4" colors["azure"]="#F0FFFF" colors["beige"]="#F5F5DC" colors["bisque"]="#FFE4C4" colors["black"]="#000000" colors["blanchedalmond"]="#FFEBCD" colors["blue"]="#0000FF" colors["blueviolet"]="#8A2BE2" colors["brown"]="#A52A2A" colors["burlywood"]="#DEB887" colors["cadetblue"]="#5F9EA0" colors["chartreuse"]="#7FFF00" colors["chocolate"]="#D2691E" colors["coral"]="#FF7F50" colors["cornflowerblue"]="#6495ED" colors["cornsilk"]="#FFF8DC" colors["crimson"]="#DC143C" colors["cyan"]="#00FFFF" colors["darkblue"]="#00008B" colors["darkcyan"]="#008B8B" colors["darkgoldenrod"]="#B8860B" colors["darkgray"]="#A9A9A9" colors["darkgreen"]="#006400" colors["darkkhaki"]="#BDB76B" colors["darkmagenta"]="#8B008B" colors["darkolivegreen"]="#556B2F" colors["darkorange"]="#FF8C00" colors["darkorchid"]="#9932CC" colors["darkred"]="#8B0000" colors["darksalmon"]="#E9967A" colors["darkseagreen"]="#8FBC8F" colors["darkslateblue"]="#483D8B" colors["darkslategray"]="#2F4F4F" colors["darkturquoise"]="#00CED1" colors["darkviolet"]="#9400D3" colors["deeppink"]="#FF1493" colors["deepskyblue"]="#00BFFF" colors["dimgray"]="#696969" colors["dodgerblue"]="#1E90FF" colors["firebrick"]="#B22222" colors["floralwhite"]="#FFFAF0" colors["forestgreen"]="#228B22" colors["fuchsia"]="#FF00FF" colors["gainsboro"]="#DCDCDC" colors["ghostwhite"]="#F8F8FF" colors["gold"]="#FFD700" colors["goldenrod"]="#DAA520" colors["gray"]="#808080" colors["green"]="#008000" colors["greenyellow"]="#ADFF2F" colors["honeydew"]="#F0FFF0" colors["hotpink"]="#FF69B4" colors["indianred"]="#CD5C5C" colors["indigo"]="#4B0082" colors["ivory"]="#FFFFF0" colors["khaki"]="#F0E68C" colors["lavender"]="#E6E6FA" colors["lavenderblush"]="#FFF0F5" colors["lawngreen"]="#7CFC00" colors["lemonchiffon"]="#FFFACD" colors["lightblue"]="#ADD8E6" colors["lightcoral"]="#F08080" colors["lightcyan"]="#E0FFFF" colors["lightgoldenrodyellow"]="#FAFAD2" colors["lightgray"]="#D3D3D3" colors["lightgreen"]="#90EE90" colors["lightpink"]="#FFB6C1" colors["lightsalmon"]="#FFA07A" colors["lightseagreen"]="#20B2AA" colors["lightskyblue"]="#87CEFA" colors["lightslategray"]="#778899" colors["lightsteelblue"]="#B0C4DE" colors["lightyellow"]="#FFFFE0" colors["lime"]="#00FF00" colors["limegreen"]="#32CD32" colors["linen"]="#FAF0E6" colors["magenta"]="#FF00FF" colors["maroon"]="#800000" colors["mediumaquamarine"]="#66CDAA" colors["mediumblue"]="#0000CD" colors["mediumorchid"]="#BA55D3" colors["mediumpurple"]="#9370DB" colors["mediumseagreen"]="#3CB371" colors["mediumslateblue"]="#7B68EE" colors["mediumspringgreen"]="#00FA9A" colors["mediumturquoise"]="#48D1CC" colors["mediumvioletred"]="#C71585" colors["midnightblue"]="#191970" colors["mintcream"]="#F5FFFA" colors["mistyrose"]="#FFE4E1" colors["moccasin"]="#FFE4B5" colors["navajowhite"]="#FFDEAD" colors["navy"]="#000080" colors["oldlace"]="#FDF5E6" colors["olive"]="#808000" colors["olivedrab"]="#6B8E23" colors["orange"]="#FFA500" colors["orangered"]="#FF4500" colors["orchid"]="#DA70D6" colors["palegoldenrod"]="#EEE8AA" colors["palegreen"]="#98FB98" colors["paleturquoise"]="#AFEEEE" colors["palevioletred"]="#DB7093" colors["papayawhip"]="#FFEFD5" colors["peachpuff"]="#FFDAB9" colors["peru"]="#CD853F" colors["pink"]="#FFC0CB" colors["plum"]="#DDA0DD" colors["powderblue"]="#B0E0E6" colors["purple"]="#800080" colors["red"]="#FF0000" colors["rosybrown"]="#BC8F8F" colors["royalblue"]="#4169E1" colors["saddlebrown"]="#8B4513" colors["salmon"]="#FA8072" colors["sandybrown"]="#F4A460" colors["seagreen"]="#2E8B57" colors["seashell"]="#FFF5EE" colors["sienna"]="#A0522D" colors["silver"]="#C0C0C0" colors["skyblue"]="#87CEEB" colors["slateblue"]="#6A5ACD" colors["slategray"]="#708090" colors["snow"]="#FFFAFA" colors["springgreen"]="#00FF7F" colors["steelblue"]="#4682B4" colors["tan"]="#D2B48C" colors["teal"]="#008080" colors["thistle"]="#D8BFD8" colors["tomato"]="#FF6347" colors["turquoise"]="#40E0D0" colors["violet"]="#EE82EE" colors["wheat"]="#F5DEB3" colors["white"]="#FFFFFF" colors["whitesmoke"]="#F5F5F5" colors["yellow"]="#FFFF00" colors["yellowgreen"]="#9ACD32" EndSub End>VFP128-1.sb< Start>VFP128.sb< ' Color Gradations 0.1b ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.1b 2013/03/07 Created but not implemented angle yet. ' GraphicsWindow.Title = "Color Gradations 0.1b" Colors_Init() percent = "1=0;2=70;3=100;" name= "1=Cyan;2=Navy;3=Indigo;" GraphicsWindow.BrushColor = "Black" For i = 1 To 3 pbox[i] = Controls.AddTextBox(10, 10 + (i - 1) * 30) Controls.SetTextBoxText(pbox[i], percent[i]) Controls.SetSize(pbox[i], 40, 22) nbox[i] = Controls.AddTextBox(60, 10 + (i - 1) * 30) Controls.SetTextBoxText(nbox[i], name[i]) EndFor Controls.AddButton("Paint", 10, 100) param = "x=0;y=0;angle=45;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height Paint() Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked param = "x=0;y=0;angle=45;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height For i = 1 To 3 percent[i] = Controls.GetTextBoxText(pbox[i]) name[i] = Controls.GetTextBoxText(nbox[i]) EndFor Paint() EndSub Sub Paint For i = 1 To 3 p = percent[i] n = name[i] param[p] = n EndFor FillLinearGradientRectangle() EndSub Sub FillLinearGradientRectangle ' param["x"], param["y"] - position of the rectangle ' param["width"], param["height"] - size of the rectangle ' param["angle"] - angle of gradient ' param["0"]..param["100"] - 0% to 100% colors x0 = param["x"] y0 = param["y"] width = param["width"] height = param["height"] angle = param["angle"] n = Array.GetItemCount(param) index = Array.GetAllIndices(param) color = "" For i = 1 To n If index[i] + 0 = index[i] And 0 <= index[i] And index[i] <= 100 Then color[index[i]] = param[index[i]] EndIf EndFor If color[0] = "" Then color[0] = GraphicsWindow.BrushColor EndIf If color[100] = "" Then color[100] = GraphicsWindow.BrushColor EndIf n = Array.GetItemCount(color) index = Array.GetAllIndices(color) For i = 1 To n - 1 y1 = y0 + index[i] * height / 100 y2 = y0 + index[i + 1] * height / 100 c = color[index[i]] Color_ColorToRGB() r1 = r g1 = g b1 = b c = color[index[i + 1]] Color_ColorToRGB() r2 = r g2 = g b2 = b For y = y1 To y2 r = Math.Floor(r1 + (r2 - r1) * (y - y1) / (y2 - y1)) g = Math.Floor(g1 + (g2 - g1) * (y - y1) / (y2 - y1)) b = Math.Floor(b1 + (b2 - b1) * (y - y1) / (y2 - y1)) GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) GraphicsWindow.DrawLine(x0, y, x0 + width, y) EndFor EndFor EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param c - color ' returns r, g, b - red, green and blue values If Text.StartsWith(c, "#") Then c = Text.ConvertToUpperCase(c) Else c = Text.ConvertToLowerCase(c) c = colors[c] EndIf sHex = Text.GetSubText(c, 2, 2) Math_Hex2Dec() r = iDec sHex = Text.GetSubText(c, 4, 2) Math_Hex2Dec() g = iDec sHex = Text.GetSubText(c, 6, 2) Math_Hex2Dec() b = iDec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' returns iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub Sub Colors_Init colors["aliceblue"]="#F0F8FF" colors["antiquewhite"]="#FAEBD7" colors["aqua"]="#00FFFF" colors["aquamarine"]="#7FFFD4" colors["azure"]="#F0FFFF" colors["beige"]="#F5F5DC" colors["bisque"]="#FFE4C4" colors["black"]="#000000" colors["blanchedalmond"]="#FFEBCD" colors["blue"]="#0000FF" colors["blueviolet"]="#8A2BE2" colors["brown"]="#A52A2A" colors["burlywood"]="#DEB887" colors["cadetblue"]="#5F9EA0" colors["chartreuse"]="#7FFF00" colors["chocolate"]="#D2691E" colors["coral"]="#FF7F50" colors["cornflowerblue"]="#6495ED" colors["cornsilk"]="#FFF8DC" colors["crimson"]="#DC143C" colors["cyan"]="#00FFFF" colors["darkblue"]="#00008B" colors["darkcyan"]="#008B8B" colors["darkgoldenrod"]="#B8860B" colors["darkgray"]="#A9A9A9" colors["darkgreen"]="#006400" colors["darkkhaki"]="#BDB76B" colors["darkmagenta"]="#8B008B" colors["darkolivegreen"]="#556B2F" colors["darkorange"]="#FF8C00" colors["darkorchid"]="#9932CC" colors["darkred"]="#8B0000" colors["darksalmon"]="#E9967A" colors["darkseagreen"]="#8FBC8F" colors["darkslateblue"]="#483D8B" colors["darkslategray"]="#2F4F4F" colors["darkturquoise"]="#00CED1" colors["darkviolet"]="#9400D3" colors["deeppink"]="#FF1493" colors["deepskyblue"]="#00BFFF" colors["dimgray"]="#696969" colors["dodgerblue"]="#1E90FF" colors["firebrick"]="#B22222" colors["floralwhite"]="#FFFAF0" colors["forestgreen"]="#228B22" colors["fuchsia"]="#FF00FF" colors["gainsboro"]="#DCDCDC" colors["ghostwhite"]="#F8F8FF" colors["gold"]="#FFD700" colors["goldenrod"]="#DAA520" colors["gray"]="#808080" colors["green"]="#008000" colors["greenyellow"]="#ADFF2F" colors["honeydew"]="#F0FFF0" colors["hotpink"]="#FF69B4" colors["indianred"]="#CD5C5C" colors["indigo"]="#4B0082" colors["ivory"]="#FFFFF0" colors["khaki"]="#F0E68C" colors["lavender"]="#E6E6FA" colors["lavenderblush"]="#FFF0F5" colors["lawngreen"]="#7CFC00" colors["lemonchiffon"]="#FFFACD" colors["lightblue"]="#ADD8E6" colors["lightcoral"]="#F08080" colors["lightcyan"]="#E0FFFF" colors["lightgoldenrodyellow"]="#FAFAD2" colors["lightgray"]="#D3D3D3" colors["lightgreen"]="#90EE90" colors["lightpink"]="#FFB6C1" colors["lightsalmon"]="#FFA07A" colors["lightseagreen"]="#20B2AA" colors["lightskyblue"]="#87CEFA" colors["lightslategray"]="#778899" colors["lightsteelblue"]="#B0C4DE" colors["lightyellow"]="#FFFFE0" colors["lime"]="#00FF00" colors["limegreen"]="#32CD32" colors["linen"]="#FAF0E6" colors["magenta"]="#FF00FF" colors["maroon"]="#800000" colors["mediumaquamarine"]="#66CDAA" colors["mediumblue"]="#0000CD" colors["mediumorchid"]="#BA55D3" colors["mediumpurple"]="#9370DB" colors["mediumseagreen"]="#3CB371" colors["mediumslateblue"]="#7B68EE" colors["mediumspringgreen"]="#00FA9A" colors["mediumturquoise"]="#48D1CC" colors["mediumvioletred"]="#C71585" colors["midnightblue"]="#191970" colors["mintcream"]="#F5FFFA" colors["mistyrose"]="#FFE4E1" colors["moccasin"]="#FFE4B5" colors["navajowhite"]="#FFDEAD" colors["navy"]="#000080" colors["oldlace"]="#FDF5E6" colors["olive"]="#808000" colors["olivedrab"]="#6B8E23" colors["orange"]="#FFA500" colors["orangered"]="#FF4500" colors["orchid"]="#DA70D6" colors["palegoldenrod"]="#EEE8AA" colors["palegreen"]="#98FB98" colors["paleturquoise"]="#AFEEEE" colors["palevioletred"]="#DB7093" colors["papayawhip"]="#FFEFD5" colors["peachpuff"]="#FFDAB9" colors["peru"]="#CD853F" colors["pink"]="#FFC0CB" colors["plum"]="#DDA0DD" colors["powderblue"]="#B0E0E6" colors["purple"]="#800080" colors["red"]="#FF0000" colors["rosybrown"]="#BC8F8F" colors["royalblue"]="#4169E1" colors["saddlebrown"]="#8B4513" colors["salmon"]="#FA8072" colors["sandybrown"]="#F4A460" colors["seagreen"]="#2E8B57" colors["seashell"]="#FFF5EE" colors["sienna"]="#A0522D" colors["silver"]="#C0C0C0" colors["skyblue"]="#87CEEB" colors["slateblue"]="#6A5ACD" colors["slategray"]="#708090" colors["snow"]="#FFFAFA" colors["springgreen"]="#00FF7F" colors["steelblue"]="#4682B4" colors["tan"]="#D2B48C" colors["teal"]="#008080" colors["thistle"]="#D8BFD8" colors["tomato"]="#FF6347" colors["turquoise"]="#40E0D0" colors["violet"]="#EE82EE" colors["wheat"]="#F5DEB3" colors["white"]="#FFFFFF" colors["whitesmoke"]="#F5F5F5" colors["yellow"]="#FFFF00" colors["yellowgreen"]="#9ACD32" EndSub End>VFP128.sb< Start>VFP542.sb< ' アクションゲーム 1作目 ' ' 岡山科学技術専門学校 情報システム学科 教材 ' 各種定数の定義 cls: GraphicsWindow.Width = 700 GraphicsWindow.Height = 330 GraphicsWindow.BackgroundColor = "#B0F0E6" GraphicsWindow.FontSize = 60 GraphicsWindow.BrushColor = "#C050B0" GraphicsWindow.DrawText(170,8, "ロールボール2") GraphicsWindow.FontSize = 30 GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(1,90, "操作方法は前回と変わらない") GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawText(1,130, "難易度は前回より上がってるんじゃないかな") GraphicsWindow.BrushColor = "Blue" GraphicsWindow.DrawText(1,180, "[1~9]または[A~F]を押すと始まります") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(1,230, "ステージナンバー") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(1,260, "1 2 3 4 5 6 7 8 9 A B C D E F") KeyName = GraphicsWindow.LastKey If KeyName = "D1" Then Goto rt ElseIf KeyName = "D2" Then ss=2 Goto st ElseIf KeyName = "D3" Then ss=3 Goto st ElseIf KeyName = "D4" Then ss=4 Goto st ElseIf KeyName = "D5" Then ss=5 Goto st ElseIf KeyName = "D6" Then ss=6 Goto st ElseIf KeyName = "D7" Then ss=7 Goto st ElseIf KeyName = "D8" Then ss=8 Goto st ElseIf KeyName = "D9" Then ss=9 Goto st ElseIf KeyName = "A" then ss=10 Goto st ElseIf KeyName = "B" Then ss=11 Goto st ElseIf KeyName = "C" Then ss=12 Goto st ElseIf KeyName = "D" Then ss=13 Goto st ElseIf KeyName = "E" Then ss=14 Goto st ElseIf KeyName = "F" Then ss=15 Goto st EndIf Goto cls rt: ss=1 stage = 1 DEATH = 0 click=0 st: GraphicsWindow.Clear() SCREEN_WIDTH = 24 ' スクリーンの幅(ユニット数) SCREEN_HEIGHT = 18 ' スクリーンの高さ(ユニット数) UNIT_SIZE = 30 ' ユニットサイズ(ピクセル) GOAL_X = 1 GOAL_Y = 1 ENEMY_NUM = 5 SPEED = 5 ' 一度に移動するピクセル数 ENEMY_SPEED = 8 ' 敵の速度 DELAY = 50 ' ループ毎の待機時間(ミリ秒) WALL_COLOR = "#808080" ' 壁の色 BACK_COLOR = "#B0F0E6" ' 背景の色 ROBO_COLOR = "#0000FF" ' ロボットの色 ENEMY_COLOR = "#FF0000" ' Enemy Color ' 壁の配置(マップ)を定義 (1:壁あり, それ以外:壁なし) If ss=1 then ENEMY_NUM = 7 WALLS [1] = "111111111111111111111111" WALLS [2] = "100111111100011111111111" WALLS [3] = "100111111100011111111111" WALLS [4] = "100111111100011111111111" WALLS [5] = "100111111100011111111111" WALLS [6] = "100111111100011111111111" WALLS [7] = "100111111100011111111111" WALLS [8] = "100111111100000000000001" WALLS [9] = "100000000000000000000001" WALLS [10] = "100000000000000000000001" WALLS [11] = "100000000000011111111001" WALLS [12] = "111111111100011111111001" WALLS [13] = "111111111100011111111001" WALLS [14] = "111111111100011111111001" WALLS [15] = "111111111100011111111001" WALLS [16] = "111111111100011111111001" WALLS [17] = "111111111100011111111001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 10 ey[1] = UNIT_SIZE * 1 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 11 ey[2] = UNIT_SIZE * 16 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 12 ey[3] = UNIT_SIZE * 1 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 22 ey[4] = UNIT_SIZE * 7 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 1 ey[5] = UNIT_SIZE * 8 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 22 ey[6] = UNIT_SIZE * 9 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 1 ey[7] = UNIT_SIZE * 10 exd[7] = 1 eyd[7] = 0 Endif If ss=2 then ENEMY_NUM = 18 WALLS [1] = "111111111111111111111111" WALLS [2] = "100111111000001111111111" WALLS [3] = "100111110000000111111111" WALLS [4] = "110111100000000011111111" WALLS [5] = "110111000000000001111111" WALLS [6] = "110110000000000000111111" WALLS [7] = "110100000000000000011111" WALLS [8] = "110100000011100000011111" WALLS [9] = "110000000111110000001111" WALLS [10] = "111000000111110000000111" WALLS [11] = "111100000011100000010111" WALLS [12] = "111100000000000000010111" WALLS [13] = "111110000000000000110111" WALLS [14] = "111111000000000001110111" WALLS [15] = "111111100000000011110111" WALLS [16] = "111111110000000111110001" WALLS [17] = "111111111000001111111001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 5 ey[1] = UNIT_SIZE * 9 exd[1] = 0 eyd[1] = -1 ex[2] = UNIT_SIZE * 6 ey[2] = UNIT_SIZE * 8 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 7 ey[3] = UNIT_SIZE * 9 exd[3] = 0 eyd[3] = -1 ex[4] = UNIT_SIZE * 8 ey[4] = UNIT_SIZE * 8 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 2 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 10 ey[6] = UNIT_SIZE * 3 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 11 ey[7] = UNIT_SIZE * 4 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 10 ey[8] = UNIT_SIZE * 5 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 11 ey[9] = UNIT_SIZE * 6 exd[9] = 1 eyd[9] = 0 ex[10] = UNIT_SIZE * 14 ey[10] = UNIT_SIZE * 9 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 15 ey[11] = UNIT_SIZE * 8 exd[11] = 0 eyd[11] = -1 ex[12] = UNIT_SIZE * 16 ey[12] = UNIT_SIZE * 9 exd[12] = 0 eyd[12] = 1 ex[13] = UNIT_SIZE * 17 ey[13] = UNIT_SIZE * 8 exd[13] = 0 eyd[13] = -1 ex[14] = UNIT_SIZE * 11 ey[14] = UNIT_SIZE * 11 exd[14] = -1 eyd[14] = 0 ex[15] = UNIT_SIZE * 12 ey[15] = UNIT_SIZE * 12 exd[15] = 1 eyd[15] = 0 ex[16] = UNIT_SIZE * 11 ey[16] = UNIT_SIZE * 13 exd[16] = -1 eyd[16] = 0 ex[17] = UNIT_SIZE * 12 ey[17] = UNIT_SIZE * 14 exd[17] = 1 eyd[17] = 0 ex[18] = UNIT_SIZE * 11 ey[18] = UNIT_SIZE * 15 exd[18] = -1 eyd[18] = 0 Endif If ss=3 then ENEMY_NUM = 12 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000011111111111" WALLS [3] = "111111111100011111111111" WALLS [4] = "111111111100011111111111" WALLS [5] = "111111111100000000000011" WALLS [6] = "110000000000011111111111" WALLS [7] = "111111111100000000000011" WALLS [8] = "110000000000011111111111" WALLS [9] = "111111111100011111111111" WALLS [10] = "111111000000000001111111" WALLS [11] = "111111111100011111111111" WALLS [12] = "111111111100000000000011" WALLS [13] = "110000000000011111111111" WALLS [14] = "111111111100000000000011" WALLS [15] = "110000000000011111111111" WALLS [16] = "111111111100011111111111" WALLS [17] = "111111111100000000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 10 ey[1] = UNIT_SIZE * 1 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 11 ey[2] = UNIT_SIZE * 16 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 12 ey[3] = UNIT_SIZE * 1 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 10 ey[4] = UNIT_SIZE * 4 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 2 ey[5] = UNIT_SIZE * 5 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 10 ey[6] = UNIT_SIZE * 6 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 2 ey[7] = UNIT_SIZE * 7 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 6 ey[8] = UNIT_SIZE * 9 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 10 ey[9] = UNIT_SIZE * 11 exd[9] = 1 eyd[9] = 0 ex[10] = UNIT_SIZE * 2 ey[10] = UNIT_SIZE * 12 exd[10] = 1 eyd[10] = 0 ex[11] = UNIT_SIZE * 10 ey[11] = UNIT_SIZE * 13 exd[11] = 1 eyd[11] = 0 ex[12] = UNIT_SIZE * 2 ey[12] = UNIT_SIZE * 14 exd[12] = 1 eyd[12] = 0 Endif If ss=4 then ENEMY_NUM = 24 WALLS [1] = "111111111111111111111111" WALLS [2] = "101000000000000000000001" WALLS [3] = "101000000000000000000101" WALLS [4] = "101000000000000000000101" WALLS [5] = "100000011111111110000001" WALLS [6] = "111111100000000001011111" WALLS [7] = "100000000000000000000001" WALLS [8] = "100000000000000001000001" WALLS [9] = "100000000001100000000001" WALLS [10] = "100000000001100000000001" WALLS [11] = "100000100000000000000001" WALLS [12] = "100000000000000000000001" WALLS [13] = "111110100000000001111111" WALLS [14] = "100000011111111110000001" WALLS [15] = "101000000000000000000101" WALLS [16] = "101000000000000000000101" WALLS [17] = "100000000000000000000101" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 22 ey[1] = UNIT_SIZE * 1 exd[1] = -1 eyd[1] = 0 ex[2] = UNIT_SIZE * 3 ey[2] = UNIT_SIZE * 2 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 20 ey[3] = UNIT_SIZE * 3 exd[3] = -1 eyd[3] = 0 ex[4] = UNIT_SIZE * 1 ey[4] = UNIT_SIZE * 6 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 16 ey[5] = UNIT_SIZE * 7 exd[5] = -1 eyd[5] = 0 ex[6] = UNIT_SIZE * 1 ey[6] = UNIT_SIZE * 8 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 10 ey[7] = UNIT_SIZE * 9 exd[7] = -1 eyd[7] = 0 ex[8] = UNIT_SIZE * 7 ey[8] = UNIT_SIZE * 10 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 22 ey[9] = UNIT_SIZE * 11 exd[9] = -1 eyd[9] = 0 ex[10] = UNIT_SIZE * 20 ey[10] = UNIT_SIZE * 14 exd[10] = -1 eyd[10] = 0 ex[11] = UNIT_SIZE * 3 ey[11] = UNIT_SIZE * 15 exd[11] = 1 eyd[11] = 0 ex[12] = UNIT_SIZE * 20 ey[12] = UNIT_SIZE * 16 exd[12] = -1 eyd[12] = 0 ex[13] = UNIT_SIZE * 7 ey[13] = UNIT_SIZE * 6 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 8 ey[14] = UNIT_SIZE * 11 exd[14] = 0 eyd[14] = -1 ex[15] = UNIT_SIZE * 9 ey[15] = UNIT_SIZE * 6 exd[15] = 0 eyd[15] = 1 ex[16] = UNIT_SIZE * 10 ey[16] = UNIT_SIZE * 11 exd[16] = 0 eyd[16] = -1 ex[17] = UNIT_SIZE * 13 ey[17] = UNIT_SIZE * 6 exd[17] = 0 eyd[17] = 1 ex[18] = UNIT_SIZE * 14 ey[18] = UNIT_SIZE * 11 exd[18] = 0 eyd[18] = -1 ex[19] = UNIT_SIZE * 15 ey[19] = UNIT_SIZE * 6 exd[19] = 0 eyd[19] = 1 ex[20] = UNIT_SIZE * 16 ey[20] = UNIT_SIZE * 11 exd[20] = 0 eyd[20] = -1 ex[21] = UNIT_SIZE * 17 ey[21] = UNIT_SIZE * 6 exd[21] = 0 eyd[21] = 0 ex[22] = UNIT_SIZE * 6 ey[22] = UNIT_SIZE * 11 exd[22] = 0 eyd[22] = 0 ex[23] = UNIT_SIZE * 13 ey[23] = UNIT_SIZE * 8 exd[23] = 1 eyd[23] = 0 ex[24] = UNIT_SIZE * 22 ey[24] = UNIT_SIZE * 9 exd[24] = -1 eyd[24] = 0 Endif If ss=5 then ENEMY_NUM = 18 ENEMY_SPEED = 9 WALLS [1] = "111111111111111111111111" WALLS [2] = "101011011011011011011111" WALLS [3] = "101001001001001001001111" WALLS [4] = "101001001001001001001111" WALLS [5] = "101001001001001001001111" WALLS [6] = "101001001001000001001111" WALLS [7] = "101001001001001001001111" WALLS [8] = "101000001001001001001101" WALLS [9] = "100001001000001001000001" WALLS [10] = "101001001001001001001001" WALLS [11] = "111001001001001000001101" WALLS [12] = "111001001001001001001101" WALLS [13] = "111001000001001001001101" WALLS [14] = "111001001001001001001101" WALLS [15] = "111001001001001001001101" WALLS [16] = "111001001001001001001001" WALLS [17] = "111011011011011011011001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 2 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 3 ey[2] = UNIT_SIZE * 16 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 4 ey[3] = UNIT_SIZE * 8 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 6 ey[4] = UNIT_SIZE * 5 exd[4] = 0 eyd[4] = -1 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 15 exd[5] = 0 eyd[5] = -1 ex[6] = UNIT_SIZE * 7 ey[6] = UNIT_SIZE * 11 exd[6] = 0 eyd[6] = -1 ex[7] = UNIT_SIZE * 9 ey[7] = UNIT_SIZE * 1 exd[7] = 0 eyd[7] = -1 ex[8] = UNIT_SIZE * 9 ey[8] = UNIT_SIZE * 10 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 10 ey[9] = UNIT_SIZE * 7 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 12 ey[10] = UNIT_SIZE * 6 exd[10] = 0 eyd[10] = -1 ex[11] = UNIT_SIZE * 12 ey[11] = UNIT_SIZE * 15 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 13 ey[12] = UNIT_SIZE * 12 exd[12] = 0 eyd[12] = -1 ex[13] = UNIT_SIZE * 15 ey[13] = UNIT_SIZE * 2 exd[13] = 0 eyd[13] = -1 ex[14] = UNIT_SIZE * 15 ey[14] = UNIT_SIZE * 11 exd[14] = 0 eyd[14] = 1 ex[15] = UNIT_SIZE * 16 ey[15] = UNIT_SIZE * 6 exd[15] = 0 eyd[15] = 1 ex[16] = UNIT_SIZE * 18 ey[16] = UNIT_SIZE * 6 exd[16] = 0 eyd[16] = -1 ex[17] = UNIT_SIZE * 18 ey[17] = UNIT_SIZE * 16 exd[17] = 0 eyd[17] = 1 ex[18] = UNIT_SIZE * 19 ey[18] = UNIT_SIZE * 9 exd[18] = 0 eyd[18] = -1 Endif If ss=6 then ENEMY_NUM = 10 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100111111110211111101111" WALLS [3] = "100111100002011111101111" WALLS [4] = "100000000010011110101011" WALLS [5] = "111111111110011110101011" WALLS [6] = "111111111110011110000011" WALLS [7] = "111111111110011111111111" WALLS [8] = "111111111100011111111111" WALLS [9] = "102000000000200000000021" WALLS [10] = "120000000002000000000201" WALLS [11] = "110111111110001111111011" WALLS [12] = "110000000010011111100011" WALLS [13] = "111111111010011111101111" WALLS [14] = "100000111010011111100001" WALLS [15] = "101010111010011111111001" WALLS [16] = "100000111000211111111001" WALLS [17] = "101010111112011111111001" WALLS [18] = "100000111111111111111111" ex[1] = UNIT_SIZE * 1 ey[1] = UNIT_SIZE * 8 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 14 ey[2] = UNIT_SIZE * 8 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 9 ey[3] = UNIT_SIZE * 9 exd[3] = -1 eyd[3] = 0 ex[4] = UNIT_SIZE * 22 ey[4] = UNIT_SIZE * 9 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 7 exd[5] = 0 eyd[5] = -1 ex[6] = UNIT_SIZE * 11 ey[6] = UNIT_SIZE * 16 exd[6] = 0 eyd[6] = -1 ex[7] = UNIT_SIZE * 12 ey[7] = UNIT_SIZE * 1 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 12 ey[8] = UNIT_SIZE * 10 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 12 ey[9] = UNIT_SIZE * 8 exd[9] = 0 eyd[9] = 0 ex[10] = UNIT_SIZE * 11 ey[10] = UNIT_SIZE * 9 exd[10] = 0 eyd[10] = 0 Endif If ss=7 then ENEMY_NUM = 16 WALLS [1] = "111111111111111111111111" WALLS [2] = "100001111111111111111111" WALLS [3] = "111101111111111111111111" WALLS [4] = "111101111111111111111111" WALLS [5] = "111101111111111111111111" WALLS [6] = "110000300000003000000001" WALLS [7] = "100000300000003000000001" WALLS [8] = "100000300030003000300011" WALLS [9] = "110000300030003000300001" WALLS [10] = "100000300034443000300001" WALLS [11] = "100000300030003000300011" WALLS [12] = "110000000030000000300001" WALLS [13] = "100000000030000000300001" WALLS [14] = "111111111111111111110111" WALLS [15] = "111111111111111111110111" WALLS [16] = "111111111111111111110111" WALLS [17] = "111111111111111111110001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 5 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 12 ey[2] = UNIT_SIZE * 5 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 11 ey[3] = UNIT_SIZE * 6 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 20 ey[4] = UNIT_SIZE * 6 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 7 ey[5] = UNIT_SIZE * 7 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 16 ey[6] = UNIT_SIZE * 7 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 5 ey[7] = UNIT_SIZE * 8 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 22 ey[8] = UNIT_SIZE * 8 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 2 ey[9] = UNIT_SIZE * 9 exd[9] = 1 eyd[9] = 0 ex[10] = UNIT_SIZE * 14 ey[10] = UNIT_SIZE * 9 exd[10] = 1 eyd[10] = 0 ex[11] = UNIT_SIZE * 9 ey[11] = UNIT_SIZE * 10 exd[11] = 1 eyd[11] = 0 ex[12] = UNIT_SIZE * 17 ey[12] = UNIT_SIZE * 10 exd[12] = -1 eyd[12] = 0 ex[13] = UNIT_SIZE * 8 ey[13] = UNIT_SIZE * 11 exd[13] = 1 eyd[13] = 0 ex[14] = UNIT_SIZE * 21 ey[14] = UNIT_SIZE * 11 exd[14] = -1 eyd[14] = 0 ex[15] = UNIT_SIZE * 4 ey[15] = UNIT_SIZE * 12 exd[15] = 1 eyd[15] = 0 ex[16] = UNIT_SIZE * 15 ey[16] = UNIT_SIZE * 12 exd[16] = -1 eyd[16] = 0 Endif If ss=8 then GraphicsWindow.ShowMessage("作成中","") ss=ss+1 Goto st Endif If ss=9 then GraphicsWindow.ShowMessage("作成中","") ss=ss+1 Goto st Endif If ss=10 then GraphicsWindow.ShowMessage("作成中","") ss=ss+1 Goto st Endif If ss=11 then ENEMY_NUM = 11 WALLS [1] = "111111111111111111111111" WALLS [2] = "100040000000000111111111" WALLS [3] = "100110110110110111111111" WALLS [4] = "111110110110110111111111" WALLS [5] = "111110000000000111111111" WALLS [6] = "111110110110110111111111" WALLS [7] = "111110110110110111111111" WALLS [8] = "111110110110110111111111" WALLS [9] = "111110000000000000111111" WALLS [10] = "111110000000000000111111" WALLS [11] = "111111110110110110111111" WALLS [12] = "111111110110110110111111" WALLS [13] = "111111110110110110111111" WALLS [14] = "111111110000000000111111" WALLS [15] = "111111110110110110111111" WALLS [16] = "111111110110110110111001" WALLS [17] = "111111110000000000400001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 5 ey[1] = UNIT_SIZE * 9 exd[1] = 0 eyd[1] = -1 ex[2] = UNIT_SIZE * 8 ey[2] = UNIT_SIZE * 1 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 11 ey[3] = UNIT_SIZE * 16 exd[3] = 0 eyd[3] = -1 ex[4] = UNIT_SIZE * 14 ey[4] = UNIT_SIZE * 1 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 17 ey[5] = UNIT_SIZE * 8 exd[5] = 0 eyd[5] = -1 ex[6] = UNIT_SIZE * 5 ey[6] = UNIT_SIZE * 1 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 14 ey[7] = UNIT_SIZE * 4 exd[7] = -1 eyd[7] = 0 ex[8] = UNIT_SIZE * 5 ey[8] = UNIT_SIZE * 8 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 17 ey[9] = UNIT_SIZE * 9 exd[9] = -1 eyd[9] = 0 ex[10] = UNIT_SIZE * 8 ey[10] = UNIT_SIZE * 13 exd[10] = 1 eyd[10] = 0 ex[11] = UNIT_SIZE * 17 ey[11] = UNIT_SIZE * 16 exd[11] = -1 eyd[11] = 0 Endif If ss=12 then ENEMY_NUM = 15 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000000000000001" WALLS [3] = "111111111111111111111101" WALLS [4] = "111000300030003000300401" WALLS [5] = "111030003000300030003111" WALLS [6] = "111000300030003000300111" WALLS [7] = "111030003000300030003111" WALLS [8] = "111000300030003000300111" WALLS [9] = "111030003000300030003111" WALLS [10] = "111000300030003000300111" WALLS [11] = "111030003000300030003111" WALLS [12] = "111000300030003000300111" WALLS [13] = "111030003000300030003111" WALLS [14] = "111000300030003000300111" WALLS [15] = "104030003000300030003111" WALLS [16] = "101111111111111111111111" WALLS [17] = "100000000000000000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 5 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 5 ey[2] = UNIT_SIZE * 12 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 7 ey[3] = UNIT_SIZE * 3 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 9 ey[4] = UNIT_SIZE * 9 exd[4] = 0 eyd[4] = -1 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 7 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 13 ey[6] = UNIT_SIZE * 8 exd[6] = 0 eyd[6] = -1 ex[7] = UNIT_SIZE * 15 ey[7] = UNIT_SIZE * 4 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 17 ey[8] = UNIT_SIZE * 11 exd[8] = 0 eyd[8] = -1 ex[9] = UNIT_SIZE * 19 ey[9] = UNIT_SIZE * 5 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 20 ey[10] = UNIT_SIZE * 3 exd[10] = -1 eyd[10] = 0 ex[11] = UNIT_SIZE * 4 ey[11] = UNIT_SIZE * 5 exd[11] = 1 eyd[11] = 0 ex[12] = UNIT_SIZE * 16 ey[12] = UNIT_SIZE * 7 exd[12] = -1 eyd[12] = 0 ex[13] = UNIT_SIZE * 5 ey[13] = UNIT_SIZE * 9 exd[13] = 1 eyd[13] = 0 ex[14] = UNIT_SIZE * 18 ey[14] = UNIT_SIZE * 11 exd[14] = -1 eyd[14] = 0 ex[15] = UNIT_SIZE * 7 ey[15] = UNIT_SIZE * 13 exd[15] = 1 eyd[15] = 0 Endif If ss=13 then ENEMY_NUM = 12 WALLS [1] = "111111111111111111111111" WALLS [2] = "100040000000000000111111" WALLS [3] = "100110110110110110111111" WALLS [4] = "111110110110110110111111" WALLS [5] = "110003003000000000111111" WALLS [6] = "110110110110110111111111" WALLS [7] = "110110110110110111111111" WALLS [8] = "110000000000003000000111" WALLS [9] = "111110110110110110110111" WALLS [10] = "111110110110110110110111" WALLS [11] = "111110000003000003000111" WALLS [12] = "111110110110110110110111" WALLS [13] = "111110110110110110110111" WALLS [14] = "111110000000000000000111" WALLS [15] = "111111110110110110110111" WALLS [16] = "111111110110110110110111" WALLS [17] = "111111110000003000000401" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 5 ey[1] = UNIT_SIZE * 1 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 17 ey[2] = UNIT_SIZE * 4 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 2 ey[3] = UNIT_SIZE * 7 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 20 ey[4] = UNIT_SIZE * 10 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 5 ey[5] = UNIT_SIZE * 13 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 20 ey[6] = UNIT_SIZE * 16 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 5 ey[7] = UNIT_SIZE * 13 exd[7] = 0 eyd[7] = -1 ex[8] = UNIT_SIZE * 8 ey[8] = UNIT_SIZE * 1 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 11 ey[9] = UNIT_SIZE * 16 exd[9] = 0 eyd[9] = -1 ex[10] = UNIT_SIZE * 14 ey[10] = UNIT_SIZE * 1 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 17 ey[11] = UNIT_SIZE * 16 exd[11] = 0 eyd[11] = -1 ex[12] = UNIT_SIZE * 20 ey[12] = UNIT_SIZE * 7 exd[12] = 0 eyd[12] = 1 Endif If ss=14 then ENEMY_NUM = 13 ENEMY_SPEED = 10 WALLS [1] = "111111111111111111111111" WALLS [2] = "100011111110000000000011" WALLS [3] = "100011111110111011111011" WALLS [4] = "101111100000000000000011" WALLS [5] = "101111101110111011111011" WALLS [6] = "100000001110111011111011" WALLS [7] = "111111100000000000000011" WALLS [8] = "100000000000111011111011" WALLS [9] = "101111101113111011111011" WALLS [10] = "101111101110111011111011" WALLS [11] = "101111101110000000000011" WALLS [12] = "100000000000000011111111" WALLS [13] = "101111101110111000000001" WALLS [14] = "101111101110111011111101" WALLS [15] = "100000000000000011111101" WALLS [16] = "101111101110111111110001" WALLS [17] = "100000000000111111110001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 11 ey[1] = UNIT_SIZE * 1 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 7 ey[2] = UNIT_SIZE * 3 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 21 ey[3] = UNIT_SIZE * 6 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 1 ey[4] = UNIT_SIZE * 7 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 10 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 15 ey[6] = UNIT_SIZE * 11 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 1 ey[7] = UNIT_SIZE * 14 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 1 ey[8] = UNIT_SIZE * 16 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 1 ey[9] = UNIT_SIZE * 7 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 7 ey[10] = UNIT_SIZE * 3 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 11 ey[11] = UNIT_SIZE * 1 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 15 ey[12] = UNIT_SIZE * 1 exd[12] = 0 eyd[12] = 1 ex[13] = UNIT_SIZE * 21 ey[13] = UNIT_SIZE * 1 exd[13] = 0 eyd[13] = 1 EndIf If ss=15 then ENEMY_NUM = 20 WALLS [1] = "111111111111111111111111" WALLS [2] = "100100001111111111111111" WALLS [3] = "100001100000000000111111" WALLS [4] = "100111011011011011011111" WALLS [5] = "111111000000000000011111" WALLS [6] = "111111011011011011011111" WALLS [7] = "111111000000000000011111" WALLS [8] = "111111111011011011011111" WALLS [9] = "111111000000000000011111" WALLS [10] = "111111011011011011011111" WALLS [11] = "111111000000000000011111" WALLS [12] = "111111011011011011011111" WALLS [13] = "111111000000000000011111" WALLS [14] = "111111011011011011111111" WALLS [15] = "111111000000000000011001" WALLS [16] = "111111011011011011000001" WALLS [17] = "111111000000000000011001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 7 ey[1] = UNIT_SIZE * 2 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 18 ey[2] = UNIT_SIZE * 4 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 6 ey[3] = UNIT_SIZE * 6 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 18 ey[4] = UNIT_SIZE * 8 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 10 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 18 ey[6] = UNIT_SIZE * 12 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 6 ey[7] = UNIT_SIZE * 14 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 18 ey[8] = UNIT_SIZE * 16 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 6 ey[9] = UNIT_SIZE * 8 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 9 ey[10] = UNIT_SIZE * 4 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 12 ey[11] = UNIT_SIZE * 11 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 15 ey[12] = UNIT_SIZE * 7 exd[12] = 0 eyd[12] = -1 ex[13] = UNIT_SIZE * 18 ey[13] = UNIT_SIZE * 3 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 12 ey[14] = UNIT_SIZE * 2 exd[14] = 0 eyd[14] = 0 ex[15] = UNIT_SIZE * 12 ey[15] = UNIT_SIZE * 6 exd[15] = 0 eyd[15] = 0 ex[16] = UNIT_SIZE * 9 ey[16] = UNIT_SIZE * 8 exd[16] = 0 eyd[16] = 0 ex[17] = UNIT_SIZE * 15 ey[17] = UNIT_SIZE * 8 exd[17] = 0 eyd[17] = 0 ex[18] = UNIT_SIZE * 12 ey[18] = UNIT_SIZE * 12 exd[18] = 0 eyd[18] = 0 ex[19] = UNIT_SIZE * 15 ey[19] = UNIT_SIZE * 14 exd[19] = 0 eyd[19] = 0 ex[20] = UNIT_SIZE * 9 ey[20] = UNIT_SIZE * 16 exd[20] = 0 eyd[20] = 0 EndIf If ss=16 then GraphicsWindow.ShowMessage("全ステージクリア", "おめでとう") Goto gameend Endif ' スクリーンの初期設定 GraphicsWindow.Show() ' 表示 GraphicsWindow.Width = SCREEN_WIDTH * UNIT_SIZE ' 幅を設定 GraphicsWindow.Height = SCREEN_HEIGHT * UNIT_SIZE ' 高さを設定 GraphicsWindow.CanResize = "False" ' サイズを固定 GraphicsWindow.BackgroundColor = BACK_COLOR ' 背景色を設定 ' 壁の描画 GraphicsWindow.BrushColor = WALL_COLOR ' ブラシの色を設定 For iy = 1 To Array.GetItemCount(WALLS) ' 縦方向の繰り返し(WALLS配列の数だけ) For ix = 1 To Text.GetLength(WALLS [iy]) ' 横方向の繰り返し(文字列の長さだけ) If Text.GetSubText(WALLS [iy], ix, 1) = "1" Then ' 文字が"1"だったら GraphicsWindow.FillRectangle(UNIT_SIZE * (ix - 1), UNIT_SIZE * (iy - 1), UNIT_SIZE, UNIT_SIZE) EndIf EndFor EndFor ' 壁2の描画 GraphicsWindow.BrushColor = "Green" ' ブラシの色を設定 For iy = 1 To Array.GetItemCount(WALLS) ' 縦方向の繰り返し(WALLS配列の数だけ) For ix = 1 To Text.GetLength(WALLS [iy]) ' 横方向の繰り返し(文字列の長さだけ) If Text.GetSubText(WALLS [iy], ix, 1) = "3" Then ' 文字が"3"だったら GraphicsWindow.FillRectangle(UNIT_SIZE * (ix - 1), UNIT_SIZE * (iy - 1), UNIT_SIZE, UNIT_SIZE) EndIf EndFor EndFor ' 壁3の描画 GraphicsWindow.BrushColor = "Yellow" ' ブラシの色を設定 For iy = 1 To Array.GetItemCount(WALLS) ' 縦方向の繰り返し(WALLS配列の数だけ) For ix = 1 To Text.GetLength(WALLS [iy]) ' 横方向の繰り返し(文字列の長さだけ) If Text.GetSubText(WALLS [iy], ix, 1) = "4" Then ' 文字が"3"だったら GraphicsWindow.FillRectangle(UNIT_SIZE * (ix - 1), UNIT_SIZE * (iy - 1), UNIT_SIZE, UNIT_SIZE) EndIf EndFor EndFor ' GOAL GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = "True" GraphicsWindow.DrawText(GOAL_X * UNIT_SIZE, GOAL_Y * UNIT_SIZE, "GOAL") ' ロボットのスタート地点 x = UNIT_SIZE * 22 ' 横位置 (左から12ユニット) y = UNIT_SIZE * 16 ' 縦位置 (上から10ユニット) xd = 0 ' 横移動方向 (-1:左, 0:止, 1:右) 移動用 yd = 0 ' 縦移動方向 (-1:上, 0:止, 1:下) 移動用 xk = 0 ' 横移動方向 (-1:左, 0:止, 1:右) キーボード受付用 yk = 0 ' 縦移動方向 (-1:上, 0:止, 1:下) キーボード受付用 ' ロボット初期描画 GraphicsWindow.BrushColor = ROBO_COLOR ' ブラシの色を設定 GraphicsWindow.PenColor = ROBO_COLOR ' ペンの色を���定 robot = Shapes.AddEllipse(UNIT_SIZE, UNIT_SIZE) ' ロボットのシェイプを設定 Shapes.Move(robot, x, y) ' ロボットのシェイプを初期位置に ' 敵の描画 GraphicsWindow.BrushColor = ENEMY_COLOR GraphicsWindow.PenColor = ENEMY_COLOR For ie = 1 To ENEMY_NUM enemy[ie] = Shapes.AddEllipse(UNIT_SIZE, UNIT_SIZE) Shapes.Move(enemy[ie], ex[ie], ey[ie]) EndFor Controls.AddButton("終了",660,5) Controls.ButtonClicked = onbutton1 ' キーボードイベントの設定 GraphicsWindow.KeyDown = onKeyDown ' キーが押されたらonKeyDownサブルーチンを呼ぶ While xk = 0 And yk = 0 EndWhile starttime = Clock.ElapsedMilliseconds ' メインループ status = "" While status = "" ' 繰り返し(無条件に) ' キーボードからの方向指示を受け付ける ' ロボットの縦位置・横位置ともにユニット単位だったら If Math.Remainder(x, UNIT_SIZE) = 0 And Math.Remainder(y, UNIT_SIZE) = 0 Then ' キーボード受け付け用の方向情報を移動用の方向情報にコピー xd = xk ' 横方向 yd = yk ' 縦方向 EndIf ' このまま一回分進んだ場合のマップ上の位置を求める ' まずピクセル単位で位置を求め、それをユニットのサイズで割ることでマップ上の位置を求める If xd < 0 Then nx = x - 1 ElseIf 0 < xd then nx = x + UNIT_SIZE + 1 Else nx = x EndIf nxi = Math.Floor(nx / UNIT_SIZE) + 1 If yd < 0 Then ny = y - 1 ElseIf 0 < yd then ny = y + UNIT_SIZE + 1 Else ny = y EndIf nyi = Math.Floor(ny / UNIT_SIZE) + 1 ' マップ上の求めた位置に壁があるか If Text.GetSubText(WALLS [nyi], nxi, 1) = "1" Then ' すべての移動方向を0に設定する(つまり、停止させる) xk = 0 yk = 0 xd = 0 yd = 0 EndIf If Text.GetSubText(WALLS [nyi], nxi, 1) = "3" Then ' すべての移動方向を0に設定する(つまり、停止させる) xk = 0 yk = 0 xd = 0 yd = 0 EndIf ' ロボットの移動位置を計算 x = x + xd * SPEED y = y + yd * SPEED ' ロボットのシェイプを移動 Shapes.Move(robot, x, y) ' ゴール判定 If x = GOAL_X * UNIT_SIZE And y = GOAL_Y * UNIT_SIZE Then status = "GOAL" gametime = Clock.ElapsedMilliseconds - starttime GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(300,200, gametime / 100) EndIf ' 敵の動き For ie = 1 To ENEMY_NUM If exd[ie] < 0 Then enx = ex[ie] - 1 ElseIf 0 < exd[ie] then enx = ex[ie] + UNIT_SIZE + 1 Else enx = ex[ie] EndIf enxi = Math.Floor(enx / UNIT_SIZE) + 1 If eyd[ie] < 0 Then eny = ey[ie] - 1 ElseIf 0 < eyd[ie] then eny = ey[ie] + UNIT_SIZE + 1 Else eny = ey[ie] EndIf enyi = Math.Floor(eny / UNIT_SIZE) + 1 If Text.GetSubText(WALLS [enyi], enxi, 1) = "1" Then ' 敵が壁にぶつかった時、逆方向に動く exd[ie] = -exd[ie] eyd[ie] = -eyd[ie] EndIf If Text.GetSubText(WALLS [enyi], enxi, 1) = "4" Then ' 敵が壁にぶつかった時、逆方向に動く exd[ie] = -exd[ie] eyd[ie] = -eyd[ie] EndIf ex[ie] = ex[ie] + exd[ie] * ENEMY_SPEED ey[ie] = ey[ie] + eyd[ie] * ENEMY_SPEED Shapes.Move(enemy[ie], ex[ie], ey[ie]) If (x - ex[ie]) * (x - ex[ie]) + (y - ey[ie]) * (y - ey[ie]) < UNIT_SIZE * UNIT_SIZE Then status = "GAME OVER" GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.PenColor = "Yellow" GraphicsWindow.FillEllipse(x - 135, y - 135, 300, 300) Program.Delay(DELAY) GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.FillEllipse(x - 135, y - 135, 300, 300) GraphicsWindow.ShowMessage("ギャーーー!!", "OUT") DEATH=DEATH+1 GraphicsWindow.ShowMessage("あなたの死亡回数は"+DEATH+"です", "OUT") If DEATH = 50 then GraphicsWindow.ShowMessage("つらくなってきたかな?", "がんばれ") Endif If DEATH = 100 then GraphicsWindow.ShowMessage("もうだめぽ", "OUT") GraphicsWindow.Clear() Goto gameend Endif Goto st EndIf If click = 1 then GraphicsWindow.ShowMessage("お疲れさまでした", "ゲームを終了します") GraphicsWindow.Clear() click = 0 Goto cls EndIf GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(3,3, ""+ss+"") EndFor ' 速度調整のための待機 Program.Delay(DELAY) EndWhile If status = "GOAL" then If ss=6 then GraphicsWindow.ShowMessage ("残機が15機増えた","命を手に入れた") DEATH = DEATH - 15 If DEATH < 0 then DEATH = 0 EndIf EndIf GraphicsWindow.ShowMessage("次のステージへ", "ゴール") ss=ss+1 GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(3,3, ""+ss+"") goto st EndIf gameend: Goto cls Sub onbutton1 click = click + 1 EndSub ' サブルーチン (キーが押されたときに呼ばれる) Sub onKeyDown KeyName = GraphicsWindow.LastKey ' 最後に操作されたキーの名前を取得 If KeyName = "Left" Then ' カーソル(左)キーだったら xk = -1 ' 横移動方向を左(-1)に yk = 0 ' 縦移動方向を止(0)に ElseIf KeyName = "Right" Then ' カーソル(右)キーだったら xk = 1 ' 横移動方向を右(1)に yk = 0 ' 縦移動方向を止(0)に ElseIf KeyName = "Up" Then ' カーソル(上)キーだったら xk = 0 ' 横移動方向を止(0)に yk = -1 ' 縦移動方向を上(-1)に ElseIf KeyName = "Down" Then ' カーソル(下)キーだ���たら xk = 0 ' 横移動方向を止(0)に yk = 1 ' 縦移動方向を下(1)に ElseIf KeyName = "Space" Then xk = 0 yk = 0 EndIf EndSub End>VFP542.sb< Start>VFQ049.sb< ' Challenge of the Month - May 2012 Tower of Hanoi by NaochanON 2012/-05/15 ' small rect can be stacked on the Large one. But large rect cannot be stacked on the small one. init() PoleandRect() Controls.ButtonClicked=onbuttonclick GraphicsWindow.MouseMove=onmousedown GraphicsWindow.MouseUp=onmouseup Sub onmouseup MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY RPN=math.Ceiling((MX-30)/420) ' Released Pole Number cnt= Array.GetItemCount(st[RPN]) ' count of array st[X] before release TopN= st[RPN][1] ' Top number of st[X] If (RPN=MPN And TopN="") Or (RPN=MPN And TopN>onmove) Then ' released at other pole PosY[onmove]=500-(cnt+1)*50 PosX[onmove]=(230+420*(RPN-1))-(50+20*onmove) Shapes.Animate(rect[onmove],PosX[onmove] ,PosY[onmove],1000) ' rect is stacked st[RPN][onmove]=onmove ' change array data onmove=0 ' Release If Array.GetItemCount(st[RPN])=N And RPN>1 Then Shapes.Animate(cong,450,20,2000) EndIf elseif RPN=MPN And TopN>0 and onmove>TopN then ' if rect number is larger than top's GoBack() elseif RPN=CPN then ' if same pole GoBack() EndIf mm=mm+1 ' count up turn number Controls.SetTextBoxText(cntbox,msg3+mm) ' show turn number catch=0 EndSub Sub GoBack PosY[onmove]=500-(cntmd+1)*50 PosX[onmove]=(230+420*(CPN-1))-(50+20*onmove) Shapes.Animate(rect[onmove],PosX[onmove] ,PosY[onmove],1000) st[CPN][onmove]=onmove onmove=0 endsub Sub onmousedown If Flag=1 and mouse.IsLeftButtonDown Then MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY If catch=0 Then For i=1 To N If math.abs(PosX[i]-MX)<200 and math.abs(Posy[i]-MY)<50 then onmove=i CPN= math.Ceiling((MX-30)/420) ' CPN.... caught Pole Number st[CPN][onmove]="" ' remove the number cntmd= Array.GetItemCount(st[CPN]) ' array data number catch=1 i=N endif Endfor endif onmousemove() endif endsub Sub onmousemove MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY MPN=math.Ceiling((MX-30)/420) ' MPN.... moving Pole Number If MY>100 and onmove>0 And Mouse.IsLeftButtonDown Then PosX[onmove] = (230+420*(MPN-1))-(50+20*onmove) ' rect moves vertically PosY[onmove] = GraphicsWindow.MouseY Shapes.Move(rect[onmove],posX[onmove],posY[onmove]) ' elseIf MY<100 and Mouse.IsLeftButtonDown Then PosX[onmove] = GraphicsWindow.Mousex -(50+20*onmove) PosY[onmove] = GraphicsWindow.MouseY Shapes.Move(rect[onmove],posX[onmove],posY[onmove]) ' rect moves freely EndIf EndSub Sub Left_stacking ' Initial stacking For i=1 To 6 Shapes.Move(rect[i],0,-100) ' first of all rects are hidden EndFor For i=N To 1 Step -1 PosX[i]=230-(50+20*(i)) PosY[i]=500-50*(N-i+1) Shapes.Move(rect[i],PosX[i], PosY[i]) ' Rects are stacked at Left pole st[1][i]=i ' st1=123.... connected the number st[2][i]="" st[3][i]="" EndFor MM=0 Controls.SetTextBoxText(cntbox,msg3+MM) ' show First turn number Controls.SetTextBoxText(box2,msg2+minN[N]) ' show minimum turn number Flag=1 ' when first left stack catch=0 Shapes.Move(cong,Math.GetRandomNumber(1000),1000)' hide for next stage Program.Delay(100) endsub Sub init GraphicsWindow.Width=1300 GraphicsWindow.Height=700 GraphicsWindow.Top=20 GraphicsWindow.Left=20 GraphicsWindow.Show() GraphicsWindow.BackgroundColor="Black" GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawText(300,300,"Wait a moment........") Pic=Flickr.GetRandomPicture("Mountain") GraphicsWindow.DrawResizedImage(pic,0,0,1300,700) GraphicsWindow.BrushColor="Red" ' LF=Text.GetCharacter(10) Exp=Shapes.AddText("Select stack number and push EXE ") Shapes.Move(exp,100,625) GraphicsWindow.FontSize=16 box= Controls.AddTextBox(125,545) N=3 ' minimum stacking number msg="Number= "+LF+" " Controls.SetSize(box,100,50) Controls.SetTextBoxText(box,msg+N) box2= Controls.AddTextBox(500,545) Controls.SetSize(box2,200,30) msg2="Minimum turn= " Controls.SetTextBoxText(box2,msg2) cntbox=controls.AddTextBox(750,550) msg3="Your turn = " Controls.SetTextBoxText(cntbox,msg3) ' GraphicsWindow.BrushColor="Darkcyan" GraphicsWindow.FillRectangle(0,522,1300,300) btn=Controls.AddButton("EXE",300,550) Controls.SetSize(btn,100,30) ' mark1=Controls.AddButton("▲",100,540) mark2=Controls.AddButton("▼",100,570) ' Polename="1=Left;2=Center;3=Right" ' Pole name minN="1=1;2=3;3=7;4=15;5=31;6=63" ' minimum turn number (gotten by Net : 2^n-1 ) EndSub Sub getcolor Retry: color=GraphicsWindow.GetRandomColor() If Text.IsSubText(s,color) Then Goto Retry EndIf s=s+color+":" EndSub Sub PoleandRect For i=1 To 3 getcolor() GraphicsWindow.BrushColor=color GraphicsWindow.PenColor=color base[i]=Shapes.AddRectangle(400,20) Shapes.Move(base[i],30+(i-1)*420,500) Pole[i]=Shapes.AddRectangle(20,400) ' make poles Shapes.Move(pole[i],220+(i-1)*420,500-400) EndFor ' For j=1 To 7 getcolor() GraphicsWindow.BrushColor=color GraphicsWindow.PenColor=color rect[j]=Shapes.AddRectangle(100+40*j,50) ' make rects Shapes.SetOpacity(rect[j],90) Shapes.Move(rect[j],0,-100) EndFor ' GraphicsWindow.BrushColor="Yellow" cong= Shapes.AddText("Congratulation ! That's right ") Shapes.Move(cong,Math.GetRandomNumber(1000),1000) Shapes.Zoom(cong,3,3) EndSub Sub onbuttonclick nm= Controls.GetButtonCaption(Controls.LastClickedButton) If nm="▲" Or nm="▼" Then If nm="▲" Then N=N+1 If N>6 Then N=6 EndIf ElseIf nm="▼" then N=N-1 If N<3 Then N=3 EndIf EndIf Controls.SetTextBoxText(box,msg+N) ElseIf nm="EXE" then Left_stacking() EndIf EndSub End>VFQ049.sb< Start>VFQ142-0.sb< name= "Bob" colour= "cyan" GraphicsWindow.Show() GraphicsWindow.Height= 650 GraphicsWindow.Width= 1000 GraphicsWindow.Left= 5 GraphicsWindow.Top= 5 GraphicsWindow.BackgroundColor= "black" GraphicsWindow.BrushColor= colour GraphicsWindow.PenColor= "white" GraphicsWindow.TextInput= MoveCycle Restart: GraphicsWindow.Clear() delY=0 delX=0 player= Shapes.AddEllipse(15,40) x=0 y=0 Moving= "true" Start: If (Moving= "true") Then X = x+delX Y = y+delY GraphicsWindow.Title= "X= "+X+ " : Y= "+Y Shapes.Move(player,x,y) Timer.Interval= 1 Timer = 1 Timer.tick= OnTimerTick 'If (x>5 and y>5) Then If(GraphicsWindow.GetPixel(x+40/2+delX,y+40/2+delY) <> "#000000") Then GraphicsWindow.ShowMessage("1You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") Goto Restart ElseIf (x>1000 or x650 or yVFQ142-0.sb< Start>VFQ142-2.sb< name= "Bob" colour= "cyan" GraphicsWindow.Show() GraphicsWindow.Height= 650 GraphicsWindow.Width= 1000 GraphicsWindow.Left= 5 GraphicsWindow.Top= 5 GraphicsWindow.BackgroundColor= "black" GraphicsWindow.BrushColor= colour GraphicsWindow.PenColor= "white" GraphicsWindow.KeyDown= MoveCycle ' <-------------------- init() While "true" moving() Program.Delay(50) If crashed="true" Then Shapes.Remove(player) GraphicsWindow.Clear() Program.Delay(500) init() EndIf endwhile Sub init delY=0 delX=0 player= Shapes.AddEllipse(15,40) crashed="false" endsub Sub moving X = shapes.GetLeft(player)+delX Y = shapes.GetTop(player)+delY If x<0 then '<---------------------------- x=-1 elseif x>1001 then X=1001 elseif Y<0 then Y=-1 elseif y>650 then Y=651 endif '<---------------------------- Shapes.Move(player,x,y) GraphicsWindow.Title= "X= "+X+ " : Y= "+Y If (GraphicsWindow.GetPixel(x+40/2+delX,y+40/2+delY) <> "#000000") Then GraphicsWindow.ShowMessage("1 You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" ElseIf (x>1000 or x<0) then GraphicsWindow.ShowMessage("2 You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" ElseIf (y>650 or y<0) then GraphicsWindow.ShowMessage("3 You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" EndIf GraphicsWindow.BrushColor= colour GraphicsWindow.FillRectangle(x +15/4-1, y + 40/3+2, 12, 12) EndSub Sub MoveCycle key= GraphicsWindow.LastKey If (key= "Right") Then '<------------------- delX= 12 delY= 0 Shapes.Rotate(player,90) ElseIf (key= "Left") Then '<-------------------- delX= -12 delY=0 Shapes.Rotate(player,90) ElseIf (key= "Down") Then '<-------------------- delY= 12 delX=0 Shapes.Rotate(player,0) ElseIf (key= "Up") Then '<-------------------- delY= -12 delX=0 Shapes.Rotate(player,0) EndIf EndSub End>VFQ142-2.sb< Start>VFQ142.sb< name= "Bob" colour= "cyan" GraphicsWindow.Show() GraphicsWindow.Height= 650 GraphicsWindow.Width= 1000 GraphicsWindow.Left= 5 GraphicsWindow.Top= 5 GraphicsWindow.BackgroundColor= "black" GraphicsWindow.BrushColor= colour GraphicsWindow.PenColor= "white" Restart: GraphicsWindow.Clear() delY=0 delX=0 player= Shapes.AddEllipse(15,40) x=0 y=0 Moving= "true" Start: If (Moving= "true") Then X = x+delX Y = y+delY GraphicsWindow.TextInput= MoveCycle Shapes.Move(player,x,y) Timer.Interval= 1 Timer = 1 Timer.tick= OnTimerTick If (x>5 and y>5) Then If(GraphicsWindow.GetPixel(x+15/2+2,y+40/2+2) <> "#000000") Then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") Goto Restart ElseIf (x>1000 or x<5) then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") Goto Restart ElseIf (y>650 or y<5) then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") Goto Restart EndIf Endif GraphicsWindow.BrushColor= colour GraphicsWindow.FillRectangle(x +15/4-1, y + 40/3+2, 12, 12) Endif Program.Delay(50) Goto Start Sub MoveCycle key= GraphicsWindow.LastKey If (key= "D") Then delX= 12 delY= 0 Shapes.Rotate(player,90) ElseIf (key= "A") Then delX= -12 delY=0 Shapes.Rotate(player,90) ElseIf (key= "S") Then delY= 12 delX=0 Shapes.Rotate(player,0) ElseIf (key= "W") Then delY= -12 delX=0 Shapes.Rotate(player,0) EndIf EndSub Sub OnTimerTick timer= timer+1 EndSub End>VFQ142.sb< Start>VFQ973.sb< dw=1200 dh=900 sffm="false"'<<<---------set true to display 3d nodes GraphicsWindow.Title="Drawing, please wait... GraphicsWindow .Left =0 GraphicsWindow.Top=0 TextWindow.Show () TextWindow.Left=1230 TextWindow.top=0 TextWindow.BackgroundColor="darkblue TextWindow.ForegroundColor="lime LDUtilities.ShowErrors="false nln=text.GetCharacter (13)+Text.GetCharacter(10) GraphicsWindow.KeyDown=kdd at["["]="] at["{"]="} at["<"]="> rvn="false ft="" ftf="" GraphicsWindow.BackgroundColor="teal GraphicsWindow.Width=dw GraphicsWindow.Height=dh view3D = LD3DView.AddView(dw,dh,"true") 'Will not clip to size if window rescaled LD3DView.AddDirectionalLight (view3D,"gold",-1 ,-1 ,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#55888888") LD3DView.ResetCamera(view3D,0,10,10, -1, -1, -1, "","","") 'LD3DView.AutoControl ("true" "true", -1 .25) nrmz="0 0 1: 0 0 1: 0 0 1: 0 0 1: 0 0 1: 0 0 1 indices = "0 1 2 3 4 5 ii=1 ta[0]=1 rt="" args=0 txtr="0 0 :1 0 :1 1"'<<<<---------------texture mapping for triangles Sub m3d tc=ldtext.Split (args[1] " ") For r=1 To Array.GetItemCount (tc) If Text.StartsWith (tc[r] "a") Then tang=text.GetSubTextToEnd (tc[r] 2) elseIf Text.StartsWith (tc[r] "r") Then tang=tang+text.GetSubTextToEnd (tc[r] 2) elseIf Text.StartsWith (tc[r] "{") or Text.StartsWith (tc[r] "[") or Text.StartsWith (tc[r] "<") Then nx="" lr=text.GetSubText (tc[r] 1 1) qq=text.GetSubTextToEnd (tc[r] 2) r=r+1 rtt: if tc[r]=at[lr] then else nx=nx+tc[r]+" " r=r+1 Goto rtt endif ' TextWindow.WriteLine (lr+qq+": "+nx) For q=1 to qq Stack.PushValue ("q" q) Stack.PushValue ("r" r) Stack.PushValue ("qq" qq) Stack.PushValue ("tt" tc) LDCall.Function("m3d" nx) q=stack.PopValue ("q") qq=stack.PopValue ("qq") tc=stack.PopValue ("tt") r=Stack.PopValue ("r") endfor elseIf Text.StartsWith (tc[r] "m") Then dst=text.GetSubTextToEnd (tc[r] 2) If pln="XY" then nn=LDMath.Convert2Cartesian (px py dst tang) cc=cc+nn[1]+":"+pz+":"+nn[2]+"| px=nn[1] py=nn[2] elseif pln="XZ" then nn=LDMath.Convert2Cartesian (px pz dst tang) cc=cc+nn[1]+":"+nn[2]+":"+py+"| px=nn[1] pz=nn[2] Else nn=LDMath.Convert2Cartesian (py pz dst tang) cc=cc+px+":"+nn[2]+":"+nn[1]+"| py=nn[1] pz=nn[2] endif EndIf EndFor endsub Sub lmake For ou=1 to 4 If ou=1 then ctx="m.45 "+ct else ctx=ct endif ldcall.Function ("m3d" ctx) endfor EndSub 'model nodes, can be replaced by ur desired 3d model or loaded from a file, struct.: x1: y1: z1:... xn: yn: zn 'warning: this is very long line, over 25000 chars! pl=LDText.Split ("XY YZ XZ" " ") ct="<4 m.5 > {6 r15 m.1 } For ij=1 to 3 pln=pl[ij] px=0 py=0 pz=0 tang=0 lmake() ln=LDText.Split (cc,"|" ) mfacets() cc="" endfor pln="XY px=0 py=0 pz=2.75 tang=0 lmake() ln=LDText.Split (cc,"|" ) mfacets() cc="" pln="XZ px=0 pz=0 py=2.75 tang=0 lmake() ln=LDText.Split (cc,"|" ) mfacets() cc="" pln="YZ py=0 pz=0 px=2.8 tang=0 lmake() ln=LDText.Split (cc,"|" ) mfacets() cc="" GraphicsWindow.Title=(ix-1) +" nodes ya=5 r35=10 ai=1 aa=45 LDEvents.MouseWheel=mww cs=LD3DView.AddSphere (view3D .055 30 "cyan" "D") rottc() mww() Sub addnd'--------------------------------------------------------------creates 3d nodes for rightside hemisphere al=ldtext.Split (args[1] ":") For f=1 To Array.GetItemCount (al) ag=ldtext.Split (al[f] " ") rt="" For r=1 To 3 rt=rt+(ldarray.GetValue (lsx ag[r]))+": rt=rt+ldarray.GetValue (lsz ag[r])+": rt=rt+(ldarray.GetValue (lsy ag[r]))+": EndFor o1=LD3DView.AddGeometry(view3D,rt,indices,nrmz,"White","D") 'LD3DView.AddImage (view3D o1 txtr im "D") EndFor endsub Sub make2tr'-------------------------------------------------------------------------2 triangles at once = 1 square al=ldtext.Split (ldtext.Replace (args[1] ":" " ") " ") ret=al[1]+" " ret=text.Append (ret, al[2]+" ") ret=text.Append (ret, al[3]+":") ret=text.Append (ret, al[1]+" ") ret=text.Append (ret, al[3]+" ") ret=text.Append (ret, al[4]+":") 'TextWindow.WriteLine (ret) return=ret fct=fct+2 EndSub Sub makectr1 all1=ldtext.Split (ldtext.Replace (args[1] ":" " ") " ") ww=":" t1="" For zx=2 to array.GetItemCount (all1)-2 Step 2 t1=t1+LDCall.Function ("make2tr" all1[zx-1]+ww+all1[zx]+ww+all1[zx+2]+ww+all1[zx+1]) endfor ldcall.Function( "addnd" t1) ldcall.Function( "addnd1" t1) endsub Sub fmake atx=LDText.Split (ft "|") For qw=1 to Array.GetItemCount(atx) tt=tt+LDCall.Function (ftf atx[qw]) endfor endsub Sub mfacets'---------------------------------------------------------------------------------makes nodes & facets lsx=LDArray.Create (2000) lsz=LDArray.Create (2000) lsy=LDArray.Create (2000) ix=1 ss=": For x=1 To Array.GetItemCount (ln) l1=LDText.Split(ln[x] ":") For f=1 to Array.GetItemCount (l1) step 3 If sffm then sf[ix]=LD3DView.AddSphere (view3D .03 4 LDColours.HSLtoRGB (ix 1 .5) "D") LD3DView.TranslateGeometry (view3D sf[ix] l1[f] l1[f+1] l1[f+2]) endif LDarray.SetValue (lsx ix l1[f]) LDarray.SetValue (lsz ix l1[f+1]) LDarray.SetValue (lsy ix l1[f+2]) nxx: ix=ix+1 endfor Endfor ph="" For iig=2 To ix-1 ox=ldarray.GetValue(lsx iig-1) oy=ldarray.GetValue(lsy iig-1) oz=ldarray.GetValue(lsz iig-1) px=ldarray.GetValue(lsx iig) py=ldarray.GetValue(lsy iig) pz=ldarray.GetValue(lsz iig) ph=ph+px+ss+pz+ss+py+ss+ox+ss+oz+ss+oy+ss endfor ld3dview.Addtube (view3D ph .03 10 "red" "E") EndSub Sub sset ' ----------------------------------------------------------------------------------moves 3d cursor GraphicsWindow.Title =ii px=ldarray.GetValue(lsx ii) py=ldarray.GetValue(lsy ii) pz=ldarray.GetValue(lsz ii) LD3DView.ModifyObject (view3D sf[ii] "H") LD3DView.ModifyObject (view3D sf[oi] "S") oi=ii LD3DView.TranslateGeometry(view3D cs px pz py) ss=": If ii>1 then ox=ldarray.GetValue(lsx ii-1) oy=ldarray.GetValue(lsy ii-1) oz=ldarray.GetValue(lsz ii-1) ph=px+ss+pz+ss+py+ss+ox+ss+oz+ss+oy 'ld3dview.Addtube (view3D ph .01 10 "red" "E") 'TextWindow.WriteLine (ph) endif EndSub Sub rottc '---------------------------------------------------------------- rotates around model full circle For aa=0 To 360 Step .5 If GraphicsWindow.LastKey="Space" Then aa=aa-.5 else px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") endif Program.Delay (15) EndFor EndSub Sub kdd '-----------------------------------------------------------------------------------keyboard handling lk= text.ConvertToLowerCase (GraphicsWindow.LastKey) 'GraphicsWindow.Title =lk If (lk="up") then ii=ii-1 If ii<1 Then ii=1 endif sset() ElseIf lk="a" then LD3DView.AutoControl ("true" "true", -1 .25) ElseIf lk="s" then LD3DView.AutoControl ("false" "false", -1 .25) ElseIf lk="escape" then mov="false ElseIf lk="d1" then TextWindow.Write ("Node: ") ii=TextWindow.ReadNumber() ElseIf lk="down" then ii=ii+1 sset() elseIf lk="return" then GraphicsWindow.Title ="add "+ai lin[ai]=ii ai=ai+1 Goto xx ElseIf lk="home" then ii=1 sset() EndIf GraphicsWindow.Title =ii xx: EndSub Sub mww lky=GraphicsWindow.LastKey If lky="Space" then If mov Then yp=yp+ LDEvents.LastMouseWheelDelta/20 else ya=ya+ LDEvents.LastMouseWheelDelta endif elseIf lky="LeftCtrl" then If mov then xp=xp+ LDEvents.LastMouseWheelDelta/20 else r35=r35+ LDEvents.LastMouseWheelDelta/2 endif Else If mov then zp=zp+ LDEvents.LastMouseWheelDelta/20 else aa=aa+LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title =aa endif endif px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndSub End>VFQ973.sb< Start>VFT451.sb< 'This program finds all permutations of a set with different items (unfortunately I 'haven't found a way to do it with repeated items yet. 'It uses a simple algorithm to keep adding one to a number in any numerical system and 'then check if all the items are different 'set number of items n=4 'set delay between steps d=150 'find n^n (all possibilities of a set with n items that vary from 1 to n) b=Math.Power(n, n) 'set all items to 1 For i = 1 To n a[i]=1 EndFor 'main loop with b processes For i = 1 To b 'set "to print" variable to true in each process tp="true" 'check if any of the items are equal. if not, it's a permutation For j = 1 To n For k = 1 To n If j <> k And a[j] = a[k] Then tp="false" EndIf EndFor EndFor 'print permutation if all items are different If tp = "true" Then TextWindow.Write("(") For l = 1 To n If l <> n Then TextWindow.Write(a[l] + ",") Else TextWindow.WriteLine(a[l] + ")") EndIf EndFor Program.Delay(d) Add() Else m=n Add() EndIf EndFor 'adds one to the set as if the number system has n digits Sub Add 'if the last item is at the maximum value set it to one and keep going to the anterior item If a[m]=n Then a[m]=1 'if anterior item is also at the maximum value, repeat subroutine If a[m-1]=n Then m=m-1 add() 'set item to itself plus 1 Else a[m-1]=a[m-1]+1 EndIf 'set item to itself plus 1 Else a[m]=a[m]+1 EndIf EndSub End>VFT451.sb< Start>VFT667.sb< 'Mini Database design 'Form creation code copied from Investment Calculator GUI Application 'In Shape object 'In this step Add button activated 'On for every keystroke record in file get updated ( Best use ? ) 'NOTE: 'Insted of Controls.TextTyped use event GraphicsWindow.KeyUp 'Now add EDIT option 'Now add Insert option 'NOTE: 'Use Insert and Edit Button In Conjunction 'Tried to addup the Insert option in OnKeyUp events but not possible because 'for each key stroke it inserts new line '=============================================== 'EVENT DECLERATIONS Controls.ButtonClicked = OnButtonClicked 'Controls.TextTyped = OnTextTyped GraphicsWindow.KeyUp = OnKeyUp GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "Ivory" GW = GraphicsWindow.Width GH = GraphicsWindow.Height dfltBrush = GraphicsWindow.BrushColor dfltFntNm = GraphicsWindow.FontName dfltFntSz = GraphicsWindow.FontSize 'MAKE FORM HEADING GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor HdrPlc = Shapes.AddRectangle(0.8*GW,40) Shapes.Move(HdrPlc,0.1*GW,10) GraphicsWindow.BrushColor = "Blue" GraphicsWindow.FontSize = 24 lblHdr = Shapes.AddText(" Contacts Database") Shapes.Move(lblHdr,0.15*GW,15) 'MAKE THE CONTROLS AND LABEL IT 'For better adjustment flexibility lblOffsetX = 50 objGrpOffsetY = 70 txtOffsetX = 320 objSepDist = 30 'Restore defaults GraphicsWindow.BrushColor = dfltBrush GraphicsWindow.FontSize = dfltFntSz 'Create text fields caption objCnt = 0 lblCntID = Shapes.AddText("Contact ID") lblNmFst = Shapes.AddText("First Name") lblNmMdl = Shapes.AddText("Middle Name") lblNmLst = Shapes.AddText("Last Name") lblMobileNo = Shapes.AddText("Mobile Number") lblAdrs1 = Shapes.AddText("Flat / Plot / Home") lblAdrs2 = Shapes.AddText("Area / Colony / Village") lblAdrs3 = Shapes.AddText("City / District / Town / Taluka") 'Adjust text field captions Shapes.Move(lblCntID,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblNmFst,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblNmMdl,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblNmLst,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblMobileNo,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblAdrs1,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblAdrs2,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(lblAdrs3,lblOffsetX, objGrpOffsetY + objCnt*objSepDist) 'Create and adjust data value text fields objCnt=0 txtCntID = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtNmFst = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtNmMdl = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtNmLst = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtMobileNo = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtAdrs1 = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtAdrs2 = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 txtAdrs3 = Controls.AddTextBox(txtOffsetX,objGrpOffsetY + objCnt*objSepDist) 'Keep text field hiden untill edit Controls.HideControl(txtAdrs1) Controls.HideControl(txtAdrs2) Controls.HideControl(txtAdrs3) Controls.HideControl(txtNmFst) Controls.HideControl(txtNmLst) Controls.HideControl(txtNmMdl) Controls.HideControl(txtMobileNo) Controls.HideControl(txtCntID) 'Create data value labels objCnt = 0 valCntID = Shapes.AddText("# # # #") valNmFst = Shapes.AddText("@@@@@@") valNmMdl = Shapes.AddText("@@@@@@@@@@@@") valNmLst = Shapes.AddText("@@@@@@@@") valMobileNo = Shapes.AddText("#########") valAdrs1 = Shapes.AddText("$$$$$$$$$$$") valAdrs2 = Shapes.AddText("$$$$$$$$$$$$$$$$$$$$$$$$") valAdrs3 = Shapes.AddText("$$$$$$$$$$$$$$$$") 'Adjust data value labels Shapes.Move(valCntID,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valNmFst,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valNmMdl,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valNmLst,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valMobileNo,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valAdrs1,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valAdrs2,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) objCnt = objCnt + 1 Shapes.Move(valAdrs3,txtOffsetX, objGrpOffsetY + objCnt*objSepDist) 'Add Button Controls and adjust AdjustmentX = 20 objCnt = objCnt + 3 btnPrevious = Controls.AddButton("Previous",1*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) btnInsert = Controls.AddButton("Insert",2*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) btnEdit = Controls.AddButton("Edit",3*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) btnAdd = Controls.AddButton("Add",4*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) 'btnDelete = Controls.AddButton("Delete",5*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) 'btnSave = Controls.AddButton("Save",6*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) btnNext = Controls.AddButton("Next",7*GW/8 - AdjustmentX,objGrpOffsetY + objCnt*objSepDist) Controls.SetSize(btnPrevious,70,25) Controls.SetSize(btnInsert,70,25) Controls.SetSize(btnEdit,70,25) Controls.SetSize(btnAdd,70,25) 'Controls.SetSize(btnDelete,70,25) 'Controls.SetSize(btnSave,70,25) Controls.SetSize(btnNext,70,25) 'When program starts open file read first line and display it DataFile = Program.Directory + "\Contacts.dat" CountRecords() RecCurser = 1 ' The following line could be harmful and has been automatically commented. ' Record = File.ReadLine(DataFile,RecCurser) AssignValues() DisplayValues() EOF = "False" BOF = "True" Sub OnButtonClicked btnClicked = Controls.GetButtonCaption(Controls.LastClickedButton) 'PREVIOUS NEXT NEVIGATION If btnClicked = "Next" Then HideControls() If EOF = "False" Then RecCurser = RecCurser + 1 ' The following line could be harmful and has been automatically commented. ' Record = File.ReadLine(DataFile,RecCurser) If Record <> "" Then EOF = "False" BOF = "False" AssignValues() DisplayValues() Else EOF = "True" BOF = "False" EndIf Else GraphicsWindow.ShowMessage("Reached to end of file","EOF") EndIf EndIf If btnClicked = "Previous" Then HideControls() If BOF = "False" Then RecCurser = RecCurser - 1 ' The following line could be harmful and has been automatically commented. ' Record = File.ReadLine(DataFile,RecCurser) If Record <> "" Then EOF = "False" BOF = "False" AssignValues() DisplayValues() Else EOF = "False" BOF = "True" EndIf Else GraphicsWindow.ShowMessage("Reached to bigining of file","BOF") EndIf EndIf If btnClicked = "Add" Then CountRecords() RecCurser = RECORD_COUNT + 1 Record = "" EOF = "True" BOF = "False" Controls.SetTextBoxText(txtCntID,RecCurser) 'IT ALSO FIRES THE EVENT TEXTTYPED Hence GraphicsWindow.KeyUp event used HideValues() ClearControls() ShowControls() EndIf If btnClicked = "Edit" Then 'Record is ready with you only assigning values to txt type field is remaining AssignEditValues() HideValues() ShowControls() EndIf If btnClicked = "Insert" Then 'Record is ready with you only assigning values to txt type field is remaining Record = "" Record = Math.GetRandomNumber(99) + "-" + Text.GetCharacter(64 + Math.GetRandomNumber(26)) + ",,,,,,," ' The following line could be harmful and has been automatically commented. ' File.InsertLine(DataFile,RecCurser,Record) ' The following line could be harmful and has been automatically commented. ' Record = File.ReadLine(DataFile,RecCurser) AssignValues() DisplayValues() EndIf EndSub Sub OnKeyUp 'Make the record a fresh Record = "" Record = Record + Controls.GetTextBoxText(txtCntID) + "," Record = Record + Controls.GetTextBoxText(txtNmFst) + "," Record = Record + Controls.GetTextBoxText(txtNmMdl) + "," Record = Record + Controls.GetTextBoxText(txtNmLst) + "," Record = Record + Controls.GetTextBoxText(txtMobileNo) + "," Record = Record + Controls.GetTextBoxText(txtAdrs1) + "," Record = Record + Controls.GetTextBoxText(txtAdrs2) + "," Record = Record + Controls.GetTextBoxText(txtAdrs3) 'Write it in file at last ' The following line could be harmful and has been automatically commented. ' File.WriteLine(DataFile,RecCurser,Record) EndSub Sub CountRecords For i = 1 To 65535 'Largest 16 bit number ' The following line could be harmful and has been automatically commented. ' TempRec = File.ReadLine(DataFile,i) If TempRec = "" Then RECORD_COUNT = i-1 Goto CountRecordsExit EndIf EndFor CountRecordsExit: EndSub Sub AssignValues RecLength = Text.GetLength(Record) FldCnt = 0 FldStart = 1 'Seperate out fields in record (upto last but one) For i = 1 To RecLength If Text.GetSubText(Record,i,1) = "," Then FldCnt = FldCnt + 1 Fld[FldCnt] = Text.GetSubText(Record,FldStart,i-FldStart) FldStart = i + 1 EndIf EndFor 'Last field FldCnt = FldCnt + 1 Fld[FldCnt] = Text.GetSubText(Record,FldStart,RecLength-FldStart+1) 'Assign fields to field values for displaying Shapes.SetText(valCntID,Fld[1]) Shapes.SetText(valNmFst,Fld[2]) Shapes.SetText(valNmMdl,Fld[3]) Shapes.SetText(valNmLst,Fld[4]) Shapes.SetText(valMobileNo,Fld[5]) Shapes.SetText(valAdrs1,Fld[6]) Shapes.SetText(valAdrs2,Fld[7]) Shapes.SetText(valAdrs3,Fld[8]) EndSub Sub AssignEditValues RecLength = Text.GetLength(Record) FldCnt = 0 FldStart = 1 'Seperate out fields in record (upto last but one) For i = 1 To RecLength If Text.GetSubText(Record,i,1) = "," Then FldCnt = FldCnt + 1 Fld[FldCnt] = Text.GetSubText(Record,FldStart,i-FldStart) FldStart = i + 1 EndIf EndFor 'Last field FldCnt = FldCnt + 1 Fld[FldCnt] = Text.GetSubText(Record,FldStart,RecLength-FldStart+1) 'Assign fields to text field values for displaying Controls.SetTextBoxText(txtCntID,Fld[1]) Controls.SetTextBoxText(txtNmFst,Fld[2]) Controls.SetTextBoxText(txtNmMdl,Fld[3]) Controls.SetTextBoxText(txtNmLst,Fld[4]) Controls.SetTextBoxText(txtMobileNo,Fld[5]) Controls.SetTextBoxText(txtAdrs1,Fld[6]) Controls.SetTextBoxText(txtAdrs2,Fld[7]) Controls.SetTextBoxText(txtAdrs3,Fld[8]) EndSub 'Hide values and display text boxes Sub HideValues Shapes.HideShape(valAdrs1) Shapes.HideShape(valAdrs2) Shapes.HideShape(valAdrs3) Shapes.HideShape(valCntID) Shapes.HideShape(valMobileNo) Shapes.HideShape(valNmFst) Shapes.HideShape(valNmLst) Shapes.HideShape(valNmMdl) EndSub 'Hide values and display text boxes Sub DisplayValues Shapes.ShowShape(valAdrs1) Shapes.ShowShape(valAdrs2) Shapes.ShowShape(valAdrs3) Shapes.ShowShape(valCntID) Shapes.ShowShape(valMobileNo) Shapes.ShowShape(valNmFst) Shapes.ShowShape(valNmLst) Shapes.ShowShape(valNmMdl) EndSub Sub ClearControls Controls.SetTextBoxText(txtAdrs1,"") Controls.SetTextBoxText(txtAdrs2,"") Controls.SetTextBoxText(txtAdrs3,"") Controls.SetTextBoxText(txtMobileNo,"") Controls.SetTextBoxText(txtNmFst,"") Controls.SetTextBoxText(txtNmLst,"") Controls.SetTextBoxText(txtNmMdl,"") EndSub Sub ShowControls Controls.ShowControl(txtAdrs1) Controls.ShowControl(txtAdrs2) Controls.ShowControl(txtAdrs3) Controls.ShowControl(txtCntID) Controls.ShowControl(txtMobileNo) Controls.ShowControl(txtNmFst) Controls.ShowControl(txtNmLst) Controls.ShowControl(txtNmMdl) EndSub Sub HideControls Controls.HideControl(txtAdrs1) Controls.HideControl(txtAdrs2) Controls.HideControl(txtAdrs3) Controls.HideControl(txtCntID) Controls.HideControl(txtMobileNo) Controls.HideControl(txtNmFst) Controls.HideControl(txtNmLst) Controls.HideControl(txtNmMdl) EndSub End>VFT667.sb< Start>VFT761.sb< ' Palindrome checking program Palindrome_Sample() Show_Sample() Select_A_Sample() Check_Palindrome() Ok_or_Not() Sub Show_Sample GraphicsWindow.BackgroundColor="White" GraphicsWindow.left=0 GraphicsWindow.top=0 GraphicsWindow.Height=700 GraphicsWindow.Width=1200 GraphicsWindow.Show() GraphicsWindow.FontSize=18 For i = 1 To 16 GraphicsWindow.DrawText(10,5+40*(i-1),i) GraphicsWindow.drawRectangle(45,10+40*(i-1),20,20) GraphicsWindow.DrawText(70,5+40*(i-1),sample[i]) endfor i=17 GraphicsWindow.BrushColor="Red" GraphicsWindow.DrawText(70,5+40*(i-1),sample[i]) Endsub Sub Select_A_Sample Loop: OnX=mouse.IsLeftButtonDown GMX=GraphicsWindow.MouseX GMY=GraphicsWindow.MouseY If Onx="true" Then If (45VFT761.sb< Start>VFW867.sb< args=0 szz=5 d10=10 GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.Width =400 GraphicsWindow.Height =300 GraphicsWindow.Title="Goldfinger clr ="cyan dblue="#0000aa For qi=1 to 3 sx=qi*100+" " ii=1 clr=dblue LDCall.Function5 ("dell" 30 30 text.Append(sx 115) 0 360) LDCall.Function5 ("dell" 35 35 text.Append(sx 180) 25 340) LDCall.Function5 ("dell" 37 63 text.Append(sx 150) 70 110) LDCall.Function5 ("dell" 37 63 text.Append(sx 150) 250 290) LDCall.Function4 ("dlin" sx+10 85 120 180) LDCall.Function4 ("dlin" sx+10 85 90 210) LDCall.Function4 ("dlin" t_x t_y 60 90) LDCall.Function4 ("dlin" sx-50 95 55 90) LDCall.Function4 ("dlin" t_x t_y 110 205) LDCall.Function4 ("dlin" t_x t_y 55 90) endfor tt=1 nm="0 1 8 0 1 7 0 1 6 0 1 5 0 1 4 0 1 3 0 1 2 0 1 1 0 1 0 0 0 9 0 0 8 0 0 7 Z Z Z" nm=ldtext.Split (nm " ") LDCall.Function ("gnum" nm[1]) qi=1 While "true For ii=1 To 98 If ff[ii]="*" then LDShapes.BrushColour(di[qi][ii],LDColours.HSLtoRGB(ii/2 1 0.77)) LDShapes.ZIndex (di[qi][ii] 100*tt+ii) ' Program.Delay (5) else LDShapes.BrushColour(di[qi][ii],dblue) LDShapes.ZIndex (di[qi][ii] 1) endif endfor tt=tt+1 qi=qi+1 if nm[tt]="Z" Then Program.Delay (99999) endif LDCall.Function ("gnum" nm[tt]) If qi>3 Then qi=1 Program.Delay (890) endif endwhile Sub gnum q=args[1] For x=1 to 98 ff[x]=". endfor If q=8 Then LDCall.Function("dset" "1 38") elseIf q=3 Then LDCall.Function("dset" "1 10 16 32") elseIf q=0 Then LDCall.Function("dset" "1 6 14 19 23 34 39 48") elseIf q=9 Then LDCall.Function("dset" "1 19 23 32 39 43") elseIf q=2 Then LDCall.Function("dset" "1 10 16 19 33 38 92 98") elseIf q=6 Then LDCall.Function("dset" "1 3 9 11 14 38 44 48") elseIf q=5 Then LDCall.Function("dset" "3 3 20 31 9 11 14 16 35 38 45 48 78 81") elseIf q=7 Then LDCall.Function("dset" "76 92") elseIf q=4 Then LDCall.Function("dset" "49 75") elseIf q=1 Then LDCall.Function("dset" "49 65") elseIf q="Z" Then LDCall.Function("dset" "76 98") endif EndSub Sub dset qq=ldtext.Split(args[1] " ") For r=1 To Array.GetItemCount(qq) Step 2 For x=qq[r] to qq[r+1] ff[x]="* endfor endfor EndSub Sub dlin GraphicsWindow.brushColor=clr t_angle=args[4] t_x=args[1] t_y=args[2] ds=0 While dsd10 then di[qi][ii]=Shapes.AddEllipse(5 5) Shapes.Move (di[qi][ii] dd[1]+nx dd[2]+ny) ii=ii+1 ox=nx oy=ny endif EndFor EndSub End>VFW867.sb< Start>VFX041.sb< ' Pictionary - Chinese ' Copyright © 2017-2018 Nonki Takahashi. The MIT License. ' Last update 2017-07-09 GraphicsWindow.Title = "Pictionary" SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh ' initialize shapes Shapes_Init_Chinese() angle = 0 ' dummy ' add shapes scale = 1 iMin = 1 iMax = Array.GetItemCount(shape) Shapes_Add() ' initialize shapes Shapes_Init_Caption() iMax = Array.GetItemCount(shape) ' add shapes Shapes_Add() Sub Shapes_Init_Chinese ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 119 ' x offset shY = 94 ' y offset shape = "" shape[1] = "pw=0;bc=#DE2910;func=rect;width=360;height=240;x=0;y=0;" shape[2] = "pw=0;bc=#FFDE00;func=tri;x1=14.59;y1=0;x2=0;y2=44.92;x3=29.19;y3=44.92;x=45.4;y=23.99;" shape[3] = "pw=0;bc=#FFDE00;func=tri;x1=14.59;y1=0;x2=0;y2=44.92;x3=29.19;y3=44.92;x=58.27;y=33.35;angle=72;" shape[4] = "pw=0;bc=#FFDE00;func=tri;x1=14.59;y1=0;x2=0;y2=44.92;x3=29.19;y3=44.92;x=53.36;y=48.49;angle=144;" shape[5] = "pw=0;bc=#FFDE00;func=tri;x1=14.59;y1=0;x2=0;y2=44.92;x3=29.19;y3=44.92;x=37.44;y=48.49;angle=216;" shape[6] = "pw=0;bc=#FFDE00;func=tri;x1=14.59;y1=0;x2=0;y2=44.92;x3=29.19;y3=44.92;x=32.52;y=33.35;angle=288;" shape[7] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=111.26;y=18.83;angle=-120.97;" shape[8] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=111.73;y=13.54;angle=-48.97;" shape[9] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=116.9;y=12.35;angle=23.03;" shape[10] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=119.62;y=16.9;angle=95.03;" shape[11] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=116.14;y=20.91;angle=167.03;" shape[12] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=134.66;y=41.15;angle=-98.14;" shape[13] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=137.14;y=36.46;angle=-26.14;" shape[14] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=142.37;y=37.37;angle=45.86;" shape[15] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=143.12;y=42.62;angle=117.86;" shape[16] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=138.36;y=44.95;angle=189.86;" shape[17] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=134.79;y=75.27;angle=-74.06;" shape[18] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=138.97;y=72;angle=-2.06;" shape[19] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=143.37;y=74.96;angle=69.94;" shape[20] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=141.91;y=80.06;angle=141.94;" shape[21] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=136.61;y=80.25;angle=213.94;" shape[22] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=111.61;y=97.69;angle=-51.35;" shape[23] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=116.72;y=96.29;angle=20.65;" shape[24] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=119.64;y=100.72;angle=92.65;" shape[25] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=116.32;y=104.86;angle=164.65;" shape[26] = "pw=0;bc=#FFDE00;func=tri;x1=4.86;y1=0;x2=0;y2=14.97;x3=9.73;y3=14.97;x=111.36;y=102.99;angle=236.65;" EndSub Sub Shapes_Init_Caption ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 394 ' x offset shY = 358 ' y offset shape = "" shape[1] = "func=text;x=0;y=0;text=Chinese;fn=Trebuchet MS;fs=50;fb=True;pw=0;bc=Black;" EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_Add ' Shapes | add shapes as shapes data ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - 1 if same scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param iMin, iMax - shape indices to add ' return shWidth, shHeight - total size of shapes For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub End>VFX041.sb< Start>VFX640.sb< kk=50*Math.SquareRoot(3)/2 grrn="#FF007700 grry="#FFAAAAAA GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor=grrn For x=0 To 30 m2=Math.Remainder(x 2) For y=0 To 10 s=Shapes.AddTriangle(0 0 0 50 kk 25) Shapes.Move(s x*kk y*50+m2*25-25) LDShapes.SetShapeEvent(s) s=Shapes.AddTriangle(0 0 0 50 kk 25) Shapes.Rotate(s 180) LDShapes.SetShapeEvent(s) Shapes.Move(s x*kk y*50+25-m2*25-25) EndFor EndFor GraphicsWindow.KeyDown=kkk LDShapes.ShapeEvent=see While 1=1 If lpp Then lpp="false l1=1 While l1<6 l1=l1+1 For oo=13 To 11 Step -1 ff="" aa=LDShapes.GetAllShapes() 'bb=FCDialogs.AskForTextLine("no:") ' The following line could be harmful and has been automatically commented. ' cc=File.ReadContents("e:/blkk/fff"+oo+".txt") For a=1 To Array.GetItemCount(aa) If Text.GetSubText(cc a 1)="#" Then LDShapes.BrushColour(aa[a] grrn) Else LDShapes.BrushColour(aa[a] "gray") EndIf EndFor Program.Delay(60) EndFor EndWhile EndIf EndWhile Sub kkk lk=GraphicsWindow.LastKey If lk="D1" Then ff="" aa=LDShapes.GetAllShapes() For a=1 To Array.GetItemCount(aa) d= LDShapes.GetColour(aa[a]) ' TextWindow.WriteLine(d[1]) If d[1]=grrn Then ff=ff+"#" ElseIf d[1]=grry Then ff=ff+"+" Else ff=ff+"." EndIf EndFor ' The following line could be harmful and has been automatically commented. ' fc=File.GetFiles("e:/blkk") ' TextWindow.WriteLine(fc) fxx=(array.GetItemCount(fc)+1) ' The following line could be harmful and has been automatically commented. ' File.WriteContents("e:/blkk/fff"+fxx+".txt" ff) GraphicsWindow.Title="Saved #"+fxx ElseIf lk="D2" Then ff="" aa=LDShapes.GetAllShapes() bb=FCDialogs.AskForTextLine("no:") If bb=0 or bb="" Then Else ' The following line could be harmful and has been automatically commented. ' cc=File.ReadContents("e:/blkk/fff"+bb+".txt") GraphicsWindow.Title="Loaded #"+bb For a=1 To Array.GetItemCount(aa) If Text.GetSubText(cc a 1)="#" or Text.GetSubText(cc a 1)="" Then LDShapes.BrushColour(aa[a] grrn) ElseIf Text.GetSubText(cc a 1)="+" Then LDShapes.BrushColour(aa[a] grry) Else LDShapes.BrushColour(aa[a] "gray") EndIf EndFor EndIf ElseIf lk="D3" Then lpp="true EndIf EndSub Sub see ll=LDShapes.LastEventShape If LDShapes.LastEventType="MouseDown" Then cll() EndIf If LDShapes.LastEventType="MouseEnter" Then cll() EndIf EndSub Sub cll If Mouse.IsRightButtonDown Then LDShapes.BrushColour(ll grrn) ElseIf Mouse.IsLeftButtonDown Then If FCKeyboard.IsControlPressed Then LDShapes.BrushColour(ll grry) Else LDShapes.BrushColour(ll "gray") EndIf EndIf EndSub End>VFX640.sb< Start>VGC117.sb< GraphicsWindow.BackgroundColor ="Darkblue datFile = "e:\datt.db" GraphicsWindow.Title ="StarSphere of Zodiac GraphicsWindow.Height=900 GraphicsWindow.Width =750 database = LDDataBase.AddDataBase(datFile) listView = LDDataBase.AddListView(GraphicsWindow.Width,100) Controls.Move(listView,0,GraphicsWindow.Height-100) LDShapes.BrushColour (listView,"#80ffffff") symbol = LDText.Split("♓ ♈ ♈ ♉ ♉ ♊ ♊ ♋ ♋ ♌ ♌ ♍ ♍ ♍ ♎ ♎ ♏ ♏ ♐ ♐ ♑ ♒ ♒ ♓"," ") gucktheta=80/180*math.PI guckphi=10/180*math.PI pi=Math.pi bw=700 bh=bw dd=25 www=0 inn=0 nmm= LDText.Split ("All Capricornus Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpius Sagittarius"," ") cll= LDText.split ("Red Magenta Orange Cyan Lime DarkGreen Purple Brown Black DarkCyan Magenta DarkRed"," ") cll2="Capricornus=red;Aquarius=blue;Pisces=white;Aries=green;Taurus=magenta;Gemini=Brown;Cancer=Pink;Leo=Yellow;Virgo=Cyan;Libra=Gray;Scorpius=Black;Sagittarius=Violet cnm=LDControls.AddComboBox(nmm,100,500) controls.AddButton("show",10,10) Controls.ButtonClicked =ccb Controls.Move (cnm,60,10) args=0 sset() GraphicsWindow.PenWidth =1 GraphicsWindow.PenColor =LDColours.HSLtoRGB (180,.6,.15) GraphicsWindow.PenWidth =2 for i=90 to 270 step 10'------------------------meridians(x) ir= math.GetRadians (i) ir1= math.GetRadians (i-10) for j=-80 to 80 step 10'--------------------paralelles (y) jr= math.GetRadians (j) jr1= math.GetRadians (j-10) shapes.AddLine ( ldcall.Function3 ("kx",1,jr,ir), ldcall.Function3 ("ky",1,jr,ir), ldcall.Function3 ("kx",1,jr1,ir), ldcall.Function3 ("ky",1,jr1,ir)) shapes.AddLine ( ldcall.Function3 ("kx",1,jr,ir1), ldcall.Function3 ("ky",1,jr,ir1), ldcall.Function3 ("kx",1,jr,ir), ldcall.Function3 ("ky",1,jr,ir )) endfor endfor Sub ccb If LDControls.LastComboBoxIndex=1 Then res=LDDataBase.Query(database, "SELECT * FROM Stars1", listView, "True") ldcall.Function ("shstarr",1) else res=LDDataBase.Query(database, "SELECT * FROM Stars1 where tx2='"+nmm[LDControls.LastComboBoxIndex] +"' order by tx2 ", listView, "True") GraphicsWindow.BrushColor=cll[LDControls.LastComboBoxIndex] ldcall.Function ("shstarr",0) endif endsub p14=25 ee=4 e500=500 res=LDDataBase.Query(database, "SELECT * FROM Stars1 order by rx1 desc ", listView, "True") LDCall.Function ("shstarr",1) LDEvents.MouseWheel =mww Sub sset GraphicsWindow.BrushColor ="black GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width, GraphicsWindow.Height) GraphicsWindow.BrushColor="darkblue GraphicsWindow.FillEllipse (25,25,700,700) endsub Sub mww If inn=0 Then inn=1 www=www+ LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title =www sset() ldcall.Function ("shstarr",2) inn=0 endif endsub Sub shstarr aa=args[1] For i = 1 To Array.GetItemCount(res) x=res[i]["rx1"] y=res[i]["ry1"] ax=math.Remainder (x*15+www,360) If ax>90 And ax<270 then x=ldcall.Function3 ("kx",1,math.GetRadians (y),math.GetRadians (ax)) y=ldcall.Function3 ("ky",1,math.GetRadians (y),math.GetRadians (ax)) mg=res[i]["mag"] d = math.round(20 / mg) If d>20 Then d=20 EndIf If aa=1 then If d>10 then GraphicsWindow.BrushColor="#80FFFF00 elseIf d>6 then GraphicsWindow.BrushColor="Yellow elseif d>4 then GraphicsWindow.BrushColor="White else GraphicsWindow.BrushColor="Gray endif ElseIf aa=2 then GraphicsWindow.BrushColor=cll2[res[i]["tx2"]] endif GraphicsWindow .FillEllipse ( x - d / 2, y - d / 2,d,d) endif EndFor EndSub sub f'(x) qx=args[1] RETURN =ldmath.SIN(qx*6)*20-50 EndSub sub kx'(r,theta,phi) qr=args[1] theta=args[2] phi=args[3] qx=qr*math.cos(theta)*math.cos(phi) qy=qr*math.cos(theta)*math.sin(phi) qz=qr*math.sin(theta) qx=math.sin(guckphi)*qx+math.cos(guckphi)*qy RETURN= bw/2+qx*bw/2+dd ENDsub sub ky'(r,theta,phi) qr=args[1] theta=args[2] phi=args[3] qx=qr*math.cos(theta)*math.cos(phi) qy=qr*math.cos(theta)*math.sin(phi) qz=qr*math.sin(theta) qy=math.cos(guckphi)*qx-math.sin(guckphi)*qy qz=math.cos(gucktheta)*qy-math.sin(gucktheta)*qz RETURN= bh/2-qz*bh/2+dd ENDsub End>VGC117.sb< Start>VGG091.sb< ' This program can check word(s). 2011/08/22 by NaoChanON 'This program refers VFT761 and GKN568 Sentences_Sample() Show_Sample() Select_or_input() Check_Dictionary() Sub Show_Sample GraphicsWindow.Clear() GraphicsWindow.BackgroundColor="Lightcyan" GraphicsWindow.left=50 GraphicsWindow.top=0 GraphicsWindow.Height=700 GraphicsWindow.Width=1200 GraphicsWindow.FontName="Coorie new" GraphicsWindow.Show() GraphicsWindow.FontSize=18 YP=40 'Sample listing pitch XS=70 'Sample listing start point BW=850 'TextBox width BT=250 'TextBox Y position BY=30 'textBox Height CW=150 'Checkbox Width For i = 1 To 5 GraphicsWindow.DrawText(10,7+YP*(i-1),i) GraphicsWindow.drawRectangle(45,7+YP*(i-1),20,20) GraphicsWindow.DrawText(XS,5+YP*(i-1),sample[i]) 'Sample sentences endfor textbox[1] = Controls.AddTextBox(XS,BT) ' Sentences input box Controls.SetSize(textbox[1] ,BW,BY) GraphicsWindow.BrushColor="Green" GraphicsWindow.FillRectangle(BW+XS+10,BT,CW,BY) GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawText(BW+XS+15,BT+2," Check Start! ") i=6 GraphicsWindow.BrushColor="Red" GraphicsWindow.DrawText(XS,15+YP*(i-1),sample[i]) ' Sample select or Input GraphicsWindow.FontSize=18 Endsub Sub Select_or_input Loop1: GMX=GraphicsWindow.MouseX GMY=GraphicsWindow.MouseY If mouse.IsLeftButtonDown="true" Then If (45VGG091.sb< Start>VGG263.sb< 'Connect 4 Program 'Written by Zachary Chiang 'Computer Science Period 7 Init() Click() 'Intializes the program Sub Init GraphicsWindow.Clear() GraphicsWindow.Title = "Connect 4" GraphicsWindow.Height = 300 GraphicsWindow.Width = 350 GraphicsWindow.Show() GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FillRectangle (0, 0, 350, 300) GraphicsWindow.MouseDown = Click Circles() EndSub 'Creates the white circles Sub Circles Values() GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse (col1, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row1, circlesize, circlesize) GraphicsWindow.FillEllipse (col1, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row2, circlesize, circlesize) GraphicsWindow.FillEllipse (col1, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row3, circlesize, circlesize) GraphicsWindow.FillEllipse (col1, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row4, circlesize, circlesize) GraphicsWindow.FillEllipse (col1, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row5, circlesize, circlesize) GraphicsWindow.FillEllipse (col1, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col2, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col3, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col4, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col5, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col6, row6, circlesize, circlesize) GraphicsWindow.FillEllipse (col7, row6, circlesize, circlesize) EndSub 'Sets the inital variables col1row1 = 0 col2row1 = 0 col3row1 = 0 col4row1 = 0 col5row1 = 0 col6row1 = 0 col7row1 = 0 col1row2 = 0 col2row2 = 0 col3row2 = 0 col4row2 = 0 col5row2 = 0 col6row2 = 0 col7row2 = 0 col1row3 = 0 col2row3 = 0 col3row3 = 0 col4row3 = 0 col5row3 = 0 col6row3 = 0 col7row3 = 0 col1row4 = 0 col2row4 = 0 col3row4 = 0 col4row4 = 0 col5row4 = 0 col6row4 = 0 col7row4 = 0 col1row5 = 0 col2row5 = 0 col3row5 = 0 col4row5 = 0 col5row5 = 0 col6row5 = 0 col7row5 = 0 col1row6 = 0 col2row6 = 0 col3row6 = 0 col4row6 = 0 col5row6 = 0 col6row6 = 0 col7row6 = 0 brushcolor = "b" GraphicsWindow.BrushColor = "Blue" 'Sets the coordinate values for the rows and columns Sub Values row1 = 10 row2 = row1 + (50 * 1) row3 = row1 + (50 * 2) row4 = row1 + (50 * 3) row5 = row1 + (50 * 4) row6 = row1 + (50 * 5) row7 = row1 + (50 * 6) row8 = row1 + (50 * 7) row9 = row1 + (50 * 8) row10 = row1 + (50 * 9) col1 = 10 col2 = col1 + (50 * 1) col3 = col1 + (50 * 2) col4 = col1 + (50 * 3) col5 = col1 + (50 * 4) col6 = col1 + (50 * 5) col7 = col1 + (50 * 6) col8 = col1 + (50 * 7) col9 = col1 + (50 * 8) col10 = col1 + (50 * 9) circlesize = 30 gamestatus = 0 EndSub 'When mouse is clicked, checks which column it is in and which row to fill Sub Click Values() x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x > 5 And x < 45 And y > 0 And y < 300) Then If col1row6 = "0" Then GraphicsWindow.FillEllipse (col1, row6, circlesize, circlesize) col1row6 = brushcolor ElseIf col1row5= "0" Then GraphicsWindow.FillEllipse (col1, row5, circlesize, circlesize) col1row5 = brushcolor ElseIf col1row4= "0" Then GraphicsWindow.FillEllipse (col1, row4, circlesize, circlesize) col1row4 = brushcolor ElseIf col1row3= "0" Then GraphicsWindow.FillEllipse (col1, row3, circlesize, circlesize) col1row3 = brushcolor ElseIf col1row2= "0" Then GraphicsWindow.FillEllipse (col1, row2, circlesize, circlesize) col1row2 = brushcolor ElseIf col1row1= "0" Then GraphicsWindow.FillEllipse (col1, row1, circlesize, circlesize) col1row1 = brushcolor ElseIf col1row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 55 And x < 95 And y > 0 And y < 300) Then If col2row6 = "0" Then GraphicsWindow.FillEllipse (col2, row6, circlesize, circlesize) col2row6 = brushcolor ElseIf col2row5= "0" Then GraphicsWindow.FillEllipse (col2, row5, circlesize, circlesize) col2row5 = brushcolor ElseIf col2row4= "0" Then GraphicsWindow.FillEllipse (col2, row4, circlesize, circlesize) col2row4 = brushcolor ElseIf col2row3= "0" Then GraphicsWindow.FillEllipse (col2, row3, circlesize, circlesize) col2row3 = brushcolor ElseIf col2row2= "0" Then GraphicsWindow.FillEllipse (col2, row2, circlesize, circlesize) col2row2 = brushcolor ElseIf col2row1= "0" Then GraphicsWindow.FillEllipse (col2, row1, circlesize, circlesize) col2row1 = brushcolor ElseIf col2row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 105 And x < 145 And y > 0 And y < 300) Then If col3row6 = "0" Then GraphicsWindow.FillEllipse (col3, row6, circlesize, circlesize) col3row6 = brushcolor ElseIf col3row5= "0" Then GraphicsWindow.FillEllipse (col3, row5, circlesize, circlesize) col3row5 = brushcolor ElseIf col3row4= "0" Then GraphicsWindow.FillEllipse (col3, row4, circlesize, circlesize) col3row4 = brushcolor ElseIf col3row3= "0" Then GraphicsWindow.FillEllipse (col3, row3, circlesize, circlesize) col3row3 = brushcolor ElseIf col3row2= "0" Then GraphicsWindow.FillEllipse (col3, row2, circlesize, circlesize) col3row2 = brushcolor ElseIf col3row1= "0" Then GraphicsWindow.FillEllipse (col3, row1, circlesize, circlesize) col3row1 = brushcolor ElseIf col3row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 155 And x < 195 And y > 0 And y < 300) Then If col4row6 = "0" Then GraphicsWindow.FillEllipse (col4, row6, circlesize, circlesize) col4row6 = brushcolor ElseIf col4row5= "0" Then GraphicsWindow.FillEllipse (col4, row5, circlesize, circlesize) col4row5 = brushcolor ElseIf col4row4= "0" Then GraphicsWindow.FillEllipse (col4, row4, circlesize, circlesize) col4row4 = brushcolor ElseIf col4row3= "0" Then GraphicsWindow.FillEllipse (col4, row3, circlesize, circlesize) col4row3 = brushcolor ElseIf col4row2= "0" Then GraphicsWindow.FillEllipse (col4, row2, circlesize, circlesize) col4row2 = brushcolor ElseIf col4row1= "0" Then GraphicsWindow.FillEllipse (col4, row1, circlesize, circlesize) col4row1 = brushcolor ElseIf col4row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 205 And x < 245 And y > 0 And y < 300) Then If col5row6 = "0" Then GraphicsWindow.FillEllipse (col5, row6, circlesize, circlesize) col5row6 = brushcolor ElseIf col5row5= "0" Then GraphicsWindow.FillEllipse (col5, row5, circlesize, circlesize) col5row5 = brushcolor ElseIf col5row4= "0" Then GraphicsWindow.FillEllipse (col5, row4, circlesize, circlesize) col5row4 = brushcolor ElseIf col5row3= "0" Then GraphicsWindow.FillEllipse (col5, row3, circlesize, circlesize) col5row3 = brushcolor ElseIf col5row2= "0" Then GraphicsWindow.FillEllipse (col5, row2, circlesize, circlesize) col5row2 = brushcolor ElseIf col5row1= "0" Then GraphicsWindow.FillEllipse (col5, row1, circlesize, circlesize) col5row1 = brushcolor ElseIf col5row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 255 And x < 295 And y > 0 And y < 300) Then If col6row6 = "0" Then GraphicsWindow.FillEllipse (col6, row6, circlesize, circlesize) col6row6 = brushcolor ElseIf col6row5= "0" Then GraphicsWindow.FillEllipse (col6, row5, circlesize, circlesize) col6row5 = brushcolor ElseIf col6row4= "0" Then GraphicsWindow.FillEllipse (col6, row4, circlesize, circlesize) col6row4 = brushcolor ElseIf col6row3= "0" Then GraphicsWindow.FillEllipse (col6, row3, circlesize, circlesize) col6row3 = brushcolor ElseIf col6row2= "0" Then GraphicsWindow.FillEllipse (col6, row2, circlesize, circlesize) col6row2 = brushcolor ElseIf col6row1= "0" Then GraphicsWindow.FillEllipse (col6, row1, circlesize, circlesize) col6row1 = brushcolor ElseIf col6row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 305 And x < 345 And y > 0 And y < 300) Then If col7row6 = "0" Then GraphicsWindow.FillEllipse (col7, row6, circlesize, circlesize) col7row6 = brushcolor ElseIf col7row5= "0" Then GraphicsWindow.FillEllipse (col7, row5, circlesize, circlesize) col7row5 = brushcolor ElseIf col7row4= "0" Then GraphicsWindow.FillEllipse (col7, row4, circlesize, circlesize) col7row4 = brushcolor ElseIf col7row3= "0" Then GraphicsWindow.FillEllipse (col7, row3, circlesize, circlesize) col7row3 = brushcolor ElseIf col7row2= "0" Then GraphicsWindow.FillEllipse (col7, row2, circlesize, circlesize) col7row2 = brushcolor ElseIf col7row1= "0" Then GraphicsWindow.FillEllipse (col7, row1, circlesize, circlesize) col7row1 = brushcolor ElseIf col7row1= "r" Or "b" Then Goto End EndIf EndIf If (x > 5 And x < 45 Or x > 55 And x < 95 Or x > 105 And x < 145 Or x > 155 And x < 195 Or x > 205 And x < 245 Or x > 255 And x < 295 Or x > 305 And x < 345) Then Brush() EndIf Check() End: EndSub Sub Brush If brushcolor = "b" Then GraphicsWindow.BrushColor = "Red" brushcolor = "r" ElseIf brushcolor = "r" Then GraphicsWindow.BrushColor = "Blue" brushcolor = "b" EndIf EndSub 'Checks all possible winning combinations Sub Check If col1row6 = "b" And col2row6 = "b" And col3row6 = "b" And col4row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row6 = "r" And col2row6 = "r" And col3row6 = "r" And col4row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row6 = "b" And col3row6 = "b" And col4row6 = "b" And col5row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row6 = "r" And col3row6 = "r" And col4row6 = "r" And col5row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row6 = "b" And col4row6 = "b" And col5row6 = "b" And col6row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row6 = "r" And col4row6 = "r" And col5row6 = "r" And col6row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row6 = "b" And col5row6 = "b" And col6row6 = "b" And col7row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row6 = "r" And col5row6 = "r" And col6row6 = "r" And col7row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row5 = "b" And col2row5 = "b" And col3row5 = "b" And col4row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row5 = "r" And col2row5 = "r" And col3row5 = "r" And col4row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row5 = "b" And col3row5 = "b" And col4row5 = "b" And col5row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row5 = "r" And col3row5 = "r" And col4row5 = "r" And col5row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row5 = "b" And col4row5 = "b" And col5row5 = "b" And col6row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row5 = "r" And col4row5 = "r" And col5row5 = "r" And col6row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") EndIf If col4row5 = "b" And col5row5 = "b" And col6row5 = "b" And col7row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row5 = "r" And col5row5 = "r" And col6row5 = "r" And col7row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row4 = "b" And col2row4 = "b" And col3row4 = "b" And col4row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row4 = "r" And col2row4 = "r" And col3row4 = "r" And col4row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row4 = "b" And col3row4 = "b" And col4row4 = "b" And col5row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row4 = "r" And col3row4 = "r" And col4row4 = "r" And col5row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row4 = "b" And col4row4 = "b" And col5row4 = "b" And col6row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row4 = "r" And col4row4 = "r" And col5row4 = "r" And col6row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row4 = "b" And col5row4 = "b" And col6row4 = "b" And col7row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row4 = "r" And col5row4 = "r" And col6row4 = "r" And col7row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row3 = "b" And col2row3 = "b" And col3row3 = "b" And col4row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row3 = "r" And col2row3 = "r" And col3row3 = "r" And col4row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row3 = "b" And col3row3 = "b" And col4row3 = "b" And col5row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row3 = "r" And col3row3 = "r" And col4row3 = "r" And col5row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row3 = "b" And col4row3 = "b" And col5row3 = "b" And col6row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row3 = "r" And col4row3 = "r" And col5row3 = "r" And col6row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row3 = "b" And col5row3 = "b" And col6row3 = "b" And col7row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row3 = "r" And col5row3 = "r" And col6row3 = "r" And col7row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row2 = "b" And col2row2 = "b" And col3row2 = "b" And col4row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row2 = "r" And col2row2 = "r" And col3row2 = "r" And col4row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row2 = "b" And col3row2 = "b" And col4row2 = "b" And col5row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row2 = "r" And col3row2 = "r" And col4row2 = "r" And col5row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row2 = "b" And col4row2 = "b" And col5row2 = "b" And col6row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row2 = "r" And col4row2 = "r" And col5row2 = "r" And col6row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row2 = "b" And col5row2 = "b" And col6row2 = "b" And col7row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row2 = "r" And col5row2 = "r" And col6row2 = "r" And col7row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row1 = "b" And col2row1 = "b" And col3row1 = "b" And col4row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row1 = "r" And col2row1 = "r" And col3row1 = "r" And col4row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row1 = "b" And col3row1 = "b" And col4row1 = "b" And col5row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row1 = "r" And col3row1 = "r" And col4row1 = "r" And col5row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row1 = "b" And col4row1 = "b" And col5row1 = "b" And col6row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row1 = "r" And col4row1 = "r" And col5row1 = "r" And col6row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row1 = "b" And col5row1 = "b" And col6row1 = "b" And col7row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row1 = "r" And col5row1 = "r" And col6row1 = "r" And col7row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row6 = "b" And col2row5 = "b" And col3row4 = "b" And col4row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row6 = "r" And col2row5 = "r" And col3row4 = "r" And col4row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row6 = "b" And col3row5 = "b" And col4row4 = "b" And col5row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row6 = "r" And col3row5 = "r" And col4row4 = "r" And col5row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row6 = "b" And col4row5 = "b" And col5row4 = "b" And col6row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row6 = "r" And col4row5 = "r" And col5row4 = "r" And col6row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row6 = "b" And col5row5 = "b" And col6row4 = "b" And col7row3 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row6 = "r" And col5row5 = "r" And col6row4 = "r" And col7row3 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row5 = "b" And col2row4 = "b" And col3row3 = "b" And col4row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row5 = "r" And col2row4 = "r" And col3row3 = "r" And col4row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row5 = "b" And col3row4 = "b" And col4row3 = "b" And col5row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row5 = "r" And col3row4 = "r" And col4row3 = "r" And col5row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row5 = "b" And col4row4 = "b" And col5row3 = "b" And col6row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row5 = "r" And col4row4 = "r" And col5row3 = "r" And col6row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row5 = "b" And col5row4 = "b" And col6row3 = "b" And col7row2 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row5 = "r" And col5row4 = "r" And col6row3 = "r" And col7row2 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row4 = "b" And col2row3 = "b" And col3row2 = "b" And col4row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row4 = "r" And col2row3 = "r" And col3row2 = "r" And col4row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row4 = "b" And col3row3 = "b" And col4row2 = "b" And col5row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row4 = "r" And col3row3 = "r" And col4row2 = "r" And col5row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row4 = "b" And col4row3 = "b" And col5row2 = "b" And col6row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row4 = "r" And col4row3 = "r" And col5row2 = "r" And col6row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row4 = "b" And col5row3 = "b" And col6row2 = "b" And col7row1 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row4 = "r" And col5row3 = "r" And col6row2 = "r" And col7row1 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row3 = "b" And col2row4 = "b" And col3row5 = "b" And col4row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row3 = "r" And col2row4 = "r" And col3row5 = "r" And col4row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row3 = "b" And col3row4 = "b" And col4row5 = "b" And col5row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row3 = "r" And col3row4 = "r" And col4row5 = "r" And col5row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") EndIf If col3row3 = "b" And col4row4 = "b" And col5row5 = "b" And col6row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row3 = "r" And col4row4 = "r" And col5row5 = "r" And col6row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row3 = "b" And col5row4 = "b" And col6row5 = "b" And col7row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row3 = "r" And col5row4 = "r" And col6row5 = "r" And col7row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row2 = "b" And col2row3 = "b" And col3row4 = "b" And col4row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row2 = "r" And col2row3 = "r" And col3row4 = "r" And col4row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row2 = "b" And col3row3 = "b" And col4row4 = "b" And col5row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row2 = "r" And col3row3 = "r" And col4row4 = "r" And col5row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row2 = "b" And col4row3 = "b" And col5row4 = "b" And col6row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row2 = "r" And col4row3 = "r" And col5row4 = "r" And col6row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row2 = "b" And col5row3 = "b" And col6row4 = "b" And col7row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row2 = "r" And col5row3 = "r" And col6row4 = "r" And col7row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row1 = "b" And col2row2 = "b" And col3row3 = "b" And col4row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row1 = "r" And col2row2 = "r" And col3row3 = "r" And col4row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row1 = "b" And col3row2 = "b" And col4row3 = "b" And col5row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row1 = "r" And col3row2 = "r" And col4row3 = "r" And col5row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row1 = "b" And col4row2 = "b" And col5row3 = "b" And col6row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row1 = "r" And col4row2 = "r" And col5row3 = "r" And col6row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row1 = "b" And col5row2 = "b" And col6row3 = "b" And col7row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row1 = "r" And col5row2 = "r" And col6row3 = "r" And col7row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row1 = "b" And col1row2 = "b" And col1row3 = "b" And col1row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row1 = "r" And col1row2 = "r" And col1row3 = "r" And col1row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row2 = "b" And col1row3 = "b" And col1row4 = "b" And col1row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row2 = "r" And col1row3 = "r" And col1row4 = "r" And col1row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row3 = "b" And col1row4 = "b" And col1row5 = "b" And col1row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col1row3 = "r" And col1row4 = "r" And col1row5 = "r" And col1row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row1 = "b" And col2row2 = "b" And col2row3 = "b" And col2row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row1 = "r" And col2row2 = "r" And col2row3 = "r" And col2row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row2 = "b" And col2row3 = "b" And col2row4 = "b" And col2row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row2 = "r" And col2row3 = "r" And col2row4 = "r" And col2row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col2row3 = "b" And col2row4 = "b" And col2row5 = "b" And col2row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col2row3 = "r" And col2row4 = "r" And col2row5 = "r" And col2row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row1 = "b" And col3row2 = "b" And col3row3 = "b" And col3row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row1 = "r" And col3row2 = "r" And col3row3 = "r" And col3row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row2 = "b" And col3row3 = "b" And col3row4 = "b" And col3row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row2 = "r" And col3row3 = "r" And col3row4 = "r" And col3row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col3row3 = "b" And col3row4 = "b" And col3row5 = "b" And col3row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col3row3 = "r" And col3row4 = "r" And col3row5 = "r" And col3row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row1 = "b" And col4row2 = "b" And col4row3 = "b" And col4row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row1 = "r" And col4row2 = "r" And col4row3 = "r" And col4row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row2 = "b" And col4row3 = "b" And col4row4 = "b" And col4row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row2 = "r" And col4row3 = "r" And col4row4 = "r" And col4row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col4row3 = "b" And col4row4 = "b" And col4row5 = "b" And col4row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col4row3 = "r" And col4row4 = "r" And col4row5 = "r" And col4row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col5row1 = "b" And col5row2 = "b" And col5row3 = "b" And col5row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col5row1 = "r" And col5row2 = "r" And col5row3 = "r" And col5row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col5row2 = "b" And col5row3 = "b" And col5row4 = "b" And col5row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col5row2 = "r" And col5row3 = "r" And col5row4 = "r" And col5row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col5row3 = "b" And col5row4 = "b" And col5row5 = "b" And col5row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col5row3 = "r" And col5row4 = "r" And col5row5 = "r" And col5row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col6row1 = "b" And col6row2 = "b" And col6row3 = "b" And col6row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col6row1 = "r" And col6row2 = "r" And col6row3 = "r" And col6row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col6row2 = "b" And col6row3 = "b" And col6row4 = "b" And col6row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col6row2 = "r" And col6row3 = "r" And col6row4 = "r" And col6row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col6row3 = "b" And col6row4 = "b" And col6row5 = "b" And col6row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col6row3 = "r" And col6row4 = "r" And col6row5 = "r" And col6row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col7row1 = "b" And col7row2 = "b" And col7row3 = "b" And col7row4 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col7row1 = "r" And col7row2 = "r" And col7row3 = "r" And col7row4 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col7row2 = "b" And col7row3 = "b" And col7row4 = "b" And col7row5 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col7row2 = "r" And col7row3 = "r" And col7row4 = "r" And col7row5 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col7row3 = "b" And col7row4 = "b" And col7row5 = "b" And col7row6 = "b" Then GraphicsWindow.ShowMessage ("Blue Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver ElseIf col7row3 = "r" And col7row4 = "r" And col7row5 = "r" And col7row6 = "r" Then GraphicsWindow.ShowMessage ("Red Player Wins!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf If col1row1 = "b" Or col1row1 = "r" Then If col2row1 = "b" Or col2row1 = "r" Then If col3row1 = "b" Or col3row1 = "r" Then If col4row1 = "b" Or col4row1 = "r" Then If col5row1 = "b" Or col5row1 = "r" Then If col6row1 = "b" Or col6row1 = "r" Then If col7row1 = "b" Or col7row1 = "r" Then GraphicsWindow.ShowMessage ("Its a tie!" "Congratulations!") gamestatus = 1 Goto GameOver EndIf EndIf EndIf EndIf EndIf EndIf EndIf GameOver: If gamestatus = 1 Then Init() Circles() col1row1 = 0 col2row1 = 0 col3row1 = 0 col4row1 = 0 col5row1 = 0 col6row1 = 0 col7row1 = 0 col1row2 = 0 col2row2 = 0 col3row2 = 0 col4row2 = 0 col5row2 = 0 col6row2 = 0 col7row2 = 0 col1row3 = 0 col2row3 = 0 col3row3 = 0 col4row3 = 0 col5row3 = 0 col6row3 = 0 col7row3 = 0 col1row4 = 0 col2row4 = 0 col3row4 = 0 col4row4 = 0 col5row4 = 0 col6row4 = 0 col7row4 = 0 col1row5 = 0 col2row5 = 0 col3row5 = 0 col4row5 = 0 col5row5 = 0 col6row5 = 0 col7row5 = 0 col1row6 = 0 col2row6 = 0 col3row6 = 0 col4row6 = 0 col5row6 = 0 col6row6 = 0 col7row6 = 0 brushcolor = "b" GraphicsWindow.BrushColor = "Blue" gamestatus = 0 EndIf EndSub End>VGG263.sb< Start>VGH186.sb< 'GUI Design, by Airwaves! GraphicsWindow.Show() GraphicsWindow.MouseMove = MouseMove GraphicsWindow.KeyDown = KeyDown GraphicsWindow.Title = "GUI Designer" addbutton_button = FCControls.AddButton(70, 20, "Add Button") FCControls.Move(addbutton_button, GraphicsWindow.Width - 73, GraphicsWindow.Height - 60) FCControls.RegisterMouseDownEvent(addbutton_button, "addbutton") done_button = FCControls.AddButton(70, 20, "Done") FCControls.Move(done_button, GraphicsWindow.Width - 146, GraphicsWindow.Height - 60) FCControls.RegisterMouseDownEvent(done_button, "done") textbox_button = FCControls.AddButton(70, 20, "Text Box") FCControls.Move(textbox_button, GraphicsWindow.Width - 146, GraphicsWindow.Height - 30) FCControls.RegisterMouseDownEvent(textbox_button, "addtextbox") checkbox_button = FCControls.AddButton(70, 20, "Check Box") FCControls.Move(checkbox_button, GraphicsWindow.Width - 73, GraphicsWindow.Height - 30) FCControls.RegisterMouseDownEvent(checkbox_button, "addcheckbox") progressbar_button = FCControls.AddButton(80, 20, "Progresss Bar") FCControls.Move(progressbar_button, GraphicsWindow.Width - 229, GraphicsWindow.Height - 30) FCControls.RegisterMouseDownEvent(progressbar_button, "addprogressbar") currentselected = "" stuff() Sub addbutton controlnumber = controlnumber + 1 control[controlnumber] = FCControls.AddButton(80, 30, "Button " + controlnumber) FCControls.RegisterMouseDownEvent(control[controlnumber], "setselected") currentselected = control[controlnumber] Shapes.SetText(currentselected2, "Focus:" + Text.GetCharacter(10) + currentselected) register[controlnumber] = "Register" EndSub Sub setposition FCControls.Move(currentselected, FCControls.GetText(x_box), FCControls.GetText(y_box)) EndSub Sub stuff x_box = FCControls.AddTextBox(90, 25, "X") y_box = FCControls.AddTextBox(90, 25, "Y") register_box = FCControls.AddTextBox(90, 25, "Register") width_box = FCControls.AddTextBox(90, 25, "Width") height_box = FCControls.AddTextBox(90, 25, "Height") text_box = FCControls.AddTextBox(90, 25, "Text/Value") FCControls.Move(x_box, GraphicsWindow.Width - 190, 5) FCControls.Move(width_box, GraphicsWindow.Width - 190, 65) FCControls.Move(height_box, GraphicsWindow.Width - 95, 65) FCControls.Move(y_box, GraphicsWindow.Width - 95, 5) FCControls.Move(register_box, GraphicsWindow.Width - 190, 35) FCControls.Move(text_box, GraphicsWindow.Width - 190, 95) FCControls.RegisterKeyDownEvent(x_box, "setposition") FCControls.RegisterKeyDownEvent(y_box, "setposition") FCControls.RegisterKeyDownEvent(register_box, "setregister") FCControls.RegisterKeyDownEvent(width_box, "setwidth") FCControls.RegisterKeyDownEvent(height_box, "setheight") FCControls.RegisterKeyDownEvent(text_box, "settext") GraphicsWindow.BrushColor = "Black" currentselected2 = Shapes.AddText("Focus:") Shapes.Move(currentselected2, GraphicsWindow.Width - 95, 35) EndSub Sub setselected mX = GraphicsWindow.MouseX mY = GraphicsWindow.MouseY For i = 0 To Array.GetItemCount(control) controlleft = FCControls.GetLeft(control[i]) controlright = FCControls.GetRight(control[i]) controltop = FCControls.GetTop(control[i]) controlbottom = FCControls.GetBottom(control[i]) If mX>controlleft And mXcontroltop And mY 5 And top < 20 Then GraphicsWindow.PenColor = "Blue" Shapes.Remove(line) line=Shapes.AddLine(left+(FCControls.GetWidth(currentselected)/2), 0, left+(FCControls.GetWidth(currentselected)/2), top) EndIf If left > 5 and left < 20 Then GraphicsWindow.PenColor = "Red" Shapes.Remove(line2) line2=Shapes.AddLine(0, top+(FCControls.GetHeight(currentselected)/2), left, top+(FCControls.GetHeight(currentselected)/2)) EndIf If right > width - 20 And right < width - 5 Then GraphicsWindow.PenColor = "Red" Shapes.Remove(line3) line3=Shapes.AddLine(width, top+(FCControls.GetHeight(currentselected)/2), right, top+(FCControls.GetHeight(currentselected)/2)) EndIf If bottom < height - 5 And bottom > height - 20 Then GraphicsWindow.PenColor = "Blue" Shapes.Remove(line4) line4=Shapes.AddLine(left+(FCControls.GetWidth(currentselected)/2), height, left+(FCControls.GetWidth(currentselected)/2), bottom) EndIf EndSub Sub KeyDown If GraphicsWindow.LastKey = "F1" And controlnumber > 0 Then controlnumber = controlnumber - 1 FCControls.Remove(currentselected) Array.RemoveValue(control, controlnumber+1) currentselected = control[controlnumber] Shapes.SetText(currentselected2, "Focus:" + Text.GetCharacter(10) + currentselected) EndIf EndSub Sub addtextbox controlnumber = controlnumber + 1 control[controlnumber] = FCControls.AddTextBox(100, 25, "TextBox " + controlnumber) FCControls.RegisterMouseDownEvent(control[controlnumber], "setselected") currentselected = control[controlnumber] Shapes.SetText(currentselected2, "Focus:" + Text.GetCharacter(10) + currentselected) register[controlnumber] = "Register" EndSub Sub settext FCControls.SetText(currentselected, FCControls.GetText(text_box)) EndSub Sub addcheckbox controlnumber = controlnumber + 1 control[controlnumber] = FCControls.AddCheckBox("CheckBox " + controlnumber) FCControls.RegisterMouseDownEvent(control[controlnumber], "setselected") currentselected = control[controlnumber] Shapes.SetText(currentselected2, "Focus:" + Text.GetCharacter(10) + currentselected) register[controlnumber] = "Register" EndSub Sub addprogressbar controlnumber = controlnumber + 1 control[controlnumber] = FCControls.AddProgressBar(100, 25, 0) FCControls.RegisterMouseDownEvent(control[controlnumber], "setselected") currentselected = control[controlnumber] Shapes.SetText(currentselected2, "Focus:" + Text.GetCharacter(10) + currentselected) register[controlnumber] = "Register" EndSub End>VGH186.sb< Start>VGJ889.sb< ' Balloon Shooting Game ' original by Strawhatter ' modified by Nonki Takahashi--HJJ420 ' Balloon Shape Changed ' Bullet and Cannon Color Changed ' Modified mahreen miangul--JanUarY 2020 GraphicsWindow.Title = "mahreen miangul ' 111111111111111111111111111111111111111111111111111111111111111111111 GraphicsWindow.Width = 1080 GraphicsWindow.Height = 660 Colors_Init() percent = "1=0;2=70;3=100;" name= "1=DeepSkyBlue;2=yellow;3=blue;" GraphicsWindow.BrushColor = "Black" For i = 1 To 3 pbox[i] = Controls.AddTextBox(10, 10 + (i - 1) * 30) Controls.SetTextBoxText(pbox[i], percent[i]) Controls.SetSize(pbox[i], 40, 22) nbox[i] = Controls.AddTextBox(60, 10 + (i - 1) * 30) Controls.SetTextBoxText(nbox[i], name[i]) EndFor Controls.AddButton("Paint", 10, 100) param = "x=0;y=0;angle=45;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height Paint() Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked param = "x=0;y=0;angle=45;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height For i = 1 To 3 percent[i] = Controls.GetTextBoxText(pbox[i]) name[i] = Controls.GetTextBoxText(nbox[i]) EndFor Paint() EndSub Sub Paint For i = 1 To 3 p = percent[i] n = name[i] param[p] = n EndFor FillLinearGradientRectangle() EndSub Sub FillLinearGradientRectangle ' param["x"], param["y"] - position of the rectangle ' param["width"], param["height"] - size of the rectangle ' param["angle"] - angle of gradient ' param["0"]..param["100"] - 0% to 100% colors x0 = param["x"] y0 = param["y"] width = param["width"] height = param["height"] angle = param["angle"] n = Array.GetItemCount(param) index = Array.GetAllIndices(param) color = "" For i = 1 To n If index[i] + 0 = index[i] And 0 <= index[i] And index[i] <= 100 Then color[index[i]] = param[index[i]] EndIf EndFor If color[0] = "" Then color[0] = GraphicsWindow.BrushColor EndIf If color[100] = "" Then color[100] = GraphicsWindow.BrushColor EndIf n = Array.GetItemCount(color) index = Array.GetAllIndices(color) For i = 1 To n - 1 y1 = y0 + index[i] * height / 100 y2 = y0 + index[i + 1] * height / 100 c = color[index[i]] Color_ColorToRGB() r1 = r g1 = g b1 = b c = color[index[i + 1]] Color_ColorToRGB() r2 = r g2 = g b2 = b For y = y1 To y2 r = Math.Floor(r1 + (r2 - r1) * (y - y1) / (y2 - y1)) g = Math.Floor(g1 + (g2 - g1) * (y - y1) / (y2 - y1)) b = Math.Floor(b1 + (b2 - b1) * (y - y1) / (y2 - y1)) GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) GraphicsWindow.DrawLine(x0, y, x0 + width, y) EndFor EndFor EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param c - color ' returns r, g, b - red, green and blue values If Text.StartsWith(c, "#") Then c = Text.ConvertToUpperCase(c) Else c = Text.ConvertToLowerCase(c) c = colors[c] EndIf sHex = Text.GetSubText(c, 2, 2) Math_Hex2Dec() r = iDec sHex = Text.GetSubText(c, 4, 2) Math_Hex2Dec() g = iDec sHex = Text.GetSubText(c, 6, 2) Math_Hex2Dec() b = iDec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' returns iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub Sub Colors_Init colors["aliceblue"]="#F0F8FF" colors["antiquewhite"]="#FAEBD7" colors["aqua"]="#00FFFF" colors["aquamarine"]="#7FFFD4" colors["azure"]="#F0FFFF" colors["beige"]="#F5F5DC" colors["bisque"]="#FFE4C4" colors["black"]="#000000" colors["blanchedalmond"]="#FFEBCD" colors["blue"]="#0000FF" colors["blueviolet"]="#8A2BE2" colors["brown"]="#A52A2A" colors["burlywood"]="#DEB887" colors["cadetblue"]="#5F9EA0" colors["chartreuse"]="#7FFF00" colors["chocolate"]="#D2691E" colors["coral"]="#FF7F50" colors["cornflowerblue"]="#6495ED" colors["cornsilk"]="#FFF8DC" colors["crimson"]="#DC143C" colors["cyan"]="#00FFFF" colors["darkblue"]="#00008B" colors["darkcyan"]="#008B8B" colors["darkgoldenrod"]="#B8860B" colors["darkgray"]="#A9A9A9" colors["darkgreen"]="#006400" colors["darkkhaki"]="#BDB76B" colors["darkmagenta"]="#8B008B" colors["darkolivegreen"]="#556B2F" colors["darkorange"]="#FF8C00" colors["darkorchid"]="#9932CC" colors["darkred"]="#8B0000" colors["darksalmon"]="#E9967A" colors["darkseagreen"]="#8FBC8F" colors["darkslateblue"]="#483D8B" colors["darkslategray"]="#2F4F4F" colors["darkturquoise"]="#00CED1" colors["darkviolet"]="#9400D3" colors["deeppink"]="#FF1493" colors["deepskyblue"]="#00BFFF" colors["dimgray"]="#696969" colors["dodgerblue"]="#1E90FF" colors["firebrick"]="#B22222" colors["floralwhite"]="#FFFAF0" colors["forestgreen"]="#228B22" colors["fuchsia"]="#FF00FF" colors["gainsboro"]="#DCDCDC" colors["ghostwhite"]="#F8F8FF" colors["gold"]="#FFD700" colors["goldenrod"]="#DAA520" colors["gray"]="#808080" colors["green"]="#008000" colors["greenyellow"]="#ADFF2F" colors["honeydew"]="#F0FFF0" colors["hotpink"]="#FF69B4" colors["indianred"]="#CD5C5C" colors["indigo"]="#4B0082" colors["ivory"]="#FFFFF0" colors["khaki"]="#F0E68C" colors["lavender"]="#E6E6FA" colors["lavenderblush"]="#FFF0F5" colors["lawngreen"]="#7CFC00" colors["lemonchiffon"]="#FFFACD" colors["lightblue"]="#ADD8E6" colors["lightcoral"]="#F08080" colors["lightcyan"]="#E0FFFF" colors["lightgoldenrodyellow"]="#FAFAD2" colors["lightgray"]="#D3D3D3" colors["lightgreen"]="#90EE90" colors["lightpink"]="#FFB6C1" colors["lightsalmon"]="#FFA07A" colors["lightseagreen"]="#20B2AA" colors["lightskyblue"]="#87CEFA" colors["lightslategray"]="#778899" colors["lightsteelblue"]="#B0C4DE" colors["lightyellow"]="#FFFFE0" colors["lime"]="#00FF00" colors["limegreen"]="#32CD32" colors["linen"]="#FAF0E6" colors["magenta"]="#FF00FF" colors["maroon"]="#800000" colors["mediumaquamarine"]="#66CDAA" colors["mediumblue"]="#0000CD" colors["mediumorchid"]="#BA55D3" colors["mediumpurple"]="#9370DB" colors["mediumseagreen"]="#3CB371" colors["mediumslateblue"]="#7B68EE" colors["mediumspringgreen"]="#00FA9A" colors["mediumturquoise"]="#48D1CC" colors["mediumvioletred"]="#C71585" colors["midnightblue"]="#191970" colors["mintcream"]="#F5FFFA" colors["mistyrose"]="#FFE4E1" colors["moccasin"]="#FFE4B5" colors["navajowhite"]="#FFDEAD" colors["navy"]="#000080" colors["oldlace"]="#FDF5E6" colors["olive"]="#808000" colors["olivedrab"]="#6B8E23" colors["orange"]="#FFA500" colors["orangered"]="#FF4500" colors["orchid"]="#DA70D6" colors["palegoldenrod"]="#EEE8AA" colors["palegreen"]="#98FB98" colors["paleturquoise"]="#AFEEEE" colors["palevioletred"]="#DB7093" colors["papayawhip"]="#FFEFD5" colors["peachpuff"]="#FFDAB9" colors["peru"]="#CD853F" colors["pink"]="#FFC0CB" colors["plum"]="#DDA0DD" colors["powderblue"]="#B0E0E6" colors["purple"]="#800080" colors["red"]="#FF0000" colors["rosybrown"]="#BC8F8F" colors["royalblue"]="#4169E1" colors["saddlebrown"]="#8B4513" colors["salmon"]="#FA8072" colors["sandybrown"]="#F4A460" colors["seagreen"]="#2E8B57" colors["seashell"]="#FFF5EE" colors["sienna"]="#A0522D" colors["silver"]="#C0C0C0" colors["skyblue"]="#87CEEB" colors["slateblue"]="#6A5ACD" colors["slategray"]="#708090" colors["snow"]="#FFFAFA" colors["springgreen"]="#00FF7F" colors["steelblue"]="#4682B4" colors["tan"]="#D2B48C" colors["teal"]="#008080" colors["thistle"]="#D8BFD8" colors["tomato"]="#FF6347" colors["turquoise"]="#40E0D0" colors["violet"]="#EE82EE" colors["wheat"]="#F5DEB3" colors["white"]="#FFFFFF" colors["whitesmoke"]="#F5F5F5" colors["yellow"]="#FFFF00" colors["yellowgreen"]="#9ACD32" EndSub 'Initialisation Window gw = 1080 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh fpsTarget= 30 'Initialise Key events GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp keyUp = 0 keyDown = 0 'Initialise Cannon GraphicsWindow.fontsize=44 GraphicsWindow.pencolor="Magenta" GraphicsWindow.penwidth=5 GraphicsWindow.brushcolor="Olivedrab" Cannon = Shapes.AddRectangle(50,50) Boom = Shapes.AddRectangle(50,20) GraphicsWindow.brushcolor="Green" balloon = Shapes.Addtext("👹") balloonDelay=5 StartY=10 dir=-1 CannonX = gw CannonY = gh speed = 3 Shapes.Move(Cannon,CannonX-25,CannonY-25) Shapes.Move(Boom,CannonX-73,CannonY-8) '=============================Makesprite()============================ SPRITE_init() add_shapes() 'Main loop - just move the ball t = Clock.ElapsedMilliseconds While ("True") processKey() If bullet <> "" Then bx = Shapes.GetLeft(bullet) by = Shapes.GetTop(bullet) Shapes.Move(bullet, bx - 10, by) EndIf Collison() Shapes.Move(Cannon,CannonX-25,CannonY-25) Shapes.Move(Boom,CannonX-73,CannonY-8) Program.Delay(10) EndWhile 'Key press event subroutines 'A separate Down and Up is checked for each key, this tells us the state for any key 'And isn't affected by auto-repeat delays for keys Sub OnKeyDown lastKey = GraphicsWindow.LastKey If(lastKey = "Up") Then keyUp = 1 ElseIf(lastKey = "Down") Then keyDown = 1 ElseIf(lastKey="Space")Then KeySpace =1 EndIf EndSub Sub OnKeyUp lastKey = GraphicsWindow.LastKey If(lastKey = "Up") Then keyUp = 0 ElseIf(lastKey = "Down") Then keyDown = 0 Elseif (lastKey="Space")Then KeySpace=0 EndIf EndSub Sub processKey randNum = Math.GetRandomNumber(600) If(keyUp = 1) Then CannonY = CannonY-speed BoomY=BoomY - speed EndIf If(keyDown = 1) Then CannonY = CannonY+speed BoomY= BoomY+speed EndIf GraphicsWindow.brushcolor="white" If KeySpace=1 And bullet = "" Then bullet=Shapes.AddEllipse(20,20) Shapes.Move(bullet,gw,CannonY-6) EndIf 'Check for hitting edges If (CannonY < 0) Then CannonY = -CannonY BoomY=-BoomY EndIf If (Cannon > gh) Then CannonY = -CannonY BoomY=-BoomY EndIf If t + 600 < Clock.ElapsedMilliseconds Then Shapes.Animate(balloon,10,randNum,600) t = Clock.ElapsedMilliseconds EndIf EndSub ' ==============================Add Sprites========================================= Sub add_shapes For M=1 To Array.GetItemCount(s) For N=1 To Array.GetItemCount(s[M]) ss=s[M][N] _shx=shx[M][N] _shY=shY[M][N] _shape=shape[M] NMB=M+":"+N For i=1 To Array.GetItemCount(_shape) GraphicsWindow.PenWidth = _shape[i]["pw"] GraphicsWindow.BrushColor = _shape[i]["bc"] GraphicsWindow.penColor = _shape[i]["pc"] If _shape[i]["func"]="ell" Then shp[NMB][i] = Shapes.AddEllipse(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="rect" Then shp[NMB][i] = Shapes.AddRectangle(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="tri" Then shp[NMB][i] = Shapes.Addtriangle(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss, _shape[i]["x3"]*ss, _shape[i]["y3"]*ss) ElseIf _shape[i]["func"]="line" Then shp[NMB][i] = Shapes.Addline(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss) EndIf Shapes.Animate(shp[NMB][i], _shape[i]["x"]*ss+_shX, _shape[i]["y"]*ss+_shY, 500) Shapes.Rotate(shp[NMB][i], _Shape[i]["angle"]) EndFor EndFor EndFor EndSub Sub Collison Ball_Amount=2 If bullet <> "" Then GraphicsWindow.brushcolor="blue" Bullet_X=Shapes.GetLeft(bullet) + 10 Bullet_Y=Shapes.GetTop(bullet) + 10 Balloon_X=Shapes.GetLeft(balloon) + 25 Balloon_Y=Shapes.GetTop(balloon) + 25 dx = Balloon_X - Bullet_X dy = Balloon_Y - Bullet_Y d = Math.SquareRoot(dx * dx + dy * dy) If d < 35 Then Sound.PlayClick() GraphicsWindow.DrawText(Bullet_X, Bullet_Y, "mahreen/miangul") Shapes.Remove(bullet) bullet = "" ElseIf Bullet_X < 0 Then Shapes.Remove(bullet) bullet = "" EndIf EndIf EndSub Sub SPRITE_init ' 14 Trees s[1]="1=0.6;2=0.6;3=0.6;4=0.6;5=0.6;6=0.6;7=0.6;8=0.6;9=0.6;10=0.6;11=0.6;12=0.6;13=0.6;14=0.6" shX[1]="1=300;2=350;3=400;4=450;5=500;6=550;7=600;8=650;9=700;10=750;11=800;12=850;13=900;14=950" shY[1]="1=350;2=350;3=350;4=350;5=350;6=350;7=350;8=350;9=350;10=350;11=350;12=350;13=350;14=350" shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2" shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2" shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2;" shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2;" shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2" shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2" shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2;" shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2;" shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2" shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0" shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0" ' 18 Apples s[2] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=0.2;8=0.2;9=0.2;10=0.2;11=0.2;12=0.2;13=0.2;14=0.2;15=0.2;16=0.2;17=.2;18=.2;18=.2" shX[2] ="1=200;2=220;3=250;4=280;5=310;6=680;7=710;8=740;9=770;10=590;11=620;12=650;13=680;14=710;15=740;16=770;17=800;18=830" shY[2] ="1=495;2=425;3=460;4=495;5=425;6=460;7=370;8=370;9=370;10=500;11=500;12=500;13=500;14=500;15=500;16=500;17=500;18=500" shape[2][1] = "func=rect;x=626;y=110;width=20;height=60;angle=30;bc=yellowgreen;pw=0;" shape[2][2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;" shape[2][3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;" shape[2][4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;" shape[2][5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;" shape[2][6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;" shape[2][7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;" shape[2][8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;" 'Tree s[3]="1=0.7;2=0.7;3=0.7;4=0.7;" shX[3]="1=0;2=100;3=0;4=100" shY[3]="1=210;2=210;3=320;4=320" ' 5,6,13,14 shape[3]=shape[1] 'Apple s[4] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=.2;8=.2;" shX[4] ="1=-100;2=-90;3=-40;4=0;5=40;6=80;7=120;8=140" shY[4] ="1=480;2=430;3=440;4=300;5=300;6=300;7=300;8=300" shape[4]=shape[2] endsub End>VGJ889.sb< Start>VGK484-0.sb< ' Scale 0.2 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.2 23/03/2013 Completed. (VGK484-0) ' 0.1a 19/03/2013 Created. (VGK484) ' GraphicsWindow.Title = "Scale 0.2b" x0 = GraphicsWindow.Width / 2 y0 = GraphicsWindow.Height / 2 GraphicsWindow.PenColor = "LightGray" For i = 1 To 4 GraphicsWindow.DrawEllipse(x0 - i * 50, y0 - i * 50, i * 100, i * 100) EndFor GraphicsWindow.BrushColor = "Black" oAngle = Shapes.AddText("") Shapes.Move(oAngle, 10, 10) GraphicsWindow.FillTriangle(x0, y0, x0 - 10, y0 + 20, x0 + 10, y0 + 20) GraphicsWindow.PenColor = "Black" scale = Shapes.AddLine(0, 0, 400, 0) Shapes.Move(scale, x0 - 200, y0) weight = "1=10;2=10;3=20;4=20;5=40;6=40;" color = "1=Red;2=Orange;3=Green;4=DarkCyan;5=DarkBlue;6=Purple;" nBlock = Array.GetItemCount(weight) GraphicsWindow.PenWidth = 0 For i = nBlock To 1 Step -1 size[i] = Math.Floor(Math.Power(weight[i], 1/3) * 10) GraphicsWindow.BrushColor = color[i] block[i] = Shapes.AddRectangle(size[i], size[i]) x[i] = 50 * i y[i] = y0 * 2 - 50 - size[i] Shapes.Move(block[i], x[i], y[i]) EndFor iPicked = 0 angle = 0 Rotate() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove Timer.Interval = 1000 / 24 Timer.Tick = OnTick Sub CalcMoment moment = -angle * 100 cosa = Math.Cos(Math.GetRadians(angle)) For i = 1 To 9 posx = (i - 1) * 50 - 200 iLoaded = loaded[posx] If iLoaded <> "" Then moment = moment + posx * weight[iLoaded] * cosa EndIf EndFor da = moment / 1000 EndSub Sub OnTick ms = Math.Remainder(Clock.ElapsedMilliseconds, 3000) CalcMoment() If da <> 0 Then angle = angle + da If angle < -60 Then angle = -60 ElseIf 60 < angle Then angle = 60 EndIf Rotate() Shapes.SetText(oAngle, "angle=" + Math.Round(angle)) EndIf EndSub Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY For i = 1 To nBlock If x[i] <= mx And mx <= x[i] + size[i] And y[i] <= my And my <= y[i] + size[i] Then iPicked = i Shapes.Rotate(block[iPicked], 0) dx = mx - x[i] dy = my - y[i] i = nBlock + 1 ' break For j = 1 To 9 If loaded[(j - 1) * 50 - 200] = iPicked Then loaded[(j - 1) * 50 - 200] = "" EndIf EndFor EndIf EndFor EndSub Sub OnMouseMove If iPicked <> 0 Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY x[iPicked] = mx - dx y[iPicked] = my - dy Shapes.Move(block[iPicked], x[iPicked], y[iPicked]) EndIf EndSub Sub OnMouseUp If iPicked <> 0 Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY For i = 1 To 9 xx = Math.Abs((mx - dx + size[iPicked]) - lx[i]) yy = Math.Abs((my - dy + size[iPicked]) - ly[i]) If xx < size[iPicked] And yy < size[iPicked] Then loaded[(i - 1) * 50 - 200] = iPicked i = 9 ' break EndIf EndFor EndIf iPicked = 0 Rotate() EndSub Sub Rotate ' param angle Shapes.Rotate(scale, angle) nLoaded = Array.GetItemCount(loaded) pos = Array.GetAllIndices(loaded) cosa = Math.Cos(Math.GetRadians(angle)) sina = Math.Sin(Math.GetRadians(angle)) For i = 1 To nLoaded iLoaded = loaded[pos[i]] half = size[iLoaded] / 2 x[iLoaded] = x0 + pos[i] * cosa + half * sina - half y[iLoaded] = y0 + pos[i] * sina - half * cosa - half Shapes.Move(block[iLoaded], x[iLoaded], y[iLoaded]) Shapes.Rotate(block[iLoaded], angle) EndFor For i = 1 To 9 lx[i] = x0 + ((i - 1) * 50 - 200) * cosa ly[i] = y0 + ((i - 1) * 50 - 200) * sina EndFor EndSub End>VGK484-0.sb< Start>VGK484-2.sb< ' Scale 0.22 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.22 23/03/2013 Minor changed for Silverlight. (VGK484-1) ' 0.2 23/03/2013 Completed. (VGK484-0) ' 0.1a 19/03/2013 Created. (VGK484) ' GraphicsWindow.Title = "Scale 0.22" x0 = GraphicsWindow.Width / 2 y0 = GraphicsWindow.Height / 2 GraphicsWindow.PenColor = "LightGray" For i = 1 To 4 GraphicsWindow.DrawEllipse(x0 - i * 50, y0 - i * 50, i * 100, i * 100) EndFor GraphicsWindow.BrushColor = "Black" oAngle = Shapes.AddText("") Shapes.Move(oAngle, 10, 10) GraphicsWindow.FillTriangle(x0, y0, x0 - 10, y0 + 20, x0 + 10, y0 + 20) GraphicsWindow.PenColor = "Black" scale = Shapes.AddRectangle(400, 2) Shapes.Move(scale, x0 - 200, y0) weight = "1=10;2=10;3=20;4=20;5=40;6=40;" color = "1=Red;2=Orange;3=Green;4=DarkCyan;5=DarkBlue;6=Purple;" nBlock = Array.GetItemCount(weight) GraphicsWindow.PenWidth = 0 For i = nBlock To 1 Step -1 size[i] = Math.Floor(Math.Power(weight[i], 1/3) * 10) GraphicsWindow.BrushColor = color[i] block[i] = Shapes.AddRectangle(size[i], size[i]) x[i] = 50 * i y[i] = y0 * 2 - 50 - size[i] Shapes.Move(block[i], x[i], y[i]) EndFor iPicked = 0 angle = 0 Rotate() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove Timer.Interval = 1000 / 24 Timer.Tick = OnTick Sub CalcMoment moment = -angle * 100 cosa = Math.Cos(Math.GetRadians(angle)) For i = 1 To 9 posx = (i - 1) * 50 - 200 iLoaded = loaded[posx] If iLoaded <> "" Then moment = moment + posx * weight[iLoaded] * cosa EndIf EndFor da = moment / 1000 EndSub Sub OnTick ms = Math.Remainder(Clock.ElapsedMilliseconds, 3000) CalcMoment() If da <> 0 Then angle = angle + da If angle < -60 Then angle = -60 ElseIf 60 < angle Then angle = 60 EndIf Rotate() Shapes.SetText(oAngle, "angle=" + Math.Round(angle)) EndIf EndSub Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY For i = 1 To nBlock If x[i] <= mx And mx <= x[i] + size[i] And y[i] <= my And my <= y[i] + size[i] Then iPicked = i Shapes.Rotate(block[iPicked], 0) dx = mx - x[i] dy = my - y[i] i = nBlock + 1 ' break For j = 1 To 9 If loaded[(j - 1) * 50 - 200] = iPicked Then loaded[(j - 1) * 50 - 200] = "" EndIf EndFor EndIf EndFor EndSub Sub OnMouseMove If iPicked <> 0 Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY x[iPicked] = mx - dx y[iPicked] = my - dy Shapes.Move(block[iPicked], x[iPicked], y[iPicked]) EndIf EndSub Sub OnMouseUp If iPicked <> 0 Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY For i = 1 To 9 xx = Math.Abs((mx - dx + size[iPicked]) - lx[i]) yy = Math.Abs((my - dy + size[iPicked]) - ly[i]) If xx < size[iPicked] And yy < size[iPicked] Then loaded[(i - 1) * 50 - 200] = iPicked i = 9 ' break EndIf EndFor EndIf iPicked = 0 Rotate() EndSub Sub Rotate ' param angle Shapes.Rotate(scale, angle) cosa = Math.Cos(Math.GetRadians(angle)) sina = Math.Sin(Math.GetRadians(angle)) nLoaded = Array.GetItemCount(loaded) pos = Array.GetAllIndices(loaded) For i = 1 To nLoaded iLoaded = loaded[pos[i]] half = size[iLoaded] / 2 x[iLoaded] = x0 + pos[i] * cosa + half * sina - half y[iLoaded] = y0 + pos[i] * sina - half * cosa - half Shapes.Move(block[iLoaded], x[iLoaded], y[iLoaded]) Shapes.Rotate(block[iLoaded], angle) EndFor For i = 1 To 9 lx[i] = x0 + ((i - 1) * 50 - 200) * cosa ly[i] = y0 + ((i - 1) * 50 - 200) * sina EndFor EndSub End>VGK484-2.sb< Start>VGK484.sb< ' Scale 0.1a x0 = GraphicsWindow.Width / 2 y0 = GraphicsWindow.Height / 2 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillTriangle(x0, y0, x0 - 10, y0 + 20, x0 + 10, y0 + 20) Shapes.AddLine(x0 - 200, y0, x0 + 200, y0) weight = "1=10;2=10;3=20;4=20;5=40;6=40;" color = "1=Red;2=Orange;3=Green;4=DarkCyan;5=DarkBlue;6=Purple;" nBlock = Array.GetItemCount(weight) GraphicsWindow.PenWidth = 0 For i = nBlock To 1 Step -1 size[i] = Math.Floor(Math.Power(weight[i], 1/3) * 10) GraphicsWindow.BrushColor = color[i] block[i] = Shapes.AddRectangle(size[i], size[i]) x[i] = 50 * i y[i] = y0 * 2 - 50 - size[i] Shapes.Move(block[i], x[i], y[i]) EndFor iPicked = 0 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY For i = 1 To nBlock If x[i] <= mx And mx <= x[i] + size[i] And y[i] <= my And my <= y[i] + size[i] Then iPicked = i dx = mx - x[i] dy = my - y[i] i = nBlock + 1 ' break EndIf EndFor EndSub Sub OnMouseUp iPicked = 0 EndSub Sub OnMouseMove If iPicked <> 0 Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY x[i] = mx - dx y[i] = my - dy Shapes.Move(block[iPicked], x[i], y[i]) EndIf EndSub End>VGK484.sb< Start>VGK947.sb< ' SmallBasic Version 1.0 ' Funktion: Downloader ' Autor: Pappa Lapub ' Herkunft: ' ImportURL: ' Extension: LitDev, Data ' Kommentar: Zielpfad Vorgabe: C:\Temp\ ' Demo DLUrl zB. http://www.nirsoft.net/utils/batteryinfoview.zip 117507 Bytes, 114.8 KB / Mon, 20 May 2013 09:03:44 ' -------------------------------------------------------------------------------- CmdLine() 'GWInit() Controls.ButtonClicked = BeiKnopfDruck Controls.TextTyped = BeiTextEingabe ' ---- SUBs -------------------------------------------------------------- Sub CmdLine If Program.ArgumentCount > 0 Then URL = Program.GetArgument(1) UrlTest() If URL = "" Then Program.End() Else TOut = "True" Save() Program.End() EndIf Else GWInit() EndIf EndSub Sub GWInit GraphicsWindow.Width = 400 GraphicsWindow.Height = 90 GraphicsWindow.BackgroundColor = "Aquamarine" URLText = Controls.AddTextBox(10,10) Controls.SetSize(URLText, 380, 24) DLKnopf = Controls.AddButton("Download", 10,50) LDDialogs.ToolTip(DLKnopf,"DateiURL beginnend mit http://") SaveIn = Controls.AddButton("Speichern in..",155,50) Zurück = Controls.AddButton("Bereinigen",310,50) SaveFile = "" EndSub Sub BeiKnopfDruck If Controls.LastClickedButton = DLKnopf Then UrlTest() 'TmpFile = Network.DownloadFile(URL) If URL <> "" Then TOut = "True" Save() EndIf ElseIf Controls.LastClickedButton = Zurück Then Controls.SetTextBoxText(URLText,"") ElseIf Controls.LastClickedButton = SaveIn Then If FilePlus.FileExists(SaveFile) Then EndPfad = LDDialogs.GetFolder("C:\Temp") If EndPfad <> "" Then FilePlus.MoveFile(SaveFile,EndPfad) EndIf EndIf EndIf EndSub Sub BeiTextEingabe If Controls.LastTypedTextBox = URLText Then URL = Controls.GetTextBoxText(URLText) EndIf EndSub Sub UrlTest If Text.GetSubText(Text.ConvertToLowerCase(URL), 1, 7) <> "http://" Then 'GraphicsWindow.ShowMessage("Falsche Webdateiadresse: " + URL + " Muss mit http:// beginnen.", "Fehler") Dialogs.ShowMessageBox("Falsche Webdateiadresse: " + URL + ". Muss mit http:// beginnen.", "Fehler","OK","Information") URL = "" If URL = "" Then Controls.SetTextBoxText(URLText,"") EndIf EndIf EndSub ' Dateiadresse URL herunterladen, diese wird aber als tmpDatei gespeichert Sub Save If TOut Then 'URL = "http://www.nirsoft.net/utils/batteryinfoview.zip" ' zB. kleine Datei TmpPfad = "C:\Temp\" TmpFile = Network.DownloadFile(URL) Timer.Interval = 30000 Timer.Tick = OnTimeOut If (TmpFile <> "") And (FilePlus.FileExists(TmpFile)) Then Dialogs.ShowMessageBox("Download abgeschlossen.", "Fertig", "OK","Information") Else TOut = "False" EndIf ' diese Datei wird gespeichert als tmpDatei namens 'TextWindow.WriteLine(TmpFile) ' Ermittle den Filename OHNE den Ordnerpfad (also den Pfad abspalten) FileName = URL Pos = Text.GetIndexOf(FileName,"/") While (Pos > 0) FileName = Text.GetSubTextToEnd(FileName,Pos+1) Pos = Text.GetIndexOf(FileName,"/") EndWhile 'zu speichernde Datei als Pfad+Name festlegen auf den richtigen Namen kopieren ' vorher ev. noch überprüfen ob eh keine andere Savefile schon existiert die dabei überschrieben wird SaveFile = TmpPfad + FileName FileExt = FilePlus.GetFileExtension(SaveFile) BaseName = Text.GetSubText(SaveFile,1,Text.GetLength(SaveFile) - Text.GetLength(FileExt)) Num = 0 While FilePlus.FileExists(SaveFile) Num = Num + 1 SaveFile = BaseName + "_" + Num + FileExt EndWhile 'TextWindow.WriteLine(SaveFile) ' The following line could be harmful and has been automatically commented. ' 'File.CopyFile(TmpFile,SaveFile) FilePlus.MoveFile(TmpFile,SaveFile) TOut = "False" ' und die tmpDatei löschen (vorher ev. noch prüfen ob die kopierte Savefile EH wirklich existiert) ' The following line could be harmful and has been automatically commented. ' 'File.DeleteFile(TmpFile) EndIf EndSub '-------------------------------------------- Sub OnTimeOut If TmpFile = "" Then TOut = "False" Dialogs.ShowMessageBox("Downloadversuch abgebrochen. Überprüfe Verbindung!", "Verbindungsfehler", "OK", "Error") EndIf EndSub End>VGK947.sb< Start>VGK960.sb< ' Raycaster maze ' 'using inbuilt simple textures 30 x 3 pixels. InitialSetUp: w = 399 h = 300 'w = 511 'h = 384 'w = 319 'h = 240 size = 8 'intensity = 70 intensity = 120 GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.CanResize = 1 GraphicsWindow.BackgroundColor = "black" GraphicsWindow.PenWidth = size posX = 2.1 posY = 7.5 dirX = 1 dirY = 0 planeX = 0 planeY = 0.66 completed = 1 moveSpeed = 0.2 rotSpeed = 0.1 texWidth = 30 texHeight = 3 ' set up the key press interrupts GraphicsWindow.Keydown = OnKeydown GraphicsWindow.Keyup = OnKeyup ' call the setupmap subroutine to draw the initial map view setupmap() setuptexture() setupcolours() main() Loop: Goto loop Sub draw GraphicsWindow.DrawLine (x * size,drawStart,x * size,drawEnd) EndSub Sub drawfill GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,0,x*size,drawstart) GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,drawend,x*size,h) EndSub Sub nodraw GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,0,x * size,h) EndSub sub main completed = 0 starttime = Clock.ElapsedMilliseconds For x = 0 To w / size ' calculate ray position and direction cameraX = 2 * x / (w / size) - 1 ' x-coordinate in camera space rayPosX = posX rayPosY = posY rayDirX = dirX + planeX * cameraX rayDirY = dirY + planeY * cameraX ' 'which box of the map we're in mapX = Math.Floor(rayPosX) mapY = Math.Floor(rayPosY) ' length of ray from current position to next x or y-side sideDistX = 0 sideDistY = 0 ' length of ray from one x or y-side to next x or y-side deltaDistX = Math.SquareRoot(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX)) deltaDistY = Math.SquareRoot(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY)) perpWallDist = 0 'what direction to step in x or y-direction (either +1 or -1) stepX = 0 stepY = 0 hit = 0 ' was there a wall hit? side = 0 ' was a NS or a EW wall hit? ' calculate step and initial sideDist If rayDirX < 0 Then stepX = -1 sideDistX = (rayPosX - mapX) * deltaDistX Else stepX = 1 sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX EndIf If rayDirY < 0 then stepY = -1 sideDistY = (rayPosY - mapY) * deltaDistY Else stepY = 1 sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY EndIf ' perform DDA ' trace a "ray" until it hits a wall, and determine if it's an "X" (horizontal) or "Y" (vertical) wall While hit = 0 ' jump to next map square, OR in x-direction, OR in y-direction If sideDistX < sideDistY Then sideDistX = sideDistX + deltaDistX mapX = mapx + stepX side = 0 Else sideDistY = sideDistY + deltaDistY mapY = mapy + stepY side = 1 EndIf ' Check if ray has hit a wall If worldMap[mapX][mapY] > 0 Then hit = 1 EndIf EndWhile ' Calculate distance projected on camera direction. If side = 0 Then perpWallDist = Math.Abs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) Else perpWallDist = Math.Abs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY) EndIf ' Calculate height of line to draw on screen lineHeight = Math.Abs(h / perpWallDist) lineHeight = Math.Round (lineheight) 'if height if line to be drawn is > than height of graphics window then limit height of line 'If lineHeight > h Then ' lineHeight = h 'EndIf ' ' calculate lowest and highest pixel to fill in current stripe drawStart = (lineHeight * -1) / 2 + h / 2 'If drawStart < 0 Then ' drawStart = 0 'EndIf drawEnd = lineHeight / 2 + h / 2 'If drawEnd >= h Then ' drawEnd = h - 1 'EndIf ' set up the colours depending on the block numbers ' default colour is grey (RGB values are equal) coladj2 = (lineHeight / h) * 250 coladj = (lineHeight / h) * 250 - (intensity - coladj2) coladj = Math.Floor(coladj) If coladj < 0 Then coladj = 0 EndIf If coladj > 255 Then coladj = 255 EndIf ' blockcolour = worldMap[mapx][mapY] colours() If coladj < 1 Then nodraw() Goto jumpend EndIf If worldMap[mapx][mapy] < 5 Then draw() drawfill() Goto jumpend Else wallX = 0 If side = 1 Then wallX = rayPosX + ((mapY - rayPosY + (1 - stepy) / 2) / rayDirY) * rayDirX Else wallX = rayPosY + ((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) * rayDirY EndIf wallX = wallX - math.floor(wallX) texX = math.Floor(wallX * texWidth) hY = lineHeight/texHeight For texY = 1 To texheight newtex = worldMap[mapx][mapy] texel = texture[newtex][texX + 1][texY] blockcolour = texel colours() newdrawStart = drawStart + (texY * hY) - hY newdrawEnd = drawstart + (texY * hY) GraphicsWindow.DrawLine (x * size,newdrawStart,x * size,newdrawEnd) drawfill() EndFor EndIf jumpend: EndFor completed = 1 'endtime = Clock.ElapsedMilliseconds 'duration = endtime - starttime 'duration = math.Round (1 /(duration/1000)) 'TextWindow.CursorLeft = 0 'TextWindow.CursorTop = 0 'TextWindow.WriteLine (duration + " ") Endsub Sub colours coldistr = colourtable[blockcolour][1] * coladj coldistg = colourtable[blockcolour][2] * coladj coldistb = colourtable[blockcolour][3] * coladj colour = GraphicsWindow.GetColorFromRGB(coldistr, coldistg, coldistb) If side = 1 Then colour = GraphicsWindow.GetColorFromRGB(coldistr / 1.3, coldistg / 1.3, coldistb / 1.3) EndIf GraphicsWindow.PenColor = colour EndSub Sub onkeydown If completed = 1 Then 'ensures that will not try to draw, when previous frame is still drawing keypress = GraphicsWindow.LastKey moveX = dirX * movespeed moveY = dirY * movespeed ' checks that nothing is in front then moves forward If keypress = "Up" Then If worldMap[Math.Floor(posX + moveX )][Math.Floor(posy)] = 0 Then posX = posX + moveX Endif If worldMap[Math.Floor(posx)][math.Floor(posY + moveY)] = 0 Then posY = posY + moveY Endif Endif ' checks that nothing is in behind then moves backwards If keypress = "Down" Then If worldMap[Math.Floor(posX - moveX)][Math.Floor(posy)] = 0 Then posX = posX - moveX Endif If worldMap[Math.Floor(posx)][math.Floor(posY - moveY)] = 0 Then posY = posY - moveY Endif Endif ' rotate the view anticlockwise if turning left If keypress = "Left" Then oldDirx = dirX CosrotspeedL = Math.Cos(-1 * rotspeed) SinrotspeedL = Math.Sin(-1 * rotspeed) dirX = dirX * CosrotspeedL - dirY * SinrotspeedL dirY = oldDirX * SinrotspeedL + dirY * CosrotspeedL oldPlanex = planeX planeX = planeX * CosrotspeedL - planeY * SinrotspeedL planeY = oldPlaneX * SinrotspeedL + planeY * CosrotspeedL EndIf ' rotate the view clockwise if turning right If keypress = "Right" Then oldDirx = dirX CosrotspeedR = Math.Cos(rotspeed) SinrotspeedR = Math.Sin(rotspeed) dirX = dirX * CosrotspeedR - dirY * SinrotspeedR dirY = oldDirX * SinrotspeedR + dirY * CosrotspeedR oldPlaneX = planeX planeX = planeX * CosrotspeedR - planeY * SinrotspeedR planeY = oldPlaneX * SinrotspeedR + planeY * CosrotspeedR EndIf 'call main subroutine to draw the new frame/view main() EndIf EndSub Sub OnKeyUp keypress = "" EndSub Sub setupmap mapwidth = 28 mapheight = 31 MapLine[1] = "1111111111111111111111111111" MapLine[2] = "1111000111110001111111111111" MapLine[3] = "1111000000000000000000000001" MapLine[4] = "1111000110110001111111110111" MapLine[5] = "1666106110111011111111110111" MapLine[6] = "6006606110111011111111110111" MapLine[7] = "9000006000001000000000110111" MapLine[8] = "6006606000001011111110110111" MapLine[9] = "6666606000001011111110110101" MapLine[10] = "1118505881111011111110000001" MapLine[11] = "1150000081111011111111110101" MapLine[12] = "1180000058881011000100010111" MapLine[13] = "1180060000000000000100010111" MapLine[14] = "1180000058881011000100010111" MapLine[15] = "1180000081111011101100010111" MapLine[16] = "1188505811111011101100010111" MapLine[17] = "1111505111111010001110110111" MapLine[18] = "1111505911111010111110110111" MapLine[19] = "1111505051111010000000110111" MapLine[20] = "1111505051111011111111100011" MapLine[21] = "1111505051000000000000000011" MapLine[22] = "1100001011000011011101100011" MapLine[23] = "1101101011000011011101111111" MapLine[24] = "1101101011000011011101111111" MapLine[25] = "1101101011011111011101111111" MapLine[26] = "1101101011011111010101100001" MapLine[27] = "1101100011011111010101100001" MapLine[28] = "1000111111011111010100000001" MapLine[29] = "1000000000000000010111100001" MapLine[30] = "1000111111111111110000000001" MapLine[31] = "1111111111111111111111111111" ' ' define some parameters that state how big the map is mapsizex = Text.GetLength (mapline[1]) mapsizey = array.GetItemCount (mapline) ' 'try to read this in and convert it into a two dimensional array For yloop = 1 To mapsizey For xloop = 1 To mapsizex worldmap[xloop][yloop] = Text.GetSubText(mapline[yloop],xloop,1) EndFor EndFor EndSub Sub setuptexture 'blue panel texline[1] = "777777777777777777777777777777" texline[2] = "774444444444444444444444444477" texline[3] = "777777777777777777777777777777" For yloop = 1 To texHeight For xloop = 1 To texWidth texture[5][xloop][yloop] = Text.GetSubText(texline[yloop],xloop,1) EndFor EndFor 'red panel texline[1] = "777777777777777777777777777777" texline[2] = "777722222222222222222222227777" texline[3] = "777777777777777777777777777777" For yloop = 1 To texHeight For xloop = 1 To texWidth texture[6][xloop][yloop] = Text.GetSubText(texline[yloop],xloop,1) EndFor EndFor 'closed door texline[1] = "111111111111111111111111111111" texline[2] = "111111778555555555555877111111" texline[3] = "111111778555555555555877111111" For yloop = 1 To texHeight For xloop = 1 To texWidth texture[7][xloop][yloop] = Text.GetSubText(texline[yloop],xloop,1) EndFor EndFor 'gray panel texline[1] = "777777777777777777777777777777" texline[2] = "771111111111111111111111111177" texline[3] = "777777777777777777777777777777" For yloop = 1 To texHeight For xloop = 1 To texWidth texture[8][xloop][yloop] = Text.GetSubText(texline[yloop],xloop,1) EndFor EndFor 'open door texline[1] = "887777777777777777777777777788" texline[2] = "887778844000000000000448877788" texline[3] = "887778844000000000000448877788" For yloop = 1 To texHeight For xloop = 1 To texWidth texture[9][xloop][yloop] = Text.GetSubText(texline[yloop],xloop,1) EndFor EndFor EndSub Sub setupcolours 'black colourtable [0][1] = 0 colourtable [0][2] = 0 colourtable [0][3] = 0 'white/gray colourtable [1][1] = .75 colourtable [1][2] = .75 colourtable [1][3] = .75 'red colourtable [2][1] = 1 colourtable [2][2] = 0 colourtable [2][3] = 0 'green colourtable [3][1] = 0 colourtable [3][2] = 1 colourtable [3][3] = 0 'blue colourtable [4][1] = 0 colourtable [4][2] = 0 colourtable [4][3] = 1 'brown colourtable [5][1] = .66 colourtable [5][2] = .33 colourtable [5][3] = .16 'dark brown colourtable [6][1] = .33 colourtable [6][2] = .22 colourtable [6][3] = .11 'mid gray colourtable [7][1] = .37 colourtable [7][2] = .37 colourtable [7][3] = .37 'dark gray colourtable [8][1] = .18 colourtable [8][2] = .18 colourtable [8][3] = .18 EndSub End>VGK960.sb< Start>VGL640.sb< 'These variables control game play: BRAND_NEW_GAME = 0 PLAY_LEVEL = 1 ADVANCE_LEVEL = 2 REPLAY_LEVEL = 3 GAME_OVER = 4 gameState = BRAND_NEW_GAME 'Initialization: mazeScale = 8 'Size of maze and distance between tiles. The game runs better when 'the mazeScale is 2 x the number of animation frames. I set the total animation frames 'to 4 because it gave the best performance while making the math easier. gameScreenHeight = 375 gamescreenWidth = 225 monsterEatenCtr = 0 'Counts the number of monsters eaten in succession per energizer (4= bonus) monsterBonusPts = 1000 'Pts given to player for eating 4 monsters in succession. monsterPts = 200 'Points player gets when he/she eats a monster. monsterPtsMuliplier = 2 'Causes player to get bonus points when monsters are eaten in succession. monstersEatenPerLevel = 0'Counts the number of mosters eaten per level. SBC gets a life if he eats 16 monsters per level. gameSpeed = 20'<-- Decrease if game runs too slowly gameScore = 0 gameLevel = 0 pelletScore = 25 energizerScore = 100 hasReached50K = "False" 'Flag to track if score reaches 50,000. Player gets extra life. initialCountDownTime = 80 'Amount of time (cycles) the monsters stay "frightened" globalCycleCtr = 0 'Used for syncronization and scheduling. '********************************** 'Game loop '*********************************** While (gameState <> GAME_OVER) keyPressed = GraphicsWindow.LastKey start = Clock.ElapsedMilliseconds globalCycleCtr = globalCycleCtr + 1 If (gameState = BRAND_NEW_GAME) Then InitializeLookupTables() SetupGraphicsWindow() LoadBitmaps() InitializeSprites() SpriteArray[SBC][Lives] = 3 gameState = ADVANCE_LEVEL ElseIf (gameState = ADVANCE_LEVEL) Then globalCycleCtr = 0 monstersEatenPerLevel = 0 selectedRotation = 0 ' SBC goes through 4 max rotations. sbcDirection = Dir_R ' SBC moves to the right when level starts. SmallDelay() UpdateLevelState() ConstructGameElements() splashText = "L E V E L : "+ gameLevel DisplayLevelSplash() gameState = PLAY_LEVEL ElseIf (gameState = PLAY_LEVEL) Then LeaveMonsterPenOneByOne() 'Each sprite has a counter that it uses to track when it reaches a tile when moving though the maze. 'When this counter reaches mazeScale, the sprite updates it info and draws. 'Each sprite also has a spritespeed variable that it uses to set its movement speed. For example, 'if spritespeed = 1 then updates will be done on each tick of the global counter. If spritespeed = 2 then 'updates will be done on every 2nd tick, which will slow down that sprite, etc. For Sprites = firstSprite to lastSprite IF Math.Remainder(globalCycleCtr,SpriteArray[Sprites][spriteSpeed])=0 Then Update() Draw() EndIf Endfor ElseIf (gameState = REPLAY_LEVEL) Then sbcDirection = Dir_R Sprites=1 SpriteArray[SBC][Lives] = SpriteArray[sbc][Lives] - 1 SpriteArray[SBC][State] = NORMAL globalCycleCtr = 0 SmallDelay() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() DrawSprites() '<---BUG FIX. A call to DrawSprites( ) fixes an issue where SBC dissapears when level restarts. SmallDelay() gameState = PLAY_LEVEL If (SpriteArray[SBC][Lives] = 0) Then gameState = GAME_OVER splashText = "Game Over" DisplayLevelSplash() Endif Endif delay = gameSpeed - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf KeyboardHandler() EndWhile 'End of main state machine '*********************************************************************************** Sub SmallDelay Program.Delay(500) EndSub '******************************************************************************************* 'Updates various games elements (eg maze color, game speed, etc) as the player advances to a new level: '- gameSpeed: Overall speed of game. Game gets faster on each level. '- initialCountDownTime: amount of time that monsters stay afraid. Decreases on each level. Sub UpdateLevelState If math.Remainder(gameLevel,4) = 1 Then mazeBorderColor = "Cyan" ElseIf math.Remainder(gameLevel,4) = 2 then mazeBorderColor = "Red" Elseif math.Remainder(gameLevel,4) = 3 then mazeBorderColor = "midnightblue" Elseif math.Remainder(gameLevel,4) = 0 then mazeBorderColor = "magenta" EndIf gameLevel = gameLevel + 1 gameSpeed = gameSpeed - 2 If (gameSpeed <= 0) Then gameSpeed = 0 EndIf 'Give the player a new life on levels 4 and 8: If (gameLevel = 4 Or gameLevel = 8) Then SpriteArray[sbc][Lives]=SpriteArray[sbc][Lives] + 1 EndIf 'Reduce the amount of time that the monsters stay "Frightened" as game progresses. 'At much higher levels, the monsters won't stay frighened at all: initialCountDownTime = initialCountDownTime - 2 If initialCountDownTime <= 0 Then initialCountDownTime = 0 EndIf EndSub '******************************************************************************************* 'Dsplays a splash screen at the start of each level: Sub DisplayLevelSplash GraphicsWindow.FontSize=14 GraphicsWindow.BrushColor="white" l=Shapes.AddText(splashText) Shapes.Move(l,-200,205) Shapes.Animate(l,80,205,1000) SmallDelay() SmallDelay() SmallDelay() Shapes.Animate(l,-200,205,1000) EndSub '******************************************************************************************* 'The variables Dir_L, Dir_U, Dir_R, Dir_D are used as indexes into the xModifier and yModifier lookup tables. 'For example, xModifier[L] & yModifier[L] produces -1 and 0 respectively. When added to XY or RC values this will cause 'the sprite to go left, etc: Sub KeyboardHandler Dir_L = 1 Dir_U = 2 Dir_R = 3 Dir_D = 4 If (keyPressed = "Left") Then sbcDirection = Dir_L Elseif (keyPressed = "Right") Then sbcDirection = Dir_R Elseif (keyPressed = "Up") Then sbcDirection = Dir_U Elseif (keyPressed = "Down") Then sbcDirection = Dir_D Elseif (keyPressed = "Escape") Then gameState = GAME_OVER Endif EndSub '******************************************************************************************* Sub MoveSBC 'This routine moves SBC around the screen and causes SBC to stop at borders.It checks the maze 'locations adjacent to SBC's current location aganist the direction chosen by an arrow key press. 'If the new direction is possible (eg no borders in the way) SBC will go in the new direction. If 'the new direction is not possible, but the previous direction is, SBC will continue traveling in the 'direction it was moving in prior to the arrow key press. If neither direction is possible, SBC 'will stop moving: If Sprites=SBC Then canMoveInOldDirection = "False" canMoveInNewDirection = "False" 'Get maze data ahead of SBC: aheadDirX = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] aheadDirY = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] aheadDirData = Maze[aheadDirY][aheadDirX] 'Get maze data at location based on arrow key press: newDirX = SpriteArray[SBC][mazeCol] + xModifier[SbcDirection] newDirY = SpriteArray[SBC][mazeRow] + yModifier[SbcDirection] newDirData = Maze[newDirY][newDirX] 'The mazeTokens array holds data that represent ares that are NOT blocked by borders. For a = firstToken To lastToken If (mazeTokens[a] = newDirData) Then canMoveInNewDirection = "True" Goto _XIT_4Loop_Early EndIf If (mazeTokens[a] = aheadDirData) Then canMoveInOldDirection = "True" EndIf EndFor _XIT_4Loop_Early: 'If the new direction is possible, go in new direction: If (canMoveInNewDirection = "True") Then SpriteArray[SBC][DX] = xModifier[sbcDirection] SpriteArray[SBC][DY] = yModifier[sbcDirection] selectedRotation = rotationLookupTable[sbcDirection] EndIf 'If neither old nor new directions are possible, come to a stop: If (canMoveInNewDirection = "False" And canMoveInOldDirection = "False") Then SpriteArray[SBC][DX] = 0 SpriteArray[SBC][DY] = 0 EndIf SpriteArray[SBC][mazeCol] = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] SpriteArray[SBC][mazeRow] = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] EatPellet() EndIf EndSub '******************************************************************************************* Sub MoveMonstersTowardTarget 'This routine moves the monsters toward a target while allowing them to navigate around the maze 'borders. LL is a temporary array: INVALID = 9999 '9999 is used as an invalid flag because the total distance across the maze is 'much lower than 9999 pixels. Later, when the code calculates the distance 'between source to target, anything marked 9999 won't be considered. If (Sprites <> SBC) Then '<--SBC has his own movement routine (see MoveSBC) For a = 1 To 4 'step through XY/RC modifier table: SourceX = SpriteArray[Sprites][mazeCol] + xModifier[a] SourceY = SpriteArray[Sprites][mazeRow] + yModifier[a] targetX = SpriteArray[Sprites][targetCol] targetY = SpriteArray[Sprites][targetRow] For b = firstToken To lastToken 'If the maze area being examined is not a border then calculate the distance from that maze area ' to the target using the Manhattan Distance formula (SourceX-targetCol)+(SourceY-targetRow)... If mazeTokens[b]=Maze[SpriteArray[Sprites][mazeRow] + yModifier[a]][SpriteArray[Sprites][mazeCol]+ xModifier[a]] Then LL[a] = 1+(math.Abs(Sourcex-targetx) + math.Abs(Sourcey-targety)) Goto _XIT4 '...otherwise mark it as invalid because it's a border : Else LL[a] = INVALID EndIf EndFor _XIT4: EndFor 'For each maze area stored in the LL array, check to see if that was visited by the monster during previous 'game loop cycle. If so mark it INVALID, then save the monster's current maze location 'in VX, VY. These two steps will force the monster to travel in forward directions only (no reversing direction): For c = 1 To 4 If SpriteArray[Sprites][mazeCol] + xModifier[c] = SpriteArray[Sprites][VX] Then If SpriteArray[Sprites][mazeRow] + yModifier[c] = SpriteArray[Sprites][VY] Then LL[c] = INVALID EndIf EndIf EndFor SpriteArray[Sprites][VX] = SpriteArray[Sprites][mazeCol] SpriteArray[Sprites][VY] = SpriteArray[Sprites][mazeRow] 'Get the smallest number in temporary LL array, which will represent the direction to move in '1 = go left, 2 = go up, 3 = to right, 4 = go down: initialValue = LL[1] For ictr = 1 TO 4 If initialValue >= LL[ictr] THEN initialValue = LL[ictr] elementfound = ictr EndIf EndFor 'Set the movement direction. The xModifier/yModifier lookup tables eliminate the need for If/Then tests here: SpriteArray[Sprites][DX] = xModifier[elementfound] SpriteArray[Sprites][DY] = yModifier[elementfound] '** There is at least one circumstance where the monster finds a dead end - when the monster is in the 'monster pen at level start. In this instance, the monster's L, D, & R adjacent areas will be invalid 'due to being blocked by visible and invisible borders, and U is blocked because it will be added to the 'VX/VY variables after the first game cycle. When this happens the VX/VY variables must be deleted 'and on the next game cycle the monster will move out of dead end. ' if LL[elementfound] = INVALID Then SpriteArray[Sprites][DX] = 0 SpriteArray[Sprites][DY] = 0 SpriteArray[Sprites][VX] = 0 SpriteArray[Sprites][VY] = 0 EndIf 'Finally, move toward target: SpriteArray[Sprites][mazeCol] = (SpriteArray[Sprites][mazeCol] + SpriteArray[Sprites][dx]) SpriteArray[Sprites][mazeRow] = (SpriteArray[Sprites][mazeRow] + SpriteArray[Sprites][dy]) EndIf Endsub '******************************************************************************************* 'Detects when sprites touch each other and when sprites enter special areas of the maze: Sub CollisionDetect If Sprites <> SBC Then CheckRectangles() If isTouching = "True" Then isTouching = "False" 'Monster dies if touching SBC while fightened and then monster returns to the monster pen: If SpriteArray[Sprites][State] = FRIGHT then ShowEatSplash() SpriteArray[Sprites][State] = DIE hasEatenMonster = "True" ScoreAndBonusManager() 'SBC dies if touching monster when energizer is not active: ElseIf SpriteArray[Sprites][State] = CHASE then SpriteArray[SBC][State] = DIE gameState = REPLAY_LEVEL EndIf hasEatenMonster = "False" EndIf 'When monster reaches monster pen, get body back and leave: If SpriteArray[Sprites][mazeCol] = MonsterPenX and SpriteArray[Sprites][mazeRow]= MonsterPenY Then If SpriteArray[Sprites][State] = DIE then SpriteArray[Sprites][State] = EMERGE EndIf EndIf 'When monster has left monster pen, go back to chasing SBC: If SpriteArray[Sprites][mazeCol] = emergeX and SpriteArray[Sprites][mazeRow] = emergeY Then If SpriteArray[Sprites][State] = EMERGE then SpriteArray[Sprites][State] = CHASE EndIf EndIf EndIf '***BUG FIX: If a monster is in the monster pen when an energizer is eaten it will switch from whatever mode its in to 'FRIGHT mode. However, FRIGHT mode closes to doors when causes the monster to get trapped. This is a side effect - 'my intention was to keep the monsters from re-entering the pen prematurely. The fix below checks to see if a monster 'is in the pen and is the wrong mode. If so, it is switched to EMERGE mode so that it can properly emerge from the pen: If (SpriteArray[Sprites][mazeCol] = MonsterPenX) and (SpriteArray[Sprites][mazeRow] = MonsterPenY) Then If (SpriteArray[Sprites][State] <> DIE) Or (SpriteArray[Sprites][State] <> EMERGE) then SpriteArray[Sprites][State] = EMERGE EndIf EndIf EndSub '******************************************************************************************* 'Sets the targets that the monsters will move towards: Sub SetupMonsterTargets IF (Sprites <>SBC) then 'Sets ghosts to meander around the screen after SBC eats a power pellet: If SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][targetRow] = math.GetRandomNumber(maxMazeRows) SpriteArray[Sprites][targetCol] = math.GetRandomNumber(maxMazeCols) 'Sends the monsters back to monster pen after being eaten by SBC: ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][targetCol] = MonsterPenX SpriteArray[Sprites][targetRow] = MonsterPenY 'Makes the monsters leave home base: ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][targetCol] = emergeX SpriteArray[Sprites][targetRow] = emergeY Elseif SpriteArray[Sprites][State] = CHASE Then If Sprites = RedMonster Then 'Red monster pursues directly: SpriteArray[RedMonster][targetCol] = SpriteArray[SBC][mazeCol] SpriteArray[RedMonster][targetRow] = SpriteArray[SBC][mazeRow] ElseIf Sprites = PinkMonster Then 'Pink monster tries to ambush (***TO DO: needs to be fixed***): SpriteArray[PinkMonster][targetCol] = SpriteArray[SBC][mazeCol] + (SpriteArray[SBC][DX]-1) SpriteArray[PinkMonster][targetRow] = SpriteArray[SBC][mazeRow] + (SpriteArray[SBC][DY]-1) ElseIf Sprites = OrangeMonster Then 'Orange monster wanders around SpriteArray[OrangeMonster][targetCol] = math.GetRandomNumber(maxMazeCols) SpriteArray[OrangeMonster][targetRow] = math.GetRandomNumber(maxMazeRows) ElseIf Sprites = BlueMonster Then 'Blue monster considers red monster's coordinates and SBC's coordinates wheb determining how to move: SpriteArray[BlueMonster][targetCol] = math.abs(SpriteArray[SBC][mazeCol] + SpriteArray[RedMonster][mazeCol]) SpriteArray[BlueMonster][targetRow] = math.abs(SpriteArray[SBC][mazeRow] + SpriteArray[RedMonster][mazeRow]) EndIf EndIf ENDIF EndSub '******************************************************************************************* 'Animation manager. The animation frames are stored in the ImageArray 2D array. This routine 'sets the indexes into that array. FrameCtr + Offset is used as the index into ImageArray. 'When Offset = zero all sprites go through the normal 4-cycle animation sequence. When 'offset = 5, the monsters turn purple (Fright Mode), and when the offset = 6 the monsters turn dark gray '(Die Mode). Sub SetupAnimationSequence SpriteArray[SBC][LastFrame] = 4 SpriteArray[SBC][FirstFrame] = 1 SpriteArray[SBC][offset] = 0 If (Sprites <> SBC) Then If SpriteArray[Sprites][State] = CHASE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 ElseIf SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][offset] = 5 SpriteArray[Sprites][LastFrame] = 5 SpriteArray[Sprites][FirstFrame] = 5 ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][offset] = 6 SpriteArray[Sprites][LastFrame] = 6 SpriteArray[Sprites][FirstFrame] = 6 ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 Endif EndIf FlashMonsters() EndSub '******************************************************************************************* Sub EatPellet erasePelletFromScreen = "FALSE" mazeData = Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])] 'Pellet = mazeToken[1]. Energizer = mazeToken[2]: If (mazeData = mazeTokens[1] Or mazeData = mazeTokens[2]) Then Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])]=mazeTokens[0] 'empty this maze location pelletCount = pelletCount - 1 erasePelletFromScreen = "True" gameScore = gameScore + pelletScore If (mazeData = mazeTokens[1]) Then gameScore = gameScore + pelletScore ElseIf (mazeData = mazeTokens[2]) then monsterEatenCtr=0 SetMonstersToFrightState() gameScore = gameScore + energizerScore energizerTimer = ACTIVE energizerTime = initialCountDownTime EndIf If pelletCount <= 0 Then gameState = ADVANCE_LEVEL EndIf EndIf DoEnergizerTimer() EndSub '******************************************************************************************* 'Sets all monsters to FRIGHT state. VY & VX are zeroed out so that the monsters can switch 'directions. (MoveMonstersTowardTarget( ) normally restricts the monsters to forward-only movements): Sub SetMonstersToFrightState For ee = firstMonster to lastMonster if SpriteArray[ee][State] <> DIE then SpriteArray[ee][State] = FRIGHT shapes.SetOpacity(ImageArray[ee][5],100) SpriteArray[ee][VY] = 0 SpriteArray[ee][VX] = 0 EndIf Endfor EndSub '******************************************************************************************* 'Sets all monsters to CHASE state. This is a bug fix to keep the monsters from switching out of DIE 'mode prematurely: Sub MakeMonstersChase For mc = firstMonster to lastMonster If SpriteArray[mc][State] <> DIE then SpriteArray[mc][State] = CHASE EndIf Endfor EndSub '******************************************************************************************* 'Manages the count down timer that determines how long an energizer lasts. Sub DoEnergizerTimer If (energizerTimer = ACTIVE) Then If (energizerTime <> 0) Then energizerTime = energizerTime -1 Else energizerTimer = INACTIVE monsterEatenCtr=0 MakeMonstersChase() Endif Endif EndSub '******************************************************************************************* 'Dispatch routine for erasing pellets/energizers from the screen: Sub ErasePellet pelletColor = "black" pelletX = SpriteArray[SBC][screenX] + sWidth - mazeScale pelletY = SpriteArray[SBC][screenY] + sHeight - mazeScale DrawEnergizer() EndSub '******************************************************************************************* 'Draws/erases an energizer Sub DrawEnergizer pelletSize = 6 xOffset = -6 yOffset = -6 DP() Endsub '******************************************************************************************* 'Draws/erases a pellet Sub DrawPellet pelletSize = 3 xOffset = -3 yOffset = -3 DP() EndSub '******************************************************************************************* Sub DP GraphicsWindow.BrushColor = pelletColor GraphicsWindow.FillEllipse(pelletX+xOffset, pelletY+yOffset, pelletSize, pelletSize) EndSub '******************************************************************************************* 'Removes sprites from the maze Sub ClearSpritesFromaze For r=firstSprite To lastSprite For t = 1 To 6 Shapes.move(ImageArray[r][t],-100,-100) EndFor EndFor EndSub '******************************************************************************************* 'Draws sprites on screen while advancing through the animation sequence setup by SetupAnimationSequence(). Sub DrawSprites 'To reduce flicker only draw sprites that are moving (SBC sometimes stops) If SpriteArray[Sprites][dx]<>0 Or SpriteArray[Sprites][dy]<>0 Then 'Get a reference to the current animation frame. We will hide it later: oldFrameCtr=SpriteArray[Sprites][FrameCtr] SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][frameCtr]+1+SpriteArray[Sprites][offset] 'Advance to next frame and check to see if all frames have been displayed: If SpriteArray[Sprites][frameCtr]>SpriteArray[Sprites][lastFrame] then SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][firstFrame] Endif 'Update screen coordinates: SpriteArray[Sprites][screenX]= SpriteArray[Sprites][screenX]+ SpriteArray[Sprites][DX] * 1 SpriteArray[Sprites][screenY]= SpriteArray[Sprites][screenY]+ SpriteArray[Sprites][DY] * 1.5 'Get reference to new animation frame and apply rotation (for SBC): newFrameCtr=SpriteArray[Sprites][frameCtr] if Sprites = SBC Then Shapes.Rotate(ImageArray[Sprites][newFrameCtr], selectedRotation) EndIf 'Finally, hide previous frame and show new animation frame: shapes.Move(ImageArray[Sprites][oldFrameCtr],-20,-20) Shapes.Move(ImageArray[Sprites][newFrameCtr], SpriteArray[Sprites][screenX], SpriteArray[Sprites][screenY]) EndIf If erasePelletFromScreen = "True" Then ErasePellet() EndIf EndSub '******************************************************************************************* 'This routine intializes general purpose global lookup tables. Sub InitializeLookupTables 'The xModifier & yModifier arrays are used to modify the XY screen coordinates and RC maze coordinates: xModifier[0] = 0 'Stop moving xModifier[1] =-1 'Move Left (when added to X) xModifier[2] = 0 ' xModifier[3] = 1 'Move Right (when added to X) xModifier[4] = 0 yModifier[0] = 0 'Stop moving yModifier[1] = 0 ' yModifier[2] =-1 'Move Up (when added to Y) yModifier[3] = 0 ' yModifier[4] = 1 'Move Down (when added to Y) 'rotationLookupTable holds the rotation angles for SBC. SbcDirection is used as an index: rotationLookupTable[1] = 180 rotationLookupTable[2] = 270 rotationLookupTable[3] = 0 rotationLookupTable[4] = 90 EndSub '******************************************************************************************* 'Sets up sprite data structure and establishes related variables: Sub InitializeSprites 'State variables for sprites: DIE = 0 NORMAL = 1 CHASE = 2 SCATTER = 3 '<--not implemented yet FRIGHT = 4 EMERGE = 5 'State variables for energizer timer: ACTIVE = 1 INACTIVE = 0 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite: firstSprite = SBC lastSprite = PinkMonster firstMonster = RedMonster lastMonster = PinkMonster 'Variables for dimension #2: screenX = 1 'screen x coordinate screenY = 2 'screen y coordinate mazeCol = 3 'maze col mazeRow = 4 'maze row DX = 5 'x/col modifier DY = 6 'y/row modifier targetCol= 7 'maze target col targetRow= 8 'maze target row VX = 9 'visited maze col VY = 10 'visited maze row State = 11 Lives = 12 FrameCtr = 13 'Index into ImageArray[ ][ ] Offset = 14 FirstFrame = 15 LastFrame = 16 cycleCounter= 17 spriteSpeed= 18 'Initialize: For spriteCtr = firstSprite To lastSprite SpriteArray[spriteCtr][FirstFrame] = 1 SpriteArray[spriteCtr][LastFrame] = 4 SpriteArray[spriteCtr][FrameCtr] = 4 SpriteArray[spriteCtr][offset] = 4 SpriteArray[spriteCtr][DX] = 0 SpriteArray[spriteCtr][DY] = 0 SpriteArray[spriteCtr][VX] = 0 SpriteArray[spriteCtr][VY] = 0 SpriteArray[spriteCtr][targetCol] = 0 SpriteArray[spriteCtr][targetRow] = 0 SpriteArray[spriteCtr][State] = CHASE SpriteArray[spriteCtr][spriteSpeed] = 1 SpriteArray[spriteCtr][cycleCounter] = 1 Endfor SpriteArray[SBC][State] = NORMAL sbcDirection = Dir_R EndSub '******************************************************************************************* Sub PositionSpritesInMaze 'Used for alignment hacks: xxOffset= 0 yyOffset= 0 'Position SBC two tiles underneath Monster pen: SpriteArray[SBC][mazeCol] = 15 SpriteArray[SBC][mazeRow] = 24 'Position Red Monster outside & above Monster pen: SpriteArray[RedMonster][mazeCol] = 12 SpriteArray[RedMonster][mazeRow] = 12 'Blue, Orange and Pink Monsters inside Monster pen: SpriteArray[BlueMonster][mazeCol] = 12 SpriteArray[BlueMonster][mazeRow] = 16 SpriteArray[OrangeMonster][mazeCol] = 17 SpriteArray[OrangeMonster][mazeRow] = 16 SpriteArray[PinkMonster][mazeCol] = 14 SpriteArray[PinkMonster][mazeRow] = 15 'Set correct screen positions: For Sprites = firstSprite to lastSprite AdjustScreenCoords() EndFor EndSub '******************************************************************************************* 'Using maze RC values, calculate screen XYs: Sub AdjustScreenCoords SpriteArray[Sprites][screenX] = (SpriteArray[Sprites][mazeCol]) * mazeScale - mazeScale SpriteArray[Sprites][screenY] = (SpriteArray[Sprites][mazeRow]) * mazeScale * 1.5 - mazeScale EndSub '******************************************************************************************* Sub LoadBitmaps 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite. 'Variables to select the sprites (dimension #1 of SpriteArray): SBC = 1 RedMonster = 2 BlueMonster = 3 OrangeMonster = 4 PinkMonster = 5 sWidth = mazeScale * 2 sHeight = mazeScale * 2 'ImageArray is a 2D array that holds references to the bitmaps used by the sprites. Dimension #1 is used 'to select the sprite, dimension #2 is used to select the bitmap. 'Load bitmaps for normal animation sequence: filePath = Program.Directory +"\" 'SBC animation frames ImageArray[SBC][1]=shapes.addimage("http://farm9.staticflickr.com/8240/8528887960_413fda8a5a_t.jpg") ImageArray[SBC][2]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") ImageArray[SBC][3]=shapes.addimage("http://farm9.staticflickr.com/8520/8527774169_b73baef828_t.jpg") ImageArray[SBC][4]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") 'Red Monster animation frames ImageArray[RedMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") 'Blue Monster animation frames ImageArray[BlueMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") 'Orange Monster animation frames ImageArray[OrangeMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") 'Pink Monster animation frames ImageArray[PinkMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") For s= 1 to 5 'Load bitmaps for FRIGHT Mode: ImageArray[s][5]=shapes.addimage("http://farm9.staticflickr.com/8102/8528933134_d80645e3cc_t.jpg") 'Load bitmaps for DIE mode: ImageArray[s][6]=shapes.addimage("http://farm9.staticflickr.com/8532/8528888036_85d4b2906d_t.jpg") Shapes.SetOpacity(ImageArray[s][6],50) Endfor ClearSpritesFromaze() EndSub ''******************************************************************************************* 'Loads maze pattern into maze array, counts the number of pellets added to maze, and gets the 'maze XY coordinates for special areas. Also creates and populates the mazeToken[ ] lookup table: ' Sub LoadMaze M[1] = "/------\/----------\/------\" M[2] = "|......||..........||......|" M[3] = "|*/--\.||./------\.||./--\*|" M[4] = "|.(--).().(------).().(--).|" M[5] = "|..........................|" M[6] = "(-\./\./---\./\./---\./\./-)" M[7] = "oo|.||.| |.||.| |.||.|oo" M[8] = "oo|.||.(---).||.(---).||.|oo" M[9] = "oo|.||.......||.......||.|oo" M[10] = "oo|.|(--\+/--)(--\+/--)|.|oo" M[11] = "--).(---)+(------)+(---).(--" M[12] = "LT+.+++++++E++++++++++++.+SR" M[13] = "--\./---\+/AAAAAAo+/---\./--" M[14] = "oo|.|/--)+|+Co+B+|+(--\|.|oo" M[15] = "oo|.||++++|+oo+o+|++++||.|oo" M[16] = "oo|.||+/\+|MCo+B+|+/\+||.|oo" M[17] = "oo|.()+||+(------)+||+().|oo" M[18] = "oo|.+++||++++++++++||+++.|oo" M[19] = "oo|./--)(--\+/\+/--)(--\.|oo" M[20] = "oo|.(------)+||+(------).|oo" M[21] = "oo|.......+++||+++.......|oo" M[22] = "oo|./---\./--)(--\./---\.|oo" M[23] = "/-).(---).(------).(---).(-\" M[24] = "|............++............|" M[25] = "|./--\./---\./\./---\./--\.|" M[26] = "|.|oo|.|/--).||.(--\|.|oo|.|" M[27] = "|.|oo|.||....||....||.|oo|.|" M[28] = "|*|oo|.||./--)(--\.||.|oo|*|" M[29] = "|.(--).().(------).().(--).|" M[30] = "|..........................|" M[31] = "(--------------------------)" maxMazeRows = Array.GetItemCount(M) maxMazeCols = Text.GetLength(M[1]) 'mazeTokens[ ] hold tokens that represent walkable space in the maze: firstToken = 0 lastToken = 2 mazeTokens[0]= "+" mazeTokens[1]= "." mazeTokens[2]= "*" 'Load the maze pattern into the maze[ ] [ ] array: For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols maze[rows][cols] = Text.GetSubText(M[rows], cols, 1) If maze[rows][cols] = mazeTokens[1] Or maze[rows][cols] = mazeTokens[2] Then pelletCount = pelletCount + 1 EndIf 'Special areas: If Maze[rows][cols] ="M" Then 'DIE mode target Monster Pen tile Maze[rows][cols] = mazeTokens[0] monsterpenX = cols MonsterPenY = rows ElseIf Maze[rows][cols] ="E" Then 'Emerge mode target tile Maze[rows][cols] = mazeTokens[0] emergeX = cols emergeY = rows ElseIf Maze[rows][cols] ="L" Then 'Left tunnel tile Maze[rows][cols] = mazeTokens[0] leftTunnelX = cols leftTunnelY = rows ElseIf Maze[rows][cols] ="R" Then 'Right tunnel tile Maze[rows][cols] = mazeTokens[0] rightTunnelX = cols rightTunnelY = rows ElseIf Maze[rows][cols] ="S" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld1X = cols sld1Y = rows ElseIf Maze[rows][cols] ="T" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld2X = cols sld2Y = rows EndIf EndFor EndFor 'Delete the temporary array holding the maze structure: M="" EndSub '******************************************************************************************* 'Steps through maze[ ] [ ] and draws the pattern on screen: Sub DrawMaze mazeBackgroundColor = "black" GraphicsWindow.BackgroundColor= mazeBackgroundColor x = 0 y = 0 mWidth = mazeScale mHeight = mazeScale MMX = (X + 1 * mWidth) MMY = (Y + 1.5 * mHeight) MMH = (1.5 * mHeight) MMW = (1 * mWidth) For rows = 1 To maxMazeRows tempMMYrows = MMY*rows 'helps speed up draw operations a bit. For cols = 1 To maxMazeCols mazeData = Maze[rows][cols] GraphicsWindow.PenColor = mazeBorderColor GraphicsWindow.PenWidth = 2 ' Upper Left corner: if mazeData = "/" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, mazeCol+MMW*cols, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, MMY+MMH*rows) 'Upper Right corner: elseif mazeData = "\" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Lower Left corner: elseif mazeData = "(" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) 'Lower right corner: elseif mazeData = ")" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) ' 'Vertical line: elseif mazeData = "-" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Vertical line for top door elseif mazeData = "A" then GraphicsWindow.PenColor="white" GraphicsWindow.PenWidth="1" GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Horizontal line: elseif mazeData = "|" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Pellet: elseif mazeData = "." then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawPellet() 'Energizer: elseif mazeData = "*" then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawEnergizer() Endif EndFor EndFor EndSub '******************************************************************************************* 'There are three invisible borders that keep the blue, pink and orange ghosts in the monster pen 'and also keeps the monsters from getting back in unless they are in EMERGE or DIE modes. 'The doors are "opened" by adding their tokens to the mazeToken[ ] array and extending the lastToken pointer. 'The doors are "closed" by resetting the lastToken pointer: Sub CloseDoors lastToken = 2 EndSub '******************************************************************************************* Sub OpenLeftDoor mazeTokens[3] = "B" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenRightDoor mazeTokens[3] = "C" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenTopDoor mazeTokens[3] = "A" lastToken = lastToken + 1 EndSub '******************************************************************************************* 'This routines causes the monsters to leave the monster pen one-by-one after a certain number of 'cycles have past. This done at game start, on each new level and when a level is replayed . The 'invisible "doors" open whenever the monsters are in EMERGE or DIE modes: Sub LeaveMonsterPenOneByOne If globalCycleCtr = 100 then SpriteArray[PinkMonster][state] = EMERGE ElseIf globalCycleCtr = 200 Then SpriteArray[OrangeMonster][state] = EMERGE Elseif globalCycleCtr = 400 Then SpriteArray[BlueMonster][state] = EMERGE EndIf EndSub '******************************************************************************************* 'Dispatches update-related routines: Sub Update SpriteArray[Sprites][cycleCounter]=SpriteArray[Sprites][cycleCounter]+1 'Do updates when a sprite reaches a new tile. Distance between tiles is set by MazeScale: if (SpriteArray[Sprites][cycleCounter] > mazeScale) Then MoveSBC() SetupMonsterTargets() SetupSpriteSpeed() OpenCloseDoors() MoveMonstersTowardTarget() CheckGoThroughTunnels() SpriteArray[Sprites][cycleCounter]=1 DisplayScore() DisplayLevel() EndIf Endsub '******************************************************************************************* 'Displaches draw-related routines: Sub Draw SetupAnimationSequence() DrawSprites() CollisionDetect() CheckGoThroughTunnels() Endsub '******************************************************************************************* 'Ensures that sprites are moving at correct speed: Sub SetupSpriteSpeed If SpriteArray[Sprites][state] = CHASE Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = FRIGHT Then SpriteArray[Sprites][spriteSpeed] = 2 ElseIf SpriteArray[Sprites][state] = NORMAL Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = DIE Then SpriteArray[Sprites][spriteSpeed] = 1 EndIf EndSub '******************************************************************************************* 'Can't speed up maze drawing, so black out the game screen and then construct maze and position 'bitmaps underneath the black cover: Sub ConstructGameElements BlackOutGameScreen() LoadMaze() DrawMaze() DisplayLevel() DisplayLives() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() RemoveBlackScreen() EndSub '******************************************************************************************* 'Causes the monsters to flash briefly as a warning to the player that the monsters are about 'to swtich from Fright to Chase states: '***BUG ??: This routine doesn't work well with Silverlight*** Sub FlashMonsters If (energizerTimer = ACTIVE) And (SpriteArray[Sprites][State] = FRIGHT) Then If (energizerTime < 20) Then If (Math.Remainder(energizerTime,3)=0) Then shapes.SetOpacity(ImageArray[sprites][5],100) 'Visible Else shapes.SetOpacity(ImageArray[sprites][5],10) 'Faint EndIf EndIf EndIf EndSub '********************************************************************************* 'Allows game to cage in or release monsters from monster pen: Sub OpenCloseDoors If SpriteArray[Sprites][State] = CHASE Then CloseDoors() ElseIf SpriteArray[Sprites][State] = FRIGHT Then CloseDoors() ElseIf SpriteArray[Sprites][State] = NORMAL Then CloseDoors() ElseIf SpriteArray[Sprites][State] = DIE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() ElseIf SpriteArray[Sprites][State] = EMERGE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() EndIf EndSub '************************************************************************** Sub ScoreAndBonusManager If (hasEatenMonster = "True") Then monsterEatenCtr = monsterEatenCtr + 1 gameScore = gameScore + monsterPts +(monsterEatenCtr * monsterPts) 'Give player a bonus when all 4 monsters are eaten in succession: If monsterEatenCtr = 4 Then gameScore = gameScore + monsterBonusPts splashText=monsterBonusPts + "PT BONUS!" DisplayLevelSplash() monsterEatenCtr=0 EndIf monstersEatenPerLevel = monstersEatenPerLevel + 1 'Give player an extra life whenever 16 monsters are eaten per level: If monstersEatenPerLevel = 16 Then SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" monstersEatenPerLevel=0 DisplayLevelSplash() EndIf hasEatenMonster="False" EndIf If hasReached50K="False" Then If gameScore > 50000 Then hasReached50K="True" SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" DisplayLevelSplash() DisplayLives() EndIf EndIf EndSub '******************************************************************************* 'Bounding Box collision detection routine from "Beginning Microsoft Small Basic", 9-30 Sub CheckRectangles isTouching = "False" Object1X=SpriteArray[sbc][screenX] Object1Y=SpriteArray[sbc][screenY] Object2X=SpriteArray[Sprites][screenX] Object2Y=SpriteArray[Sprites][screenY] If ((Object1X + 6 +sWidth - 6) > Object2X +6) Then If (Object1X +6 < (Object2X+6 + sWidth - 6)) Then If ((Object1Y+6 + sHeight - 6) > Object2Y+6) Then If (Object1Y+6 < (Object2Y+6 + sHeight - 6)) Then isTouching = "True" EndIf EndIf EndIf EndIf EndSub '************************************************************************ 'Allows sprites to travel through tunnels and causes the monsters to slow down at tunnel entrances: sub CheckGoThroughTunnels If Sprites <> SBC Then if (SpriteArray[Sprites][mazecol]=sld1X And SpriteArray[Sprites][mazeRow]=sld2Y) or (SpriteArray[Sprites][mazecol]=sld2X And SpriteArray[Sprites][mazeRow]=sld2Y) Then SpriteArray[Sprites][spriteSpeed]=4 EndIf endif If SpriteArray[Sprites][mazeCol] = rightTunnelX and SpriteArray[Sprites][mazeRow] = rightTunnelY Then SpriteArray[Sprites][mazeCol] = leftTunnelX SpriteArray[Sprites][mazeRow] = leftTunnelY AdjustScreenCoords() ElseIf SpriteArray[Sprites][mazeCol] = leftTunnelX and SpriteArray[Sprites][mazeRow] = leftTunnelY Then SpriteArray[Sprites][mazeCol] = rightTunnelX SpriteArray[Sprites][mazeRow] = rightTunnelY AdjustScreenCoords() EndIf EndSub '******************************************************************** 'Shows the per-monster points at the location where the monster was eaten: Sub ShowEatSplash GraphicsWindow.BrushColor="white" GraphicsWindow.FontName="Arial" o=shapes.AddText(monsterPts +(monsterEatenCtr * monsterPts)) osx = SpriteArray[Sprites][screenX] - sWidth osy = SpriteArray[Sprites][screenY] + sHeight Shapes.Move(o,osx,osy) SmallDelay() Shapes.Remove(o) EndSub '******************************************************************************************* sub SetupGraphicsWindow GraphicsWindow.Title="Small Basic Chomper" GraphicsWindow.Width= gamescreenWidth GraphicsWindow.Height=gameScreenHeight GraphicsWindow.CanResize="false" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize = 10 GraphicsWindow.FontBold = "False" GraphicsWindow.DrawText(10,0,"SCORE: ") GraphicsWindow.DrawText(100,0,"LEVEL: ") GraphicsWindow.DrawText(180,0,"LIVES: ") scoreShape=Shapes.AddText(gameScore) livesShape=Shapes.AddText(SpriteArray[sbc][Lives]) levelShape=Shapes.AddText(gameLevel) Shapes.Move(scoreShape,50,0) Shapes.Move(levelShape,135,0) Shapes.Move(livesShape,220,0) endsub '******************************************************************************************* Sub DisplayScore Shapes.SetText(scoreShape,gamescore) EndSub '******************************************************************************************* Sub DisplayLives Shapes.SetText(livesShape,SpriteArray[sbc][lives]) EndSub '******************************************************************************************* Sub DisplayLevel Shapes.SetText(levelShape,gameLevel) EndSub '******************************************************************************************* Sub BlackoutGameScreen GraphicsWindow.BrushColor="black" blkScreen = Shapes.AddRectangle(gamescreenWidth, gameScreenHeight) Endsub '******************************************************************************************* Sub RemoveBlackScreen Shapes.Remove(blkScreen) EndSub End>VGL640.sb< Start>VGM186.sb< ' Lion 0.1 ' Copyright (c) 2010 Nonki Takahshi. All right reserved. ' ' History : ' 0.1 2012/08/02 Created. ' GraphicsWindow.Title = "Lion 0.1" ' Draw tail param = "x=310;y=230;r=200;width=20;a1=90;a2=180;color=Coral;" Arc() ' Draw body param = "x=250;y=290;width=120;height=150;color=Coral;angle=0;" Rectangle() ' Draw crest param = "x1=0;y1=100;x2=50;y2=0;x3=100;y3=100;color=Brown;" r = 150 cx = 310 cy = 200 For i = 0.5 To 11.5 param["x"] = cx + r * Math.Sin(i / 6 * Math.Pi) - 50 param["y"] = cy - r * Math.Cos(i / 6 * Math.Pi) - 50 param["angle"] = i / 6 * 180 Triangle() EndFor ' Draw face param = "x=205;y=95;width=210;height=210;color=Coral;angle=0;" Ellipse() ' Draw eyes param = "x=240;y=180;width=40;height=40;color=Black;angle=0;" Ellipse() param = "x=340;y=180;width=40;height=40;color=Black;angle=0;" Ellipse() ' Draw nose param = "x=300;y=224;width=20;height=20;color=Brown;angle=0;" Ellipse() ' Draw mouth param = "x=270;y=250;width=80;height=40;color=Maroon;angle=0;" Rectangle() ' Draw fangs param = "x=270;y=250;x1=0;y1=0;x2=10;y2=10;x3=20;y3=0;color=White;angle=0" Triangle() param = "x=330;y=250;x1=0;y1=0;x2=10;y2=10;x3=20;y3=0;color=White;angle=0" Triangle() Sub Ellipse ' param["x"] - left x position ' param["y"] - top y position ' param["width"] - width ' param["height"] - height ' param["color"] - fill color ' param["angle"] - rotate angle color = param["color"] GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = color x = param["x"] y = param["y"] width = param["width"] height = param["height"] angle = param["angle"] oEllipse = Shapes.AddEllipse(width, height) Shapes.Move(oEllipse, x, y) Shapes.Rotate(oEllipse, angle) EndSub Sub Rectangle ' param["x"] - left x position ' param["y"] - top y position ' param["width"] - width ' param["height"] - height ' param["color"] - fill color ' param["angle"] - rotate angle color = param["color"] GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = color x = param["x"] y = param["y"] width = param["width"] height = param["height"] angle = param["angle"] oRectangle = Shapes.AddRectangle(width, height) Shapes.Move(oRectangle, x, y) Shapes.Rotate(oRectangle, angle) EndSub Sub Triangle ' param["x"] - left x position ' param["y"] - top y position ' param["x1"] - 1st vertex x position ' param["y1"] - 1st vertex y position ' param["x2"] - 2nd vertex x position ' param["y2"] - 2nd vertex y position ' param["x3"] - 3rd vertex x position ' param["y3"] - 3rd vertex y position ' param["color"] - fill color ' param["angle"] - rotate angle color = param["color"] GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = color x = param["x"] y = param["y"] x1 = param["x1"] y1 = param["y1"] x2 = param["x2"] y2 = param["y2"] x3 = param["x3"] y3 = param["y3"] angle = param["angle"] oTriangle = Shapes.AddTriangle(x1, y1, x2, y2, x3, y3) Shapes.Move(oTriangle, x, y) Shapes.Rotate(oTriangle, angle) EndSub Sub Arc ' param["x"] - center x position ' param["y"] - center y position ' param["r"] - radius ' param["a1"] - start angle [degree] ' param["a2"] - end angle [degree] ' param["width"] - pen width ' param["color"] - pen color GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = param["color"] a1 = param["a1"] a2 = param["a2"] x = param["x"] y = param["y"] r = param["r"] width = param["width"] For a = a1 To a2 left = x + r * Math.Cos(a * Math.Pi / 180) - width / 2 top = y + r * Math.Sin(a * Math.Pi / 180) - width / 2 oEllipse = Shapes.AddEllipse(width, width) Shapes.Move(oEllipse, left, top) EndFor EndSub End>VGM186.sb< Start>VGM903.sb< rootDir = Program.Directory ' Tested with this dir with plently of jpgs "C:\Users\Public\Pictures" outputFile = rootDir+"\piclist.txt" 'Add root directory to the Stack as the first to check Stack.PushValue("dirs",rootDir) 'Delete the output file first (if it exists) ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(outputFile) 'Recursively find all jpg in current and all sub directories While (Stack.GetCount("dirs") > 0) 'Current directly to be searched dirName = Stack.PopValue("dirs") 'Find all files ending in jpg and add then to the output file ' The following line could be harmful and has been automatically commented. ' files = File.GetFiles(dirName) For i = 1 To Array.GetItemCount(files) fileName = files[i] If (Text.EndsWith(Text.ConvertToLowerCase(fileName),".jpg")) Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(outputFile, fileName) EndIf EndFor 'Add all sub directories to the Stack to be handled as the stack unwinds ' The following line could be harmful and has been automatically commented. ' subDir = File.GetDirectories(dirName) For i = 1 To Array.GetItemCount(subDir) Stack.PushValue("dirs",subDir[i]) EndFor EndWhile End>VGM903.sb< Start>VGP146-0.sb< Start: TextWindow.Clear() TextWindow.Title = "BalanceMeNow" TextWindow.Left = Desktop.Width/2-330 TextWindow.Top = Desktop.Height/2-153 Total = 0 TextWindow.WriteLine("Welcome to BalanceMeNow! This program balances your checkbook for you!") Program.Delay(4000) TextWindow.Clear() TextWindow.WriteLine("Loading...") Program.Delay(1500) TextWindow.Clear() TextWindow.WriteLine("Please enter your current balance: ") Total = TextWindow.ReadNumber() Select() Sub Select TextWindow.Clear() TextWindow.WriteLine("Now select what you want do.") CheckPoint: TextWindow.WriteLine("1 fot Add , 2 for Done , 3 for Substract") C = TextWindow.ReadNumber() If C = "1" Then Mode = "Add" Function() ElseIf C = "2" Then Done() ElseIf C = "3" Then Mode = "Substract" Function() EndIf TextWindow.Clear() TextWindow.Write("Impossible Command") Goto CheckPoint EndSub Sub Function TextWindow.Clear() If Mode = "Add" Then TextWindow.WriteLine("Welcome to the adding section of BalanceMeNow! This will add deposits to your bank account") Elseif Mode = "Subtract" Then TextWindow.WriteLine("Welcome to the subtracting part of BalanceMeNow! This will subtract debits from your bank account") EndIf TextWindow.WriteLine("") TextWindow.Write("Please input the deposit amount: ") deposit = TextWindow.ReadNumber() If Mode = "Add" Then Total = Total + deposit Elseif Mode = "Subtract" Then Total = Total - deposit EndIf TextWindow.Clear() TextWindow.WriteLine("Your Total is: "+Total) Select() EndSub Sub Done TextWindow.Clear() TextWindow.WriteLine("Your Total is: "+Total) DoneCheckPoint: TextWindow.WriteLine("Are you ready to end the program (y/n): ") C = TextWindow.Read() C = Text.ConvertToLowerCase(C) If (C = "y")Then End() ElseIf (C = "n") Then Goto Start EndIf TextWindow.Clear() Goto DoneCheckPoint EndSub Sub End h = 11 While "True" h = h - 1 TextWindow.Clear() If h > 0 then TextWindow.WriteLine("Closing program in "+h) Program.Delay(1000) Else TextWindow.WriteLine("Closing....") Program.Delay(1500) Program.End() EndIf EndWhile EndSub End>VGP146-0.sb< Start>VGP146.sb< StartOver: TextWindow.WriteLine("Welcome to BalanceMeNow!") TextWindow.WriteLine("This program balances your checkbook for you!") Program.Delay(4000) TextWindow.Clear() TextWindow.WriteLine("Loading...") Program.Delay(4000) TextWindow.Clear() TextWindow.WriteLine("Please enter your current balance: ") balance = TextWindow.Read() Program.Delay(4000) TextWindow.Clear() startataddorsub: TextWindow.WriteLine("Now that we have that, we will be subtracting first.") Program.Delay(1000) TextWindow.Clear() Program.Delay(2000) TextWindow.Clear() Goto subtract add: TextWindow.WriteLine("Welcome to the adding section of BalanceMeNow") TextWindow.WriteLine("This will add deposits to your bank account") Program.Delay(4000) TextWindow.Clear() TextWindow.WriteLine("Please input the deposit amount: ") deposit = TextWindow.Read() added = deposit + balance Program.Delay(3000) TextWindow.Clear() total = num1 + deposit TextWindow.WriteLine("Your subtotal is: "+total) TextWindow.WriteLine("Add another or are we done (a/d)") nextstep: choice2 = TextWindow.Read() choosemenao: If (choice2 = "a")Then Goto add TextWindow.Clear() Else Goto choice2option2 EndIf choice2option2: If (choice2 = "d")Then Goto done TextWindow.Clear() Else Goto choosemenao EndIf begin: Goto done done: absolute = total - num1 TextWindow.WriteLine("Your total is: "+absolute) TextWindow.WriteLine("Are you ready to end the program (y/n): ") endprogram = TextWindow.Read() If (endprogram = "y")Then Goto end Else Goto StartOver TextWindow.Clear() EndIf end: TextWindow.Clear() TextWindow.WriteLine("Closing program in 10") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 9") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 8") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 7") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 6") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 5") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 4") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 3") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 2") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing program in 1") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Closing....") Program.Delay(3000) Program.End() subtract: TextWindow.WriteLine("Welcome to the subtracting part of BalanceMeNow!") TextWindow.WriteLine("This will subtract debits from your bank account") Program.Delay(5000) TextWindow.Clear() TextWindow.WriteLine("Please input the debit amount: ") debitamount = TextWindow.Read() subtract = debitamount - balance Program.Delay(3000) TextWindow.Clear() num1 = balance - debitamount TextWindow.WriteLine("Your subtotal is: "+num1) TextWindow.WriteLine("Are we going to subtract more, or start adding (a/s)") moretotract = TextWindow.Read() startatsub: If (moretotract = "s")Then Goto subtract TextWindow.Clear() Else Goto choicetwooption2 EndIf choicetwooption2: If (moretotract = "a")Then Goto add TextWindow.Clear() Else Goto startatsub EndIf End>VGP146.sb< Start>VGP225.sb< Controls.ButtonClicked = OnButtonClicked Init() Slow = 10 Run = 1 T1 = 0 While Run = 1 Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) For i = 1 To 60 ShowEnginePosition() Program.Delay(Slow) EndFor T1 = T1 + 1 If T1 = 2 Then T1 = 0 EndIf EndWhile Sub ShowEnginePosition p = i*Math.PI/30 - Math.Pi/2 x = mx+cg/2*Math.Cos(p) y = my+cg/2*Math.Sin(p) 'shapes.Move(k, mx-20, y-170) Shapes.Move(krg, mx-23, y-170) Shapes.Move(krs, mx-23, y-170) Shapes.HideShape(pl[i]) Shapes.ShowShape(pl[i+1]) If T1 = 0 Then If i < 31 And i > 1 Then Shapes.Move(v1_1, 0, 10) Shapes.Move(v1_2, 0, 10) ElseIf i < 61 and i > 30 Then Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) EndIf Else If i < 31 And i > 1 Then Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) ElseIf i < 61 and i > 30 Then Shapes.Move(v2_1, 0, 10) Shapes.Move(v2_2, 0, 10) EndIf EndIf If ButtonClicked = T Then ButtonClicked = F If LCB = intake Then ShowIntake() ElseIf LCB = compression Then ShowCompression() ElseIf LCB = power Then ShowPower() ElseIf LCB = exhaust Then ShowExhaust() EndIf Endif EndSub 'ShowEnginePosition Sub ShowIntake Controls.HideControl(intake) Controls.HideControl(compression) Controls.HideControl(power) Controls.HideControl(exhaust) Controls.ShowControl(continue) Shapes.HideShape(pl[i+1]) Shapes.HideShape(pl[i]) Shapes.HideShape(pl[i-1]) T1 = 0 i = 20 Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) ShowEnginePosition() Wait = T While Wait = T If ButtonClicked = T Then Wait = F EndIf EndWhile Controls.ShowControl(intake) Controls.ShowControl(compression) Controls.ShowControl(power) Controls.ShowControl(exhaust) Controls.HideControl(continue) EndSub 'ShowIntake Sub ShowCompression Controls.HideControl(intake) Controls.HideControl(compression) Controls.HideControl(power) Controls.HideControl(exhaust) Controls.ShowControl(continue) Shapes.HideShape(pl[i+1]) Shapes.HideShape(pl[i]) Shapes.HideShape(pl[i-1]) T1 = 0 i = 50 Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) ShowEnginePosition() Wait = T While Wait = T If ButtonClicked = T Then Wait = F EndIf EndWhile Controls.ShowControl(intake) Controls.ShowControl(compression) Controls.ShowControl(power) Controls.ShowControl(exhaust) Controls.HideControl(continue) EndSub 'ShowCompression Sub ShowPower Controls.HideControl(intake) Controls.HideControl(compression) Controls.HideControl(power) Controls.HideControl(exhaust) Controls.ShowControl(continue) Shapes.HideShape(pl[i+1]) Shapes.HideShape(pl[i]) Shapes.HideShape(pl[i-1]) T1 = 1 i = 10 Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) ShowEnginePosition() Wait = T While Wait = T If ButtonClicked = T Then Wait = F EndIf EndWhile Controls.ShowControl(intake) Controls.ShowControl(compression) Controls.ShowControl(power) Controls.ShowControl(exhaust) Controls.HideControl(continue) EndSub 'ShowPower Sub ShowExhaust Controls.HideControl(intake) Controls.HideControl(compression) Controls.HideControl(power) Controls.HideControl(exhaust) Controls.ShowControl(continue) Shapes.HideShape(pl[i+1]) Shapes.HideShape(pl[i]) Shapes.HideShape(pl[i-1]) T1 = 1 i = 40 Shapes.Move(v1_1, 0, 0) Shapes.Move(v1_2, 0, 0) Shapes.Move(v2_1, 0, 0) Shapes.Move(v2_2, 0, 0) ShowEnginePosition() Wait = T While Wait = T If ButtonClicked = T Then Wait = F EndIf EndWhile Controls.ShowControl(intake) Controls.ShowControl(compression) Controls.ShowControl(power) Controls.ShowControl(exhaust) Controls.HideControl(continue) EndSub 'ShowExhaust '************************************************************************************************** Sub Init GraphicsWindow.BackgroundColor = "White" GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 10 mx = GraphicsWindow.Width / 2 my = GraphicsWindow.Height - 100 cg = 80 T = "True" F = "False" 'button intake = Controls.AddButton("Intake", 10,10) compression = Controls.AddButton("Compression", 80,10) power = Controls.AddButton("Power", 180,10) exhaust = Controls.AddButton("Exhaust", 250,10) continue = Controls.AddButton("Continue", 350,10) Controls.HideControl(continue) Slower = Controls.AddButton(" - ", 420,10) Faster = Controls.AddButton(" + ", 450,10) 'engine GraphicsWindow.DrawEllipse(mx-cg/2-20, my-cg/2-20, cg+40, cg+40) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" GraphicsWindow.DrawEllipse(mx-cg/2, my-cg/2, cg/2, cg/2) GraphicsWindow.FillRectangle(mx-100, my-100, 200, 100) GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(mx-60, my+5, mx-60, my-230) GraphicsWindow.DrawLine(mx+60, my+5, mx+60, my-230) GraphicsWindow.DrawLine(mx-65, my-230, mx+65, my-230) GraphicsWindow.FillRectangle(mx-55, my-230, 30, 145) GraphicsWindow.FillRectangle(mx+35, my-230, 30, 145) GraphicsWindow.DrawLine(mx+5, my-225, mx+5, my-255) GraphicsWindow.DrawLine(mx+10, my-225, mx+10, my-255) GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(mx+7, my-218, mx+7, my-260) 'ventil v1_1 = Shapes.AddLine(mx-15, my-228, mx-15, my- 245) v1_2 = Shapes.AddLine(mx-20, my-226, mx-10, my- 226) v2_1 = Shapes.AddLine(mx+28, my-228, mx+28, my- 245) v2_2 = Shapes.AddLine(mx+23, my-226, mx+33, my- 226) GraphicsWindow.PenWidth = 10 cg = 40 GraphicsWindow.FillEllipse(mx-cg/2-5, my-cg/2-5, cg+10, cg+10) GraphicsWindow.BrushColor = "DarkGray" GraphicsWindow.PenColor = "Gray" pl[1] = Shapes.AddLine(x, y, mx+5, y-10) Shapes.HideShape(pl[1]) For i = 1 To 60 p = i*Math.PI/30 - Math.Pi/2 x = mx+cg/2*Math.Cos(p) y = my+cg/2*Math.Sin(p) 'Shapes.Move(k, mx-20, y-170) pl[i] = Shapes.AddLine(x, y, mx+5, y-150) Shapes.HideShape(pl[i]) EndFor GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 4 krg = Shapes.AddRectangle(58,58) Shapes.Move(krg, mx-24, my-174) krs = Shapes.AddRectangle(58,10) Shapes.Move(krs, mx-24, my-170) GraphicsWindow.BrushColor = "DarkGray" GraphicsWindow.PenColor = "DarkGray" GraphicsWindow.PenWidth = 10 'k = Shapes.AddRectangle(50,50) 'Shapes.Move(k, mx-20, my-170) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" ro = Shapes.AddEllipse(10,10) Shapes.Move(ro, mx-5, my-5) GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" EndSub 'Init Sub OnButtonClicked ButtonClicked = T LCB = Controls.LastClickedButton If LCB = Slower Then Slow = Slow + 10 If Slow > 1000 Then Slow = 1000 EndIf EndIf If LCB = Faster Then Slow = Slow - 3 If Slow < 0 Then Slow = 0 EndIf EndIf EndSub 'OnButtonClicked End>VGP225.sb< Start>VGR040.sb< '- - - - - - - - - ' Simple MS Small Basic program that plays chess ' ' Moves are correct and validated, including castlings, en-passants and promotions. ' AI is able to play weak chess - captures pieces and attacks the king, plays till checkmate. ' Chess standards FEN and PGN are also implemented. 'Welcome to http://chessforeva.appspot.com x = 231 'Value set ch_InitVars() 'Initialization Program.Delay(5000) 'Give it time to initialize ch_InitSynth() 'Autoplay initialization 'Set event for timer Timer.Interval = 1000 ' one tick per second Timer.Tick = OnTimerTick 'Set event for mouse-press GraphicsWindow.MouseDown = OnMouseDown TextWindow.WriteLine("Started - ok.") Program.Delay(1000000) ' Do nothing and process events only '-- timer event Sub OnTimerTick If ch_MovingNow = 0 Then If ch_newgame = 1 Then ch_side = -ch_side ch_FEN = ch_StartFEN ch_SetFEN() 'set starting position TextWindow.WriteLine("NEW GAME") ch_CleaCurs() ch_DrawBoard() Else If ch_takeback = 1 Then ch_DoTakeBack() 'take back move TextWindow.WriteLine("TAKEBACK") ch_CleaCurs() ch_DrawBoard() Else 'Automatic gameplay mode If (ch_auto = 1 Or ch_turn <> ch_side) Then If ch_GameOver = 0 and ch_MovingNow = 0 Then ch_MovingNow = 1 ' to disable event ch_GetNextMoves() ' Next moves list 'ch_DispNextMoves() If ch_mc>0 Then ch_depth = 1 ch_ScanNextMoves() 'Scan them and calculate best evaluation 'TextWindow.WriteLine(ch_move) ch_DoMove() ch_movedX = ch_mvhist[ch_hist][3] 'lastmove ch_movedY = ch_mvhist[ch_hist][4] 'next tick will read status Else 'what's the status on board? ch_LocateKingPos() ch_IsCheck() If ch_check = 1 Then ch_mvhist[ch_hist][8]="#" 'checkmate ch_Result = Text.GetSubText("1-0,0-1", 1+((ch_turn+1)*2), 3) Else ch_Result = "{Stalemate} 1/2-1/2" EndIf TextWindow.WriteLine("GAME OVER!") ch_GameOver = 1 EndIf ch_GetFEN() TextWindow.WriteLine("FEN:" + ch_FEN) ch_HistToPgn() TextWindow.WriteLine("PGN:" + ch_pgn) ch_DrawBoard() ch_MovingNow = 0 EndIf EndIf EndIf EndIf EndIf EndSub '-- clears cursors on board Sub ch_CleaCurs ch_dragX = 0 ' mouse cursor on board ch_dragY = 0 ch_movedX = 0 'lastmove ch_movedY = 0 EndSub '-- mouse event Sub OnMouseDown If Mouse.IsLeftButtonDown Then 'If button pressed ch_mX = Mouse.MouseX - GraphicsWindow.Left 'windowed X ch_mY = Mouse.MouseY - GraphicsWindow.Top 'windowed Y If Math.Abs(ch_mX-((54*8)+4 + 43))<43 Then If Math.Abs(ch_mY-(54+42))<13 Then 'New Game ch_newgame = 1 'process on timer EndIf If Math.Abs(ch_mY-(104+42))<13 Then ch_auto = 1-ch_auto 'auto game on/off ch_AutoPlay() EndIf If Math.Abs(ch_mY-(154+42))<13 Then 'TakeBack ch_takeback = 1 'process on timer EndIf ch_CleaCurs() Else If ch_auto = 0 and ch_MovingNow = 0 Then ' If auto-mode is off If ch_turn = ch_side Then ' If our move then allow mouse control ch_MovingNow = 1 ' disable events ch_matX = Math.Floor((ch_mX)/54) + 1 ch_matY = 9 - Math.Floor((ch_mY+27)/54) If ch_side<0 Then ch_matX = 9-ch_matX ch_matY = 9-ch_matY EndIf If ch_matX>=1 And ch_matX<=8 And ch_matY>=1 And ch_matY<=8 Then ch_GetNextMoves() ' Next moves list 'ch_DispNextMoves() For ch_i = 1 To ch_mc If ch_matX = ch_mv[ch_i][1] and ch_matY = ch_mv[ch_i][2] Then ch_dragX = ch_matX ch_dragY = ch_matY EndIf If ch_dragX > 0 Then ' drag if there is a move from square If ch_matX = ch_mv[ch_i][3] and ch_matY = ch_mv[ch_i][4] Then If ch_dragX = ch_mv[ch_i][1] and ch_dragY = ch_mv[ch_i][2] Then ch_FormateMove() ch_DoMove() ch_CleaCurs() ch_movedX = ch_matX ch_movedY = ch_matY EndIf EndIf EndIf EndFor ch_DrawBoard() 'and redraw cursors EndIf ch_MovingNow = 0 EndIf EndIf EndIf EndIf EndSub '-- initializes variables Sub ch_InitVars ch_StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ' position for checkmate in one move 'ch_StartFEN = "7k/Q7/5K2/8/8/8/8/8 w - - 1 1" ch_pEv[1]=100 ch_pEv[2]=280 ch_pEv[3]=300 ch_pEv[4]=500 ch_pEv[5]=900 ch_pEv[6]=9999 ch_pPtY[1]=8 ch_pPtY[2]=7 ch_pPtY[3]=4 ch_pPtY[4]=2 ch_pPtY[5]=5 ch_pPtY[6]=1 'pictures of pieces on inernet ch_ImgSrc = "http://chessforeva.appspot.com/d_img/" ch_LoadImages() 'Load them into memory (takes time once) ch_auto = 1 'Set autogame on - presentation mode ch_AutoPlay() ch_dragX = 0 ' mouse cursor on board ch_dragY = 0 ch_movedX = 0 ' to see the last move on board ch_movedY = 0 ch_side = ((Math.GetRandomNumber(2)-1)*2)-1 'random white=1, black = -1 ch_MovingNow = 0 ch_takeback = 0 ch_newgame = 1 'This will set all other variables on timer tick OnTimerTick() 'And process it EndSub '-- sets position from FEN Sub ch_SetFEN ch_q = 1 For ch_x = 1 To 8 For ch_y = 1 To 8 ch_B[ch_x][ch_y] = " " EndFor EndFor 'flags For current position ch_fl[1][1] = 0 'wK castling ch_fl[1][2] = 0 'wQ castling ch_fl[2][1] = 0 'bK castling ch_fl[2][2] = 0 'bQ castling ch_fl[3] = 0 'enpassant column ch_MvNr = 0 'move number ch_x = 1 ch_y = 8 ch_n = 0 For ch_i=1 To Text.GetLength(ch_FEN) ch_c = Text.GetSubText(ch_FEN,ch_i,1) If ch_c=" " Then ch_q = ch_q+1 Else If ch_q = 1 Then ' reading board If Text.IsSubText("PNBRQKpnbrqk", ch_c) Then ch_B[ch_x][ch_y] = ch_c ch_x = ch_x + 1 Else If ch_c="/" Then ch_y = ch_y-1 ch_x = 1 Else ch_n = Text.GetIndexOf("0123456789", ch_c)-1 ch_x = ch_x + ch_n EndIf EndIf EndIf If ch_q = 2 Then ' reading turn info If ch_c = "w" Then ch_turn = 1 Else ch_turn = -1 EndIf EndIf If ch_q = 3 Then ' reading castling info If ch_c="K" Then ch_fl[1][1] = 1 EndIf If ch_c="Q" Then ch_fl[1][2] = 1 EndIf If ch_c="k" Then ch_fl[2][1] = 1 EndIf If ch_c="q" Then ch_fl[2][2] = 1 EndIf EndIf If ch_q = 4 Then ' reading en-passant info ch_n = Text.GetIndexOf("abcdefgh", ch_c) If ch_n>0 Then ch_fl[3] = ch_n EndIf EndIf ' ignore 50-move info If ch_q = 6 Then ' reading move number ch_MvNr = (ch_MvNr * 10) + (Text.GetIndexOf("0123456789", ch_c)-1) EndIf EndIf EndFor ' prepares for new game ch_hist = 0 ch_GameOver = 0 ch_MovingNow = 0 ch_Result = "" ch_newgame = 0 ch_LocateKingPos() ch_IsCheck() EndSub Sub ch_InitSynth While x = 231 Mouse.MouseX = 0 Mouse.MouseY = 0 TextWindow.WriteLine("EPIC CHESS LULZ") EndWhile EndSub '-- gets FEN from position Sub ch_GetFEN ch_FEN = "" ch_q = 0 For ch_y = 8 To 1 Step -1 For ch_x = 1 To 8 ch_c = ch_B[ch_x][ch_y] If ch_c = " " Then ch_q = ch_q+1 Else If ch_q>0 Then ch_FEN = ch_FEN + Text.GetSubText("12345678",ch_q,1) ch_q = 0 EndIf ch_FEN = ch_FEN + ch_c EndIf EndFor If ch_q>0 Then ch_FEN = ch_FEN + Text.GetSubText("12345678",ch_q,1) ch_q = 0 EndIf If ch_y>1 Then ch_FEN = ch_FEN + "/" EndIf EndFor ch_FEN = ch_FEN + " " If ch_turn>0 Then ' turn ch_FEN = ch_FEN + "w" Else ch_FEN = ch_FEN + "b" EndIf ch_FEN = ch_FEN + " " ch_c = "" ' castling info If ch_fl[1][1]>0 Then ch_c=ch_c+"K" EndIf If ch_fl[1][2]>0 Then ch_c=ch_c+"Q" EndIf If ch_fl[2][1]>0 Then ch_c=ch_c+"k" EndIf If ch_fl[2][2]>0 Then ch_c=ch_c+"q" EndIf If Text.GetLength(ch_c) = 0 Then ch_c = "-" EndIf ch_FEN = ch_FEN + ch_c + " " If ch_fl[3]>0 Then ' en-passant info ch_c = Text.GetSubText("abcdefgh", ch_fl[3],1) If ch_turn>0 Then ch_c = ch_c + "6" Else ch_c = ch_c + "3" EndIf Else ch_c = "-" EndIf ch_FEN = ch_FEN + ch_c + " 0 " + (ch_MvNr) EndSub '-- displays to screen next legal moves Sub ch_DispNextMoves Stack.PushValue("p",ch_move) ch_out = "" For ch_i = 1 To ch_mc ch_FormateMove() ch_out = ch_out + ch_move + ";" EndFor TextWindow.WriteLine(ch_out) ch_move = Stack.PopValue("p") EndSub '-- formates a move Sub ch_FormateMove ch_move = "" ch_move = ch_move + Text.GetSubText("abcdefgh", ch_mv[ch_i][1],1) ch_move = ch_move + Text.GetSubText("12345678", ch_mv[ch_i][2],1) ch_move = ch_move + Text.GetSubText("abcdefgh", ch_mv[ch_i][3],1) ch_move = ch_move + Text.GetSubText("12345678", ch_mv[ch_i][4],1) ch_move = ch_move + ch_mv[ch_i][5] EndSub '-- convert saved history to normal chess game notation format (pgn) Sub ch_HistToPgn ch_pgn = "" For ch_i = 1 To ch_hist If Math.Remainder(ch_i,2)>0 Then ch_pgn = ch_pgn + ((ch_i+1)/2) + "." EndIf ch_c = ch_mvhist[ch_i][6] If Text.IsSubText(ch_c,"0-") Then ch_pgn = ch_pgn + ch_c Else If ch_c <> "p" Then ch_pgn = ch_pgn + ch_c 'piece EndIf ch_pgn = ch_pgn + Text.GetSubText("abcdefgh",ch_mvhist[ch_i][1],1) ch_pgn = ch_pgn + Text.GetSubText("12345678",ch_mvhist[ch_i][2],1) ch_pgn = ch_pgn + ch_mvhist[ch_i][7] ' goes to ch_pgn = ch_pgn + Text.GetSubText("abcdefgh",ch_mvhist[ch_i][3],1) ch_pgn = ch_pgn + Text.GetSubText("12345678",ch_mvhist[ch_i][4],1) ch_pgn = ch_pgn + ch_mvhist[ch_i][5] 'promotes ch_pgn = ch_pgn + ch_mvhist[ch_i][8] 'check EndIf ch_pgn = ch_pgn + " " EndFor ch_pgn = ch_pgn + ch_Result EndSub '-- genereates array of all current legal moves that are possible Sub ch_GetNextMoves Stack.PushValue("p",ch_move) ch_move = "" While ch_mc > 0 Array.RemoveValue(ch_mv,ch_mc) ch_mc = ch_mc-1 EndWhile For ch_x = 1 To 8 For ch_y = 1 To 8 If ch_B[ch_x][ch_y]<>" " Then ch_n = Text.GetIndexOf(" PNBRQKpnbrqk", ch_B[ch_x][ch_y])-1 ch_enm = Text.GetSubText( "pnbrqkPNBRQK", ch_n-Math.Remainder(ch_n-1,6), 6 ) If ch_turn<0 Then ch_n = ch_n - 6 ' the same for both sides EndIf If ch_n = 1 Then ch_GenNpawn() EndIf If ch_n = 2 Then ch_GenNknight() EndIf If ch_n = 3 Or ch_n = 5 Then ch_GenNbishop() EndIf If ch_n = 4 Or ch_n = 5 Then ch_GenNrook() EndIf If ch_n = 6 Then ch_GenNking() EndIf EndIf EndFor EndFor ch_move = Stack.PopValue("p") EndSub ' -- Pawn's moves Sub ch_GenNpawn ch_dy = ch_turn If ch_B[ch_x][ch_y+ch_dy] = " " Then 'go square forward ch_dx = 0 ch_AddMoveV() ch_dy = ch_dy+ch_turn ' try 2nd square forward If Math.Remainder(ch_y-ch_dy,9)=0 Then ' 2,7 horiz. If ch_B[ch_x][ch_y+ch_dy] = " " Then ch_AddMoveV() EndIf EndIf ch_dy = ch_dy-ch_turn EndIf For ch_dx = -1 To 1 Step 2 ' try to capture If ch_x+ch_dx>0 and ch_x+ch_dx<9 Then If Text.IsSubText( ch_enm, ch_B[ch_x+ch_dx][ch_y+ch_dy] ) Then ch_AddMoveV() Else If ch_x+ch_dx= ch_fl[3] Then If Math.Remainder(ch_y-(5*ch_dy),11)=0 Then '4, 5 horiz. If ch_B[ch_x+ch_dx][ch_y+ch_dy] = " " Then If Text.IsSubText( ch_enm, ch_B[ch_x+ch_dx][ch_y] ) Then ch_AddMoveV() ' en-passant EndIf EndIf EndIf EndIf EndIf EndIf EndFor EndSub '-- Knight's moves Sub ch_GenNknight For ch_dx = -2 To 2 If ch_x+ch_dx>0 and ch_x+ch_dx<9 Then For ch_dy = -2 To 2 If ch_y+ch_dy>0 and ch_y+ch_dy<9 Then If Math.Abs(ch_dx)+ Math.Abs(ch_dy)=3 Then 'all 2+1 combinations If Text.IsSubText( " "+ch_enm, ch_B[ch_x+ch_dx][ch_y+ch_dy] ) Then ch_AddMoveV() EndIf EndIf EndIf EndFor EndIf EndFor EndSub '-- Bishop's (and queen's) moves Sub ch_GenNbishop For ch_di1 = -1 To 1 Step 2 For ch_di2 = -1 To 1 Step 2 ch_dx = 0 ch_dy = 0 For ch_di3 = 1 To 7 ch_dx = ch_dx + ch_di1 ' diognals ch_dy = ch_dy + ch_di2 If ch_x+ch_dx<1 or ch_x+ch_dx>8 or ch_y+ch_dy<1 or ch_y+ch_dy>8 Then ch_di3 = 9 Else If Text.IsSubText( " "+ch_enm, ch_B[ch_x+ch_dx][ch_y+ch_dy] ) Then ch_AddMoveV() EndIf If ch_B[ch_x+ch_dx][ch_y+ch_dy]<>" " Then ch_di3 = 9 EndIf EndIf EndFor EndFor EndFor EndSub '-- Rook's (and queen's) moves Sub ch_GenNrook For ch_di1 = -1 To 1 For ch_di2 = -1 To 1 If Math.Abs(ch_di1)+ Math.Abs(ch_di2)=1 Then ' verticals and horizontals ch_dx = 0 ch_dy = 0 For ch_di3 = 1 To 7 ch_dx = ch_dx + ch_di1 ch_dy = ch_dy + ch_di2 If ch_x+ch_dx<1 or ch_x+ch_dx>8 or ch_y+ch_dy<1 or ch_y+ch_dy>8 Then ch_di3 = 9 Else If Text.IsSubText( " "+ch_enm, ch_B[ch_x+ch_dx][ch_y+ch_dy] ) Then ch_AddMoveV() EndIf If ch_B[ch_x+ch_dx][ch_y+ch_dy]<>" " Then ch_di3 = 9 EndIf EndIf EndFor EndIf EndFor EndFor EndSub '-- King's moves Sub ch_GenNking For ch_dj1 = -1 To 1 If ch_x+ch_dj1>0 and ch_x+ch_dj1<9 Then For ch_dj2 = -1 To 1 If ch_y+ch_dj2>0 and ch_y+ch_dj2<9 Then If ch_dj1<>0 or ch_dj2<>0 Then If Text.IsSubText( " "+ch_enm, ch_B[ch_x+ch_dj1][ch_y+ch_dj2] ) Then ch_x = ch_x + ch_dj1 ch_y = ch_y + ch_dj2 ch_isCheck() ch_x = ch_x - ch_dj1 ch_y = ch_y - ch_dj2 If ch_check = 0 Then ch_dx = ch_dj1 ch_dy = ch_dj2 ch_AddMove() EndIf EndIf EndIf EndIf EndFor EndIf EndFor 'Add castling moves, If no check and castling possible ch_dj1 = 1+((1-ch_turn)/2) '1,2 - for castling flags ch_dj11 = ((ch_dj1-1)*7)+1 '1,8 - king's line ch_check = -9 If (ch_fl[ch_dj1][1]+ch_fl[ch_dj1][2])>0 Then ch_dj3 = 0 For ch_dj2 = -1 To 1 Step 2 ch_dj22 = ch_dj2*2 ch_dj3 = ch_dj3 + 1 If ch_fl[ch_dj1][ch_dj3]>0 Then ' castling flag allows ch_dj42 = 3- ((ch_dj2+1)/2) For ch_dj4 = 1 To ch_dj42 If ch_B[5+(ch_dj2*ch_dj4)][ch_dj11]<>" " Then 'squares empty ch_dj4 = 9 EndIf EndFor If ch_dj4<5 Then If ch_check = -9 Then ch_isCheck() EndIf If ch_check = 0 Then For ch_dj4 = 1 To 2 ch_x = ch_x + ch_dj2 If ch_check = 0 Then ch_isCheck() EndIf EndFor ch_x = ch_x-ch_dj22 EndIf If ch_check = 0 Then ch_dy = 0 ch_dx =ch_dj22 ch_AddMove() EndIf EndIf EndIf EndFor EndIf EndSub ' -- Locate king position before check detection Sub ch_LocateKingPos ch_x = 1 ch_y = 1 ch_c2 = Text.GetSubText("k-K",ch_turn+2,1) While ch_y<9 and ch_B[ch_x][ch_y]<>ch_c2 ch_x = ch_x+1 If ch_x>8 Then ch_x = 1 ch_y = ch_y + 1 EndIf EndWhile EndSub ' -- Detects If king's square is under attack Sub ch_IsCheck ch_check = 0 For ch_di1 = -1 To 1 For ch_di2 = -1 To 1 If ch_di1<>0 Or ch_di2<>0 Then ch_dx = 0 ch_dy = 0 For ch_di3 = 1 To 7 ch_dx = ch_dx + ch_di1 ' diognals, verticals and horizontals ch_dy = ch_dy + ch_di2 If ch_x+ch_dx<1 or ch_x+ch_dx>8 or ch_y+ch_dy<1 or ch_y+ch_dy>8 Then ch_di3 = 9 Else ch_n = Text.GetIndexOf(" PNBRQKpnbrqk", ch_B[ch_x+ch_dx][ch_y+ch_dy])-1 If ch_n<>0 Then ch_n = ch_n - ((ch_turn+1) * 3) If ch_n = 1 Then 'oponent's pawn If Math.Abs(ch_dx) = 1 and ch_dy = ch_turn Then ch_check = 1 EndIf Else If ch_n = 3 Then 'oponent's bishop If Math.Abs(ch_di1) + Math.Abs(ch_di2) = 2 Then ch_check = 1 EndIf Else If ch_n = 4 Then 'oponent's rook If Math.Abs(ch_di1) + Math.Abs(ch_di2) = 1 Then ch_check = 1 EndIf Else If ch_n = 5 Then 'oponent's queen ch_check = 1 Else If ch_n = 6 Then 'oponent's king If Math.Abs(ch_dx)<2 and Math.Abs(ch_dy) < 2 Then ch_check = 1 EndIf EndIf EndIf EndIf EndIf EndIf If ch_check Then ch_di1 = 9 ch_di2 = 9 EndIf ch_di3 = 9 EndIf EndIf EndFor EndIf EndFor EndFor If ch_check = 0 Then 'maybe oponent's knight's check For ch_dx = -2 To 2 If ch_x+ch_dx>0 and ch_x+ch_dx<9 Then For ch_dy = -2 To 2 If ch_y+ch_dy>0 and ch_y+ch_dy<9 Then If Math.Abs(ch_dx) + Math.Abs(ch_dy) = 3 Then ch_n = Text.GetIndexOf(" PNBRQKpnbrqk", ch_B[ch_x+ch_dx][ch_y+ch_dy])-1 If ch_n>1 Then ch_n = ch_n - ((ch_turn+1) * 3) If ch_n = 2 Then 'oponent's knight ch_check = 1 ch_dx = 9 ch_dy = 9 EndIf EndIf EndIf EndIf EndFor EndIf EndFor EndIf EndSub '-- add and verify king's threat before put this move into the list (heavy, but proper) Sub ch_AddMoveV Stack.PushValue( "q", ch_check ) Stack.PushValue( "q", ch_B ) Stack.PushValue( "q", ch_x ) Stack.PushValue( "q", ch_y ) Stack.PushValue( "q", ch_dx ) Stack.PushValue( "q", ch_dy ) Stack.PushValue( "q", ch_di1 ) Stack.PushValue( "q", ch_di2 ) Stack.PushValue( "q", ch_di3 ) Stack.PushValue( "q", ch_n ) ch_B[ch_x+ch_dx][ch_y+ch_dy] = ch_B[ch_x][ch_y] ch_B[ch_x][ch_y] = " " ch_LocateKingPos() ch_IsCheck() ch_n = Stack.PopValue("q") ch_di3 = Stack.PopValue("q") ch_di2 = Stack.PopValue("q") ch_di1 = Stack.PopValue("q") ch_dy = Stack.PopValue("q") ch_dx = Stack.PopValue("q") ch_y = Stack.PopValue("q") ch_x = Stack.PopValue("q") ch_B = Stack.PopValue("q") If ch_check = 0 Then ch_AddMove() EndIf ch_check = Stack.PopValue("q") EndSub '-- add this legal move to the list Sub ch_AddMove ch_mc = ch_mc + 1 ch_mv[ch_mc][1] = ch_x ch_mv[ch_mc][2] = ch_y ch_mv[ch_mc][3] = ch_x+ch_dx ch_mv[ch_mc][4] = ch_y+ch_dy ch_mv[ch_mc][5] = "" EndSub '-- Checking all generated moves, searches best answer (max. depth level 2) Sub ch_ScanNextMoves For ch_mi = 1 To ch_mc ch_Push() ch_MovePiece() If ch_depth = 1 Then ch_Ei = ch_mi ch_Ev[ch_Ei][1] = ch_E + (Math.GetRandomNumber(9)-5) ch_depth = ch_depth + 1 ch_GetNextMoves() ' Oponent's move If ch_mc > 0 Then ch_ScanNextMoves() Else ch_LocateKingPos() ch_IsCheck() ch_Ev[ch_Ei][1] = 99999 * (-ch_turn) * (1+ch_check) ' go this case, or stalemate ch_Ev[ch_Ei][2] = 0 EndIf ch_depth = ch_depth - 1 ch_E = ch_Ev[ch_Ei][1]+ch_Ev[ch_Ei][2] ' Our move+ and oponent's answer- = evaluation Else If ch_depth = 2 Then ch_EvN = 0 If ch_mi = 1 Then ch_EvN = 1 Else If ch_turn>0 Then If ch_Ev[ch_Ei][2] > ch_E Then ch_EvN = 1 ' seems strongest answer EndIf Else If ch_Ev[ch_Ei][2] < ch_E Then ch_EvN = 1 ' seems strongest answer EndIf EndIf EndIf If ch_EvN>0 Then ch_Ev[ch_Ei][2] = ch_E EndIf EndIf EndIf ch_Pop() If ch_depth = 1 Then ch_EvN = 0 If ch_mi = 1 Then ch_EvN = 1 Else If ch_turn>0 Then If ch_Evb < ch_E Then ch_EvN = 1 ' seems better after all, if we are white EndIf Else If ch_Evb > ch_E Then ch_EvN = 1 'seems better after all, if we are black EndIf EndIf EndIf If ch_EvN>0 Then ch_Evb = ch_E ch_i = ch_Ei ch_FormateMove() 'ch_move contains the best move EndIf EndIf EndFor EndSub '-- Process move from the list for normal notation ("e2e4") Sub ch_DoMove ch_GetNextMoves() For ch_mi = 1 To ch_mc If ch_mv[ch_mi][1] = Text.GetIndexOf("abcdefgh", Text.GetSubText(ch_move,1,1) ) Then If ch_mv[ch_mi][2] = Text.GetIndexOf("12345678", Text.GetSubText(ch_move,2,1) ) Then If ch_mv[ch_mi][3] = Text.GetIndexOf("abcdefgh", Text.GetSubText(ch_move,3,1) ) Then If ch_mv[ch_mi][4] = Text.GetIndexOf("12345678", Text.GetSubText(ch_move,4,1) ) Then ch_depth = 0 'save to history ch_hist = ch_hist + 1 ch_mvhist[ch_hist][1] = ch_mv[ch_mi][1] ' from ch_mvhist[ch_hist][2] = ch_mv[ch_mi][2] ch_mvhist[ch_hist][3] = ch_mv[ch_mi][3] ' to ch_mvhist[ch_hist][4] = ch_mv[ch_mi][4] ch_mvhist[ch_hist][5] = ch_mv[ch_mi][5] 'promo ch_mvhist[ch_hist][6] = "" ' piece, or 0-0, or 0-0-0 ch_mvhist[ch_hist][7] = "-" ' move, capture ch_mvhist[ch_hist][8] = "" 'check ch_mvhist[ch_hist][9] = ch_move 'save move text ch_MovePiece() EndIf EndIf EndIf EndIf EndFor EndSub '-- Moving piece on board and counting evaluation improvements (+ for white, - for black) Sub ch_MovePiece ch_E = 0 ch_fl[3] = 0 ch_n = Text.GetIndexOf(" PNBRQKpnbrqk", ch_B[ch_mv[ch_mi][3]][ch_mv[ch_mi][4]])-1 If ch_n>0 Then If ch_turn>0 Then ch_n = ch_n - 6 EndIf If ch_n>0 And ch_n<7 Then ch_E = ch_E + (ch_turn * ch_pEv[ch_n]) ' Got points by capturing enemy's piece If ch_depth = 0 Then 'save to history ch_mvhist[ch_hist][7] = "x" EndIf EndIf EndIf ch_n = Text.GetIndexOf(" PNBRQKpnbrqk", ch_B[ch_mv[ch_mi][1]][ch_mv[ch_mi][2]])-1 If ch_n>0 Then If ch_turn<0 Then ch_n = ch_n - 6 EndIf If ch_depth = 0 Then 'save to history ch_mvhist[ch_hist][6] = Text.GetSubText("pNBRQK",ch_n,1) ' piece EndIf ' Moving piece's evaluations If ch_n = 1 Then If ch_mv[ch_mi][1]<>ch_mv[ch_mi][3] and ch_B[ch_mv[ch_mi][3]][ch_mv[ch_mi][4]] = " " Then ch_B[ch_mv[ch_mi][3]][ch_mv[ch_mi][2]] = " " 'en-passant ch_E = ch_E + (ch_turn * ch_pEv[1]) If ch_depth = 0 Then 'save to history ch_mvhist[ch_hist][7] = "x" EndIf Else If Math.Abs( ch_mv[ch_mi][4]-ch_mv[ch_mi][2] ) = 2 Then ch_fl[3] = ch_mv[ch_mi][1] 'remember enpassant column EndIf EndIf For ch_di1 = 1 To 8 step 7 If ch_mv[ch_mi][4] = ch_di1 Then 'promoted to queen If Text.GetLength(ch_move)>4 Then ch_di2 = Text.GetIndexOf("nbrq",Text.GetSubText(ch_move,5,1)) ' given Else ch_di2 = 4 'queen EndIf ch_mv[ch_mi][5]= Text.GetSubText("nbrq",ch_di2,1) If ch_depth = 0 Then 'save to history ch_mvhist[ch_hist][5] = "=" + ch_mv[ch_mi][5] EndIf ch_B[ch_mv[ch_mi][1]][ch_mv[ch_mi][2]] = Text.GetSubText("-nbrq---NBRQ", ch_di1+ch_di2,1) ch_E = ch_E + (ch_turn * (ch_pEv[5]-ch_pEv[1])) EndIf EndFor EndIf If ch_n = 2 or ch_n = 3 Then 'knight or bishop 'should attack king EndIf If ch_n = 5 Then 'queen 'should attack king EndIf If ch_n = 6 Then 'king 'If it is a castling or move away from e1,e8 If ch_mv[ch_mi][1] = 5 Then ch_di3 = ch_mv[ch_mi][3]-ch_mv[ch_mi][1] ch_dj1 = 1+((1-ch_turn)/2) '1,2 - for castling flags If Math.Abs(ch_di3)>1 Then ch_di2 = ch_mv[ch_mi][2] '1,8 - castling ch_di4 = 1+(7*((ch_di3+2)/4)) '1,8 Rook ch_B[5+(ch_di3/2)][ch_di2] = ch_B[ch_di4][ch_di2] ch_B[ch_di4][ch_di2] = " " ch_E = ch_E + (200 * ch_turn) ' castle If possible If ch_depth = 0 Then 'save to history ch_di4 = 5-(((ch_di3+2)/4)*2) '5,3 length ch_mvhist[ch_hist][6] = Text.GetSubText("0-0-0",1,ch_di4) EndIf Else If (ch_fl[ch_dj1][1]+ch_fl[ch_dj1][2])>0 Then ch_E = ch_E - (200 * ch_turn) EndIf EndIf ch_fl[ch_dj1][1] = 0 ch_fl[ch_dj1][2] = 0 EndIf EndIf ' add points for y-position (attack forward) ch_E = ch_E + ((ch_mv[ch_mi][4] - ch_mv[ch_mi][2]) * ch_pPtY[ch_n]) ' add points for x-position (center) ch_E = ch_E + (ch_turn * (18 - Math.Abs(9 - (2*ch_mv[ch_mi][3])))) ch_B[ch_mv[ch_mi][3]][ch_mv[ch_mi][4]] = ch_B[ch_mv[ch_mi][1]][ch_mv[ch_mi][2]] ch_B[ch_mv[ch_mi][1]][ch_mv[ch_mi][2]] = " " 'If rook moved or was captured For ch_dj1 = 1 To 8 Step 7 'a,h ch_dj22 = 2-((ch_dj1-1)/7) '1,2 For ch_dj2 = 1 To 8 Step 7 '1,8 ch_dj11 = 1+((ch_dj2-1)/7) '1,2 ch_dj23 = (ch_dj11*2)-3 '1,-1 ch_dj24 = 0 If (ch_mv[ch_mi][1] = ch_dj1 and ch_mv[ch_mi][2] = ch_dj2) Then ch_dj24 = 1 EndIf If (ch_dj24 = 0) And (ch_mv[ch_mi][3] = ch_dj1 and ch_mv[ch_mi][4] = ch_dj2) Then ch_dj24 = 1 EndIf If ch_dj24 = 1 and ch_fl[ch_dj11][ch_dj22] > 0 Then ch_fl[ch_dj11][ch_dj22] = 0 ch_E = ch_E + (80 * ch_dj23) ' penalty for lost castling EndIf EndFor EndFor EndIf ' motivate center, knights,bishops If ch_MvNr<10 Then ch_dj23 = 8-(((ch_turn+1)/2)*7) '1,8 For ch_dj1 = 2 To 7 If Math.Abs(9 - ch_dj1)>1 and Text.IsSubText("NBnb", ch_B[ch_dj1][ch_dj23]) Then ch_E = ch_E - (ch_turn * (5*ch_MvNr)) ' penalty for long sitting in back EndIf EndFor If ch_MvNr<8 Then For ch_dj1 = 4 To 5 If Text.IsSubText("pP",ch_B[ch_dj1][ch_dj23+ch_turn]) Then ch_E = ch_E - (ch_turn * 60) ' penalty for not taking the center EndIf EndFor EndIf EndIf ch_turn = -ch_turn If ch_turn>0 Then ch_MvNr = ch_MvNr + 1 ' increase move-counter EndIf ch_LocateKingPos() ch_IsCheck() If ch_check>0 Then ' Add extra points for check ch_E = ch_E - (50 * ch_turn) If ch_depth = 0 Then 'save to history ch_mvhist[ch_hist][8] = "+" 'check EndIf EndIf EndSub '-- Save current position in stack Sub ch_Push Stack.PushValue("p", ch_fl) Stack.PushValue("p", ch_turn) Stack.PushValue("p", ch_MvNr) Stack.PushValue("p", ch_mv) Stack.PushValue("p", ch_mc) Stack.PushValue("p", ch_mi) Stack.PushValue("p", ch_B) Stack.PushValue("p", ch_move) EndSub '-- Restore position from stack Sub ch_Pop ch_move = Stack.PopValue("p") ch_B = Stack.PopValue("p") ch_mi = Stack.PopValue("p") ch_mc = Stack.PopValue("p") ch_mv = Stack.PopValue("p") ch_MvNr = Stack.PopValue("p") ch_turn = Stack.PopValue("p") ch_fl = Stack.PopValue("p") EndSub '-- reproduces all moves till current position Sub ch_DoTakeBack ch_tbh = ch_hist - 2 If ch_tbh >= 0 Then ch_FEN = ch_StartFEN ch_SetFEN() 'set starting position For ch_tbi = 1 To ch_tbh 'do movements ch_move = ch_mvhist[ch_tbi][9] ch_DoMove() EndFor For ch_tbi = 1 To 2 'remove 2 movements Array.RemoveValue(ch_mvhist,ch_tbh+1) EndFor EndIf ch_takeback = 0 EndSub '-- Load images into variables Sub ch_LoadImages ch_GrH = (54*8) ch_GrW = (54*8) + (92) GraphicsWindow.Title = "MS SmallBasic chess presentation" GraphicsWindow.Height = ch_GrH GraphicsWindow.Width = ch_GrW GraphicsWindow.DrawBoundText(ch_GrW/2.2,ch_GrH/2.2, 100, "Loading...") For ch_i = 1 to 6 ch_c = Text.GetSubText("pnbrqk",ch_i,1) For ch_n = 1 To 2 ch_c2 = ch_ImgSrc + Text.GetSubText("wb",ch_n,1) + ch_c + "54.gif" ch_ImgPc[ch_i][ch_n] = ImageList.LoadImage(ch_c2) EndFor EndFor 'And also draw buttons GraphicsWindow.BackgroundColor = "#30C8CF" Stack.PushValue("g",GraphicsWindow.BrushColor) GraphicsWindow.BrushColor = "#DDDDDD" GraphicsWindow.FillEllipse((54*8)+4,54, 86, 26) GraphicsWindow.FillEllipse((54*8)+4,104, 86, 26) GraphicsWindow.FillEllipse((54*8)+4,154, 86, 26) GraphicsWindow.BrushColor = "#0000FF" GraphicsWindow.DrawBoundText((54*8)+15,60,70,"New Game") GraphicsWindow.DrawBoundText((54*8)+15,110,70,"AutoPlay") GraphicsWindow.DrawBoundText((54*8)+15,160,70,"TakeBack") GraphicsWindow.BrushColor = Stack.PopValue("g") EndSub ' Turtle draws or clears a mark Sub ch_AutoPlay Turtle.X = (54*8)+76 Turtle.Y = 111 Stack.PushValue("g",GraphicsWindow.PenColor ) Stack.PushValue("g",GraphicsWindow.PenWidth ) ch_i = 5+(ch_auto*11) GraphicsWindow.PenColor = Text.GetSubText("OFF:#DDDDDD,ON:#FF0000" ,ch_i,7) GraphicsWindow.PenWidth = 3 Turtle.Angle = 180 Turtle.Move(12) Turtle.Angle = Turtle.Angle - 155 Turtle.Move(18) 'Turtle.Hide() GraphicsWindow.PenWidth = Stack.PopValue("g") GraphicsWindow.PenColor = Stack.PopValue("g") EndSub 'Redraws the chess board Sub ch_DrawBoard For ch_di1 = 1 To 8 For ch_di2 = 1 To 8 ch_di11 = (ch_di1-1) ch_di22 = (8-ch_di2) If ch_side<0 Then ch_di11 = 7-ch_di11 ch_di22 = 7-ch_di22 EndIf 'Board squares ch_i = 7+((1-Math.Remainder(ch_di1+ch_di2,2))*14) Stack.PushValue("g",GraphicsWindow.BrushColor) GraphicsWindow.BrushColor = Text.GetSubText("white:#E7CEA5,black:#A57B5A",ch_i,7) GraphicsWindow.FillRectangle(ch_di11*54, ch_di22*54, 54, 54) ch_c = ch_B[ch_di1][ch_di2] 'Pieces on board If ch_c <> " " Then ch_i = Text.GetIndexOf("pnbrqkPNBRQK", ch_c) ch_n = 2 ch_c2 = "#0000FF" If ch_i > 6 Then ch_i = ch_i - 6 ch_n = 1 ch_c2 = "#FF0000" EndIf GraphicsWindow.BrushColor = ch_c2 GraphicsWindow.DrawBoundText((ch_di11*54)+20, (ch_di22*54)+20,30,ch_c) GraphicsWindow.DrawImage(ch_ImgPc[ch_i][ch_n], ch_di11*54, ch_di22*54) GraphicsWindow.BrushColor = Stack.PopValue("g") EndIf ' cursor for mouse drags If ch_di1 = ch_dragX And ch_di2 = ch_dragY Then ch_c2 = "#FF0000" ' red ch_DrawCursor() EndIf ' last move on board If ch_di1 = ch_movedX And ch_di2 = ch_movedY Then ch_c2 = "#0000FF" ' blue ch_DrawCursor() EndIf EndFor EndFor EndSub ' Draws rectangle Sub ch_DrawCursor Stack.PushValue("g",GraphicsWindow.PenColor) GraphicsWindow.PenColor = ch_c2 GraphicsWindow.DrawRectangle((ch_di11*54)+1, (ch_di22*54)+1, 52, 52) GraphicsWindow.PenColor = Stack.PopValue("g") EndSub End>VGR040.sb< Start>VGR369.sb< char[1][1] = "I" char[1][2] = "V" char[2][1] = "X" char[2][2] = "L" char[3][1] = "C" char[3][2] = "D" char[4][1] = "M" While ("True") TextWindow.WriteLine("Enter number to convert to Roman Numerals") number = TextWindow.ReadNumber() If (number > 0 And number < 4000) Then output = "" For i = 1 To Text.GetLength(number) digit = Text.GetSubText(number,Text.GetLength(number)+1-i,1) convert() EndFor TextWindow.WriteLine("") TextWindow.WriteLine(output) TextWindow.WriteLine("") Else TextWindow.WriteLine("Try again between 1 and 3999") EndIf EndWhile Sub convert If (digit = 1) Then numeral = char[i][1] ElseIf (digit = 2) Then numeral = char[i][1]+char[i][1] ElseIf (digit = 3) Then numeral = char[i][1]+char[i][1]+char[i][1] ElseIf (digit = 4) Then numeral = char[i][1]+char[i][2] ElseIf (digit = 5) Then numeral = char[i][2] ElseIf (digit = 6) Then numeral = char[i][2]+char[i][1] ElseIf (digit = 7) Then numeral = char[i][2]+char[i][1]+char[i][1] ElseIf (digit = 8) Then numeral = char[i][2]+char[i][1]+char[i][1]+char[i][1] ElseIf (digit = 9) Then numeral = char[i][1]+char[i+1][1] Else numeral = "" EndIf output = numeral+output EndSub End>VGR369.sb< Start>VGR488-1.sb< ' Wavelength vs Refractive Index GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Title = "Wavelength vs Refractive Index InitColor() ni = Array.GetItemCount(color) index = Array.GetAllIndices(color) DrawGrid() glass = "C7" Plot() glass = "F2" Plot() Sub DrawGrid GraphicsWindow.PenColor = "LightGray" GraphicsWindow.BrushColor = "darkblue gg=LDShapes.BrushGradient (cc "H") LDShapes.BrushRectangle (gg 180 100 300 200) λ = 400 n = 1.5 Map() x400 = x y1_5 = y n = 1.7 For λ = 400 To 700 Step 50 Map() GraphicsWindow.DrawLine(x, y, x, y1_5) GraphicsWindow.DrawText(x - 10, y1_5 + 10, λ) EndFor GraphicsWindow.DrawText(x + 20, y1_5 + 10, "λ[nm]") λ = 700 For n = 1.5 To 1.7 Step 0.05 Map() GraphicsWindow.DrawLine(x400, y, x, y) GraphicsWindow.DrawText(x400 - 30, y - 10, n) EndFor GraphicsWindow.DrawText(x400 - 30, y - 30, "n") EndSub Sub InitColor 'Wavelength to Color color[404] = "sp=h;c=#0800FF;C7=1.52532;F2=1.65070;" color[436] = "sp=g;c=#0000FF;C7=1.52155;F2=1.64206;" ' color[480] = "sp=F';c=#0074FF;C7=1.51747;F2=1.63312;" color[486] = "sp=F;c=#00A6FF;C7=1.51699;F2=1.63210;" color[546] = "sp=e;c=#00FE00;C7=1.51314;F2=1.62409;" color[588] = "sp=d;c=#FF5A00;C7=1.51112;F2=1.62004;" ' color[590] = "sp=D;c=#FF5000;C7=1.51105;F2=1.61989;" color[632] = "sp=632.8;c=#FF0800;C7=1.50934;F2=1.61655;" ' color[644] = "sp=C';c=#FF0400;C7=1.50895;F2=1.61581;" color[656] = "sp=C;c=#FF0200;C7=1.50854;F2=1.61502;" cc[1]="#0800FF cc[2]="#0000FF cc[3]="#00A6FF cc[4]="#00FE00 cc[5]="#FF5A00 cc[6]="#FF0800 cc[7]="#FF0200 EndSub Sub Map ' param λ, n ' return x, y x = λ - 220 y = 300 - (n - 1.5) * 1000 EndSub Sub Plot GraphicsWindow.PenColor = "Black" For i = 1 To ni λ = index[i] clr = color[λ] n = clr[glass] Map() If 1 < i Then GraphicsWindow.PenWidth = 2 GraphicsWindow.DrawLine(x, y, xLast, yLast) EndIf GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = clr["c"] dot = Shapes.AddEllipse(4, 4) Shapes.Move(dot, x - 2, y - 2) xLast = x yLast = y EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(x, y - 20, glass) EndSub End>VGR488-1.sb< Start>VGR488.sb< ' Wavelength vs Refractive Index ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Reference ' [1] http://www.hoya-opticalworld.com/english/technical/002.html ' [2] http://smallbasic.com/program/?PGK814 GraphicsWindow.Title = "Wavelength vs Refractive Index" InitColor() ni = Array.GetItemCount(color) index = Array.GetAllIndices(color) DrawGrid() glass = "C7" Plot() glass = "F2" Plot() Sub DrawGrid GraphicsWindow.PenColor = "LightGray" GraphicsWindow.BrushColor = "Gray" λ = 400 n = 1.5 Map() x400 = x y1_5 = y n = 1.7 For λ = 400 To 700 Step 50 Map() GraphicsWindow.DrawLine(x, y, x, y1_5) GraphicsWindow.DrawText(x - 10, y1_5 + 10, λ) EndFor GraphicsWindow.DrawText(x + 20, y1_5 + 10, "λ[nm]") λ = 700 For n = 1.5 To 1.7 Step 0.05 Map() GraphicsWindow.DrawLine(x400, y, x, y) GraphicsWindow.DrawText(x400 - 30, y - 10, n) EndFor GraphicsWindow.DrawText(x400 - 30, y - 30, "n") EndSub Sub InitColor 'Wavelength to Color color[404] = "sp=h;c=#0800FF;C7=1.52532;F2=1.65070;" color[436] = "sp=g;c=#0000FF;C7=1.52155;F2=1.64206;" ' color[480] = "sp=F';c=#0074FF;C7=1.51747;F2=1.63312;" color[486] = "sp=F;c=#00A6FF;C7=1.51699;F2=1.63210;" color[546] = "sp=e;c=#00FE00;C7=1.51314;F2=1.62409;" color[588] = "sp=d;c=#FF5A00;C7=1.51112;F2=1.62004;" ' color[590] = "sp=D;c=#FF5000;C7=1.51105;F2=1.61989;" color[632] = "sp=632.8;c=#FF0800;C7=1.50934;F2=1.61655;" ' color[644] = "sp=C';c=#FF0400;C7=1.50895;F2=1.61581;" color[656] = "sp=C;c=#FF0200;C7=1.50854;F2=1.61502;" EndSub Sub Map ' param λ, n ' return x, y x = λ - 220 y = 300 - (n - 1.5) * 1000 EndSub Sub Plot GraphicsWindow.PenColor = "Black" For i = 1 To ni λ = index[i] clr = color[λ] n = clr[glass] Map() If 1 < i Then GraphicsWindow.PenWidth = 2 GraphicsWindow.DrawLine(x, y, xLast, yLast) EndIf GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = clr["c"] dot = Shapes.AddEllipse(4, 4) Shapes.Move(dot, x - 2, y - 2) xLast = x yLast = y EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(x, y - 20, glass) EndSub End>VGR488.sb< Start>VGR968-0.sb< ' FebrUary 2020 ' mahreen miangul ' Multiple Animation ' Multiple Keyboard ' rewrote by Nonki Takahashi GraphicsWindow.top= -2.0 GraphicsWindow.left= 80 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = 1280 GraphicsWindow.Height = 666 percent = "1=0;2=70;3=100;" name= "1=LightSteelBlue;2=LightSteelBlue;3=green;" param = "x=0;y=0;angle=45;" param["width"] = GraphicsWindow.Width param["height"] = GraphicsWindow.Height Paint() ' ===================================mussa-maina============================= GraphicsWindow.FontSize = 8 GraphicsWindow.brushColor = "gold miangul = Shapes.Addtext("mussa-maina") Shapes.Move(miangul, 833,250) Shapes.rotate(miangul, 30) Shapes.SetOpacity(miangul, 130) Shapes.Zoom(miangul, 3, 5) '---------------------------------------------------------mahreen//miangul ----------------------------------------------------------------------------------------- GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 80 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "yellow" ' Text shadow color GraphicsWindow.DrawText(380, 0, "mahreen!") ' Shadow position/text GraphicsWindow.DrawText(500, 60, "miangul!") orangered= GraphicsWindow.getcolorfromrgb(250,80,80) GraphicsWindow.BrushColor=orangered GraphicsWindow.BrushColor = orangered ' Text color GraphicsWindow.DrawText(385, 5, "mahreen!") ' Position and text GraphicsWindow.DrawText(505, 65, "miangul!") ' ===================mahreen miangul--Text//WELL COME============ CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) '<------------- line feed GraphicsWindow.FontSize = 44 GraphicsWindow.brushColor = "orange msg=Shapes.AddText("WELL COME!"+CRLF+"from"+CRLF+"haroon "+CRLF+"rashid!") Shapes.Move(msg,0,0) ' =============================ThoABan// Sprites============================= GraphicsWindow.FontSize = 44 GraphicsWindow.BrushColor= "greenyellow miangulBOX = Shapes.Addtext("👹") Shapes.Move(miangulBOX, 0,0) Shapes.Animate(miangulBOX, 110,55,2000) GraphicsWindow.BrushColor= "snow miangulBOX = Shapes.Addtext("👹") Shapes.Move(miangulBOX, 1080,660) Shapes.Animate(miangulBOX, 150,55,2000) GraphicsWindow.BrushColor= "yellow miangulBOX = Shapes.Addtext("👹") Shapes.Move(miangulBOX, 1080,0) Shapes.Animate(miangulBOX, 190,55,2000) GraphicsWindow.BrushColor= "YellowGreen miangulBOX = Shapes.Addtext("��") Shapes.Move(miangulBOX, 0,660) Shapes.Animate(miangulBOX, 230,55,2000) Drawrectangle() GraphicsWindow.penColor = "Chocolate GraphicsWindow.BrushColor = "Sienna GraphicsWindow.Fillrectangle(420, 330, 45, 85) param = "x=420;y=330;width=45;height=85;" Drawrectangle() ' -----------------------------------------------------------Chalk Colors//Free Hand Drawing--------------------------------------------- ' Arc GraphicsWindow.PenColor = "black param = "x=30;y=130;width=77;height=60;a1=0;a2=180;" DrawArc() ' Ellipse GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "yellow GraphicsWindow.Fillellipse(0, 240, 150, 30) param = "x=0;y=240;width=150;height=30;" Drawellipse() ' Line GraphicsWindow.penColor = "black param = "x1=0;y1=330;x2=130;y2=320" DrawLine() ' Rectangle GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "white GraphicsWindow.Fillrectangle(0, 380, 130, 30) param = "x=0;y=380;width=130;height=30;" Drawrectangle() ' Triangle GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "red GraphicsWindow.Filltriangle(0, 545, 50, 450, 100, 545) param = "x1=0;y1=545;x2=50;y2=450;x3=100;y3=545;" Drawtriangle() GraphicsWindow.KeyDown = onkeyDown ' ======================Make Image1()Madam Apple======================= MakeImage() '--------------------------------------------------Text 420---------------------------------------------------- GraphicsWindow.FontSize = 33 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(0, 630, "420")'>>>>>>>>>>>>>1 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(0, 600, "420")'>>>>>>>>>>>>>2 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(0, 570, "420")'>>>>>>>>>>>>>3 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(0, 540, "420")'>>>>>>>>>>>>>4 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(80, 630, "420")'>>>>>>>>>>>>>5 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(80, 600, "420")'>>>>>>>>>>>>>6 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(80, 570, "420")'>>>>>>>>>>>>>7 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(80, 540, "420")'>>>>>>>>>>>>>8 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(80, 510, "420")'>>>>>>>>>>>>>9 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(160, 550, "420")'>>>>>>>>>>>>>10 GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(160, 630, "420")'>>>>>>>>>>>>>11 '=============================Makesprite()============================ SPRITE_init() add_shapes() ' ============================== Aircraft Animation====================== dZ = 0.1 zoom = 1 ddx=0 ddy=0 bdx=0 bdy=0 bdy2=5 ' <------ initial ball2 moving speed-Y ANMB="5:1" BNMB="6:1" ' <----- Blue car shapes number=6 repeat =1 shoot="False" shoot2="False" ' <----- zm=1 Hit_count=0 No_hit=0 ' ------------------------------------------------------STARS--------------------------------------------------------- GraphicsWindow.BrushColor = "yellow For i = 0 To 80 GraphicsWindow.FontSize = 5+ Math.GetRandomNumber(30) x = Math.GetRandomNumber(GraphicsWindow.Width) y = Math.GetRandomNumber(GraphicsWindow.height/2.6) star[i]=Shapes.AddText("★") '<------------- Shapes.Move(star[i],x,y) '<------------- Program.Delay(10) EndFor ' ----------------------------------------------------MOON-------------------------------------------------------- GraphicsWindow.BrushColor = "yellow" GraphicsWindow.PenWidth=0 '<------------- moon= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(moon,250,50) '<------------- GraphicsWindow.BrushColor = "LightSteelBlue shadow= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(shadow,260,45) '<------------- ' ============================== Cannon Animation ============================== GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor= "blue" Ball=Shapes.AddEllipse(10,20) Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) GraphicsWindow.BrushColor= "Navy" ' <----- Ball2=Shapes.AddEllipse(10,20) ' <----- Shapes.Move(Ball2,shapes.GetLeft(shp[BNMB][15]),shapes.Gettop(shp[BNMB][15]))' <----- Shapes.HideShape(Ball2) ' <----- ' ============================== BlueCar Timer ==================================== Timer.Interval=800 Timer.Tick=BlueCar_up ' =======================Drag & Drop to Target or Return Home======================= GraphicsWindow.brushColor = "AliceBlue" home = "X=0;Y=0" spriteSize = "420" sprite[1] = Shapes.Addtext("👹") Shapes.Move(sprite[1], home["X"], home["Y"]) spriteTarget[1] = Shapes.Addtext(spriteSize + 0) 'upSize Target for special fx Shapes.Move(spriteTarget[1], 160, 590) Shapes.SetOpacity(spriteTarget[1], 600) '================================Cloud Moving===================================== dx = GraphicsWindow.Width dY = GraphicsWindow.Height GraphicsWindow.BrushColor = "silver" GraphicsWindow.FontSize = 122 x = x + dX - 44 y = y + dY - 550 cloud() Shapes.Animate(cloud,x,y,0) Program.Delay(800) cloud() ShowInstructions() '============================Mouse Click and Drag to Targrt================================ While "True" ' And "North" <> "South" <--- No meanig , it always "True" mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown Then 'handle click and select If selected = "" And clicked = "False" Then 'can loop thru here for more than 1 box If mseX >= home["X"] And mseX <= home["X"] + spriteSize And mseY >= home["Y"] And mseY <= home["Y"] + spriteSize Then selected = 1 'box number EndIf EndIf clicked = "True" 'the mse has been clicked for this frame Shapes.Move(sprite[selected], mseX, mseY) Else If Math.Round(mseX/50) = Math.Round(Shapes.GetLeft(spriteTarget[selected])/50) Then If Math.Round(mseY/50) = Math.Round(Shapes.GetTop(spriteTarget[selected])/50) Then Shapes.Remove(sprite[selected]) Shapes.SetOpacity(spriteTarget[selected], 100) EndIf EndIf Shapes.Move(sprite[selected], home["X"], home["Y"]) selected = "" 'deselect when finishised with the box clicked = "False" 'inits here, get ready for next click EndIf Program.Delay(20) '============================Aircraft Blinking Program======================= zoom = zoom - dZ For i = 1 To Array.GetItemCount(shape[5]) If Array.ContainsValue(shape[5][i], "eye") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) ElseIf Array.ContainsValue(shape[5][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], zoom, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx,shapes.Gettop(shp[ANMB][i])+ddy) EndFor If zoom = 0.1 Or zoom = 1 Then dZ = -dZ EndIf ' ============================Star Blinking and ShootingProgram========================== mmm= Math.GetRandomNumber(80) ' blinking star number _op=Shapes.GetOpacity(star[mmm]) ' opacity ... brightness If _op>50 Then Shapes.SetOpacity(star[mmm],Math.GetRandomNumber(49)) ' darker Else Shapes.SetOpacity(star[mmm],50+Math.GetRandomNumber(50)) ' brighter EndIf If mmm=50 Then Shapes.Move(star[0],400+Math.GetRandomNumber(700),-200) Shapes.Animate(star[0],Math.GetRandomNumber(500),2200,2000) 'shooting star Program.Delay(30) zm=zm+0.1 '===============================Moon Opacity and Zoom=============================== Shapes.Zoom(moon,zm,zm) ' moon becomes bigger Shapes.Zoom(shadow,zm,zm)' shadow becomes bigger Shapes.Move(moon,shapes.GetLeft(moon)+1,shapes.GetTop(moon)+1) Shapes.Move(shadow,shapes.GetLeft(shadow)+2,shapes.GetTop(shadow)+1) EndIf Program.Delay(20) ' <<<<>>>> '============================Aircraft Reverse Moving=====X,Y Direction============= cycleX= shapes.GetLeft(shp[ANMB][5]) cycleY= shapes.GetTop(shp[ANMB][5]) If cycleX<0 Or cycleX>GraphicsWindow.Width Then ddx=-ddx EndIf If cycleY<0 Or cycleY>200 Then ddy=-ddy EndIf ' ===========================BallFire======================================= If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)-bdx/2,shapes.Gettop(ball)-bdy/2) If shapes.Gettop(ball)>700 Then shoot="False" No_hit=No_hit+1 GraphicsWindow.Title="You Hit !!!!!! Total "+(Hit_count*10-No_hit*5) +" Points get" Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) EndIf '==========================Collision Check Here================================= BCar_X=shapes.GetLeft(shp[BNMB][5]) BCar_Y=shapes.GetTop(shp[BNMB][5]) ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (BCar_XVGR968-0.sb< Start>VGT754.sb< LDDataBase.ConnectSqlServer("MM\INSTANZ1", "TestDatenbank") command = "BEGIN TRANSACTION;" command = command + "INSERT into Personen(PersonID,VorName,NachName,PflegeDatum) VALUES ('1','Martin','Menze','19590807 05:50');" command = command + "COMMIT;" LDDataBase.Command("TestDatenbank", command) End>VGT754.sb< Start>VGV311.sb< ' mml to mid file exchange sample by NaochanON TZQ815 ' Sample ... MoonLightSonata(Beethoven) MML Code is made by Yvan Leduc ' This uses Free compiler mml2mid.exe. ' mml2mid compiles MML(Music Macro Language) file into SMF(Standard MIDI File format 0 and 1). ' mml2mid.exe is made by Akito Monden, Hideki Fujii, Hisayasu Kuroda and Naoyuki Nide ' See http://hpc.jp/~mml2mid/index-e.html ' you can dowload it from here. http://hpc.jp/~mml2mid/download.html ' select mml530.zip -> download -> unzip ' mml2mid.exe is in the "bin_w32" folder. copy this in your mml file folder. Title="MoonLightSonata_1" Dir= Program.Directory+"\" path= Dir+Title+".mml" dq=text.GetCharacter(34) ' double quotaition" crlf=text.GetCharacter(13)+Text.GetCharacter(10) ' Head="#title"+dq+Title+dq+crlf ' title // unnecessary head=head+"#copyright"+dq+"Original Beethoven /Yvan Leduc / mml2mid by NaochanON"+dq+crlf '// unnecessary head=head+"#timebase 48"+crlf ' timebase // unnecessary head=head+"A t160"+crlf ' tempo unnecessary codes=head ' Codes="" For M=1 To 69 Read_Measure() sum="A " For t=1 To 12 temp=a[t]+n[t] temp=text.ConvertToLowerCase(LDText.Replace(temp,"L64","L0")) 'L64 --> L0 temp=LDText.Replace(temp,"#","+") ' # --> + sum=sum+temp+" " a[t]="" n[t]="" EndFor codes=codes+sum+crlf EndFor ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(path) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path,codes) Program.Delay(500) LDProcess.Start(Dir+"mml2mid.exe",Title) Program.Delay(500) LDProcess.Start(Dir+Title+".mid","") SUB Read_Measure If (M=1) then ' measure 1 a[1]="O2L64 C#" +"O3L64 C#" +"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=2) then ' measure 2 a[1]="O2L64 B" +"O3L64 B" +"O4L64 B" n[1]="O4L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=3) then ' measure 3 a[1]="O2L64 A" +"O3L64 A" +"O4L64 A" n[1]="O4L4 A" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 A" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O2L64 F#" +"O3L64 F#" +"O4L64 A" n[7]="O4L4 A" n[8]="O5L4 D" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 D" n[12]="O5L4 F#" ElseIf (M=4) then ' measure 4 a[1]="O2L64 G#" +"O3L64 G#" +"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 C" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O2L64 G#" +"O3L64 G#" +"O4L64 G#" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C" n[12]="O5L4 D#" ElseIf (M=5) then ' measure 5 a[1]="O2L64 C#" +"O3L64 C#" +"O4L64 G#" n[1]="O4L4 E" n[2]="O4L4 G#" n[3]="O4L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 G#" +"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" a[12]="O5L64 E" +"O6L64 G#" n[12]="O5L4 E" ElseIf (M=6) then ' measure 6 a[1]="O2L64 F#" +"O3L64 F#" +"O4L64 C" n[1]="O6L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 G#" +"O6L64 G#" n[10]="O6L4 G#" n[11]="O4L4 D#" a[12]="O5L64 F#" +"O6L64 G#" n[12]="O5L4 F#" ElseIf (M=7) then ' measure 7 a[1]="O3L64 C#" +"O4L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 F#" +"O4L64 A" n[7]="O6L4 A" n[8]="O4L4 C#" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=8) then ' measure 8 a[1]="O3L64 B" +"O4L64 G#" n[1]="O6L4 G#" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" a[7]="O3L64 B" +"O4L64 G#" n[7]="O6L4 F#" n[8]="O4L4 B" n[9]="O4L4 D#" a[10]="O4L64 A"+"O6L64 B" n[10]="O6L4 B" n[11]="O4L4 B" n[12]="O5L4 D#" ElseIf (M=9) then ' measure 9 a[1]="O3L64 E" +"O4L64 G#" n[1]="O6L4 E" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O4L4 B" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O4L4 B" n[12]="O5L4 E" ElseIf (M=10) then ' measure 10 a[1]="O3L64 E" +"O4L64 E" n[1]="O4L4 G" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 E n[7]="O4L4 G" n[8]="O4L4 B" n[9]="O5L4 E" a[10]="O3L64 G" +"O6L64 G" n[10]="O6L4 G" n[11]="O4L4 B" a[12]="O5L64 E" +"O6L64 G" n[12]="O5L4 E" ElseIf (M=11) then ' measure 11 a[1]="O3L64 D" +"O6L64 G" n[1]="O6L4 G" n[2]="O4L4 B" n[3]="O5L4 F" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 F" n[7]="O4L4 G" n[8]="O4L4 B" n[9]="O5L4 F" a[10]="O3L64 G" +"O6L64 G" n[10]="O6L4 G" n[11]="O4L4 F" a[12]="O5L64 E" +"O6L64 G" n[12]="O6L4 G" ElseIf (M=12) then ' measure 12 a[1]="O3L64 G" +"O5L64 G" n[1]="O6L4 G" n[2]="O4L4 C" n[3]="O5L4 E" a[4]="O3L64 B" +"O4L64 B" n[4]="O5L4 G" n[5]="O4L4 C" n[6]="O5L4 E" a[7]="O2L64 A#" +"O3L64 A#" n[7]="O5L4 G" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 F#"+"O6L64 F#" n[10]="O6L4 F#" n[11]="O4L4 A#" n[12]="O5L4 C#" ElseIf (M=13) then ' measure 13 a[1]="O3L64 B" +"O5L64 F#" n[1]="O6L4 F#" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 F#" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 E" +"O6L64 G" n[7]="O6L4 G" n[8]="O4L4 B" n[9]="O5L4 C#" a[10]="O3L64 G" +"O6L64 E" n[10]="O6L4 E" n[11]="O4L4 B" n[12]="O5L4 C#" ElseIf (M=14) then ' measure 14 a[1]="O3L64 F#" +"O6L64 F#" n[1]="O6L4 F#" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 F#" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 F#" +"O4L64 F#" n[7]="O6L4 F#" n[8]="O4L4 A#" n[9]="O5L4 C#" n[10]="O4L4 F#" n[11]="O4L4 A#" n[12]="O5L4 C#" ElseIf (M=15) then ' measure 15 a[1]="O3L64 B" +"O5L64 B" n[1]="O5L4 B" n[2]="O5L4 D" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D" n[6]="O5L4 F#" n[7]="O4L4 D" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 B" +"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 D#" n[12]="O5L4 F#" ElseIf (M=16) then ' measure 16 a[1]="O3L64 B" +"O7L64 C" n[1]="O7L4 C" n[2]="O5L4 E" n[3]="O5L4 G" a[4]="O3L64 E" +"O4L64 B" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G" a[7]="O3L64 G" +"O4L64 B" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G" a[10]="O3L64 C" +"O6L64 A#" n[10]="O6L4 A#" n[11]="O5L4 E" n[12]="O5L4 G" ElseIf (M=17) then ' measure 17 a[1]="O3L64 B" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 B" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 B" +"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 D#" n[12]="O5L4 F#" ElseIf (M=18) then ' measure 18 a[1]="O3L64 B" +"O7L64 C" n[1]="O7L4 C" n[2]="O5L4 E" n[3]="O5L4 G" a[4]="O3L64 E" +"O3L64 B" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G" a[7]="O3L64 G" +"O3L64 B" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G" '♮ a[10]="O3L64 C" +"O6L64 A#" n[10]="O6L4 A#" n[11]="O5L4 E" n[12]="O5L4 G" ElseIf (M=19) then ' measure 19 a[1]="O2L64 B" +"O4L64 B" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D#" n[6]="O5L4 F#" a[7]="O2L64 G#" +"O3L64 G#" +"O6L64 B" n[7]="O6L4 B" n[8]="O5L4 D" n[9]="O5L4 F" n[10]="O4L4 B" n[11]="O5L4 D" n[12]="O5L4 F" ElseIf (M=20) then ' measure 20 a[1]="O2L64 F" +"O3L64 F" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 C#" n[3]="O5L4 G#" n[4]="O4L4 B" n[5]="O5L4 C#" n[6]="O5L4 G#" a[7]="O2L64 F#" +"O3L64 F#" +"O6L64 A" n[7]="O6L4 A" n[8]="O5L4 C#" n[9]="O5L4 F#" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=21) then ' measure 21 a[1]="O3L64 B" +"O4L64 B" +"O6L64 G" n[1]="O6L4 G" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 C" +"O4L64 C" +"O6L64 F#" n[7]="O6L4 F#" n[8]="O4L4 A" n[9]="O5L4 D#" n[10]="O4L4 F#" n[11]="O4L4 A" n[12]="O5L4 D#" ElseIf (M=22) then ' measure 22 a[1]="O3L64 C#" +"O5L64 C#" n[1]="O5L4 C#" n[2]="O4L4 F#" n[3]="O4L4 A" n[4]="O5L4 C#" n[5]="O4L4 F#" n[6]="O4L4 A" a[7]="O3L64 C#" +"O5L64 C#" n[7]="O5L4 C#" n[8]="O4L4 F#" n[9]="O4L4 G#" a[10]="O3L64 C#" +"O5L64 C#" n[10]="O4L4 C#" n[11]="O4L4 F" n[12]="O4L4 G#" ElseIf (M=23) then ' measure 23 a[1]="O2L64 F#" +"O3L64 C#" +"O4L64 F#" n[1]="O4L4 F#" n[2]="O4L4 A" n[3]="O5L4 C#" n[4]="O4L4 A" n[5]="O5L4 C#" n[6]="O5L4 F#" n[7]="O5L4 C#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 E" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O5L4 F#" a[12]="O5L64 A" +"O6L64 C#" n[12]="O6L4 C#" ElseIf (M=24) then ' measure 24 a[1]="O3L64 F" +"O6L64 C#" n[1]="O4L4 C#" n[2]="O4L4 G#" n[3]="O4L4 B" n[4]="O4L4 C#" n[5]="O4L4 G#" n[6]="O4L4 B" n[7]="O4L4 C#" n[8]="O4L4 G#" n[9]="O4L4 B a[10]="O4L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 G#" a[12]="O4L64 B" +"O6L64 C#" n[12]="O6L4 C#" ElseIf (M=25) then ' measure 25 a[1]="O3L64 F#" +"O6L64 C#" n[1]="O6L4 C#" n[2]="O4L4 F#" n[3]="O4L4 A" n[4]="O4L4 C#" n[5]="O4L4 F#" n[6]="O4L4 A" a[7]="O4L64 D#" +"O6L64 C" n[7]="O6L4 C" n[8]="O4L4 F#" n[9]="O4L4 A" a[10]="O3L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 F#" n[12]="O4L4 A" ElseIf (M=26) then ' measure 26 a[1]="O3L64 C" +"O6L64 D#" n[1]="O6L4 D#" n[2]="O4L4 F#" n[3]="O4L4 G#" n[4]="O4L4 D#" n[5]="O4L4 F#" n[6]="O4L4 G#" n[7]="O4L4 D#" n[8]="O4L4 F#" n[9]="O4L4 G#" a[10]="O3L64 C" +"O6L64 D#" n[10]="O6L4 D#" n[11]="O4L4 F#" n[12]="O4L4 G#" ElseIf (M=27) then ' measure 27 a[1]="O3L64 C#" +"O6L64 E" n[1]="O6L4 E" n[2]="O4L4 G#" n[3]="O4L4 C#" n[4]="O4L4 E" n[5]="O4L4 G#" n[6]="O4L4 C#" a[7]="O3L64 F#" +"O6L64 D#" n[7]="O6L4 D#" n[8]="O4L4 F#" n[9]="O4L4 A" a[10]="O3L64 G" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 E" n[12]="O4L4 A#" ElseIf (M=28) then ' measure 28 a[1]="O3L64 G#" +"O6L64 C" n[1]="O5L4 C" n[2]="O4L4 C" n[3]="O4L4 D#" a[4]="O4L64 G#" +"O6L64 G#" n[4]="O6L4 G#" n[5]="O4L4 C" n[6]="O4L4 D#" a[7]="O4L64 A" +"O6L64 A" n[7]="O6L4 A" n[8]="O4L4 C" n[9]="O4L4 D#" a[10]="O4L64 F#" +"O6L64 F#" n[10]="O6L4 F#" n[11]="O4L4 C" n[12]="O4L4 D#" ElseIf (M=29) then ' measure 29 n[1]="O3L64 G#" n[2]="O4L4 C" n[3]="O4L4 D#" a[4]="O3L64 G#" +"O5L64 G#" n[4]="O5L4 G#" n[5]="O4L4 C" n[6]="O4L4 D#" a[7]="O3L64 G#" +"O5L64 A" n[7]="O5L4 A" n[8]="O4L4 C" n[9]="O4L4 D#" a[10]="O3L64 E" +"O5L64 F#" n[10]="O5L4 F#" n[11]="O4L4 C" n[12]="O4L4 D#" ElseIf (M=30) then ' measure 30 a[1]="O3L64 G#" +"O3L64 E" n[1]="O3L4 E" n[2]="O4L4 E" n[3]="O4L4 G#" a[4]="O5L64 C#" +"O6L64 C#" n[4]="O3L4 E" n[5]="O4L4 E" n[6]="O4L4 G#" a[7]="O5L64 E" +"O6L64 E" n[7]="O6L4 E" n[8]="O4L4 E" n[9]="O4L4 G#" a[10]="O5L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 E" n[12]="O4L4 G#" ElseIf (M=31) then ' measure 31 a[1]="O3L64 G#"+"O3L64 G#" n[1]="O3L4 G#" n[2]="O4L4 E" n[3]="O4L4 G#" a[4]="O5L64 C#" +"O5L64 C#" n[5]="O4L4 E" n[6]="O4L4 G#" a[7]="O4L64 E" +"O6L64 E" n[7]="O6L4 E" n[8]="O4L4 E" n[9]="O4L4 G#" a[10]="O4L64 C#" +"O5L64 C#" n[10]="O5L4 C#" n[11]="O4L4 E" n[12]="O4L4 G#" ElseIf (M=32) then ' measure 32 a[1]="O2L64 G#"+"O3L64 F#" n[1]="O4L4 F#" n[2]="O3L4 A" n[3]="O3L4 F#" n[4]="O5L4 C" n[5]="O4L4 A" n[6]="O5L4 D#" n[7]="O5L4 C" n[8]="O5L4 F#" n[9]="O5L4 D#" n[10]="O5L4 A" n[11]="O5L4 F#" n[12]="O6L4 C" ElseIf (M=33) then ' measure 33 a[1]="O2L64 G#"+"O3L64 E" n[1]="O4L4 E" n[2]="O4L4 C#" n[3]="O3L4 G#" n[4]="O5L4 E" n[5]="O5L4 C#" n[6]="O5L4 G#" n[7]="O5L4 E" n[8]="O6L4 C#" n[9]="O5L4 G#" n[10]="O6L4 E" n[11]="O6L4 C#" n[12]="O5L4 G#" ElseIf (M=34) then ' measure 34 a[1]="O2L64 G#"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 G" n[3]="O5L4 E" n[4]="O5L4 A#" n[5]="O5L4 G" n[6]="O6L4 C#" n[7]="O5L4 A#" n[8]="O6L4 E" n[9]="O6L4 C#" n[10]="O6L4 G" n[11]="O6L4 E" n[12]="O6L4 A#" ElseIf (M=35) then ' measure 35 a[1]="O2L64 G#"+"O4L64 F#" n[1]="O5L4 F#" n[2]="O6L4 C" n[3]="O5L4 A" n[4]="O6L4 D#" n[5]="O6L4 C" n[6]="O6L4 F#" n[7]="O6L4 D#" n[8]="O6L4 A" n[9]="O6L4 F#" n[10]="O7L4 C" n[11]="O6L4 A" n[12]="O7L4 D#" ElseIf (M=36) then ' measure 36 a[1]="O2L64 G#"+"O3L64 G#"+"O7L64 C" n[1]="O7L4 C" n[2]="O6L4 F#" n[3]="O6L4 A" n[4]="O6L4 D#" n[5]="O6L4 F#" n[6]="O6L4 C" n[7]="O6L4 D#" n[8]="O5L4 A" n[9]="O6L4 C" n[10]="O5L4 F#" n[11]="O5L4 A" n[12]="O5L4 D#" ElseIf (M=37) then ' measure 37 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 F#" n[1]="O5L4 F#" n[2]="O5L4 C" n[3]="O5L4 D#" n[4]="O5L4 A" n[5]="O6L4 C" n[6]="O5L4 F#" a[7]="O5L64 A"+"O6L64 A" n[7]="O5L4 A" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=38) then ' measure 38 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F# " a[7]="O5L64 D#"+"O6L64 D#" n[7]="O5L4 D#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=39) then ' measure 39 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F# " a[7]="O5L64 D"+"O6L64 D" n[7]="O5L4 D" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=40) then ' measure 40 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F#" ' a[7]="O2L64 A"+"O3L64 A"+"O5L64 C#" n[7]="O5L4 C#" n[8]="O5L4 E" n[9]="O6L4 C#" n[10]="O5L4 C#" n[11]="O5L4 E" n[12]="O6L4 C#" ElseIf (M=41) then ' measure 41 a[1]="O2L64 F#"+"O3L64 F#"+"O5L64 D#" n[1]="O5L4 D#" n[2]="O5L4 A" n[3]="O6L4 C#" n[4]="O5L4 D#" n[5]="O5L4 A" n[6]="O6L4 C#" a[7]="O2L64 G#"+"O3L64 G#"+"O5L64 D#" n[7]="O5L4 D#" n[8]="O5L4 G#" n[9]="O6L4 C" n[10]="O5L4 D#" n[11]="O5L4 G#" n[12]="O6L4 C" ElseIf (M=42) then ' measure 42 a[1]="O3L64 C#"+"O3L64 G#"+"O5L64 E" n[1]="O5L4 E" n[2]="O5L4 G#" n[3]="O6L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" a[12]="O5L64 E"+"O6L64 G#" n[12]="O6L4 G#" ElseIf (M=43) then ' measure 43 a[1]="O3L64 C"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 D#" a[12]="O5L64 F#"+"O6L64 G#" ' <---- n[12]="O6L4 G#" ElseIf (M=44) then ' measure 44 a[1]="O3L64 C#"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 F#"+"O4L64 A"+"O6L64 A" n[7]="O6L4 A" n[8]="O5L4 C#" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=45) then ' measure 45 a[1]="O3L64 B"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" a[7]="O3L64 B"+"O4L64 A"+"O6L64 F#" n[7]="O6L4 F#" n[8]="O4L4 B" n[9]="O5L4 D#" a[10]="O3L64 B"+"O4L64 A"+"O6L64 B" n[10]="O6L4 B" n[11]="O4L4 B" n[12]="O5L4 D# ElseIf (M=46) then ' measure 46 a[1]="O3L64 E"+"O4L64 G#"+"O6L64 E" n[1]="O6L4 E" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G#" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G#" a[10]="O4L64 B"+"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 E" a[12]="O5L64 G#"+"O6L64 B" n[12]="O6L4 B" ElseIf (M=47) then ' measure 47 a[1]="O3L64 D#"+"O4L64 B"+"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O4L4 B" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 B"+"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 F#" a[12]="O5L64 A"+"O6L64 B" n[12]="O6L4 B" ElseIf (M=48) then ' measure 48 a[1]="O3L64 E"+"O4L64 B"+"O6L64 B" n[1]="O4L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 D#"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 G#" a[10]="O3L64 C#"+"O7L64 C#" n[10]="O7L4 C#" n[11]="O5L4 E" n[12]="O5L4 G#" ElseIf (M=49) then ' measure 49 a[1]="O3L64 C"+"O4L64 G#"+"O7L64 D#" n[1]="O7L4 D#" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 D#" n[5]="O5L4 F#" n[6]="O5L4 G#" a[7]="O3L64 C#"+"O4L64 E"+"O7L64 E" n[7]="O7L4 E" n[8]="O5L4 F#" n[9]="O6L4 C#" n[10]="O5L4 E" n[11]="O5L4 F#" n[12]="O6L4 C#" ElseIf (M=50) then ' measure 50 a[1]="O3L64 C#"+"O4L64 D"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O5L4 D" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 D"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 G#" n[10]="O5L4 C" n[11]="O5L4 F#" n[12]="O5L4 G#" ElseIf (M=51) then ' measure 51 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 E" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 E" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" a[10]="O5L64 C#" +"O7L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F" n[12]="O5L4 G# ElseIf (M=52) then ' measure 52 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" a[4]="O3L64 F#"+"O4L64 F#" +"O5L64 C#" n[4]="O5L4 C#" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 A"+"O4L64 A"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 F#"+"O5L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=53) then ' measure 53 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 F" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 F" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" a[10]="O5L64 C#"+"O7L64 C#" n[10]="O7L4 C#" n[11]="O5L4 F" n[12]="O5L4 G#" ElseIf (M=54) then ' measure 54 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" a[4]="O3L64 F#"+"O4L64 F#" n[4]="O5L4 C#" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 A"+"O4L64 A" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 F#"+"O5L64 C#" +"O7L64 C" n[10]="O7L4 C" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=55) then ' measure 55 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 F" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 F" n[6]="O5L4 G#" a[7]="O3L64 F#"+"O3L64 F#"+"O7L64 C#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" n[10]="O5L4 C#" n[11]="O5L4 F" n[12]="O5L4 G#" ElseIf (M=56) then ' measure 56 a[1]="O3L64 B"+"O4L64 B"+"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O4L4 B" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 C#"+"O4L64 C#"+"O6L64 B" n[10]="O4L4 B" n[11]="O5L4 E" n[12]="O5L4 G#" ElseIf (M=57) then ' measure 57 a[1]="O3L64 C#"+"O4L64 A"+"O6L64 A" n[1]="O6L4 A" n[2]="O5L4 E" n[3]="O5L4 G#" a[4]="O3L64 D#"+"O4L64 D#"+"O6L64 A" n[4]="O6L4 A" n[5]="O5L4 D#" n[6]="O5L4 F#" a[7]="O3L64 C"+"O4L64 C"+"O6L64 G#" n[7]="O6L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 C#"+"O4L64 A"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=58) then ' measure 58 a[1]="O3L64 F#"+"O4L64 A"+"O6L64 F#" n[1]="O6L4 F#" n[2]="O5L4 C#" n[3]="O5L4 D#" n[4]="O5L4 F#" n[5]="O5L4 C#" n[6]="O5L4 D#" a[7]="O3L64 E"+"O4L64 G#"+"O6L64 G#" n[7]="O6L4 G#" n[8]="O5L4 C#" n[9]="O5L4 D#" a[10]="O3L64 D#"+"O4L64 D#"+"O6L64 A" n[10]="O6L4 A" n[11]="O5L4 C#" n[12]="O5L4 D#" ElseIf (M=59) then ' measure 59 a[1]="O2L64 E"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O5L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 E"+"O4L64 F#"+"O6L64 G#" n[7]="O5L4 G#" n[8]="O5L4 C" n[9]="O5L4 D# n[10]="O5L4 F#" n[11]="O5L4 C" n[12]="O5L4 D#" ElseIf (M=60) then ' measure 60 a[1]="O3L64 C#"+"O4L64 G#"+"O5L64 C#" n[1]="O5L4 C#" n[2]="O3L4 G#" n[3]="O4L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O3L64 C#"+"O4L64 G#" n[10]="O5L4 G#" n[11]="O5L4 C#" n[12]="O4L64 C#"+"O5L4 E" ElseIf (M=61) then ' measure 61 a[1]="O3L64 C"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 G#"+"O4L64 G#" n[10]="O4L4 G#" n[11]="O5L4 D#" n[12]="O4L64 G#"+"O5L4 F#" ElseIf (M=62) then ' measure 62 a[1]="O3L64 C#"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 E" n[3]="O5L4 C#" n[4]="O5L4 G#" n[5]="O5L4 E" n[6]="O6L4 C#" n[7]="O5L4 G#" n[8]="O6L4 E" n[9]="O6L4 C#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O6L4 E" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=63) then ' measure 63 a[1]="O2L64 G#"+"O3L64 G#"+"O6L64 C" n[1]="O6L4 C" n[2]="O6L4 D#" n[3]="O5L4 A" n[4]="O6L4 C" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O5L4 D#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 G#"+"O6L64 C" n[10]="O6L4 C" n[11]="O5L4 G#" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=64) then ' measure 64 a[1]="O3L64 C#"+"O3L64 G#"+"O6L64 C#" n[1]="O6L4 C#" n[2]="O5L4 E" n[3]="O5L4 C#" n[4]="O5L4 G#" n[5]="O5L4 E" n[6]="O6L4 C#" n[4]="O5L4 G#" n[5]="O6L4 E" n[6]="O6L4 C#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O6L4 E" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=65) then ' measure 65 a[1]="O2L64 G#"+"O3L64 G#"+"O6L64 C" n[1]="O6L4 C" n[2]="O6L4 D#" n[3]="O5L4 A" n[4]="O6L4 C" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O6L4 D#" n[8]="O6L4 F#" n[9]="O5L4 A" a[10]="O4L64 G#"+"O6L64 C" n[10]="O6L4 C" n[11]="O5L4 G#" n[12]="O4L64 G#"+"O5L4 F#" ElseIf (M=66) then ' measure 66 a[1]="O3L64 C#"+"O3L64 G#"+"O6L64 C#" n[1]="O6L4 C#" n[2]="O5L4 G#" n[3]="O6L4 C#" n[4]="O6L4 E" n[5]="O6L4 C#" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 E" n[9]="O5L4 G#" n[10]="O6L4 C#" n[11]="O5L4 G#" n[12]="O5L4 E" ElseIf (M=67) then ' measure 67 a[1]="O3L64 C#"+"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 E" n[3]="O5L4 G#" n[4]="O6L4 C#" n[5]="O5L4 G#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O4L4 G#" n[10]="O4L4 E" n[11]="O4L4 G#" n[12]="O4L4 E" ElseIf (M=68) then ' measure 68 a[1]="O2L64 C#"+"O3L64 C#" n[1]="O4L1 C#" a[2]="O3L64 C#"+"O4L64 G#" n[2]="O4L1 G#" ElseIf (M=69) then ' measure 69 a[1]="O2L64 C#"+"O3L64 C#" n[1]="O4L1 C#" EndIf EndSub End>VGV311.sb< Start>VGX095.sb< Xcentre=250 Ycentre=200 Radius=100 GraphicsWindow.PenColor="Blue" For angle=0 To 180 Step 0.5 GraphicsWindow.DrawLine(Xcentre,Ycentre,Radius*math.cos(math.GetRadians(angle))+Xcentre,Radius*math.sin(math.GetRadians(angle))+Ycentre) EndFor GraphicsWindow.PenColor="Red" For angle=180.5 To 200 Step 0.5 GraphicsWindow.DrawLine(Xcentre,Ycentre,Radius*math.cos(math.GetRadians(angle))+Xcentre,Radius*math.sin(math.GetRadians(angle))+Ycentre) EndFor GraphicsWindow.PenColor="Yellow" For angle=200.5 To 300 Step 0.5 GraphicsWindow.DrawLine(Xcentre,Ycentre,Radius*math.cos(math.GetRadians(angle))+Xcentre,Radius*math.sin(math.GetRadians(angle))+Ycentre) EndFor GraphicsWindow.PenColor="Green" For angle=300.5 To 360 Step 0.5 GraphicsWindow.DrawLine(Xcentre,Ycentre,Radius*math.cos(math.GetRadians(angle))+Xcentre,Radius*math.sin(math.GetRadians(angle))+Ycentre) EndFor End>VGX095.sb< Start>VHC219.sb< TextWindow.Show() looping: TextWindow.WriteLine("what would you like to search?") kw = TextWindow.Read() 'TextWindow.Hide() pic = Flickr.GetRandomPicture(kw) TextWindow.Clear() For i = 1 To 10 Desktop.SetWallPaper(pic) pic = Flickr.GetRandomPicture(kw) Program.Delay(6000) TextWindow.WriteLine("Loading new image //"+ Clock.Time + " Searching: " + kw) EndFor TextWindow.WriteLine("would you like to search for anything else y/n") yn = TextWindow.Read() If yn = "y" Or "yes" Then Goto looping EndIf End>VHC219.sb< Start>VHD172.sb< 'mahreen miangul 'Animation 17th October 2016 GraphicsWindow.Width = 1080 GraphicsWindow.Height = 600 GraphicsWindow.BackgroundColor = "gainsboro ' mahreen miangul GraphicsWindow.brushColor = "purple graphicswindow.FontSize = 55 haroon2= Shapes.AddText("Bunny!") Shapes.Move(haroon2, 1080, 0) Shapes.Animate(haroon2, 330, 10, 2000) Shapes.Rotate(haroon2, 0) GraphicsWindow.BrushColor = "gainsboro GraphicsWindow.penColor = "black GraphicsWindow.penwidth = 1 ' Bunny- Animation ' Ear-Left haroon1 = shapes.addellipse(80, 180) Shapes.move(haroon1, 1000, 600) Shapes.animate(haroon1,80, 50, 2000) Shapes.rotate(haroon1, 0) 'Shapes.SetOpacity(haroon1, 50) 'Shapes.Zoom(haroon1, 5, 3) ' Ear-Right haroon1 = shapes.addellipse(80, 180) Shapes.move(haroon1, 1000, 600) Shapes.animate(haroon1,180, 50, 2000) GraphicsWindow.BrushColor = "white ' Face haroon1 = shapes.addellipse(180, 180) Shapes.move(haroon1, 1000, 0) Shapes.animate(haroon1,80, 160, 2000) ' Eye-Left haroon1 = shapes.addellipse(44, 50) Shapes.move(haroon1, 1000, 420) Shapes.animate(haroon1,110, 180, 2000) ' Eye-Right haroon1 = shapes.addellipse(44, 50) Shapes.move(haroon1, 1000, 420) Shapes.animate(haroon1,180, 180, 2000) GraphicsWindow.BrushColor = "black ' Eye-Left1 haroon1 = shapes.addellipse(20, 20) Shapes.move(haroon1, 1000, 140) Shapes.animate(haroon1,122, 195, 2000) ' Eye-Right1 haroon1 = shapes.addellipse(20, 20) Shapes.move(haroon1, 1000, 40) Shapes.animate(haroon1,194, 195, 2000) GraphicsWindow.penColor = "black ' Mouth haroon1 = shapes.addLine(0, 0, 100, 0) Shapes.move(haroon1, 1000, 40) Shapes.animate(haroon1,120, 280, 2000) GraphicsWindow.BrushColor = "white ' Tooth haroon1 = shapes.addrectangle(20, 10) Shapes.move(haroon1, 1000, 40) Shapes.animate(haroon1,150, 280, 2000) ' Tooth2 haroon1 = shapes.addrectangle(20, 10) Shapes.move(haroon1, 1000, 40) Shapes.animate(haroon1,170, 280, 2000) ' add eyelids GraphicsWindow.PenColor = "transparent GraphicsWindow.BrushColor = "white For i = 1 To 2 eyelids[i] = Shapes.AddEllipse(44, 50) Shapes.move(eyelids[i], 0, 0) Shapes.animate(eyelids[i], 110 + (i - 1) * 70, 178, 2000) EndFor Timer.Tick = Blink Timer.Interval = 500 Sub Blink t = t + 1 If Math.Remainder(t, 6) = 1 Then For i = 1 To 2 Shapes.HideShape(eyelids[i]) EndFor ElseIf Math.Remainder(t, 6) = 0 Then For i = 1 To 2 Shapes.ShowShape(eyelids[i]) EndFor EndIf EndSub End>VHD172.sb< Start>VHG623.sb< ' SnakeBite Concept Test in Small Basic v0.7 ' Davey~Wavey, 2009 GraphicsWindow.Width=768 GraphicsWindow.Height=640 GraphicsWindow.Left = 800 GraphicsWindow.Top = 50 GraphicsWindow.PenWidth=0 thisLevel = 1 score = 0 processing = 0 ' a flag used in sub processes to prevent multiple runs digestionDelay= 0 ' delay to prevent multiple tail pieces being eaten at once. angrySnake = 0 ' flag indicating if snake is angry (makes snake faster and chases player) levelConfig() snakeSetup() playerSetup() grass2() snakeSize = level[thisLevel]["snakeSize"] ' this value will change during game as snake eats/is eaten snakeDelay = 0 'level[thisLevel]["snakeDelay"] 'GraphicsWindow.KeyDown=movePlayer Timer.Interval = 10 Timer.Tick = checkKeys ' MAIN LOOP While (snakeSize > 2) ' detect tail collision If (digestionDelay<=0) Then If (math.Abs(player["x"]+10 - snake[snakeSize]["x"]) < 8) And (Math.Abs(player["y"]+10 - snake[snakeSize]["y"]) < 8) AND snake[snakeSize]["delay"] = 0 Then snakeSize = snakeSize - 1 shapes.Remove(snake[snakeSize]["sprite"]) snake[snakeSize]["sprite"] = snake[snakeSize+1]["sprite"] 'level[thisLevel]["snakeDelay"] = level[thisLevel]["snakeDelay"] - (2*thisLevel) snakeDelay=0 ' zero out snake redraw delay so that tail piece gets redrawn immediately (prevents a gap when eating final snake tail piece) digestionDelay = 4000 ' don't allow another piece to be eaten for a while EndIf Else digestionDelay=digestionDelay-1 ' just decrease the delay EndIf ' detect player/snake head collision If (math.Abs(player["x"]+10 - snake[1]["x"]) < 16) And (Math.Abs(player["y"]+10 - snake[1]["y"]) < 16) Then GraphicsWindow.ShowMessage("YOU GOT EATEN!", "EATEN!!!") Program.End() EndIf moveSnake() movePlayer() ' test snake length increase If Mouse.IsLeftButtonDown="True" AND processing=0 Then addSegment() ElseIf Mouse.IsLeftButtonDown="False" And processing=1 Then mUp() EndIf EndWhile GraphicsWindow.ShowMessage("YEAH, YOU WON!!!", "WHOOPIE!") Program.End() ' ===================================================================== Sub checkKeys ' indicate if player is to move playerMove = GraphicsWindow.LastKey EndSub ' ===================================================================== Sub movePlayer If playerMove <> "" Then ' move player If playerMove = "Left" AND player["x"] > 10 Then player["x"] = player["x"] - 1 Shapes.Rotate(player["sprite"], 270) EndIf If playerMove = "Right" AND player["x"] < (graphicsWindow.Width - 30) Then player["x"] = player["x"] + 1 Shapes.Rotate(player["sprite"], 90) EndIf If playerMove = "Up" AND player["y"] > 10 Then player["y"] = player["y"] - 1 Shapes.Rotate(player["sprite"], 0) EndIf If playerMove = "Down" AND player["y"] < (graphicsWindow.Height - 30) Then player["y"] = player["y"] + 1 Shapes.Rotate(player["sprite"], 180) EndIf Shapes.Move( player["sprite"], player["x"], player["y"] ) playerMove = "" EndIf EndSub ' ===================================================================== Sub moveSnake If snakeDelay = 0 Then ' make snake faster when it's angry If angrySnake=0 Then snakeDelay= level[thisLevel]["snakeDelay"] Else snakeDelay= level[thisLevel]["snakeDelay"]/4 EndIf ' move snake For snakePart = 1 To snakeSize ' CHANGE SNAKE POSITION If snakePart=1 Or snake[snakePart]["delay"] = 0 Then ' find out which direction we're moving in dir=text.GetSubText(snake[snakePart]["moves"], 1, 1) If snakePart=1 Then headDir=dir ' remember direction head was moving in, incase a new direction is not chosen below EndIf ' take direction off moves list for this snake part snake[snakePart]["moves"]=Text.GetSubTextToEnd(snake[snakePart]["moves"], 2) ' add this movement onto next snake part's movement list If snakePart < snakeSize Then snake[snakepart+1]["moves"]=text.Append(snake[snakepart+1]["moves"],dir) EndIf If dir = 1 Then snake[snakePart]["y"]=snake[snakePart]["y"]-1 ' moving N ElseIf dir = 2 Then snake[snakePart]["x"]=snake[snakePart]["x"]+1 ' moving E ElseIf dir = 3 Then snake[snakePart]["y"]=snake[snakePart]["y"]+1 ' moving S ElseIf dir = 4 Then snake[snakePart]["x"]=snake[snakePart]["x"]-1 ' moving W EndIf ' adjust for window edge If snake[snakePart]["x"] < 1 Then snake[snakePart]["x"] = GraphicsWindow.Width ElseIf snake[snakePart]["x"] > GraphicsWindow.Width Then snake[snakePart]["x"] = 1 ElseIf snake[snakePart]["y"] < 1 Then snake[snakePart]["y"] = GraphicsWindow.Height ElseIf snake[snakePart]["y"] > GraphicsWindow.Height Then snake[snakePart]["y"] = 1 EndIf EndIf ' DRAW SNAKE PART in new position ' The offsets allow for the various snake segment sizes If snakePart=1 Then offset=math.Floor(headSize/2) ElseIf snakePart<>snakeSize Then offset=math.Floor(bodySize/2) Else offset=math.Floor(tailSize/2) EndIf shapes.Move(snake[snakePart]["sprite"], snake[snakePart]["x"]-offset, snake[snakePart]["y"]-offset ) ' DECREASE SNAKE PART DELAY If snake[snakePart]["delay"] > 0 Then snake[snakePart]["delay"] = snake[snakePart]["delay"] - 1 EndIf EndFor ' if our 'change direction' delay has run out and a 1 in 4 chance is true, let's change the snake direction If snake[1]["delay"] = 0 AND Math.GetRandomNumber(4) = 1 Then ' change snake head direction headDir = Math.GetRandomNumber(4) snake[1]["delay"] = level[thisLevel]["dirDelay"] ' ANGRY SNAKE calculation If (angrySnake = 0) Then rn=Math.GetRandomNumber(10) If (rn=7) Then angrySnake = Math.GetRandomNumber(50)+20 EndIf ElseIf angrySnake > 0 Then GraphicsWindow.Title="ANGRY SNAKE!!!! ="+angrySnake angrySnake=angrySnake-1 EndIf ElseIf snake[1]["delay"]=0 Then ' leave the snake going the same way and delay another direction change for a while snake[1]["delay"] = level[thisLevel]["dirDelay"] EndIf ' if snake is heading into window edge, force a direction change 'If (headDir = 1 And snake[1]["y"] < 20) Then ' headDir = 3 ' go S 'EndIf 'If (headDir = 3 And snake[1]["y"] > GraphicsWindow.Height-(20)) Then ' headDir = 1 ' go N 'EndIf 'If (headDir = 4 And snake[1]["x"] < 20) Then ' headDir = 2 ' go E 'EndIf 'If (headDir = 2 And snake[1]["x"] > GraphicsWindow.Width-(8+20)) Then ' headDir = 4 ' go W 'EndIf ' point snake head in appropriate direction snake[1]["moves"]=headDir ' paint the snake eyes If headDir = 1 Then Shapes.Move( snakeEyes["leftEye"], snake[1]["x"]-6, snake[1]["y"]-5 ) Shapes.Move( snakeEyes["rightEye"], snake[1]["x"]+4, snake[1]["y"]-5 ) ElseIf headDir = 3 Then Shapes.Move( snakeEyes["leftEye"], snake[1]["x"]-6, snake[1]["y"]+5 ) Shapes.Move( snakeEyes["rightEye"], snake[1]["x"]+5, snake[1]["y"]+5 ) ElseIf headDir = 2 Then Shapes.Move( snakeEyes["leftEye"], snake[1]["x"]+5, snake[1]["y"]-6 ) Shapes.Move( snakeEyes["rightEye"], snake[1]["x"]+5, snake[1]["y"]+4 ) ElseIf headDir = 4 Then Shapes.Move( snakeEyes["leftEye"], snake[1]["x"]-5, snake[1]["y"]-6 ) Shapes.Move( snakeEyes["rightEye"], snake[1]["x"]-5, snake[1]["y"]+4 ) EndIf Else ' do nothing with snake, just decrease delay counter snakeDelay=snakeDelay-1 EndIf EndSub ' ===================================================================== Sub addSegment processing=1 ' flag that we're working on it! ' increase snake size and delay movement of new tail snakeSize = snakeSize + 1 snake[snakeSize]["delay"]=snake[snakeSize-1]["delay"]+12 ' need to remove old tail due to Small Basic's layering of graphic shapes Shapes.Remove(snake[snakeSize-1]["sprite"]) ' add a new body part GraphicsWindow.BrushColor="Chocolate" snake[snakeSize-1]["sprite"]=Shapes.AddEllipse(18,18) Shapes.Move(snake[snakeSize-1]["sprite"], snake[snakeSize-1]["x"], snake[snakeSize-1]["y"]) ' add new tail snake[snakeSize]["x"]=snake[snakeSize-1]["x"] snake[snakeSize]["y"]=snake[snakeSize-1]["y"] GraphicsWindow.BrushColor="SandyBrown" snake[snakeSize]["sprite"]=Shapes.AddEllipse(16,16) Shapes.Move(snake[snakeSize]["sprite"], snake[snakeSize]["x"], snake[snakeSize]["y"]) EndSub Sub mUp processing=0 ' cancel the mousedown action - have to do this 'cos the 'puter is much faster than our likkle fingers EndSub ' ===================================================================== Sub snakeSetup For snakePart=1 to level[thisLevel]["snakeSize"] ' create the snake segments If snakePart = 1 Then GraphicsWindow.BrushColor="Brown" snake[snakePart]["sprite"]=Shapes.AddEllipse(headSize,headSize) ' head ElseIf snakePart <> level[thisLevel]["snakeSize"] Then GraphicsWindow.BrushColor="Chocolate" snake[snakePart]["sprite"]=Shapes.AddEllipse(bodySize,bodySize) ' body Else GraphicsWindow.BrushColor="SandyBrown" snake[snakePart]["sprite"]=Shapes.AddEllipse(tailSize,tailSize) ' tail EndIf ' locate snake on screen - probably needs to be part of each level config snake[snakePart]["x"]=level[thisLevel]["snakeX"] snake[snakePart]["y"]=level[thisLevel]["snakeY"] ' as all segments start at the same x,y we must increment the initial delay for each successive segment If snakePart > 2 Then snake[snakePart]["delay"]=((snakePart-1)*(bodySize-4))+4 Else snake[2]["delay"]=bodySize '18 EndIf EndFor ' set initial direction snake[1]["moves"]=level[thisLevel]["snakeDir"] snake[1]["delay"]="0" ' need to initialise delay for snake head - used to determin delay before direction change ' set up the eyes snakeEyes["leftEye"]=Shapes.AddEllipse(3,3) snakeEyes["rightEye"]=Shapes.AddEllipse(3,3) EndSub ' ===================================================================== Sub playerSetup player["x"]=390 player["y"]=400 GraphicsWindow.BrushColor="Lime" player["sprite"]=Shapes.AddRectangle( 20,20 ) Shapes.Move( player["sprite"], player["x"], player["y"] ) EndSub ' ===================================================================== Sub levelConfig headSize = 24 '48'24 ' radius of head bodySize = 18 '36 '18 tailSize = 16 '32 '16 level[1]["snakeX"] =Math.GetRandomNumber(700)+50 level[1]["snakeY"] =Math.GetRandomNumber(500)+50 level[1]["snakeDir"] =math.GetRandomNumber(4) ' start snake off in a random direction: 1=N, 2=E, 3=S, 4=W level[1]["snakeSize"] =10 ' length of snake level[1]["snakeDelay"]=500 ' speed of snake level[1]["dirDelay"] =20 ' delay (moves) before snake can change direction EndSub ' ===================================================================== Sub grass GraphicsWindow.BackgroundColor="DarkGreen" greens[1]="ForestGreen" greens[2]="Green" greens[3]="YellowGreen" greens[4]="OliveDrab" greens[5]="DarkOliveGreen" GraphicsWindow.PenColor="" For x = 1 To 800 Step 5 For y = 1 To 600 Step 5 col = Math.GetRandomNumber(4) GraphicsWindow.BrushColor=greens[col] 'GraphicsWindow.PenColor=col GraphicsWindow.FillEllipse(x,y, Math.GetRandomNumber(30), Math.GetRandomNumber(30)) EndFor EndFor EndSub Sub grass2 map1 = ImageList.LoadImage(Program.Directory + "\grass_128b.png") For x = 0 To 5 For y = 0 To 4 GraphicsWindow.DrawImage (map1, x*128,y*128) EndFor EndFor EndSub End>VHG623.sb< Start>VHH620-0.sb< ' Missile Command Demo 0.3a ' Original Copyright (c) 1980 ATARI ' Ported to Small Basic by Nonki Takahashi ' ' History: ' 0.1a 2013-09-25 Created. (VHH620) ' 0.2a 2013-09-26 End credit and concurrent bomb added. (PVH974) ' 0.3a 2013-09-26 Demo screen added. (VHH620-0) ' Init() GraphicsWindow.FontName = "Consolas" While "True" Caption() Demo() HighScores() GameEnd() EndWhile Sub Init GraphicsWindow.Title = "Missile Command Demo 0.3a" gw = 640 gh = 480 GraphicsWindow.Width = gw GraphicsWindow.Height = gh colors["background"] = "Black" colors["caption"] = "Red" colors["fire"] = "White" colors["normal"] = "Blue" colors["bold"] = "Red" colors["ground"] = "Peru" colors["city"] = "DarkCyan" colors["launcher"] = "Blue" colors["enemy"] = "Red" GraphicsWindow.BackgroundColor = colors["background"] EndSub Sub Caption GraphicsWindow.BrushColor = "Black" mask = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(mask, 0) GraphicsWindow.BrushColor = colors["caption"] GraphicsWindow.FontSize = 150 GraphicsWindow.DrawBoundText(30, 50, 600, "MISSILE COMMAND") Program.Delay(1000) x = "" ' center of bomb y = "" ' center of bomb t = "" ' current time t1 = "" ' middle time t2 = "" ' end time Timer.Interval = 20 Timer.Tick = OnTick For i = 1 To 50 x[i] = Math.GetRandomNumber(gw) y[i] = Math.GetRandomNumber(gh) r = 30 ' (Math.GetRandomNumber(3) + 2) * 10 t1[i] = Math.Floor(r / 5) t2[i] = t1[i] * 2 + 1 t[i] = 1 Shapes.SetOpacity(mask, i * 1.5) Program.Delay(100) EndFor Program.Delay(1000) Timer.Pause() Timer.Tick = DoNothing EndSub Sub OnTick For _i = 1 To 50 If (0 < t[_i]) And (t[_i] <= t2[_i]) Then Bomb() EndIf EndFor EndSub Sub Bomb ' param _i - bomb index ' param x, y - center of fire Timer.Pause() If t[_i] <= t1[_i] Then GraphicsWindow.BrushColor = colors["fire"] r1 = 5 + (t[_i] - 1) * 5 GraphicsWindow.FillEllipse(x[_i] - r1, y[_i] - r1, 2 * r1, 2 * r1) t[_i] = t[_i] + 1 ElseIf t[_i] <= t2[_i] Then r1 = 5 + (t2[_i] - t[_i]) * 5 GraphicsWindow.BrushColor = colors["background"] r2 = r1 + 1 GraphicsWindow.FillEllipse(x[_i] - r2, y[_i] - r2, 2 * r2, 2 * r2) If t[_i] < t2[_i] Then r3 = r1 - 5 r4 = r1 * 5 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(r4, r4, r4) GraphicsWindow.FillEllipse(x[_i] - r3, y[_i] - r3, 2 * r3, 2 * r3) EndIf t[_i] = t[_i] + 1 EndIf Timer.Resume() EndSub Sub Demo City_Init() GraphicsWindow.BrushColor = colors["ground"] GraphicsWindow.FillRectangle(0, city["y"], gw, gh - city["y"]) For i = 1 To city["num"] x = (i - 1) * 70 + 10 city["x"][i] = x + 30 y = city["y"] If i = 1 Or i = 5 Or i = 9 Then GraphicsWindow.BrushColor = colors["ground"] GraphicsWindow.FillEllipse(x - 5, y - 15, 70, 70) Else City_Draw() EndIf EndFor mx = "" ' missile position my = "" ' missile position ma = "" ' missile angle mt = "" ' current time Timer.Interval = 20 Timer.Tick = OnTickMissile For j = 1 To 10 mx[j] = Math.GetRandomNumber(gw) my[j] = 0 target = Math.GetRandomNumber(city["num"]) x = city["x"][target] - mx[j] y = city["y"] - my[j] Math_CartesianToPolar() ma[j] = a mt[j] = 1 Program.Delay(300) EndFor Program.Delay(3000) Timer.Pause() Timer.Tick = DoNothing EndSub Sub DoNothing EndSub Sub OnTickMissile For _j = 1 To 10 If 0 < mt[_j] Then Missile_Move() EndIf EndFor EndSub Sub Missile_Move ' param _j - missile index ' param mx,my - missile position ' param ma - missile angle Timer.Pause() _a = Math.GetRadians(ma[_j]) _x = mx[_j] + 4 * Math.Cos(_a) _y = my[_j] + 4 * Math.Sin(_a) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = colors["enemy"] GraphicsWindow.SetPixel(mx[_j], my[_j], colors["enemy"]) GraphicsWindow.DrawLine(mx[_j], my[_j], _x, _y) GraphicsWindow.SetPixel(_x, _y, "Yellow") mx[_j] = _x my[_j] = _y Timer.Resume() EndSub Sub City_Init GraphicsWindow.Clear() bldg["num"] = 12 bldg["width"] = 5 bldg["height"] = "1=10;2=30;3=25;4=25;5=10;6=40;7=20;8=30;9=35;10=15;11=5;12=10;" city["y"] = gh - 30 city["num"] = 9 EndSub Sub City_Draw Stack.PushValue("local", i) GraphicsWindow.BrushColor = colors["city"] _x = x For i = 1 To bldg["num"] _y = y - bldg["height"][i] GraphicsWindow.FillRectangle(_x, _y, bldg["width"], bldg["height"][i]) _x = _x + bldg["width"] EndFor i = Stack.PopValue("local") EndSub Sub HighScores EndSub Sub GameEnd GraphicsWindow.BackgroundColor = "Red" GraphicsWindow.Clear() GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenWidth = 0 GraphicsWindow.FontSize = 120 theEnd = Shapes.AddText("THE END") Shapes.Move(theEnd, 90, 160) Shapes.SetOpacity(theEnd, 0) x1 = 400 '356 y1 = 1200 '2400 x2 = 1600 '3200 y2 = 300 '267 t1 = Shapes.AddTriangle(0, 0, x1, 0, 0, y1) t2 = Shapes.AddTriangle(0, gh, x1, gh, 0, gh - y1) t3 = Shapes.AddTriangle(gw, 0, gw - x1, 0, gw, y1) t4 = Shapes.AddTriangle(gw, gh, gw - x1, gh, gw, gh - y1) t5 = Shapes.AddTriangle(0, 0, x2, 0, 0, y2) t6 = Shapes.AddTriangle(0, gh, x2, gh, 0, gh - y2) t7 = Shapes.AddTriangle(gw, 0, gw - x2, 0, gw, y2) t8 = Shapes.AddTriangle(gw, gh, gw - x2, gh, gw, gh - y2) imax = 20 For i = 0 To imax - 1 SizeOctagon() EndFor Shapes.SetOpacity(theEnd, 100) For i = imax - 1 To 0 Step -1 SizeOctagon() EndFor GraphicsWindow.BackgroundColor = colors["background"] GraphicsWindow.Clear() EndSub Sub SizeOctagon If Math.Remainder(i, 2) = 0 Then GraphicsWindow.BackgroundColor = "White" Else GraphicsWindow.BackgroundColor = "Blue" EndIf Shapes.Move(t1, -i * gw / 2 / imax, 0) Shapes.Move(t2, -i * gw / 2 / imax, 0) Shapes.Move(t3, i * gw / 2 / imax, 0) Shapes.Move(t4, i * gw / 2 / imax, 0) Shapes.Move(t5, 0, -i * gh / 2 / imax) Shapes.Move(t6, 0, i * gh / 2 / imax) Shapes.Move(t7, 0, -i * gh / 2 / imax) Shapes.Move(t8, 0, i * gh / 2 / imax) Program.Delay(200) EndSub Sub Math_CartesianToPolar ' Math | convert cartesian coodinate to polar coordinate ' param x, y - cartesian coordinate ' return r, a - polar coordinate r = Math.SquareRoot(x * x + y * y) If x = 0 And y > 0 Then a = 90 ' [degree] ElseIf x = 0 And y < 0 Then a = -90 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf If x < 0 Then a = a + 180 ElseIf x > 0 And y < 0 Then a = a + 360 EndIf EndSub End>VHH620-0.sb< Start>VHH620.sb< ' Missile Command Demo ' Original Copyright (c) 1980 ATARI ' Ported to Small Basic by Nonki Takahashi ' Init() Caption() Demo() HighScores() Sub Init gw = 640 gh = 480 GraphicsWindow.Width = gw GraphicsWindow.Height = gh colors["background"] = "Black" colors["caption"] = "Red" colors["fire"] = "Yellow" colors["normal"] = "Blue" colors["bold"] = "Red" colors["ground"] = "Peru" colors["city"] = "Cyan" colors["launcher"] = "Blue" colors["enemy"] = "Red" GraphicsWindow.BackgroundColor = colors["background"] EndSub Sub Caption GraphicsWindow.BrushColor = colors["caption"] GraphicsWindow.FontName = "Consolas" GraphicsWindow.FontSize = 150 GraphicsWindow.DrawBoundText(30, 50, 600, "MISSILE COMMAND") Program.Delay(1000) For i = 1 To 50 x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh) r = (Math.GetRandomNumber(3) + 2) * 10 d = 10 Bomb() EndFor EndSub Sub Bomb ' param x, y - center of fire ' param r - radius of fire ' param d - delay [ms] (default 100) GraphicsWindow.BrushColor = colors["fire"] For r1 = 5 To r Step 5 GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1) Program.Delay(d) EndFor For r1 = r To 5 Step -5 GraphicsWindow.BrushColor = colors["background"] r2 = r1 + 1 GraphicsWindow.FillEllipse(x - r2, y - r2, 2 * r2, 2 * r2) r3 = r1 - 5 r4 = r1 * 5 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(r4, r4, 0) GraphicsWindow.FillEllipse(x - r3, y - r3, 2 * r3, 2 * r3) Program.Delay(d) EndFor EndSub Sub Demo EndSub Sub HighScores EndSub End>VHH620.sb< Start>VHK875.sb< ' SmallBasic Version 1.0 ' Funktion: BuuhLoween - TextShape Animation ' Autor: Pappa Lapub ' Herkunft: ' ImportURL: http://smallbasic.com/program/? ' Extension: ' Kommentar: ' ' Variablen: ' ' ToDo: Add EasterEgg ' OK : LeftShift + Space (also maybe later; not need to be simult.) changes BGColor ' -------------------------------------------------------------------------------- GW = GraphicsWindow.Width GH = GraphicsWindow.Height GraphicsWindow.BackgroundColor = "Black" Show = "True" GraphicsWindow.BrushColor = "Red" buuhSize = 12 buuhShape = Shapes.AddText("") GraphicsWindow.FontName = "Wingdings" Skull = Shapes.AddText("") Blood = Shapes.AddText("") GraphicsWindow.FontName = "Tahoma" GraphicsWindow.BrushColor = "Lime" halloSize = 72 GraphicsWindow.FontSize = HalloSize halloShape = Shapes.AddText("") GraphicsWindow.KeyDown = OnKeyDown While "True" If Show Then GraphicsWindow.Title = "Running Animation..." buuhTxt = "Buuh!" fSize = buuhSize twHalf = 0.3 * fSize * Text.GetLength(buuhTxt) StartX = GW/2 - twHalf StartY = GH - fSize Shapes.Move(buuhShape, StartX,StartY) Program.Delay(1000) Shapes.SetText(buuhShape, buuhTxt) dZoom = 1 For Up = 1 To GH/2 + 10 Shapes.Move(buuhShape, StartX,StartY - Up) If Math.Remainder(Up, 2) = 0 Then StartX = StartX - 0.2 dZoom = dZoom + 0.1 Shapes.Zoom(buuhShape, dZoom,dZoom) EndIf Program.Delay(5) EndFor Program.Delay(1000)' Shapes.Move(Skull, GW/2 - fSize*dZoom, Up + fSize*dZoom - 30) Shapes.SetText(Skull, "N") ' Wingdings # for skull 0x804E Shapes.Zoom(Skull, dZoom,dZoom) Program.Delay(600) Shapes.Move(Blood, GW/2, Up + fSize*dZoom - 70) Shapes.SetText(Blood, "S") ' Wingdings # for tear 0x53 Shapes.Zoom(Blood, dZoom,dZoom) Program.Delay(1000) halloTxt = "HalloWien" fSize = halloSize twHalf = fSize/3.2 * Text.GetLength(halloTxt) Shapes.SetText(halloShape, halloTxt) Shapes.Move(halloShape, GW/2 - twHalf,(Shapes.GetTop(buuhShape) - 60 - fSize)/2) For dX = 0.1 To 1 Step 0.01 Shapes.Zoom(halloShape, dX,1) Program.Delay(40) EndFor Show = "" GraphicsWindow.Title = "Ready. Press any key but 'Escape' to repeat" Else Program.Delay(100) EndIf EndWhile ' ////////// EVENTs \\\\\\\\\\ Sub OnKeyDown If GraphicsWindow.LastKey = "LeftShift" Then ShftFlag = "True" EndIf If GraphicsWindow.LastKey = "Space" And ShftFlag Then ShftFlag = "" EasterEgg() EndIf If GraphicsWindow.LastKey = "Escape" Then Program.End() Else If Show = "" Then Show = "True" Shapes.SetText(buuhShape,"") Shapes.SetText(Blood,"") Shapes.SetText(Skull,"") Shapes.SetText(halloShape,"") EndIf EndIf EndSub ' ////////// SUBs \\\\\\\\\\ Sub EasterEgg GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() EndSub End>VHK875.sb< Start>VHP408.sb< ' ' Dialog Test ' V: 0.9.1.3.0 ' Created for Data Extension 0.9.1.3 and Small Basic 0.9.5 ' Created by Oskariok, http://dataextension.webatu.com ' Test program for all dialogs ' TextWindow.WriteLine(Dialogs.AskForColor()) TextWindow.WriteLine(Dialogs.AskForTextLine("1 + 1?", "?")) Dialogs.AskForFont() TextWindow.WriteLine(Dialogs.LastFontName) TextWindow.WriteLine(Dialogs.LastFontSize) TextWindow.WriteLine(Dialogs.AskForDirectory()) TextWindow.WriteLine(Dialogs.AskForSaveLocation("")) TextWindow.WriteLine(Dialogs.AskForFile("")) TextWindow.WriteLine(Dialogs.AskForFiles("")) TextWindow.Read() End>VHP408.sb< Start>VHR395-0.sb< GraphicsWindow.Show() GraphicsWindow.Height = 500 GraphicsWindow.Width = 800 GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "The Binary Program v0.7" GraphicsWindow.PenColor = "Lime" GraphicsWindow.FontBold = "True" loader() Sub loader'-------------------LOADING MENU AT START SO PROGRAM IS NOT UNLOADED----------------------------------------------------------- 'LOADER PARAMS GraphicsWindow.PenColor = "Lime" GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.FontSize = 50 GraphicsWindow.DrawBoundText(260,220,5000,"LOADING") 'Hides shapes before they are drawn Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) dot1 = Shapes.AddRectangle(10,10) Shapes.Move(dot1,520,260) dot2 = Shapes.AddRectangle(10,10) Shapes.Move(dot2,540,260) dot3 = Shapes.AddRectangle(10,10) Shapes.Move(dot3,560,260) 'LOADING ANIMATION Shapes.ShowShape(dot1) Program.Delay(300) Shapes.ShowShape(dot2) Program.Delay(300) Shapes.ShowShape(dot3) Program.Delay(300) Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) Program.Delay(300) Shapes.ShowShape(dot1) Program.Delay(300) Shapes.ShowShape(dot2) Program.Delay(300) Shapes.ShowShape(dot3) Program.Delay(300) Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) Program.Delay(300) Endsub showMenu:'----------------MAIN MENU-------------------------- GraphicsWindow.Clear() GraphicsWindow.FontBold = "True" GraphicsWindow.BrushColor = "Lime" Shape1 = Shapes.AddRectangle(3000,50) Shape2 = Shapes.AddRectangle(3000,50) Shape3 = Shapes.AddRectangle(3000,50) Shapes.Move(Shape1,395,150) Shapes.Move(Shape2,395,250) Shapes.Move(Shape3,395,350) Shapes.HideShape(Shape1) Shapes.HideShape(Shape2) Shapes.HideShape(Shape3) GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = "60" GraphicsWindow.BrushColor = "HotPink" GraphicsWindow.FillRectangle(0,90,1000,3) GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.DrawBoundText(50,30,1000,"The Binary Program") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.FillEllipse(20,150,150,75) GraphicsWindow.FillEllipse(20,250,150,75) GraphicsWindow.FillEllipse(20,350,150,75) GraphicsWindow.FillRectangle(95,150,300,50) GraphicsWindow.FillRectangle(95,250,300,50) GraphicsWindow.FillRectangle(95,350,300,50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = "30" GraphicsWindow.DrawBoundText(95,150,300," Binary Code Table") GraphicsWindow.DrawBoundText(95,250,300," Text To Binary") GraphicsWindow.DrawBoundText(95,350,300," Binary To Text") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BrushColor = "Orange" GraphicsWindow.FontSize = "15" GraphicsWindow.FontName = "Broadway" GraphicsWindow.DrawBoundText(0,-3,800,"By: Kyle Mitchel") GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bbox = Shapes.AddRectangle(800,500) Shapes.Move (bbox, 0, 0) For lwp = 100 To 0 Step -1 Shapes.SetOpacity(bbox, lwp) Program.Delay(20) EndFor GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor = "Lime" mouseMove: x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x>95 And x<396 And y>149 And y<201) Then Shapes.ShowShape(Shape1) Shapes.HideShape(Shape2) Shapes.HideShape(Shape3) ElseIf (x>95 And x<396 And y>249 And y<301) Then Shapes.ShowShape(Shape2) Shapes.HideShape(Shape1) Shapes.HideShape(Shape3) ElseIf (x>95 And x<396 And y>349 And y<401) Then Shapes.ShowShape(Shape3) Shapes.HideShape(Shape1) Shapes.HideShape(Shape2) endif If Mouse.IsLeftButtonDown then Goto buttonDown endIf Goto mouseMove buttonDown: x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x>95 And x<396 And y>149 And y<201) Then menu1() Goto continue ElseIf (x>95 And x<396 And y>249 And y<301) Then TToB() ElseIf (x>95 And x<396 And y>349 And y<401) Then BToT() EndIf Goto mouseMove continue: Sub menu1 GraphicsWindow.Clear() Shapes.Remove(Shape1) Shapes.Remove(Shape2) Shapes.Remove(Shape3) GraphicsWindow.FontName = "Arial Bold" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,0,800,600) GraphicsWindow.BrushColor = "HotPink" GraphicsWindow.FontSize = "25" GraphicsWindow.DrawBoundText(30,30,750,"A - 01000001 K - 01001011 U - 01010101") GraphicsWindow.DrawBoundText(30,75,750,"B - 01000010 L - 01001100 V - 01010110") GraphicsWindow.DrawBoundText(30,115,750,"C - 01000011 M - 01001101 W - 01010111") GraphicsWindow.DrawBoundText(30,155,750,"D - 01000100 N - 01001110 X - 01011000") GraphicsWindow.DrawBoundText(30,195,750,"E - 01000101 O - 01001111 Y - 01011001") GraphicsWindow.DrawBoundText(30,235,750,"F - 01000110 P - 01010000 Z - 01011010") GraphicsWindow.DrawBoundText(30,275,750,"G - 01000111 Q - 01010001") GraphicsWindow.DrawBoundText(30,315,750,"H - 01001000 R - 01010010") GraphicsWindow.DrawBoundText(30,355,750,"I - 01001001 S - 01010011") GraphicsWindow.DrawBoundText(30,395,750,"J - 01001010 T - 01010100") 'Goto continue Endsub GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "BlacK" Controls.LoadTheme("Vista") Button=Controls.AddButton(200,50,"Go Back") Controls.Move(Button,450,300) Button2=Controls.AddButton(200,50,"Switch To Lowercase") Controls.Move(Button2,450,350) Controls.RegisterMouseDownEvent(Button2,"Click2") Sub Click2 EndSub Controls.RegisterMouseDownEvent(Button,"Click") Sub Click EndSub Sub Lower GraphicsWindow.DrawBoundText(30,30,750,"a - 01100001 k - 01101011 u - 01110101") GraphicsWindow.DrawBoundText(30,75,750,"b - 01100010 l - 01101100 v - 01110110") GraphicsWindow.DrawBoundText(30,115,750,"c - 01100011 m - 01101101 w - 01110111") GraphicsWindow.DrawBoundText(30,155,750,"d - 01100100 n - 01101110 x - 01111000") GraphicsWindow.DrawBoundText(30,195,750,"e - 01100101 o - 01101111 y - 01111001") GraphicsWindow.DrawBoundText(30,235,750,"f - 01100110 p - 01110000 z - 01111010") GraphicsWindow.DrawBoundText(30,275,750,"g - 01100111 q - 01110001") GraphicsWindow.DrawBoundText(30,315,750,"h - 01101000 r - 01110010") GraphicsWindow.DrawBoundText(30,355,750,"i - 01101001 s - 01110011") GraphicsWindow.DrawBoundText(30,395,750,"j - 01101010 t - 01110100") endsub GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "BlacK" Controls.LoadTheme("Vista") Button1=Controls.AddButton(200,50,"Go Back") Controls.Move(Button1,450,300) Controls.RegisterMouseDownEvent(Button,"Click1") Button22=Controls.AddButton(200,50,"Switch To Uppercase") Controls.Move(Button2,450,350) Controls.RegisterMouseDownEvent(Button22,"Click22") Sub Click22 menu1() EndSub bbox = Shapes.AddRectangle(800,500) Shapes.Move (bbox, 0, 0) For lwp = 100 To 0 Step -1 Shapes.SetOpacity(bbox, lwp) Program.Delay(20) EndFor GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor = "Lime" Goto waitMouse waitMouse: If (Mouse.IsLeftButtonDown) Then Goto waitMouse ' this first check just waits until the original menu mouseclick is released EndIf waitMouse2: If (Mouse.IsLeftButtonDown) Then Goto showMenu ' now we have clicked again, we can return to menu EndIf Goto waitMouse2 Sub TToB GraphicsWindow.Hide() l = ":_= ;a=10;b=01;c=110;d=001;e=101;f=0110;g=1110;h=0001;i=1001;j=0101;k=1101;l=0011;m=0111;n=1111;o=01111;p=00001;q=10001;r=01001;s=11001;t=00101;u=010101;v=01101;w=11101;x=00011;y=10011;z=01011" TextWindow.WriteLine(" Text To Binary Code Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter Any Word Or Phrase: ") nname = textwindow.read() name = Text.ConvertToLowerCase(nname) TextWindow.WriteLine("") value = 0 TextWindow.WriteLine("") For i = 1 To Text.GetLength(name) letter[i] = Text.GetSubText(name, i, 1) value[i] = l[letter[i]] if letter[i] <> " " then TextWindow.Write(value[i] + " ") Else TextWindow.Write("") EndIf tvalue = tvalue + value[i] EndFor TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.Write("Exit (Y/N)?: ") exit = TextWindow.Read() If exit = "Y" Then TextWindow.Hide() GraphicsWindow.Show() ElseIf exit = "y" Then TextWindow.Hide() GraphicsWindow.Show() elseif exit = "N" Then TextWindow.Clear() TToB() elseif exit = "n" then TextWindow.Clear() TToB() EndIf EndSub Sub FAIL l = ":10=a;01=b;110=c;001=d;101=e;0110=f;1110=g;0001=h;1001=i;0101=j;1101=k;0011=l;0111=m;1111=n;01111=o;00001=p;10001=q;01001=r;11001=s;00101=t;010101=u;01101=v;11101=w;00011=x;10011=y;01011=z" TextWindow.WriteLine(" Text To Binary Code Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter Any Word Or Phrase: ") nname = textwindow.read() name = Text.ConvertToLowerCase(nname) TextWindow.WriteLine("") value = 0 TextWindow.WriteLine("") For i = 1 To Text.GetLength(name) number[i] = Text.GetSubText(name, i, 1) values[i] = l[number[i]] if letter[i] <> " " then TextWindow.Write(values[i] + " ") Else TextWindow.Write("") EndIf tvalues = tvalues + values[i] EndFor TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.Write("Exit (Y/N)?: ") exit = TextWindow.Read() If exit = "Y" Then TextWindow.Hide() ElseIf exit = "y" Then TextWindow.Hide() elseif exit = "N" Then TextWindow.Clear() TToB() elseif exit = "n" then TextWindow.Clear() TToB() EndIf EndSub Sub BToT TextWindow.WriteLine(" Binary Code To Text Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter your first letter in binary code: ") binary1 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your second letter in binary code: ") binary2 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your third letter in binary code: ") binary3 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your fourth letter in binary code: ") binary4 = TextWindow.Read() TextWindow.Clear() If binary1*1=binary1 Then Goto cont ElseIf binary2*1=binary2 Then Goto cont ElseIf binary3*1=binary3 Then Goto cont ElseIf binary4*1=binary4 Then Goto cont Else TextWindow.WriteLine("Invalid Format!") EndIf cont: If binary1 = "10" Then TextWindow.Write("A") ElseIf binary1 = "01" Then TextWindow.Write("B") ElseIf binary1 = "01" Then TextWindow.Write("C") ElseIf binary1 = "01" Then TextWindow.Write("D") ElseIf binary1 = "01" Then TextWindow.Write("E") ElseIf binary1 = "01" Then TextWindow.Write("F") ElseIf binary1 = "01" Then TextWindow.Write("G") ElseIf binary1 = "01" Then TextWindow.Write("H") ElseIf binary1 = "01" Then TextWindow.Write("I") ElseIf binary1 = "01" Then TextWindow.Write("J") ElseIf binary1 = "01" Then TextWindow.Write("K") ElseIf binary1 = "01" Then TextWindow.Write("L") ElseIf binary1 = "01" Then TextWindow.Write("M") ElseIf binary1 = "01" Then TextWindow.Write("N") ElseIf binary1 = "01" Then TextWindow.Write("O") ElseIf binary1 = "01" Then TextWindow.Write("P") ElseIf binary1 = "01" Then TextWindow.Write("Q") ElseIf binary1 = "01" Then TextWindow.Write("R") ElseIf binary1 = "01" Then TextWindow.Write("S") ElseIf binary1 = "01" Then TextWindow.Write("T") ElseIf binary1 = "01" Then TextWindow.Write("U") ElseIf binary1 = "01" Then TextWindow.Write("V") ElseIf binary1 = "01" Then TextWindow.Write("W") ElseIf binary1 = "01" Then TextWindow.Write("X") ElseIf binary1 = "01" Then TextWindow.Write("Y") ElseIf binary1 = "01" Then TextWindow.Write("Z") EndIf EndSub '########NON-WORKING CLOCK########################## S = 100 While (S>1) GraphicsWindow.BrushColor = "Orange" Date = Clock.Date Time = Clock.Time GraphicsWindow.DrawText(0,450,Date + " " + Time) Program.Delay(50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,450,1000,1000) Endwhile End>VHR395-0.sb< Start>VHR395.sb< GraphicsWindow.Show() GraphicsWindow.Height = 500 GraphicsWindow.Width = 800 GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "The Binary Program v0.7" GraphicsWindow.PenColor = "Lime" GraphicsWindow.FontBold = "True" loader() Sub loader'-------------------LOADING MENU AT START SO PROGRAM IS NOT UNLOADED----------------------------------------------------------- 'LOADER PARAMS GraphicsWindow.PenColor = "Lime" GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.FontSize = 50 GraphicsWindow.DrawBoundText(260,220,5000,"LOADING") 'Hides shapes before they are drawn Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) dot1 = Shapes.AddRectangle(10,10) Shapes.Move(dot1,520,260) dot2 = Shapes.AddRectangle(10,10) Shapes.Move(dot2,540,260) dot3 = Shapes.AddRectangle(10,10) Shapes.Move(dot3,560,260) 'LOADING ANIMATION Shapes.ShowShape(dot1) Program.Delay(300) Shapes.ShowShape(dot2) Program.Delay(300) Shapes.ShowShape(dot3) Program.Delay(300) Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) Program.Delay(300) Shapes.ShowShape(dot1) Program.Delay(300) Shapes.ShowShape(dot2) Program.Delay(300) Shapes.ShowShape(dot3) Program.Delay(300) Shapes.HideShape(dot1) Shapes.HideShape(dot2) Shapes.HideShape(dot3) Program.Delay(300) Endsub showMenu:'----------------MAIN MENU-------------------------- GraphicsWindow.Clear() GraphicsWindow.FontBold = "True" GraphicsWindow.BrushColor = "Lime" Shape1 = Shapes.AddRectangle(3000,50) Shape2 = Shapes.AddRectangle(3000,50) Shape3 = Shapes.AddRectangle(3000,50) Shapes.Move(Shape1,395,150) Shapes.Move(Shape2,395,250) Shapes.Move(Shape3,395,350) Shapes.HideShape(Shape1) Shapes.HideShape(Shape2) Shapes.HideShape(Shape3) GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = "60" GraphicsWindow.BrushColor = "HotPink" GraphicsWindow.FillRectangle(0,90,1000,3) GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.DrawBoundText(50,30,1000,"The Binary Program") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.FillEllipse(20,150,150,75) GraphicsWindow.FillEllipse(20,250,150,75) GraphicsWindow.FillEllipse(20,350,150,75) GraphicsWindow.FillRectangle(95,150,300,50) GraphicsWindow.FillRectangle(95,250,300,50) GraphicsWindow.FillRectangle(95,350,300,50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = "30" GraphicsWindow.DrawBoundText(95,150,300," Binary Code Table") GraphicsWindow.DrawBoundText(95,250,300," Text To Binary") GraphicsWindow.DrawBoundText(95,350,300," Binary To Text") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.BrushColor = "Orange" GraphicsWindow.FontSize = "15" GraphicsWindow.FontName = "Broadway" GraphicsWindow.DrawBoundText(0,-3,800,"By: Kyle Mitchel") GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bbox = Shapes.AddRectangle(800,500) Shapes.Move (bbox, 0, 0) For lwp = 100 To 0 Step -1 Shapes.SetOpacity(bbox, lwp) Program.Delay(20) EndFor GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor = "Lime" mouseMove: x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x>95 And x<396 And y>149 And y<201) Then Shapes.ShowShape(Shape1) Shapes.HideShape(Shape2) Shapes.HideShape(Shape3) ElseIf (x>95 And x<396 And y>249 And y<301) Then Shapes.ShowShape(Shape2) Shapes.HideShape(Shape1) Shapes.HideShape(Shape3) ElseIf (x>95 And x<396 And y>349 And y<401) Then Shapes.ShowShape(Shape3) Shapes.HideShape(Shape1) Shapes.HideShape(Shape2) endif If Mouse.IsLeftButtonDown then Goto buttonDown endIf Goto mouseMove buttonDown: x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (x>95 And x<396 And y>149 And y<201) Then menu1() ElseIf (x>95 And x<396 And y>249 And y<301) Then TToB() ElseIf (x>95 And x<396 And y>349 And y<401) Then BToT() EndIf Goto mouseMove Sub menu1 GraphicsWindow.Clear() Shapes.Remove(Shape1) Shapes.Remove(Shape2) Shapes.Remove(Shape3) GraphicsWindow.FontName = "Arial Bold" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,0,800,600) GraphicsWindow.BrushColor = "HotPink" GraphicsWindow.FontSize = "25" GraphicsWindow.DrawBoundText(30,30,750,"A - 01000001 K - 01001011 U - 01010101") GraphicsWindow.DrawBoundText(30,75,750,"B - 01000010 L - 01001100 V - 01010110") GraphicsWindow.DrawBoundText(30,115,750,"C - 01000011 M - 01001101 W - 01010111") GraphicsWindow.DrawBoundText(30,155,750,"D - 01000100 N - 01001110 X - 01011000") GraphicsWindow.DrawBoundText(30,195,750,"E - 01000101 O - 01001111 Y - 01011001") GraphicsWindow.DrawBoundText(30,235,750,"F - 01000110 P - 01010000 Z - 01011010") GraphicsWindow.DrawBoundText(30,275,750,"G - 01000111 Q - 01010001") GraphicsWindow.DrawBoundText(30,315,750,"H - 01001000 R - 01010010") GraphicsWindow.DrawBoundText(30,355,750,"I - 01001001 S - 01010011") GraphicsWindow.DrawBoundText(30,395,750,"J - 01001010 T - 01010100") Goto continue Endsub continue: GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "BlacK" Controls.LoadTheme("Vista") Button=Controls.AddButton(200,50,"Go Back") Controls.Move(Button,450,300) Button2=Controls.AddButton(200,50,"Switch To Lowercase") Controls.Move(Button2,450,350) Controls.RegisterMouseDownEvent(Button2,"Click2") Sub Click2 EndSub Controls.RegisterMouseDownEvent(Button,"Click") Sub Click EndSub Sub Lower GraphicsWindow.DrawBoundText(30,30,750,"a - 01100001 k - 01101011 u - 01110101") GraphicsWindow.DrawBoundText(30,75,750,"b - 01100010 l - 01101100 v - 01110110") GraphicsWindow.DrawBoundText(30,115,750,"c - 01100011 m - 01101101 w - 01110111") GraphicsWindow.DrawBoundText(30,155,750,"d - 01100100 n - 01101110 x - 01111000") GraphicsWindow.DrawBoundText(30,195,750,"e - 01100101 o - 01101111 y - 01111001") GraphicsWindow.DrawBoundText(30,235,750,"f - 01100110 p - 01110000 z - 01111010") GraphicsWindow.DrawBoundText(30,275,750,"g - 01100111 q - 01110001") GraphicsWindow.DrawBoundText(30,315,750,"h - 01101000 r - 01110010") GraphicsWindow.DrawBoundText(30,355,750,"i - 01101001 s - 01110011") GraphicsWindow.DrawBoundText(30,395,750,"j - 01101010 t - 01110100") endsub GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "BlacK" Controls.LoadTheme("Vista") Button1=Controls.AddButton(200,50,"Go Back") Controls.Move(Button1,450,300) Controls.RegisterMouseDownEvent(Button,"Click1") Button22=Controls.AddButton(200,50,"Switch To Uppercase") Controls.Move(Button2,450,350) Controls.RegisterMouseDownEvent(Button22,"Click22") Sub Click22 menu1() EndSub bbox = Shapes.AddRectangle(800,500) Shapes.Move (bbox, 0, 0) For lwp = 100 To 0 Step -1 Shapes.SetOpacity(bbox, lwp) Program.Delay(20) EndFor GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor = "Lime" Goto waitMouse waitMouse: If (Mouse.IsLeftButtonDown) Then Goto waitMouse ' this first check just waits until the original menu mouseclick is released EndIf waitMouse2: If (Mouse.IsLeftButtonDown) Then Goto showMenu ' now we have clicked again, we can return to menu EndIf Goto waitMouse2 Sub TToB GraphicsWindow.Hide() l = ":_= ;a=10;b=01;c=110;d=001;e=101;f=0110;g=1110;h=0001;i=1001;j=0101;k=1101;l=0011;m=0111;n=1111;o=01111;p=00001;q=10001;r=01001;s=11001;t=00101;u=010101;v=01101;w=11101;x=00011;y=10011;z=01011" TextWindow.WriteLine(" Text To Binary Code Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter Any Word Or Phrase: ") nname = textwindow.read() name = Text.ConvertToLowerCase(nname) TextWindow.WriteLine("") value = 0 TextWindow.WriteLine("") For i = 1 To Text.GetLength(name) letter[i] = Text.GetSubText(name, i, 1) value[i] = l[letter[i]] if letter[i] <> " " then TextWindow.Write(value[i] + " ") Else TextWindow.Write("") EndIf tvalue = tvalue + value[i] EndFor TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.Write("Exit (Y/N)?: ") exit = TextWindow.Read() If exit = "Y" Then TextWindow.Hide() GraphicsWindow.Show() ElseIf exit = "y" Then TextWindow.Hide() GraphicsWindow.Show() elseif exit = "N" Then TextWindow.Clear() TToB() elseif exit = "n" then TextWindow.Clear() TToB() EndIf EndSub Sub FAIL l = ":10=a;01=b;110=c;001=d;101=e;0110=f;1110=g;0001=h;1001=i;0101=j;1101=k;0011=l;0111=m;1111=n;01111=o;00001=p;10001=q;01001=r;11001=s;00101=t;010101=u;01101=v;11101=w;00011=x;10011=y;01011=z" TextWindow.WriteLine(" Text To Binary Code Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter Any Word Or Phrase: ") nname = textwindow.read() name = Text.ConvertToLowerCase(nname) TextWindow.WriteLine("") value = 0 TextWindow.WriteLine("") For i = 1 To Text.GetLength(name) number[i] = Text.GetSubText(name, i, 1) values[i] = l[number[i]] if letter[i] <> " " then TextWindow.Write(values[i] + " ") Else TextWindow.Write("") EndIf tvalues = tvalues + values[i] EndFor TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.Write("Exit (Y/N)?: ") exit = TextWindow.Read() If exit = "Y" Then TextWindow.Hide() ElseIf exit = "y" Then TextWindow.Hide() elseif exit = "N" Then TextWindow.Clear() TToB() elseif exit = "n" then TextWindow.Clear() TToB() EndIf EndSub Sub BToT TextWindow.WriteLine(" Binary Code To Text Convertor") TextWindow.WriteLine("") TextWindow.Write("Enter your first letter in binary code: ") binary1 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your second letter in binary code: ") binary2 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your third letter in binary code: ") binary3 = TextWindow.Read() TextWindow.Clear() TextWindow.Write("Enter your fourth letter in binary code: ") binary4 = TextWindow.Read() TextWindow.Clear() If binary1*1=binary1 Then Goto cont ElseIf binary2*1=binary2 Then Goto cont ElseIf binary3*1=binary3 Then Goto cont ElseIf binary4*1=binary4 Then Goto cont Else TextWindow.WriteLine("Invalid Format!") EndIf cont: If binary1 = "10" Then TextWindow.Write("A") ElseIf binary1 = "01" Then TextWindow.Write("B") ElseIf binary1 = "01" Then TextWindow.Write("C") ElseIf binary1 = "01" Then TextWindow.Write("D") ElseIf binary1 = "01" Then TextWindow.Write("E") ElseIf binary1 = "01" Then TextWindow.Write("F") ElseIf binary1 = "01" Then TextWindow.Write("G") ElseIf binary1 = "01" Then TextWindow.Write("H") ElseIf binary1 = "01" Then TextWindow.Write("I") ElseIf binary1 = "01" Then TextWindow.Write("J") ElseIf binary1 = "01" Then TextWindow.Write("K") ElseIf binary1 = "01" Then TextWindow.Write("L") ElseIf binary1 = "01" Then TextWindow.Write("M") ElseIf binary1 = "01" Then TextWindow.Write("N") ElseIf binary1 = "01" Then TextWindow.Write("O") ElseIf binary1 = "01" Then TextWindow.Write("P") ElseIf binary1 = "01" Then TextWindow.Write("Q") ElseIf binary1 = "01" Then TextWindow.Write("R") ElseIf binary1 = "01" Then TextWindow.Write("S") ElseIf binary1 = "01" Then TextWindow.Write("T") ElseIf binary1 = "01" Then TextWindow.Write("U") ElseIf binary1 = "01" Then TextWindow.Write("V") ElseIf binary1 = "01" Then TextWindow.Write("W") ElseIf binary1 = "01" Then TextWindow.Write("X") ElseIf binary1 = "01" Then TextWindow.Write("Y") ElseIf binary1 = "01" Then TextWindow.Write("Z") EndIf EndSub '########NON-WORKING CLOCK########################## S = 100 While (S>1) GraphicsWindow.BrushColor = "Orange" Date = Clock.Date Time = Clock.Time GraphicsWindow.DrawText(0,450,Date + " " + Time) Program.Delay(50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,450,1000,1000) Endwhile End>VHR395.sb< Start>VHS349.sb< ' mahreen miangul ' Multiple KeyBoard ' JanUary 'GraphicsWindow.Left = 0.5 * (Desktop.Width - GraphicsWindow.Width) 'GraphicsWindow.Top = 0.5 * (Desktop.Height - GraphicsWindow.Height) GraphicsWindow.top= -2.0 GraphicsWindow.left= 80 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor="blue" GraphicsWindow.Width = "1280" GraphicsWindow.Height = "666" ' ============================== TEXT============================== CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) GraphicsWindow.brushcolor = "AliceBlue" GraphicsWindow.FontSize = 44 msg=Shapes.AddText("HAPPY NEW YEAR 2018!"+CRLF+"2018X-2018Y-2018Z"+CRLF+"mahreen-miangul! "+CRLF+"mussa-maina!") Shapes.Move(msg,420,0) GraphicsWindow.KeyDown = onkeyDown ' ======================Make Image1()Madam Apple======================= MakeImage1() ' ============================== Hill================================ GraphicsWindow.brushColor = "tan" GraphicsWindow.fillEllipse(-88,505,620,288) GraphicsWindow.fillEllipse(211,388,622,366) GraphicsWindow.fillEllipse(211,388,1888,666) '--------------------------------------------------Text 420---------------------------------------------------- GraphicsWindow.brushColor = "Snow" GraphicsWindow.FontSize = 33 GraphicsWindow.DrawText(20, 310, "2018")'>>>>>>>>>>>>>1 GraphicsWindow.DrawText(120, 280, "2018")'>>>>>>>>>>>>>2 GraphicsWindow.DrawText(220, 250, "2018")'>>>>>>>>>>>>>3 GraphicsWindow.DrawText(340, 210, "2018")'>>>>>>>>>>>>>4 GraphicsWindow.DrawText(477, 460, "2018")'>>>>>>>>>>>>>5 GraphicsWindow.DrawText(600, 450, "2018")'>>>>>>>>>>>>>6 GraphicsWindow.DrawText(500, 500, "2018")'>>>>>>>>>>>>>7 GraphicsWindow.DrawText(820, 190, "2018")'>>>>>>>>>>>>>8 GraphicsWindow.DrawText(922, 180, "2018")'>>>>>>>>>>>>>9 GraphicsWindow.DrawText(1022, 400, "2018")'>>>>>>>>>>>>>10 GraphicsWindow.DrawText(1144, 420, "2018")'>>>>>>>>>>>>>11 '=============================Makesprite()============================ SPRITE_init() add_shapes() ' ============================== Aircraft Animation====================== dZ = 0.1 zoom = 1 ddx=0 ddy=0 bdx=0 bdy=0 bdy2=5 ' <------ initial ball2 moving speed-Y ANMB="5:1" BNMB="6:1" ' <----- Blue car shapes number=6 repeat =1 shoot="False" shoot2="False" ' <----- zm=1 Hit_count=0 No_hit=0 ' ------------------------------------------------------STARS--------------------------------------------------------- GraphicsWindow.BrushColor = "yellow" For i = 0 To 80 GraphicsWindow.FontSize = 5+ Math.GetRandomNumber(30) x = Math.GetRandomNumber(GraphicsWindow.Width) y = Math.GetRandomNumber(GraphicsWindow.height/2.6) star[i]=Shapes.AddText("★") '<------------- Shapes.Move(star[i],x,y) '<------------- Program.Delay(10) EndFor ' ----------------------------------------------------MOON-------------------------------------------------------- GraphicsWindow.BrushColor = "yellow" GraphicsWindow.PenWidth=0 '<------------- moon= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(moon,50,50) '<------------- GraphicsWindow.BrushColor = "blue" shadow= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(shadow,60,45) '<------------- ' ============================== Cannon Animation ============================== GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor= "Red" Ball=Shapes.AddEllipse(10,20) Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) GraphicsWindow.BrushColor= "Navy" ' <----- Ball2=Shapes.AddEllipse(10,20) ' <----- Shapes.Move(Ball2,shapes.GetLeft(shp[BNMB][15]),shapes.Gettop(shp[BNMB][15]))' <----- Shapes.HideShape(Ball2) ' <----- ' ============================== BlueCar Timer ==================================== Timer.Interval=800 Timer.Tick=BlueCar_up ' =======================Drag & Drop to Target or Return Home======================= GraphicsWindow.brushColor = "snow" home = "X=0;Y=0" spriteSize = "2018" sprite[1] = Shapes.Addtext("👹") Shapes.Move(sprite[1], home["X"], home["Y"]) spriteTarget[1] = Shapes.Addtext(spriteSize + 0) 'upSize Target for special fx Shapes.Move(spriteTarget[1], 860, 600) Shapes.SetOpacity(spriteTarget[1], 600) '================================Cloud Moving===================================== dx = GraphicsWindow.Width dY = GraphicsWindow.Height GraphicsWindow.BrushColor = "silver" GraphicsWindow.FontSize = 122 x = x + dX - 44 y = y + dY - 550 cloud() Sub cloud cloud = Shapes.Addtext("🌁") Shapes.Animate(cloud,x,y,22000) Endsub Shapes.Animate(cloud,x,y,0) Program.Delay(800) cloud() '============================Mouse Click and Drag to Targrt================================ While "True" ' And "North" <> "South" <--- No meanig , it always "True" mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown Then 'handle click and select If selected = "" And clicked = "False" Then 'can loop thru here for more than 1 box If mseX >= home["X"] And mseX <= home["X"] + spriteSize And mseY >= home["Y"] And mseY <= home["Y"] + spriteSize Then selected = 1 'box number EndIf EndIf clicked = "True" 'the mse has been clicked for this frame Shapes.Move(sprite[selected], mseX, mseY) Else If Math.Round(mseX/50) = Math.Round(Shapes.GetLeft(spriteTarget[selected])/50) Then If Math.Round(mseY/50) = Math.Round(Shapes.GetTop(spriteTarget[selected])/50) Then Shapes.Remove(sprite[selected]) Shapes.SetOpacity(spriteTarget[selected], 100) EndIf EndIf Shapes.Move(sprite[selected], home["X"], home["Y"]) selected = "" 'deselect when finishised with the box clicked = "False" 'inits here, get ready for next click EndIf Program.Delay(20) 'EndWhile ' <----------- no use 'While 0=0 ' <----------- no use '============================Aircraft Blinking Program======================= zoom = zoom - dZ For i = 1 To Array.GetItemCount(shape[5]) If Array.ContainsValue(shape[5][i], "eye") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) ElseIf Array.ContainsValue(shape[5][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], zoom, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx,shapes.Gettop(shp[ANMB][i])+ddy) EndFor If zoom = 0.1 Or zoom = 1 Then dZ = -dZ EndIf ' ============================Star Blinking and ShootingProgram========================== 'While zm<6 'If zm<6 Then ' <<<<>>>> mmm= Math.GetRandomNumber(80) ' blinking star number _op=Shapes.GetOpacity(star[mmm]) ' opacity ... brightness If _op>50 Then Shapes.SetOpacity(star[mmm],Math.GetRandomNumber(49)) ' darker Else Shapes.SetOpacity(star[mmm],50+Math.GetRandomNumber(50)) ' brighter EndIf If mmm=50 Then Shapes.Move(star[0],400+Math.GetRandomNumber(700),-200) Shapes.Animate(star[0],Math.GetRandomNumber(500),2200,2000) 'shooting star Program.Delay(30) zm=zm+0.1 '===============================Moon Opacity and Zoom=============================== Shapes.Zoom(moon,zm,zm) ' moon becomes bigger Shapes.Zoom(shadow,zm,zm)' shadow becomes bigger Shapes.Move(moon,shapes.GetLeft(moon)+1,shapes.GetTop(moon)+1) Shapes.Move(shadow,shapes.GetLeft(shadow)+2,shapes.GetTop(shadow)+1) EndIf Program.Delay(20) ' <<<<>>>> 'endif 'endwhile '============================Aircraft Reverse Moving=====X,Y Direction============= cycleX= shapes.GetLeft(shp[ANMB][5]) cycleY= shapes.GetTop(shp[ANMB][5]) If cycleX<0 Or cycleX>GraphicsWindow.Width Then ddx=-ddx EndIf If cycleY<0 Or cycleY>200 Then ddy=-ddy EndIf ' ===========================BallFire======================================= If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)-bdx/2,shapes.Gettop(ball)-bdy/2) If shapes.Gettop(ball)>700 Then shoot="False" No_hit=No_hit+1 GraphicsWindow.Title="You Hit !!!!!! Total "+(Hit_count*10-No_hit*5) +" Points get" Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) EndIf '==========================Collision Check Here================================= BCar_X=shapes.GetLeft(shp[BNMB][5]) BCar_Y=shapes.GetTop(shp[BNMB][5]) ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (BCar_X>>> shape[5][13] = "func=ell;x=-177;y=270;width=25;height=25;angle=0;bc=Gainsboro;pc=darkslategray;pw=4;tag=eye" ' eye 2 ' <<<<>>>> shape[5][14] = "func=ell;x=-250;y=177;width=44;height=22;angle=0;bc=deeppink;pc=yellow;pw=2;tag=mouth" ' ' <<<<>>>> shape[5][15] = "func=ell;x=-255;y=166;width=22;height=44;angle=0;bc=yellow;pc=deeppink;pw=2;tag=mouth" ' ' <<<<>>>> ' Car s[6] ="1=0.5" shX[6] ="1=820" shY[6] ="1=540" shape[6][1] = "func=rect;x=0;y=20;width=36;height=44;bc=#000000;pw=0;" shape[6][2] = "func=rect;x=77;y=23;width=36;height=44;bc=#000000;pw=0;" shape[6][3] = "func=rect;x=0;y=154;width=36;height=44;bc=#000000;pw=0;" shape[6][4] = "func=rect;x=77;y=156;width=36;height=44;bc=#000000;pw=0;" shape[6][5] = "func=rect;x=11;y=0;width=93;height=230;bc=#000000;pw=0;" shape[6][6] = "func=rect;x=17;y=25;width=81;height=55;bc=#00000;pw=0;" shape[6][7] = "func=rect;x=27;y=35;width=62;height=48;bc=#000000;pw=0;" shape[6][8] = "func=line;x=17;y=24;x1=11;y1=14;x2=0;y2=0;pc=#000000;pw=2;" shape[6][9] = "func=line;x=87;y=23;x1=0;y1=16;x2=12;y2=0;pc=#000000;pw=2;" shape[6][10] = "func=rect;x=17;y=85;width=81;height=134;bc=darkslategray;pw=0;" shape[6][11]="func=ell;x=18;y=7;width=29;height=19;angle=-50;bc=snow;pw=0.5" shape[6][12]="func=ell;X=70;Y=7;width=29;height=19;angle=50;bc=mediumslateblue;pw=0.5" shape[6][13]="func=rect;X=14;Y=180;width=33;height=15;angle=40;bc=snow;pc=darkslategray;pw=0" shape[6][14]="func=rect;X=72;Y=180;width=33;height=15;angle=-40;bc=mediumslateblue;pc=darkslategray;pw=0" shape[6][15]="func=rect;x=50;y=-20;width=22;height=66;angle=0;bc=mediumslateblue;pc=darkslategray;pw=0" '<------ cannon for ball2 'shape[6][16]="func=ell;X=-420;Y=-880;width=15;height=25;angle=50;bc=saddlebrown;pc=cornsilk;pw=1.5" 'shape[6][17]="func=rect;x=-420;y=-800;width=50;height=50;angle=-40;bc=saddlebrown;pc=cornsilk;pw=2" ' Tree s[7]="1=0.8;2=.8;3=.8;4=.8;" shX[7]="1=10;2=150;3=920;4=1100" shY[7]="1=300;2=300;3=330;4=330" ' 5,6,13,14 shape[7]=shape[1] 'Apple s[8] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=.2;8=.2;" shX[8] ="1=140;2=650;3=-80;4=0;5=100;6=740;7=920;8=1100" shY[8] ="1=444;2=420;3=440;4=420;5=420;6=420;7=480;8=460" endsub End>VHS349.sb< Start>VHT007-0.sb< ' Deal 0.6 ' Copyright (c) 2012-2014 Nonki Takahashi. All rights reserved. ' ' History : ' 0.6 2014-02-20 Changed to use Stack. (VHT007-0) ' 0.5 2014-02-19 Rewrote only for shuffle and deal. (VHT007) ' 0.4 2014-01-09 Changed for performance. (RMP814-0) ' 0.3 2014-01-06 Rewrote to check full house probability. (RMP814) ' 0.2 2013-04-04 Modified for Challenge of the Month. (CZJ358-0) ' 0.1 2012-08-21 Created. (CZJ358) ' GraphicsWindow.Title = "Deal 0.6" Not = "False=True;True=False;" WQ = Text.GetCharacter(34) Cards_Init() Program.Delay(2000) While "True" ShuffleCards() DealCards() Program.Delay(2000) RecombineCards() Program.Delay(2000) EndWhile Sub DealCards col = 1 row = 2 i = 0 While 0 < Stack.GetCount("deck") index = Stack.PopValue("deck") i = i + 1 field[i] = index Cards_Move() Cards_Open() col = col + 1 If nNumbers < col Then col = 1 row = row + 1 EndIf EndWhile EndSub Sub RecombineCards col = 1 row = 1 For i = 1 To nSuites * nNumbers index = field[i] Cards_Close() Cards_Move() EndFor EndSub Sub ShuffleCards ' Shuffle cards num1 = num For n = nSuites * nNumbers To 1 Step -1 i = Math.GetRandomNumber(n) ix = Array.GetAllIndices(num1) Stack.PushValue("deck", num1[ix[i]]) num1[ix[i]] = "" EndFor EndSub Sub Cards_Init ' return cards - array for cards properties ' return nSuites - number of suites ' return nNumbers - number of numbers width = 50 height = 70 cards["width"] = width cards["height"] = height cards["xs"] = 4 ' offset for suite in a card cards["ys"] = 30 cards["xn"] = 4 ' offset for number in a card cards["yn"] = 5 cards["xp"] = 6 ' offset for pattern in card cards["yp"] = 0 pattern = "color=DarkBlue;code=2593;" suites["club"] = "color=Black;code=2663;" suites["diamond"] = "color=#AA0000;code=2666;" suites["heart"] = "color=#AA0000;code=2665;" suites["spade"] = "color=Black;code=2660;" numbers = "1=A;2=2;3=3;4=4;5=5;6=6;7=7;8=8;9=9;10=10;11=J;12=Q;13=K;" nSuites = Array.GetItemCount(suites) nNumbers = Array.GetItemCount(numbers) iSuites = Array.GetAllIndices(suites) GraphicsWindow.BackgroundColor = "#004400" GraphicsWindow.PenWidth = 0 GraphicsWindow.FontName = "Courier New" GraphicsWindow.Width = (width + 10) * nNumbers + 10 GraphicsWindow.Height = (height + 10) * (nSuites + 1) + 10 col = 1 row = 1 x0 = 10 y0 = 10 sHex = pattern["code"] Math_Hex2Dec() pChar = Text.GetCharacter(iDec) For s = 1 To nSuites suite = iSuites[s] sHex = suites[suite]["code"] Math_Hex2Dec() sChar = Text.GetCharacter(iDec) For n = 1 To nNumbers index = index + 1 num[index] = index GraphicsWindow.BrushColor = "White" cards[index]["oCard"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = suites[suite]["color"] GraphicsWindow.FontSize = 28 cards[index]["oSuite"] = Shapes.AddText(sChar) cards[index]["oNumber"] = Shapes.AddText(numbers[n]) GraphicsWindow.BrushColor = "White" cards[index]["oCard2"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = pattern["color"] GraphicsWindow.FontSize = 60 cards[index]["oPattern"] = Shapes.AddText(pChar) Cards_Move() EndFor EndFor EndSub Sub Cards_Close ' param index Shapes.ShowShape(cards[index]["oCard2"]) Shapes.ShowShape(cards[index]["oPattern"]) EndSub Sub Cards_Open ' param index Shapes.HideShape(cards[index]["oPattern"]) Shapes.HideShape(cards[index]["oCard2"]) EndSub Sub Cards_Move ' param index - index of a card ' param col, row - position to move cards[index]["col"] = col cards[index]["row"] = row x = x0 + (col - 1) * (width + 10) y = y0 + (row - 1) * (height + 10) Shapes.Animate(cards[index]["oCard"], x, y, 300) Shapes.Animate(cards[index]["oSuite"], x + cards["xs"], y + cards["ys"], 300) Shapes.Animate(cards[index]["oNumber"], x + cards["xn"], y + cards["yn"], 300) Shapes.Animate(cards[index]["oCard2"], x, y, 300) Shapes.Animate(cards[index]["oPattern"], x + cards["xp"], y + cards["yp"], 300) EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param sHex ' return iDec iDec = 0 iLen = Text.GetLength(sHex) For iPtr = 1 To iLen iDec = iDec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(sHex, iPtr, 1)) - 1 EndFor EndSub End>VHT007-0.sb< Start>VHV386.sb< ' Backgammon Board 0.1 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History ' 0.1 2013-08-04 Created. ' gw = 640 gh = 480 fw = 60 ' frame width fh = 30 ' frame height mg = 10 ' margin GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "#663300" GraphicsWindow.FillRectangle(mg, mg, gw - mg * 2, gh - mg * 2) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(mg + fw, mg + fh, (gw - mg * 2 - fw * 3) / 2, gh - (mg + fh) * 2) GraphicsWindow.FillRectangle(gw / 2 + fw / 2, mg + fh, (gw - mg * 2 - fw * 3) / 2, gh - (mg + fh) * 2) color = "0=BurlyWood;1=Maroon;" x = mg + fw y = mg + fh dx = (gw - mg * 2 - fw * 3) / 12 dy = (gh - mg * 2 - fh * 3) / 2 y1 = y y2 = y y3 = y + dy DrawPath() x = gw / 2 + fw / 2 DrawPath() color = "0=Maroon;1=BurlyWood;" x = mg + fw y = gh - mg - fh dy = -(gh - mg * 2 - fh * 3) / 2 y1 = y y2 = y y3 = y + dy DrawPath() x = gw / 2 + fw / 2 DrawPath() GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" x = gw / 2 + fw / 2 + 5 * dx y = mg + fh dy = dx o = 0 AddCheckers() GraphicsWindow.BrushColor = "White" y = gh - mg - fh - dx dy = -dx o = 6 AddCheckers() Dice_Init() x0 = gw / 2 y0 = gh / 2 r = size a = Math.GetRandomNumber(360) _a[1] = Math.GetRadians(a) _a[2] = _a[1] - Math.Pi For i = 1 To 2 n = Math.GetRandomNumber(6) x = x0 + r * Math.Cos(_a[i]) - size / 2 y = y0 + r * Math.Sin(_a[i]) - size / 2 Dice_Add() EndFor Sub AddCheckers For i = 1 To 5 checker[i + o] = Shapes.AddEllipse(dx, dx) Shapes.Move(checker[i + o], x, y + (i - 1) * dy) EndFor EndSub Sub DrawPath For i = 0 To 5 mod = Math.Remainder(i, 2) GraphicsWindow.BrushColor = color[mod] x1 = x + i * dx x2 = x + (i + 1) * dx x3 = (x1 + x2) / 2 GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) EndFor EndSub Sub Dice_Init pattern[1] = " . " pattern[2] = ". ." pattern[3] = " . . . " pattern[4] = ". . . ." pattern[5] = ". . . . ." pattern[6] = ". .. .. ." size = 20 EndSub Sub Dice_Add GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" dice[i][0] = Shapes.AddRectangle(size, size) Shapes.Move(dice[i][0], x, y) For j = 1 To 9 k = 0 If Text.GetSubText(pattern[n], j, 1) = "." Then k = k + 1 If n = 1 Then GraphicsWindow.BrushColor = "Red" d = size / 3 p = 0.35 Else GraphicsWindow.BrushColor = "Black" d = size / 5 p = 0.6 EndIf x1 = x + (Math.Remainder(j - 1, 3) + p) * size / 4 y1 = y + (Math.Floor((j - 1) / 3) + p) * size / 4 dice[i][k] = Shapes.AddEllipse(d, d) Shapes.Move(dice[i][k], x1, y1) EndIf EndFor EndSub End>VHV386.sb< Start>VHW071.sb< 'Regular polygon x = 20 y = 20 caption = "Number of sides?" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(x, y, caption) oText = Controls.AddTextBox(x + Text.GetLength(caption) * 8, y) Controls.SetTextBoxText(oText, "3") x0 = 100 y0 = 100 r = 100 m = 10 ' for margin s = 2 * (r + m) ' for clear circle size xc = x0 + r yc = x0 + r lastn= 0 While "True" Program.Delay(500) n = Controls.GetTextBoxText(oText) If n <> lastn Then lastn = n GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x0 - m, y0 - m, s, s) x1 = r * Math.Cos(Math.Pi * 2) + xc y1 = r * Math.Sin(Math.Pi * 2) + yc For i = 1 To n x2 = r * Math.Cos(Math.Pi * 2 / n * i) + xc y2 = r * Math.Sin(Math.Pi * 2 / n * i) + yc GraphicsWindow.DrawLine(x1, y1, x2, y2) x1 = x2 y1 = y2 EndFor EndIf EndWhile End>VHW071.sb< Start>VHW150.sb< T = "True" Numbers[1] = 1 Numbers[2] = 2 Numbers[3] = 3 Numbers[4] = 4 Numbers[5] = 5 Numbers[6] = 6 Numbers[7] = 7 Numbers[8] = 8 Numbers[9] = 9 Numbers[10] = 0 TestString = "Hello 4519876320" TextWindow.WriteLine(TestString) LenString = Text.GetLength(TestString) For i = LenString To 1 Step - 1 If Array.ContainsValue(Numbers, Text.GetSubText(TestString, i, 1)) = T Then Start = i Else i = 1 EndIf EndFor TestText = Text.GetSubText(TestString, 1, Start - 1) TestNumber = Text.GetSubTextToEnd(TestString, Start) TextWindow.WriteLine("|" + TestText + "|") TextWindow.WriteLine("|" + TestNumber + "|") End>VHW150.sb< Start>VHX094.sb< 'Variables CurrentFontName = "Microsoft Sans Serif" CurrentFontSize = 13 CurrentFontBold = "False" CurrentFontItalic = "False" CurrentFontColor = "Black" CurrentMenu = "" PrevFDFontName = "" PrevFDFontSize = "" PrevFDFontBold = "" PrevFDFontItalic = "" PrevFDFontColor = "" UserWantsFontSettingsRestored = "No" FurtherFontNamesHidden = "Yes" SecondScreenAdded = "No" ImageAdded = "No" PreviousTop = "" ChangesAffect = "TF1" ImageLoaded = "No" 'Images ImgFontLogo = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\FontIcon.png" ' The following line could be harmful and has been automatically commented. ' ImgTMNewFile = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\NewFile.png" ' The following line could be harmful and has been automatically commented. ' ImgTMOpenFile = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\OpenFile.png" ' The following line could be harmful and has been automatically commented. ' ImgTMSaveFile = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\SaveFile.png" ImgTMFontSize = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\FontSize.png" ImgTMSecondScreen = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\SecondScreen.png" ImgDMInfoIcon = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\InfoIcon.png" ImgCopyPaste = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\CopyPaste.png" ImgTMAddImage = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\AddImage.png" ImgTMGear = "C:\Users\Θανάσης\Documents\Small Basic\Images\Notebook\Gear.png" 'Colors GrayControl = GraphicsWindow.GetColorFromRGB(240, 240, 240) GrayControlShadow = GraphicsWindow.GetColorFromRGB(160, 160, 160) 'Window GraphicsWindow.Hide() GraphicsWindow.Title = "Notebook" GraphicsWindow.Width = 1000 GraphicsWindow.Height = 600 GraphicsWindow.Top = 2500 GraphicsWindow.Left = 1500 GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(200, 200, 200) GraphicsWindow.Show() 'Main SetupProgram() GraphicsWindow.Top = (Desktop.Height - 670) / 2 GraphicsWindow.Left = (Desktop.Width - 1000) / 2 'SUBROUTINES '*************** 'SetupProgram Sub SetupProgram GraphicsWindow.Hide() AddTopMenu() HideTopMenu() AddScreen() HideScreen() AddNewFileDialog() HideNewFileDialog() AddOpenFileDialog() HideOpenFileDialog() AddSaveFileDialog() HideSaveFileDialog() AddFontDialog() HideFontDialog() AddCopyPasteDialog() HideCopyPasteDialog() AddSettingsDialog() HideSettingsDialog() AddImageDialog() HideImageDialog() ShowTopMenu() Shapes.ShowShape(Screen) GraphicsWindow.Show() EndSub 'AddTopMenu Sub AddTopMenu GraphicsWindow.BrushColor = GrayControl GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = GrayControlShadow TMBackRec = Shapes.AddRectangle(GraphicsWindow.Width - 10, 35) Shapes.Move(TMBackRec, 5, 5) TMSeperator8 = Shapes.AddRectangle(39, 35) Shapes.Move(TMSeperator8, 233, 5) TMSeperator7 = Shapes.AddRectangle(229, 35) Shapes.Move(TMSeperator7, 5, 5) TMSeperator5 = Shapes.AddRectangle(191, 35) Shapes.Move(TMSeperator5, 5, 5) TMSeperator4 = Shapes.AddRectangle(153, 35) Shapes.Move(TMSeperator4, 5, 5) TMSeperator3 = Shapes.AddRectangle(115, 35) Shapes.Move(TMSeperator3, 5, 5) TMSeperator2 = Shapes.AddRectangle(77, 35) Shapes.Move(TMSeperator2, 5, 5) TMSeperator = Shapes.AddRectangle(39, 35) Shapes.Move(TMSeperator, 5, 5) TMIconNewFile = Shapes.AddImage(ImgTMNewFile) Shapes.Move(TMIconNewFile, 12, 12) TMIconOpenFile = Shapes.AddImage(ImgTMOpenFile) Shapes.Move(TMIconOpenFile, 52, 12) TMIconSaveFile = Shapes.AddImage(ImgTMSaveFile) Shapes.Move(TMIconSaveFile, 90, 12) TMIconFontSize = Shapes.AddImage(ImgTMFontSize) Shapes.Move(TMIconFontSize, 128, 12) TMIconSecondScreen = Shapes.AddImage(ImgTMSecondScreen) Shapes.Move(TMIconSecondScreen, 166, 11) TMIconAddImage = Shapes.AddImage(ImgTMAddImage) Shapes.Move(TMIconAddImage, 204, 15) TMIconGear = Shapes.AddImage(ImgTMGear) Shapes.Move(TMIconGear, 242, 13) TMBtnNewFile = Controls.AddButton("", 6, 6) Controls.SetSize(TMBtnNewFile, 37, 33) Shapes.SetOpacity(TMBtnNewFile, 20) TMBtnOpenFile = Controls.AddButton("", 44, 6) Controls.SetSize(TMBtnOpenFile, 39, 33) Shapes.SetOpacity(TMBtnOpenFile, 20) TMBtnSaveFile = Controls.AddButton("", 81, 6) Controls.SetSize(TMBtnSaveFile, 39, 33) Shapes.SetOpacity(TMBtnSaveFile, 20) TMBtnFont = Controls.AddButton("", 120, 6) Controls.SetSize(TMBtnFont, 37, 33) Shapes.SetOpacity(TMBtnFont, 20) TMBtnSecondScreen = Controls.AddButton("", 158, 6) Controls.SetSize(TMBtnSecondScreen, 37, 33) Shapes.SetOpacity(TMBtnSecondScreen, 20) TMBtnAddImage = Controls.AddButton("", 196, 6) Controls.SetSize(TMBtnAddImage, 37, 33) Shapes.SetOpacity(TMBtnAddImage, 20) TMBtnSettings = Controls.AddButton("", 234, 6) Controls.SetSize(TMBtnSettings, 37, 33) Shapes.SetOpacity(TMBtnSettings, 20) TMBackRec2 = Shapes.AddRectangle(0, 35) Shapes.Move(TMBackRec2, 503, 5) Shapes.SetOpacity(TMBackRec2, 0) TMSeperator6 = Shapes.AddRectangle(39, 35) Shapes.Move(TMSeperator6, 503, 5) TMIconCopyPaste = Shapes.AddImage(ImgCopyPaste) Shapes.Move(TMIconCopyPaste, 512, 13) TMBtnCopyPaste = Controls.AddButton("", 504, 6) Controls.SetSize(TMBtnCopyPaste, 37, 33) Shapes.SetOpacity(TMBtnCopyPaste, 20) EndSub 'HideTopMenu Sub HideTopMenu Shapes.HideShape(TMBackRec) Shapes.HideShape(TMSeperator) Shapes.HideShape(TMSeperator2) Shapes.HideShape(TMSeperator3) Shapes.HideShape(TMSeperator4) Shapes.HideShape(TMSeperator5) Shapes.HideShape(TMSeperator6) Shapes.HideShape(TMSeperator7) Shapes.HideShape(TMSeperator8) Shapes.HideShape(TMIconNewFile) Shapes.HideShape(TMIconOpenFile) Shapes.HideShape(TMIconSaveFile) Shapes.HideShape(TMIconFontSize) Shapes.HideShape(TMIconSecondScreen) Shapes.HideShape(TMIconCopyPaste) Shapes.HideShape(TMIconAddImage) Shapes.HideShape(TMIconGear) Shapes.HideShape(TMBackRec2) Controls.HideControl(TMBtnNewFile) Controls.HideControl(TMBtnOpenFile) Controls.HideControl(TMBtnSaveFile) Controls.HideControl(TMBtnFont) Controls.HideControl(TMBtnSecondScreen) Controls.HideControl(TMBtnCopyPaste) Controls.HideControl(TMBtnAddImage) Controls.HideControl(TMBtnSettings) EndSub 'ShowTopMenu Sub ShowTopMenu Shapes.ShowShape(TMBackRec) Shapes.ShowShape(TMSeperator) Shapes.ShowShape(TMSeperator2) Shapes.ShowShape(TMSeperator3) Shapes.ShowShape(TMSeperator4) Shapes.ShowShape(TMSeperator5) Shapes.ShowShape(TMSeperator7) Shapes.ShowShape(TMSeperator8) Shapes.ShowShape(TMIconSaveFile) Shapes.ShowShape(TMIconFontSize) Shapes.ShowShape(TMIconNewFile) Shapes.ShowShape(TMIconOpenFile) Shapes.ShowShape(TMIconSecondScreen) Shapes.ShowShape(TMIconAddImage) Shapes.ShowShape(TMIconGear) Controls.ShowControl(TMBtnFont) Controls.ShowControl(TMBtnNewFile) Controls.ShowControl(TMBtnOpenFile) Controls.ShowControl(TMBtnSaveFile) Controls.ShowControl(TMBtnSecondScreen) Controls.ShowControl(TMBtnAddImage) Controls.ShowControl(TMBtnSettings) If SecondScreenAdded = "Yes" Then Controls.ShowControl(TMBtnCopyPaste) Shapes.ShowShape(TMBackRec2) Shapes.ShowShape(TMIconCopyPaste) Shapes.ShowShape(TMSeperator6) EndIf EndSub 'AddNewFileDialog Sub AddNewFileDialog GraphicsWindow.BrushColor = GrayControl GraphicsWindow.PenColor = GrayControlShadow DMBackRec = Shapes.AddRectangle(190, 35) Shapes.Move(DMBackRec, 405, 155) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 13 DMTitle = Shapes.AddText("") Shapes.Move(DMTitle, (GraphicsWindow.Width - 58) / 2, 164) GraphicsWindow.BrushColor = GrayControl DMBackRec2 = Shapes.AddRectangle(600, 200) Shapes.Move(DMBackRec2, (GraphicsWindow.Width - 600) / 2, 200) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" DMBackColor = Shapes.AddRectangle(598, 98) Shapes.Move(DMBackColor, (GraphicsWindow.Width - 598) / 2, 201) GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.PenColor = "Gainsboro" DMBackColor2 = Shapes.AddRectangle(598, 98) Shapes.Move(DMBackColor2, (GraphicsWindow.Width - 598) / 2, 301) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" DMLabel = Shapes.AddText("Are you sure you wish to make a new file? All unsaved data will be lost.") Shapes.Move(DMLabel, (GraphicsWindow.Width - 400) / 2, 245) DMIconInfo = Shapes.AddImage(ImgDMInfoIcon) Shapes.Move(DMIconInfo, (GraphicsWindow.Width - 630) / 2, 190) Shapes.Zoom(DMIconInfo, 0.5, 0.5) DMBtnYes = Controls.AddButton("Yes", (GraphicsWindow.Width - 210) / 2, 335) Controls.SetSize(DMBtnYes, 100, 30) DMBtnNo = Controls.AddButton("No", GraphicsWindow.Width / 2, 335) Controls.SetSize(DMBtnNo, 100, 30) EndSub 'ShowNewFileDialog Sub ShowNewFileDialog Shapes.Move(DMTitle, (GraphicsWindow.Width - 58) / 2, 164) Shapes.Move(DMBackRec, 405, 155) Shapes.SetText(DMTitle, "New File") Shapes.SetText(DMLabel, "Are you sure you wish to make a new file? All unsaved data will be lost.") Controls.ShowControl(DMBtnNo) Controls.ShowControl(DMBtnYes) ShowBasicDM() EndSub 'HideNewFileDialog Sub HideNewFileDialog HideBasicDM() Controls.HideControl(DMBtnNo) Controls.HideControl(DMBtnYes) EndSub 'ShowBasicDM Sub ShowBasicDM Shapes.ShowShape(DMBackColor) Shapes.ShowShape(DMBackColor2) Shapes.ShowShape(DMBackRec) Shapes.ShowShape(DMBackRec2) Shapes.ShowShape(DMIconInfo) Shapes.ShowShape(DMLabel) Shapes.ShowShape(DMTitle) EndSub 'HideBasicDM Sub HideBasicDM Shapes.HideShape(DMBackColor) Shapes.HideShape(DMBackColor2) Shapes.HideShape(DMBackRec) Shapes.HideShape(DMBackRec2) Shapes.HideShape(DMIconInfo) Shapes.HideShape(DMLabel) Shapes.HideShape(DMTitle) EndSub 'AddScreen Sub AddScreen Controls.Remove(Screen) Controls.Remove(Screen2) GraphicsWindow.FontName = CurrentFontName GraphicsWindow.BrushColor = CurrentFontColor GraphicsWindow.FontBold = CurrentFontBold GraphicsWindow.FontItalic = CurrentFontItalic GraphicsWindow.FontSize = CurrentFontSize Screen = Controls.AddMultiLineTextBox(5, 45) If SecondScreenAdded = "No" And ImageAdded = "No" And ImageLoaded = "No" Then Controls.SetSize(Screen, GraphicsWindow.Width - 10, GraphicsWindow.Height - 50) ElseIf SecondScreenAdded = "Yes" Or ImageAdded = "Yes" Or ImageLoaded = "Yes" Then Controls.SetSize(Screen, 492.5, GraphicsWindow.Height - 50) EndIf Screen2 = Controls.AddMultiLineTextBox(502.5, 45) Controls.SetSize(Screen2, 492.5, GraphicsWindow.Height - 50) Controls.HideControl(Screen2) If SecondScreenAdded = "No" Then Shapes.SetOpacity(Screen2, 0) EndIf EndSub 'HideScreen Sub HideScreen Controls.HideControl(Screen) Controls.HideControl(Screen2) EndSub 'AddOpenFileDialog Sub AddOpenFileDialog OFTextBox = Controls.AddTextBox((GraphicsWindow.Width - 400) / 2, 320) Controls.SetSize(OFTextBox, 400, 23) OFBtnConfirm = Controls.AddButton("Open", (GraphicsWindow.Width - 210) / 2, 350) Controls.SetSize(OFBtnConfirm, 100, 30) OFBtnCancel = Controls.AddButton("Cancel", GraphicsWindow.Width / 2, 350) Controls.SetSize(OFBtnCancel, 100, 30) EndSub 'ShowOpenFileDialog Sub ShowOpenFileDialog Shapes.Move(DMTitle, (GraphicsWindow.Width - 65) / 2, 164) Shapes.Move(DMBackRec, 405, 155) Shapes.SetText(DMTitle, "Open File") Shapes.SetText(DMLabel, "Enter the path the name and the extension of the file you wish to open.") ShowBasicDM() Controls.ShowControl(OFTextBox) Controls.ShowControl(OFBtnConfirm) Controls.ShowControl(OFBtnCancel) EndSub 'HideOpenFileDialog Sub HideOpenFileDialog HideBasicDM() Controls.HideControl(OFTextBox) Controls.HideControl(OFBtnConfirm) Controls.HideControl(OFBtnCancel) EndSub 'AddSaveFileDialog Sub AddSaveFileDialog SFTextBox = Controls.AddTextBox((GraphicsWindow.Width - 400) / 2, 320) Controls.SetSize(SFTextBox, 400, 23) SFBtnConfirm = Controls.AddButton("Save", (GraphicsWindow.Width - 210) / 2, 350) Controls.SetSize(SFBtnConfirm, 100, 30) SFBtnCancel = Controls.AddButton("Cancel", GraphicsWindow.Width / 2, 350) Controls.SetSize(SFBtnCancel, 100, 30) EndSub 'ShowSaveFileDialog Sub ShowSaveFileDialog Shapes.Move(DMTitle, (GraphicsWindow.Width - 65) / 2, 164) Shapes.Move(DMBackRec, 405, 155) Shapes.SetText(DMTitle, "Save File") Shapes.SetText(DMLabel, "Enter the path the name and the extension of the file you wish to save.") ShowBasicDM() Controls.ShowControl(SFTextBox) Controls.ShowControl(SFBtnConfirm) Controls.ShowControl(SFBtnCancel) EndSub 'HideSaveFileDialog Sub HideSaveFileDialog HideBasicDM() Controls.HideControl(SFTextBox) Controls.HideControl(SFBtnConfirm) Controls.HideControl(SFBtnCancel) EndSub 'AddFontDialog Sub AddFontDialog GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.PenColor = GrayControlShadow FDBackRec = Shapes.AddRectangle(400, 300) Shapes.Move(FDBackRec, 300, 150) GraphicsWindow.BrushColor = "Black" FDLabel = Shapes.AddText("Font name:") Shapes.Move(FDLabel, 340, 185) FDTBFontName = Controls.AddTextBox(430, 183) Controls.SetTextBoxText(FDTBFontName, "Microsoft Sans Serif") FDBtnFurtherFontNames = Controls.AddButton("Names", 600, 183) Controls.SetSize(FDBtnFurtherFontNames, 55, 23) FDLabel2 = Shapes.AddText("Font size:") Shapes.Move(FDLabel2, 340, 230) FDTBFontSize = Controls.AddTextBox(430, 227) Controls.SetTextBoxText(FDTBFontSize, 13) Controls.SetSize(FDTBFontSize, 37, 22) FDBtnIncrFS = Controls.AddButton("+", 472, 227) Controls.SetSize(FDBtnIncrFS, 22, 22) FDBtnDecrFS = Controls.AddButton("-", 499, 227) Controls.SetSize(FDBtnDecrFS, 22, 22) FDLabel3 = Shapes.AddText("Font bold:") Shapes.Move(FDLabel3, 340, 275) FDBtnFontBold = Controls.AddButton("No", 430, 270) Controls.SetSize(FDBtnFontBold, 32, 27) FDLabel4 = Shapes.AddText("Font italic:") Shapes.Move(FDLabel4, 340, 320) FDBtnFontItalic = Controls.AddButton("No", 430, 315) Controls.SetSize(FDBtnFontItalic, 32, 27) FDTBFontColor = Controls.AddTextBox(430, 377) Controls.SetSize(FDTBFontColor, 80, 23) Controls.SetTextBoxText(FDTBFontColor, "Black") FDIconFont = Shapes.AddImage(ImgFontLogo) Shapes.Move(FDIconFont, 540, 220) FDLabel5 = Shapes.AddText("Font color:") Shapes.Move(FDLabel5, 340, 380) GraphicsWindow.BrushColor = "Red" FDBtnRed = Controls.AddButton("■", 520, 360) GraphicsWindow.BrushColor = "Green" FDBtnGreen = Controls.AddButton("■", 545, 360) GraphicsWindow.BrushColor = "Blue" FDBtnBlue = Controls.AddButton("■", 570, 360) GraphicsWindow.BrushColor = "Gold" FDBtnGold = Controls.AddButton("■", 595, 360) GraphicsWindow.BrushColor = "Magenta" FDBtnMagenta = Controls.AddButton("■", 620, 360) GraphicsWindow.BrushColor = "Pink" FDBtnPink = Controls.AddButton("■", 645, 360) GraphicsWindow.BrushColor = "Crimson" FDBtnCrimson = Controls.AddButton("■", 520, 389) GraphicsWindow.BrushColor = "Lime" FDBtnLime = Controls.AddButton("■", 545, 389) GraphicsWindow.BrushColor = "Cyan" FDBtnCyan = Controls.AddButton("■", 570, 389) GraphicsWindow.BrushColor = "Yellow" FDBtnYellow = Controls.AddButton("■", 595, 389) GraphicsWindow.BrushColor = "Indigo" FDBtnIndigo = Controls.AddButton("■", 620, 389) GraphicsWindow.BrushColor = "Black" FDBtnBlack = Controls.AddButton("■", 645, 389) GraphicsWindow.BrushColor = "GainsBoro" GraphicsWindow.PenColor = GrayControlShadow FDBackRec2 = Shapes.AddRectangle(200, 300) Shapes.Move(FDBackRec2, 720, 150) GraphicsWindow.BrushColor = "Black" FDBtnRestore = Controls.AddButton("Restore", 340, 460) Controls.SetSize(FDBtnRestore, 100, 30) FDBtnConfirm = Controls.AddButton("Confirm", 450, 460) Controls.SetSize(FDBtnConfirm, 100, 30) FDBtnCancel = Controls.AddButton("Cancel", 560, 460) Controls.SetSize(FDBtnCancel, 100, 30) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Times New Roman" FDTBName = Controls.AddTextBox(738, 168) GraphicsWindow.FontName = "Arial" FDTBName2 = Controls.AddTextBox(738, 198) GraphicsWindow.FontName = "Consolas" FDTBName3 = Controls.AddTextBox(738, 228) GraphicsWindow.FontName = "CASTELLAR" FDTBName4 = Controls.AddTextBox(738, 258) GraphicsWindow.FontName = "Curlz MT" FDTBName5 = Controls.AddTextBox(738, 288) GraphicsWindow.FontName = "Baskerville Old Face" FDTBName6 = Controls.AddTextBox(738, 318) GraphicsWindow.FontName = "Blackadder ITC" FDTBName7 = Controls.AddTextBox(738, 348) GraphicsWindow.FontName = "Ravie" FDTBName8 = Controls.AddTextBox(738, 378) GraphicsWindow.FontName = "Snap ITC" FDTBName9 = Controls.AddTextBox(738, 408) SetFDTBNames() EndSub 'ShowFontDialog Sub ShowFontDialog Shapes.Move(DMTitle, (GraphicsWindow.Width - 75) / 2, 114) Shapes.Move(DMBackRec, 405, 105) Shapes.SetText(DMTitle, "Font Dialog") Shapes.ShowShape(DMTitle) Shapes.ShowShape(DMBackRec) Shapes.ShowShape(FDBackRec) Shapes.ShowShape(FDLabel) Shapes.ShowShape(FDLabel2) Shapes.ShowShape(FDLabel3) Shapes.ShowShape(FDLabel4) Shapes.ShowShape(FDLabel5) Shapes.ShowShape(FDIconFont) Controls.ShowControl(FDBtnFontBold) Controls.ShowControl(FDBtnFontItalic) Controls.ShowControl(FDTBFontName) Controls.ShowControl(FDTBFontSize) Controls.ShowControl(FDBtnCancel) Controls.ShowControl(FDBtnConfirm) Controls.ShowControl(FDBtnFontBold) Controls.ShowControl(FDBtnFontItalic) Controls.ShowControl(FDTBFontName) Controls.ShowControl(FDTBFontSize) Controls.ShowControl(FDBtnCancel) Controls.ShowControl(FDBtnConfirm) Controls.ShowControl(FDTBFontColor) Controls.ShowControl(FDBtnBlack) Controls.ShowControl(FDBtnBlue) Controls.ShowControl(FDBtnRed) Controls.ShowControl(FDBtnMagenta) Controls.ShowControl(FDBtnGold) Controls.ShowControl(FDBtnGreen) Controls.ShowControl(FDBtnIndigo) Controls.ShowControl(FDBtnCyan) Controls.ShowControl(FDBtnLime) Controls.ShowControl(FDBtnPink) Controls.ShowControl(FDBtnYellow) Controls.ShowControl(FDTBFontColor) Controls.ShowControl(FDBtnCrimson) Controls.ShowControl(FDBtnDecrFS) Controls.ShowControl(FDBtnIncrFS) Controls.ShowControl(FDBtnFurtherFontNames) Controls.ShowControl(FDBtnRestore) If FurtherFontNamesHidden = "No" Then Controls.ShowControl(FDTBName) Controls.ShowControl(FDTBName2) Controls.ShowControl(FDTBName3) Controls.ShowControl(FDTBName4) Controls.ShowControl(FDTBName5) Controls.ShowControl(FDTBName6) Controls.ShowControl(FDTBName7) Controls.ShowControl(FDTBName8) Controls.ShowControl(FDTBName9) Controls.ShowControl(FDBackRec2) EndIf EndSub 'HideFontDialog Sub HideFontDialog Shapes.HideShape(DMTitle) Shapes.HideShape(DMBackRec) Shapes.HideShape(FDBackRec) Shapes.HideShape(FDLabel) Shapes.HideShape(FDLabel2) Shapes.HideShape(FDLabel3) Shapes.HideShape(FDLabel4) Shapes.HideShape(FDLabel5) Shapes.HideShape(FDIconFont) Controls.HideControl(FDBtnFurtherFontNames) Controls.HideControl(FDBtnFontBold) Controls.HideControl(FDBtnFontItalic) Controls.HideControl(FDTBFontName) Controls.HideControl(FDTBFontSize) Controls.HideControl(FDBtnCancel) Controls.HideControl(FDBtnConfirm) Controls.HideControl(FDTBFontColor) Controls.HideControl(FDBtnBlack) Controls.HideControl(FDBtnBlue) Controls.HideControl(FDBtnRed) Controls.HideControl(FDBtnMagenta) Controls.HideControl(FDBtnGold) Controls.HideControl(FDBtnGreen) Controls.HideControl(FDBtnIndigo) Controls.HideControl(FDBtnCyan) Controls.HideControl(FDBtnLime) Controls.HideControl(FDBtnPink) Controls.HideControl(FDBtnYellow) Controls.HideControl(FDBtnCrimson) Controls.HideControl(FDBtnRestore) Controls.HideControl(FDTBName) Controls.HideControl(FDTBName2) Controls.HideControl(FDTBName3) Controls.HideControl(FDTBName4) Controls.HideControl(FDTBName5) Controls.HideControl(FDTBName6) Controls.HideControl(FDTBName7) Controls.HideControl(FDTBName8) Controls.HideControl(FDTBName9) Controls.HideControl(FDBackRec2) Controls.HideControl(FDBtnDecrFS) Controls.HideControl(FDBtnIncrFS) EndSub 'AddCopyPasteDialog Sub AddCopyPasteDialog GraphicsWindow.FontName = "Microsoft Sans Serif" CPBtnLeft = Controls.AddButton("Left", 340, 335) Controls.SetSize(CPBtnLeft, 100, 30) CPBtnRight= Controls.AddButton("Right", 450, 335) Controls.SetSize(CPBtnRight, 100, 30) CPBtnCancel = Controls.AddButton("Cancel", 560, 335) Controls.SetSize(CPBtnCancel, 100, 30) EndSub 'ShowCopyPasteDialog Sub ShowCopyPasteDialog Shapes.Move(DMTitle, (GraphicsWindow.Width - 80) / 2, 164) Shapes.Move(DMBackRec, 405, 155) Shapes.SetText(DMTitle, "Copy Paste") Shapes.SetText(DMLabel, "Select where you want the text to be pasted.") ShowBasicDM() Controls.ShowControl(CPBtnLeft) Controls.ShowControl(CPBtnRight) Controls.ShowControl(CPBtnCancel) EndSub 'HideCopyPasteDialog Sub HideCopyPasteDialog HideBasicDM() Controls.HideControl(SFTextBox) Controls.HideControl(SFBtnConfirm) Controls.HideControl(SFBtnCancel) Controls.HideControl(CPBtnLeft) Controls.HideControl(CPBtnRight) Controls.HideControl(CPBtnCancel) EndSub 'AddSettingsDialog Sub AddSettingsDialog GraphicsWindow.BrushColor = GrayControl SDBackRec = Shapes.AddRectangle(500, 180) Shapes.Move(SDBackRec, 250, 175) SDSeperator2 = Shapes.AddRectangle(500, 120) Shapes.Move(SDSeperator2, 250, 175) SDSeperator = Shapes.AddRectangle(500, 60) Shapes.Move(SDSeperator, 250, 175) GraphicsWindow.BrushColor = "White" SDBackRadio = Shapes.AddEllipse(15, 15) Shapes.Move(SDBackRadio, 270, 197) SDBackRadio2 = Shapes.AddEllipse(15, 15) Shapes.Move(SDBackRadio2, 270, 257) SDBackRadio3 = Shapes.AddEllipse(15, 15) Shapes.Move(SDBackRadio3, 270, 317) GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor = "Black" SDLabel = Shapes.AddText("Future changes will affect the first text field.") Shapes.Move(SDLabel, 295, 197) SDLabel2 = Shapes.AddText("Future changes will affect the second text field.") Shapes.Move(SDLabel2, 295, 257) SDLabel3 = Shapes.AddText("Future changes will affect both text fields.") Shapes.Move(SDLabel3, 295, 317) SDBtnConfirm = Controls.AddButton("Confirm", 395, 365) Controls.SetSize(SDBtnConfirm, 100, 30) SDBtnCancel = Controls.AddButton("Cancel", 505, 365) Controls.SetSize(SDBtnCancel, 100, 30) GraphicsWindow.PenColor = "Black" SDRadio = Shapes.AddEllipse(7, 7) Shapes.Move(SDRadio, 274, 201) EndSub 'ShowSettingsDialog Sub ShowSettingsDialog Shapes.Move(DMBackRec, 405, 120) Shapes.SetText(DMTitle, "Settings") Shapes.Move(DMTitle, 472, 131) Shapes.ShowShape(DMTitle) Shapes.ShowShape(DMBackRec) Shapes.ShowShape(SDBackRec) Shapes.ShowShape(SDBackRadio) Shapes.ShowShape(SDBackRadio2) Shapes.ShowShape(SDBackRadio3) Shapes.ShowShape(SDRadio) Shapes.ShowShape(SDLabel) Shapes.ShowShape(SDLabel2) Shapes.ShowShape(SDLabel3) Shapes.ShowShape(SDSeperator) Shapes.ShowShape(SDSeperator2) Controls.ShowControl(SDBtnCancel) Controls.ShowControl(SDBtnConfirm) EndSub 'HideSettingsDialog Sub HideSettingsDialog HideBasicDM() Shapes.HideShape(SDBackRec) Shapes.HideShape(SDLabel) Shapes.HideShape(SDLabel2) Shapes.HideShape(SDLabel3) Shapes.HideShape(SDBackRadio) Shapes.HideShape(SDBackRadio2) Shapes.HideShape(SDBackRadio3) Shapes.HideShape(SDSeperator) Shapes.HideShape(SDSeperator2) Shapes.HideShape(SDRadio) Controls.HideControl(SDBtnCancel) Controls.HideControl(SDBtnConfirm) EndSub 'ApplyFontSettings Sub ApplyFontSettings CurrentFontName = Controls.GetTextBoxText(FDTBFontName) CurrentFontSize = Controls.GetTextBoxText(FDTBFontSize) CurrentFontColor = Controls.GetTextBoxText(FDTBFontColor) CurrentFontBold = Controls.GetButtonCaption(FDBtnFontBold) CurrentFontItalic = Controls.GetButtonCaption(FDBtnFontItalic) GetScreenText = Controls.GetTextBoxText(Screen) GetScreen2Text = Controls.GetTextBoxText(Screen2) Controls.Remove(Screen) If CurrentFontBold = "Yes" Then CurrentFontBold = "True" Else CurrentFontBold = "False" EndIf If CurrentFontItalic = "Yes" Then CurrentFontItalic = "True" Else CurrentFontItalic = "False" EndIf GraphicsWindow.FontBold = CurrentFontBold GraphicsWindow.FontItalic = CurrentFontItalic GraphicsWindow.FontSize = CurrentFontSize GraphicsWindow.FontName = CurrentFontName GraphicsWindow.BrushColor = CurrentFontColor EndSub 'CancelFontSettings Sub CancelFontSettings Controls.SetTextBoxText(FDTBFontName, PrevFDFontName) Controls.SetTextBoxText(FDTBFontSize, PrevFDFontSize) Controls.SetTextBoxText(FDTBFontColor, PrevFDFontColor) If PrevFDFontBold = "No" Then Controls.SetButtonCaption(FDBtnFontBold, "No") CurrentFontBold = "False" ElseIf PrevFDFontBold = "Yes" Then Controls.SetButtonCaption(FDBtnFontBold, "Yes") CurrentFontBold = "True" EndIf If PrevFDFontItalic = "No" Then Controls.SetButtonCaption(FDBtnFontItalic, "No") CurrentFontItalic = "False" ElseIf PrevFDFontItalic = "Yes" Then Controls.SetButtonCaption(FDBtnFontItalic, "Yes") CurrentFontItalic = "True" EndIf EndSub 'RestoreFontSettings Sub RestoreFontSettings Controls.SetTextBoxText(FDTBFontName, "Microsoft Sans Serif") Controls.SetTextBoxText(FDTBFontSize, 13) Controls.SetButtonCaption(FDBtnFontBold, "No") Controls.SetButtonCaption(FDBtnFontItalic, "No") Controls.SetTextBoxText(FDTBFontColor, "Black") UserWantsFontSettingsRestored = "Yes" EndSub 'HideAllMenus Sub HideAllMenus CurrentMenu = "" HideTopMenu() HideScreen() HideNewFileDialog() HideOpenFileDialog() HideSaveFileDialog() HideFontDialog() HideCopyPasteDialog() HideSettingsDialog() HideImageDialog() EndSub 'SetFDTBNames Sub SetFDTBNames Controls.SetTextBoxText(FDTBName, "Times New Roman") Controls.SetTextBoxText(FDTBName2, "Arial") Controls.SetTextBoxText(FDTBName3, "Consolas") Controls.SetTextBoxText(FDTBName4, "CASTELLAR") Controls.SetTextBoxText(FDTBName5, "Curlz MT") Controls.SetTextBoxText(FDTBName6, "Baskerville Old Face") Controls.SetTextBoxText(FDTBName7, "Blackadder ITC") Controls.SetTextBoxText(FDTBName8, "Ravie") Controls.SetTextBoxText(FDTBName9, "Snap ITC") EndSub 'GetPreviousSettings Sub GetPreviousSettings PrevFDFontBold = Controls.GetButtonCaption(FDBtnFontBold) PrevFDFontItalic = Controls.GetButtonCaption(FDBtnFontItalic) PrevFDFontName = Controls.GetTextBoxText(FDTBFontName) PrevFDFontSize = Controls.GetTextBoxText(FDTBFontSize) PrevFDFontColor = Controls.GetTextBoxText(FDTBFontColor) EndSub 'ShowTopMenuControls Sub ShowTopMenuControls Controls.ShowControl(TMBtnSecondScreen) Controls.ShowControl(TMBtnNewFile) Controls.ShowControl(TMBtnOpenFile) Controls.ShowControl(TMBtnSaveFile) Controls.ShowControl(TMBtnFont) Controls.ShowControl(TMBtnAddImage) Controls.ShowControl(TMBtnSettings) EndSub 'HideTopMenuControls Sub HideTopMenuControls Controls.HideControl(TMBtnSecondScreen) Controls.HideControl(TMBtnNewFile) Controls.HideControl(TMBtnOpenFile) Controls.HideControl(TMBtnSaveFile) Controls.HideControl(TMBtnFont) Controls.HideControl(TMBtnAddImage) Controls.HideControl(TMBtnSettings) EndSub 'IncreaseLeftTf Sub IncreaseLeftTf For Increase = 492 To 990 Step 0.8 Controls.SetSize(TMBackRec, Increase, 35) Controls.SetSize(Screen, Increase, GraphicsWindow.Height - 50) EndFor EndSub 'DecreaseLeftTF Sub DecreaseLeftTF For Decrease = 980 To 492.5 Step -0.8 Controls.SetSize(TMBackRec, Decrease, 35) Controls.SetSize(Screen, Decrease, GraphicsWindow.Height - 50) EndFor EndSub 'AddImageDialog Sub AddImageDialog GraphicsWindow.BrushColor = GrayControl GraphicsWindow.PenColor = GrayControlShadow IDBackTitle = Shapes.AddRectangle(190, 35) Shapes.Move(IDBackTitle, 655, 5) GraphicsWindow.BrushColor = "Black" IDTitle = Shapes.AddText("Add Image") Shapes.Move(IDTitle, 715, 15) GraphicsWindow.BrushColor = GrayControl IDBackRec = Shapes.AddRectangle(485, 150) Shapes.Move(IDBackRec, 505, 45) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" IDBackRecWhite = Shapes.AddRectangle(483, 60) Shapes.Move(IDBackRecWhite, 506, 46) IDIconInfo = Shapes.AddImage(ImgDMInfoIcon) Shapes.Move(IDIconInfo, 475, 15) Shapes.Zoom(IDIconInfo, 0.3, 0.3) GraphicsWindow.BrushColor = "Black" IDLabel = Shapes.AddText("Enter the name the path and the extention of the image you wish to add.") Shapes.Move(IDLabel, 565, 70) GraphicsWindow.FontSize = 12 IDTBAddImage = Controls.AddTextBox(555, 125) Controls.SetSize(IDTBAddImage, 375, 20) GraphicsWindow.FontSize = 13 IDBtnAddImage = Controls.AddButton("Add", 647, 150) Controls.SetSize(IDBtnAddImage, 100, 25) IDBtnCancel = Controls.AddButton("Cancel", 752, 150) Controls.SetSize(IDBtnCancel, 100, 25) EndSub 'AppearImageDialog Sub AppearImageDialog Shapes.ShowShape(IDBackTitle) Shapes.ShowShape(IDTitle) Shapes.ShowShape(IDBackRec) Shapes.ShowShape(IDIconInfo) Shapes.ShowShape(IDLabel) Shapes.ShowShape(IDBackRecWhite) Controls.ShowControl(IDTBAddImage) Controls.ShowControl(IDBtnAddImage) Controls.ShowControl(IDBtnCancel) For Appear = 0 To 100 Step 0.2 Shapes.SetOpacity(IDBackTitle, Appear) Shapes.SetOpacity(IDTitle, Appear) Shapes.SetOpacity(IDBackRec, Appear) Shapes.SetOpacity(IDIconInfo, Appear) Shapes.SetOpacity(IDLabel, Appear) Shapes.SetOpacity(IDBackRecWhite, Appear) Shapes.SetOpacity(IDTBAddImage, Appear) Shapes.SetOpacity(IDBtnAddImage, Appear) Shapes.SetOpacity(IDBtnCancel, Appear) EndFor EndSub 'FadeImageDialog Sub FadeImageDialog For Fade = 100 To 0 Step -0.2 Shapes.SetOpacity(IDBackTitle, Fade) Shapes.SetOpacity(IDTitle, Fade) Shapes.SetOpacity(IDBackRec, Fade) Shapes.SetOpacity(IDIconInfo, Fade) Shapes.SetOpacity(IDLabel, Fade) Shapes.SetOpacity(IDBackRecWhite, Fade) Shapes.SetOpacity(IDTBAddImage, Fade) Shapes.SetOpacity(IDBtnAddImage, Fade) Shapes.SetOpacity(IDBtnCancel, Fade) EndFor HideImageDialog() EndSub 'ShowImageDialog Sub ShowImageDialog Shapes.ShowShape(IDBackTitle) Shapes.ShowShape(IDTitle) Shapes.ShowShape(IDBackRec) Shapes.ShowShape(IDIconInfo) Shapes.ShowShape(IDLabel) Shapes.ShowShape(IDBackRecWhite) Controls.ShowControl(IDTBAddImage) Controls.ShowControl(IDBtnAddImage) Controls.ShowControl(IDBtnCancel) EndSub 'HideImageDialog Sub HideImageDialog Shapes.HideShape(LoadedImage) Shapes.HideShape(IDBackTitle) Shapes.HideShape(IDTitle) Shapes.HideShape(IDBackRec) Shapes.HideShape(IDIconInfo) Shapes.HideShape(IDLabel) Shapes.HideShape(IDBackRecWhite) Controls.HideControl(IDTBAddImage) Controls.HideControl(IDBtnAddImage) Controls.HideControl(IDBtnCancel) EndSub 'GoBack Sub GoBack If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf EndSub 'TextTyped Controls.TextTyped = TextTyped Sub TextTyped SetFDTBNames() If Controls.GetTextBoxText(FDTBFontSize) < 8 Then Controls.SetTextBoxText(FDTBFontSize, 8) ElseIf Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 0) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 1) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 2) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 3) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 4) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 5) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 6) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 7) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 8) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontName), 9) Then Controls.SetTextBoxText(FDTBFontName, PrevFDFontName) ElseIf Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 0) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 1) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 2) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 3) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 4) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 5) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 6) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 7) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 8) Or Text.IsSubText(Controls.GetTextBoxText(FDTBFontColor), 9) Then Controls.SetTextBoxText(FDTBFontColor, PrevFDFontColor) EndIf EndSub 'MouseDown GraphicsWindow.MouseDown = MouseDown Sub MouseDown x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If CurrentMenu = "Settings" Then If x > 270 And x < 550 And y > 197 And y < 212 Then Sound.PlayClick() Shapes.Move(SDRadio, 274, 201) ElseIf x > 270 And x < 570 And y > 257 And y < 272 Then Sound.PlayClick() Shapes.Move(SDRadio, 274, 261) ElseIf x > 270 And x < 540 And y > 317 And y < 332 Then Sound.PlayClick() Shapes.Move(SDRadio, 274, 321) EndIf EndIf EndSub 'ButtonClicked Controls.ButtonClicked = ButtonClicked Sub ButtonClicked If Controls.LastClickedButton = TMBtnNewFile Then Sound.PlayClick() HideAllMenus() ShowNewFileDialog() ElseIf Controls.LastClickedButton = TMBtnOpenFile Then Sound.PlayClick() HideAllMenus() ShowOpenFileDialog() ElseIf Controls.LastClickedButton = DMBtnYes Then Sound.PlayClick() HideNewFileDialog() ShowTopMenu() If ChangesAffect = "TF1" Then Controls.SetTextBoxText(Screen, "") ElseIf ChangesAffect = "TF2" Then Controls.SetTextBoxText(Screen2, "") ElseIf ChangesAffect = "Both" Then Controls.SetTextBoxText(Screen, "") Controls.SetTextBoxText(Screen2, "") EndIf Shapes.ShowShape(Screen) GoBack() ElseIf Controls.LastClickedButton = DMBtnNo Then Sound.PlayClick() HideNewFileDialog() ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf ElseIf Controls.LastClickedButton = OFBtnCancel Then Sound.PlayClick() HideOpenFileDialog() ShowTopMenu() Shapes.ShowShape(Screen) GoBack() ElseIf Controls.LastClickedButton = OFBtnConfirm Then Sound.PlayClick() GetOpenFilePath = Controls.GetTextBoxText(OFTextBox) If GetOpenFilePath = "" Then GraphicsWindow.ShowMessage("Please enter a path.", "Information") Sound.PlayClick() Else ' The following line could be harmful and has been automatically commented. ' FileContents = File.ReadContents(GetOpenFilePath) If FileContents = "" Then GraphicsWindow.ShowMessage("There is no such file.", "Information") Sound.PlayClick() Else If ChangesAffect = "TF1" Then Controls.SetTextBoxText(Screen, FileContents) ElseIf ChangesAffect = "TF2" Then Controls.SetTextBoxText(Screen2, FileContents) ElseIf ChangesAffect = "Both" Then Controls.SetTextBoxText(Screen, FileContents) Controls.SetTextBoxText(Screen2, FileContents) EndIf HideOpenFileDialog() ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf EndIf EndIf ElseIf Controls.LastClickedButton = TMBtnSaveFile Then Sound.PlayClick() HideAllMenus() ShowSaveFileDialog() ElseIf Controls.LastClickedButton = SFBtnCancel Then Sound.PlayClick() HideSaveFileDialog() ShowTopMenu() Controls.ShowControl(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf ElseIf Controls.LastClickedButton = SFBtnConfirm Then Sound.PlayClick() GetSaveFilePath = Controls.GetTextBoxText(SFTextBox) If GetSaveFilePath = "" Then GraphicsWindow.ShowMessage("Please enter a path.", "Information") Sound.PlayClick() Else GetScreenText = Controls.GetTextBoxText(Screen) GetScreen2Text = Controls.GetTextBoxText(Screen2) PathLength = Text.GetLength(GetSaveFilePath) FileExtention = Text.GetSubText(GetSaveFilePath, PathLength - 4, 5) If ChangesAffect = "TF1" Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(GetSaveFilePath, GetScreenText) ElseIf ChangesAffect = "TF2" Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(GetSaveFilePath, GetScreen2Text) ElseIf ChangesAffect = "Both" Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(GetSaveFilePath, GetScreenText) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(GetSaveFilePath + "2" + FileExtention, GetScreen2Text) EndIf HideSaveFileDialog() ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf EndIf ElseIf Controls.LastClickedButton = TMBtnFont Then Sound.PlayClick() GetPreviousSettings() HideAllMenus() ShowFontDialog() ElseIf Controls.LastClickedButton = FDBtnFontBold Then Sound.PlayClick() If Controls.GetButtonCaption(FDBtnFontBold) = "No" Then Controls.SetButtonCaption(FDBtnFontBold, "Yes") Controls.SetSize(FDBtnFontBold, 32, 27) CurrentFontBold = "True" ElseIf Controls.GetButtonCaption(FDBtnFontBold) = "Yes" Then Controls.SetButtonCaption(FDBtnFontBold, "No") Controls.SetSize(FDBtnFontBold, 32, 27) CurrentFontBold = "False" EndIf ElseIf Controls.LastClickedButton = FDBtnFontItalic Then Sound.PlayClick() If Controls.GetButtonCaption(FDBtnFontItalic) = "No" Then Controls.SetButtonCaption(FDBtnFontItalic, "Yes") Controls.SetSize(FDBtnFontItalic, 32, 27) CurrentFontItalic = "True" ElseIf Controls.GetButtonCaption(FDBtnFontItalic) = "Yes" Then Controls.SetButtonCaption(FDBtnFontItalic, "No") Controls.SetSize(FDBtnFontItalic, 32, 27) CurrentFontItalic = "False" EndIf ElseIf Controls.LastClickedButton = FDBtnCancel Then Sound.PlayClick() UserWantsFontSettingsRestored = "No" HideFontDialog() CancelFontSettings() ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf ElseIf Controls.LastClickedButton = FDBtnConfirm Then Sound.PlayClick() GetFontName = Controls.GetTextBoxText(FDTBFontName) GetFontSize = Controls.GetTextBoxText(FDTBFontSize) GetFontColor = Controls.GetTextBoxText(FDTBFontColor) If GetFontName = "" Or GetFontSize = "" Or GetFontColor = "" Then GraphicsWindow.ShowMessage("Please fill all the text fields.", "Attention") Else If UserWantsFontSettingsRestored = "No" Then UserWantsFontSettingsRestored = "No" HideFontDialog() ApplyFontSettings() ShowTopMenu() AddScreen() If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf Controls.SetTextBoxText(Screen, GetScreenText) Controls.SetTextBoxText(Screen2, GetScreen2Text) Else UserWantsFontSettingsRestored = "No" CurrentFontName = "Microsoft Sans Serif" CurrentFontSize = 11 CurrentFontBold = "False" CurrentFontItalic = "False" CurrentFontColor = "Black" HideFontDialog() ApplyFontSettings() ShowTopMenu() AddScreen() If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf Controls.SetTextBoxText(Screen, GetScreenText) Controls.SetTextBoxText(Screen2, GetScreen2Text) EndIf EndIf ElseIf Controls.LastClickedButton = FDBtnRed Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Red") CurrentFontColor = "Red" ElseIf Controls.LastClickedButton = FDBtnGreen Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Green") CurrentFontColor = "Green" ElseIf Controls.LastClickedButton = FDBtnBlue Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Blue") CurrentFontColor = "Blue" ElseIf Controls.LastClickedButton = FDBtnGold Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Gold") CurrentFontColor = "Gold" ElseIf Controls.LastClickedButton = FDBtnMagenta Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Magenta") CurrentFontColor = "Magenta" ElseIf Controls.LastClickedButton = FDBtnPink Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Pink") CurrentFontColor = "Pink" ElseIf Controls.LastClickedButton = FDBtnCrimson Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Crimson") CurrentFontColor = "Crimson" ElseIf Controls.LastClickedButton = FDBtnLime Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Lime") CurrentFontColor = "Lime" ElseIf Controls.LastClickedButton = FDBtnCyan Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Cyan") CurrentFontColor = "Cyan" ElseIf Controls.LastClickedButton = FDBtnYellow Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Yellow") CurrentFontColor = "Yellow" ElseIf Controls.LastClickedButton = FDBtnIndigo Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Indigo") CurrentFontColor = "Indigo" ElseIf Controls.LastClickedButton = FDBtnBlack Then Sound.PlayClick() Controls.SetTextBoxText(FDTBFontColor, "Black") CurrentFontColor = "Black" ElseIf Controls.LastClickedButton = FDBtnRestore Then Sound.PlayClick() RestoreFontSettings() ElseIf Controls.LastClickedButton = FDBtnFurtherFontNames Then Sound.PlayClick() If Controls.GetButtonCaption(FDBtnFurtherFontNames) = "Names" Then FurtherFontNamesHidden = "No" Controls.SetButtonCaption(FDBtnFurtherFontNames, "Hide") Controls.ShowControl(FDTBName) Controls.ShowControl(FDTBName2) Controls.ShowControl(FDTBName3) Controls.ShowControl(FDTBName4) Controls.ShowControl(FDTBName5) Controls.ShowControl(FDTBName6) Controls.ShowControl(FDTBName7) Controls.ShowControl(FDTBName8) Controls.ShowControl(FDTBName9) Shapes.ShowShape(FDBackRec2) Else Controls.SetButtonCaption(FDBtnFurtherFontNames, "Names") FurtherFontNamesHidden = "Yes" Controls.HideControl(FDTBName) Controls.HideControl(FDTBName2) Controls.HideControl(FDTBName3) Controls.HideControl(FDTBName4) Controls.HideControl(FDTBName5) Controls.HideControl(FDTBName6) Controls.HideControl(FDTBName7) Controls.HideControl(FDTBName8) Controls.HideControl(FDTBName9) Shapes.HideShape(FDBackRec2) EndIf ElseIf Controls.LastClickedButton = TMBtnSecondScreen Then Sound.PlayClick() If ImageAdded = "Yes" Then GraphicsWindow.ShowMessage("You can not add a second text field while using an image.", "Information") Sound.PlayClick() Else HideTopMenuControls() If SecondScreenAdded = "No" Then PrevText = Controls.GetTextBoxText(Screen) PrevTxt = Controls.GetTextBoxText(Screen2) Controls.SetTextBoxText(Screen, "") Controls.SetTextBoxText(Screen2, "") DecreaseLeftTF() Shapes.ShowShape(Screen2) Shapes.ShowShape(TMBackRec2) For Times = 0 To 492 Step 0.8 Controls.SetSize(TMBackRec2, Times, 35) Shapes.SetOpacity(TMBackRec2, Times / 3) Controls.SetSize(Screen2, Times, GraphicsWindow.Height - 50) Shapes.SetOpacity(Screen2, (Times) / 3) EndFor Controls.SetTextBoxText(Screen, PrevText) Controls.SetTextBoxText(Screen2, PrevTxt) Controls.ShowControl(TMBtnSecondScreen) SecondScreenAdded = "Yes" ShowTopMenu() Else PrevText1 = Controls.GetTextBoxText(Screen) PrevText2 = Controls.GetTextBoxText(Screen2) Controls.SetTextBoxText(Screen, "") Controls.SetTextBoxText(Screen2, "") Shapes.HideShape(TMIconCopyPaste) Shapes.HideShape(TMSeperator6) Controls.HideControl(TMBtnCopyPaste) For Fade = 100 To 0 Step -0.08 Shapes.SetOpacity(Screen2, Fade) Shapes.SetOpacity(TMBackRec2, Fade) EndFor Controls.HideControl(Screen2) For Increase = 492 To 990 Step 0.8 Controls.SetSize(TMBackRec, Increase, 35) Controls.SetSize(Screen, Increase, GraphicsWindow.Height - 50) EndFor Controls.SetTextBoxText(Screen, PrevText1) Controls.SetTextBoxText(Screen2, PrevText2) ShowTopMenuControls() SecondScreenAdded = "No" EndIf EndIf ElseIf Controls.LastClickedButton = FDBtnIncrFS Then Sound.PlayClick() PrevFontSize = Controls.GetTextBoxText(FDTBFontSize) Controls.SetTextBoxText(FDTBFontSize, PrevFontSize + 1) ElseIf Controls.LastClickedButton = FDBtnDecrFS Then Sound.PlayClick() PrevFontSize = Controls.GetTextBoxText(FDTBFontSize) Controls.SetTextBoxText(FDTBFontSize, PrevFontSize - 1) ElseIf Controls.LastClickedButton = TMBtnCopyPaste Then Sound.PlayClick() HideAllMenus() ShowCopyPasteDialog() ElseIf Controls.LastClickedButton = CPBtnCancel Then Sound.PlayClick() HideAllMenus() ShowTopMenu() Shapes.ShowShape(Screen) Shapes.ShowShape(Screen2) ElseIf Controls.LastClickedButton = CPBtnRight Then Sound.PlayClick() HideAllMenus() ShowTopMenu() Shapes.ShowShape(Screen) Shapes.ShowShape(Screen2) If Controls.GetTextBoxText(Screen) = "" Then GraphicsWindow.ShowMessage("The first text field is empty.", "Information") Sound.PlayClick() Else Controls.SetTextBoxText(Screen2, Controls.GetTextBoxText(Screen)) EndIf ElseIf Controls.LastClickedButton = CPBtnLeft Then Sound.PlayClick() HideAllMenus() ShowTopMenu() Shapes.ShowShape(Screen) Shapes.ShowShape(Screen2) If Controls.GetTextBoxText(Screen2) = "" Then GraphicsWindow.ShowMessage("The second text field is empty.", "Information") Sound.PlayClick() Else Controls.SetTextBoxText(Screen, Controls.GetTextBoxText(Screen2)) EndIf ElseIf Controls.LastClickedButton = TMBtnAddImage Then Sound.PlayClick() If SecondScreenAdded = "Yes" Then GraphicsWindow.ShowMessage("You can not add an image while using a second text field.", "Information") Sound.PlayClick() Else If ImageAdded = "No" Then ImageAdded = "Yes" HideTopMenuControls() PrevTF1Txt = Controls.GetTextBoxText(Screen) Controls.SetTextBoxText(Screen, "") DecreaseLeftTF() Shapes.HideShape(Screen2) ShowTopMenuControls() AppearImageDialog() Controls.SetTextBoxText(Screen, PrevTF1Txt) ElseIf ImageAdded = "Yes" Then ImageAdded = "No" HideTopMenuControls() PrevTF1Txt = Controls.GetTextBoxText(Screen) Controls.SetTextBoxText(Screen, "") FadeImageDialog() IncreaseLeftTF() ShowTopMenuControls() Controls.SetTextBoxText(Screen, PrevTF1Txt) EndIf EndIf ElseIf Controls.LastClickedButton = TMBtnSettings Then Sound.PlayClick() HideAllMenus() ShowSettingsDialog() PreviousTop = Shapes.GetTop(SDRadio) CurrentMenu = "Settings" ElseIf Controls.LastClickedButton = SDBtnCancel Then Sound.PlayClick() HideAllMenus() Shapes.Move(SDRadio, 274, PreviousTop) ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf ElseIf Controls.LastClickedButton = SDBtnConfirm Then Sound.PlayClick() HideAllMenus() If Shapes.GetTop(SDRadio) = 201 Then ChangesAffect = "TF1" ElseIf Shapes.GetTop(SDRadio) = 261 Then ChangesAffect = "TF2" ElseIf Shapes.GetTop(SDRadio) = 321 Then ChangesAffect = "Both" EndIf ShowTopMenu() Shapes.ShowShape(Screen) If SecondScreenAdded = "Yes" Then Shapes.ShowShape(Screen2) ElseIf ImageAdded = "Yes" And ImageLoaded = "No" Then ShowImageDialog() ElseIf ImageLoaded = "Yes" Then Shapes.ShowShape(LoadedImage) EndIf ElseIf Controls.LastClickedButton = IDBtnCancel Then Sound.PlayClick() HideTopMenuControls() FadeImageDialog() IncreaseLeftTf() ShowTopMenuControls() ImageAdded = "No" ElseIf Controls.LastClickedButton = IDBtnAddImage Then Sound.PlayClick() GetAddImagePath = Controls.GetTextBoxText(IDTBAddImage) If GetAddImagePath = "" Then GraphicsWindow.ShowMessage("Please enter a path.", "Information") Sound.PlayClick() Else HideImageDialog() ImagePath = Controls.GetTextBoxText(IDTBAddImage) LoadedImage = Shapes.AddImage(ImagePath) Shapes.Move(LoadedImage, 505, 45) ImageLoaded = "Yes" EndIf EndIf EndSub End>VHX094.sb< Start>VHX123.sb< 'Key Stroke Recorder ver. 0.1 by Ezra94 GraphicsWindow.Title = "Key Stroke Recorder 0.1" GraphicsWindow.CanResize = "False" gw = 600 gh = 400 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw)*0.50 GraphicsWindow.Top = (Desktop.Height - gh)*0.25 Controls.TextTyped = onTextInput Controls.ButtonClicked = onButtonClick pre = Program.Directory ext = ".txt" 'main text box mbw = gw mbh = gh*0.71 mbx = (gw - mbw)*0.50 mby = (gh - mbh)*0.50 'buttons (Index:0-3) bw = gw*0.15 bh = gh*0.08 bx = (gw - bw) by = (gh - bh)*0.07 'save/open (saving) textbox sbw = gw*0.30 sbh = gh*0.06 sbx = (gw - sbw)*0.98 sby = (gh - sbh)*0.08 'save/open (file) button fbw = sbw/2 fbx = (gw - sbw)*0.76 'back button bbx = (gw - sbw)*0.54 buttonName = "0=Record;1=Play;2=Open;3=Save;4=Back;5=Stop" status = "1=Recording;2=Playing;3=Opening File;4=Saving File"'text displaying current action of recorder nameOfData = "1=(Number of Keys Strokes);2=(Key Stroke Intervals);3=(Content of Recording)"'names of ea. indice of dataType setMess = "Status: " mess = Shapes.AddText(setMess) Shapes.SetText(mess,setMess) initValues() createGUI() While "True" mainControls() recordText() playRecording() 'data() 'Please remove comment tag to save EndWhile Sub initValues sec = 0 min = Text.Append("0",0) dataIndex = 0 playRecord = "False" recording = "False" run = "False" start = "True" inputText = "False" clicked = "False" handleFiles = "False" seekInput = "True" textIndex = 0 mess = Shapes.AddText(setMess) EndSub Sub createGUI mainTextBox = Controls.AddMultiLineTextBox(mbx,mby) Controls.SetSize(mainTextBox,mbw,mbh) For i = 3 To 0 Step -1 button[i] = Controls.AddButton(buttonName[i], bx-(bw*i),by) Controls.SetSize(button[i],bw,bh) EndFor EndSub Sub mainControls While seekInput = "True" If (clicked = "True") Then ' "True" when any button is pressed If (lastClicked = "Record") Then recording = "True" deleteTempData() textIndex = 1 ElseIf (lastClicked = "Play") Then playRecord = "True" textIndex = 2 ElseIf (lastClicked = "Open") Then buttonIndex = 2 textIndex = 3 ElseIf (lastClicked = "Save") Then buttonIndex = 3 textIndex = 4 EndIf removeButton() Shapes.SetText(mess,setMess + status[textIndex]) clicked = "False" seekInput = "False" EndIf Program.Delay(250) 'delay allows buttons be more responsive but doesn't interfer with mainTimer() EndWhile EndSub Sub removeButton For i = 3 To 0 Step -1 Controls.Remove(button[i]) EndFor If (recording = "True" Or playRecord ="True") Then button[5] = Controls.AddButton(buttonName[5],bx,by) Controls.SetSize(button[5],bw,bh) Else fileBox = Controls.AddTextBox(sbx,sby) Controls.SetSize(FileBox,sbw,sbh) button[buttonIndex] = Controls.AddButton(buttonName[buttonIndex],fbx,sby) Controls.SetSize(button[buttonIndex],fbw,sbh) button[4] = Controls.AddButton(buttonName[4],bbx,sby) Controls.SetSize(button[4],fbw,sbh) handleFiles = "True" EndIf EndSub Sub recordText 'all data is recorded after pressing record button & until stop button pressed While recording = "True" mainTimer() If (inputText = "True" And run = "True") Then 'time is stored as 0232345, not 02:32:345, in dataType[2] (allows accurate comparision look at line 168) recordKeyStrokeInterval = Text.Append(min,sec) recordKeyStrokeInterval = Text.Append(recordKeyStrokeInterval,milliSec) dataType[2][dataIndex] = recordKeyStrokeInterval 'dataType[2] = record key stroke interval dataType[3][dataIndex] = Controls.GetTextBoxText(mainTextBox) 'dataType[3] = record content inputted in textbox dataIndex = dataIndex + 1 dataType[1] = Array.GetItemCount(dataType[3]) 'dataType[1] = record number of key strokes inputText = "False" ElseIf (lastClicked = "Stop") Then GraphicsWindow.Clear() createGUI() initValues() EndIf EndWhile EndSub Sub deleteTempData 'delete temporary data & prepares arrays for next recording For i = 0 To dataType[1] dataType[2][i] = "" dataType[3][i] = "" EndFor EndSub Sub playRecording While playRecord = "True" mainTimer() If (run = "True") Then 'curTime updated ea. loop & only temporary unlike recordKeyStrokeInterval which is stored & used later curTime = Text.Append(sec,milliSec) curTime = Text.Append(min,curTime) If (curTime = dataType[2][dataIndex]) Then Controls.SetTextBoxText(mainTextBox,dataType[3][dataIndex]) dataIndex = dataIndex + 1 EndIf If (dataIndex >= dataType[1]) Then Shapes.SetText(mess,setMess + "Done Playing") EndIf If (lastClicked = "Stop") Then GraphicsWindow.Clear() createGUI() initValues() EndIf EndIf EndWhile EndSub 'recreate timer by tracking PC's current millisecond--creates sec & min Sub mainTimer 'Every time record/play pressed milSec must be 0 before timer starts can compare more accurately (look at line 168) 'Timer starts under 3 conditions: 1)record/play button pressed 2)when pressed start = "True"3) pc's milSec is 0 If (Clock.Millisecond = 0 And start = "True") Then run = "True" start = "False" EndIf If (run = "True") Then 'store & update milliSec ea. loop milliSec = Clock.Millisecond EndIf If (milliSec >= 999) Then sec = sec + 1 If (sec < 10) Then sec = Text.Append("0",sec) EndIf Program.Delay(1) 'allows program to flow & record by 1 milSec EndIf If (sec > 59) Then sec = Text.Append("0",0) min = min + 1 If (min < 10) Then min = Text.Append("0",min) EndIf EndIf EndSub 'record up to 59 min 59 sec 999 milSec max Sub data While (handleFiles = "True") If (clicked = "True") Then ' "True" when any button is pressed retrieveFileName = Controls.GetTextBoxText(fileBox) fileName = Text.Append("\",retrieveFileName) 'main name of all 3 indices of dataType If (lastClicked = "Save") Then For i = 3 To 1 Step -1 'file subname of ea. indice of dataType [1] # of key strokes; [2] key stroke intervals; [3] content of key strokes fileSubName[i] = Text.Append(fileName,nameOfData[i]) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(pre+fileSubName[i]+ext,dataType[i]) EndFor ElseIf (lastClicked = "Open") Then For i = 3 To 1 Step -1 fileSubName[i] = Text.Append(fileName,nameOfData[i]) ' The following line could be harmful and has been automatically commented. ' dataType[i] = File.ReadContents(pre+fileSubName[i]+ext) EndFor EndIf clicked = "False" handleFiles = "False" GraphicsWindow.Clear() initValues() createGUI() EndIf Program.Delay(250) 'delay allows buttons be more responsive but doesn't interfer w/ mainTimer() EndWhile EndSub Sub onTextInput inputText = "True" EndSub Sub onButtonClick lastClicked = Controls.GetButtonCaption(Controls.LastClickedButton) clicked = "True" EndSub End>VHX123.sb< Start>VHX642.sb< GraphicsWindow.Height = 115 GraphicsWindow.Width = 300 GraphicsWindow.BrushColor = "Black" GraphicsWindow.Title = "" LDUtilities.ExitOnClose = "False" LDUtilities.GWClosing = OnGWClose 'GraphicsWindow.DrawText(45,5,"Enter your username and password") GraphicsWindow.DrawText(10,45,"Password") GraphicsWindow.DrawText(10,15,"Username") TxtBox2 = Controls.AddTextBox(85,15) 'TxtBox = Controls.AddTextBox(85,45) TxtBox = LDControls.AddPasswordBox(160,20,160) Shapes.Move(TxtBox,85,45) B = Controls.AddButton("OK",125,75) B2 = Controls.AddButton("Create an account",165,75) Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked If Controls.LastClickedButton = B Then Pass = LDControls.LastPassword User = Controls.GetTextBoxText(TxtBox2) If Pass = "" And User = "" Then GraphicsWindow.ShowMessage("Please enter your account info before pressing this button","") Goto Skip EndIf Var = LDNetwork.GetGameData("TankWars" + Controls.GetTextBoxText(TxtBox2)) If Var["password"] = LDControls.LastPassword Then GraphicsWindow.ShowMessage("Successfully changed","") ' The following line could be harmful and has been automatically commented. ' File.WriteLine("Settings.txt",1, LDEncryption.AESEncrypt(Controls.GetTextBoxText(TxtBox2),"TankWars")) LDProcess.Start(Program.Directory + "/Armored Assault.exe","") Program.End() Else GraphicsWindow.ShowMessage("Incorrect Username/Password","") EndIf EndIf Skip: If Controls.LastClickedButton = B2 Then Pass = LDControls.LastPassword User = Controls.GetTextBoxText(TxtBox2) If Pass = "" And User <> "" Then GraphicsWindow.ShowMessage("Please enter the password you wish to use","") EndIf If Pass = "" And User = "" Then GraphicsWindow.ShowMessage("Please enter your account info before pressing this button","") EndIf If Pass <> "" And User = "" Then GraphicsWindow.ShowMessage("Please enter the username you wish to use","") EndIf Var = LDNetwork.GetGameData("TankWars" + User) If Var["weapon"] <> "" Then GraphicsWindow.ShowMessage("The username ''" + User + "'' has allready been taken","") ElseIf Pass <> "" And User <> "" Then LDNetwork.SetGameData("TankWars" + User,"weapon=1;password=" + Pass + ";") GraphicsWindow.ShowMessage("Account successfully created!","") EndIf EndIf EndSub Sub OnGwClose LDProcess.Start(Program.Directory + "/GameMenu.exe","") Program.End() EndSub End>VHX642.sb< Start>VHX709.sb< dw=1200 dh=900 ya=140 r35=270 GraphicsWindow.Title="Atom demo LDUtilities.ShowErrors="false LDUtilities.ShowNoShapeErrors="false GraphicsWindow.Width =dw GraphicsWindow.Height=dh GraphicsWindow.Left=1 GraphicsWindow.Top =11 GraphicsWindow.BackgroundColor="teal view3D = LD3DView.AddView(dw,dh,"true") 'Will not clip to size if window rescaled LD3DView.AddDirectionalLight (view3D,"lightgray",-1 ,-1 ,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#55888888") LD3DView.ResetCamera(view3D,30,30,30, -1, -1, -1, "","","") LD3DView.AutoControl ("true" "true", -1 .25) For x=1 To 55 sa[x]=LD3DView.AddSphere (view3D .5 33 "red" "D") sb[x]=LD3DView.AddSphere (view3D .5 33 "blue" "D") LD3DView.TranslateGeometry(view3D sa[x], -2 0 0) LD3DView.TranslateGeometry(view3D sb[x] 0 2 0) LD3DView.SetCentre (view3D sa[x] 2, 0 0 "R1R2R3") LD3DView.SetCentre (view3D sb[x] 0, -2 0 "R1R2R3") LD3DView.AnimateRotation (view3D sa[x] LDMath.Cos(x*6) 0 LDMath.Sin(x*6) 0 360 1+x/10, -1) LD3DView.AnimateRotation (view3D sb[x] LDMath.Sin(x*6) 0 LDMath.Cos(x*6) 0 360 1+x/10, -1) Program.Delay (20) endfor For x=1 To 55 se[x]=LD3DView.AddSphere (view3D .3 33 "white" "D") LD3DView.TranslateGeometry(view3D se[x] 0 16+x 0) LD3DView.SetCentre (view3D se[x] 0, -16-x 0 "R1R2R3") LD3DView.AnimateRotation (view3D se[x] LDMath.Sin(x*6) 0 LDMath.Cos(x*6) 0 360 1+x/10, -1) program.Delay (15) EndFor For aa=0 To -1 px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Program.Delay(33) endfor End>VHX709.sb< Start>VHZ817.sb< string = "hallo" txtBox = Controls.AddTextBox(10 10) result = Shapes.AddText("result") Shapes.Move(result, 10, 45) LDFocus.SetFocus(txtBox) GraphicsWindow.KeyDown = OnKeyDown While 0=0 If key = "Return" Then If Text.ConvertToLowerCase(Controls.GetTextBoxText(txtBox)) = string Then Shapes.SetText(result, Controls.GetTextBoxText(txtBox)) Controls.SetTextBoxText(txtBox, "") ElseIf Controls.GetTextBoxText(txtBox) <> "" Then Shapes.SetText(result, "") GraphicsWindow.ShowMessage("Text is NOT equal to" "Message") EndIf key = "" EndIf Program.Delay(100) EndWhile Sub OnKeyDown key = GraphicsWindow.LastKey EndSub End>VHZ817.sb< Start>VJC201.sb< ' Kodalith effect simulation ' programme par Yvan Leduc August 1rst 2016 ' final program: KKM457 width=600 height=400 GraphicsWindow.Title = " Kodalith effect " GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=height GraphicsWindow.Width=width GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = "14" GraphicsWindow.BackgroundColor="black" 'path=Program.Directory 'image=ImageList.LoadImage(path+"/DSC_3433.JPG") 'image=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/907658") image=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/906535") GraphicsWindow.DrawResizedImage(image,0,0,600,400) totalpixels=width*height ' time process : 5 minutes While y < height For x= 1 To width-1 hex=graphicswindow.GetPixel(x,y) RED() GREEN() BLUE() RGB=R+G+B if RGB > 500 Then ' ( 255+255+255 =765 /2 = 382 ) MID GRAY GraphicsWindow.SetPixel(x,y,"white") elseif RGB > 300 Then GraphicsWindow.SetPixel(x,y,"black") elseif RGB > 100 Then GraphicsWindow.SetPixel(x,y,"white") endif endfor y=y+1 ENDWHILE Sound.PlayBellRing() Sub RED R[1]=Text.GetSubText(hex, 2, 1) R[2]=Text.GetSubText(hex, 3, 1) For H = 1 To 2 If R[H]="A" THEN R[H]=10 elseIf R[H]="B" THEN R[H]=11 elseIf R[H]="C" THEN R[H]=12 ElseIf R[H]="D" THEN R[H]=13 elseIf R[H]="E" THEN R[H]=14 elseIf R[H]="F" THEN R[H]=15 EndIf EndFor R= (R[2]* Math.Power(16,0))+ (R[1]* Math.Power(16,1)) EndSub Sub GREEN G[1]=Text.GetSubText(hex, 2, 1) G[2]=Text.GetSubText(hex, 3, 1) For H = 1 To 2 If G[H]="A" THEN G[H]=10 elseIf G[H]="B" THEN G[H]=11 elseIf G[H]="C" THEN G[H]=12 ElseIf G[H]="D" THEN G[H]=13 elseIf G[H]="E" THEN G[H]=14 elseIf G[H]="F" THEN G[H]=15 EndIf EndFor G = (G[2]* Math.Power(16,0))+ (G[1]* Math.Power(16,1)) EndSub Sub BLUE B[1]=Text.GetSubText(hex, 2, 1) B[2]=Text.GetSubText(hex, 3, 1) For H = 1 To 2 If B[H]="A" THEN B[H]=10 elseIf B[H]="B" THEN B[H]=11 elseIf B[H]="C" THEN B[H]=12 ElseIf B[H]="D" THEN B[H]=13 elseIf B[H]="E" THEN B[H]=14 elseIf B[H]="F" THEN B[H]=15 EndIf EndFor B= (B[2]* Math.Power(16,0))+ (B[1]* Math.Power(16,1)) EndSub End>VJC201.sb< Start>VJC621.sb< Init() Sub Init 'GraphicsWindow DTW = Desktop.Width DTH = Desktop.Height GWW = DTW - 10 GWH = DTH - 71 GWT = 0 GWL = -10 GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH GWFN = "Consolas" GWFS = 14 GraphicsWindow.FontName = GWFN GraphicsWindow.FontSize = GWFS BD = " Datum " BB = " € Betrag " BK = " Konto " BGK = " Gegenkonto " BT = "...............Buchungstext..............." headings[1] = BD headings[2] = BB headings[3] = BK headings[4] = BGK headings[5] = BT DV = LDControls.AddDataView(DTW -100, DTH - 200, headings) Shapes.Move(DV, 10, 30) K[1] = "10" KT[1] = "Kasse" K[2] = "12" KT[2] = "Bank" K[3] = "13" KT[3] = "Geldtransit" K[4] = "14" KT[4] = "Forderungen" K[5] = "16" KT[5] = "Verbindlichkeiten" K[6] = "40" KT[6] = "Lebensmittel" K[7] = "41" KT[7] = "Kleidung" K[8] = "45" KT[8] = "Fahrzeuge" K[9] = "49" KT[9] = "sonstige Kosten" K[10] = "80" KT[10] = "Einnahmen" For i = 1 To 10 KUT[i] = K[i] + " = " + KT[i] EndFor LDControls.DataViewSetColumnComboBox(DV,3,KUT) LDControls.DataViewSetColumnComboBox(DV,4,KUT) EndSub 'Init End>VJC621.sb< Start>VJF550.sb< 'Arrow-button w = 350 h = 290 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.Top = (Desktop.Height-h) / 2 GraphicsWindow.Left = (Desktop.Width-w) / 2 GraphicsWindow.FontSize = 15 'xxxxxxxxxxxxxx MAIN PROGRAM xxxxxxxxxxxxxxx CreateGUI() Controls.ButtonClicked = ButtonDown 'waiting for input and will execute each time the ButtonDown subroutine 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub CreateGUI Plus = Controls.AddButton("+", 20, 210) 'put in place the button Controls.SetSize(Plus, 40, 40) GraphicsWindow.BrushColor="green" Shapes.AddTriangle (30,240,50,240,40,220) EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub ButtonDown operator = Controls.GetButtonCaption(Controls.LastClickedButton) TextWindow.WriteLine("operator : "+operator) If operator="+" Then TextWindow.WriteLine("operator if : "+operator+" changed to -") controls.setbuttoncaption(plus,"-") GraphicsWindow.BrushColor="red" Shapes.AddTriangle (30,240,50,240,40,220) Else TextWindow.WriteLine("operator else : "+operator+" changed to +") controls.setbuttoncaption(plus,"+") GraphicsWindow.BrushColor="green" Shapes.AddTriangle (30,240,50,240,40,220) endif EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx End>VJF550.sb< Start>VJF857.sb< GraphicsWindow.Hide() GraphicsWindow.Width = 200 GraphicsWindow.Height = 330 GraphicsWindow.Title = "Calculator" GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "DarkSlateGray" GraphicsWindow.KeyDown = OnKeyDown holder = "" intdivon = "False" GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(10, 10, GraphicsWindow.Width - 20, 40) GraphicsWindow.FontSize = 36 GraphicsWindow.BrushColor = "Black" numbers = Shapes.AddText("0") Shapes.Move(numbers, 20, 10) btn7 = FCControls.AddButton(30, 30, "7") FCControls.Move(btn7, 22, 100) FCControls.RegisterMouseDownEvent(btn7, "n7") btn8 = FCControls.AddButton(30, 30, "8") FCControls.Move(btn8, 54, 100) FCControls.RegisterMouseDownEvent(btn8, "n8") btn9 = FCControls.AddButton(30, 30, "9") FCControls.Move(btn9, 86, 100) FCControls.RegisterMouseDownEvent(btn9, "n9") btn4 = FCControls.AddButton(30, 30, "4") FCControls.Move(btn4, 22, 132) FCControls.RegisterMouseDownEvent(btn4, "n4") btn5 = FCControls.AddButton(30, 30, "5") FCControls.Move(btn5, 54, 132) FCControls.RegisterMouseDownEvent(btn5, "n5") btn6 = FCControls.AddButton(30, 30, "6") FCControls.Move(btn6, 86, 132) FCControls.RegisterMouseDownEvent(btn6, "n6") btn1 = FCControls.AddButton(30, 30, "1") FCControls.Move(btn1, 22, 164) FCControls.RegisterMouseDownEvent(btn1, "n1") btn2 = FCControls.AddButton(30, 30, "2") FCControls.Move(btn2, 54, 164) FCControls.RegisterMouseDownEvent(btn2, "n2") btn3 = FCControls.AddButton(30, 30, "3") FCControls.Move(btn3, 86, 164) FCControls.RegisterMouseDownEvent(btn3, "n3") btnbck = FCControls.AddButton(30, 30, "←") FCControls.Move(btnbck, 22, 67) FCControls.RegisterMouseDownEvent(btnbck, "bck") ent = FCControls.AddButton(30, 94, "=") FCControls.Move(ent, 152, 132) FCControls.RegisterMouseDownEvent(ent, "calculate") btnbck = FCControls.AddButton(30, 30, "←") FCControls.Move(btnbck, 22, 67) FCControls.RegisterMouseDownEvent(btnbck, "bck") clear = FCControls.AddButton(30, 30, "C") FCControls.Move(clear, 54, 67) FCControls.RegisterMouseDownEvent(clear, "c") plus = FCControls.AddButton(30, 30, "+") FCControls.Move(plus, 86, 67) FCControls.RegisterMouseDownEvent(plus, "add") minus = FCControls.AddButton(30, 30, "-") FCControls.Move(minus, 119, 100) FCControls.RegisterMouseDownEvent(minus, "subtract") divide = FCControls.AddButton(30, 30, "÷") FCControls.Move(divide, 119, 132) FCControls.RegisterMouseDownEvent(divide, "slash") multiply = FCControls.AddButton(30, 30, "*") FCControls.Move(multiply, 119, 164) FCControls.RegisterMouseDownEvent(multiply, "mult") btn0 = FCControls.AddButton(94, 30, "0") FCControls.Move(btn0, 22, 196) FCControls.RegisterMouseDownEvent(btn0, "n0") btndot = FCControls.AddButton(30, 30, ".") FCControls.Move(btndot, 119, 196) FCControls.RegisterMouseDownEvent(btndot, "ndot") btnper = FCControls.AddButton(30, 30, "%") FCControls.Move(btnper, 152, 67) FCControls.RegisterMouseDownEvent(btnper, "nper") btnsqrt = FCControls.AddButton(30, 30, "√") FCControls.Move(btnsqrt, 119, 67) FCControls.RegisterMouseDownEvent(btnsqrt, "nsqrt") btnpwr = FCControls.AddButton(30, 30, "^") FCControls.Move(btnpwr, 152, 100) FCControls.RegisterMouseDownEvent(btnpwr, "npwr") btnintdiv = FCControls.AddButton(30, 30, "Int÷") FCControls.Move(btnintdiv, 22, 228) FCControls.RegisterMouseDownEvent(btnintdiv, "nintdiv") btnmemadd = FCControls.AddButton(30, 30, "M+") FCControls.Move(btnmemadd, 54, 228) FCControls.RegisterMouseDownEvent(btnmemadd, "memadd") btnmemm = FCControls.AddButton(30, 30, "M-") FCControls.Move(btnmemm, 86, 228) FCControls.RegisterMouseDownEvent(btnmemm, "memm") btnmemmr = FCControls.AddButton(30, 30, "MR") FCControls.Move(btnmemmr, 119, 228) FCControls.RegisterMouseDownEvent(btnmemmr, "memmr") btnsin = FCControls.AddButton(30, 30, "sin") FCControls.Move(btnsin, 152, 228) FCControls.RegisterMouseDownEvent(btnsin, "sin") btncos = FCControls.AddButton(30, 30, "cos") FCControls.Move(btncos, 22, 260) FCControls.RegisterMouseDownEvent(btncos, "cos") btntan = FCControls.AddButton(30, 30, "tan") FCControls.Move(btntan, 54, 260) FCControls.RegisterMouseDownEvent(btntan, "tan") btnlog = FCControls.AddButton(30, 30, "log") FCControls.Move(btnlog, 86, 260) FCControls.RegisterMouseDownEvent(btnlog, "LOG") btncosh = FCControls.AddButton(30, 30, "cosh") FCControls.Move(btncosh, 119, 260) FCControls.RegisterMouseDownEvent(btncosh, "cosh") btnsinh = FCControls.AddButton(30, 30, "sinh") FCControls.Move(btnsinh, 152, 260) FCControls.RegisterMouseDownEvent(btnsinh, "sinh") btnrnd = FCControls.AddButton(30, 30, "RND") FCControls.Move(btnrnd, 22, 292) FCControls.RegisterMouseDownEvent(btnrnd, "rnd") btnmax = FCControls.AddButton(30, 30, "↑/↓") FCControls.Move(btnmax, 22, 292) FCControls.RegisterMouseDownEvent(btnmax, "maxmin") Sub n1 holder = TextPlus.Append(holder, 1) draw() EndSub Sub n2 holder = TextPlus.Append(holder, 2) draw() EndSub Sub n3 holder = TextPlus.Append(holder, 3) draw() EndSub Sub n4 holder = TextPlus.Append(holder, 4) draw() EndSub Sub n5 holder = TextPlus.Append(holder, 5) draw() EndSub Sub n6 holder = TextPlus.Append(holder, 6) draw() EndSub Sub n7 holder = TextPlus.Append(holder, 7) draw() EndSub Sub n8 holder = TextPlus.Append(holder, 8) draw() EndSub Sub n9 holder = TextPlus.Append(holder, 9) draw() EndSub Sub n0 holder = TextPlus.Append(holder, 0) draw() EndSub Sub draw GraphicsWindow.FontSize = 36 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText(holder) Shapes.Move(numbers, 20, 10) If maxfinderon = "True" then holder3 = FCControls.GetText(numbers) EndIf EndSub Sub bck holder = TextPlus.RemoveSubText(holder, TextPlus.GetLength(holder)-1, 1) draw() EndSub Sub c holder = "" output = "" draw() Shapes.Remove(numbers) EndSub Sub calculate GraphicsWindow.FontSize = 36 'Check if Operation is Add If Text.GetIndexOf(holder, "+") <> 0 Then operationindex = Text.GetIndexOf(holder, "+") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation + textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Subtract If Text.GetIndexOf(holder, "-") <> 0 Then operationindex = Text.GetIndexOf(holder, "-") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation - textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Multiply If Text.GetIndexOf(holder, "*") <> 0 Then operationindex = Text.GetIndexOf(holder, "*") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation * textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Divide If Text.GetIndexOf(holder, "÷") <> 0 Then operationindex = Text.GetIndexOf(holder, "÷") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation / textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf If pwron = "True" then textbeforoperation = TextPlus.GetSubText(holder, 1, TextPlus.GetIndexOf(holder, "^") - 1) textafteroperation = TextPlus.GetSubTextToEnd(holder, TextPlus.GetIndexOf(holder, "^") + 1) output = MathPlus.Power(textbeforoperation, textafteroperation) pwron = "False" If output > 10000000 then showaserror() else showonscreen() endif EndIf If intdivon = "True" then textbeforoperation = TextPlus.GetSubText(holder, 1, TextPlus.GetIndexOf(holder, "÷R") - 1) textafteroperation = TextPlus.GetSubTextToEnd(holder, TextPlus.GetIndexOf(holder, "÷R") + 2) remainder = MathPlus.Remainder(textbeforoperation, textafteroperation) outputmain = textbeforoperation / textafteroperation intoutput = MathPlus.Round(outputmain) output = intoutput + "R " + remainder intdivon = "False" showonscreen() EndIf If Text.GetIndexOf(holder, "÷") = 0 and Text.GetIndexOf(holder, "+") = 0 and Text.GetIndexOf(holder, "-") = 0 and Text.GetIndexOf(holder, "÷R") = 0 and Text.GetIndexOf(holder, "^") = 0 and Text.GetIndexOf(holder, "*") = 0 then GraphicsWindow.FontSize = 20 output = "Syntax Error" holder = "" showonscreen() EndIf If maxfinderon = "True" then themax = Math.Max(holder2, holder3) themin = Math.Min(holder2, holder3) Shapes.Remove(smallnumbers) output = "MAX" + themax + ";MIN" + themin showonscreen() maxfinderon = "False" EndIf EndSub Sub showonscreen GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText(output) Shapes.Move(numbers, 20, 10) EndSub Sub add holder = TextPlus.Append(holder, "+") draw() EndSub Sub subtract holder = TextPlus.Append(holder, "-") draw() EndSub Sub slash holder = TextPlus.Append(holder, "÷") draw() EndSub Sub mult holder = TextPlus.Append(holder, "*") draw() EndSub Sub ndot holder = TextPlus.Append(holder, ".") draw() EndSub Sub nsqrt holder = MathPlus.SquareRoot(holder) draw() EndSub Sub nper percentconvert = holder * 100 holder = percentconvert + "%" draw() EndSub Sub npwr holder = TextPlus.Append(holder, "^") pwron = "True" draw() EndSub Sub nintdiv holder = TextPlus.Append(holder, "÷R") intdivon = "True" draw() EndSub Sub memadd GraphicsWindow.BrushColor = "Black" memory = holder If holder = "" Then memory = "0" EndIf GraphicsWindow.FontSize = 10 Shapes.Remove(showmem) showmem = Shapes.AddText(memory) Shapes.Move(showmem, GraphicsWindow.Width - 25, 38) EndSub Sub memm Shapes.Remove(showmem) memory = "" EndSub Sub memmr holder = memory draw() EndSub Sub sin holder = Math.Sin(holder) draw() EndSub Sub cos holder = Math.Sin(holder) draw() EndSub Sub tan holder = Math.Tan(holder) draw() EndSub Sub log holder = Math.Log(holder) draw() EndSub Sub cosh holder = MathPlus.Cosh(holder) draw() EndSub Sub sinh holder = MathPlus.Sinh(holder) draw() EndSub Sub rnd holder = Math.Round(holder) draw() EndSub Sub maxmin Shapes.Remove(numbers) GraphicsWindow.FontSize = 10 GraphicsWindow.BrushColor = "Black" Shapes.Remove(smallnumbers) If holder <> "" then smallnumbers = Shapes.AddText("NUM1=" + holder) maxfinderon = "True" draw() else GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText("Syntax Error") Shapes.Move(numbers, 20, 10) maxfinderon = "False" Endif Shapes.Move(smallnumbers, 140, 15) holder2 = holder holder = "" EndSub Sub showaserror GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText("Overflow Error") Shapes.Move(numbers, 20, 10) EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "D0" Then n0() ElseIf GraphicsWindow.LastKey = "D1" Then n1() ElseIf GraphicsWindow.LastKey = "D2" Then n2() ElseIf GraphicsWindow.LastKey = "D3" Then n3() ElseIf GraphicsWindow.LastKey = "D4" Then n4() ElseIf GraphicsWindow.LastKey = "D5" Then n5() ElseIf GraphicsWindow.LastKey = "D6" Then n6() ElseIf GraphicsWindow.LastKey = "D7" Then n7() ElseIf GraphicsWindow.LastKey = "D8" Then n8() ElseIf GraphicsWindow.LastKey = "D9" Then n9() ElseIf GraphicsWindow.LastKey = "Tab" Then calculate() ElseIf GraphicsWindow.LastKey = "Back" Then bck() ElseIf GraphicsWindow.LastKey = "NumPad1" Then n1() ElseIf GraphicsWindow.LastKey = "NumPad2" Then n2() ElseIf GraphicsWindow.LastKey = "NumPad3" Then n3() ElseIf GraphicsWindow.LastKey = "NumPad4" Then n4() ElseIf GraphicsWindow.LastKey = "NumPad5" Then n5() ElseIf GraphicsWindow.LastKey = "NumPad6" Then n6() ElseIf GraphicsWindow.LastKey = "NumPad7" Then n7() ElseIf GraphicsWindow.LastKey = "NumPad8" Then n8() ElseIf GraphicsWindow.LastKey = "NumPad9" Then n9() ElseIf GraphicsWindow.LastKey = "NumPad0" Then n0() ElseIf GraphicsWindow.LastKey = "Decimal" Then ndot() ElseIf GraphicsWindow.LastKey = "Add" Then add() ElseIf GraphicsWindow.LastKey = "Subtract" Then subtract() ElseIf GraphicsWindow.LastKey = "Multiply" Then mult() ElseIf GraphicsWindow.LastKey = "Divide" Then slash() ElseIf GraphicsWindow.LastKey = "Clear" Then c() ElseIf GraphicsWindow.LastKey = "C" Then c() ElseIf FCKeyboard.IsControlPressed Then memadd() ElseIf FCKeyboard.IsAltPressed Then memm() ElseIf FCKeyboard.IsShiftPressed Then nintdiv() EndIf EndSub End>VJF857.sb< Start>VJH175.sb< GraphicsWindow.Width =1200 GraphicsWindow.Height=900 GraphicsWindow.Title ="3D tubes GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.PenWidth=0 For z=2 To 0 Step -1 r=200 yi=0 For y=100 To 700 Step 3 yi=yi+1 For rw=0 To 2 x=ldmath.Sin (y-100)*200+300+rw*250 cc=math.Remainder (y/3+200+math.Remainder (rw 2)*40 360) GraphicsWindow.BrushColor = LDColours.HSLtoRGB (cc 1 .13+y/2200) ss[z][rw][yi]=Shapes.AddEllipse (r r) Shapes.move (ss[z][rw][yi] x y-55+z*180) EndFor r=r-.6 EndFor EndFor mmx=yi LDEvents.MouseWheel =mww Sub mww mmx=mmx-ldevents.LastMouseWheelDelta For r=1 To mmx For z=2 To 0 Step -1 For rw=0 To 2 Shapes.ShowShape (ss[z][rw][r]) endfor endfor EndFor For r=mmx To yi For z=2 To 0 Step -1 For rw=0 To 2 Shapes.hideShape (ss[z][rw][r]) endfor endfor EndFor EndSub End>VJH175.sb< Start>VJK277-0.sb< GraphicsWindow.PenWidth = 5 GraphicsWindow.PenColor = "#88FF8C00" GraphicsWindow.BrushColor = "#99FF4500" GW = 600 Drop_Amount = 20 GraphicsWindow.Width = GW GraphicsWindow.Height = GW For i = 1 To Drop_Amount Drop_Radius[i] = 15 Drop_X[i] = Math.GetRandomNumber(GW)-30 Drop_Y[i] = Math.GetRandomNumber(GW)-30 Drop[i] = Shapes.AddEllipse(Drop_Radius[i]*2,Drop_Radius[i]*2) endfor While "True" TimeStart = Clock.ElapsedMilliseconds For i = 1 To Drop_Amount If Drop_Radius[i] > 0 Then Distance2 = math.SquareRoot(math.Power(Drop_X[i]-GraphicsWindow.MouseX,2)+math.Power(Drop_Y[i]-GraphicsWindow.MouseY,2)) If Distance2 <= Drop_Radius[i] then TextWindow.WriteLine(Math.GetRandomNumber(999)) endif Shapes.Zoom(Drop[i],Drop_Radius[i]/12,Drop_Radius[i]/12) '/15 Shapes.Move(Drop[i],Drop_X[i]-15,Drop_Y[i]-15) 'original radius offset required here CheckDistance() endif endfor PerfectDelay = 20-(Clock.ElapsedMilliseconds-TimeStart) If PerfectDelay > 0 Then Program.Delay(PerfectDelay) EndIf endwhile Sub CheckDistance For b = i+1 to Drop_Amount 'Only consider each atom pair once If Drop_Radius[b] > 0 Then 'Only consider if atom i and atom b are still present 'Distance = math.SquareRoot(math.Power(Drop_X[i]-Drop_X[b],2)+math.Power(Drop_Y[i]-Drop_Y[b],2)) Distance = math.SquareRoot((Drop_X[i]-Drop_X[b])*(Drop_X[i]-Drop_X[b])+(Drop_Y[i]-Drop_Y[b])*(Drop_Y[i]-Drop_Y[b])) 'More efficient I thin If Distance <= (Drop_Radius[b] + Drop_Radius[i]) Then 'Always delete atom b and resize atom i 'Resize atom i If Drop_Radius[b] < Drop_Radius[i] Then Drop_Radius[i] = Drop_Radius[i] + Drop_Radius[b]/3 Else Drop_Radius[i] = Drop_Radius[b] + Drop_Radius[i]/3 endif 'Set position of Atom i, depending on the size weighted mean position - this will give smoother joining Drop_X[i] = (Drop_Radius[i]*Drop_X[i]+Drop_Radius[b]*Drop_X[b])/(Drop_Radius[i] + Drop_Radius[b]) Drop_Y[i] = (Drop_Radius[i]*Drop_Y[i]+Drop_Radius[b]*Drop_Y[b])/(Drop_Radius[i] + Drop_Radius[b]) 'Delete atom b Drop_X[b] = -1000 Drop_Y[b] = -1000 Drop_Radius[b] = 0 Shapes.Remove(Drop[b]) Else 'No other condition need here (either collided or not collided) 'Calculate velocity change, inversely proportional to distance and proportional to attracting atom radius velX = (Drop_X[i] - Drop_X[b]) / Distance / Distance * 2 velY = (Drop_Y[i] - Drop_Y[b]) / Distance / Distance * 2 Drop_X[b] = Drop_X[b] + velX * Drop_Radius[i] Drop_Y[b] = Drop_Y[b] + velY * Drop_Radius[i] Drop_X[i] = Drop_X[i] - velX * Drop_Radius[b] Drop_Y[i] = Drop_Y[i] - velY * Drop_Radius[b] endif endif endfor endsub End>VJK277-0.sb< Start>VJK277.sb< GraphicsWindow.PenWidth = 5 GraphicsWindow.PenColor = "#88FF8C00" GraphicsWindow.BrushColor = "#99FF4500" GW = 600 Drop_Amount = 20 GraphicsWindow.Width = GW GraphicsWindow.Height = GW For i = 1 To Drop_Amount Drop_Radius[i] = 15 Drop_X[i] = Math.GetRandomNumber(GW)-30 Drop_Y[i] = Math.GetRandomNumber(GW)-30 Drop[i] = Shapes.AddEllipse(Drop_Radius[i]*2,Drop_Radius[i]*2) endfor While "True" TimeStart = Clock.ElapsedMilliseconds For i = 1 To Drop_Amount If Drop_Radius[i] > 0 Then Distance2 = math.SquareRoot(math.Power(Drop_X[i]-GraphicsWindow.MouseX,2)+math.Power(Drop_Y[i]-GraphicsWindow.MouseY,2)) If Distance2 <= Drop_Radius[i] then TextWindow.WriteLine(Math.GetRandomNumber(999)) endif Shapes.Zoom(Drop[i],Drop_Radius[i]/12,Drop_Radius[i]/12) '/15 Shapes.Move(Drop[i],Drop_X[i]-Drop_Radius[i]/8,Drop_Y[i]-Drop_Radius[i]/8) CheckDistance() endif endfor PerfectDelay = 20-(Clock.ElapsedMilliseconds-TimeStart) If PerfectDelay > 0 Then Program.Delay(PerfectDelay) EndIf endwhile Sub CheckDistance For b = 1 to Drop_Amount If b <> i Then Distance = math.SquareRoot(math.Power(Drop_X[i]-Drop_X[b],2)+math.Power(Drop_Y[i]-Drop_Y[b],2)) If Distance <= (Drop_Radius[b] + Drop_Radius[i]) Then If Drop_Radius[b] < Drop_Radius[i] Then Drop_Radius[i] = Drop_Radius[i] + Drop_Radius[b]/3 Drop_X[b] = -1000 Drop_Y[b] = -1000 Drop_Radius[b] = 0 Shapes.Remove(Drop[b]) Else Drop_Radius[b] = Drop_Radius[b] + Drop_Radius[i]/3 Drop_X[i] = -1000 Drop_Y[i] = -1000 Drop_Radius[i] = 0 Shapes.Remove(Drop[i]) endif ElseIf Distance > (Drop_Radius[b] + Drop_Radius[i]) Then Drop_X[b] = Drop_X[b] + (Drop_X[i] - Drop_X[b]) / Distance / Distance * Drop_Radius[i] * 2 Drop_Y[b] = Drop_Y[b] + (Drop_Y[i] - Drop_Y[b]) / Distance / Distance * Drop_Radius[i] * 2 endif endif endfor endsub End>VJK277.sb< Start>VJK317.sb< player() variables() Menu() 'Done so far: 'got almost all mobs and bosses + bonus monsters/bosses 'got health pots and mana pots 'got/need skills 'got saving and loading, THINK SO! :D 'Need ASAP: 'equipment (add moar items!) 'questgiver (HOW!?!?!) 'town (NAME ? or more than one?) 'map (BUT HOOOOW) Sub variables path = Program.Directory + "\Diablo.txt" ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' variables=File.ReadContents(path) x = 0 y = 0 EndSub Sub Save_game path = Program.Directory + "\Diablo.txt" variables[1] = x variables[2] = y variables[3] = level variables[4] = playerhp variables[5] = playerstr variables[6] = playerdef variables[7] = playergold variables[8] = playerxp variables[9] = totalplayerhp variables[10] = sp variables[11] = totalplayermp variables[12] = playermp variables[13] = hppot variables[14] = mppot variables[15] = playervitinc variables[16] = playerintinc variables[17] = playervit variables[18] = playerint variables[19] = activatevls variables[20] = activatelbs variables[21] = activatescm variables[22] = activateepa variables[23] = activatesk variables[24] = activatezh variables[25] = activatedg ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteContents(path, variables) EndSub Sub load_game path = Program.Directory + "\Diablo.txt" x = variables[1] y = variables [2] level = variables[3] playerhp = variables[4] playerstr = variables[5] playerdef = variables[6] playergold = variables[7] playerxp = variables[8] totalplayerhp = variables[9] sp = variables[10] totalplayermp = variables[11] playermp = variables[12] hppot =variables[13] mppot = variables[14] playervitinc = variables[15] playerintinc = variables[16] playervit = variables[17] playerint = variables[18] activatevls = variables[19] activatelbs = variables[20] activatescm = variables[21] activateepa = variables[22] activatesk = variables[23] activatezh =variables[24] activatedg= variables[25] EndSub Sub player sp = 0 weapon = "Sword" level = 1 totalplayerhp = 100 + playervitinc playerhp = 100 + playervitinc playerstr = 10 - enemydef playerdef = 10 playergold = 0 playerxp = 0 playermp = 30 + playerintinc totalplayermp = 30 + playerintinc hppot = 10 mppot = 10 playervitinc = 0 playerintinc = 0 playervit = 10 playerint = 10 activatevls = 0 activatelbs = 0 activatescm = 0 activateepa = 0 activatedg = 0 activatesk = 0 activatezh = 0 EndSub Sub skeleton enemyname = "Skeleton" enemyhp = 10 totalenemyhp = 10 enemystr = 12 - playerdef enemydef = 1 xpdrop = 5 golddrop = 3 EndSub Sub hordeofzombies enemyname = "Horde of Zombies" enemyhp = 10 totalenemyhp = 10 enemystr = 12 - playerdef enemydef = 1 xpdrop = 5 golddrop = 3 EndSub Sub zombie enemyname = "Zombie" enemyhp = 20 totalenemyhp = 20 enemystr = 14 - playerdef enemydef = 2 xpdrop = 10 golddrop = 6 EndSub Sub demon enemyname = "Demon" enemyhp = 30 totalenemyhp = 30 enemystr = 16- playerdef enemydef = 3 xpdrop = 15 golddrop = 9 EndSub Sub skeletonking enemyname = "Leoric, the Skeleton King" enemyhp = 250 totalenemyhp = 250 enemystr = 25- playerdef enemydef = 15 xpdrop = 25 golddrop = 45 EndSub Sub zombiehulk enemyname = "Zombie Hulk" enemyhp = 300 totalenemyhp = 300 enemystr = 30- playerdef enemydef = 20 xpdrop = 30 golddrop = 50 EndSub Sub demongeneral enemyname = "Demon General" enemyhp = 500 totalenemyhp = 500 enemystr = 35- playerdef enemydef = 25 xpdrop = 40 golddrop = 60 EndSub Sub Mephisto eneyname = "Mephisto" enemyhp = 850 totalenemyhp = 850 enemystr = 50- playerdef enemydef = 40 xpdrop = 40 goldrop = 80 EndSub Sub Diablo enemyname = "Diablo" enemyhp = 1000 totalenemyhp = 1000 enemystr = 60- playerdef enemydef = 50 xpdrop = 50 golddrop = 100 EndSub Sub Menu TextWindow.WriteLine(" Diablo") space() TextWindow.WriteLine(" ALPHA TEST") For i =1 To 5 space() EndFor TextWindow.WriteLine(" 1. New Game") TextWindow.WriteLine(" 2. Load Game") TextWindow.WriteLine(" 3. Exit") For i =1 To 10 space() EndFor TextWindow.WriteLine("All trademarks referenced herein are the properties of their respective owners.") TextWindow.WriteLine(" ©2015 Blizzard Entertainment, Inc. All rights reserved.") space() menu1 = TextWindow.ReadKey() If menu1 = 1 Then TextWindow.Clear() intro() ElseIf menu1 = 2 then TextWindow.Clear() ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' variables = File.ReadContents(path) load_game() selectlocation() elseif menu1 = 3 then Program.End() Else wrongoption() Menu() EndIf EndSub Sub space TextWindow.WriteLine(" ") endsub Sub enter TextWindow.WriteLine("Press Enter") TextWindow.PauseWithoutMessage() TextWindow.Clear() endsub Sub wrongoption TextWindow.Clear() TextWindow.WriteLine("You can only select the ones listed.") space() enter() EndSub Sub intro TextWindow.WriteLine("Story: You need to save Sanctuary from the Prime Evils!") space() enter() selectlocation() EndSub Sub leveling If (50 <= playerxp) And (playerxp <= 99 * 50) And (Math.Remainder(playerxp, 50) = 0) Then sp = sp + 1 level = level + 1 EndIf EndSub Sub town If x = 1 And y = 1 then TextWindow.Clear() selectlocation() EndIf If x = 4 And y = 60 then TextWindow.Clear() selectlocation() EndIf If x = 1 And (2 <= y And y <= 6) Then TownRandom() endif If x = 4 And (61 <= y And y <= 66) Then TownRandom() endif EndSub Sub townshopname If x = 1 And y = 1 then TextWindow.WriteLine("8. Enter Newb Town Shop") space() EndIf If x = 4 And y = 60 then TextWindow.WriteLine("8. Enter Hell Town Shop") space() EndIf EndSub Sub townshopname2 If x = 1 And y = 1 then TextWindow.Write("Newb Town ") EndIf If x = 4 And y = 60 then TextWindow.Write("Hell Town ") EndIf EndSub Sub townshopenter if selectlocation1 = 8 then TextWindow.Clear() shop() EndIf EndSub Sub townname If x = 1 And y = 1 then TextWindow.WriteLine("Newb Town Shop") space() EndIf If x = 1 And (2 <= y And y <= 6) Then TextWindow.WriteLine("Newb Town") space() endif If x =4 And y = 60 then TextWindow.WriteLine("Hell Town Shop") space() EndIf If x = 4 And (61 <= y And y <= 66) Then TextWindow.WriteLine("Hell Town") space() endif EndSub sub townrandom randomencounter1 = Math.GetRandomNumber(100) If randomencounter1 < 3then TextWindow.Clear() TextWindow.WriteLine("You have found a Health Potion.") space() enter() hppot = hppot + 1 selectlocation() elseIf randomencounter1 < 6 then TextWindow.Clear() TextWindow.WriteLine("You have found a Mana Potion.") space() enter() mppot = mppot + 1 selectlocation() Else selectlocation() EndIf EndSub Sub selectlocation leveling() townname() TextWindow.WriteLine("Coordinates: " + "(" + x + "," + y + ")") space() TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp) space() TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold) space() TextWindow.WriteLine("Nephalem Health: " + playerhp + "/" + totalplayerhp + " Nephalem Mana: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. North (" + x + "," + (y + 1) + ")") TextWindow.WriteLine("2. East (" + (x + 1) + "," + y + ")") TextWindow.WriteLine("3. West (" + (x - 1) + "," + y + ")") TextWindow.WriteLine("4. South (" + x + "," + (y - 1) + ")") space() TextWindow.WriteLine("5. Inventory") TextWindow.WriteLine("6. Statistics") TextWindow.WriteLine("7. Journal") space() townshopname() TextWindow.WriteLine("9. Miscellaneous") space() selectlocation1 = TextWindow.ReadKey() townshopenter() If selectlocation1 = 1 Then TextWindow.Clear() y = y + 1 randomencounter() ElseIf selectlocation1 = 2 then TextWindow.Clear() x = x + 1 randomencounter() elseif selectlocation1 = 3 then TextWindow.Clear() x = x-1 randomencounter() elseif selectlocation1 = 4 then TextWindow.Clear() y = y-1 randomencounter() elseif selectlocation1 = 5 then TextWindow.Clear() selectlocationinventory() elseif selectlocation1 = 6 then TextWindow.Clear() stats() elseif selectlocation1 = 7 then TextWindow.Clear() journal() elseIf selectlocation1 = 9 Then misc() Else wrongoption() selectlocation() EndIf EndSub Sub journal TextWindow.WriteLine("Journal") space() TextWindow.WriteLine("Table of Contents") space() space() TextWindow.WriteLine("1. Monsters") TextWindow.WriteLine("2. Bosses") TextWindow.WriteLine("3. Weapons") TextWindow.WriteLine("4. Armors") TextWindow.WriteLine("5. Potions") TextWindow.WriteLine("6. Towns") TextWindow.WriteLine("7. Shops") space() TextWindow.WriteLine("8. Return") space() journal1 =TextWindow.ReadKey() If journal1 = 1 then TextWindow.Clear() mobjournal() elseIf journal1 = 2 then TextWindow.Clear() bossjournal() elseIf journal1 = 3 then TextWindow.Clear() weaponjournal() elseIf journal1 = 4 then TextWindow.Clear() armorjournal() elseIf journal1 = 5 then TextWindow.Clear() potionjournal() elseIf journal1 = 6 then TextWindow.Clear() townjournal() elseIf journal1 = 7 then TextWindow.Clear() shopjournal() elseIf journal1 = 8 Then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongoption() TextWindow.Clear() journal() EndIf endsub Sub mobjournal TextWindow.WriteLine("Monsters") space() space() TextWindow.WriteLine("Skeleton") TextWindow.WriteLine("Health: 10") TextWindow.WriteLine("Strenght: 12") TextWindow.WriteLine("Defence: 1") TextWindow.WriteLine("Experience: 5") TextWindow.WriteLine("Gold drop: 3") space() TextWindow.WriteLine("Zombie") TextWindow.WriteLine("Health: 20") TextWindow.WriteLine("Strenght: 14") TextWindow.WriteLine("Defence: 2") TextWindow.WriteLine("Experience: 10") TextWindow.WriteLine("Gold drop: 6") space() TextWindow.WriteLine("Demon") TextWindow.WriteLine("Health: 30") TextWindow.WriteLine("Strenght: 16") TextWindow.WriteLine("Defence: 3") TextWindow.WriteLine("Experience: 15") TextWindow.WriteLine("Gold drop: 9") space() space() TextWindow.WriteLine("1. Return 2. Next Page") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() mobjournal() endif EndSub Sub bossjournal TextWindow.WriteLine("Bosses") space() space() TextWindow.WriteLine("Skeleton King: HP = 250, Str = 25, Def = 15, XP drop = 25, Gold drop = 45") TextWindow.WriteLine("Appears on (9,66)") space() TextWindow.WriteLine("Zombie Hulk: HP = 300, Str = 30, Def = 20, XP drop = 30, Gold drop = 50") TextWindow.WriteLine("Appears on (3,66)") space() TextWindow.WriteLine("Demon General: HP = 500, Str = 35, Def = 25, XP drop = 40, Gold drop = 60") TextWindow.WriteLine("Appears on (6,46)") space() TextWindow.WriteLine("Diablo: HP = 1000, Str = 60, Def = 50, XP drop = 50, Gold drop = 100") TextWindow.WriteLine("Appears on (6,66) and when all previous bosses are defeated") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() bossjournal() endif EndSub Sub weaponjournal TextWindow.WriteLine("Weapons") space() space() TextWindow.WriteLine("Vampire Long Sword: Has a 40% chance to siphon the enemy hp and add it to yours") space() TextWindow.WriteLine("Lightning Broad Sword: Has a 30% chance to stun the enemy for 1 turn") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() weaponjournal() endif EndSub Sub armorjournal TextWindow.WriteLine("Armor") space() space() TextWindow.WriteLine("Spiked Chain Mail: Deals damage every turn to the enemy") space() TextWindow.WriteLine("Electric Plate Armor: Has a 30% chance to stub the enemey for 1 turn") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() armorjournal() endif EndSub Sub potionjournal TextWindow.WriteLine("Potions") space() space() TextWindow.WriteLine("HP Potion: Heals 15 HP") space() TextWindow.WriteLine("MP Potion: Gives 15 MP") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() potionjournal() endif EndSub Sub shopjournal TextWindow.WriteLine("Shop") space() space() TextWindow.WriteLine("A place of commerce where you can buy and sell goods") TextWindow.WriteLine("You will meet shops around the world randomly") space() space() TextWindow.WriteLine("Newb Town Shop: Appears on (1,1)") space() TextWindow.WriteLine("Hell Town Shop: Appears on (4,60)") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() shopjournal() endif EndSub Sub townjournal TextWindow.WriteLine("Town") space() space() TextWindow.WriteLine("Safe Zones where you will randomly find potions") TextWindow.WriteLine("Towns will always have 1 or 2 shops") space() space() TextWindow.WriteLine("Newb Town: Appears on (1,2),(1,3),(1,4),(1,5),(1,6)") space() TextWindow.WriteLine("Hell Town: Appears on (4,61),(4,62),(4,63),(4,64),(4,65),(4,66)") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() townjournal() endif EndSub Sub stats TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp) space() TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold) space() TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp + " Player MP: " + playermp + "/" + totalplayermp) space() space() TextWindow.WriteLine("1. Strength: " + playerstr + " Gives 1 dmg per point") TextWindow.WriteLine("2. Vitality: " + playervit + " Gives 5 HP per point") TextWindow.WriteLine("3. Endurance: " + playerdef + " Gives reduces 1 dmg per point") TextWindow.WriteLine("4. Intelligence: " + playerint + " Gives 3 MP per point") TextWindow.WriteLine(" ") TextWindow.WriteLine("5. Return") space() staat = TextWindow.ReadKey() If staat = 1 then spiszero() sp = sp - 1 playerstr = playerstr + 1 TextWindow.Clear() stats() elseif staat = 2 then spiszero() sp = sp - 1 playervit = playervit + 1 playervitinc = playervitinc + 5 TextWindow.Clear() stats() elseif staat = 3 then spiszero() sp = sp - 1 playerdef = playerdef + 1 TextWindow.Clear() stats() elseif staat = 4 then spiszero() sp = sp - 1 playerint = playerint +1 playerintinc = playerintinc + 3 TextWindow.Clear() stats() elseIf staat = 5 Then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongoption() stats() EndIf endsub Sub spiszero If sp = 0 Then TextWindow.Clear() stats() EndIf EndSub Sub randomencounter town() randomencounter1 = Math.GetRandomNumber(100) If randomencounter1 < 5then TextWindow.Clear() TextWindow.WriteLine("You found a HP Potion.") space() enter() hppot = hppot + 1 selectlocation() elseIf randomencounter1 < 10 then TextWindow.Clear() TextWindow.WriteLine("You found a MP Potion.") space() enter() mppot = mppot + 1 selectlocation() elseIf randomencounter1 < 30 then TextWindow.Clear() shop() else enemy() EndIf EndSub Sub shop TextWindow.Clear() townshopname2() TextWindow.WriteLine("Shop") space() TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Weapon") TextWindow.WriteLine("2. Armor") TextWindow.WriteLine("3. Potion") space() TextWindow.WriteLine("4. Return") space() shop = TextWindow.ReadKey() if shop = 1 Then TextWindow.Clear() weapons() ElseIf shop = 2 then TextWindow.Clear() armors() elseif shop = 3 Then TextWindow.Clear() potions() elseif shop = 4 then TextWindow.Clear() selectlocation() Else wrongoption() shop() EndIf EndSub Sub potions TextWindow.WriteLine("HP Pot: x" + hppot + " MP Pot: x" + mppot) space() TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Buy 1 HP Pot: 10 gold") TextWindow.WriteLine("2. Buy 1 MP Pot: 10 gold") space() TextWindow.WriteLine("3. Sell 1 MP Pot: 5 gold") TextWindow.WriteLine("4. Sell 1 MP Pot: 5 gold") space() TextWindow.WriteLine("5. Return") space() potion1 = TextWindow.ReadKey() If potion1= 1 Then If playergold < 10 Then TextWindow.Clear() potions() EndIf hppot = hppot + 1 playergold = playergold - 10 TextWindow.Clear() potions() ElseIf potion1= 2 then If playergold < 10 Then TextWindow.Clear() potions() EndIf mppot = mppot + 1 playergold = playergold - 10 TextWindow.Clear() potions() elseif potion1= 3 then If hppot <= 0 then TextWindow.Clear() potions() EndIf playergold = playergold + 5 hppot = hppot - 1 TextWindow.Clear() potions() elseif potion1= 4 then If mppot <= 0 then TextWindow.Clear() potions() EndIf playergold = playergold + 5 mppot = mppot - 1 TextWindow.Clear() potions() elseif potion1 = 5 then TextWindow.Clear() shop() Else wrongoption() potions() EndIf EndSub Sub weapons TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Buy Vampire Long Sword x" + activatevls + " Cost: 50 gold") TextWindow.WriteLine("2. Buy Lightning Broad Sword x" + activatelbs + " Cost: 50 gold") space() TextWindow.WriteLine("3. Return") space() weapon1 = TextWindow.ReadKey() If weapon1= 1 Then If activatevls =1 Then TextWindow.Clear() weapons() EndIf If playergold < 50 Then TextWindow.Clear() weapons() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Vampire Long Sword!") activatevls = 1 activatelbs = 0 playergold = playergold - 50 TextWindow.Clear() weapons() elseIf weapon1= 2 Then If activatelbs = 1 Then TextWindow.Clear() weapons() EndIf If playergold < 50 Then TextWindow.Clear() weapons() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Lightning Broad Sword!") activatelbs = 1 activatevls = 0 playergold = playergold - 50 TextWindow.Clear() weapons() elseif weapon1 = 3 then TextWindow.Clear() shop() Else wrongoption() weapons() EndIf EndSub Sub vampirelongsword If activatevls = 1 then vlschance = Math.GetRandomNumber(100) If vlschance <40 Then vlssiphon = enemyhp/10 weapon = "Vampire Long Sword" enemyhp = enemyhp - vlssiphon playerhp = playerhp + vlssiphon space() TextWindow.WriteLine("Vampire Long Sword siphons " + vlssiphon + " HP") Else endif playerhpormpoverhun() endif EndSub Sub playerhpormpoverhun If playerhp > 100 Then playerhp = totalplayerhp EndIf If playermp > 30 Then playermp = totalplayermp endif EndSub Sub lightningbroadsword If activatelbs = 1 then lbschance = Math.GetRandomNumber(100) lbsstun() EndIf EndSub Sub lbsstun stun = 0 If lbschance <30 Then weapon = "Lightning Broad Sword" stun = stun + 1 Else EndIf if stun > 0 then stun = stun - 1 playerattackstun() If enemyhp <= 0 Then TextWindow.Clear() EndIf Else EndIf EndSub sub playerattackstun space() TextWindow.WriteLine(enemyname + " is stun for 1 turn.") spikechainmail() enemyhp = enemyhp - playerstr space() enter() battle() endsub Sub armors TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Spiked Chain Mail x" + activatescm + " Cost: 50 gold") TextWindow.WriteLine("2. Electric Plate Armor x" + activateepa + " Cost: 50 gold") space() TextWindow.WriteLine("3. Return") space() armor1 = TextWindow.ReadKey() If armor1= 1 Then If activatescm =1 Then TextWindow.Clear() armors() EndIf If playergold < 50 Then TextWindow.Clear() armors() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Spiked Chain Mail!") activatescm = 1 activateepa = 0 playergold = playergold - 50 TextWindow.Clear() armors() elseIf armor1= 2 Then If activateepa =1 Then TextWindow.Clear() armors() EndIf If playergold < 50 Then TextWindow.Clear() armors() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Electric Plate Armor!") activateepa = 1 activatescm = 0 playergold = playergold - 50 TextWindow.Clear() armors() elseif armor1 = 3 then TextWindow.Clear() shop() Else wrongoption() armors() EndIf EndSub Sub spikechainmail If activatescm = 1 then spikechainmaildmg = totalenemyhp/25 space() TextWindow.WriteLine(armor + " deals " + spikechainmaildmg + " dmg.") enemyhp = enemyhp - spikechainmaildmg Else endif endsub Sub electricplatearmor If activateepa = 1 then epachance = Math.GetRandomNumber(100) epastun() EndIf EndSub Sub epastun stun = 0 If epachance <30 Then armor = "Electric Plate Armor" stun = stun + 1 Else EndIf if stun > 0 then stun = stun - 1 epaarmorstun() If enemyhp <= 0 Then TextWindow.Clear() EndIf Else EndIf EndSub sub epaarmorstun space() enemyhp = enemyhp - playerstr TextWindow.WriteLine(enemyname + " is stun for 1 turn.") space() enter() battle() endsub Sub weaponname If activatevls = 1 then weapon = "Vampire Long Sword" EndIf If activatelbs = 1 then weapon = "Lightning Broad Sword" endif EndSub Sub armorname If activatescm = 1 then armor = "Spiked Chain Mail" EndIf If activateepa = 1 then armor = "Electric Plate Armor" EndIf EndSub Sub selectlocationinventory playerhpormpoverhun() If hppot < 1 Then TextWindow.Clear() selectlocationinventory() ElseIf mppot < 1 then TextWindow.Clear() selectlocationinventory() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use HP Pot x" + hppot) TextWindow.WriteLine("2. Use MP Pot x" +mppot) space() TextWindow.WriteLine("3. Return") space() inventory1 = TextWindow.ReadKey() If inventory1 = 1 Then If playerhp = 100 Then TextWindow.Clear() selectlocationinventory() endif space() TextWindow.WriteLine("You gain 15 HP") space() playerhp = playerhp + 15 hppot = hppot - 1 enter() selectlocationinventory() elseIf inventory1 = 2 Then If playermp = 30 Then TextWindow.Clear() selectlocationinventory() endif space() TextWindow.WriteLine("You gain 15 MP") space() playermp = playermp + 15 mppot = mppot - 1 enter() selectlocationinventory() elseif inventory1 = 3 then TextWindow.Clear() selectlocation() EndIf EndSub Sub misc TextWindow.Clear() TextWindow.WriteLine("1. Save") TextWindow.WriteLine("2. Load") TextWindow.WriteLine("3. Return") TextWindow.WriteLine("4. Exit") space() misc1 = TextWindow.ReadKey() If misc1 = 1 Then Save_game() TextWindow.Clear() TextWindow.WriteLine("Game has been saved") space() enter() Program.End() ElseIf misc1 = 2 then TextWindow.Clear() ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' variables = File.ReadContents(path) load_game() selectlocation() elseif misc1 = 4 then Program.End() ElseIf misc1 = 3 then TextWindow.Clear() selectlocation() Else wrongoption() misc() EndIf EndSub Sub enemy TextWindow.Clear() If x = 6 And y = 66 and activatedg = 1 And activatesk = 1 And activatezh = 1 Then Diablo() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() ElseIf x = 6 and y = 46 then demongeneral() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() elseif x = 3 and y = 66 then zombiehulk() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() elseif x = 9 and y = 66 then skeletonking() battle() endif enemy1 = Math.GetRandomNumber(100) If enemy1 < 40 Then skeleton() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() ElseIf enemy1 <70 then zombie() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() elseif enemy1 <100 then demon() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() EndIf EndSub Sub battle If playerhp<=0Then defeat() EndIf If enemyhp <= 0 Then mobwin() EndIf TextWindow.Clear() weaponname() armorname() TextWindow.WriteLine(enemyname ) space() TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp) space() TextWindow.WriteLine("1. Use your " + weapon) TextWindow.WriteLine("2. Inventory") TextWindow.WriteLine("3. Skills") TextWindow.WriteLine("4. Run Away") TextWindow.WriteLine("5. Do Nothing") space() battle1 = TextWindow.ReadKey() If battle1 = 1 Then playerattack() ElseIf battle1 = 2 then TextWindow.Clear() inventory() elseif battle1 = 3 then TextWindow.Clear() skill() elseif battle1 = 4 then runaway1 = Math.GetRandomNumber(2) If runaway1 =1 then space() TextWindow.WriteLine(enemyname + " attacked your back and dealt " + enemystr+".") playerhp = playerhp - enemystr space() enter() battle() Else TextWindow.Clear() selectlocation() EndIf elseif battle1 = 5 then TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr space() enter() battle() Else wrongoption() battle() endif EndSub Sub inventory playerhpormpoverhun() If hppot < 1 Then TextWindow.Clear() selectlocationinventory() ElseIf mppot < 1 then TextWindow.Clear() selectlocationinventory() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use HP Pot x" + hppot) TextWindow.WriteLine("2. Use MP Pot x" + mppot) space() TextWindow.WriteLine("3. Return") space() inventory1 = TextWindow.ReadKey() If inventory1 = 1 Then If playerhp = 100 Then TextWindow.Clear() inventory() endif space() TextWindow.WriteLine("You gain 15 HP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr playerhp = playerhp + 15 hppot = hppot -1 enter() inventory() elseIf inventory1 = 2 Then If playermp = 30 Then TextWindow.Clear() inventory() endif space() TextWindow.WriteLine("You gain 15 MP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr playermp = playermp + 15 mppot = mppot - 1 enter() inventory() elseif inventory1 = 3 then TextWindow.Clear() battle() EndIf EndSub Sub skill If playerhp<=0Then defeat() EndIf If enemyhp <= 0 Then mobwin() EndIf If playermp <= 0 Then TextWindow.Clear() battle() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp) space() TextWindow.WriteLine("1. Insta Crit Cost: 5 MP") TextWindow.WriteLine("2. Heal Cost: 5 MP") space() TextWindow.WriteLine("3. Return") space() skill1 = TextWindow.ReadKey() space() If skill1 = 1 Then TextWindow.WriteLine("You dealt " + (playerstr *1.5)) space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") space() playerhp = playerhp - enemystr enemyhp = enemyhp - (playerstr*1.5) playermp = playermp - 5 enter() skill() ElseIf skill1 = 2 then TextWindow.WriteLine("You healed yourself for 50 HP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") space() playerhp = playerhp - enemystr enter() playerhp = playerhp + 50 playermp = playermp - 5 playerhpormpoverhun() skill() elseif skill1 = 3 then TextWindow.Clear() battle() Else wrongoption() EndIf EndSub sub playerattack space() TextWindow.WriteLine("You attacked and dealt " +playerstr + " dmg.") vampirelongsword() lightningbroadsword() spikechainmail() electricplatearmor() space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+" dmg.") enemyhp = enemyhp - playerstr playerhp = playerhp - enemystr space() enter() battle() endsub Sub diabloactivate If x = 6 and y = 46 then activatedg = 1 elseif x = 3 and y = 66 then activatezh = 1 elseif x = 9 and y = 66 then activatesk = 1 EndIf EndSub sub mobwin TextWindow.Clear() diabloactivate() TextWindow.WriteLine("You defeated " + enemyname + ".") space() TextWindow.WriteLine("You gain " + xpdrop + " exp.") TextWindow.WriteLine("You gain " + golddrop + " gold.") playerxp = playerxp + xpdrop playergold = playergold + golddrop space() enter() selectlocation() EndSub Sub defeat TextWindow.Clear() TextWindow.WriteLine("You have been defeated!") enter() Program.End() EndSub End>VJK317.sb< Start>VJQ084.sb< GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.MouseMove=mdd GraphicsWindow.MouseDown=mww GraphicsWindow.PenWidth=2 GraphicsWindow.Title="Metallic Foils Draw GraphicsWindow.Width=1200 GraphicsWindow.Height=800 GraphicsWindow.Left=5 GraphicsWindow.Top=5 cx=400 cy=cx ox=-1 Sub mdd If Mouse.IsLeftButtonDown Then GraphicsWindow.BrushColor=LDColours.HSLtoRGB(math.Remainder( hh 360) math.Abs(LDMath.Cos(hh)) (1+LDMath.Sin(hh/3))/4+.25) GraphicsWindow.PenColor=GraphicsWindow.BrushColor hh=hh+3 mx=GraphicsWindow.MouseX my=GraphicsWindow.MouseY If ox>=0 Then ss=Shapes.AddTriangle(cx cy mx my ox oy) LDShapes.ZIndex(ss, in) EndIf ox=mx oy=my in=in-1 EndIf EndSub Sub mww If Mouse.IsRightButtonDown Then cx=GraphicsWindow.MouseX cy=GraphicsWindow.MouseY ii=LDGraphicsWindow.Capture("" "false") GraphicsWindow.Clear() GraphicsWindow.DrawImage(ii 0 0) ox=-1 in=in+1000 EndIf EndSub End>VJQ084.sb< Start>VJQ222.sb< GraphicsWindow.Width = Desktop.Width - 100 GraphicsWindow.Height = Desktop.Height - 125 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.BrushColor = "Black" GraphicsWindow.CanResize = "No" GraphicsWindow.Top = 13.5 GraphicsWindow.Left = 50 BallCount = 5 NumOfTanksAllowedOut = 10 Money = 50 TankImg = "http://sean.alyrica.net/TD/Tank.png" NumOfTanks = 10 TankWidth = 100 TankHeight = 40 TankPriceInc = 10 IntTankSpeed = 2 TankMaxVar = 10 TankCost = 10 IntTankHealth = 1000 TankHealthInc = 1000 TankHealthIncAcc = 1500 MoneyText = Shapes.AddText("You Have " + Money + "$") Shapes.Move(MoneyText,GraphicsWindow.Width - 100,10) Img = ImageList.LoadImage("http://www.sean.alyrica.net/TD/Background.Png") For i10 = 1 to GraphicsWindow.Width Step 175 For i11 = 1 To GraphicsWindow.Height Step 125 GraphicsWindow.DrawImage(Img,i10,i11) EndFor EndFor NumOfTurretTypes = 6 '<-- This MUST be set to the number of turrets Types!!! '------Turret Properties-------------------------------------------------------------------- TurretPic[1]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base.Png" 'The Stationary part Pic TurretPic[1]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top.Png" 'The Turning part Pic TurretPic[1]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img TurretProp[1]["Name"] = "Type 1 Turret" 'Turret Name TurretProp[1]["BallSize"] = 5 'Ball Size (If Projectile is set to Ball) TurretProp[1]["BallColor"] = "Black" 'Ball Color (If Projectile is set to Ball) TurretProp[1]["Price"] = 25 'Cost in $ TurretProp[1]["Speed"] = 100 'Velocity TurretProp[1]["ROF"] = 500 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[1]["Damage"] = 400 'The Damage it does to the tank when it fires TurretProp[1]["Range"] = 200 '------------------------------------------------------------------------------------------------ TurretPic[2]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base2.Png" 'The Stationary part Pic TurretPic[2]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top2.Png" 'The Turning part Pic TurretPic[2]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img TurretProp[2]["Name"] = "Type 2 Turret" 'Turret Name TurretProp[2]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball) TurretProp[2]["BallColor"] = "Blue" 'Ball Color (If Projectile is set to Ball) TurretProp[2]["Price"] = 50 'Cost in $ TurretProp[2]["Speed"] = 125 'Velocity TurretProp[2]["ROF"] = 1250 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[2]["Damage"] = 1000 'The Damage it does to the tank when it fires TurretProp[2]["Range"] = 200 '------------------------------------------------------------------------------------------------- TurretPic[3]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base3.Png" 'The Stationary part Pic TurretPic[3]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top4.Png" 'The Turning part Pic TurretPic[3]["Projectile"]["Path"] = "http://sean.alyrica.net/TD/Missile2.Png" 'Set to Ball For Ball Or The file path for a img TurretProp[3]["Name"] = "Type 1 Missile Launcher" 'Turret Name TurretProp[3]["BallSize"] = 15 'Ball Size (If Projectile is set to Ball) TurretProp[3]["BallColor"] = "Red" 'Ball Color (If Projectile is set to Ball) TurretProp[3]["Price"] = 150 'Cost in $ TurretProp[3]["Speed"] = 100 'Velocity TurretProp[3]["ROF"] = 1550 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[3]["Damage"] = 2000 'The Damage it does to the tank when it fires TurretProp[3]["Range"] = 300 '-------------------------------------------------------------------------------------------------- TurretPic[4]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base3.Png" 'The Stationary part Pic TurretPic[4]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top5.Png" 'The Turning part Pic TurretPic[4]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img TurretProp[4]["Name"] = "Type 2 Missile Launcher" 'Turret Name TurretProp[4]["BallSize"] = 15 'Ball Size (If Projectile is set to Ball) TurretProp[4]["BallColor"] = "Orange" 'Ball Color (If Projectile is set to Ball) TurretProp[4]["Price"] = 500 'Cost in $ TurretProp[4]["Speed"] = 200 'Velocity TurretProp[4]["ROF"] = 1000 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[4]["Damage"] = 5000 'The Damage it does to the tank when it fires TurretProp[4]["Range"] = 310 '-------------------------------------------------------------------------------------------------- TurretPic[5]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base4.Png" 'The Stationary part Pic TurretPic[5]["Top"]["Path"] = "http://sean.alyrica.net/TD/TopAir.Png" 'The Turning part Pic TurretPic[5]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img TurretProp[5]["Name"] = "Rapid Fire Turret" 'Turret Name TurretProp[5]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball) TurretProp[5]["BallColor"] = "Red" 'Ball Color (If Projectile is set to Ball) TurretProp[5]["Price"] = 700 'Cost in $ TurretProp[5]["Speed"] = 150 'Velocity TurretProp[5]["ROF"] = 250 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[5]["Damage"] = 1500 'The Damage it does to the tank when it fires TurretProp[5]["Range"] = 310 '-------------------------------------------------------------------------------------------------- TurretPic[6]["Base"]["Path"] = "http://sean.alyrica.net/TD/Base4.Png" 'The Stationary part Pic TurretPic[6]["Top"]["Path"] = "http://sean.alyrica.net/TD/Top6.Png" 'The Turning part Pic TurretPic[6]["Projectile"]["Path"] = "Ball" 'Set to Ball For Ball Or The file path for a img TurretProp[6]["Name"] = "Heavy Turret" 'Turret Name TurretProp[6]["BallSize"] = 10 'Ball Size (If Projectile is set to Ball) TurretProp[6]["BallColor"] = "Yellow" 'Ball Color (If Projectile is set to Ball) TurretProp[6]["Price"] = 1000 'Cost in $ TurretProp[6]["Speed"] = 150 'Velocity TurretProp[6]["ROF"] = 1500 'Rate Of Fire. In Millseconds Length in between fireing TurretProp[6]["Damage"] = 10500 'The Damage it does to the tank when it fires TurretProp[6]["Range"] = 250 Img5 = ImageList.LoadImage("http://sean.alyrica.net/TD/TopWreck.Png") Img6 = ImageList.LoadImage("http://sean.alyrica.net/TD/BaseWreck.Png") For i = 1 To NumOfTurretTypes ImgTop[i] = ImageList.LoadImage(TurretPic[i]["Top"]["Path"]) ImgBase[i] = ImageList.LoadImage(TurretPic[i]["Base"]["Path"]) GraphicsWindow.DrawImage(ImgBase[i],i * 40,10) GraphicsWindow.DrawImage(ImgTop[i],i * 40,5) GraphicsWindow.DrawText(i * 40 + 5,40,TurretProp[i]["Price"] + " $") EndFor AddTanks() GraphicsWindow.ShowMessage("To grab a turret, click on it and place it where you want. if you want to see how many kills it has, put your cursor over it.","Tankinator") BeginGameTime = Clock.ElapsedMilliseconds While Out < NumOfTanksAllowedOut Program.Delay(5) OldTimeStart2 = Timestart2 Timestart2 = Clock.ElapsedMilliseconds TimeElapsed2 = Timestart2 - OldTimeStart2 If TimeElapsed2 / 20 < 5 Then TankSpeed = TimeElapsed2 / (20 -intTankSpeed) EndIf GraphicsWindow.Title = "Out = " + Out Shapes.SetText(MoneyText,"You Have " + Money + "$") If (Kills + OutThisRound) >= NumOfTanks Then Kills = 0 AddTanks() EndIf MoveTanks() SetAim() CalcXY() EndWhile For i12 = 1 to TurretNum Kills = Kills + TurretKills[i12] EndFor Score = Math.Round((Clock.ElapsedMilliseconds - BeginGameTime) * Kills / 1000) GraphicsWindow.ShowMessage("You Lost :( Your score was " + Score,"Tower Defence") While 1 = 1 Program.Delay(5) For i1 = 1 To TurretNum If GraphicsWindow.MouseX > Turret[i1][TurretType[i1]]["x"] And GraphicsWindow.MouseX < Turret[i1][TurretType[i1]]["x"] + 30 And GraphicsWindow.MouseY > Turret[i1][TurretType[i1]]["y"] And GraphicsWindow.MouseY < Turret[i1][TurretType[i1]]["y"] + 30 Then Shapes.ShowShape(RangeCir[i1]) Shapes.ShowShape(KillsText[i1]) Shapes.ShowShape(TurretName[i1]) Else Shapes.HideShape(RangeCir[i1]) Shapes.HideShape(KillsText[i1]) Shapes.HideShape(TurretName[i1]) EndIf EndFor EndWhile Sub Fire Sf = Sf + 1 If Sf > BallCount Then '<--- If the number of shots fired is more than the number of balls that can possible be on the screen, Then set it to One Sf = 1 EndIf If Ball[Turret2Fire][Sf] = "" Then ProjCaps = Text.ConvertToUpperCase(BallPath[Turret2Fire]) If ProjCaps = "BALL" Then Color = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = BallColor[Turret2Fire] Ball[Turret2Fire][Sf] = Shapes.AddEllipse(BallSize[Turret2Fire],BallSize[Turret2Fire]) GraphicsWindow.BrushColor = Color EndIf If ProjCaps <> "BALL" And ProjCaps <> "" Then Ball[Turret2Fire][Sf] = Shapes.AddImage(BallPath[Turret2Fire]) EndIf EndIf Ang[Turret2Fire][sf] = Angle2Fire V = TurretProp[TurretType[Turret2Fire]]["Speed"] Vh[Turret2Fire][sf] = Math.GetDegrees(Math.Cos(Math.GetRadians(Ang[Turret2Fire][sf] - 90))) * v Vv[Turret2Fire][sf] = Math.GetDegrees(Math.Sin(Math.GetRadians(Ang[Turret2Fire][sf] - 90))) * v Time[Turret2Fire][sf] = 0 TimeFire[Turret2Fire][sf] = 0 EndSub Sub OnMouseDown If ObjectMove <> "" Then ObjectMove = "" Mousex = Math.Round(GraphicsWindow.MouseX / 30) * 30 Mousey = Math.Round(GraphicsWindow.MouseY / 30) * 30 Turret[TurretNum][TypeClicked]["x"] = Mousex Turret[TurretNum][TypeClicked]["y"] = Mousey Color = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = "#591DB904" RangeCir[TurretNum] = Shapes.AddEllipse((TurretProp[TypeClicked]["Range"] * 2),(TurretProp[TypeClicked]["Range"] * 2)) Shapes.Move(RangeCir[TurretNum],Mousex - TurretProp[TypeClicked]["Range"] + 15, Mousey - TurretProp[TypeClicked]["Range"] + 15) Shapes.HideShape(RangeCir[TurretNum]) GraphicsWindow.BrushColor = Color KillsText[TurretNum] = Shapes.AddText("") Shapes.Move(KillsText[TurretNum],10,GraphicsWindow.Height - 30) Shapes.HideShape(KillsText[TurretNum]) TurretName[TurretNum] = Shapes.AddText(TurretProp[TypeClicked]["Name"]) Shapes.Move(TurretName[TurretNum],10,GraphicsWindow.Height - 60) Shapes.HideShape(TurretName[TurretNum]) TimeStart[TurretNum] = Clock.ElapsedMilliseconds TurretType[TurretNum] = TypeClicked BallColor[TurretNum] = TurretProp[TurretType[Turret2Fire]]["BallColor"] BallSize[TurretNum] = TurretProp[TurretType[Turret2Fire]]["BallSize"] BallPath[TurretNum] = TurretPic[TurretType[Turret2Fire]]["Projectile"]["Path"] Turret[TurretNum][TypeClicked]["Top"] = Shapes.AddImage(ImgTop[TypeClicked]) Shapes.Move(Turret[TurretNum][TypeClicked]["Top"],Turret[TurretNum][TypeClicked]["x"],Turret[TurretNum][TypeClicked]["y"] - 5) EndIf For i = 1 To NumOfTurretTypes If GraphicsWindow.MouseX > (i * 40) And GraphicsWindow.MouseX < (i * 40) + 30 And GraphicsWindow.MouseY > 10 And GraphicsWindow.MouseY < 40 Then Clicked = "Yes" TypeClicked = i EndIf EndFor If Clicked = "Yes" Then If Money - TurretProp[TypeClicked]["Price"] >= 0 Then ObjectMove = Shapes.AddImage(ImgBase[TypeClicked]) Mousex = Math.Round(GraphicsWindow.MouseX / 30) * 30 Mousey = Math.Round(GraphicsWindow.MouseY / 30) * 30 Shapes.Move(ObjectMove,Mousex,Mousey) Clicked = "No" TurretNum = TurretNum + 1 Money = Money - TurretProp[TypeClicked]["Price"] EndIf EndIf EndSub Sub OnMouseMove If ObjectMove <> "" Then Mousex = Math.Round(GraphicsWindow.MouseX / 30) * 30 Mousey = Math.Round(GraphicsWindow.MouseY / 30) * 30 Shapes.Move(ObjectMove,Mousex,Mousey) EndIf EndSub Sub GetAngle Tx[i1] = Turret[i1][TurretType[i1]]["x"] Ty[i1] = Turret[i1][TurretType[i1]]["y"] If Posx[i1] > Tx[i1] Then 'Aims At Pos AngleRadians[i1] = Math.ArcTan((Posy[i1] - Ty[i1]) / (Posx[i1] - Tx[i1])) + 1.57079 '90 Degs. In Radians ElseIf Posx[i1] < Tx[i1] Then AngleRadians[i1] = Math.ArcTan((Posy[i1] - Ty[i1]) / (Posx[i1] - Tx[i1])) - 1.57079 '90 Degs. In Radians ElseIf Posx[i1] = Tx[i1] And Posy[i1] > Ty[i1] Then AngleRadians[i1] = Math.ArcTan((Posy[i1] - Ty[i1]) / (Posx[i1] - Tx[i1])) + 3.14159 EndIf Angle[i1] = Math.GetDegrees(AngleRadians[i1]) EndSub Sub AddTanks For i3 = 1 To NumOfTanks If Tank[i3] = "" Then Tank[i3] = Shapes.AddImage(TankImg) EndIf Tanky[i3] = Math.GetRandomNumber(GraphicsWindow.Height - TankHeight) Tankx[i3] = GraphicsWindow.Width + Math.GetRandomNumber(GraphicsWindow.Width) TankVar[i3] = Math.GetRandomNumber(TankMaxVar) / TankMaxVar Shapes.Remove(HealthBarInside[i3]) Color = GraphicsWindow.BrushColor Size = GraphicsWindow.PenWidth PColor = GraphicsWindow.PenColor GraphicsWindow.PenWidth = 3 GraphicsWindow.BrushColor = "White" If TankHealthRec[i3] = "" Then TankHealthRec[i3] = Shapes.AddRectangle(100,12) EndIf GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenColor = "Red" HealthBarInside[i3] = Shapes.AddRectangle(94,6) GraphicsWindow.BrushColor = Color GraphicsWindow.PenWidth = Size GraphicsWindow.PenColor = PColor TankHealth[i3] = IntTankHealth EndFor CurrTnkHealth = IntTankHealth IntTankHealth = IntTankHealth + TankHealthInc TankHealthInc = TankHealthInc + TankHealthIncAcc TankCost = TankCost + TankPriceInc OutThisRound = 0 EndSub Sub MoveTanks For i4 = 1 To NumOfTanks Tankx[i4] = Tankx[i4] - (TankSpeed + TankVar[i4]) Shapes.Move(Tank[i4] ,Tankx[i4],Tanky[i4]) Shapes.Move(TankHealthRec[i4] ,Tankx[i4] + 5,Tanky[i4] + (TankHeight + 20)) Shapes.Move(HealthBarInside[i4] ,Tankx[i4] + 8,Tanky[i4] + (TankHeight + 23)) If Tankx[i4] < (0 - TankWidth) Then Out = out + 1 OutThisRound = OutThisRound + 1 Tankx[i4] = 4000 EndIf EndFor EndSub Sub SetAim For i9 = 1 To TurretNum CanCalcFire[i9] = "No" EndFor CanSetFire = "No" For i5 = 1 To TurretNum For i6 = 1 To NumOfTanks Dify = Math.Max(Turret[i5][TurretType[i5]]["y"] + 15,Tanky[i6]) - Math.Min(Turret[i5][TurretType[i5]]["y"] + 15,Tanky[i6]) Difx = Math.Max(Turret[i5][TurretType[i5]]["x"] + 15,Tankx[i6]) - Math.Min(Turret[i5][TurretType[i5]]["x"] + 15,Tankx[i6]) Dist = Math.SquareRoot((Dify * Dify) + (Difx * Difx)) If Dist <= TurretProp[TurretType[i5]]["Range"] Then Posx[i5] = Tankx[i6] + (TankWidth / 2) Posy[i5] = Tanky[i6] + (TankHeight / 2) CanCalcFire[i5] = "Yes" EndIf EndFor EndFor EndSub Sub HitTank TankHealth[i7] = TankHealth[i7] - TurretProp[TurretType[i1]]["Damage"] Time[i1][i2] = 100 If TankHealth[i7] <= 0 Then Tankx[i7] = 3000 TurretKills[i1] = TurretKills[i1] + 1 Kills = Kills + 1 Money = Money + TankCost EndIf BarWidth = (TankHealth[i7] / CurrTnkHealth) * 94 Shapes.Remove(HealthBarInside[i7]) Color = GraphicsWindow.BrushColor PColor = GraphicsWindow.PenColor GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" If BarWidth > 1 Then HealthBarInside[i7] = Shapes.AddRectangle(BarWidth,6) Shapes.Move(HealthBarInside[i7] ,Tankx[i7] + 8,Tanky[i7] + (TankHeight + 23)) EndIf GraphicsWindow.BrushColor = Color GraphicsWindow.PenColor = PColor EndSub Sub CalcXY For i1 = 1 To TurretNum If TurretLive[i1] <> "No" Then Shapes.SetText(KillsText[i1],"Kills: " + TurretKills[i1]) If GraphicsWindow.MouseX > Turret[i1][TurretType[i1]]["x"] And GraphicsWindow.MouseX < Turret[i1][TurretType[i1]]["x"] + 30 And GraphicsWindow.MouseY > Turret[i1][TurretType[i1]]["y"] And GraphicsWindow.MouseY < Turret[i1][TurretType[i1]]["y"] + 30 Then Shapes.ShowShape(RangeCir[i1]) Shapes.ShowShape(KillsText[i1]) Shapes.ShowShape(TurretName[i1]) Else Shapes.HideShape(RangeCir[i1]) Shapes.HideShape(KillsText[i1]) Shapes.HideShape(TurretName[i1]) EndIf GetAngle() Shapes.Rotate(Turret[i1][TurretType[i1]]["Top"],Angle[i1]) For i2 = 1 To BallCount For i7 = 1 To NumOfTanks If x[i1][i2] > Tankx[i7] And x[i1][i2] < Tankx[i7] + TankWidth And y[i1][i2] > Tanky[i7] And y[i1][i2] < Tanky[i7] + TankHeight Then HitTank() EndIf If (Turret[i1][TurretType[i1]]["x"] + 30) >Tankx[i7] And Turret[i1][TurretType[i1]]["x"] < Tankx[i7] + TankWidth And Turret[i1][TurretType[i1]]["y"] + 15 > Tanky[i7] And Turret[i1][TurretType[i1]]["y"] < Tanky[i7] + TankHeight Then T2D = i1 DeadAng[i1] = Angle[i1] DestroyTurret() EndIf EndFor Time[i1][i2] = Time[i1][i2] + .005 If CanCalcFire[i1] = "Yes" Then TimeCurrent[i1] = Clock.ElapsedMilliseconds - TimeStart[i1] EndIf If TimeCurrent[i1] >= TurretProp[TurretType[i1]]["ROF"]Then TimeStart[i1] = Clock.ElapsedMilliseconds Turret2Fire = i1 Angle2Fire = Angle[i1] TurretType2 = TurretType Fire() CanFire[i1] = "No" EndIf x[i1][i2] = Vh[i1][i2] * Time[i1][i2] + Turret[i1][TurretType[i1]]["x"] y[i1][i2] = Vv[i1][i2] * Time[i1][i2] + (Math.Power(Time[i1][i2],2)) + Turret[i1][TurretType[i1]]["y"] Shapes.Move(Ball[i1][i2],x[i1][i2],y[i1][i2]) Shapes.Rotate(Ball[i1][i2],Ang[i1][i2] - 90) EndFor EndIf EndFor EndSub Sub DestroyTurret Wreck[T2D] = Shapes.AddImage(Img6) Shapes.Move(Wreck[T2D],Turret[T2D][TurretType[T2D]]["x"],Turret[T2D][TurretType[T2D]]["y"]) WreckTop[T2D] = Shapes.AddImage(Img5) Shapes.Rotate(WreckTop[T2D],DeadAng[T2D]) Shapes.Move(WreckTop[T2D],Turret[T2D][TurretType[T2D]]["x"] + 5,Turret[T2D][TurretType[T2D]]["y"] - 5) Turret[T2D][TurretType[T2D]]["y"] = 6000 Shapes.Remove(Turret[T2D][TurretType[T2D]]["Top"]) TankHealth[i7] = TankHealth[i7] - TurretProp[TurretType[T2D]]["Price"] * 20 TurretLive[i1] = "No" BarWidth = (TankHealth[i7] / CurrTnkHealth) * 94 Shapes.Remove(HealthBarInside[i7]) Color = GraphicsWindow.BrushColor PColor = GraphicsWindow.PenColor GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" If BarWidth > 1 Then HealthBarInside[i7] = Shapes.AddRectangle(BarWidth,6) Shapes.Move(HealthBarInside[i7] ,Tankx[i7] + 8,Tanky[i7] + (TankHeight + 23)) EndIf GraphicsWindow.BrushColor = Color GraphicsWindow.PenColor = PColor If TankHealth[i7] <= 0 Then Tankx[i7] = 3000 TurretKills[i1] = TurretKills[i1] + 1 Kills = Kills + 1 Money = Money + TankCost TurretDeaths = TurretDeaths + 1 EndIf EndSub End>VJQ222.sb< Start>VJT156.sb< X = -2.0 Y = -1.4 width = 3.0 height = 3.0 winWidth = GraphicsWindow.Width winHeight = GraphicsWindow.Height Hue = 0 Saturation = 50 Lightness = 50 precision = 2 stripy = "False" For nowX = X To X+width Step width/winWidth*precision screenY = 0 For nowY = Y To Y+height Step height/winHeight*precision realVal = nowX imagVal = nowY InMandelbrot() GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(screenX,screenY,precision,precision) screenY = screenY+precision EndFor screenX = screenX+precision EndFor Sub InMandelbrot realCopy = realVal imagCopy = imagVal For i = 1 To 20 a = realCopy b = imagCopy PowerComplex() imagCopy = squareImag+imagVal realCopy = squareReal+realVal dist = realCopy*realCopy+imagCopy*imagCopy If dist>4 Then Hue = i*360/20 HSL_2_RGB() color = GraphicsWindow.GetColorFromRGB(RedCompo,GreenCompo,BlueCompo) i = 20 ElseIf i = 19 And stripy <> "True" Then Hue = 360 HSL_2_RGB() color = GraphicsWindow.GetColorFromRGB(RedCompo,GreenCompo,BlueCompo) EndIf EndFor EndSub Sub HSL_2_RGB H = Hue/360 S = Saturation/100 L = Lightness/100 If L < 0.5 Then tmp1 = L+L*S Else tmp1 = L+S-L*S EndIf tmp2 = 2*L-tmp1 tmpRGB[1] = H+1/3 tmpRGB[2] = H tmpRGB[3] = H-1/3 If 6*tmpRGB[1] < 1 Then RedCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[1] ElseIf 2*tmpRGB[1] < 1 Then RedCompo = tmp1 ElseIf 3*tmpRGB[1] < 2 Then RedCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[1])*6 Else RedCompo = tmp2 EndIf If 6*tmpRGB[2] < 1 Then GreenCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[2] ElseIf 2*tmpRGB[2] < 1 Then GreenCompo = tmp1 ElseIf 3*tmpRGB[2] < 2 Then GreenCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[2])*6 Else GreenCompo = tmp2 EndIf If 6*tmpRGB[3] < 1 Then BlueCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[3] ElseIf 2*tmpRGB[3] < 1 Then BlueCompo = tmp1 ElseIf 3*tmpRGB[3] < 2 Then BlueCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[3])*6 Else BlueCompo = tmp2 EndIf BlueCompo = Math.Round(Math.Max(BlueCompo*255,0)) RedCompo = Math.Round(Math.Max(RedCompo*255,0)) GreenCompo = Math.Round(Math.Max(GreenCompo*255,0)) EndSub Sub PowerComplex squareReal = a*a*a*a-6*a*a*b*b+b*b*b*b squareImag = 4*a*a*a*b-4*a*b*b*b EndSub End>VJT156.sb< Start>VJT997-1.sb< GraphicsWindow.BackgroundColor="darkblue dw=desktop.Width dh=desktop.Height GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddAmbientLight(view3D "#77777777") LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10) LD3DView.AddDirectionalLight (view3D,"#bbaaaaaa" ,-1,-7,-1) LD3DView.AutoControl2 ( 5 1) GraphicsWindow.Title="3D-Stairs args=0 f35=.15 f25=.12 cc="gold Sub stcc pp="" For rr=0 To 7 For oo=0 To 1 dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8 15) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8 15) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8 7) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8 7) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8, 0) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8, 0) For zz=0 To 15 If zz>=2 and zz<7 and oo=0 Then ty="S" Else ty="D" EndIf dd1=LD3DView.AddCube(view3D 1,cc ty) LD3DView.TranslateGeometry(view3D dd1 zz bh+rr+oo*8, -7) EndFor EndFor For m=0 To 7 cc="gold dd=LD3DView.AddCube(view3D 1,cc "D") 'LD3DView.SetCentre( LD3DView.TranslateGeometry(view3D dd m, bh+rr,rr) dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m+8, bh+rr+7,7-rr) EndFor dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 0, rr,rr 1) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 7, rr,rr 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 8, rr+7,7-rr 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 15, rr+7,7-rr 1) EndFor For rr=0 To 7 For m=0 To 15 dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m, bh+7,rr+8) dd=LD3DView.AddCube(view3D 1,"blue" "D") LD3DView.TranslateGeometry(view3D dd m, bh+14,rr-7) If rr=7 Then dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd m, 7,rr+8 1) ElseIf m=0 or m=15 Then dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd m, 14,rr-6 3) EndIf EndFor dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 0, 7,rr+8 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 15, 7,rr+8 2) EndFor nord=LDText.Split("1 15 17 32 2 16" " ") For r=1 To Array.GetItemCount(nord) pp=pp+nds[1][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") nord=LDText.Split("1 15 2 16" " ") pp="" For r=1 To Array.GetItemCount(nord) pp=pp+nds[2][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") LDCall.Function2("ntub" 2 "15 2") If BH=14 Then LDCall.Function2("ntub" 3 "14 2 1 13") LDCall.Function4("ntub2" 3 13 2 16) Else LDCall.Function2("ntub" 3 "1 13") LDCall.Function2("ntub" 3 "14 2") EndIf EndSub Sub ntub nord=LDText.Split(args[2] " ") pp="" For r=1 To Array.GetItemCount(nord) pp=pp+nds[args[1]][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") EndSub Sub ntub2 pp=nds[args[1]][args[2]]+":" pp=pp+nds[args[3]][args[4]] 'TextWindow.Write(pp) LD3DView.AddTube(view3D pp .75 6 "green" "D") EndSub Sub nset dd=args[1] qw=args[5] LD3DView.TranslateGeometry(view3D dd args[2] bh+args[3] args[4]) in[qw]=in[qw]+1 qq=": nds[qw][in[qw]]=args[2]+qq+(bh+args[3]+5)+qq+args[4] EndSub For bh=0 To 14 Step 14 in=0 stcc() EndFor End>VJT997-1.sb< Start>VJT997.sb< GraphicsWindow.BackgroundColor="darkblue dw=desktop.Width dh=desktop.Height GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddAmbientLight(view3D "#77777777") LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10) LD3DView.AddDirectionalLight (view3D,"#bbaaaaaa" ,-1,-7,-1) LD3DView.AutoControl2 ( 5 1) GraphicsWindow.Title="3D-Stairs args=0 f35=.15 f25=.12 cc="gold Sub stcc pp="" For rr=0 To 7 For oo=0 To 1 dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8 15) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8 15) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8 7) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8 7) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 0 bh+rr+oo*8, 0) dd1=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd1 15 bh+rr+oo*8, 0) For zz=0 To 15 if zz>=2 and zz<7 and oo=0 Then ty="S" Else ty="D" EndIf dd1=LD3DView.AddCube(view3D 1,cc ty) LD3DView.TranslateGeometry(view3D dd1 zz bh+rr+oo*8, -8) EndFor EndFor For m=0 To 7 cc="gold dd=LD3DView.AddCube(view3D 1,cc "D") 'LD3DView.SetCentre( LD3DView.TranslateGeometry(view3D dd m, bh+rr,rr) dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m+8, bh+rr+7,7-rr) EndFor dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 0, rr,rr 1) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 7, rr,rr 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 8, rr+7,7-rr 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 15, rr+7,7-rr 1) EndFor For rr=0 To 7 For m=0 To 15 dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m, bh+7,rr+8) dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m, bh,rr-8) If rr=7 Then dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd m, 7,rr+8 1) EndIf EndFor dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 0, 7,rr+8 2) dd=LD3DView.AddCone(view3D f35 f25 5 10 "gray" "D") ldcall.Function5("nset" dd 15, 7,rr+8 2) EndFor nord=LDText.Split("1 15 17 32 2 16" " ") For r=1 To Array.GetItemCount(nord) pp=pp+nds[1][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") nord=LDText.Split("1 15 2 16" " ") pp="" For r=1 To Array.GetItemCount(nord) pp=pp+nds[2][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") nord=LDText.Split("15 2" " ") pp="" For r=1 To Array.GetItemCount(nord) pp=pp+nds[2][nord[r]]+":" EndFor LD3DView.AddTube(view3D pp .75 6 "green" "D") EndSub Sub nset dd=args[1] qw=args[5] LD3DView.TranslateGeometry(view3D dd args[2] bh+args[3] args[4]) in[qw]=in[qw]+1 qq=": nds[qw][in[qw]]=args[2]+qq+(bh+args[3]+5)+qq+args[4] EndSub For bh=0 To 28 Step 14 in=0 nds=0 stcc() EndFor End>VJT997.sb< Start>VJV917-0.sb< ' program by parYvan Leduc March 2016 & Litdev upped 'image=ImageList.LoadImage("http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001273.jpg") image=ImageList.LoadImage("http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001854.jpg") LDImage.EffectGray(image) ' gray width=640 height=640 GraphicsWindow.Title = "Highlights images Analyzer" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=680 GraphicsWindow.Width=1200 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = "30" GraphicsWindow.drawboundtext(700,50,500,"Highlights images Analyzer") GraphicsWindow.BrushColor = "gray" GraphicsWindow.FontSize = "12" GraphicsWindow.DrawboundText(700, 400,450,"GRIN is a collection of over a thousand images of significant historical interest scanned at high-resolution in several sizes. This collection is intended for the media, publishers, and the general public looking for high-quality photographs") GraphicsWindow.DrawboundText(700, 500,450,"Cernan Jump Salutes Flag , Apollo 17 mission at http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001273.jpg") GraphicsWindow.drawboundtext(700,600,500,"Program by Yvan Leduc 2016") GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = "30" very_dark_blue="#000039" GraphicsWindow.BackgroundColor=very_dark_blue GraphicsWindow.DrawresizedImage(image,10,10,width,height) totalpixels=width*height GraphicsWindow.BrushColor = "blue" box1 = Controls.AddTextBox(800, 150) start = Clock.ElapsedMilliseconds w = ImageList.GetWidthOfImage(image) h = ImageList.GetHeightOfImage(image) LDImage.OpenWorkingImage(image) divval= ldmath.Base2Decimal("FFFFFF",16)/10 colors="0=#00000000;1=#FF164A84;2=#FF8F2E14;3=#FF38B48B;4=#FF0095D9;5=#FF007B43;6=#FFE2041B;7=#FFEC6800;8=#FF884898;#FFDCDDDD" For i = 1 To w For j = 1 To h pixel = text.GetSubTextToEnd(LDImage.GetWorkingImagePixel(image,i,j),4) div=math.Floor(ldmath.Base2Decimal(pixel,16)/divval) LDImage.SetWorkingImagePixel(image,i,j,colors[div]) EndFor EndFor LDImage.CloseWorkingImage(image) end = Clock.ElapsedMilliseconds GraphicsWindow.Title = (end-start)+" ms GraphicsWindow.DrawresizedImage(image,10,10,width,height) GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = "16" GraphicsWindow.DrawBoundText (800,200,300,"255,255,255 white pixels ") Sound.PlayBellRing() End>VJV917-0.sb< Start>VJV917.sb< ' program by parYvan Leduc March 2016 image=ImageList.LoadImage("http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001273.jpg") width=640 height=640 GraphicsWindow.Title = "Highlights images Analyzer" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=680 GraphicsWindow.Width=1200 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = "30" GraphicsWindow.drawboundtext(700,50,500,"Highlights images Analyzer") GraphicsWindow.BrushColor = "gray" GraphicsWindow.FontSize = "12" GraphicsWindow.DrawboundText(700, 400,450,"GRIN is a collection of over a thousand images of significant historical interest scanned at high-resolution in several sizes. This collection is intended for the media, publishers, and the general public looking for high-quality photographs") GraphicsWindow.DrawboundText(700, 500,450,"Cernan Jump Salutes Flag , Apollo 17 mission at http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001273.jpg") GraphicsWindow.drawboundtext(700,600,500,"Program by Yvan Leduc 2016") GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = "30" very_dark_blue="#000039" GraphicsWindow.BackgroundColor=very_dark_blue GraphicsWindow.DrawresizedImage(image,10,10,width,height) totalpixels=width*height GraphicsWindow.BrushColor = "blue" box1 = Controls.AddTextBox(800, 150) start = Clock.ElapsedMilliseconds w = ImageList.GetWidthOfImage(image) h = ImageList.GetHeightOfImage(image) LDImage.OpenWorkingImage(image) For i = 1 To w For j = 1 To h pixel = LDImage.GetWorkingImagePixel(image,i,j) If (pixel = "#FFFFFFFF") Then LDImage.SetWorkingImagePixel(image,i,j,"Blue") 'count = count+1 'Controls.SetTextBoxText(box1,count) EndIf EndFor EndFor LDImage.CloseWorkingImage(image) end = Clock.ElapsedMilliseconds GraphicsWindow.Title = (end-start)+" ms GraphicsWindow.DrawresizedImage(image,10,10,width,height) GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = "16" GraphicsWindow.DrawBoundText (800,200,300,"255,255,255 white pixels ") Sound.PlayBellRing() End>VJV917.sb< Start>VJW228-0.sb< GraphicsWindow.Title="Shapes3 (beta V0.2) GraphicsWindow.BackgroundColor="tan dffs() ssh="x LDShapes.ShapeEvent = see GraphicsWindow.MouseDown = mmm GraphicsWindow.MouseMove = mww GraphicsWindow.MouseUp = muu LDEvents.MouseWheel = mwwl While 1=1'-----------------------mainloop---------------------------------- If cmd="opn" Then fff=LDDialogs.OpenFile("Sb|*.sb|SVG|*.svg|Nonki's shapes|*.nsh|HTML|*.htm;*.html|All|*.*" "e:/") If fff="" Then ElseIf Text.IsSubText(Text.ConvertToLowerCase(fff) ".svg") Then ' The following line could be harmful and has been automatically commented. ' buf = File.ReadContents(fff) Parse_SVG() Shapes_Add() EndIf cmd="" ElseIf cmd="sav" Then fff=LDDialogs.SaveFile("SVG|*.svg|Sb|*.sb|Nonki's shapes|*.nsh|HTML|*.htm;*.html|All|*.*" "e:/") If fff="" Then ElseIf Text.IsSubText(Text.ConvertToLowerCase(fff) ".svg") Then GenerateSVG() ' The following line could be harmful and has been automatically commented. ' File.WriteContents(fff, buf) EndIf cmd="" EndIf Program.Delay(1) EndWhile Sub mwwl If Mouse.IsRightButtonDown Then aaa[ssh]=aaa[ssh]+LDEvents.LastMouseWheelDelta*3 Shapes.Rotate(ssh aaa[ssh]) Else zz[ssh]=zz[ssh]+LDEvents.LastMouseWheelDelta/20 Shapes.Zoom(ssh zz[ssh] zz[ssh]) EndIf EndSub Sub muu lsh=ssh ssh="x" 'GraphicsWindow.Title=lsh EndSub Sub mww If Mouse.IsLeftButtonDown and GraphicsWindow.MouseY>25 Then If ssh="x" Then Else ldShapes.Centre(ssh GraphicsWindow.MouseX GraphicsWindow.MouseY) EndIf EndIf EndSub Sub mmm If ssh="x" Then Else ldShapes.Centre(ssh GraphicsWindow.MouseX GraphicsWindow.MouseY) EndIf EndSub Sub see If LDShapes.LastEventType="MouseDown" Then ssh=LDShapes.LastEventShape EndIf EndSub Sub dffs p50=30 DIGIT = "0123456789" buf="" Not = "False=True;True=False WQ = Text.GetCharacter(34) qt = WQ CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) LT = "<" tt=Text.GetCharacter(9) pcolor="black bcolor="white pwidth=1.5 mnn["File"]="Main" mnn["New"]="File mnn["---"]="File mnn["Open ..."]="File mnn["Save"]="File mnn["Save As ..."]="File mnn["Import ..."]="File mnn["Make HTML..."]="file mnn["-"]="File mnn["Exit"]="File url = "D:\yotta\MySmallBasic\MySmallBasic\Sample\Shapes-master\img/" fffc="" imm=ImageList.LoadImage(url+"open.png") icc["Open ..."]=imm imm=ImageList.LoadImage(url+"save.png") icc["Save"]=imm icc["Save As ..."]=imm imm=ImageList.LoadImage(url+"open.png") icc["Import ..."]=imm mnn["Edit"]="Main" cpy="Copy"+tt+tt+"^C" mnn[cpy]="edit" imm=ImageList.LoadImage(url+"copy.png") icc[cpy]=imm mnn["Cut"+tt+tt+"Delete"]="edit" imm=ImageList.LoadImage(url+"cut.png") icc["cut"+tt+tt+"delete"]=imm pst="Paste"+tt+tt+"^V" mnn[pst]="edit" imm=ImageList.LoadImage(url+"paste.png") icc[pst]=imm dpp="Duplicate"+tt+"^D" mnn[dpp]="edit" imm=ImageList.LoadImage(url+"copy.png") icc[dpp]=imm li=ImageList.LoadImage("e:\shpp.png") ll=LDImage.SplitImage(li 8 3) ' GraphicsWindow.DrawImage(ll[1][1] 30 30) mnn["--"]="edit" mnn["Grid"+tt+tt+"^G"]="edit" mnn["Draw"]="main lnn="Line"+tt+tt+"^L" mnn[lnn]="draw icc[lnn]= ll[5][1] ddd="Curve"+tt+tt+"^U" mnn[ddd]="draw icc[ddd]=ll[8][1] ddd="Triangle"+tt+"^A" mnn[ddd]="draw icc[ddd]=ll[7][1] ddd="Rectangle"+tt+"^R" mnn[ddd]="draw icc[ddd]=ll[1][1] ddd="Ellipse"+tt+tt+"^E" fffc["elli"]="ell mnn[ddd]="draw icc[ddd]=ll[2][1] ddd="Circle"+tt+tt+"^I" mnn[ddd]="draw icc[ddd]=ll[3][1] ddd="Polygon"+tt+"^P" mnn[ddd]="draw icc[ddd]=ll[6][1] ddd="Reg.Polyg"+tt+"^Y" mnn[ddd]="draw icc[ddd]=ll[2][1] ddd="Text"+tt+tt+"^T" mnn[ddd]="draw icc[ddd]=ll[4][1] mnn["----"]="draw mnn["Shaded"]="draw mnn["Shape"]="main mnn["Star5"]="Shape icc["star5"]=ll[7][2] mnn["Star6"]="Shape icc["star6"]=ll[8][2] mnn["Arrow"]="Shape icc["arrow"]=ll[1][3] mnn["Baloon"]="Shape icc["baloon"]=ll[8][3] mnn["Image"]="Shape mnn["Sphere"]="Shape mnn["Cone"]="Shape mnn["Pyramid"]="Shape mnn["Cube"]="Shape mnn["Pipe"]="Shape mnn=LDText.Replace(mnn "^" "Ctrl+") icc=LDText.Replace(icc "^" "Ctrl+") LDControls.AddMenu(1600 20 mnn icc "") LDControls.MenuClicked=mnncl rmm=LDText.Split("Outline clr!Outline pen!Fill clr!Gradient!BgColor!BgImage!New Drawing!Shadow!Size_X!Size_Y!Unzoom!UnRot" "!") LDDialogs.AddRightClickMenu(rmm "") LDDialogs.RightClickMenu=rcc EndSub Sub rcc ll=LDDialogs.LastRightClickMenuItem If ll=2 Then pwidth=FCDialogs.AskForTextLine("Width:") LDShapes.PenWidth(lsh pwidth) ElseIf ll=7 Then ccd=LDDialogs.Confirm("Ok to clear all?" "Shapes") If ccd="Yes" Then rsst="true EndIf ElseIf ll=8 Then LDEffect.DropShadow(lsh "") ElseIf ll=1 Then pcolor= LDDialogs.Colour() LDShapes.PenColour(lsh pcolor) ElseIf ll=9 Then ss=FCDialogs.AskForTextLine("SizeX:") LDShapes.SetSize(lsh ss LDShapes.Height(lsh)) ElseIf ll=10 Then ss=FCDialogs.AskForTextLine("SizeY:") LDShapes.SetSize(lsh LDShapes.Width(lsh) ss) ElseIf ll=11 Then zz[lsh]=1 Shapes.Zoom(lsh 1 1) ElseIf ll=3 Then bcolor= LDDialogs.Colour() LDShapes.BrushColour(lsh bcolor) ElseIf ll=4 Then cl[1]= LDDialogs.Colour() cl[2]= LDDialogs.Colour() LDGraphicsWindow.BackgroundBrush( LDShapes.BrushGradient(cl "DD")) ElseIf ll=5 Then GraphicsWindow.BackgroundColor= LDDialogs.Colour() ElseIf ll=6 Then fff=LDDialogs.OpenFile("1=png;2=jpg;3=bmp" "e:/") ldGraphicsWindow.BackgroundImage(imagelist.LoadImage(fff)) EndIf EndSub Sub mnncl'---------------------------menu click routine--------------------------- ll=LDControls.LastMenuItem If Text.StartsWith(ll "Bal") Then tt=FCDialogs.AskForTextLine("txt:") GraphicsWindow.BrushColor=bcolor GraphicsWindow.PenColor=pcolor GraphicsWindow.PenWidth=pwidth ff=LDFigures.AddCallout(100 50 tt "Cloud" "x=0;y=1.25") LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Open") Then cmd="opn" ElseIf (ll= "Save") Then cmd="sav" ElseIf (ll="Star5") Then ff=LDShapes.AddStar(5 20 45) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf (ll="Star6") Then ff=LDShapes.AddStar(6 20 45) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Ell") Then ff=Shapes.AddEllipse(100 50) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Rect") Then ff=Shapes.AddRectangle(100 50) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) EndIf EndSub Sub Parse_SVG ' param buf - SVG buffer scale = 1 iMin = nShapes + 1 iMax = nShapes p = 1 Parse_Header() Parse_Space() ' Parse_Defs() match="true While match Parse_Space() Parse_Rect() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf If Not[match] Then Parse_Ellipse() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf If Not[match] Then Parse_Polygon() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf If Not[match] Then Parse_Line() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf EndWhile nShapes = iMax Parse_Use() EndSub Sub Parse_Line match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "line") Then param = "tag=line;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() Parse_SetStyle() points = attr["x1"] + "," + attr["y1"] + " " + attr["x2"] + "," + attr["y2"] Parse_Points() shp = "" shp["func"] = "line" shp["x"] = x shp["y"] = y+p50 shp["width"] = width shp["height"] = height shp["x1"] = px[1] - x shp["y1"] = py[1] - y shp["x2"] = px[2] - x shp["y2"] = py[2] - y shp["pw"] = pw shp["pc"] = pc match = "True" EndIf EndSub Sub Parse_Rect match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "rect") Then param = "tag=rect;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() x = attr["x"] y = attr["y"] width = attr["width"] height = attr["height"] Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "rect" shp["x"] = x - Math.Floor(pw / 2) shp["y"] = y - Math.Floor(pw / 2)+p50 shp["width"] = width + pw shp["height"] = height + pw shp["angle"] = angle shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_Polygon match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "polygon") Then param = "tag=polygon;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() points = attr["points"] Parse_Points() Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "tri" shp["x"] = x shp["y"] = y+p50 shp["width"] = width shp["height"] = height shp["angle"] = angle shp["x1"] = px[1] - x shp["y1"] = py[1] - y shp["x2"] = px[2] - x shp["y2"] = py[2] - y shp["x3"] = px[3] - x shp["y3"] = py[3] - y shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_Points len = Text.GetLength(points) px = "" py = "" nPoints = 1 For pPoints = 1 To len c = Text.GetSubText(points, pPoints, 1) While (pPoints <= len) And Text.IsSubText(DIGIT, c) px[nPoints] = Text.Append(px[nPoints], c) pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndWhile If c = "," Then pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndIf While (pPoints <= len) And Text.IsSubText(DIGIT, c) py[nPoints] = Text.Append(py[nPoints], c) pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndWhile If nPoints = 1 Then xmin = px[1] ymin = py[1] xmax = px[1] ymax = py[1] Else If px[nPoints] < xmin Then xmin = px[nPoints] EndIf If py[nPoints] < ymin Then ymin = py[nPoints] EndIf If xmax < px[nPoints] Then xmax = px[nPoints] EndIf If ymax < py[nPoints] Then ymax = py[nPoints] EndIf EndIf If c = " " Then nPoints = nPoints + 1 EndIf EndFor x = xmin y = ymin width = xmax - xmin height = ymax - ymin EndSub Sub Parse_Angle angle = "" If attr["transform"] <> "" Then pAngle = 8 lAngle = Text.GetIndexOf(Text.GetSubTextToEnd(attr["transform"], pAngle), " ") - 1 angle = Text.GetSubText(attr["transform"], pAngle, lAngle) EndIf EndSub Sub Parse_Ellipse match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "ellipse") Then param = "tag=ellipse;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() cx = attr["cx"] cy = attr["cy"] rx = attr["rx"] ry = attr["ry"] Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "ell" shp["x"] = cx - rx - Math.Floor(pw / 2) shp["y"] = cy - ry - Math.Floor(pw / 2)+p50 shp["width"] = 2 * rx + pw shp["height"] = 2 * ry + pw shp["angle"] = angle shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_FindTag pSave = p tag = "" findNext = "True" While findNext findNext = "False" ' tag may be not found pTag = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), LT + param["tag"]) If 0 < pTag Then lTag = Text.GetLength(param["tag"]) + 1 pTag = p + pTag - 1 len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/" + param["tag"] + ">") If len = 0 Then lTag = 1 len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/>") EndIf If param["class"] = "" Then len = len + lTag tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag ElseIf 0 < len Then findNext = "True" ' tag may have different class len = len + lTag attr = "class=" + qt + param["class"] + qt pAttr = pTag + lTag + 1 lAttr = Text.GetLength(attr) If Text.GetSubText(buf, pAttr, lAttr) = attr Then tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag EndIf EndIf p = pTag + len EndIf EndWhile If tag = "" Then p = pSave EndIf EndSub Sub Parse_GetAttrAndText pTag = Text.GetIndexOf(tag, " ") + 1 pEnd = Text.GetIndexOf(tag, ">") attr = "" While pTag <= pEnd Parse_SkipSpaceInTag() pEq = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), "=") If 0 < pEq Then pEq = pTag + pEq - 1 If Text.GetSubText(tag, pEq + 1, 1) = qt Then pQ = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pEq + 2), qt) If 0 < pQ Then pQ = pEq + 2 + pQ - 1 attr[Text.GetSubText(tag, pTag, pEq - pTag)] = Text.GetSubText(tag, pEq + 2, pQ - pEq - 2) pTag = pQ + 2 EndIf EndIf Else pTag = pEnd + 1 EndIf EndWhile If pEnd + 1 < pTag Then pTag = pEnd + 1 EndIf len = Text.GetLength(tag) txt = "" While pTag <= len pL = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), LT) If pL = 0 Then txt = Text.Append(txt, Text.GetSubTextToEnd(tag, pTag)) pTag = len + 1 Else pL = pTag + pL - 1 txt = Text.Append(txt, Text.GetSubText(tag, pTag, pL - pTag)) pR = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), ">") If 0 < pR Then pTag = pTag + pR Else pTag = len + 1 EndIf EndIf EndWhile EndSub Sub Parse_GetStyleAttr pKw = Text.GetIndexOf(Text.GetSubTextToEnd(attr["style"], pStyle), kw) If pKw = 0 Then value = "" Else pValue = pStyle + pKw + Text.GetLength(kw) pColon = Text.GetIndexOf(Text.GetSubTextToEnd(attr["style"], pValue), ";") If pColon = 0 Then pColon = Text.GetLength(kw) + 1 EndIf value = Text.GetSubText(attr["style"], pValue, pColon - 1) EndIf EndSub Sub Parse_Header If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "svg") Then len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), ">") If 0 < len Then tag = Text.GetSubText(buf, p, len) Parse_GetAttrAndText() wi = attr["viewbox"] aaa=ldtext.Split(wi " ") width=aaa[3]-aaa[1] height = aaa[4]-aaa[2] GraphicsWindow.ShowMessage(width+":"+height "svg") p = p + len match = "True" EndIf EndIf EndSub Sub Parse_Space isSpace = "True" While isSpace char = Text.GetSubText(buf, p, 1) If Text.IsSubText(" " + CR + LF, char) Then p = p + 1 Else isSpace = "False" EndIf EndWhile EndSub Sub Parse_SetStyle pStyle = 1 kw = "fill" Parse_GetStyleAttr() bc = Text.ConvertToUpperCase(value) kw = "stroke" Parse_GetStyleAttr() pc = Text.ConvertToUpperCase(value) kw = "stroke-width" Parse_GetStyleAttr() pw = value EndSub Sub Parse_Use param = "tag=use;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() shX = 0 shY = 0 For i = iMin To iMax shp = shape[i] shp["x"] = shp["x"] + attr["x"] shp["y"] = shp["y"] + attr["y"] If shp["func"] = "tri" And (shp["y2"] < shp["y1"]) Then shp["y2"] = shp["y1"] shp["y1"] = shp["y3"] shp["y3"] = shp["y2"] shp["angle"] = shp["angle"] + 180 If 360 <= shp["angle"] Then shp["angle"] = shp["angle"] - 360 EndIf EndIf If shp["pc"] <> "" Then color = shp["pc"] ' CS_AddColorToPalette() EndIf If shp["bc"] <> "" Then color = shp["bc"] ' CS_AddColorToPalette() EndIf shape[i] = shp CalcDetectBorder() EndFor EndSub Sub Parse_SkipSpaceInTag isSpace = "True" While isSpace char = Text.GetSubText(tag, pTag, 1) If Text.IsSubText(" " + CR + LF, char) Then pTag = pTag + 1 Else isSpace = "False" EndIf EndWhile EndSub Sub CalcDetectBorder ' param i - index of shapes shp = shape[i] If shp["func"] = "line" Then ' line x = shp["x2"] - shp["x1"] y = shp["y2"] - shp["y1"] rr=LDMath.Convert2Radial(shp["x1"] shp["y1"] shp["x2"] shp["y2"]) aa=rr[2] If 180 <= a Then a = a - 180 EndIf shp["angle"] = a len = rr[1] shp["_x0"] = Math.Floor(cx - len / 2) shp["_x1"] = Math.Floor(cx + len / 2) shp["_y0"] = cy - 4 shp["_y1"] = cy + 4 Else ' rectangle, ellipse or triangle If shp["func"] = "tri" Then ' triangle shp["width"] = shp["x3"] shp["height"] = shp["y2"] EndIf shp["_x0"] = shp["x"] shp["_y0"] = shp["y"] shp["_x1"] = shp["x"] + shp["width"] shp["_y1"] = shp["y"] + shp["height"] EndIf shape[i] = shp EndSub Sub Shapes_Add Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "bll" Then shp["obj"] = LDFigures.AddCallout(shp["width"]*s, shp["height"]*s "" "Cloud" "x=0;y=1.25") ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then fs = shp["fs"] GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf ldShapes.SetShapeEvent( shp["obj"]) x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 EndSub Sub Shapes_CalcRotatePos _cx = param["x"] + param["width"] / 2 _cy = param["y"] + param["height"] / 2 rr=LDMath.Convert2Radial( param["cx"] param["cy"] _cx _cy) a=rr[2] r=rr[1] a = a + param["angle"] x = r * Math.Cos(a * Math.Pi / 180) y = r * Math.Sin(a * Math.Pi / 180) _cx = x + param["cx"] _cy = y + param["cy"] x = _cx - param["width"] / 2 y = _cy - param["height"] / 2 EndSub Sub Shapes_CalcWidthAndHeight For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Move Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax shp = shape[i] _x = shp["rx"] _y = shp["ry"] Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove Stack.PushValue("local", i) For i = iMin To iMax shp = shape[i] Shapes.Remove(shp["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate s = scale param["angle"] = angle If cx <> "" Then param["cx"] = cx Else cx = "" ' to avoid syntax error param["cx"] = shWidth / 2 EndIf If cy <> "" Then param["cy"] = cy Else cy = "" ' to avoid syntax error param["cy"] = shHeight / 2 EndIf For i = iMin To iMax shp = shape[i] param["x"] = shp["x"] param["y"] = shp["y"] param["width"] = shp["width"] param["height"] = shp["height"] Shapes_CalcRotatePos() shp["rx"] = x shp["ry"] = y Shapes.Move(shp["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shp["obj"], angle + shp["angle"]) shape[i] = shp EndFor EndSub Sub GenerateSVG sp[4] = " " sp[6] = " " sp[8] = " " buf =LDText.Replace("" "'" wq)+cr+lf If nShapes > 0 Then shp = shape[1] xmin = shp["x"] ymin = shp["y"] xmax = shp["x"] ymax = shp["y"] EndIf For i = 2 To nShapes shp = shape[i] If shp["x"] < xmin Then xmin = shp["x"] EndIf If shp["y"] < ymin Then ymin = shp["y"] EndIf If xmax < shp["x"] Then xmax = shp["x"] EndIf If ymax < shp["y"] Then ymax = shp["y"] EndIf EndFor For i = 1 To nShapes shp = shape[i] If shp["func"] = "rect" Then buf = buf + sp[6] + LT + "rect " buf = buf + "x=" + WQ + Math.Floor(shp["x"] + shp["pw"] / 2 - xmin) + WQ + " " buf = buf + "y=" + WQ + Math.Floor(shp["y"] + shp["pw"] / 2 - ymin) + WQ + " " buf = buf + "width=" + WQ + (shp["width"] - shp["pw"]) + WQ + " " buf = buf + "height=" + WQ + (shp["height"] - shp["pw"]) + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + Math.Floor(shp["width"] / 2 + shp["x"] - xmin) + " " buf = buf + Math.Floor(shp["height"] / 2 + shp["y"] - ymin) + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "ell" Then buf = buf + sp[6] + LT + "ellipse " cx = Math.Floor(shp["width"] / 2 + shp["x"] - xmin) cy = Math.Floor(shp["height"] / 2 + shp["y"] - ymin) rx = Math.Floor((shp["width"] - shp["pw"]) / 2) ry = Math.Floor((shp["height"] - shp["pw"]) / 2) buf = buf + "cx=" + WQ + cx + WQ + " " buf = buf + "cy=" + WQ + cy + WQ + " " buf = buf + "rx=" + WQ + rx + WQ + " " buf = buf + "ry=" + WQ + ry + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + cx + " " buf = buf + cy + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "tri" Then buf = buf + sp[6] + LT + "polygon points=" + WQ buf = buf + (shp["x1"] + shp["x"] - xmin) + "," buf = buf + (shp["y1"] + shp["y"] - ymin) + " " buf = buf + (shp["x2"] + shp["x"] - xmin) + "," buf = buf + (shp["y2"] + shp["y"] - ymin) + " " buf = buf + (shp["x3"] + shp["x"] - xmin) + "," buf = buf + (shp["y3"] + shp["y"] - ymin) + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + (shp["x1"] + shp["x"] - xmin) + " " buf = buf + Math.Floor((shp["y2"] - shp["y1"]) / 2 + shp["y"] - ymin) + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "line" Then buf = buf + sp[6] + LT + "line " buf = buf + "x1=" + WQ + (shp["x1"] + shp["x"] - xmin) + WQ + " " buf = buf + "y1=" + WQ + (shp["y1"] + shp["y"] - ymin) + WQ + " " buf = buf + "x2=" + WQ + (shp["x2"] + shp["x"] - xmin) + WQ + " " buf = buf + "y2=" + WQ + (shp["y2"] + shp["y"] - ymin) + WQ + " " buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ EndIf If shp["pw"] > 0 Then buf = buf + "stroke:" + Text.ConvertToLowerCase(shp["pc"]) + ";" EndIf buf = buf + "stroke-width:" + shp["pw"] + WQ + "/>" + CR + LF EndFor buf = buf + cr+lf+ "" EndSub End>VJW228-0.sb< Start>VJW926.sb< /* linux/drivers/input/touchscreen/es209ra_touch_mt.c * * Copyright (C) 2009 Sony Ericsson Mobile Communications, INC * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ /*#define DEBUG*/ /*#define CONFIG_FWUPDATE_IGNORE*/ #define CONFIG_FW_HEADER #ifdef CONFIG_EARLYSUSPEND #define CONFIG_ES209RA_TOUCH_EARLYSUSPEND #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_FW_HEADER #include "es209ra_touch_mt_fw.h" #endif #ifdef CONFIG_ARM #include #endif /*--------------------------------------------------------------------------*/ /* control & status register address*/ #define TP_REG_FWVER 0x00 #define TP_REG_CTRL 0x01 #define TP_REG_GCTRL 0x02 #define TP_REG_SLP1TO 0x03 #define TP_REG_SLP2TO 0x04 #define TP_REG_SLP1SR 0x05 #define TP_REG_SLP2SR 0x06 #define TP_REG_ACTSENS 0x07 #define TP_REG_SLP1SENS 0x08 #define TP_REG_SLP2SENS 0x09 /* gesture register address*/ #define TP_REG_CLICKT 0x0A #define TP_REG_MCLICKT 0x0B #define TP_REG_MCLICKS 0x0C #define TP_REG_LTOUCHT 0x0D #define TP_REG_ROTATES 0x0E #define TP_REG_DRAGS 0x0F #define TP_REG_FLICKS 0x10 #define TP_REG_ZOOMS 0x11 /* calibration register address*/ #define TP_REG_CRES 0x12 #define TP_REG_CSP 0x13 #define TP_REG_CPC 0x14 #define TP_REG_CIDACC 0x15 #define TP_REG_CIDACR 0x16 #define TP_REG_CNTHRS 0x17 #define TP_REG_CFTHRS 0x18 #define TP_REG_CNNTHR 0x19 #define TP_REG_CLBR 0x1A #define TP_REG_CBLUTHR 0x1B #define TP_REG_CUD 0x1C /* touch data register address*/ #define TP_REG_XLSB 0x20 #define TP_REG_XYMSB 0x21 #define TP_REG_YLSB 0x22 #define TP_REG_Z 0x23 #define TP_REG_XLSB2 0x24 #define TP_REG_XYMSB2 0x25 #define TP_REG_YLSB2 0x26 #define TP_REG_Z2 0x27 #define TP_REG_GC 0x28 #define TP_REG_GPLSB 0x29 #define TP_REG_GPMSB 0x2A #define TP_REG_MAXIVX 0x2B #define TP_REG_MINIVX 0x2C #define TP_REG_MAXIVY 0x2D #define TP_REG_MINIVY 0x2E #define TP_REG_TSTAT 0x2F #define TSTAT_TCH12(S) (!!((S) & (1 << 0))) #define TSTAT_AXISY(S) (!!((S) & (1 << 1))) #define TSTAT_AXISX(S) (!!((S) & (1 << 2))) #define TSTAT_1STTCHX(S) (!!((S) & (1 << 3))) #define TSTAT_1STTCHY(S) (!!((S) & (1 << 4))) #define TSTAT_1STTCHL(S) (!!((S) & (1 << 5))) /* calibration register address*/ #define TP_REG_BL 0xFF #define FLASH_BLOCK_SIZE (128) #define FB_NO(x) ((x)-2) #define FIRMWARE_PATH "/data/local/tmp/fw.hex" #define FW_LENGTH (32768) #define PARAM_LENGTH (24) #define MAX_FIRMWAREBLOCK (239) #define CHECKBLOCK (255) #define UPDATE_RETRY_NUMBER (1) #define UPDATE_PERMISSION_VERSION (0x35) #define RESET_TIME (3*HZ) #define MAX_TP_SUPPORT 2 #define FIRST_TOUCH_POINT 0 #define SECOND_TOUCH_POINT 1 #define JUMP_PIXEL 40 /*Gesture Codes*/ #define GC_TOUCHUP 0x00 #define GC_CLICK 0x01 #define GC_FTOUCH1 0x02 #define GC_DRAG 0x04 #define GC_FTOUCH2 0x82 #define GC_DRAG2 0x84 #define GC_ZOOM2 0x87 #define GC_ERROR 0xFF /*touch state*/ #define NO_TOUCH 0 #define ONE_TOUCH 1 #define TWO_TOUCH 2 #ifdef DEBUG #define DBGLOG(format, args...) printk(KERN_DEBUG format, ## args) #define ERRLOG(format, args...) printk(KERN_ERR format, ## args) #else #define DBGLOG(format, args...) #define ERRLOG(format, args...) #endif /*--------------------------------------------------------------------------*/ enum drv_state{ DRV_STATE_POWEROFF = 0, DRV_STATE_BEGIN_RESET, DRV_STATE_INACTIVE_APP, DRV_STATE_ACTIVE_BL, DRV_STATE_ACTIVE_APP, DRV_STATE_UNKNOWN, }; struct touch_dataspace { u8 xlsb1; u8 xymsb1; u8 ylsb1; u8 z1; u8 xlsb2; u8 xymsb2; u8 ylsb2; u8 z2; u8 gc; u8 gplsb; u8 gpmsb; u8 maxivx; u8 minivx; u8 maxivy; u8 minivy; u8 tstat; }; struct finger_data { u16 x; u16 y; u16 old_x; u16 old_y; }; /* data structure used by this driver statically */ struct es209ra_touch { enum drv_state state; struct input_dev *input; struct spi_device *spi; struct work_struct isr_work; struct work_struct tmowork; #ifdef CONFIG_ES209RA_TOUCH_EARLYSUSPEND struct early_suspend early_suspend; #endif struct finger_data finger_data[MAX_TP_SUPPORT]; struct touch_dataspace touch_data; struct cdev device_cdev; int device_major; struct class *device_class; u8 fw_ver; u16 old_x; u16 old_y; u8 g_state_err; u8 g_state; u8 update_counter; struct timer_list tickfn; struct mutex touch_lock; }; static void es209ra_setup_work(struct es209ra_touch *tp); static void touch_data_handler(struct es209ra_touch *tp); /*--------------------------------------------------------------------------*/ int es209ra_touch_reg_write(struct spi_device *spi, u8 addr, u8 *buf, size_t len) { int err; u8 *write_buf; u8 dummy_read_req[] = {0x00, 0x00}; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); if (buf == NULL) return -EINVAL; /* Dummy SPI write due to issue on the device */ err = spi_write(spi, dummy_read_req, 2); if (err) return err; udelay(180); write_buf = kzalloc(sizeof(u8)*(len+2), GFP_KERNEL); if (write_buf == NULL) return -ENOMEM; write_buf[0] = 0x01; write_buf[1] = addr; memcpy(&write_buf[2], buf, len); err = spi_write(spi, write_buf, len+2); kfree(write_buf); if (err) return err; if (tp->fw_ver < 0x10) mdelay(2); return 0; } static int reg_write_byte(struct spi_device *spi, u8 addr, u8 data) { int err; err = es209ra_touch_reg_write(spi, addr, &data, 1); if (err) return err; return 0; } int es209ra_touch_reg_read(struct spi_device *spi, u8 addr, u8 *buf, size_t len) { int err; u8 read_req[2]; u8 dummy_read_req[] = {0x00, 0x00}; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); if (buf == NULL || len == 0) return -EINVAL; read_req[0] = 0x00; read_req[1] = addr; /* Dummy SPI write due to issue on the device */ err = spi_write(spi, dummy_read_req, 2); if (err) return err; udelay(180); err = spi_write(spi, read_req, 2); if (err) return err; if (tp->fw_ver < 0x10) mdelay(1); if (len == 1) { u8 read_buf[2]; /* To keep always more than 2 byte read access * The device does't allow 1 byte access */ err = spi_read(spi, read_buf, len+1); *buf = read_buf[0]; } else { err = spi_read(spi, buf, len); } if (err) return err; if (tp->fw_ver < 0x10) mdelay(2); return 0; } static int no_dummy_reg_write(struct spi_device *spi, u8 addr, u8 *buf, size_t len) { int err; u8 *write_buf; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); if (buf == NULL) return -EINVAL; write_buf = kzalloc(sizeof(u8)*(len+2), GFP_KERNEL); if (write_buf == NULL) return -ENOMEM; write_buf[0] = 0x01; write_buf[1] = addr; memcpy(&write_buf[2], buf, len); err = spi_write(spi, write_buf, len+2); kfree(write_buf); if (err) return err; if (tp->fw_ver < 0x10) mdelay(2); return 0; } static int no_dummy_reg_read(struct spi_device *spi, u8 addr, u8* buf) { int err; u8 read_req[2]; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); u8 read_buf[2] = {0x00, 0xFF}; u8 write_buf[2] = {0x00, 0xFF}; if (buf == NULL) return -EINVAL; read_req[0] = 0x00; read_req[1] = addr; err = spi_write(spi, read_req, 2); if (err) return err; if (tp->fw_ver < 0x10) mdelay(1); udelay(180); { /* To keep always more than 2 byte read access * The device does't allow 1 byte access */ struct spi_transfer t = { .rx_buf = read_buf, .tx_buf = write_buf, .len = 2, }; struct spi_message m; spi_message_init(&m); spi_message_add_tail(&t, &m); err = spi_sync(spi, &m); *buf = read_buf[0]; } if (err) return err; if (tp->fw_ver < 0x10) mdelay(2); return 0; } static int spi_sync_read(struct spi_device *spi, u8 addr, u8 *buf, size_t len) { int err; u8 read_req[2]; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); read_req[0] = 0x00; read_req[1] = addr; err = spi_write(spi, read_req, 2); if (err) return err; if (tp->fw_ver < 0x10) msleep(1); udelay(180); err = spi_read(spi, buf, len); if (err) return err; if (tp->fw_ver < 0x10) msleep(2); return 0; } static void reset_device(struct es209ra_touch_platform_data *pdata) { gpio_set_value(pdata->gpio_reset_pin, 1); udelay(1000); gpio_set_value(pdata->gpio_reset_pin, 0); udelay(1000); } static void dump_calibration_parameters(struct es209ra_touch_ioctl_clbr *data) { DBGLOG("%s: resolution=%d\n", __func__, data->resolution); DBGLOG("%s: scanspeed=%d\n", __func__, data->scanspeed); DBGLOG("%s: prescaler=%d\n", __func__, data->prescaler); DBGLOG("%s: columnidac=%d\n", __func__, data->columnidac); DBGLOG("%s: rowidac=%d\n", __func__, data->rowidac); DBGLOG("%s: noisethreshold=%d\n", __func__, data->noisethreshold); DBGLOG("%s: fingerthreshold=%d\n", __func__, data->fingerthreshold); DBGLOG("%s: negnoisethreshold=%d\n", __func__, data->negnoisethreshold); DBGLOG("%s: lowbaselinereset=%d\n", __func__, data->lowbaselinereset); DBGLOG("%s: blupdatethreshold=%d\n", __func__, data->blupdatethreshold); } static int do_calibration_ioctl_valset(struct spi_device *spi, struct es209ra_touch_ioctl_clbr *data) { struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); int err = 0; u8 read_buffer; mutex_lock(&tp->touch_lock); if (tp->fw_ver >= 0x7) disable_irq(spi->irq); dump_calibration_parameters(data); switch (data->clbr_num) { case 0: reg_write_byte(spi, TP_REG_CRES, data->resolution); break; case 1: reg_write_byte(spi, TP_REG_CSP, data->scanspeed); break; case 2: reg_write_byte(spi, TP_REG_CPC, data->prescaler); break; case 3: reg_write_byte(spi, TP_REG_CNTHRS, data->noisethreshold); break; case 4: reg_write_byte(spi, TP_REG_CFTHRS, data->fingerthreshold); break; case 5: reg_write_byte(spi, TP_REG_CNNTHR, data->negnoisethreshold); break; case 6: reg_write_byte(spi, TP_REG_CLBR, data->lowbaselinereset); break; case 7: reg_write_byte(spi, TP_REG_CBLUTHR, data->blupdatethreshold); break; case 8: reg_write_byte(spi, TP_REG_CRES, data->resolution); reg_write_byte(spi, TP_REG_CSP, data->scanspeed); reg_write_byte(spi, TP_REG_CPC, data->prescaler); reg_write_byte(spi, TP_REG_CNTHRS, data->noisethreshold); reg_write_byte(spi, TP_REG_CFTHRS, data->fingerthreshold); reg_write_byte(spi, TP_REG_CNNTHR, data->negnoisethreshold); reg_write_byte(spi, TP_REG_CLBR, data->lowbaselinereset); reg_write_byte(spi, TP_REG_CBLUTHR, data->blupdatethreshold); break; default: ERRLOG("%s: reg num error = %d\n", __func__, data->clbr_num); if (tp->fw_ver >= 0x7) enable_irq(spi->irq); mutex_unlock(&tp->touch_lock); return -EINVAL; } reg_write_byte(spi, TP_REG_CUD, 0x01); if (tp->fw_ver >= 0x7) { msleep(200); err = es209ra_touch_reg_read(spi, TP_REG_CUD, &read_buffer, 1); if (err) { err = -EIO; } else { /* reset release device */ DBGLOG("%s: state=DRV_STATE_BEGIN_RESET\n", __func__); tp->state = DRV_STATE_BEGIN_RESET; DBGLOG("%s: touch_reset_device\n", __func__); reset_device(pdata); } enable_irq(spi->irq); } else { msleep(250); } mutex_unlock(&tp->touch_lock); return err; } static int do_calibration_ioctl_valget(struct spi_device *spi, struct es209ra_touch_ioctl_clbr *data) { es209ra_touch_reg_read(spi, TP_REG_CRES, &data->resolution, 1); es209ra_touch_reg_read(spi, TP_REG_CSP, &data->scanspeed, 1); es209ra_touch_reg_read(spi, TP_REG_CPC, &data->prescaler, 1); es209ra_touch_reg_read(spi, TP_REG_CIDACC, &data->columnidac, 1); es209ra_touch_reg_read(spi, TP_REG_CIDACR, &data->rowidac, 1); es209ra_touch_reg_read(spi, TP_REG_CNTHRS, &data->noisethreshold, 1); es209ra_touch_reg_read(spi, TP_REG_CFTHRS, &data->fingerthreshold, 1); es209ra_touch_reg_read(spi, TP_REG_CNNTHR, &data->negnoisethreshold, 1); es209ra_touch_reg_read(spi, TP_REG_CLBR, &data->lowbaselinereset, 1); es209ra_touch_reg_read(spi, TP_REG_CBLUTHR, &data->blupdatethreshold, 1); dump_calibration_parameters(data); return 0; } static int do_calibration(struct spi_device *spi, struct es209ra_touch_ioctl_clbr *data, int cmd) { int err; switch (cmd) { case 0x00: err = do_calibration_ioctl_valset(spi, data); break; case 0x01: err = do_calibration_ioctl_valget(spi, data); break; default: err = -EINVAL; ERRLOG("%s: cmd error\n", __func__); break; } return err; } #if !defined(CONFIG_FW_HEADER) static ssize_t get_fw_data(struct es209ra_touch *tp, char *fw_buf, size_t count, int islast) { ssize_t length = -1; struct file *filp; struct inode *inode = NULL; loff_t pos = 0; mm_segment_t old_fs; old_fs = get_fs(); set_fs(KERNEL_DS); filp = filp_open(FIRMWARE_PATH, O_RDONLY, 0); if (IS_ERR(filp)) { ERRLOG("%s: File %p filp_open error\n", __func__, filp); goto err_r_fs; } if (!filp->f_op) { ERRLOG("%s: File Operation Method Error\n", __func__); goto err_close_file; } inode = filp->f_path.dentry->d_inode; if (!inode) { ERRLOG("%s: Get inode from filp failed\n", __func__); goto err_close_file; } length = filp->f_path.dentry->d_inode->i_size; if (length < count) { ERRLOG("%s: Invalid firmware length %d\n", __func__, length); goto err_close_file; } DBGLOG("%s: file length=%d\n", __func__, length); if (islast == 1) pos = length - 1; length = vfs_read(filp, fw_buf, count, &pos); err_close_file: filp_close(filp, NULL); err_r_fs: set_fs(old_fs); return length; } #endif static int check_state(struct es209ra_touch *tp, int exp_state) { int i; /* value 25 = 500(power on time)/20(mdelay) */ for (i = 0; i < 25; i++) { if (tp->state >= exp_state) return 0; else msleep(20); } return -1; } static u8 get_latest_firmware_ver(struct es209ra_touch *tp) { ssize_t length; char fw_buf; DBGLOG("%s: start\n", __func__); #if !defined(CONFIG_FW_HEADER) length = get_fw_data(tp, &fw_buf, 1, 1); if (length != 1) { ERRLOG("%s: Failed to read %d\n", __func__, length); fw_buf = 0; } #else length = 0; fw_buf = firmware[FW_LENGTH]; #endif DBGLOG("%s: fw version = %d.%d\n", __func__, fw_buf>>4, fw_buf&0x0F); return fw_buf; } static int update_firmware(struct es209ra_touch *tp) { struct spi_device *spi = tp->spi; struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; const u8 BootloaderKeys[8] = {0x0A, 0x06, 0x0D, 0x06, 0x00, 0x01, 0x0D, 0x03}; u8 BootloaderEnter[9] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38}; u8 BootloaderExit[11] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B, 0xCA, 0x53}; u8 WriteFlashBlock[143]; u8 WriteFlashBlock_FBNO142_Init, read_buf; ssize_t length; int err = 0; int i; int j; char *fw_buf; DBGLOG("%s: start\n", __func__); memcpy(BootloaderEnter, BootloaderKeys, ARRAY_SIZE(BootloaderKeys)); err = es209ra_touch_reg_write(tp->spi, TP_REG_BL, BootloaderEnter, ARRAY_SIZE(BootloaderEnter)); if (err) { ERRLOG("%s: write enter error\n", __func__); goto err_r_fs_irq; } msleep(200); err = no_dummy_reg_read(tp->spi, TP_REG_BL, &read_buf); if (err) { ERRLOG("%s: write enter read state error\n", __func__); goto err_r_fs_irq; } if (read_buf != 0x3) { ERRLOG("%s: write enter state error %d\n", __func__, read_buf); err = -1; goto err_r_fs_irq; } DBGLOG("%s: BootloaderEnter OK readbuf=%x\n", __func__, read_buf); #if !defined(CONFIG_FW_HEADER) fw_buf = kmalloc(FW_LENGTH, GFP_KERNEL); if (fw_buf == NULL) { ERRLOG("%s: kernel memory alloc error\n", __func__); err = -1; goto err_r_fs_irq; } length = get_fw_data(tp, fw_buf, FW_LENGTH, 0); if ((length != FW_LENGTH) { ERRLOG("%s: Failed to read %d\n", __func__, length); err = -1; goto err_free_data; } #else length = 0; fw_buf = (char *)firmware; #endif memcpy(WriteFlashBlock, BootloaderKeys, ARRAY_SIZE(BootloaderKeys)); WriteFlashBlock[FB_NO(10)] = 0x39; WriteFlashBlock[FB_NO(11)] = 0x00; WriteFlashBlock[FB_NO(143)] = 0xCA; WriteFlashBlock[FB_NO(144)] = 0x53; WriteFlashBlock_FBNO142_Init = TP_REG_BL; for (i = 2; i < 12; i++) WriteFlashBlock_FBNO142_Init += WriteFlashBlock[FB_NO(i)]; i = 2; /* Data Initialize */ while (1) { /* Data Check Sum */ WriteFlashBlock[FB_NO(141)] = 0; /* Command Check Sum FB_NO(1-11) */ WriteFlashBlock[FB_NO(142)] = WriteFlashBlock_FBNO142_Init; WriteFlashBlock[FB_NO(12)] = i; memcpy(&WriteFlashBlock[FB_NO(13)], &fw_buf[FLASH_BLOCK_SIZE*i], (int)FLASH_BLOCK_SIZE); /* Data Check Sum FB_NO(13-140) */ for (j = 13; j < 141; j++) WriteFlashBlock[FB_NO(141)] += WriteFlashBlock[FB_NO(j)]; /* Command Check Sum add FB_NO(12-141) */ WriteFlashBlock[FB_NO(142)] += (WriteFlashBlock[FB_NO(141)]*2 + WriteFlashBlock[FB_NO(12)]); /* Download New Application Firmware */ err = no_dummy_reg_write(tp->spi, TP_REG_BL, WriteFlashBlock, ARRAY_SIZE(WriteFlashBlock)); if (err) { ERRLOG("%s: write firmware error\n", __func__); goto err_free_data; } msleep(100); err = no_dummy_reg_read(tp->spi, TP_REG_BL, &read_buf); if (err) { ERRLOG("%s: read state error %d\n", __func__, i); goto err_free_data; } if (read_buf != 0x3) { ERRLOG("%s: write firmware state error %d,%d\n", __func__, read_buf, i); err = -1; goto err_free_data; } i++; /* next flash block */ if (i > CHECKBLOCK) break; if (i > MAX_FIRMWAREBLOCK) i = CHECKBLOCK; } memcpy(BootloaderExit, BootloaderKeys, ARRAY_SIZE(BootloaderKeys)); /* Device will be automatically reset after this command */ err = no_dummy_reg_write(tp->spi, TP_REG_BL, BootloaderExit, ARRAY_SIZE(BootloaderExit)); if (err) { ERRLOG("%s: write exit error\n", __func__); goto err_free_data; } DBGLOG("%s: BootloaderExit\n", __func__); DBGLOG("%s: state = DRV_STATE_POWEROFF\n", __func__); tp->state = DRV_STATE_POWEROFF; err_free_data: #if !defined(CONFIG_FW_HEADER) kfree(fw_buf); #endif err_r_fs_irq: if (tp->state != DRV_STATE_POWEROFF) { /* reset release device */ DBGLOG("%s: state = DRV_STATE_BEGIN_RESET\n", __func__); tp->state = DRV_STATE_BEGIN_RESET; DBGLOG("%s: touch_reset_device\n", __func__); reset_device(pdata); } DBGLOG("%s: Return=%d\n", __func__, err); return err; } static void es209ra_touch_tmowork(struct work_struct *work) { struct es209ra_touch *tp = container_of(work, struct es209ra_touch, tmowork); struct spi_device *spi = tp->spi; struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; mutex_lock(&tp->touch_lock); if (tp->g_state != NO_TOUCH) { tp->touch_data.gc = GC_TOUCHUP; touch_data_handler(tp); } DBGLOG("%s: state = DRV_STATE_BEGIN_RESET\n", __func__); tp->state = DRV_STATE_BEGIN_RESET; DBGLOG("%s: touch_reset_device\n", __func__); reset_device(pdata); mutex_unlock(&tp->touch_lock); } static void touch_timeout(unsigned long arg) { struct es209ra_touch *tp = (struct es209ra_touch *)arg; DBGLOG("%s: start\n", __func__); schedule_work(&tp->tmowork); } static void touch_data_handler(struct es209ra_touch *tp) { struct finger_data *tp1 = &tp->finger_data[FIRST_TOUCH_POINT]; struct finger_data *tp2 = &tp->finger_data[SECOND_TOUCH_POINT]; struct finger_data *down; struct finger_data *temp; tp1->x = tp->touch_data.xlsb1 | ((tp->touch_data.xymsb1 & 0x0F) << 8); tp1->y = tp->touch_data.ylsb1 | ((tp->touch_data.xymsb1 & 0xF0) << 4); tp2->x = tp->touch_data.xlsb2 | ((tp->touch_data.xymsb2 & 0x0F) << 8); tp2->y = tp->touch_data.ylsb2 | ((tp->touch_data.xymsb2 & 0xF0) << 4); down = (tp1->x != 0xFFF) ? tp1 : tp2; DBGLOG("%s: [%02x] xy1=(%d %d)" "xy2=(%d %d) TCH12=%d AXISxy=(%d %d)" "1stTchXY=(%d %d) 1stTchL=%d %s\n", __func__, tp->touch_data.gc, tp1->x, tp1->y, tp2->x, tp2->y, TSTAT_TCH12(tp->touch_data.tstat), TSTAT_AXISX(tp->touch_data.tstat), TSTAT_AXISY(tp->touch_data.tstat), TSTAT_1STTCHX(tp->touch_data.tstat), TSTAT_1STTCHY(tp->touch_data.tstat), TSTAT_1STTCHL(tp->touch_data.tstat), ((tp->touch_data.tstat & 0x7) != 0x7) ? "*** error" : ""); switch (tp->touch_data.gc) { case GC_TOUCHUP: case GC_CLICK: if (timer_pending(&tp->tickfn)) { del_timer(&tp->tickfn); tp->g_state_err = 0; } if (tp->g_state == ONE_TOUCH) { input_report_abs(tp->input, ABS_MT_POSITION_X, down->old_x); input_report_abs(tp->input, ABS_MT_POSITION_Y, down->old_y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 0); input_mt_sync(tp->input); input_sync(tp->input); DBGLOG("%s: ST -> touch up: (%d, %d)", __func__, down->old_x, down->old_y); } else if (tp->g_state == TWO_TOUCH) { input_report_abs(tp->input, ABS_MT_POSITION_X, tp1->old_x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp1->old_y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 0); input_mt_sync(tp->input); input_report_abs(tp->input, ABS_MT_POSITION_X, tp2->old_x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp2->old_y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 0); input_mt_sync(tp->input); input_sync(tp->input); DBGLOG("%s: MT -> tp1 touch up: (%d, %d)" " tp2 touch up: (%d, %d) \n", __func__, tp1->old_x, tp1->old_y, tp2->old_x, tp2->old_y); tp1->old_x = 0xFFF; tp1->old_y = 0xFFF; tp2->old_x = 0xFFF; tp2->old_y = 0xFFF; } tp->g_state = NO_TOUCH; break; case GC_FTOUCH1: case GC_DRAG: if (timer_pending(&tp->tickfn)) { del_timer(&tp->tickfn); tp->g_state_err = 0; } /*send ST report*/ input_report_abs(tp->input, ABS_MT_POSITION_X, down->x); input_report_abs(tp->input, ABS_MT_POSITION_Y, down->y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 10); input_mt_sync(tp->input); input_sync(tp->input); DBGLOG("%s: ST -> tp1 touch down: %d, %d\n", __func__, down->x, down->y); down->old_x = down->x; down->old_y = down->y; tp->g_state = ONE_TOUCH; break; case GC_FTOUCH2: if (timer_pending(&tp->tickfn)) { del_timer(&tp->tickfn); tp->g_state_err = 0; } /* swap order of sending fingers when 1st finger goes down->up->down */ if ((tp->g_state == ONE_TOUCH) && (tp1->x != down->old_x && tp1->y != down->old_y)) { temp = tp1; tp1 = tp2; tp2 = temp; } /*report 2 successive finger*/ input_report_abs(tp->input, ABS_MT_POSITION_X, tp1->x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp1->y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 10); input_mt_sync(tp->input); tp1->old_x = tp1->x; tp1->old_y = tp1->y; input_report_abs(tp->input, ABS_MT_POSITION_X, tp2->x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp2->y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 10); input_mt_sync(tp->input); input_sync(tp->input); DBGLOG("%s: MT -> tp1 touch down: (%d, %d)," " tp2 touch down: (%d, %d) \n", __func__, tp1->x, tp1->y, tp2->x, tp2->y); tp2->old_x = tp2->x; tp2->old_y = tp2->y; tp->g_state = TWO_TOUCH; break; case GC_DRAG2: case GC_ZOOM2: if (timer_pending(&tp->tickfn)) { del_timer(&tp->tickfn); tp->g_state_err = 0; } /*reduce jump*/ if (abs(tp1->x - tp1->old_x) > JUMP_PIXEL) { tp1->x = tp1->old_x + ((tp1->x - tp1->old_x) * 1/10); DBGLOG("%s: tp1->x = %d jumped!\n", __func__, tp1->x); } if (abs(tp1->y - tp1->old_y) > JUMP_PIXEL) { tp1->y = tp1->old_y + ((tp1->y - tp1->old_y) * 1/10); DBGLOG("%s: tp1->y = %d jumped!\n", __func__, tp1->y); } if (abs(tp2->x - tp2->old_x) > JUMP_PIXEL) { tp2->x = tp2->old_x + ((tp2->x - tp2->old_x) * 1/10); DBGLOG("%s: tp2->x = %d jumped!\n", __func__, tp2->x); } if (abs(tp2->y - tp2->old_y) > JUMP_PIXEL) { tp2->y = tp2->old_y + ((tp2->y - tp2->old_y) * 1/10); DBGLOG("%s: tp2->y = %d jumped!\n", __func__, tp2->y); } /*send MT report*/ input_report_abs(tp->input, ABS_MT_POSITION_X, tp1->x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp1->y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 10); input_mt_sync(tp->input); tp1->old_x = tp1->x; tp1->old_y = tp1->y; input_report_abs(tp->input, ABS_MT_POSITION_X, tp2->x); input_report_abs(tp->input, ABS_MT_POSITION_Y, tp2->y); input_report_abs(tp->input, ABS_MT_TOUCH_MAJOR, 10); input_mt_sync(tp->input); input_sync(tp->input); DBGLOG("%s: MT -> tp1 touch down: (%d, %d)," " tp2 touch down: (%d, %d) \n", __func__, tp1->x, tp1->y, tp2->x, tp2->y); tp2->old_x = tp2->x; tp2->old_y = tp2->y; break; case GC_ERROR: ERRLOG("%s: touch err\n", __func__); if (timer_pending(&tp->tickfn) == 0) { DBGLOG("%s: timeout set!\n", __func__); tp->tickfn.expires = jiffies + RESET_TIME; add_timer(&tp->tickfn); } tp->g_state_err = 1; break; default: DBGLOG("%s: -> Unknown gesture reg code!\n", __func__); break; } } static void es209ra_touch_isr(struct work_struct *work) { struct es209ra_touch *tp = container_of(work, struct es209ra_touch, isr_work); struct spi_device *spi = tp->spi; int err; mutex_lock(&tp->touch_lock); err = spi_sync_read(spi, TP_REG_XLSB, (u8 *)&tp->touch_data, sizeof(tp->touch_data)); if (err) ERRLOG("%s: spi_sync_read failed\n", __func__); if (tp->state == DRV_STATE_ACTIVE_APP) { touch_data_handler(tp); } else if ((tp->state == DRV_STATE_POWEROFF) || (tp->state == DRV_STATE_BEGIN_RESET)) { DBGLOG("%s: setup_work()\n", __func__); es209ra_setup_work(tp); } else { ERRLOG("%s: invalid state\n", __func__); } mutex_unlock(&tp->touch_lock); } static irqreturn_t es209ra_touch_irq(int irq, void *handle) { struct es209ra_touch *tp = handle; schedule_work(&tp->isr_work); return IRQ_HANDLED; } static void es209ra_setup_work(struct es209ra_touch *tp) { u8 read_buf = 0xFF; DBGLOG("%s: update_counter=%d\n", __func__, tp->update_counter); if (tp->g_state_err == 1) { /* Reset Error */ DBGLOG("%s: timeout setup!\n", __func__); tp->g_state_err = 0; DBGLOG("%s: state = DRV_STATE_ACTIVE_APP\n", __func__); tp->state = DRV_STATE_ACTIVE_APP; reg_write_byte(tp->spi, TP_REG_CTRL, 0x01); reg_write_byte(tp->spi, TP_REG_GCTRL, 0x64); reg_write_byte(tp->spi, TP_REG_SLP1TO, 0x96); reg_write_byte(tp->spi, TP_REG_SLP2TO, 0x96); reg_write_byte(tp->spi, TP_REG_SLP1SR, 0x0C); reg_write_byte(tp->spi, TP_REG_SLP2SR, 0x18); reg_write_byte(tp->spi, TP_REG_ACTSENS, 0x11); reg_write_byte(tp->spi, TP_REG_SLP1SENS, 0x22); reg_write_byte(tp->spi, TP_REG_SLP2SENS, 0x33); reg_write_byte(tp->spi, TP_REG_DRAGS, 0x03); return; } if ((tp->state != DRV_STATE_POWEROFF)) es209ra_touch_reg_read(tp->spi, TP_REG_BL, &read_buf, 1); DBGLOG("%s: es209ra_touch_setup_%x\n", __func__, read_buf); /* check whether application firmware or bootloader is running */ if (read_buf == 0x0) { /* app mode */ es209ra_touch_reg_read(tp->spi, TP_REG_FWVER, &tp->fw_ver, 1); DBGLOG("%s: fw version = %d.%d\n", __func__, tp->fw_ver>>4, tp->fw_ver&0x0F); if ((tp->fw_ver < 0x06) || (tp->fw_ver > 0x99)) { ERRLOG("%s: unknown ver = %d\n", __func__, tp->fw_ver); return; } DBGLOG("%s: state = DRV_STATE_ACTIVE_APP\n", __func__); tp->state = DRV_STATE_ACTIVE_APP; #if !defined(CONFIG_FWUPDATE_IGNORE) if ((tp->update_counter < UPDATE_RETRY_NUMBER) && (tp->fw_ver >= UPDATE_PERMISSION_VERSION) && (tp->fw_ver != get_latest_firmware_ver(tp))) { DBGLOG("%s: firmware update is required\n", __func__); tp->update_counter++; update_firmware(tp); } else { #endif /* initialze the device */ reg_write_byte(tp->spi, TP_REG_CTRL, 0x01); reg_write_byte(tp->spi, TP_REG_GCTRL, 0x64); reg_write_byte(tp->spi, TP_REG_SLP1TO, 0x96); reg_write_byte(tp->spi, TP_REG_SLP2TO, 0x96); reg_write_byte(tp->spi, TP_REG_SLP1SR, 0x0C); reg_write_byte(tp->spi, TP_REG_SLP2SR, 0x18); reg_write_byte(tp->spi, TP_REG_ACTSENS, 0x11); reg_write_byte(tp->spi, TP_REG_SLP1SENS, 0x22); reg_write_byte(tp->spi, TP_REG_SLP2SENS, 0x33); reg_write_byte(tp->spi, TP_REG_DRAGS, 0x03); #if !defined(CONFIG_FWUPDATE_IGNORE) } #endif } else if (read_buf == 0x1) { /* boot mode */ DBGLOG("%s: state = DRV_STATE_ACTIVE_BL\n", __func__); tp->state = DRV_STATE_ACTIVE_BL; if ((tp->update_counter >= UPDATE_RETRY_NUMBER)) { tp->update_counter = 0; ERRLOG("%s: firmware update failed and finished\n", __func__); #if !defined(CONFIG_FWUPDATE_IGNORE) } else { DBGLOG("%s: FW update failed and required. Count=%d\n", __func__, tp->update_counter); tp->update_counter++; update_firmware(tp); } #endif } else { DBGLOG("%s: state = DRV_STATE_BEGIN_RESET\n", __func__); tp->state = DRV_STATE_BEGIN_RESET; ERRLOG("%s: mode error = %d\n", __func__, read_buf); } } /*--------------------------------------------------------------------------*/ static int es209ra_touch_suspend(struct spi_device *spi, pm_message_t message) { struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); int err; u8 data; disable_irq(tp->spi->irq); /* clear worker and timer */ if (work_pending(&tp->isr_work)) flush_work(&tp->isr_work); if (work_pending(&tp->tmowork)) flush_work(&tp->tmowork); if (timer_pending(&tp->tickfn)) { del_timer(&tp->tickfn); tp->g_state_err = 0; } err = es209ra_touch_reg_read(spi, TP_REG_CTRL, &data, 1); if (err) return err; err = reg_write_byte(spi, TP_REG_CTRL, data&0xFE); if (err) return err; return 0; } static int es209ra_touch_resume(struct spi_device *spi) { struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; enable_irq(tp->spi->irq); DBGLOG("%s: state = DRV_STATE_BEGIN_RESET\n", __func__); tp->state = DRV_STATE_BEGIN_RESET; DBGLOG("%s: state = touch_reset_device\n", __func__); reset_device(pdata); return 0; } #ifdef CONFIG_ES209RA_TOUCH_EARLYSUSPEND static void es209ra_touch_early_suspend(struct early_suspend *es) { struct es209ra_touch *tp; tp = container_of(es, struct es209ra_touch, early_suspend); DBGLOG("%s: start\n", __func__); es209ra_touch_suspend(tp->spi, PMSG_SUSPEND); } static void es209ra_touch_late_resume(struct early_suspend *es) { struct es209ra_touch *tp; tp = container_of(es, struct es209ra_touch, early_suspend); DBGLOG("%s: start\n", __func__); es209ra_touch_resume(tp->spi); } #endif static int es209ra_touch_open(struct inode *inode, struct file *file) { struct es209ra_touch *tp = container_of(inode->i_cdev, struct es209ra_touch, device_cdev); file->private_data = tp; return 0; } static int es209ra_touch_release(struct inode *inode, struct file *file) { return 0; } static int parse_and_calibrate(struct es209ra_touch *tp, struct spi_device *spi, const char __user *buf, size_t count) { int err = -1; int i; int j; u8 read_buffer_in[PARAM_LENGTH/2] = {0}; u8 tmp_read_buffer[PARAM_LENGTH] = {0}; err = check_state(tp, DRV_STATE_ACTIVE_BL); if (err == -1) { ERRLOG("%s: invalid state\n", __func__); return err; } if (!access_ok(VERIFY_READ, (void __user *)buf, PARAM_LENGTH)) { err = -EFAULT; ERRLOG("%s: invalid access\n", __func__); goto done; } if (copy_from_user(tmp_read_buffer, buf, (sizeof(u8)*PARAM_LENGTH))) { err = -1; ERRLOG("%s: copy_from_user error\n", __func__); goto done; } /* parse & conversion */ for (i = 0; i < ARRAY_SIZE(read_buffer_in); i++) { for (j = 0; j < 2; j++) { u8 c = toupper(tmp_read_buffer[i * 2 + j]); if (isxdigit(c)) read_buffer_in[i] = (read_buffer_in[i] << 4) | (isdigit(c) ? c - '0' : c - 'A' + 10); else { err = -1; ERRLOG("%s: case default error, %d\n", __func__, tmp_read_buffer[j]); goto done; } } } err = do_calibration(spi, (struct es209ra_touch_ioctl_clbr *)read_buffer_in, (int)read_buffer_in[(PARAM_LENGTH/2)-1]); done: if (err == 0) err = count; else ERRLOG("%s: error return %d\n", __func__, err); return err; } static int es209ra_touch_write(struct file *file, const char __user *buf, size_t count, loff_t *f_pos) { struct spi_device *spi = ((struct es209ra_touch *)file->private_data)->spi; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); int err = -1; u8 fwver = 0; if (count >= 4) /*calibrate*/ err = parse_and_calibrate(tp, spi, buf, count); else if (count == 3) { /* get mode */ es209ra_touch_reg_read(tp->spi, TP_REG_BL, &fwver, 1); DBGLOG("%s: mode%d\n", __func__, fwver); } else { /* update firmware*/ if (tp->state == DRV_STATE_ACTIVE_APP) { es209ra_touch_reg_read(tp->spi, TP_REG_FWVER, &fwver, 1); DBGLOG("%s: firmware version = %d.%d\n", __func__, fwver>>4, fwver&0x0F); } #ifdef DEBUG DBGLOG("%s: fwver debug\n", __func__); if (count != 1) fwver = 0x07; #endif DBGLOG("%s: firmware version = %d.%d\n", __func__, fwver>>4, fwver&0x0F); if (!fwver || (fwver != get_latest_firmware_ver(tp))) { DBGLOG("%s: firmware updated is required\n", __func__); mutex_lock(&tp->touch_lock); err = update_firmware(tp); mutex_unlock(&tp->touch_lock); } } return err; } static ssize_t es209ra_touch_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct spi_device *spi = ((struct es209ra_touch *)file->private_data)->spi; struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); int err = 0; struct es209ra_touch_ioctl_clbr data; err = check_state(tp, DRV_STATE_ACTIVE_BL); if (err == -1) { ERRLOG("%s: invalid state\n", __func__); goto done; } switch (cmd) { case IOCTL_VALSET: if (!access_ok(VERIFY_READ, (void __user *) arg, _IOC_SIZE(cmd))) { err = -EFAULT; ERRLOG("%s: invalid access\n", __func__); goto done; } if (copy_from_user(&data, (void __user *) arg, sizeof(data))) { err = -EFAULT; ERRLOG("%s: copy_from_user error\n", __func__); goto done; } err = do_calibration(spi, &data, 0x00); break; case IOCTL_VALGET: if (!access_ok(VERIFY_WRITE, (void __user *) arg, _IOC_SIZE(cmd))) { err = -EFAULT; ERRLOG("%s: invalid access\n", __func__); goto done; } err = do_calibration(spi, &data, 0x01); if (copy_to_user((void __user *) arg, &data, sizeof(data))) { err = -EFAULT; ERRLOG("%s: copy_to_user error\n", __func__); goto done; } break; default: err = -EINVAL; ERRLOG("%s: cmd error\n", __func__); goto done; break; } done: return err; } static const struct file_operations es209ra_touch_fops = { .owner = THIS_MODULE, .write = es209ra_touch_write, .open = es209ra_touch_open, .ioctl = es209ra_touch_ioctl, .release = es209ra_touch_release, }; static int __devinit es209ra_touch_probe(struct spi_device *spi) { struct es209ra_touch *tp; struct input_dev *input_dev; struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; int err; dev_t device_t = MKDEV(0, 0); struct device *class_dev_t = NULL; /* Check the parameters */ if (!spi->irq) { ERRLOG("%s: no IRQ?\n", __func__); return -ENODEV; } if (!pdata) { ERRLOG("%s: no platform data?\n", __func__); return -ENODEV; } /* Set up SPI*/ spi->bits_per_word = 8; spi->mode = SPI_MODE_0; err = spi_setup(spi); if (err < 0) return err; /* Input Device: allocate and set up */ tp = kzalloc(sizeof(struct es209ra_touch), GFP_KERNEL); input_dev = input_allocate_device(); if (!tp || !input_dev) { err = -ENOMEM; goto err_cleanup_mem; } /* Device Data: Setup*/ tp->spi = spi; tp->input = input_dev; tp->state = DRV_STATE_BEGIN_RESET; tp->g_state = NO_TOUCH; tp->g_state_err = 0; tp->update_counter = 0; dev_set_drvdata(&spi->dev, tp); /* Input Device: set up */ input_dev->name = "es209ra_touch"; input_dev->phys = "es209ra_touch/input0"; input_dev->dev.parent = &spi->dev; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); DBGLOG("%s: max x = %d, max y = %d\n", __func__, pdata->x_max, pdata->y_max); input_set_abs_params(input_dev, ABS_X, 0, pdata->x_max, 0, 0); input_set_abs_params(input_dev, ABS_Y, 0, pdata->y_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 10, 0, 0); input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); err = input_register_device(input_dev); if (err) goto err_cleanup_mem; mutex_init(&tp->touch_lock); /* Character Device: set up */ err = alloc_chrdev_region(&device_t, 0, 1, "es209ra_touch"); if (err) goto err_cleanup_input; tp->device_major = MAJOR(device_t); cdev_init(&(tp->device_cdev), &es209ra_touch_fops); tp->device_cdev.owner = THIS_MODULE; tp->device_cdev.ops = &es209ra_touch_fops; err = cdev_add(&(tp->device_cdev), MKDEV(tp->device_major, 0), 1); if (err) goto err_cleanup_chrdev; tp->device_class = class_create(THIS_MODULE, "es209ra_touch"); if (IS_ERR(tp->device_class)) { err = -1; goto err_cleanup_cdev; } class_dev_t = device_create(tp->device_class, NULL, MKDEV(tp->device_major, 0), NULL, "es209ra_touch"); if (IS_ERR(class_dev_t)) { err = -1; goto err_cleanup_class; } /* register firmware validation and initialization to workqueue*/ INIT_WORK(&tp->isr_work, es209ra_touch_isr); INIT_WORK(&tp->tmowork, es209ra_touch_tmowork); /* GPIO: set up*/ err = gpio_request(pdata->gpio_reset_pin, "esh209ra_touch_gpio_reset"); if (err) goto err_cleanup_device; err = gpio_direction_output(pdata->gpio_reset_pin, 1); if (err) goto err_cleanup_device; err = gpio_request(pdata->gpio_irq_pin, "esh209ra_touch_gpio_irq"); if (err) goto err_cleanup_device; err = gpio_direction_input(pdata->gpio_irq_pin); if (err) goto err_cleanup_device; /* IRQ: request */ err = set_irq_type(spi->irq, IRQ_TYPE_LEVEL_LOW); if (err) goto err_cleanup_device; if (request_irq(spi->irq, es209ra_touch_irq, IRQF_TRIGGER_NONE, spi->dev.driver->name, tp)) { ERRLOG("%s: probe, irq %d busy\n", __func__, spi->irq); err = -EBUSY; goto err_cleanup_device; } err = set_irq_type(spi->irq, IRQ_TYPE_EDGE_FALLING); if (err) goto err_cleanup_irq; #ifdef CONFIG_ES209RA_TOUCH_EARLYSUSPEND /* register early suspend*/ tp->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; tp->early_suspend.suspend = es209ra_touch_early_suspend; tp->early_suspend.resume = es209ra_touch_late_resume; register_early_suspend(&tp->early_suspend); #endif /* reset release device */ reset_device(pdata); init_timer(&tp->tickfn); tp->tickfn.function = touch_timeout; tp->tickfn.data = (unsigned long)tp; return 0; err_cleanup_irq: free_irq(spi->irq, tp); err_cleanup_device: device_destroy(tp->device_class, MKDEV(tp->device_major, 0)); err_cleanup_class: class_destroy(tp->device_class); err_cleanup_cdev: cdev_del(&(tp->device_cdev)); err_cleanup_chrdev: unregister_chrdev_region(device_t, 1); err_cleanup_input: input_unregister_device(input_dev); mutex_destroy(&tp->touch_lock); err_cleanup_mem: input_free_device(input_dev); kfree(tp); return err; } static int __devexit es209ra_touch_remove(struct spi_device *spi) { struct es209ra_touch *tp = dev_get_drvdata(&spi->dev); struct es209ra_touch_platform_data *pdata = spi->dev.platform_data; int err; dev_t device_t = MKDEV(tp->device_major, 0); err = gpio_direction_output(pdata->gpio_reset_pin, 1); if (err) return err; es209ra_touch_suspend(spi, PMSG_SUSPEND); #ifdef CONFIG_ES209RA_TOUCH_EARLYSUSPEND unregister_early_suspend(&tp->early_suspend); #endif input_unregister_device(tp->input); device_destroy(tp->device_class, MKDEV(tp->device_major, 0)); class_destroy(tp->device_class); cdev_del(&(tp->device_cdev)); unregister_chrdev_region(device_t, 1); input_free_device(tp->input); free_irq(tp->spi->irq, tp); mutex_destroy(&tp->touch_lock); kfree(tp); DBGLOG("%s: unregistered touchscreen\n", __func__); return 0; } static struct spi_driver es209ra_touch_driver = { .driver = { .name = "es209ra_touch", .bus = &spi_bus_type, .owner = THIS_MODULE, }, .probe = es209ra_touch_probe, .remove = __devexit_p(es209ra_touch_remove), #ifndef CONFIG_ES209RA_TOUCH_EARLYSUSPEND .suspend = es209ra_touch_suspend, .resume = es209ra_touch_resume, #endif }; static int __init es209ra_touch_init(void) { int err; err = spi_register_driver(&es209ra_touch_driver); printk(KERN_INFO "\nes209ra_touch, module init, result = %d \n", err); return err; } module_init(es209ra_touch_init); static void __exit es209ra_touch_exit(void) { spi_unregister_driver(&es209ra_touch_driver); printk(KERN_INFO "\nes209ra_touch, module exit\n"); } module_exit(es209ra_touch_exit); MODULE_DESCRIPTION("es209ra TouchScreen Driver"); MODULE_LICENSE("GPL"); End>VJW926.sb< Start>VJX378.sb< gameRunning = "True" CreateBattleArray() CreateVictoryArray() CreateTextArray() While gameRunning = "True" TextWindow.Clear() PrintIntro() GetHumanWeapon() GetComputerWeapon() DoBattle() DetermineVictory() PlayAgain() EndWhile Sub PrintIntro TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("") TextWindow.WriteLine(" Welcome to the ROCK, PAPER, SCISSORS game.") TextWindow.WriteLine("") TextWindow.WriteLine(" Please select your 'weapon.'") TextWindow.WriteLine("") TextWindow.WriteLine(" 1. Rock") TextWindow.WriteLine(" 2. Paper") TextWindow.WriteLine(" 3. Scissors") EndSub Sub GetHumanWeapon TextWindow.WriteLine("") TextWindow.Write(" >") humanWeapon = TextWindow.ReadNumber() If humanWeapon < 1 Or humanWeapon > 3 Then humanWeapon = Math.GetRandomNumber(3) TextWindow.WriteLine(" You have made an invalid choice. A choice has been made for you.") EndIf EndSub Sub GetComputerWeapon computerWeapon = Math.GetRandomNumber(3) TextWindow.WriteLine("") TextWindow.WriteLine(" The computer has selected a " + computerWeapon + ".") EndSub Sub DoBattle victory = battleArray[humanWeapon][computerWeapon] TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.ForegroundColor = "Red" TextWindow.WriteLine(textArray[humanWeapon][computerWeapon]) EndSub Sub DetermineVictory TextWindow.WriteLine("") TextWindow.ForegroundColor = victoryArray[victory][2] TextWindow.WriteLine(victoryArray[victory][1]) EndSub Sub CreateBattleArray ' First element is the human weapon. 1 = rock, 2 = paper, 3 = scissors ' Second element is the computer weapon. 1 = rock, 2 = paper, 3 = scissors ' The array value is the victory condition. 1 = human victory, 2 = computer victory, 3 = draw battleArray[1][1] = 3 battleArray[2][1] = 1 battleArray[3][1] = 2 battleArray[1][2] = 2 battleArray[2][2] = 3 battleArray[3][2] = 1 battleArray[1][3] = 1 battleArray[2][3] = 2 battleArray[3][3] = 3 EndSub Sub CreateVictoryArray victoryArray[1][1] = " You won!" victoryArray[2][1] = " The computer won!" victoryArray[3][1] = " A draw! No one wins!" victoryArray[1][2] = "Green" victoryArray[2][2] = "Blue" victoryArray[3][2] = "Gray" EndSub Sub CreateTextArray textArray[1][1] = " Rock vs. Rock." textArray[2][1] = " Paper vs. Rock. Paper covers Rock." textArray[3][1] = " Scissors vs. Rock. Rock break Scissors." textArray[1][2] = " Rock vs. Paper. Paper covers Rock." textArray[2][2] = " Paper vs. Paper." textArray[3][2] = " Scissors vs. Paper. Scissors cut Paper." textArray[1][3] = " Rock vs. Scissors. Rock break Scissors." textArray[2][3] = " Paper vs. Scissors. Scissors cut Paper." textArray[3][3] = " Scissors vs. Scissors." EndSub Sub PlayAgain TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("") TextWindow.Write(" Would you like to play again (y/n)?") answer = TextWindow.Read() If answer <> "y" Then Program.End() EndIf EndSub End>VJX378.sb< Start>VJZ575.sb< ' Chime Programming System 0.1 ' Program Copyright (c) 2014 Nonki Takahshi. ' ' License: ' The MIT License (MIT) ' http://opensource.org/licenses/mit-license.php ' ' History: ' 0.1a 2014-04-17 Created. () ' ' Reference: ' [1] Gakkou no Chaimu (Chime of School), se-053a.mp3, ' http://www.soundoffice.com/se/item/se-053.php ' debug = "False" CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) MAX = 40 gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Chime Programming System 0.1" GraphicsWindow.BackgroundColor = "LightGray" url = "http://www.nonkit.com/smallbasic.files/" chime = url + "se-053a.mp3" ' The following line could be harmful and has been automatically commented. ' path = File.GetSettingsFilePath() GraphicsWindow.FontName = "Courier New" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(10, 10, "Setting filename:" + CRLF + path) ' The following line could be harmful and has been automatically commented. ' settings = File.ReadContents(path) GetCurrentTime() otime = Shapes.AddText(ctime) Shapes.Move(otime, 10, 50) Timer.Tick = OnTick GraphicsWindow.DrawText(10, 90, "Program:") x = 10 y = 110 For i = 1 To MAX GraphicsWindow.DrawText(x, y, i) time[i] = Controls.AddTextBox(x + 20, y - 4) Controls.SetSize(time[i], 80, 24) If settings[i] <> "" Then Controls.SetTextBoxText(time[i], settings[i]) EndIf x = x + 120 If gw - 120 < x Then x = 10 y = y + 26 EndIf EndFor GetNextTime() Controls.TextTyped = OnTextTyped ring = "False" changed = "False" While "True" If ring Then Sound.Play(chime) GetNextTime() ring = "False" EndIf If changed Then GetNextTime() changed = "False" EndIf EndWhile Sub GetNextTime ' param cmin - current minutes ' return nmin - next minutes nrem = 1440 nmin = 1440 For i = 1 To MAX If settings[i] <> "" Then _h = Text.GetSubText(settings[i], 1, 2) _m = Text.GetSubText(settings[i], 4, 2) _min = _h * 60 + _m remain = _min - cmin If 0 < remain And remain < nrem Then nrem = remain nmin = _min EndIf EndIf EndFor If debug Then GraphicsWindow.Title = "nmin=" + nmin + " cmin=" + cmin EndIf EndSub Sub OnTextTyped tb = Controls.LastTypedTextBox For _i = 1 To MAX If time[_i] = tb Then settings[_i] = Controls.GetTextBoxText(tb) Goto break EndIf EndFor break: ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path, settings) changed = "True" EndSub Sub OnTick GetCurrentTime() Shapes.SetText(otime, ctime) If nmin <= cmin Then ring = "True" EndIf EndSub Sub GetCurrentTime h = Clock.Hour If h <= 9 Then h = Text.Append("0", h) EndIf m = Clock.Minute If m <= 9 Then m = Text.Append("0", m) EndIf ctime = "Current time: " + h + ":" + m cmin = h * 60 + m s = Clock.Second Timer.Interval = (60 - s) * 1000 EndSub End>VJZ575.sb< Start>VKB520.sb< '*************************************************************************************** 'XZG681 'Sample program to demonstate virtually all of the SmallBasic GraphicsWindow commands 'Includes use of Shapes, Images, Arrays, Mouse and Keyboard control 'Does all of the main features required to write games using basic examples 'You will need to look at the code to see what is supposed to happen and how it is done 'Play with it, change it, break it then fix it '*************************************************************************************** ' 'Create a graphics window ' 'Keep it hidden till we want to show it GraphicsWindow.Hide() 'Give it a title GraphicsWindow.Title = "Graphics Window Example" 'Set its size and position (use variables gw and gh because they may be useful later) gw = 800 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 'The top and left = 4 position the window neatly in the top left of the screen GraphicsWindow.Top = 4 GraphicsWindow.Left = 4 'Set a background colour GraphicsWindow.BackgroundColor = "LightBlue" 'Set it so it cannot be resized GraphicsWindow.CanResize = "False" 'Show the window GraphicsWindow.Show() ' 'Create a red ball of diameter 50 (radius 25) and place it in the middle of the window (leave it there for 5 seconds) ' radius = 25 GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenColor = "Black" ' We set the position to be the (screen centre - radius), since the screen position is defined as the top left of the ball ball = Shapes.AddEllipse(2*radius,2*radius) Shapes.Move(ball,gw/2-radius,gh/2-radius) Program.Delay(5000) ' 5000 milliseconds = 5 seconds ' 'Move the ball randomly by animation 10 times (once per second) ' For i = 1 To 10 x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh) Shapes.Animate(ball,x-radius,y-radius,1000) Program.Delay(1000) ' We have to delay (pause) to wait for the animation to finish EndFor ' 'Move the ball to follow the mouse for 10 seconds ' start = Clock.Second time = 0 While (time < 10) xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY Shapes.Move(ball,xm-radius,ym-radius) time = Clock.Second - start 'If we go over the minute then seconds go back to 0 so add 60 seconds If (time < 0) Then time = time+60 EndIf 'Display the mouse coordinates - first overwrite the last output GraphicsWindow.PenColor = GraphicsWindow.BackgroundColor GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(gw-120,10,120,30) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(gw-120,10,"("+xm+","+ym+")") EndWhile ' 'Use 10 balls and move the one selected by the mouse left down (delete with right down) 'Run until all balls are deleted 'The moved balls change colour ' GraphicsWindow.Clear() 'Create an array of 10 balls and their random positions nball = 10 For i = 1 To nball GraphicsWindow.BrushColor = "LightGreen" GraphicsWindow.PenColor = "Black" x[i] = radius + Math.GetRandomNumber(gw-2*radius) y[i] = radius + Math.GetRandomNumber(gh-2*radius) ball = Shapes.AddEllipse(2*radius,2*radius) Shapes.Move(ball,x[i]-radius,y[i]-radius) balls[i] = ball EndFor start = Clock.Second iball = 0 While (nball > 0) If (Mouse.IsLeftButtonDown = "True") Then xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY 'If no ball selected, then check if we are over one If (iball = 0) Then For i = 1 To nball dist = Math.SquareRoot((xm-x[i])*(xm-x[i])+(ym-y[i])*(ym-y[i])) If (dist <= radius) Then iball = i 'To change the colour we delete it and replace it with a new ball GraphicsWindow.BrushColor = "Pink" Shapes.Remove(balls[iball]) balls[iball] = Shapes.AddEllipse(2*radius,2*radius) 'We are finished and don't want to continue checking since we have already deleted a ball so end this loop Goto completed1 EndIf EndFor EndIf completed1: 'Move selected ball If (iball > 0) Then ball = balls[iball] x[iball] = xm y[iball] = ym Shapes.Move(ball,x[iball]-radius,y[iball]-radius) EndIf Else 'drop current ball iball = 0 EndIf 'Delete a ball with right click If (Mouse.IsRightButtonDown = "True") Then xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY For i = 1 To nball dist = Math.SquareRoot((xm-x[i])*(xm-x[i])+(ym-y[i])*(ym-y[i])) If (dist <= radius) Then 'Remove the displayed object Shapes.Remove(balls[i]) 'Now remove the array element i - we do this by overwriting it with the balls further up the array For j = i To nball-1 balls[j] = balls[j+1] x[j] = x[j+1] y[j] = y[j+1] EndFor 'Delete the last ball (now moved up the array 1 place) balls[nball] = "" x[nball] = "" y[nball] = "" 'Reduce the count of balls nball = nball-1 'We are finished and don't want to continue checking since we have already deleted a ball so end this loop Goto completed2 EndIf EndFor EndIf completed2: EndWhile ' 'Replace the ball with an image and move with arrow keys for 20 seconds ' 'Delete the last ball and set a new one as a downloaded image - get its radius GraphicsWindow.Clear() image = ImageList.LoadImage("http://www.iconarchive.com/icons/artua/soccer/football-64x64.png") ball = Shapes.AddImage(image) radius = ImageList.GetWidthOfImage(image)/2 'Set variables to say if keys are pressed or not keyLeft = 0 keyRight = 0 keyUp = 0 keyDown = 0 'Start an event for keydown and keyup GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp 'Use the event to set the keypress flags - these are only called when a key is pressed or released Sub OnKeyDown key = GraphicsWindow.LastKey If (key = "Left") Then keyLeft = 1 ElseIf (key = "Right") Then keyRight = 1 ElseIf (key = "Up") Then keyUp = 1 ElseIf (key = "Down") Then keyDown = 1 EndIF EndSub Sub OnKeyUp key = GraphicsWindow.LastKey If (key = "Left") Then keyLeft = 0 ElseIf (key = "Right") Then keyRight = 0 ElseIf (key = "Up") Then keyUp = 0 ElseIf (key = "Down") Then keyDown = 0 EndIF EndSub 'Start in window centre x = gw/2 y = gh/2 start = Clock.Second time = 0 While (time < 20) 'Update position if a key is currently down If (keyLeft = 1) Then x = x-1 EndIf If (keyRight = 1) Then x = x+1 EndIf If (keyUp = 1) Then y = y-1 ' The pixes for the window increase downwards from the top EndIf If (keyDown = 1) Then y = y+1 EndIf 'Check for ball leaving screen - reneter other side If (x < 0) Then x = gw EndIf If (x > gw) Then x = 0 EndIf If (y < 0) Then y = gh EndIf If (y > gh) Then y = 0 EndIf 'Move the ball to the new position Shapes.Move(ball,x-radius,y-radius) 'Put a small delay in - the computer is too quick - this controls the update rate (frames per second) 'This is not the true fps since it doesn't account for the time drawing etc fps = 500 Program.Delay(1000/fps) time = Clock.Second - start 'If we go over the minute then add 60 seconds If (time < 0) Then time = time+60 EndIf EndWhile ' 'Now use the arrow keys to accelerate the ball and run until 50 wall hits (almost the same code) 'We can use the keyboard events unchanged 'Reverse spin the ball when we hit a boundary ' 'Start in window centre x = gw/2 y = gh/2 'Zero initial velocity u = 0 v = 0 start = Clock.Second spin = 0.0 'Ball spin rate (Positive is anticlockwise) angle = 0 hits = 0 While (hits < 50) 'Update position if a key is currently down If (keyLeft = 1) Then u = u-1 EndIf If (keyRight = 1) Then u = u+1 EndIf If (keyUp = 1) Then v = v-1 ' The pixes for the window increase downwards from the top EndIf If (keyDown = 1) Then v = v+1 EndIf 'Update position - divide by 500 to stop the acceleration being too extreme 'we can do gravity, friction etc here if we want x = x+u/500 y = y+v/500 'Check for ball leaving screen - bounce the ball this time - and spin it If (x < radius) Then u = -u spin = spin+v hits = hits+1 EndIf If (x > gw-radius) Then u = -u spin = spin-v hits = hits+1 EndIf If (y < radius) Then v = -v spin = spin-u hits = hits+1 EndIf If (y > gh-radius) Then v = -v spin = spin+u hits = hits+1 EndIf 'Move the ball to the new position Shapes.Move(ball,x-radius,y-radius) 'Rotate the ball with the current spin direction Shapes.Rotate(ball,angle) angle = angle+0.0005*spin 'Put a small delay in - the computer is too quick - this controls the update rate (frames per second) 'This is not the true fps since it doesn't account for the time drawing etc fps = 500 Program.Delay(1000/fps) EndWhile ' 'Create an array of 10 randomly sized and coloured rotating boxes, then delete them when clicked with the mouse ' GraphicsWindow.Clear() 'Create arrays of boxes and their positions and sizes For i = 1 To 10 x[i] = 20+Math.GetRandomNumber(gw-60) ' not too close the the screen edge y[i] = 20+Math.GetRandomNumber(gh-60) w[i] = 10+Math.GetRandomNumber(30) h[i] = 10+Math.GetRandomNumber(30) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.PenColor = "Black" box = Shapes.AddRectangle(w[i],h[i]) 'Note x[i],y[i] are top left of box, not its centre Shapes.Move(box,x[i],y[i]) boxes[i] = box display[i] = 1 ' flag that box is displayed EndFor 'Start a mouse click event GraphicsWindow.MouseDown = OnMouseDown 'Write the mouse click event to get coordinates of mouse click and set a flag that the mouse was clicked clicked = 0 Sub OnMouseDown xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY clicked = 1 EndSub 'Continue while boxes remain nboxes = Array.GetItemCount(boxes) angle = 0 While (nboxes > 0) 'Mouse was clicked If (clicked = 1) Then 'Check each box For i = 1 To Array.GetItemCount(boxes) 'Only look for remaining displayed boxes If (display[i] = 1) Then box = boxes[i] 'Since the boxes are rotating use the maximum size to check for click region 'This is not exactly correct for rotating boxes but often in games efficient is more important than absolute correctness dmax = Math.Max(w[i],h[i]) If (xm >= x[i] And xm <= x[i]+dmax And ym >= y[i] And ym <= y[i]+dmax) Then 'Delete this box from display and reduce the box count by 1 'Note the original arrays are not deleted since we are keeping track of box status using display[i] Shapes.Remove(box) nboxes = nboxes-1 display[i] = 0 Sound.PlayClick() EndIf EndIf EndFor 'Reset clicked flag to off since we have done everything with it clicked = 0 EndIf 'Rotate the boxes (even i anticlockwise, odd i clockwise - negative angle) For i = 1 To Array.GetItemCount(boxes) If (display[i] = 1) Then box = boxes[i] Shapes.Rotate(box,angle*(1-2*Math.Remainder(i,2))) EndIf EndFor angle = angle+1 Program.Delay(10) ' Small delay to keep the rotation smooth EndWhile ' 'Finish up ' image = ImageList.LoadImage("http://smallbasic.com/smallbasic.com/doc/img/smallbasic_32.png") GraphicsWindow.Clear() GraphicsWindow.FontSize = 100 GraphicsWindow.FontBold = "True" GraphicsWindow.FontName = "Rockwell" GraphicsWindow.DrawResizedImage(image,0,0,gw,gh) R = 255 G = 0 B = 0 dR = -1 dG = 2 dB = 3 clicked = 0 While (clicked = 0) 'Change the red, green, blue components of the colour at different rates to get changing colours If (R < 0 Or R > 255) Then dR = -dR R = R+dR EndIf If (G < 0 Or G > 255) Then dG = -dG G = G+dG EndIf If (B < 0 Or B > 255) Then dB = -dB B = B+dB EndIf colour = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.BrushColor = colour GraphicsWindow.DrawText(200,160,"All Done") GraphicsWindow.DrawText(100,340,"Click to Exit") GraphicsWindow.PenWidth = 10 GraphicsWindow.PenColor = colour GraphicsWindow.DrawLine(50,gh-50,gw-50,gh-50) GraphicsWindow.DrawLine(gw-50,gh-50,gw-50,50) GraphicsWindow.DrawLine(gw-50,50,50,50) GraphicsWindow.DrawLine(50,50,50,gh-50) R = R+dR G = G+dG B = B+dB Program.Delay(20) EndWhile Program.End() End>VKB520.sb< Start>VKC687.sb< InitWindow() While 1=1 InitHands() Sound.PlayClick() Program.Delay(1000) EndWhile Sub InitWindow GraphicsWindow.Show() GraphicsWindow.Title = "Analog Clock" GraphicsWindow.BackgroundColor = "Black" GW = GraphicsWindow.Width GH = GraphicsWindow.Height Radius = 200 MidX = GW/2 MidY = GH/2 GraphicsWindow.BrushColor = "BurlyWood" GraphicsWindow.DrawEllipse(MidX-Radius-15,MidY-Radius-5,Radius*2+30,Radius*2+20) GraphicsWindow.FillEllipse(MidX-Radius-15,MidY-Radius-5,Radius*2+30,Radius*2+20) For Angle = 1 To 180 X = MidX+(Radius+15)*Math.Cos(Math.GetRadians(Angle)) Y1 = MidY+Radius*Math.Sin(Math.GetRadians(Angle))+15 Y2 = MidY+(Radius+15)*Math.Sin(Math.GetRadians(-Angle))+10 Blue = Math.GetRandomNumber(40)+30 GraphicsWindow.PenWidth = Math.GetRandomNumber(5) GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(Blue+100+Math.GetRandomNumber(10),Blue+60+Math.GetRandomNumber(20),Blue) Shapes.AddLine(X,Y1,X,Y2) EndFor GraphicsWindow.BrushColor = "White" For i = 1 To 12 Radians = Math.GetRadians(-i * 30 + 90) ClockNum[i] = Shapes.AddText(i) Shapes.Move(ClockNum[i],MidX-4+Radius*Math.Cos(Radians),MidY-4-Radius*Math.Sin(Radians)) EndFor EndSub Sub InitHands If Clock.Hour + Clock.Minute/60 + Clock.Second/3600 <> Hour Then Shapes.Remove(HourHand) Hour = Clock.Hour + Clock.Minute/60 + Clock.Second/3600 GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 3 HourHand = Shapes.AddLine(MidX,MidY,MidX+Radius/2*Math.Cos(Math.GetRadians(Hour*30-90)),MidY+Radius/2*Math.Sin(Math.GetRadians(Hour*30-90))) EndIf If Clock.Minute <> Minute Then Shapes.Remove(MinuteHand) Minute = Clock.Minute + Clock.Second/60 GraphicsWindow.PenColor = "Blue" GraphicsWindow.PenWidth = 2 MinuteHand = Shapes.AddLine(MidX,MidY,MidX+Radius/1.2*Math.Cos(Math.GetRadians(Minute*6-90)),MidY+Radius/1.2*Math.Sin(Math.GetRadians(Minute*6-90))) EndIf If Clock.Second <> Second Then Shapes.Remove(SecondHand) Second = Clock.Second GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 1 SecondHand = Shapes.AddLine(MidX,MidY,MidX+Radius*Math.Cos(Math.GetRadians(Second*6-90)),MidY+Radius*Math.Sin(Math.GetRadians(Second*6-90))) EndIf EndSub End>VKC687.sb< Start>VKF833.sb< dw=900 dh=900 args=0 grr=1.61803398875 fff=137.508 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 fib=0 For g=1 To 5 Step 2 For x=2 To 256*2-1 'check for prime number flag=0 if ESLMaths.Primality(x) then angle=fib fib=fib+fff c="" a=x vv[x]=0.1 'height and width move=10 width =100 For n=1 To 9 b=Math.Remainder(a,2) If b = 1 Then c=c+"L" else c=c+"R" endif a=Math.Floor(a/2) EndFor T_X=dw/2 T_y=dh/2 For n=5 To 1 Step -1 For v=1 To 19 vv[x]=vv[x]*1.03 GraphicsWindow.PenWidth=width GraphicsWindow.brushColor=LDColours.HSLtoRGB (10+x/10,1,vv[x]) GraphicsWindow.FillEllipse(t_x-width/2,t_y-width/2,width,width) ldcall.Function("t_Move",move) d = Text.GetSubText(c, n, 1) If d="R" Then 'angle of branches angle=angle-g T_Angle=angle Else angle=angle+g T_Angle=angle EndIf if width>2 then width = width*0.96 EndIf EndFor move = move/grr EndFor T_Angle=0 endif endfor EndFor sub t_Move ds=args[1] mm=LDMath.Convert2Cartesian (t_x,t_y,ds, t_Angle-90 ) t_x= (mm[1]) t_y= (mm[2]) EndSub End>VKF833.sb< Start>VKJ260-0.sb< Stack.PushValue("a", "a0") Stack.PushValue("c", "c0") Stack.PushValue("b", "b0") Stack.PushValue("ad", "0") Stack.PushValue("cd", "0") Stack.PushValue("bd", "0") '--------------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.Show() GraphicsWindow.CanResize = 0 GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.PenColor = "DarkSlateGray" GraphicsWindow.PenWidth = 10 GraphicsWindow.Title = "Game 'Tower of Hanoi. Question of Tonkin.'" Path = "http://www.ac-acap.org/images/Hanoy/" background = ImageList.LoadImage(Path + "fon.jpg") GraphicsWindow.DrawImage(background, 0, 0) '--------------------------------------------------------------------------------------------------------------------------------- disk = 0 GraphicsWindow.DrawLine(200, 600, 200, 400) GraphicsWindow.DrawLine(400, 600, 400, 400) GraphicsWindow.DrawLine(600, 600, 600, 400) '--------------------------------------------------------------------------------------------------------------------------------- For i = 8 To 1 Step -1 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() a[i] = Shapes.AddEllipse(20+20*i, 20) Shapes.Move(a[i], 190-10*i, 420+20*i) Stack.PushValue("a", a[i]) Stack.PushValue("ad", i) EndFor '--------------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.ShowMessage("The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the puzzle is to move the entire stack to another rod, obeying the following rules: Only one disk may be moved at a time. Each move consists of taking the upper disk from one of the rods and sliding it onto another rod, on top of the other disks that may already be present on that rod. No disk may be placed on top of a smaller disk.", "RULES") Sound.PlayChime() GraphicsWindow.MouseDown = Down GraphicsWindow.MouseMove = Move GraphicsWindow.MouseUp = Up '--------------------------------------------------------------------------------------------------------------------------------- Sub Down If Mouse.IsLeftButtonDown = "true" And Mouse.IsRightButtonDown <> "true" Then If Stack.GetCount("a") > 1 Then If GraphicsWindow.MouseX >= 0 And GraphicsWindow.MouseX < 300 Then s = 1 disk = Stack.PopValue("a") nomer = Stack.PopValue("ad") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf If Stack.GetCount("c") > 1 Then If GraphicsWindow.MouseX >= 300 And GraphicsWindow.MouseX <= 500 Then s = 2 disk = Stack.PopValue("c") nomer = Stack.PopValue("cd") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf If Stack.GetCount("b") > 1 Then If GraphicsWindow.MouseX > 500 And GraphicsWindow.MouseX <= 800 Then s = 3 disk = Stack.PopValue("b") nomer = Stack.PopValue("bd") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf EndIf EndSub '--------------------------------------------------------------------------------------------------------------------------------- Sub Move Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndSub '--------------------------------------------------------------------------------------------------------------------------------- Sub Up If disk <> 0 Then If GraphicsWindow.MouseX >= 0 And GraphicsWindow.MouseX < 300 Then If Stack.GetCount("ad") = 1 Then Sound.PlayChimes() Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("ad") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("ad", prov) Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("ad", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If GraphicsWindow.MouseX >= 300 And GraphicsWindow.MouseX <= 500 Then If Stack.GetCount("cd") = 1 Then Sound.PlayChimes() Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("cd") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("cd", prov) Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("cd", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If GraphicsWindow.MouseX > 500 And GraphicsWindow.MouseX <= 800 Then If Stack.GetCount("bd") = 1 Then Sound.PlayChimes() Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("bd") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("bd", prov) Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("bd", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If Stack.GetCount("b") = 9 Then GraphicsWindow.ShowMessage("Congratulation! You Win!" "Victory!") EndIf EndIf EndSub End>VKJ260-0.sb< Start>VKJ260-1.sb< Stack.PushValue("a", "a0") Stack.PushValue("c", "c0") Stack.PushValue("b", "b0") Stack.PushValue("ad", "0") Stack.PushValue("cd", "0") Stack.PushValue("bd", "0") '--------------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.Show() GraphicsWindow.CanResize = 0 GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.PenColor = "DarkSlateGray" GraphicsWindow.PenWidth = 10 GraphicsWindow.Title = "Game 'Tower of Hanoi. Question of Tonkin.'" Path = "http://www.ac-acap.org/images/Hanoy/" background = ImageList.LoadImage(Path + "fon.jpg") GraphicsWindow.DrawImage(background, 0, 0) '--------------------------------------------------------------------------------------------------------------------------------- disk = 0 GraphicsWindow.DrawLine(200, 600, 200, 400) GraphicsWindow.DrawLine(400, 600, 400, 400) GraphicsWindow.DrawLine(600, 600, 600, 400) '--------------------------------------------------------------------------------------------------------------------------------- For i = 8 To 1 Step -1 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() a[i] = Shapes.AddEllipse(20+20*i, 20) Shapes.Move(a[i], 190-10*i, 420+20*i) Stack.PushValue("a", a[i]) Stack.PushValue("ad", i) EndFor '--------------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.ShowMessage("The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the puzzle is to move the entire stack to another rod, obeying the following rules: Only one disk may be moved at a time. Each move consists of taking the upper disk from one of the rods and sliding it onto another rod, on top of the other disks that may already be present on that rod. No disk may be placed on top of a smaller disk.", "RULES") Sound.PlayChime() GraphicsWindow.MouseDown = Down GraphicsWindow.MouseMove = Move GraphicsWindow.MouseUp = Up '--------------------------------------------------------------------------------------------------------------------------------- Sub Down If Mouse.IsLeftButtonDown = "true" And Mouse.IsRightButtonDown <> "true" Then If Stack.GetCount("a") > 1 Then If GraphicsWindow.MouseX >= 0 And GraphicsWindow.MouseX < 300 Then s = 1 disk = Stack.PopValue("a") nomer = Stack.PopValue("ad") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf If Stack.GetCount("c") > 1 Then If GraphicsWindow.MouseX >= 300 And GraphicsWindow.MouseX <= 500 Then s = 2 disk = Stack.PopValue("c") nomer = Stack.PopValue("cd") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf If Stack.GetCount("b") > 1 Then If GraphicsWindow.MouseX > 500 And GraphicsWindow.MouseX <= 800 Then s = 3 disk = Stack.PopValue("b") nomer = Stack.PopValue("bd") Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndIf EndIf EndIf EndSub '--------------------------------------------------------------------------------------------------------------------------------- Sub Move Shapes.Move(disk, GraphicsWindow.MouseX, GraphicsWindow.MouseY) EndSub '--------------------------------------------------------------------------------------------------------------------------------- Sub Up If disk <> 0 Then If GraphicsWindow.MouseX >= 0 And GraphicsWindow.MouseX < 300 Then If Stack.GetCount("ad") = 1 Then Sound.PlayChimes() Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("ad") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("ad", prov) Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("ad", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If GraphicsWindow.MouseX >= 300 And GraphicsWindow.MouseX <= 500 Then If Stack.GetCount("cd") = 1 Then Sound.PlayChimes() Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("cd") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("cd", prov) Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("cd", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If GraphicsWindow.MouseX > 500 And GraphicsWindow.MouseX <= 800 Then If Stack.GetCount("bd") = 1 Then Sound.PlayChimes() Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) disk = 0 nomer = 0 Else prov = Stack.PopValue("bd") If prov > nomer Then Sound.PlayChimes() Stack.PushValue("bd", prov) Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) disk = 0 nomer = 0 Else Sound.PlayBellRing() GraphicsWindow.ShowMessage("Так ходить нельзя", "Ошибка") If s = 1 Then Stack.PushValue("a", disk) Stack.PushValue("ad", nomer) Shapes.Move(disk, 190-10*nomer, 620-Stack.GetCount("a")*20) ElseIf s = 2 Then Stack.PushValue("c", disk) Stack.PushValue("cd", nomer) Shapes.Move(disk, 390-10*nomer, 620-Stack.GetCount("c")*20) ElseIf s = 3 Then Stack.PushValue("b", disk) Stack.PushValue("bd", nomer) Shapes.Move(disk, 590-10*nomer, 620-Stack.GetCount("b")*20) EndIf Stack.PushValue("bd", prov) disk = 0 nomer = 0 EndIf EndIf EndIf If Stack.GetCount("b") = 9 Then GraphicsWindow.ShowMessage("Congratulation! You Win!" "Victory!") EndIf EndIf EndSub End>VKJ260-1.sb< Start>VKK996.sb< ' Shooting at flying bee Init_View() Get_Player() GraphicsWindow.KeyDown=Move_Player Timer.Tick=Ontick Timer.Interval= 500 Sub Move_Player a=text.GetCharacterCode(GraphicsWindow.LastKey) If a=76 or a=82 Then ' Left;76 Right ;82 rotate() elseIf a=68 or a=85 Then ' Down: 68 Up: 85 FB_Move() elseif a=83 then ' Space;83 SN=SN+1 shoot() endif EndSub Sub Rotate ' rotate facing direction SN=0 DR=(a-79)/3 ' +1 or -1 Rdeg=Rdeg+DR Shapes.Rotate(spd,Rdeg) Endsub Sub FB_Move 'Forward/ Backward Moving SN=0 DXY=(a-76.5)/8.5 'DXY=-1 or +1 ddx=ddx+DXY*math.sin(Rdeg/180*Math.pi) ddy=ddy-DXY*math.cos(Rdeg/180*Math.pi) nextx=startx+ddX-28 ' shift x nexty=starty+ddY-30 ' shift y Shapes.animate(spd,nextx,nexty,400) EndSub Sub shoot ' missile shooting mis_time1[SN]=Clock.ElapsedMilliseconds ' shooted time Shapes.ShowShape(mis[SN]) Shapes.Move(mis[SN],nextx,nexty) ' shooting start position ' Length from Bee to Stag beetle L2=math.SquareRoot((Beex-nextx)*(Beex-nextx)+(Beey-nexty)*(Beey-nexty)) mis_EndX=nextX+L2*(Math.sin(Rdeg/180*Math.pi)) ' target point X mis_EndY=nextY-L2*(Math.cos(Rdeg/180*Math.pi)) ' target point Y Shapes.Animate(mis[SN],mis_EndX,mis_EndY,800) EndSub Sub Init_View GW=800 GH=700 XC=math.Round(GW/2+0.5) YC=math.Round(GH/2+0.5) GraphicsWindow.Left=100 GraphicsWindow.Top=0 GraphicsWindow.Width=GW GraphicsWindow.Height=GH GraphicsWindow.BackgroundColor="#8D61B463" GraphicsWindow.Show() ' show fruits BackWall=ImageList.LoadImage ("http://park18.wakwak.com/~osyare/fruits/all-fruits2.gif") GraphicsWindow.DrawImage(BackWall,XC/2,YC) ' show message GraphicsWindow.BrushColor="Yellow" GraphicsWindow.FontSize=20 msg1=Shapes.AddText(" Foward/Backward: Up/down arrow ") Shapes.Move(msg1,20,5) msg2=Shapes.AddText("Face rotation: Left/right arrow , Shooting: space key") Shapes.Move(msg2,20,25) Endsub Sub Get_Player L1=math.Round(GH/2-50+0.5) ' distance startx=XC startY=YC+L1 ' spider or Stag beetle 'Path="http://www.azbugman.com/images/spider.png" Spider : too big Path="http://park18.wakwak.com/~osyare/musi2/kuwagata-f.png" player=ImageList.LoadImage(Path) spd=shapes.AddImage(player) Shapes.Animate(spd,startx-28,starty-30,900) ' center shift ' bee Path2=" http://park18.wakwak.com/~osyare/musi2/hati-js.png" bee=ImageList.LoadImage(Path2) bee1=shapes.AddImage(bee) beex=XC beey=YC-150 Shapes.animate(bee1,XC,YC,750) ' shooting missile GraphicsWindow.BrushColor="Yellow" For i= 1 To 100 GraphicsWindow.PenColor="Yellow" mis[i]=shapes.AddEllipse(15,15) Shapes.HideShape(mis[i]) endfor EndSub Sub ontick ' delete missile if time is over 800-milliseconds For i=1 To 100 mis_time2[i]=Clock.ElapsedMilliseconds If mis_time2[i]-mis_time1[i]>800 then Shapes.HideShape(mis[i]) EndIf EndFor ' random moving of Bee PM=(10-Math.GetRandomNumber(20))/10 R_Rad=Math.GetRandomNumber(90)/180*Math.pi BeeX=nextX+PM*GW/2*math.sin(R_Rad) BeeY=nextY-GH*math.cos(R_Rad) If BeeX<0 then BeeX=XC/2 If GWVKK996.sb< Start>VKP168.sb< '---------------------------------------------------------------------------------------------------------------------- ' Microtronix - Solar System Simulator for MS Small Basic v0.7 ' by Geoff Williams - 4/11/2009 - Freeware ' This graphic demo appears in my music video "Haunted House" at www.youtube.com/zylascope ' www.cdbaby.com/all/zylascope ' plethora at nsw.chariot.net dot au '---------------------------------------------------------------------------------------------------------------------- GraphicsWindow.Width=1300 GraphicsWindow.Height=750 GraphicsWindow.BackgroundColor="black" GraphicsWindow.Title="Microtronix - Solar System Simulator" GraphicsWindow.Show() x=GraphicsWindow.Width/2 y=GraphicsWindow.Height/2 While (1=1) numOfPlanets=Math.GetRandomNumber(9) delay=Math.GetRandomNumber(100)+50 GraphicsWindow.BrushColor="white" GraphicsWindow.Clear() GraphicsWindow.DrawText((GraphicsWindow.Width/2)-30,20,numOfPlanets + " planet system.") 'generate planets properties using random values... For i=1 To numOfPlanets Array.setvalue ("planetRadius",i,Math.GetRandomNumber(600)+30) Array.setvalue("planetAngle",i,Math.GetRandomNumber(360)) Array.setvalue("planetAngleInc",i,math.GetRandomNumber(3) + 1) Array.setvalue("planetSize",i,Math.GetRandomNumber(90)+10) Array.setvalue("planetColor",i,GraphicsWindow.GetColorFromRGB(Math.GetRandomNumber(255),Math.GetRandomNumber(255),Math.GetRandomNumber(255))) EndFor For loops=1 To 400 'draw the sun first before the planets are drawn so it looks like the planets are in front of the sun, when the planet size is big GraphicsWindow.BrushColor="yellow" GraphicsWindow.FillEllipse(x,y,80,80) For z=1 To numOfPlanets 'calc planet size based on angle... 'make planet smaller if between 90-270 degrees If Array.getvalue("planetAngle",z) > 90 And Array.getvalue("planetAngle",z) < 270 Then planetsize = math.Round(Array.getvalue("planetSize",z) * math.Abs(Array.getvalue("planetAngle",z) - 180) / 100) If planetsize = 0 Then planetsize = 1 EndIf EndIf 'make planet bigger if between 270-360 1-90 degrees' If Array.getvalue("planetAngle",z) > 270 And Array.getvalue("planetAngle",z) <= 360 Then planetsize = Math.Round(Array.getvalue("planetSize",z) * (1 + (Array.getvalue("planetAngle",z) - 270) / 100)) ' If planetsize = 0 Then planetsize = 1 EndIf EndIf 'make planet bigger if between 1-90 degrees If Array.getvalue("planetAngle",z) > 0 And Array.getvalue("planetAngle",z) <= 90 Then planetsize= Math.Round(Array.getvalue("planetSize",z) * (1 + (90 - Array.getvalue("planetAngle",z)) / 100)) If planetsize = 0 Then planetsize = 1 EndIf EndIf 'draw planets... GraphicsWindow.BrushColor=Array.getvalue("planetColor",z) GraphicsWindow.FillEllipse(x+Array.getvalue("planetRadius",z)*Math.Sin(math.GetRadians(Array.getvalue("planetAngle",z))),y+Array.getvalue("planetRadius",z)*math.Cos(math.GetRadians(Array.getvalue("planetAngle",z)))*.2,planetsize,planetsize) 'calc new values... Array.setvalue("planetAngle",z,Array.getvalue("planetAngle",z) + Array.getvalue("planetAngleInc",z)) If Array.getvalue("planetAngle",z) < 0 Then Array.setvalue("planetAngle",z,Array.getvalue("planetAngle",z) + 360) EndIf If Array.getvalue("planetAngle",z) > 360 Then Array.setvalue("planetAngle",z,Array.getvalue("planetAngle",z) - 360) EndIf EndFor Program.Delay(delay) 'For t=1 to 5000 'delay loop. If I use program.delay(delay) above, then the graphics don't flicker as much 'EndFor 'GraphicsWindow.Clear() 'draw a black filled rectangle over the screen area taken up by the orbiting planets, this flickers less than .Clear() GraphicsWindow.BrushColor="black" GraphicsWindow.FillRectangle(0,250,1300,450) EndFor Endwhile End>VKP168.sb< Start>VKV510.sb< 'Stephen Salah 'Tic Tac Toe GraphicsWindow.KeyUp = OnKeyUp GraphicsWindow.MouseDown = OnMouseDown Sub ComputerFullturn If PVP<>"Y" then ComputerTurn() TakeTurn() EndIf EndSub Sub ComputerTurn Empty = 0 For i= 1 To 9 If Board[i]="" Then Empty=Empty+1 EndIf EndFor 'take a corner If Empty=9 Then move=1 ElseIf Empty=7 then 'opposite corner or random If Board[9]="" then move=9 Else move=7 EndIf elseif Empty=5 then 'If you can win then win If Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 elseIf Board[1]=Board[2] and Board[1]="O" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="O" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="O" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="O" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="O" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="O" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="O" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="O" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="O" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="O" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="O" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="O" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="O" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="O" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="O" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="O" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="O" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="O" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="O" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="O" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="O" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="O" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="O" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="O" and Board[5]=""then move=5 elseif Board[7]="" then move=7 elseif Board[3]="" then move=3 elseIf Board[1]=Board[2] and Board[1]="O" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="O" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="O" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="O" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="O" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="O" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="O" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="O" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="O" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="O" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="O" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="O" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="O" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="O" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="O" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="O" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="O" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="O" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="O" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="O" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="O" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="O" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="O" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="O" and Board[5]=""then move=5 elseif Board[7]="" then move=7 elseif Board[3]="" then move=3 EndIf elseif Empty=3 then If Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 elseif Board[7]="" then move=7 elseif Board[3]="" then move=3 EndIf If Board[1]=Board[2] and Board[1]="O" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="O" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="O" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="O" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="O" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="O" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="O" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="O" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="O" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="O" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="O" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="O" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="O" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="O" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="O" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="O" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="O" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="O" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="O" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="O" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="O" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="O" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="O" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="O" and Board[5]=""then move=5 elseif Board[7]="" then move=7 elseif Board[3]="" then move=3 EndIf elseif Empty=1 then For i=1 to 9 If Board[i]="" then move=i EndIf endfor empty=0 'Come back HEre elseif Empty=8 then If Board[5]="" then move=5 TookMiddle="Y" else move=7 EndIf elseif Empty=6 then If TookMiddle="Y" then If Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 elseif Board[4]="" then move=4 elseif Board[6]="" then move=6 EndIf elseif TookMiddle<>"Y" then If Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 EndIf EndIf elseif Empty=4 then If Board[1]=Board[2] and Board[1]="O" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="O" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="O" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="O" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="O" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="O" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="O" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="O" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="O" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="O" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="O" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="O" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="O" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="O" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="O" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="O" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="O" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="O" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="O" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="O" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="O" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="O" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="O" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="O" and Board[5]=""then move=5 elseIf Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 elseif Board[1]="" then move=1 elseif Board[3]="" then move=3 elseif Board[7]="" then move=7 elseif Board[9]="" then move=9 EndIf elseif Empty=2 then If Board[1]=Board[2] and Board[1]="O" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="O" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="O" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="O" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="O" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="O" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="O" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="O" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="O" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="O" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="O" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="O" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="O" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="O" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="O" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="O" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="O" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="O" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="O" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="O" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="O" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="O" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="O" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="O" and Board[5]=""then move=5 elseIf Board[1]=Board[2] and Board[1]="X" and Board[3]=""then move=3 elseif Board[2]=Board[3] and Board[3]="X" and Board[1]=""then move=1 elseif Board[1]=Board[3] and Board[3]="X" and Board[2]=""then move=2 elseif Board[4]=Board[5] and Board[4]="X" and Board[6]=""then move=6 elseif Board[4]=Board[6] and Board[4]="X" and Board[5]=""then move=5 elseif Board[5]=Board[6] and Board[5]="X" and Board[4]=""then move=4 elseif Board[7]=Board[8] and Board[7]="X" and Board[9]=""then move=9 elseif Board[7]=Board[9] and Board[7]="X" and Board[8]=""then move=8 elseif Board[8]=Board[9] and Board[9]="X" and Board[7]=""then move=7 elseif Board[1]=Board[4] and Board[4]="X" and Board[7]=""then move=7 elseif Board[1]=Board[7] and Board[7]="X" and Board[4]=""then move=4 elseif Board[4]=Board[7] and Board[7]="X" and Board[1]=""then move=1 elseif Board[2]=Board[5] and Board[2]="X" and Board[8]=""then move=8 elseif Board[2]=Board[8] and Board[2]="X" and Board[5]=""then move=5 elseif Board[5]=Board[8] and Board[5]="X" and Board[2]=""then move=2 elseif Board[9]=Board[6] and Board[6]="X" and Board[3]=""then move=3 elseif Board[9]=Board[3] and Board[3]="X" and Board[6]=""then move=6 elseif Board[6]=Board[3] and Board[6]="X" and Board[9]=""then move=9 elseif Board[9]=Board[5] and Board[5]="X" and Board[1]=""then move=1 elseif Board[9]=Board[1] and Board[1]="X" and Board[5]=""then move=5 elseif Board[5]=Board[1] and Board[1]="X" and Board[9]=""then move=9 elseif Board[7]=Board[5] and Board[5]="X" and Board[3]=""then move=3 elseif Board[5]=Board[3] and Board[3]="X" and Board[7]=""then move=7 elseif Board[7]=Board[3] and Board[3]="X" and Board[5]=""then move=5 elseif Board[1]="" then move=1 elseif Board[3]="" then move=3 elseif Board[7]="" then move=7 elseif Board[9]="" then move=9 endif elseif empty=0 then endif EndSub Sub DrawBoard GraphicsWindow.Clear() For i = 1 To 9 Board[i] = "" EndFor Empty = 0 For i= 1 To 9 If Board[i]="" Then Empty=Empty+1 EndIf EndFor GraphicsWindow.BrushColor="Black" GraphicsWindow.PenWidth=2 GraphicsWindow.DrawLine(200,1,200,600) GraphicsWindow.DrawLine(400,1,400,600) GraphicsWindow.DrawLine(1,200,600,200) GraphicsWindow.DrawLine(1,400,600,400) GraphicsWindow.DrawLine(1,600,600,600) If Win="O" Then Turn="O" ElseIf Win="X" then Turn="X" EndIf Win="" EndSub Sub TakeTurn If turn="O" Then DrawO() Turn="X" ElseIf turn= "X" then DrawX() Turn="O" EndIf CheckForWin() EndSub Sub CheckForWin If Board[1] = Board[2] And Board[2] = Board[3] and Board[1]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,500,600,500) ElseIf Board[4] = Board[5] And Board[5] = Board[6] and Board[4]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,300,600,300) ElseIf Board[7] = Board[8] And Board[8] = Board[9] and Board[7]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,100,600,100) ElseIf Board[7] = Board[4] And Board[4] = Board[1] and Board[1]="O" then Win="O" GraphicsWindow.DrawLine(100,1,100,600) ElseIf Board[8] = Board[5] And Board[5] = Board[2] and Board[2]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(300,1,300,600) ElseIf Board[9] = Board[6] And Board[6] = Board[3] and Board[3]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(500,1,500,600) ElseIf Board[9] = Board[5] And Board[5] = Board[1] and Board[1]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(600,1,1,600) ElseIf Board[7] = Board[5] And Board[5] = Board[3] and Board[3]="O" then Win="O" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,1,600,600) EndIf If Board[1] = Board[2] And Board[2] = Board[3] and Board[1]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,500,600,500) ElseIf Board[4] = Board[5] And Board[5] = Board[6] and Board[4]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,300,600,300) ElseIf Board[7] = Board[8] And Board[8] = Board[9] and Board[7]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,100,600,100) ElseIf Board[7] = Board[4] And Board[4] = Board[1] and Board[1]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(100,1,100,600) ElseIf Board[8] = Board[5] And Board[5] = Board[2] and Board[2]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(300,1,300,600) ElseIf Board[9] = Board[6] And Board[6] = Board[3] and Board[3]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(500,1,500,600) ElseIf Board[9] = Board[5] And Board[5] = Board[1] and Board[1]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(600,1,1,600) ElseIf Board[7] = Board[5] And Board[5] = Board[3] and Board[3]="X" then Win="X" GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(1,1,600,600) EndIf empty=0 For i= 1 To 9 If Board[i]="" Then Empty=Empty+1 EndIf EndFor If Empty=0 And Win<>"X" And Win<>"O" Then GraphicsWindow.PenColor="black" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawEllipse(1,1,600,600) Win="T" EndIf if Win<>"" Then GraphicsWindow.BrushColor="red" GraphicsWindow.FillRectangle(500,605,100,45) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(505,610,"Continue?") EndIf EndSub Sub OnMouseDown x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If Screen="Play" Then If Win="" Then If x>=1 and x<=200 and y>=1 and y<= 200 and Board[7] = "" Then Move=7 ElseIf x>=200 and x<=400 and y>=1 and y<= 200 and Board[8] = "" Then Move=8 ElseIf x>=400 and x<=600 and y>=1 and y<= 200 and Board[9] = "" Then Move=9 ElseIf x>=1 and x<=200 and y>=200 and y<= 400 and Board[4] = "" Then Move=4 ElseIf x>=200 and x<=400 and y>=200 and y<= 400 and Board[5] = "" Then Move=5 ElseIf x>=400 and x<=600 and y>=200 and y<= 400 and Board[6] = "" Then Move=6 ElseIf x>=1 and x<=200 and y>=400 and y<= 600 and Board[1] = "" Then Move=1 ElseIf x>=200 and x<=400 and y>=400 and y<= 600 and Board[2] = "" Then Move=2 ElseIf x>=400 and x<=600 and y>=400 and y<= 600 and Board[3] = "" Then Move=3 Else Move=0 EndIf If Move=0 then Else TakeTurn() ComputerFullturn() EndIf ElseIf x>=500 and x<=600 and y>=600 and y<= 650 and Win <> "" Then DrawBoard() If Turn="O" Then ComputerFullturn() EndIf EndIf ElseIf Screen="Menu" then If x>=100 and x<=200 and y>=600 and y<= 650 Then Screen="Play" DrawBoard() PVP="Y" elseif x>=300 and x<=400 and y>=600 and y<= 650 Then Screen="Play" DrawBoard() ComputerFullturn() EndIf EndIf EndSub Sub DrawO GraphicsWindow.PenColor="blue" If move=1 And Board[1]="" Then GraphicsWindow.DrawEllipse(10,410,180,180) Board[1] = "O" ElseIf move=2 And Board[2]="" then GraphicsWindow.DrawEllipse(210,410,180,180) Board[2] = "O" ElseIf move=3 And Board[3]="" then GraphicsWindow.DrawEllipse(410,410,180,180) Board[3] = "O" ElseIf move=4 And Board[4]="" then GraphicsWindow.DrawEllipse(10,210,180,180) Board[4] = "O" ElseIf move=5 And Board[5]="" then GraphicsWindow.DrawEllipse(210,210,180,180) Board[5] = "O" elseIf move=6 And Board[6]="" then GraphicsWindow.DrawEllipse(410,210,180,180) Board[6] = "O" ElseIf move=7 And Board[7]="" then GraphicsWindow.DrawEllipse(10,10,180,180) Board[7] = "O" ElseIf move=8 And Board[8]="" then GraphicsWindow.DrawEllipse(210,10,180,180) Board[8] = "O" ElseIf move=9 And Board[9]="" then GraphicsWindow.DrawEllipse(410,10,180,180) Board[9] = "O" EndIf EndSub Sub DrawX GraphicsWindow.PenColor="red" If move=1 And Board[1]="" Then GraphicsWindow.DrawLine(10,410,190,590) GraphicsWindow.DrawLine(190,410,10,590) Board[1] = "X" ElseIf move=2 And Board[2]="" then GraphicsWindow.DrawLine(210,410,390,590) GraphicsWindow.DrawLine(390,410,210,590) Board[2] = "X" ElseIf move=3 And Board[3]="" then GraphicsWindow.DrawLine(410,410,590,590) GraphicsWindow.DrawLine(590,410,410,590) Board[3] = "X" ElseIf move=4 And Board[4]="" then GraphicsWindow.DrawLine(10,210,190,390) GraphicsWindow.DrawLine(190,210,10,390) Board[4] = "X" ElseIf move=5 And Board[5]="" then GraphicsWindow.DrawLine(210,210,390,390) GraphicsWindow.DrawLine(390,210,210,390) Board[5] = "X" ElseIf move=6 And Board[6]="" then GraphicsWindow.DrawLine(410,210,590,390) GraphicsWindow.DrawLine(590,210,410,390) Board[6] = "X" ElseIf move=7 And Board[7]="" then GraphicsWindow.DrawLine(10,10,190,190) GraphicsWindow.DrawLine(190,10,10,190) Board[7] = "X" ElseIf move=8 And Board[8]="" then GraphicsWindow.DrawLine(210,10,390,190) GraphicsWindow.DrawLine(390,10,210,190) Board[8] = "X" ElseIf move=9 And Board[9]="" then GraphicsWindow.DrawLine(410,10,590,190) GraphicsWindow.DrawLine(590,10,410,190) Board[9] = "X" EndIf EndSub Sub OnKeyUp pressed = GraphicsWindow.LastKey LOS=Text.GetLength(pressed) End=Text.GetSubTextToEnd(pressed,LOS) If Win="" Then If (End = 1 or pressed="End" or pressed="Z") and Board[1] = "" Then move=1 ElseIf (End = 2 or pressed="Down" or pressed="X") and Board[2] = "" then move=2 ElseIf (End = 3 or pressed="Next" or pressed="C") and Board[3] = "" then move=3 ElseIf (End = 4 or pressed="Left" or pressed="A") and Board[4] = "" then move=4 ElseIf (End = 5 or pressed="Clear" or pressed="S") and Board[5] = "" then move=5 ElseIf (End = 6 or pressed="Right" or pressed="D") and Board[6] = "" then move=6 ElseIf (End = 7 or pressed="Home" or pressed="Q") and Board[7] = "" then move=7 ElseIf (End = 8 or pressed="Up" or pressed="W") and Board[8] = "" then move=8 ElseIf (End = 9 or pressed="PageUp" or pressed="E") and Board[9] = "" then move=9 Else Move=0 EndIf If Move=0 then Else ComputerFullturn() TakeTurn() EndIf EndIf EndSub GraphicsWindow.Width = 600 GraphicsWindow.Height = 650 GraphicsWindow.Top=25 'OnKeyDown 'Draw Board using 4 lines Win="" Screen="Menu" Turn="O" DrawBoard() GraphicsWindow.BrushColor="Red" GraphicsWindow.FillRectangle(100,600,100,50) GraphicsWindow.FillRectangle(300,600,100,50) GraphicsWindow.BrushColor="black" GraphicsWindow.DrawText(110,610,"P vs P") GraphicsWindow.DrawText(310,610,"P v C") End>VKV510.sb< Start>VKX413.sb< pi=ldtext.Split ("31 41 5 9 26 5 35 8" " ") SQ=ldtext.Split ("22 47 16 41 10 35 4 5 23 48 17 42 11 29 30 6 24 49 18 36 12 13 31 7 25 43 19 37 38 14 32 1 26 44 20 21 39 8 33 2 27 45 46 15 40 9 34 3 28" " ") nnp=ldtext.Split ("1 9 15 21 25 27 33 35 39 45 49" " ") GraphicsWindow.BrushColor="black GraphicsWindow.FontSize=20 GraphicsWindow.FontName="calibri GraphicsWindow.FontBold="false i=1 j=1 For y=0 To 8 for x=1 To 8 If y=0 And x<8 Then else cc= Controls.AddTextBox (x*50 y*40) If x<8 and y<8 then nn[i]=cc LDShapes.BrushColour (nn[i],"white") i=i+1 Else ct[j]=cc j=j+1 EndIf Controls.SetSize (cc 45 30) 'If y=4 then Controls.SetTextBoxText (cc sq[i-1]) 'endif endif EndFor EndFor GraphicsWindow.BackgroundColor="teal Timer.Interval=255 Timer.Tick=ttt GraphicsWindow.Title="MgcSq Composer mm=Shapes.AddText(0) Shapes.Move (mm 5 405) mm1=Shapes.AddText(0) Shapes.Move (mm1 5 365) sss=LDShapes.GetAllShapes () b1=Controls.AddButton ("clr" 1 320) b2=Controls.AddButton ("odd" 1 10) b3=Controls.AddButton ("all" 1 50) b4=Controls.AddButton ("prm" 1 90) b5=Controls.AddButton ("seq" 1 130) b6=Controls.AddButton ("pi" 1 170) Controls.ButtonClicked =bcc While "true If lpp Then lpp="false Timer.Pause () Turtle.Speed=10 Turtle.PenUp () GraphicsWindow.PenColor="red For f=1 to 49 For i=1 To 49 If SQ[i]=f then Controls.SetTextBoxText (nn[i] SQ[i] ) Turtle.MoveTo (ldShapes .GetLeft (nn[i])+20 10+ldShapes.GetTop (nn[i])) Turtle.PenDown () else Controls.SetTextBoxText (nn[i] "" ) EndIf EndFor Program.Delay (750) endfor Timer.Resume () EndIf endwhile Sub bcc lb= Controls.LastClickedButton If lb=b2 Then For f=1 To 49 If Math.Remainder (sq[f] 2)=1 Then Controls.SetTextBoxText (nn[f] SQ[f] ) Else Controls.SetTextBoxText (nn[f] "" ) EndIf endfor elseIf lb=b3 Then For f=1 To 49 Controls.SetTextBoxText (nn[f] SQ[f] ) Endfor elseIf lb=b4 Then For f=1 To 49 If sq[f]=2 or ((Math.Remainder (sq[f] 2)=1) and (Array.ContainsValue(nnp SQ[f])="False")) Then Controls.SetTextBoxText (nn[f] SQ[f] ) Else Controls.SetTextBoxText (nn[f] "" ) EndIf endfor elseIf lb=b5 Then lpp="true else For i=1 To 49 If Array.ContainsValue (pi sq[i]) then Controls.SetTextBoxText (nn[i] SQ[i]) Else Controls.SetTextBoxText (nn[i] "" ) EndIf EndFor endif EndSub Sub ttt ll=ldlist.CreateFromValues ("") For r=1 To 49 LDList.Add (ll r) EndFor i=1 err="err: " For r=1 To 7 ss=0 For c=1 To 7 tt=Controls.GetTextBoxText (nn[i]) ss=ss+ tt If LDList.Contains (ll tt) then LDList.Remove (ll tt "true") ElseIf tt="" then else err=err+tt+"; " endif i=i+1 EndFor Controls.SetTextBoxText (ct[r+1] ss) EndFor bb= LDList.ToArray (ll) tx="missing: " sm=0 For r=1 To Array.GetItemCount (bb) tx=tx+bb[r]+"; " sm=sm+bb[r] EndFor Shapes.SetText (mm tx+" = "+sm) Shapes.SetText (mm1 err) For c=1 To 7 ss=0 i=c For r=1 To 7 ss=ss+ Controls.GetTextBoxText (nn[i]) i=i+7 EndFor Controls.SetTextBoxText (ct[c+8] ss) EndFor ss=0 i=1 For r=1 To 7 tt=Controls.GetTextBoxText (nn[i]) ss=ss+tt i=i+8 EndFor Controls.SetTextBoxText (ct[16] ss) ss=0 i=43 For r=1 To 7 tt=Controls.GetTextBoxText (nn[i]) ss=ss+tt i=i-6 EndFor Controls.SetTextBoxText (sss[1] ss) EndSub End>VKX413.sb< Start>VLD513.sb< Init() Main() Program.End() Sub Main Ende = 0 While Ende = 0 CheckButton() CheckDataView() EndWhile LDControls.DataViewSaveAsCSV(DV, FN, F) For i = GWW To 1 Step -25 GWW=i GWH=GWW*DHD GWT=DHH-(GWH/2) GWL=DWH-(GWW/2) GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH EndFor EndSub 'Main Sub CheckButton If BC = 1 Then BC = 0 If LCB = Save Then Ende = 1 Shapes.HideShape(dv) ElseIf LCB = Report Then Reporting() ElseIf LCB = EOMAccount Then EndOfMpmthAccount() EndIf EndIf EndSub 'CheckButton Sub CheckDataView If changed <> "" Then SHText = " " Shapes.SetText(SHMessage, SHText) dvFokus = LDControls.DataViewGetFocus(dv) If dvFokus[1] = changed[1] Then 'Check changed field If changed[2] = 1 Then If MJ <> Text.GetSubTextToEnd(changed[3],4) Then SHText = changed[3] + " ist kein gültiges Datum! Bitte Datum korrigieren." Shapes.SetText(SHMessage, SHText) LDControls.DataViewSetFocus(dv, changed[1], changed[2]) EndIf ElseIf changed[2] = 2 Then 'Betrag num = LDUtilities.GetCultureInvariantNumber(changed[3]) If LDUtilities.IsNumber(num) = F Then SHText = changed[3] + " ist kein gültiges Betrag! Bitte Betrag korrigieren." Shapes.SetText(SHMessage, SHText) LDControls.DataViewSetFocus(dv, changed[1], changed[2]) Else dec = 2 Decimal() LDControls.DataViewSetValue(dv, changed[1], changed[2], num) LDControls.DataViewSetFocus(dv, changed[1], changed[2]+1) EndIf EndIf Else 'Check Row EndIf changed = "" EndIf EndSub 'CheckDataView Sub Decimal tmp = Math.Power(10, dec) num = 1/tmp * Math.Round( num * tmp ) EndSub Sub Reporting EndSub 'Reporting Sub EndOfMpmthAccount EndSub 'EndOfMpmthAccount Sub Init T = "True" F = "False" 'GraphicsWindow LDGraphicsWindow.Style = 2 DW=Desktop.Width - 20 DH=Desktop.Height - 100 DWH=DW/2 DHH=DH/2 DHD = DH/DW GWW=10 GWH=GWW*DHD GWT=DHH-(GWH/2) GWL=DWH-(GWW/2) GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH For i = GWW To DW Step 25 GWW=i GWH=GWW*DHD GWT=DHH-(GWH/2) GWL=DWH-(GWW/2) GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH EndFor GraphicsWindow.Title = "Buchhaltung" GWFN = "Consolas" GWFS = 14 GraphicsWindow.FontName = GWFN GraphicsWindow.FontSize = GWFS 'DataViews 'DataView Buchung BD = " Datum " BB = " € Betrag " BK = " Konto " BGK = " Gegenkonto " BT = " Buchungstext " headings[1] = BD headings[2] = BB headings[3] = BK headings[4] = BGK headings[5] = BT DV = LDControls.AddDataView(DW -500, DH - 200, headings) Shapes.HideShape(DV) Shapes.Move(DV, 10, 30) K[1] = "10" KT[1] = "Kasse " K[2] = "12" KT[2] = "Bank " K[3] = "13" KT[3] = "Geldtransit " K[4] = "14" KT[4] = "Forderungen " K[5] = "16" KT[5] = "Verbindlichkeiten" K[6] = "40" KT[6] = "Lebensmittel " K[7] = "41" KT[7] = "Kleidung " K[8] = "45" KT[8] = "Fahrzeuge " K[9] = "49" KT[9] = "sonstige Kosten " K[10] = "80" KT[10] = "Einnahmen " K[11] = "99" KT[11] = "Kontoeröffnung " ICK = Array.GetItemCount(K) For i = 1 To ICK KUT[i] = K[i] + " = " + KT[i] EndFor LDControls.DataViewSetColumnComboBox(DV,3,KUT) LDControls.DataViewSetColumnComboBox(DV,4,KUT) LDControls.DataViewColumnWidths(DV,"") LDControls.DataViewColAlignment(DV,2,"Right") FN = "E:\Buchung/Buchungen.csv" CSVD = ";" LDUtilities.CSVDeliminator = CSVD ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(FN) = T Then LDControls.DataViewReadFromCSV(DV, FN, F) EndIf LDControls.DataViewColumnSort(dv, 1, T) R = LDControls.DataViewRowCount(dv) For Row = 1 To R SKI = Text.GetSubText(LDControls.DataViewGetValue(dv,Row,3),1,2) RZ = LDUtilities.GetCultureInvariantNumber(LDControls.DataViewGetValue(dv,Row,2)) Index = LDArray.GetIndex(K, SKI) KS[Index] = KS[Index] + RZ HKI = Text.GetSubText(LDControls.DataViewGetValue(dv,Row,4),1,2) Index = LDArray.GetIndex(K, HKI) KS[Index] = KS[Index] - RZ EndFor 'DataViev Saldo Sheadings[1] = "Konto " Sheadings[2] = "Saldo" SDV = LDControls.AddDataView(450, DH - 200, Sheadings) Shapes.HideShape(SDV) Shapes.Move(SDV, DW -480, 30) LDControls.DataViewColAlignment(SDV,2,"Right") For i = 1 To ICK ZA[1] = KT[i] ZA[2] = KS[i] LDControls.DataViewSetRow(SDV, i, ZA) LDControls.DataViewRowColours(SDV, i, "LightGray", "Black") EndFor ZA[1] = " " ZA[2] = " " LDControls.DataViewSetRow(SDV, ICK, ZA) LDControls.DataViewSetFocus(SDV, ICK-2, 2) LDControls.DataViewAllowUserEntry(SDV, F) LDControls.DataViewColumnReadOnly(SDV, 1, T) LDControls.DataViewColumnReadOnly(SDV, 2, T) Shapes.ShowShape(DV) Shapes.ShowShape(SDV) Save = Controls.AddButton("Speichern", 10, DH - 40) Report = Controls.AddButton("Auswertung", 100, DH - 40) EOMAccount = Controls.AddButton("Monatsabschluß", 200, DH - 40) LDControls.DataViewSetFocus(DV, R+1, 1) Controls.ButtonClicked = OnButtonClicked LDControls.DataViewCellValueChanged = OnDataViewCellValueChanged MJ = "12.2016" SHText = "" SHMessage = Shapes.AddText(SHText) Shapes.Move(SHMessage, 10, DH - 70) EndSub 'Init Sub OnButtonClicked BC = 1 LCB = Controls.LastClickedButton EndSub 'OnButtonClicked Sub OnDataViewCellValueChanged changed = LDControls.LastDataViewCellValueChanged EndSub 'OnDataViewCellValueChanged End>VLD513.sb< Start>VLF523.sb< Turtle.Show() GraphicsWindow.Title = "Logo" TextWindow.Title = "Turtle commands" commands: speed = Turtle.Speed TextWindow.WriteLine ("What do you want the turtle?") TextWindow.WriteLine ("1. Move") TextWindow.WriteLine ("2. Turn right") TextWindow.WriteLine ("3. Turn left") TextWindow.WriteLine ("4. Move to") TextWindow.WriteLine ("5. Speed") TextWindow.WriteLine ("6. Random background color") TextWindow.WriteLine ("7. Color Turtle Road") TextWindow.WriteLine ("8. Exit") TextWindow.WriteLine ("Turtle speed: " + speed) i = TextWindow.Read() If i = "1" Then TextWindow.WriteLine ("How far?") o = TextWindow.Read() Turtle.Move(o) Endif If i = "2" Then Turtle.TurnRight() EndIf If i = "3" Then Turtle.TurnLeft() EndIf If i = "4" Then TextWindow.WriteLine ("Where? (X, Y)") TextWindow.WriteLine ("X") x = TextWindow.Read() TextWindow.WriteLine ("Y") y = TextWindow.Read() Turtle.MoveTo(x,y) EndIf If i = "5" Then TextWindow.WriteLine ("How fast?") d = TextWindow.Read() Turtle.Speed = d Endif If i = "6" Then GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() EndIf If i = "7" Then TextWindow.WriteLine ("What Color?") z = TextWindow.Read() GraphicsWindow.PenColor = z Endif If i = "8" Then TextWindow.WriteLine ("Really want to quit?") TextWindow.WriteLine ("1. Yes") TextWindow.WriteLine ("2. No") s = TextWindow.Read() If s = "1" Then Program.End() EndIf If s = "2" Then Goto commands Endif Endif Goto commands End>VLF523.sb< Start>VLF564.sb< ' SmallBasic Version 1.0 ' Function: Shell_EN.sb (Demo) ' Author: Pappa Lapub ' Origin: http://social.msdn.microsoft.com/Forums/en-US/b14fd3e3-54c2-404f-b861-e0153c02348a/litdev-ldfileprintfile-doesnt-seem-to-be-working-maybe-windows-81-issue ' ImportURL: http://smallbasic.com/program/? ' Extension: 1. LitDev; 2. Gaku's TCMxx.exe in a %PATH% folder or define the path to TCM.exe in Line 157: ' http://www.eonet.ne.jp/~gakana/tablacus/contextmenu_en.html ' http://www.eonet.ne.jp/~gakana/tablacus/dl/tcm131120.cab (TCM32.exe/TCM64.exe) ' Version 13.11.20, 55,89 KiB (57.235 bytes), 20.11.2013 14:20:43 ' In Line 157 change LDProcess.Start("TCM.exe", ... TO LDProcess.Start("Drive:\Your\PathTo\TCMxx.exe", ... !! ' ' Comment: ' 1.) Better first save, run to compile and exit. Then RUN the created EXE of this program (else maybe some paths won't fit) ! ' 2.) To AVOID a CHANGE OF your file ASSOCIATION (Shell 'Open') from 'Open with.. ' dialog ' UNMARK the "Always use the selected program to open this kind of file" checkbox in the 'Open with' dialog !! ' ' Usage: 1. Select a file or folder (via Dialog-/Buttons, Drag-/Drop on TextBox or Enter/Paste in TextBox) ' 2. Choose Contextmenu, Properties, 'Open with ..', 'New Link to ..' or Touch file ' ' Variables: FileObj/DirObj ... True if File/Folder selected or dropped ' Info ... Shape Infotext ' Obj ... selected File-/Folderpath ' ' ToDo: support file-/folderpaths entered/pasted in TextBox - CheckTBLine() OK ' support drives for Contextmenu, Properties and NewLink OK, all same for folders ? ' add touch file via VBS OK ' support shortcut keys D,F - C, P, O, N, T - Delete, Escape - OnKeyDown() ' fix 2x MsgBox when TB empty and a lower Button is clicked ' -------------------------------------------------------------------------------- LF = Text.GetCharacter(10) QU = Text.GetCharacter(34) GW1 = GraphicsWindow.Width GraphicsWindow.Height = 126 GraphicsWindow.BackgroundColor = "BurlyWood" ' The following line could be harmful and has been automatically commented. ' SelfPath = Program.Directory + "\" + LDFile.GetFile(File.GetSettingsFilePath()) + ".sb /.exe" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = LDFile.GetFile(File.GetSettingsFilePath()) ' Self ToolTip[1] = "Select a folder (for Contextmenu, Properties or to create a Shelllink in)" ToolTip[2] = "Select a file (for Contextmenu, Properties, to 'Open with ..' or Touch)" ToolTip[3] = "Show Contextmenu for selected file or folder." ToolTip[4] = "Show Property sheets dialog for selected file or folder." ToolTip[5] = "'Open with ..' (for a file only)." ToolTip[6] = "Shortcut (lnk/url) will be created in folder shown in upper TextBox (for a folder only)." ToolTip[7] = "Touch file (set to current date/time)." GraphicsWindow.BrushColor = "RoyalBlue" ' "Plum" TB = Controls.AddTextBox(10,50) Controls.SetSize(TB, GW1-20,24) LDDialogs.ToolTip(TB,"Throw one file or folder on TextBox or enter/paste path.") LDControls.AllowDrop(TB) GraphicsWindow.BrushColor = "Black" SelDir = Controls.AddButton("Select folder ..", 10,10) SelFile = Controls.AddButton("Select file ..", 120,10) btnCMenu = Controls.AddButton("Contextmenu", 10,90) btnProps = Controls.AddButton("Properties", 120,90) btnOpenWith = Controls.AddButton("Open with ..", 230,90) btnNewLink = Controls.AddButton("New Link to ..", 340,90) btnTouch = Controls.AddButton("Touch file", 450,90) For N = 1 To 7 Controls.SetSize("Button"+N, 100,26) LDDialogs.ToolTip("Button"+N,ToolTip[N]) EndFor GraphicsWindow.BrushColor = "Red" btnClear = Controls.AddButton("CLEAR", GW1-60,90) Info = Shapes.AddText("") Shapes.Move(Info, 230,10) Controls.ButtonClicked = OnClick LDControls.FileDropped = OnDrop GraphicsWindow.KeyDown = OnKeyDown LDEvents.Resized = OnResize ' ////////// EVENTs - SUBs \\\\\\\\\\ Sub OnDrop ObjArr = LDControls.LastDropFiles Obj = ObjArr[1] ' The following line could be harmful and has been automatically commented. ' If LDFile.Length(Controls.GetTextBoxText(TB)) > -1 Then FileObj = "True" Shapes.SetText(Info, "File dropped.") Else DirObj = "True" Shapes.SetText(Info, "Directory dropped.") EndIf EndSub Sub OnClick LastBtn = Controls.LastClickedButton If LastBtn <> SelDir And LastBtn <> SelFile And LastBtn <> btnClear Then CheckTBLine() EndIf Shapes.SetText(Info, "") If LastBtn = SelDir Then Obj = LDDialogs.GetFolder("") If Obj <> "" Then Controls.SetTextBoxText(TB,Obj) FileObj = "" DirObj = "True" Shapes.SetText(Info, "Directory selected.") EndIf ElseIf LastBtn = SelFile Then Obj = LDDialogs.OpenFile("*","") If Obj <> "" Then Controls.SetTextBoxText(TB,Obj) FileObj = "True" DirObj = "" Shapes.SetText(Info, "File selected.") EndIf ElseIf LastBtn = btnCMenu Then CMenu() ElseIf LastBtn = btnProps Then Props() ElseIf LastBtn = btnOpenWith Then OpenWith() ElseIf LastBtn = btnNewLink Then MakeLink() ElseIf LastBtn = btnTouch Then TouchFile() ElseIf LastBtn = btnClear Then Controls.SetTextBoxText(TB, "") Obj = "" FileObj = "" DirObj = "" Shapes.SetText(Info, "") EndIf EndSub Sub OnKeyDown LastKey = GraphicsWindow.LastKey If LastKey = "Escape" Then Program.End() ' ..... ToDo EndIf EndSub Sub OnResize GW = GraphicsWindow.Width ' If GW <> GW1 Then Program.Delay(20) If GW >= 610 Then Controls.SetSize(TB, GW-20,24) Controls.Move(btnClear, GW-60,90) Else GraphicsWindow.Width = 610 ' GW1 = GW EndIf GraphicsWindow.Height = 126 EndSub ' Actions Sub CMenu ' for given file or folder If Controls.GetTextBoxText(TB) <> "" And (FileObj Or DirObj) Then LDProcess.Start("TCM.exe", QU + Obj + QU) ' in %Path% or better change to FULL PATH to TCM.exe (using TCM.exe default options) Else GraphicsWindow.ShowMessage("NO File-/Folderpath given to show Contextmenu !", "Missing Path") EndIf EndSub Sub Props ' for given file or folder If Controls.GetTextBoxText(TB) <> "" And (FileObj Or DirObj) Then ' The following line could be harmful and has been automatically commented. ' PropsVB = LDFile.TempFolder + "\FileProp-4SB.vbs" WritePropsVBS() LDProcess.Start(PropsVB, QU + Obj + QU) ' default ShellExec for .vbs Else GraphicsWindow.ShowMessage("NO File-/Folderpath given to show PropertyTabs !", "Missing Path") EndIf EndSub Sub OpenWith ' for given file only If Controls.GetTextBoxText(TB) <> "" And FileObj Then Shapes.SetText(Info, "UNMARK 'Always use selected program to open this kind of file'" + LF + "checkbox on the 'Open with' dialog !") Path = Controls.GetTextBoxText(TB) ' The following line could be harmful and has been automatically commented. ' If LDFile.Length(Path) > -1 Then ' File exists (may be empty) Args = "C:\WINDOWS\system32\shell32.dll,OpenAs_RunDLL " + Path LDProcess.Start("rundll32.exe", Args) EndIf Else GraphicsWindow.ShowMessage("NO Filepath given to 'Open with ..' !", "Missing Filepath") EndIf EndSub Sub MakeLink ' for given folder only (= target folder for link/url creation) If Controls.GetTextBoxText(TB) <> "" And DirObj Then Path = Controls.GetTextBoxText(TB) ' The following line could be harmful and has been automatically commented. ' If File.GetDirectories(Path) <> "FAILED" Then LinkFile = Path + "\NewLink.lnk" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(LinkFile,"") Args = "C:\WINDOWS\system32\appwiz.cpl,NewLinkHere " + LinkFile ' for Win7 | on XP: FolderPath\ ProcID = LDProcess.Start("rundll32.exe", Args) While Array.ContainsIndex(LDProcess.GetProcesses(),ProcID) Program.Delay(50) EndWhile GraphicsWindow.ShowMessage("Shortcut created in " + Path + LF + " or aborted.", "SUCCESS") Else GraphicsWindow.ShowMessage("NO Folderpath given to create Shortcut in !", "Missing Folderpath") EndIf Else GraphicsWindow.ShowMessage("NO Folderpath given to create Shortcut in !", "Missing Folderpath") EndIf EndSub Sub TouchFile If Controls.GetTextBoxText(TB) <> "" And FileObj Then ' The following line could be harmful and has been automatically commented. ' TouchVB = LDFile.TempFolder + "\FileTouch-4SB.vbs" WriteTouchVBS() LDProcess.Start(TouchVB, QU + Obj + QU) ' default ShellExec for .vbs Program.Delay(1000) ' The following line could be harmful and has been automatically commented. ' ModDate = LDFile.ModifiedTime(Obj) Shapes.SetText(Info, Obj + LF + "touched at: " + ModDate) Else GraphicsWindow.ShowMessage("NO Filepath given to touch file !", "Missing Path") EndIf EndSub Sub CheckTBLine ' REMOVE quotes - CHECK if file or folder exists - SET FileObj or DirObj, Obj TBLine = Controls.GetTextBoxText(TB) If TBLine <> "" Then If Text.IsSubText(TBLine,QU) Then ' Remove Quotes TBLine = LDUtilities.RegexReplace(TBLine,QU,"","") Controls.SetTextBoxText(TB,TBLine) EndIf ' The following line could be harmful and has been automatically commented. ' If LDFile.Length(TBLine) > -1 Then ' its FilePath in TB FileObj = "True" Shapes.SetText(Info, "File selected.") Obj = TBLine ' The following line could be harmful and has been automatically commented. ' ElseIf File.GetFiles(TBLine) <> "FAILED" Or File.GetDirectories(TBLine) <> "FAILED" Then ' its DirPath in TB DirObj = "True" Shapes.SetText(Info, "Directory selected.") Obj = TBLine Else ' Wrong Path in TB GraphicsWindow.ShowMessage("File- or Folderpath not found !", "No existing Path !") TBLine = "" Controls.SetTextBoxText(TB, "") EndIf ElseIf LastBtn <> btnClear Then GraphicsWindow.ShowMessage("NO File-/Folderpath given !", "Missing Path") EndIf EndSub Sub WritePropsVBS ' The following line could be harmful and has been automatically commented. ' If LDFile.Length(PropsVB) < 1 Then ' %TEMP%\FileProp-4SB.vbs does not exist or is empty ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "' Created by " + SelfPath) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "' to show Property Sheets for file/folder given as argument.") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Option Explicit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Dim fso, strPath, strFold, strFile, shApp, FoldObj, FileObj") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "If WScript.Arguments.Count = 0 Then WScript.Quit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set fso = CreateObject(" + QU + "Scripting.FileSystemObject" + QU + ")") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "On Error Resume Next") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "strPath = fso.GetAbsolutePathName(WScript.Arguments(0))") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "If Not fso.FileExists(strPath) And Not fso.FolderExists(strPath) Then WScript.Quit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "strFold = fso.GetParentFolderName(strPath)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "strFile = fso.GetFileName(strPath)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set shApp = CreateObject(" + QU + "Shell.Application" + QU + ")") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set FoldObj = shApp.NameSpace(strFold)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set FileObj = FoldObj.ParseName(strFile)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "FileObj.InvokeVerb(" + QU + "properties" + QU + ")") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "On Error Resume Next") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "WScript.Echo strPath") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set fso = Nothing") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set shApp = Nothing") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set FoldObj = Nothing") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(PropsVB, "Set FileObj = Nothing") EndIf EndSub Sub WriteTouchVBS ' The following line could be harmful and has been automatically commented. ' If LDFile.Length(TouchVB) < 1 Then ' %TEMP%\FileTouch-4SB.vbs does not exist or is empty ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "' Created by " + SelfPath) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "' to touch file given as argument (set to current date/time).") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Option Explicit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Dim fso, strPath, strFold, strFile, shApp, FoldObj") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "If WScript.Arguments.Count = 0 Then WScript.Quit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set fso = CreateObject(" + QU + "Scripting.FileSystemObject" + QU + ")") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "strPath = fso.GetAbsolutePathName(WScript.Arguments(0))") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "If Not fso.FileExists(strPath) Then WScript.Quit") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "strFold = fso.GetParentFolderName(strPath)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "strFile = fso.GetFileName(strPath)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set fso = Nothing") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set shApp = CreateObject(" + QU + "Shell.Application" + QU + ")") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set FoldObj = shApp.NameSpace(strFold)") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "FoldObj.Items.Item(strFile).ModifyDate = Now") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set shApp = Nothing") ' The following line could be harmful and has been automatically commented. ' File.AppendContents(TouchVB, "Set FoldObj = Nothing") EndIf EndSub End>VLF564.sb< Start>VLG274.sb< ' mahreen miangul March 2019 ' Smiley Smile GraphicsWindow.Left = 0.1 * (Desktop.Width - GraphicsWindow.Width) GraphicsWindow.Top = 0 * (Desktop.Height - GraphicsWindow.Height) GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor="midnightblue" GraphicsWindow.Width = "600 GraphicsWindow.Height = "400" '============================== Makesprite() ============================== SPRITE_init() add_shapes() ' ============================== Aircraft Animation ============================== dZ = 0.1 zoom = 1 ddx=0 ddy=0 bdx=0 bdy=0 ANMB="1:1" BNMB="9:1" ' <----- Blue car shapes number=6 repeat =1 zm=1 ' <----- ' ============================== Cannon//Car Timer ============================== Timer.Interval=800 Timer.Tick=CannonCar_up While "True" ' 'inits here, get ready For next click Program.Delay(20) '============================Aircraft Blinking Program======================= zoom = zoom - dZ For i = 1 To Array.GetItemCount(shape[1]) If Array.ContainsValue(shape[1][i], "eye") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) ElseIf Array.ContainsValue(shape[1][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], zoom, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx,shapes.Gettop(shp[ANMB][i])+ddy) EndFor If zoom = 0.1 Or zoom = 1.7 Then dZ = -dZ EndIf ' <----- endwhile '============================Cannon Car Animation================================== Sub CannonCar_up MM=MM+1 If MM=23 Then MM=0 EndIf Timer.Pause() For k=1 To Array.GetItemCount(s[1]) For L=1 To Array.GetItemCount(shape[1])-1 ' <----- Shapes.Rotate(SHP["1:"+k][L],Shape[1][L]["angle"]) EndFor EndFor Program.Delay(300) For k=1 To Array.GetItemCount(s[1]) For L=1 To Array.GetItemCount(shape[1])-1 ' <----- Shapes.Rotate(SHP["1:"+K][L], 0) EndFor EndFor Program.Delay(30) Timer.Resume() EndSub ' Add Sprites Sub add_shapes For M=1 To Array.GetItemCount(s) For N=1 To Array.GetItemCount(s[M]) ss=s[M][N] _shx=shx[M][N] _shY=shY[M][N] _shape=shape[M] NMB=M+":"+N For i=1 To Array.GetItemCount(_shape) GraphicsWindow.PenWidth = _shape[i]["pw"] GraphicsWindow.BrushColor = _shape[i]["bc"] GraphicsWindow.penColor = _shape[i]["pc"] If _shape[i]["func"]="ell" Then shp[NMB][i] = Shapes.AddEllipse(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="rect" Then shp[NMB][i] = Shapes.AddRectangle(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="tri" Then shp[NMB][i] = Shapes.Addtriangle(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss, _shape[i]["x3"]*ss, _shape[i]["y3"]*ss) ElseIf _shape[i]["func"]="line" Then shp[NMB][i] = Shapes.Addline(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss) EndIf Shapes.Animate(shp[NMB][i], _shape[i]["x"]*ss+_shX, _shape[i]["y"]*ss+_shY, 500) Shapes.Rotate(shp[NMB][i], _Shape[i]["angle"]) EndFor EndFor EndFor EndSub Sub SPRITE_init ' Smiley s[1] = "1=0.8" shX[1]= "1=250" shY[1]= "1=100" shape[1][1]="func=ell;X=0;Y=0;width=150;height=150;bc=gold;pc=black;pw=0" shape[1][2]="func=ell;X=20;Y=25;width=50;height=16;bc=black;pc=black;pw=0" shape[1][3]="func=ell;X=20;Y=31;width=50;height=16;angle=0;bc=gold;pc=black;pw=0;"'tag=eye;"' Eye Lash-1 shape[1][4]="func=ell;X=80;Y=25;width=50;height=16;bc=black;pc=black;pw=0" shape[1][5]="func=ell;X=80;Y=31;width=50;height=10;angle=0;bc=gold;pc=black;pw=0;"'tag=eye;"' Eye Lash- shape[1][6]="func=ell;X=14;Y=40;width=50;height=50;angle=0;bc=white;pc=black;pw=1;"'Eye Left-1 shape[1][7]="func=ell;X=18;Y=50;width=30;height=30;bc=gray;pc=black;pw=0;" shape[1][8]="func=ell;X=22;Y=55;width=22;height=22;bc=black;pc=black;pw=0;" shape[1][9]="func=ell;X=23;Y=66;width=10;height=10;bc=white;pc=black;pw=0;tag=eye" shape[1][10]="func=ell;X=80;Y=40;width=50;height=50;angle=0;bc=white;pc=black;pw=1;"'Eye Right-1 shape[1][11]="func=ell;X=82;Y=50;width=30;height=30;bc=gray;pc=black;pw=0;" shape[1][12]="func=ell;X=85;Y=55;width=22;height=22;bc=black;pc=black;pw=0" shape[1][13]="func=ell;X=87;Y=67;width=10;height=10;bc=white;pc=black;pw=0;tag=mouth" shape[1][14]="func=ell;X=30;Y=120;width=90;height=20;angle=0;bc=white;pc=black;pw=1;" shape[1][15]="func=ell;X=30;Y=126;width=90;height=6;angle=0;bc=black;pc=black;" 'shape[1][0] = "func=rect;x=200;y=40;width=100;height=50;angle=30;bc=darkcyan;pc=darkslategray;pw=2" 'shape[1][0] = "func=rect;x=200;y=100;width=100;height=50;angle=-30;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=200;y=50;width=44;height=160;angle=15;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=200;y=100;width=100;height=50;angle=-15;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=300;y=40;width=33;height=22;bc=yellowgreen;pw=0;tag=eye" ' eye 1 ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=235;width=33;height=22;bc=greenyellow;pw=0;tag=eye" ' eye 2 ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=133;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=153;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> endsub End>VLG274.sb< Start>VLG376.sb< r=30 d=r*2 init() GraphicsWindow.FillEllipse(320-r,240-r,d,d) Turtle.Angle=120 Turtle.Move(r+60+r) x=Turtle.X y=Turtle.Y GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) Turtle.Turn(60) Turtle.Move(r+30) GraphicsWindow.PenColor="red" Turtle.Move(30+r) GraphicsWindow.BrushColor="red" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) Turtle.Turn(-60) Turtle.Move(r+30) GraphicsWindow.PenColor="white" Turtle.Move(30+r) GraphicsWindow.BrushColor="white" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) Turtle.PenUp() GraphicsWindow.PenWidth=7.5 Turtle.MoveTo(x,y-15) GraphicsWindow.PenColor="black" Turtle.PenDown() Turtle.Angle=60 Turtle.Move(r+30) GraphicsWindow.PenColor="red" Turtle.Move(30+r) Turtle.PenUp() Turtle.MoveTo(x,y+15) GraphicsWindow.PenColor="black" Turtle.PenDown() Turtle.Angle=60 Turtle.Move(r+30) GraphicsWindow.PenColor="red" Turtle.Move(30+r) Turtle.PenUp() Turtle.MoveTo(x,y) Turtle.Angle=60 Turtle.Move(r+60+r) GraphicsWindow.BrushColor="red" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) Turtle.MoveTo(320,240) GraphicsWindow.PenColor="black" GraphicsWindow.BrushColor="white" GraphicsWindow.PenWidth=15 direction=-60 For i = 1 To 2 Turtle.PenUp() Turtle.MoveTo(320,240) Turtle.Angle=direction GraphicsWindow.PenColor="black" Turtle.PenDown() Turtle.Move(r+30) GraphicsWindow.PenColor="white" Turtle.Move(30+r) GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) direction=direction+90 EndFor Turtle.PenUp() Turtle.MoveTo(320,240) Turtle.PenDown() GraphicsWindow.PenColor="black" Turtle.Move(r+30) GraphicsWindow.PenColor="blue" Turtle.Move(30+r) GraphicsWindow.BrushColor="blue" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) direction=120 x=Turtle.X y=Turtle.Y GraphicsWindow.BrushColor="white" For i = 1 To 2 Turtle.PenUp() Turtle.MoveTo(x,y) Turtle.Angle=direction GraphicsWindow.PenColor="blue" Turtle.PenDown() Turtle.Move(r+30) GraphicsWindow.PenColor="white" Turtle.Move(30+r) GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) direction=direction+120 EndFor Turtle.Hide() Sub init GraphicsWindow.Title="Molecular Challenge-Glycine(C2H5NO2)" GraphicsWindow.Height=400 GraphicsWindow.Width=800 GraphicsWindow.FontBold="false" GraphicsWindow.FontName="times new roman" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(700,20,"C") GraphicsWindow.FontSize=24 GraphicsWindow.DrawText(740,50,"2") GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(760,20,"H") GraphicsWindow.FontSize=24 GraphicsWindow.DrawText(800,50,"5") GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(820,20,"NO") GraphicsWindow.FontSize=24 GraphicsWindow.DrawText(890,50,"2") GraphicsWindow.BackgroundColor="#dabc72" GraphicsWindow.Height=Desktop.Height GraphicsWindow.Width=Desktop.Width Turtle.PenUp() Turtle.MoveTo(320,240) Turtle.Angle=120 Turtle.PenDown() Turtle.Speed=10 GraphicsWindow.PenWidth=15 GraphicsWindow.BrushColor="black" EndSub End>VLG376.sb< Start>VLH852.sb< 'Andrew LaSalle 'BLACKJACK!!! TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" Sub printcard If card < 14 And suit = 1 Then TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Black" If card = 1 Then TextWindow.WriteLine("Ace of Spades ♠ ") ElseIf card = 11 Then TextWindow.WriteLine("Jack of Spades ♠ ") ElseIf card = 12 Then TextWindow.WriteLine("Queen of Spades ♠ ") ElseIf card = 13 Then TextWindow.WriteLine("King of Spades ♠ ") Else TextWindow.WriteLine(card + " of Spades ♠ ") EndIf ElseIf card < 14 And suit = 2 Then TextWindow.ForegroundColor = "Red" If card = 1 Then TextWindow.WriteLine("Ace of Hearts ♥ ") ElseIf card = 11 Then TextWindow.WriteLine("Jack of Hearts ♥ ") ElseIf card = 12 Then TextWindow.WriteLine("Queen of Hearts ♥ ") ElseIf card = 13 Then TextWindow.WriteLine("King of Hearts ♥ ") Else TextWindow.WriteLine(card + " of Hearts ♥ ") EndIf ElseIf card < 14 And suit = 3 Then TextWindow.ForegroundColor = "Red" If card = 1 Then TextWindow.WriteLine("Ace of Diamonds ♦ ") ElseIf card = 11 Then TextWindow.WriteLine("Jack of Diamonds ♦ ") ElseIf card = 12 Then TextWindow.WriteLine("Queen of Diamonds ♦ ") ElseIf card = 13 Then TextWindow.WriteLine("King of Diamonds ♦ ") Else TextWindow.WriteLine(card + " of Diamonds ♦ ") EndIf ElseIf card < 14 And suit = 4 Then TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Black" If card = 1 Then TextWindow.WriteLine("Ace of Clubs ♣ ") ElseIf card = 11 Then TextWindow.WriteLine("Jack of Clubs ♣ ") ElseIf card = 12 Then TextWindow.WriteLine("Queen of Clubs ♣ ") ElseIf card = 13 Then TextWindow.WriteLine("King of Clubs ♣ ") Else TextWindow.WriteLine(card + " of Clubs ♣ ") EndIf EndIf EndSub card1 = Math.GetRandomNumber(13) suit1 = Math.GetRandomNumber(4) card = card1 suit = suit1 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" card2 = Math.GetRandomNumber(13) suit2 = Math.GetRandomNumber(4) card = card2 suit = suit2 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 TextWindow.WriteLine(" ") card6 = Math.GetRandomNumber(13) suit6 = Math.GetRandomNumber(4) card = card6 suit = suit6 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If (card1 = card2 And suit1 = suit2) Then TextWindow.Clear() card1 = Math.GetRandomNumber(13) suit1 = Math.GetRandomNumber(4) card = card1 suit = suit1 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" card2 = Math.GetRandomNumber(13) suit2 = Math.GetRandomNumber(4) card = card2 suit = suit2 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 TextWindow.WriteLine(" ") card6 = Math.GetRandomNumber(13) suit6 = Math.GetRandomNumber(4) card = card6 suit = suit6 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" EndIf If (card2 = card6 And suit2 = suit6) Then TextWindow.Clear() card1 = Math.GetRandomNumber(13) suit1 = Math.GetRandomNumber(4) card = card1 suit = suit1 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" card2 = Math.GetRandomNumber(13) suit2 = Math.GetRandomNumber(4) card = card2 suit = suit2 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 TextWindow.WriteLine(" ") card6 = Math.GetRandomNumber(13) suit6 = Math.GetRandomNumber(4) card = card6 suit = suit6 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" EndIf If (card1 = card6 And suit1 = suit6) Then TextWindow.Clear() card1 = Math.GetRandomNumber(13) suit1 = Math.GetRandomNumber(4) card = card1 suit = suit1 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" card2 = Math.GetRandomNumber(13) suit2 = Math.GetRandomNumber(4) card = card2 suit = suit2 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 TextWindow.WriteLine(" ") card6 = Math.GetRandomNumber(13) suit6 = Math.GetRandomNumber(4) card = card6 suit = suit6 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" EndIf cardtotal = card1 + card2 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card6= 11 Then cardtotal = cardtotal - 1 EndIf If card6 = 12 Then cardtotal = cardtotal - 2 EndIf If card6 = 13 Then cardtotal = cardtotal - 3 EndIf If (card1 = 1 And card2 = 10) Or (card1 = 10 And card2 = 1) Then TextWindow.WriteLine("BLACKJACK! You Win! ") TextWindow.Pause() Program.End() EndIf If card1 = 1 And cardtotal < 12 Then TextWindow.WriteLine("Do you want the Ace to be worth 1 or 11 ") ACE = TextWindow.ReadNumber() Math.Floor(ACE) While (ACE < 11 And ACE > 1) Or ACE < 1 Or ACE > 11 TextWindow.WriteLine("I said 1 OR 11 NOT (insert what number you just typed in, here). Now then, TRY AGAIN! ") ACE = TextWindow.ReadNumber() Math.Floor(ACE) EndWhile If ACE = 11 Then cardtotal = cardtotal + 10 EndIf If ACE = 1 Then cardtotal = cardtotal + 0 EndIf EndIf If card2 = 1 And cardtotal < 12 Then TextWindow.WriteLine("Do you want the Ace to be worth 1 or 11 ") ACE = TextWindow.ReadNumber() Math.Floor(ACE) While (ACE < 11 And ACE > 1) Or ACE < 1 Or ACE > 11 TextWindow.WriteLine("I said 1 OR 11 NOT (insert what number you just typed in, here). Now then, TRY AGAIN! ") ACE = TextWindow.ReadNumber() Math.Floor(ACE) EndWhile If ACE = 11 Then cardtotal = cardtotal + 10 EndIf If ACE = 1 Then cardtotal = cardtotal + 0 EndIf EndIf TextWindow.WriteLine(cardtotal) TextWindow.WriteLine("Do you want to hit or stay? ") hitorstay = TextWindow.Read() While (hitorstay > 0 Or hitorstay < 0) Or (hitorstay <> "Hit" And hitorstay <> "hit" And hitorstay <> "HIT" And hitorstay <> "Stay" And hitorstay <> "stay" And hitorstay <> "STAY") TextWindow.WriteLine("I said HIT OR STAY! 2 words to choose from! IT'S SIMPLE!") hitorstay = TextWindow.Read() EndWhile If (hitorstay = "Stay" Or hitorstay = "stay" Or hitorstay = "STAY") And cpucardtotal < 17 Then card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 While (card1 = card7 And suit1 = suit7) Or (card2 = card7 And suit2 = suit7) Or (card6 = card7 And suit6 = suit7) card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 EndWhile If card6 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card6 = 1 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If (card6 = 1 And card7 = 10) Or (card6 = 10 And card7 = 1) Or cpucardtotal = 21 Then TextWindow.WriteLine("BLACKJACK!? You Lost! ") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 While (card1 = card8 And suit1 = suit8) Or (card2 = card8 And suit2 = suit8) Or (card6 = card8 And suit6 = suit8) Or (card7 = card8 And suit7 = suit8) card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 EndWhile EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 While (card1 = card9 And suit1 = suit9) Or (card2 = card9 And suit2 = suit9) Or (card6 = card9 And suit6 = suit9) Or (card7 = card9 And suit7 = suit9) Or (card8 = card9 And card8 = suit9) card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 EndWhile If card9 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card9 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal > cpucardtotal And cardtotal < 21 And cpucardtotal > 17 And cpucardtotal < 21 Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal < 17 Then card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 While (card1 = card10 And suit1 = suit10) Or (card2 = card10 And suit2 = suit10) Or (card6 = card10 And suit6 = suit10) Or (card7 = card10 And suit7 = suit10) Or (card8 = card10 And suit8 = suit10) Or (card9 = card10 And suit9 = suit10) card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 EndWhile If card10 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card10 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 21 Then TextWindow.WriteLine("5 CARD CHARLIE!? You Lost! ") EndIf EndIf EndIf EndIf If hitorstay = "Hit" Or hitorstay = "hit" Or hitorstay = "HIT" Then card3 = Math.GetRandomNumber(13) suit3 = Math.GetRandomNumber(4) card = card3 suit = suit3 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal- 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf While (card1 = card3 And suit1 = suit3) Or (card2 = card3 And suit2 = suit3) Or (card3 = card6 And suit3 = suit6) card3 = Math.GetRandomNumber(13) suit3 = Math.GetRandomNumber(4) card = card3 suit = suit3 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal - 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf EndWhile TextWindow.WriteLine(cardtotal) If cardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Lost! ") TextWindow.Pause() Program.End() EndIf EndIf If (hitorstay = "Stay" Or hitorstay = "stay" Or hitorstay = "STAY") And cpucardtotal < 17 Then card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 While (card1 = card7 And suit1 = suit7) Or (card2 = card7 And suit2 = suit7) Or (card3 = card7 And suit3 = suit7) Or (card6 = card7 And suit6 = suit7) card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 EndWhile If card6 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card6 = 1 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If (card6 = 1 And card7 = 10) Or (card6 = 10 And card7 = 1) Or cpucardtotal = 21 Then TextWindow.WriteLine("BLACKJACK!? You Lost! ") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 While (card1 = card8 And suit1 = suit8) Or (card2 = card8 And suit2 = suit8) Or (card3 = card8 And suit3 = suit8) Or (card6 = card8 And suit6 = suit8) Or (card7 = card8 And suit7 = suit8) card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 EndWhile EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 While (card1 = card9 And suit1 = suit9) Or (card2 = card9 And suit2 = suit9) Or (card3 = card9 And suit3 = suit9) Or (card6 = card9 And suit6 = suit9) Or (card7 = card9 And suit7 = suit9) Or (card8 = card9 And card8 = suit9) card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 EndWhile If card9 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card9 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal > cpucardtotal And cardtotal < 21 And cpucardtotal > 17 And cpucardtotal < 21 Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal < 17 Then card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 While (card1 = card10 And suit1 = suit10) Or (card2 = card10 And suit2 = suit10) Or (card3 = card10 And suit3 = suit10) Or (card6 = card10 And suit6 = suit10) Or (card7 = card10 And suit7 = suit10) Or (card8 = card10 And suit8 = suit10) Or (card9 = card10 And suit9 = suit10) card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 EndWhile If card10 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card10 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 21 Then TextWindow.WriteLine("5 CARD CHARLIE!? You Lost! ") EndIf EndIf EndIf EndIf If hitorstay = "Hit" Or hitorstay = "HIT" Or hitorstay = "hit" Then TextWindow.WriteLine("Do you want to hit or stay? ") hitorstay = TextWindow.Read() While (hitorstay > 0 Or hitorstay < 0) Or (hitorstay <> "Hit" And hitorstay <> "hit" And hitorstay <> "HIT" And hitorstay <> "Stay" And hitorstay <> "stay" And hitorstay <> "STAY") TextWindow.WriteLine("I said HIT OR STAY! 2 words to choose from! IT'S SIMPLE!") hitorstay = TextWindow.Read() EndWhile EndIf If hitorstay = "Hit" Or hitorstay = "hit" Or hitorstay = "HIT" Then card4 = Math.GetRandomNumber(13) suit4 = Math.GetRandomNumber(4) card = card4 suit = suit4 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 + card4 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal - 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf If card4 = 11 Then cardtotal = cardtotal - 1 EndIf If card4 = 12 Then cardtotal = cardtotal - 2 EndIf If card4 = 13 Then cardtotal = cardtotal - 3 EndIf While (card1 = card4 And suit1 = suit4) Or (card2 = card4 And suit2 = suit4) Or (card3 = card4 And suit3 = suit4) Or (card4 = card6 And suit4 = suit6) card4 = Math.GetRandomNumber(13) suit4 = Math.GetRandomNumber(4) card = card4 suit = suit4 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 + card4 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal - 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf If card4 = 11 Then cardtotal = cardtotal - 1 EndIf If card4 = 12 Then cardtotal = cardtotal - 2 EndIf If card4 = 13 Then cardtotal = cardtotal - 3 EndIf EndWhile TextWindow.WriteLine(cardtotal) If cardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Lost! ") TextWindow.Pause() Program.End() EndIf EndIf If (hitorstay = "Stay" Or hitorstay = "stay" Or hitorstay = "STAY") And cpucardtotal < 17 Then card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf While (card1 = card7 And suit1 = suit7) Or (card2 = card7 And suit2 = suit7) Or (card3 = card7 And suit3 = suit7) Or (card4 = card7 And suit4 = suit7) Or (card6 = card7 And suit6 = suit7) card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf EndWhile If card6 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card6 = 1 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If (card6 = 1 And card7 = 10) Or (card6 = 10 And card7 = 1) Or cpucardtotal = 21 Then TextWindow.WriteLine("BLACKJACK!? You Lost! ") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf While (card1 = card8 And suit1 = suit8) Or (card2 = card8 And suit2 = suit8) Or (card3 = card8 And suit3 = suit8) Or (card4 = card8 And suit4 = suit8) Or (card6 = card8 And suit6 = suit8) Or (card7 = card8 And suit7 = suit8) card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf EndWhile EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 + card9 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf While (card1 = card9 And suit1 = suit9) Or (card2 = card9 And suit2 = suit9) Or (card3 = card9 And suit3 = suit9) Or (card4 = card9 And suit4 = suit9) Or (card6 = card9 And suit6 = suit9) Or (card7 = card9 And suit7 = suit9) Or (card8 = card9 And card8 = suit9) card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 + card9 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf EndWhile If card9 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card9 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal > cpucardtotal And cardtotal < 21 And cpucardtotal > 17 And cpucardtotal < 21 Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal < 17 Then card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 + card9 + card10 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf While (card1 = card10 And suit1 = suit10) Or (card2 = card10 And suit2 = suit10) Or (card3 = card10 And suit3 = suit10) Or (card4 = card10 And suit4 = suit10) Or (card6 = card10 And suit6 = suit10) Or (card7 = card10 And suit7 = suit10) Or (card8 = card10 And suit8 = suit10) Or (card9 = card10 And suit9 = suit10) card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cpucardtotal = card6 + card7 + card8 + card9 + card10 If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf EndWhile If card10 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card10 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 21 Then TextWindow.WriteLine("5 CARD CHARLIE!? You Lost! ") EndIf EndIf EndIf EndIf TextWindow.WriteLine(cardtotal) If hitorstay = "Hit" Or hitorstay = "HIT" Or hitorstay = "hit" Then TextWindow.WriteLine("Do you want to hit or stay? ") hitorstay = TextWindow.Read() While (hitorstay > 0 Or hitorstay < 0) Or (hitorstay <> "Hit" And hitorstay <> "hit" And hitorstay <> "HIT" And hitorstay <> "Stay" And hitorstay <> "stay" And hitorstay <> "STAY") TextWindow.WriteLine("I said HIT OR STAY! 2 words to choose from! IT'S SIMPLE!") hitorstay = TextWindow.Read() EndWhile EndIf If hitorstay = "Hit" Or hitorstay = "hit" Or hitorstay = "HIT" Then card5 = Math.GetRandomNumber(13) suit5 = Math.GetRandomNumber(4) card = card5 suit = suit5 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 + card4 + card5 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal - 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf If card4 = 11 Then cardtotal = cardtotal - 1 EndIf If card4 = 12 Then cardtotal = cardtotal - 2 EndIf If card4 = 13 Then cardtotal = cardtotal - 3 EndIf If card5 = 11 Then cardtotal = cardtotal - 1 EndIf If card5 = 12 Then cardtotal = cardtotal - 2 EndIf If card5 = 13 Then cardtotal = cardtotal - 3 EndIf While (card1 = card5 And suit1 = suit5) Or (card2 = card5 And suit2 = suit5) Or (card3 = card5 And suit3 = suit5) Or (card4 = card5 And suit4 = suit5) Or (card5 = card6 And suit5 = suit6) card5 = Math.GetRandomNumber(13) suit5 = Math.GetRandomNumber(4) card = card5 suit = suit5 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" cardtotal = card1 + card2 + card3 + card4 + card5 If card1 = 11 Then cardtotal = cardtotal - 1 EndIf If card1 = 12 Then cardtotal = cardtotal - 2 EndIf If card1 = 13 Then cardtotal = cardtotal - 3 EndIf If card2 = 11 Then cardtotal = cardtotal - 1 EndIf If card2 = 12 Then cardtotal = cardtotal - 2 EndIf If card2 = 13 Then cardtotal = cardtotal - 3 EndIf If card3 = 11 Then cardtotal = cardtotal - 1 EndIf If card3 = 12 Then cardtotal = cardtotal - 2 EndIf If card3 = 13 Then cardtotal = cardtotal - 3 EndIf If card4 = 11 Then cardtotal = cardtotal - 1 EndIf If card4 = 12 Then cardtotal = cardtotal - 2 EndIf If card4 = 13 Then cardtotal = cardtotal - 3 EndIf If card5 = 11 Then cardtotal = cardtotal - 1 EndIf If card5 = 12 Then cardtotal = cardtotal - 2 EndIf If card5 = 13 Then cardtotal = cardtotal - 3 EndIf EndWhile TextWindow.WriteLine(cardtotal) If cardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Lost! ") TextWindow.Pause() Program.End() EndIf If cardtotal < 21 Then TextWindow.WriteLine("5 CARD CHARLIE! Good Job! You Win! ") TextWindow.Pause() Program.End() EndIf EndIf If (hitorstay = "Stay" Or hitorstay = "stay" Or hitorstay = "STAY") And cpucardtotal < 17 Then card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 While (card1 = card7 And suit1 = suit7) Or (card2 = card7 And suit2 = suit7) Or (card3 = card7 And suit3 = suit7) Or (card4 = card7 And suit4 = suit7) Or (card5 = card7 And suit5 = suit7) Or (card6 = card7 And suit6 = suit7) card7 = Math.GetRandomNumber(13) suit7 = Math.GetRandomNumber(4) card = card7 suit = suit7 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card7 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card7 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card7 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 EndWhile If card6 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card6 = 1 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card7 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If (card6 = 1 And card7 = 10) Or (card6 = 10 And card7 = 1) Or cpucardtotal = 21 Then TextWindow.WriteLine("BLACKJACK!? You Lost! ") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 While (card1 = card8 And suit1 = suit8) Or (card2 = card8 And suit2 = suit8) Or (card3 = card8 And suit3 = suit8) Or (card4 = card8 And suit4 = suit8) Or (card5 = card8 And suit5 = suit8) Or (card6 = card8 And suit6 = suit8) Or (card7 = card8 And suit7 = suit8) card8 = Math.GetRandomNumber(13) suit8 = Math.GetRandomNumber(4) card = card8 suit = suit8 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card8 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card8 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card8 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 EndWhile EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card8 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 17 Then card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 While (card1 = card9 And suit1 = suit9) Or (card2 = card9 And suit2 = suit9) Or (card3 = card9 And suit3 = suit9) Or (card4 = card9 And suit4 = suit9) Or (card5 = card9 And suit5 = suit9) Or (card6 = card9 And suit6 = suit9) Or (card7 = card9 And suit7 = suit9) Or (card8 = card9 And card8 = suit9) card9 = Math.GetRandomNumber(13) suit9 = Math.GetRandomNumber(4) card = card9 suit = suit9 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card9 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card9 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card9 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 EndWhile If card9 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card9 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cardtotal > cpucardtotal And cardtotal < 21 And cpucardtotal > 17 And cpucardtotal < 21 Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal < 17 Then card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 While (card1 = card10 And suit1 = suit10) Or (card2 = card10 And suit2 = suit10) Or (card3 = card10 And suit3 = suit10) Or (card4 = card10 And suit4 = suit10) Or (card5 = card10 And suit5 = suit10) Or (card6 = card10 And suit6 = suit10) Or (card7 = card10 And suit7 = suit10) Or (card8 = card10 And suit8 = suit10) Or (card9 = card10 And suit9 = suit10) card10 = Math.GetRandomNumber(13) suit10 = Math.GetRandomNumber(4) card = card10 suit = suit10 PrintCard() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" If card10 = 11 Then cpucardtotal = cpucardtotal - 1 EndIf If card10 = 12 Then cpucardtotal = cpucardtotal - 2 EndIf If card10 = 13 Then cpucardtotal = cpucardtotal - 3 EndIf cpucardtotal = card6 + card7 + card8 + card9 + card10 EndWhile If card10 = 1 And cpucardtotal < 12 And cardtotal < cpucardtotal + 10 And cpucardtotal + 10 > 16 And cpucardtotal + 10 < 22 Then cpucardtotal = cpucardtotal + 10 EndIf If card10 = 1 And cpucardtotal < 12 And cardtotal > cpucardtotal + 10 Then oneor11 = Math.GetRandomNumber(2) If oneor11 = 1 Then cpucardtotal = cpucardtotal + 0 ElseIf oneor11 = 2 Then cpucardtotal = cpucardtotal + 10 EndIf EndIf TextWindow.WriteLine(cpucardtotal) If cpucardtotal > 21 Then TextWindow.WriteLine("BUSTED! You Won! ") TextWindow.Pause() Program.End() EndIf If cardtotal = cpucardtotal Then TextWindow.WriteLine("A TIE!? You (technaically) Lost! ") EndIf If (cardtotal > cpucardtotal And cardtotal < 21) And (cpucardtotal > 17 And cpucardtotal < 21) Then TextWindow.WriteLine("You Win! " + cardtotal + " beats " + cpucardtotal + "! good job! ") EndIf If cpucardtotal > 17 And cpucardtotal < 21 And cardtotal < cpucardtotal Then TextWindow.WriteLine("Oh No! You Lost! " + cpucardtotal + " beats " + cardtotal + ". ") TextWindow.Pause() Program.End() EndIf If cpucardtotal < 21 Then TextWindow.WriteLine("5 CARD CHARLIE!? You Lost! ") EndIf EndIf EndIf EndIf End>VLH852.sb< Start>VLJ342.sb< TextWindow.Title = "Letter Calculator" start: TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("Please, input a sentence:") TextWindow.WriteLine("") TextWindow.ForegroundColor = "white" read = TextWindow.Read() TextWindow.WriteLine("") length = Text.GetLength(read) TextWindow.ForegroundColor = "green" TextWindow.WriteLine(length + " characters") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.ForegroundColor = "gray" Goto start End>VLJ342.sb< Start>VLJ457-0.sb< 'Kollisions Snippet GraphicsWindow.KeyDown = TasteGedrueckt Fenster() Shape() Sub Fenster GraphicsWindow.Height = 500 GraphicsWindow.Width = 500 GraphicsWindow.Title = "Kollisions Snippet" GraphicsWindow.Left = Desktop.Width/2 - GraphicsWindow.Width/2 GraphicsWindow.Top = Desktop.Height/2 - GraphicsWindow.Height/2 GraphicsWindow.ShowMessage("Mit den Pfeiltasten wird gesteuert.", "Steuerung") EndSub Sub Shape GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" Shape[1][1][0] = Shapes.AddEllipse(25, 25) Shape[1][1][1] = 25 'Breite Shape[1][1][2] = 25 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Blue" Shape[2][1][0] = Shapes.AddRectangle(60, 70) Shape[2][1][1] = 60 'Breite Shape[2][1][2] = 70 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Green" Shape[2][2][0] = Shapes.AddTriangle(40, 5, 10, 55, 70, 55) Shape[2][2][1] = 60 'Breite Shape[2][2][2] = 50 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Brown" Shape[2][3][0] = Shapes.AddRectangle(130, 20) Shape[2][3][1] = 130 'Breite Shape[2][3][2] = 20 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Black" Shape[2][4][0] = Shapes.AddRectangle(30, 250) Shape[2][4][1] = 30 'Breite Shape[2][4][2] = 250 'Höhe Shapes.Move(Shape[1][1][0], GraphicsWindow.Width/2-12.5, GraphicsWindow.Height/2-12.5) Shapes.Move(Shape[2][1][0], 400, 30) Shapes.Move(Shape[2][3][0], 310, 430) Shapes.Move(Shape[2][4][0], 60, 140) EndSub Sub Kollisionscheck xPosPlayer1 = Shapes.GetLeft(Shape[1][1][0]) yPosPlayer1 = Shapes.GetTop(Shape[1][1][0]) xPosPlayer2 = Shapes.GetLeft(Shape[1][1][0])+12.5 yPosPlayer2 = Shapes.GetTop(Shape[1][1][0])+12.5 For i = 1 To Array.GetItemCount(Shape)-1 TextWindow.WriteLine(Array.GetItemCount(Shape[2])) 'This should be 4, because there are 4 different Arrays xPosKol1 = Shapes.GetLeft(Shape[2][i][0]) yPosKol1 = Shapes.GetTop(Shape[2][i][0]) xPosKol2 = Shapes.GetLeft(Shape[2][i][0])+Shape[2][i][1] yPosKol2 = Shapes.GetTop(Shape[2][i][0])+Shape[2][i][2] If xPosPlayer1 = xPosKol2 Or xPosPlayer1 < xPosKol2 And xPosPlayer1 > xPosKol1 Then Rechts() ElseIf xPosPlayer2 = xPosKol1 Or xPosPlayer2 > xPosKol1 And xPosPlayer1 < xPosKol2 Then Links() ElseIf yPosPlayer1 = yPosKol2 Or yPosPlayer1 < yPosKol2 And yPosPlayer1 > yPosKol1 Then Runter() ElseIf yPosPlayer2 = yPosKol1 Or yPosPlayer2 > yPosKol1 And yPosPlayer1 < yPosKol2 Then Hoch() EndIf EndFor EndSub Sub TasteGedrueckt GT = GraphicsWindow.LastKey If GT = "Up" Then Hoch() ElseIf GT = "Down" Then Runter() ElseIf GT = "Left" Then Links() ElseIf GT = "Right" Then Rechts() EndIf EndSub Sub Hoch xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos, yPos-2) Kollisionscheck() EndSub Sub Runter xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos, yPos+2) Kollisionscheck() EndSub Sub Links xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos-2, yPos) Kollisionscheck() EndSub Sub Rechts xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos+2, yPos) Kollisionscheck() EndSub End>VLJ457-0.sb< Start>VLJ457.sb< 'Kollisions Snippet GraphicsWindow.KeyDown = TasteGedrueckt Fenster() Shape() Sub Fenster GraphicsWindow.Height = 500 GraphicsWindow.Width = 500 GraphicsWindow.Title = "Kollisions Snippet" GraphicsWindow.Left = Desktop.Width/2 - GraphicsWindow.Width/2 GraphicsWindow.Top = Desktop.Height/2 - GraphicsWindow.Height/2 GraphicsWindow.ShowMessage("Mit den Pfeiltasten wird gesteuert.", "Steuerung") EndSub Sub Shape GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" Shape[1][1][0] = Shapes.AddEllipse(25, 25) Shape[1][1][1] = 25 'Breite Shape[1][1][2] = 25 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Blue" Shape[2][1][0] = Shapes.AddRectangle(60, 70) Shape[2][1][1] = 60 'Breite Shape[2][1][2] = 70 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Green" Shape[2][2][0] = Shapes.AddTriangle(40, 5, 10, 55, 70, 55) Shape[2][2][1] = 60 'Breite Shape[2][2][2] = 50 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Brown" Shape[2][3][0] = Shapes.AddRectangle(130, 20) Shape[2][3][1] = 130 'Breite Shape[2][3][2] = 20 'Höhe GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "Black" Shape[2][4][0] = Shapes.AddRectangle(30, 250) Shape[2][4][1] = 30 'Breite Shape[2][4][2] = 250 'Höhe Shapes.Move(Shape[1][1][0], GraphicsWindow.Width/2-12.5, GraphicsWindow.Height/2-12.5) Shapes.Move(Shape[2][1][0], 400, 30) Shapes.Move(Shape[2][3][0], 310, 430) Shapes.Move(Shape[2][4][0], 60, 140) EndSub Sub Kollisionscheck xPosPlayer1 = Shapes.GetLeft(Shape[1][1][0]) yPosPlayer1 = Shapes.GetTop(Shape[1][1][0]) xPosPlayer2 = Shapes.GetLeft(Shape[1][1][0])+12.5 yPosPlayer2 = Shapes.GetTop(Shape[1][1][0])+12.5 For i = 1 To Array.GetItemCount(Shape[2]) TextWindow.WriteLine(Array.GetItemCount(Shape[2])) 'This should be 4, because there are 4 different Arrays xPosKol1 = Shapes.GetLeft(Shape[2][i][0]) yPosKol1 = Shapes.GetTop(Shape[2][i][0]) xPosKol2 = Shapes.GetLeft(Shape[2][i][0])+Shape[2][i][1] yPosKol2 = Shapes.GetTop(Shape[2][i][0])+Shape[2][i][2] If xPosPlayer1 = xPosKol2 Or xPosPlayer1 < xPosKol2 And xPosPlayer1 > xPosKol1 Then Rechts() ElseIf xPosPlayer2 = xPosKol1 Or xPosPlayer2 > xPosKol1 And xPosPlayer1 < xPosKol2 Then Links() ElseIf yPosPlayer1 = yPosKol2 Or yPosPlayer1 < yPosKol2 And yPosPlayer1 > yPosKol1 Then Runter() ElseIf yPosPlayer2 = yPosKol1 Or yPosPlayer2 > yPosKol1 And yPosPlayer1 < yPosKol2 Then Hoch() EndIf EndFor EndSub Sub TasteGedrueckt GT = GraphicsWindow.LastKey If GT = "Up" Then Hoch() ElseIf GT = "Down" Then Runter() ElseIf GT = "Left" Then Links() ElseIf GT = "Right" Then Rechts() EndIf EndSub Sub Hoch xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos, yPos-2) Kollisionscheck() EndSub Sub Runter xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos, yPos+2) Kollisionscheck() EndSub Sub Links xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos-2, yPos) Kollisionscheck() EndSub Sub Rechts xPos = Shapes.GetLeft(Shape[1][1][0]) yPos = Shapes.GetTop(Shape[1][1][0]) Shapes.Move(Shape[1][1][0], xPos+2, yPos) Kollisionscheck() EndSub End>VLJ457.sb< Start>VLM306.sb< 'Small Basic Curriculum - lesson 2.4 'this program asks the user to input their house number and street name. 'the house number is checked For errors and only when it is deemed correct is the user 'asked for their address. 'house number entered - checked to ensure that it is a whole number between 0 and 999 start: TextWindow.writeline("please enter a House number between 0 and 999: ") housenum = TextWindow.Read() zerostart = Text.StartsWith(housenum,0) decinum = Text.IsSubText(housenum,".") 'subroutines called during housenumber error checks If housenum <0 Then numerror() Goto start ElseIf housenum > 999 then numerror() Goto start elseif zerostart = "true" then numerror() Goto start elseif decinum = "true" then numerror() Goto start else Goto street endif 'subroutine called when housenumber is accepted street: numcorrect() fulladdr = Text.Append(housenum, " "+streetname) textwindow.Write("Thank you, Your full address is; " + fulladdr+"? Y/N: ") addrconfirm = TextWindow.Read() TextWindow.WriteLine("") If addrconfirm = "y" then TextWindow.WriteLine("Thank You") Program.Delay(150) Sound.PlayMusic("O5 C8 C8 G8 G8 A8 A8 G4") else Goto start endif 'subroutine to sound a bell when a house number is entered incorrectly Sub numerror Sound.PlayBellRing() Program.Delay(150) endsub 'subroutine to sound achime and prompt the user forr street nameif house number is entered correctly Sub numcorrect Sound.PlayChime() Program.Delay(150) TextWindow.WriteLine("Please enter your street name: ") streetname = TextWindow.Read() EndSub 'spaceaddr = Text.GetIndexOf(fulladdr, " ") 'TextWindow.Write(spaceaddr) 'spaceaddrnext = Text.GetSubTextToEnd(fulladdr, spaceaddr+1) 'TextWindow.WriteLine(spaceaddrnext) 'space2 = Text.GetIndexOf(spaceaddrnext, " ") 'textWindow.WriteLine(space2) 'spaceaddr2 = (spaceaddr + space2) ''TextWindow.WriteLine(spaceaddr2) 'Text. End>VLM306.sb< Start>VLN842.sb< 'Variables CurrentMenu = "MainMenu" RandomSymbol1 = "" RandomSymbol2 = "" RandomSymbol3 = "" CanDoSymbolRoll = "Yes" HandleClicked = "No" CanClickHandle = "Yes" DoingSymbolRoll = "No" CurrentMoney = 100 CurrentPayout = 0 TimerOn = "No" CanPlayHandleSnd = "Yes" 'Images ImgBtn = "http://i.stack.imgur.com/IYtSy.png" ImgMMBackground = "https://lh3.ggpht.com/0U2EjcQgYcvc2dKLUyd13hkZt7l2k4lE6tB0z3-IPfPUYpMGSSVREq-IQ0Q6em0r7w=h900" ImgSlotMachine = "http://vignette2.wikia.nocookie.net/capx/images/5/5c/Slot_machine_with_key.png/revision/latest?cb=20130430031220" ImgTopMenu = "https://camo.githubusercontent.com/ea0dac1ccfffa8be8beff9f9b8f0142295ae914e/687474703a2f2f7331372e706f7374696d6167652e6f72672f38687865746e7a30762f616374696f6e5f426c61636b5f427574746f6e5f32782e706e67" ImgHandle = "https://social.msdn.microsoft.com/Forums/getfile/650084" ImgHandleHand = "http://icons.iconarchive.com/icons/anton-gerasimenko/simpsons/128/Hand-icon.png" ImgBackSlot = "http://i96.photobucket.com/albums/l185/nicosci2006/portfolio/button.png" ImgTakeMyMoney = "https://ip.bitcointalk.org/?u=http%3A%2F%2Fih1.redbubble.net%2Fimage.13863766.9187%2Fsticker%2C375x360.u2.png&t=549&c=Cs2ucCnRDXq21w" ImgLeaving = "http://www.bellyfeel.co.uk/bfblog/wp-content/uploads/2014/09/TSTO-Pic.png" ImgJackpot = "http://www.mcxprofits.com/images/jackpot_img.png" ImgMoney = "http://www.sorryopenerp.com/img/apps/money.png" ImgBroke = "http://www.allianceforwomenandchildren.org/site_images/wee_clipart2.png" 'Sounds SndHandle = "http://rickmurphy.byethost5.com/SmallBasic/ProgramListing/SlotMachine/assets/handleSFX.au" 'Window GraphicsWindow.Hide() GraphicsWindow.Title = "Vegas Slot" GraphicsWindow.Width = 768 GraphicsWindow.Height = 549 GraphicsWindow.Left = (Desktop.Width - 768) / 2 GraphicsWindow.Top = (Desktop.Height - 639) / 2 GraphicsWindow.CanResize = "False" GraphicsWindow.FontBold = "False" 'MainMenu MMBackground = Shapes.AddImage(ImgMMBackground) Shapes.Zoom(MMBackground, 0.75, 0.8) Shapes.Move(MMBackground, 0, -51) MMBtnBackPlay = Shapes.AddImage(ImgBtn) Shapes.Move(MMBtnBackPlay, 325, 404) MMBtnBackExit = Shapes.AddImage(ImgBtn) Shapes.Move(MMBtnBackExit, 325, 461) GraphicsWindow.FontName = "Ravie" GraphicsWindow.FontSize = 17 GraphicsWindow.BrushColor = "White" MMLblPlay = Shapes.AddText("Play") Shapes.Move(MMLblPlay, 362, 412) MMLblExit = Shapes.AddText("Exit") Shapes.Move(MMLblExit, 362, 470) MMBtnPlay = Controls.AddButton("", 325, 404) Controls.SetSize(MMBtnPlay, 127, 42) Shapes.SetOpacity(MMBtnPlay, 0) MMBtnExit = Controls.AddButton("", 325, 461) Controls.SetSize(MMBtnExit, 127, 42) Shapes.SetOpacity(MMBtnExit, 0) GraphicsWindow.Show() 'SUBROUTINES '*************** 'MouseMove GraphicsWindow.MouseMove = MouseMove Sub MouseMove x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If CurrentMenu = "MainMenu" Then If x > Shapes.GetLeft(MMBtnBackPlay) And x < Shapes.GetLeft(MMBtnBackPlay) + 127 And y > Shapes.GetTop(MMBtnBackPlay) And y < Shapes.GetTop(MMBtnBackPlay) + 42 Then Shapes.Zoom(MMBtnBackPlay, 1.2, 1.1) Shapes.Zoom(MMLblPlay, 1.2, 1.1) ElseIf x > Shapes.GetLeft(MMBtnBackExit) And x < Shapes.GetLeft(MMBtnBackExit) + 127 And y > Shapes.GetTop(MMBtnBackExit) And y < Shapes.GetTop(MMBtnBackExit) + 42 Then Shapes.Zoom(MMBtnBackExit, 1.2, 1.1) Shapes.Zoom(MMLblExit, 1.2, 1.1) Else Shapes.Zoom(MMBtnBackPlay, 1, 1) Shapes.Zoom(MMLblPlay, 1, 1) Shapes.Zoom(MMBtnBackExit, 1, 1) Shapes.Zoom(MMLblExit, 1, 1) EndIf ElseIf CurrentMenu = "GameOn" Then If HandleClicked = "Yes" Then Shapes.Move(GOHandle, 778, y - 24) Shapes.Move(GOHandleHand, 732, y - 15) Mouse.MouseX = (Desktop.Width - GraphicsWindow.Width) + 540 HandleLeft = Shapes.GetLeft(GOHandle) HandleTop = Shapes.GetTop(GOHandle) If HandleTop >= 399 Then HandleClicked = "No" CurrentMoney = CurrentMoney - 10 Mouse.HideCursor() Shapes.SetText(GOMoney, CurrentMoney) ResetHandle() RefreshSymbols() DoSymbolRoll() ElseIf HandleTop > 150 Then If CanPlayHandleSnd = "Yes" Then CanPlayHandleSnd = "No" Sound.Stop(SndHandle) Sound.Play(SndHandle) EndIf EndIf EndIf ElseIf CurrentMenu = "NoMoneyMenu" Then If x > Shapes.GetLeft(NMMBackContinue) And x < Shapes.GetLeft(NMMBackContinue) + 370 And y > Shapes.GetTop(NMMBackContinue) And y < Shapes.GetTop(NMMBackContinue) + 310 Then Shapes.SetOpacity(NMMBtnYes, 35) ElseIf x > Shapes.GetLeft(NMMBackExit) And x < Shapes.GetLeft(NMMBackExit) + 280 And y > Shapes.GetTop(NMMBackExit) And y < Shapes.GetTop(NMMBackExit) + 310 Then Shapes.SetOpacity(NMMBtnNo, 35) Else Shapes.SetOpacity(NMMBtnYes, 10) Shapes.SetOpacity(NMMBtnNo, 10) EndIf EndIf EndSub 'MouseDown GraphicsWindow.MouseDown = MouseDown Sub MouseDown x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If CurrentMenu = "GameOn" Then HandleLeft = Shapes.GetLeft(GOHandle) HandleTop = Shapes.GetTop(GOHandle) If CanClickHandle = "Yes" Then If x > HandleLeft And x < HandleLeft + 45 And y > HandleTop And y < HandleTop + 45 Then Sound.PlayClick() Mouse.HideCursor() Shapes.ShowShape(GOHandleHand) HandleClicked = "Yes" CanClickHandle = "No" EndIf EndIf EndIf EndSub 'MouseUp GraphicsWindow.MouseUp = MouseUp Sub MouseUp x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If CurrentMenu = "GameOn" Then If HandleClicked = "Yes" Then Shapes.HideShape(GOHandleHand) ResetHandle() If DoingSymbolRoll = "No" Then CanClickHandle = "Yes" EndIf HandleClicked = "No" EndIf EndIf EndSub 'ButtonClicked Controls.ButtonClicked = ButtonClicked Sub ButtonClicked If CurrentMenu = "MainMenu" Then If Controls.LastClickedButton = MMBtnPlay Then Sound.PlayClick() GraphicsWindow.Hide() RemoveMainMenu() StartGame() ElseIf Controls.LastClickedButton = MMBtnExit Then Sound.PlayClickAndWait() Program.End() EndIf ElseIf CurrentMenu = "NoMoneyMenu" Then If Controls.LastClickedButton = NMMBtnYes Then Sound.PlayClick() HideNoMoneyMenu() ShowDrawFromPayout() ElseIf Controls.LastClickedButton = NMMBtnNo Then Sound.PlayClickAndWait() Program.End() EndIf ElseIf CurrentMenu = "DrawFromPayout" Then If Controls.LastClickedButton = DFPBtnConfirm Then Sound.PlayClick() GetAmount = Controls.GetTextBoxText(DFPTBPayoutAmount) If GetAmount > 0 And GetAmount <= CurrentPayout Then CurrentMoney = CurrentMoney + GetAmount CurrentPayout = CurrentPayout - GetAmount Shapes.SetText(GOMoney, CurrentMoney) Shapes.SetText(GOPayout, CurrentPayout) HideDrawFromPayout() ShowGameMenu() Else Sound.PlayClick() GraphicsWindow.ShowMessage("You can't draw " + GetAmount + " dollars.", "Information") Sound.PlayClick() EndIf EndIf ElseIf CurrentMenu = "DefeatMenu" Then If Controls.LastClickedButton = DMBtnNo Then Sound.PlayClickAndWait() Program.End() ElseIf Controls.LastClickedButton = DMBtnYes Then Sound.PlayClick() HideDefeatMenu() CurrentMoney = 100 Shapes.SetText(GOMoney, 100) ShowGameMenu() CurrentMenu = "GameOn" CanClickHandle = "Yes" EndIf EndIf EndSub 'RemoveMainMenu Sub RemoveMainMenu Shapes.Remove(MMBackground) Shapes.Remove(MMBtnBackPlay) Shapes.Remove(MMBtnBackExit) Shapes.Remove(MMLblPlay) Shapes.Remove(MMLblExit) Controls.Remove(MMBtnPlay) Controls.Remove(MMBtnExit) Sound.Play(SndHandle) Sound.Stop(SndHandle) EndSub 'StartGame Sub StartGame GOSlotMachine = Shapes.AddImage(ImgSlotMachine) Shapes.Move(GOSlotMachine, 0, 0) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(15, 15, 15) GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(15, 15, 15) GOShieldCredit = Shapes.AddRectangle(125, 25) Shapes.Move(GOShieldCredit, 215, 504) GOShieldPayout = Shapes.AddRectangle(125, 25) Shapes.Move(GOShieldPayout, 425, 504) GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = "LimeGreen" GraphicsWindow.FontSize = 20 GOMoney = Shapes.AddText("100") Shapes.Move(GOMoney, 232, 502) GOPayout = Shapes.AddText(0) Shapes.Move(GOPayout, 447, 504) GOHandleBackground = Shapes.AddImage(ImgTopMenu) Shapes.Rotate(GOHandleBackground, 90) Shapes.Zoom(GOHandleBackground, 0.85, 1.7) Shapes.Move(GOHandleBackground, 525, 89) GOBackSlot1 = Shapes.AddImage(ImgBackSlot) Shapes.Zoom(GOBackSlot1, 0.56, 2.18) Shapes.Move(GOBackSlot1, 60, 139) Shapes.SetOpacity(GOBackSlot1, 50) GOBackSlot2 = Shapes.AddImage(ImgBackSlot) Shapes.Zoom(GOBackSlot2, 0.56, 2.18) Shapes.Move(GOBackSlot2, 240, 139) Shapes.SetOpacity(GOBackSlot2, 50) GOBackSlot3 = Shapes.AddImage(ImgBackSlot) Shapes.Zoom(GOBackSlot3, 0.56, 2.18) Shapes.Move(GOBackSlot3, 420, 139) Shapes.SetOpacity(GOBackSlot3, 50) GraphicsWindow.FontName = "Webdings" GraphicsWindow.FontSize = 150 GraphicsWindow.FontBold = "False" RefreshSymbols() GOHandle = Shapes.AddImage(ImgHandle) Shapes.Move(GOHandle, 778, 25) GOHandleHand = Shapes.AddImage(ImgHandleHand) Shapes.Move(GOHandleHand, 732, 30) Shapes.Rotate(GOHandleHand, -8) Shapes.HideShape(GOHandleHand) HideMainMenu() GraphicsWindow.Width = 840 GraphicsWindow.Left = (Desktop.Width - 840) / 2 JackpotImage = Shapes.AddImage(ImgJackpot) Shapes.HideShape(JackpotImage) Shapes.Move(JackpotImage, (GraphicsWindow.Width - 290) / 2, (GraphicsWindow.Height - 235) / 2) GraphicsWindow.Show() CurrentMenu = "GameOn" EndSub 'HideMainMenu Sub HideMainMenu Shapes.HideShape(MMBackground) Shapes.HideShape(MMBtnBackPlay) Shapes.HideShape(MMBtnBackExit) Shapes.HideShape(MMLblPlay) Shapes.HideShape(MMLblExit) Controls.HideControl(MMBtnPlay) Controls.HideControl(MMBtnExit) EndSub 'ShowOptionsMenu Sub ShowOptionsMenu CurrentMenu = "Options" EndSub 'HideOptionsMenu Sub HideOptionsMenu EndSub 'StartRound Sub StartRound RandomNum1 = Math.GetRandomNumber(5) RandomNum2 = Math.GetRandomNumber(5) RandomNum3 = Math.GetRandomNumber(5) CalculateSymbols() RandomSymbol1 = RandomNum1 RandomSymbol2 = RandomNum2 RandomSymbol3 = RandomNum3 Shapes.SetText(GOSymbol1, RandomSymbol1) Shapes.SetText(GOSymbol2, RandomSymbol2) Shapes.SetText(GOSymbol3, RandomSymbol3) EndSub 'CalculateSymbols Sub CalculateSymbols If RandomNum1 = 1 Then RandomNum1 = "L" ElseIf RandomNum1 = 2 Then RandomNum1 = "N" ElseIf RandomNum1 = 3 Then RandomNum1 = "O" ElseIf RandomNum1 = 4 Then RandomNum1 = "U" ElseIf RandomNum1 = 5 Then RandomNum1 = "Z" EndIf If RandomNum2 = 1 Then RandomNum2 = "L" ElseIf RandomNum2 = 2 Then RandomNum2 = "N" ElseIf RandomNum2 = 3 Then RandomNum2 = "O" ElseIf RandomNum2 = 4 Then RandomNum2 = "U" ElseIf RandomNum2 = 5 Then RandomNum2 = "Z" EndIf If RandomNum3 = 1 Then RandomNum3 = "L" ElseIf RandomNum3 = 2 Then RandomNum3 = "N" ElseIf RandomNum3 = 3 Then RandomNum3 = "O" ElseIf RandomNum3 = 4 Then RandomNum3 = "U" ElseIf RandomNum3 = 5 Then RandomNum3 = "Z" EndIf EndSub 'GetRandomColors Sub GetRandomColors x = Math.GetRandomNumber(200) y = Math.GetRandomNumber(200) z = Math.GetRandomNumber(200) EndSub 'CheckForJackpot Sub CheckForJackpot If CurrentRound = 10000 Then DoingSymbolRoll = "No" CurrentRound = 0 If RandomSymbol1 = RandomSymbol2 And RandomSymbol1 = RandomSymbol3 And RandomSymbol2 = RandomSymbol3 Then Jackpot() EndIf CanClickHandle = "Yes" EndIf EndSub 'DoSymbolRoll Sub DoSymbolRoll DoingSymbolRoll = "Yes" For Times = 1 To 10000 StartRound() CurrentRound = CurrentRound + 1 CheckForJackpot() EndFor If CurrentMoney <= 0 Then CanClickHandle = "No" HideGameMenu() ShowNoMoneyMenu() EndIf EndSub 'ResetHandle Sub ResetHandle Mouse.ShowCursor() Shapes.HideShape(GOHandleHand) If Shapes.GetTop(GOHandle) > 300 Then Shapes.Animate(GOHandle, 778, 25, 1000) Shapes.Animate(GOHandleHand, 732, 30, 1000) ElseIf Shapes.GetTop(GOHandle) < 300 Then Shapes.Animate(GOHandle, 778, 25, 500) Shapes.Animate(GOHandleHand, 732, 30, 500) EndIf CanPlayHandleSnd = "Yes" EndSub 'RefreshSymbols Sub RefreshSymbols Shapes.Remove(GOSymbol1) Shapes.Remove(GOSymbol2) Shapes.Remove(GOSymbol3) GetRandomColors() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(x, y, z) GOSymbol1 = Shapes.AddText(RandomSymbol1) Shapes.Move(GOSymbol1, 130, 149) GetRandomColors() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(x, y, z) GOSymbol2 = Shapes.AddText(RandomSymbol2) Shapes.Move(GOSymbol2, 310, 149) GetRandomColors() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(x, y, z) GOSymbol3 = Shapes.AddText(RandomSymbol3) Shapes.Move(GOSymbol3, 490, 149) EndSub 'HideGameMenu Sub HideGameMenu Shapes.HideShape(GOSlotMachine) Shapes.HideShape(GOBackSlot1) Shapes.HideShape(GOBackSlot2) Shapes.HideShape(GOBackSlot3) Shapes.HideShape(GOSymbol1) Shapes.HideShape(GOSymbol2) Shapes.HideShape(GOSymbol3) Shapes.HideShape(GOHandle) Shapes.HideShape(GOHandleHand) Shapes.HideShape(GOHandleBackground) Shapes.HideShape(GOShieldCredit) Shapes.HideShape(GOShieldPayout) Shapes.HideShape(GOMoney) Shapes.HideShape(GOPayout) EndSub 'Jackpot Sub Jackpot CanClickHandle = "No" Sound.PlayBellRing() Shield = Shapes.AddRectangle(GraphicsWindow.Width, GraphicsWindow.Height) Shapes.SetOpacity(Shield, 0) Shapes.HideShape(GOSymbol1) Shapes.HideShape(GOSymbol2) Shapes.HideShape(GOSymbol3) Shapes.ShowShape(JackpotImage) For i = 1 To 2 Step 0.00005 Shapes.Zoom(JackpotImage, i, i) EndFor CurrentPayout = CurrentPayout + 100 Shapes.SetText(GOPayout, CurrentPayout) Shapes.HideShape(JackpotImage) Shapes.Zoom(JackpotImage, 1, 1) Shapes.Remove(Shield) Shapes.ShowShape(GOSymbol1) Shapes.ShowShape(GOSymbol2) Shapes.ShowShape(GOSymbol3) CanClickHandle = "Yes" EndSub 'PullHandleAnimation Sub PullHandleAnimation Shapes.ShowShape(GOHandleHand) Shapes.Animate(GOHandle, 778, 399, 1000) Shapes.Animate(GOHandleHand, 732, 399, 1000) EndSub 'ShowNoMoneyMenu Sub ShowNoMoneyMenu If CurrentPayout > 0 Then CurrentMenu = "NoMoneyMenu" GraphicsWindow.PenColor = "GoldenRod" GraphicsWindow.BrushColor = "GoldenRod" NMMBackground = Shapes.AddRectangle(GraphicsWindow.Width, GraphicsWindow.Height) Shapes.SetOpacity(NMMBackground, 0) For Appear = 0 To 100 Step 0.009 Shapes.SetOpacity(NMMBackground, Appear) EndFor GraphicsWindow.BrushColor = "DarkGoldenRod" GraphicsWindow.PenColor = "Yellow" NMMBackExit = Shapes.AddRectangle(280, 310) Shapes.HideShape(NMMBackExit) Shapes.Move(NMMBackExit, 40, 230) NMMLeaving = Shapes.AddImage(ImgLeaving) Shapes.HideShape(NMMLeaving) Shapes.Move(NMMLeaving, 50, 270) Shapes.Zoom(NMMLeaving, 0.5, 0.5) NMMBackContinue = Shapes.AddRectangle(370, 310) Shapes.HideShape(NMMBackContinue) Shapes.Move(NMMBackContinue, 405, 230) NMMTakeMyMoney = Shapes.AddImage(ImgTakeMyMoney) Shapes.HideShape(NMMTakeMyMoney) Shapes.Move(NMMTakeMyMoney, 400, 220) GraphicsWindow.BrushColor = "DarkGoldenRod" GraphicsWindow.PenColor = "Yellow" NMMBackTitle = Shapes.AddRectangle(768, 100) Shapes.HideShape(NMMBackTitle) Shapes.Move(NMMBackTitle, 20, 20) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontName = "Ravie" GraphicsWindow.FontSize = 18 NMMLblNo = Shapes.AddText("NO") Shapes.HideShape(NMMLblNo) Shapes.Move(NMMLblNo, 165, 240) NMMLblYes = Shapes.AddText("YES") Shapes.HideShape(NMMLblYes) Shapes.Move(NMMLblYes, 570, 240) NMMTitle = Shapes.AddText("You have 0 money left but you can draw money from your") Shapes.HideShape(NMMTitle) Shapes.Move(NMMTitle, 50, 30) NMMTitle2 = Shapes.AddText("payout. Your current payout is " + CurrentPayout + ". Would you like to take") Shapes.HideShape(NMMTitle2) Shapes.Move(NMMTitle2, 50, 55) NMMTitle3 = Shapes.AddText("money from your payout and continue playing Vegas Slot?") Shapes.HideShape(NMMTitle3) Shapes.Move(NMMTitle3, 50, 80) NMMBtnYes = Controls.AddButton("", 405, 230) Controls.HideControl(NMMBtnYes) Shapes.SetOpacity(NMMBtnYes, 10) Controls.SetSize(NMMBtnYes, 370, 310) NMMBtnNo = Controls.AddButton("", 40, 230) Controls.HideControl(NMMBtnNo) Shapes.SetOpacity(NMMBtnNo, 10) Controls.SetSize(NMMBtnNo, 280, 310) Shapes.ShowShape(NMMBackExit) Shapes.ShowShape(NMMLblNo) Shapes.ShowShape(NMMLeaving) Controls.ShowControl(NMMBtnYes) Controls.ShowControl(NMMBtnNo) Shapes.ShowShape(NMMBackContinue) Shapes.ShowShape(NMMLblYes) Shapes.ShowShape(NMMTakeMyMoney) Shapes.ShowShape(NMMTitle) Shapes.ShowShape(NMMTitle2) Shapes.ShowShape(NMMTitle3) Shapes.ShowShape(NMMBackTitle) ElseIf CurrentPayout = 0 Then ShowDefeatMenu() EndIf EndSub 'HideNoMoneyMenu Sub HideNoMoneyMenu Shapes.HideShape(NMMTitle) Shapes.HideShape(NMMTitle2) Shapes.HideShape(NMMTitle3) Shapes.HideShape(NMMBackTitle) Shapes.HideShape(NMMBackContinue) Shapes.HideShape(NMMBackExit) Shapes.HideShape(NMMLblNo) Shapes.HideShape(NMMLblYes) Shapes.HideShape(NMMLeaving) Shapes.HideShape(NMMTakeMyMoney) Controls.HideControl(NMMBtnNo) Controls.HideControl(NMMBtnYes) Shapes.HideShape(NMMBackground) EndSub 'ShowDrawFromPayout Sub ShowDrawFromPayout CurrentMenu = "DrawFromPayout" GraphicsWindow.BrushColor = "GoldenRod" GraphicsWindow.PenColor = "GoldenRod" DFPBackground = Shapes.AddRectangle(GraphicsWindow.Width, GraphicsWindow.Height) DFPMoney = Shapes.AddImage(ImgMoney) Shapes.Move(DFPMoney, (GraphicsWindow.Width - 346) / 2, 10) GraphicsWindow.BrushColor = "DarkGoldenRod" GraphicsWindow.PenColor = "Yellow" DFPBackTitle = Shapes.AddRectangle(500, 50) Shapes.Move(DFPBackTitle, (GraphicsWindow.Width - 500) / 2, 270) GraphicsWindow.BrushColor = "Yellow" DFPTitle = Shapes.AddText("How much money do you wish to draw?") Shapes.Move(DFPTitle, 185, 282) GraphicsWindow.BrushColor = "DarkGoldenRod" DFPBackground2 = Shapes.AddRectangle(500, 130) Shapes.Move(DFPBackground2, (GraphicsWindow.Width - 500) / 2, 350) GraphicsWindow.BrushColor = "Yellow" DFPLbl = Shapes.AddText("Current payout: " + CurrentPayout) Shapes.Move(DFPLbl, (GraphicsWindow.Width - 500) / 1.6, 370) DFPLbl2 = Shapes.AddText("Enter amount:") Shapes.Move(DFPLbl2, (GraphicsWindow.Width - 500) / 1.6, 420) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Microsoft Sans Serif" GraphicsWindow.FontSize = 15 DFPBtnConfirm = Controls.AddButton("Confirm", 570, 490) Controls.SetSize(DFPBtnConfirm, 100, 30) DFPTBPayoutAmount = Controls.AddTextBox((GraphicsWindow.Width - 350) / 1.2, 420) GraphicsWindow.FontName = "Webdings" GraphicsWindow.FontSize = 150 EndSub 'HideDrawFromPayout Sub HideDrawFromPayout Shapes.HideShape(DFPBackground) Shapes.HideShape(DFPBackground2) Shapes.HideShape(DFPBackTitle) Shapes.HideShape(DFPLbl) Shapes.HideShape(DFPLbl2) Shapes.HideShape(DFPMoney) Shapes.HideShape(DFPTBPayoutAmount) Shapes.HideShape(DFPTitle) Controls.HideControl(DFPBtnConfirm) EndSub 'ShowGameMenu Sub ShowGameMenu Shapes.ShowShape(GOSlotMachine) Shapes.ShowShape(GOBackSlot1) Shapes.ShowShape(GOBackSlot2) Shapes.ShowShape(GOBackSlot3) Shapes.ShowShape(GOSymbol1) Shapes.ShowShape(GOSymbol2) Shapes.ShowShape(GOSymbol3) Shapes.ShowShape(GOHandle) Shapes.ShowShape(GOHandleBackground) Shapes.ShowShape(GOShieldCredit) Shapes.ShowShape(GOShieldPayout) Shapes.ShowShape(GOMoney) Shapes.ShowShape(GOPayout) CurrentMenu = "GameOn" CanClickHandle = "Yes" EndSub 'ShowDefeatMenu Sub ShowDefeatMenu CurrentMenu = "DefeatMenu" GraphicsWindow.BrushColor = "GoldenRod" GraphicsWindow.PenColor = "GoldenRod" DMBackground = Shapes.AddRectangle(GraphicsWindow.Width, GraphicsWindow.Height) Shapes.SetOpacity(DMBackground, 0) For Appear = 0 To 100 Step 0.009 Shapes.SetOpacity(DMBackground, Appear) EndFor DMBrokeImg = Shapes.AddImage(ImgBroke) Shapes.Move(DMBrokeImg, (GraphicsWindow.Width - 377) / 2, 50) GraphicsWindow.PenColor = "Yellow" GraphicsWindow.BrushColor = "DarkGoldenRod" GraphicsWindow.FontName = "Ravie" GraphicsWindow.FontSize = 18 DMBackTitle = Shapes.AddRectangle(500, 80) Shapes.Move(DMBackTitle, (GraphicsWindow.Width - 500) / 2, 340) GraphicsWindow.BrushColor = "Yellow" DMTitle = Shapes.AddText("You have 0 money and 0 payout. Do you") Shapes.Move(DMTitle, (GraphicsWindow.Width - 480) / 2, 350) DMTitle2 = Shapes.AddText("wish to play another round?") Shapes.Move(DMTitle2, (GraphicsWindow.Width - 480) / 2, 380) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Microsoft Sans Serif" GraphicsWindow.FontSize = 15 DMBtnNo = Controls.AddButton("No", (GraphicsWindow.Width - 150) / 2, 440) Controls.SetSize(DMBtnNo, 70, 30) DMBtnYes = Controls.AddButton("Yes", 420, 440) Controls.SetSize(DMBtnYes, 70, 30) GraphicsWindow.FontName = "Webdings" GraphicsWindow.FontSize = 150 EndSub 'HideDefeatMenu Sub HideDefeatMenu Shapes.HideShape(DMBackground) Shapes.HideShape(DMBrokeImg) Shapes.HideShape(DMBackTitle) Shapes.HideShape(DMTitle) Shapes.HideShape(DMTitle2) Controls.HideControl(DMBtnNo) Controls.HideControl(DMBtnYes) EndSub End>VLN842.sb< Start>VLP268.sb< Turtle.Speed=10 Turtle.TurnRight () GraphicsWindow.Clear () Turtle.x=110 GraphicsWindow.Title="SB Graphic Cmds syntax" GraphicsWindow.Height=GraphicsWindow.Height*1.2 GraphicsWindow.Width =GraphicsWindow.Width*0.9 GraphicsWindow.BackgroundColor="#00aabb GraphicsWindow.BrushColor="DarkBlue" args=0 f5=3 f_="false t_="True GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=55 GraphicsWindow.FontBold=t_ GraphicsWindow.DrawBoundText(22,22,GraphicsWindow.Width-55,"Font management") GraphicsWindow.BrushColor="White" GraphicsWindow.DrawBoundText(18,18,GraphicsWindow.Width-55,"Font management") GraphicsWindow.BrushColor="DarkBlue" GraphicsWindow.FontSize=15 GraphicsWindow.FontBold=f_ cll=ldtext.Split("White Gray"," ") brr= LDShapes.BrushGradient(cll,"DD") tx=Turtle.x-80 ty=Turtle.y-30 LDShapes.BrushGradientRoundedRectangle(brr,tx,ty,80,60,5) GraphicsWindow.DrawBoundText(tx+2,ty+2,76,"Graphics Window. Font") GraphicsWindow.FontSize=17 GraphicsWindow.FontBold=t_ tt=LDText.Replace ("Italic; =;T/F|Size; =;Ss|Bold; =;T/F|Name; = `;Ffn","`",Text.GetCharacter (34)) dtt=ldtext.Split(tt,"|") For f=0 to 1 LDCall.Function3("wdraw",50*f+10,dtt[f*2+1],dtt[f*2+2]) endfor nl=Text.GetCharacter(13)+Text.GetCharacter(10) nw=Text.GetCharacter(34) ff=nl+"Graphics Window.Font GraphicsWindow.FontName="Lucida console GraphicsWindow.BrushColor="#eeeeff GraphicsWindow.FillRectangle (10,355,GraphicsWindow.Width -10,130) GraphicsWindow.BrushColor="DarkBlue" GraphicsWindow.DrawBoundText(22,362,406,"EXAMPLES:"+nl+ff+"Name = "+nw+"Calibri"+ff+"Size = 22"+ff+"Bold = "+nw+"True"+ff+"Italic ="+nw+"False") Sub wdraw ox=turtle.X oy=turtle.y For x=1 To 5 Turtle.Move(f5) Turtle.Turn(18) EndFor Turtle.Move(args[1]) For x=1 To 5 Turtle.Move(f5) Turtle.Turn(-18) EndFor tx=Turtle.x ty=Turtle.y-10 sb=ldtext.Split (args[2],";") LDShapes.BrushGradientRoundedRectangle(brr,tx,ty,80,30,5) GraphicsWindow.DrawBoundText(tx+2,ty+2,76,sb[1]) For x=0 To Array.GetItemCount (sb)-2 LDShapes.BrushGradientRoundedRectangle(brr,tx+x*35+85,ty,35,30,5) GraphicsWindow.DrawText(tx+x*35+90,ty+2,sb[2+x]) EndFor Turtle.x=ox Turtle.y=oy For x=1 To 5 Turtle.Move(f5) Turtle.Turn(-18) EndFor Turtle.Move(args[1]) For x=1 To 5 Turtle.Move(f5) Turtle.Turn(18) EndFor tx=Turtle.x ty=Turtle.y-10 sb=ldtext.Split (args[3],";") LDShapes.BrushGradientRoundedRectangle(brr,tx,ty,80,30,5) GraphicsWindow.DrawBoundText(tx+2,ty+2,76,sb[1]) For x=0 To Array.GetItemCount (sb)-2 LDShapes.BrushGradientRoundedRectangle(brr,tx+x*35+85,ty,35,30,5) GraphicsWindow.DrawText(tx+x*35+90,ty+2,sb[2+x]) EndFor Turtle.x=ox Turtle.y=oy EndSub End>VLP268.sb< Start>VLP541-0.sb< ' mahreen miangul ID VLP541 ' Duck Shoot Multiple KeyBoard ' JanUary/1st/2019 ' Flip_Horizontal supported by Nonki Takahashi (VLP541-0) GraphicsWindow.top= -2.0 GraphicsWindow.left= 80 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.backgroundcolor = "black" GraphicsWindow.Width = 1280 GraphicsWindow.Height = 666 GraphicsWindow.KeyDown = onkeyDown '=============================Makesprite()============================ SPRITE_init() Add_Shapes() ' ============================== Aircraft Animation====================== dZ = 0.1 zoom = 1 sprite = 5 For ii=1 to 4 '<----**** ddx[ii]=-(2+Math.GetRandomNumber(50)/10) '<----**** Flip_Holizontal() endfor '<----**** ddy=0 bdx=0 bdy=30 bdy2=20 ' - initial ball2 moving speed-Y CNMB="6:1" ' Cannon shapes number=6 repeat =1 shoot="False" 'shoot2="False" zm=1 shootNMB=10 '<----**** ' ============================== Cannon Animation ============================== GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor= "Red" For i=1 to 4 '<----**** ANMB="5:"+i '<----**** Ball[i]=Shapes.AddEllipse(10,20) '<----**** Shapes.Move(Ball[i],shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) '<----**** Shapes.HideShape(Ball[i]) '<----**** sht[i]="False" '<----**** endfor '<----**** GraphicsWindow.BrushColor= "snow" For i=1 to 10 '<----**** Ball2[i]=Shapes.AddEllipse(10,20) '<----**** Shapes.Move(Ball2[i],shapes.GetLeft(shp[CNMB][14]),shapes.Gettop(shp[CNMB][14])) '<----**** Shapes.HideShape(Ball2[i]) '<----**** sht2[i]="False" '<----**** endfor '<----**** ' ==============================Cannon Animation and Blinkig 1====================== While "True" ' NN=NN+1 '<----**** If Math.Remainder(NN,7)=0 Then '<----**** For k=1 To Array.GetItemCount(s[6]) For L=1 To Array.GetItemCount(shape[6])-2 ' Shapes.Rotate(SHP["6:"+k][L],Shape[6][L]["angle"]) EndFor EndFor EndIf DuckBlinking() '<----**** DuckFire() '<----**** CannonFire() '<----**** If Math.Remainder(NN,11)=0 Then '<----**** For k=1 To Array.GetItemCount(s[6]) For L=1 To Array.GetItemCount(shape[6])-2 ' Shapes.Rotate(SHP["6:"+K][L], 0) EndFor EndFor EndIf Program.Delay(25) EndWhile Sub DuckBlinking '============================Duck Blinking Program======================= zoom = zoom - dZ sprite = 5 For ii=1 To 4 '<----**** ANMB="5:"+ii '<----**** ss = s[sprite][ii] For i = 1 To Array.GetItemCount(shape[5]) If Array.ContainsValue(shape[5][i], "eye") Or Array.ContainsValue(shape[5][i], "wing1") Or Array.ContainsValue(shape[5][i], "wing2") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) EndIf If Array.ContainsValue(shape[5][i], "wing1") Or Array.ContainsValue(shape[5][i], "wing2") Then Shapes.Move(shp[ANMB][i], Shapes.GetLeft(shp[ANMB][i]), Shapes.GetTop(shp[ANMB][i])+dZ*20*ss) EndIf Shapes.Move(shp[ANMB][i],Shapes.GetLeft(shp[ANMB][i])+ddx[ii],Shapes.GetTop(shp[ANMB][i])+ddy)'<----**** EndFor ax[ANMB] = ax[ANMB] + ddx[ii] '============================Aircraft Reverse Moving=====X,Y Direction============= cycleX[ii]= shapes.GetLeft(shp[ANMB][9]) '<----**** cycley[ii]= shapes.Gettop(shp[ANMB][9]) '<----**** If cycleX[ii]<-100 Or cycleX[ii]>GraphicsWindow.Width+100 Then'<----**** ddx[ii]=-ddx[ii] '<----**** Flip_Holizontal() EndIf endfor '<----**** If zoom = 0.1 Or zoom = 1 Then dZ = -dZ EndIf EndSub Sub DuckFire ' ===========================BallFire======================================= bn= Math.GetRandomNumber(10) '<----**** For i=1 To 4 '<----**** If sht[i]="True" Then '<----**** Shapes.ShowShape(Ball[i]) '<----**** shapes.Move(Ball[i] ,shapes.GetLeft(ball[i])+bdx/2,shapes.Gettop(ball[i])+bdy/2) '<----**** If shapes.Gettop(ball[i])>700 Then '<----**** sht[i]="False" '<----**** GraphicsWindow.Title="You Hit !!!!!! Total " Shapes.Move(Ball[i],shapes.GetLeft(shp["5:"+bn/2][9])+10,shapes.Gettop(shp["5:"+bn/2][9])+30)'<----**** Shapes.HideShape(Ball[i]) '<----**** EndIf '==========================Collision Check Here================================= Cannon_X=shapes.GetLeft(shp[CNMB][5]) Cannon_Y=shapes.GetTop(shp[CNMB][5]) ballX=shapes.GetLeft(ball[i]) '<----**** bally=shapes.GetTop(ball[i]) '<----**** If (Cannon_XVLP541-0.sb< Start>VLP541.sb< ' mahreen miangul ID QMF747-1 ' Multiple KeyBoard ' DeceMber/1st/2019 'GraphicsWindow.Left = 0.5 * (Desktop.Width - GraphicsWindow.Width) 'GraphicsWindow.Top = 0.5 * (Desktop.Height - GraphicsWindow.Height) GraphicsWindow.top= -2.0 GraphicsWindow.left= 80 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.backgroundcolor = "black" GraphicsWindow.Width = 1280 GraphicsWindow.Height = 666 GraphicsWindow.KeyDown = onkeyDown '=============================Makesprite()============================ SPRITE_init() add_shapes() ' ============================== Aircraft Animation====================== dZ = 0.1 zoom = 1 For i=1 to 4 '<----**** ddx[i]=-(2+Math.GetRandomNumber(50)/10) '<----**** endfor '<----**** ddy=0 bdx=0 bdy=30 bdy2=20 ' - initial ball2 moving speed-Y BNMB="6:1" ' Blue car shapes number=6 repeat =1 shoot="False" 'shoot2="False" zm=1 shootNMB=10 '<----**** ' ============================== Cannon Animation ============================== GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor= "Red" For i=1 to 4 '<----**** ANMB="5:"+i '<----**** Ball[i]=Shapes.AddEllipse(10,20) '<----**** Shapes.Move(Ball[i],shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) '<----**** Shapes.HideShape(Ball[i]) '<----**** sht[i]="False" '<----**** endfor '<----**** GraphicsWindow.BrushColor= "snow" For i=1 to 10 '<----**** Ball2[i]=Shapes.AddEllipse(10,20) '<----**** Shapes.Move(Ball2[i],shapes.GetLeft(shp[BNMB][14]),shapes.Gettop(shp[BNMB][14])) '<----**** Shapes.HideShape(Ball2[i]) '<----**** sht2[i]="False" '<----**** endfor '<----**** ' ==============================Aircraft Animation and Blinkig 1====================== While "True" ' NN=NN+1 '<----**** If Math.Remainder(NN,7)=0 Then '<----**** For k=1 To Array.GetItemCount(s[6]) For L=1 To Array.GetItemCount(shape[6])-2 ' Shapes.Rotate(SHP["6:"+k][L],Shape[6][L]["angle"]) EndFor EndFor EndIf AircraftBlinking() '<----**** aircraftFire() '<----**** BluecarFire() '<----**** If Math.Remainder(NN,11)=0 Then '<----**** For k=1 To Array.GetItemCount(s[6]) For L=1 To Array.GetItemCount(shape[6])-2 ' Shapes.Rotate(SHP["6:"+K][L], 0) EndFor EndFor EndIf Program.Delay(25) endwhile Sub AircraftBlinking '============================Aircraft Blinking Program======================= zoom = zoom - dZ For ii=1 To 4 '<----**** ANMB="5:"+ii '<----**** For i = 1 To Array.GetItemCount(shape[5]) If Array.ContainsValue(shape[5][i], "eye") or Array.ContainsValue(shape[5][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx[ii],shapes.Gettop(shp[ANMB][i])+ddy)'<----**** EndFor '============================Aircraft Reverse Moving=====X,Y Direction============= cycleX[ii]= shapes.GetLeft(shp[ANMB][5]) '<----**** cycley[ii]= shapes.Gettop(shp[ANMB][5]) '<----**** If cycleX[ii]<-100 Or cycleX[ii]>GraphicsWindow.Width+100 Then'<----**** ddx[ii]=-ddx[ii] '<----**** EndIf endfor '<----**** If zoom = 0.1 Or zoom = 1 Then dZ = -dZ EndIf EndSub Sub aircraftFire ' ===========================BallFire======================================= bn= Math.GetRandomNumber(10) '<----**** 'If math.Remainder(bn,2)=0 and sht[bn/2]="False" Then '<----**** 'sht[bn/2]="True" '<----**** 'shapes.Move(Ball[bn/2] ,shapes.GetLeft(shp["5:"+bn/2][9])+10,shapes.Gettop(shp["5:"+bn/2][9])+30)'<----**** 'EndIf '<----**** For i=1 To 4 '<----**** If sht[i]="True" Then '<----**** Shapes.ShowShape(Ball[i]) '<----**** shapes.Move(Ball[i] ,shapes.GetLeft(ball[i])+bdx/2,shapes.Gettop(ball[i])+bdy/2) '<----**** If shapes.Gettop(ball[i])>700 Then '<----**** sht[i]="False" '<----**** GraphicsWindow.Title="You Hit !!!!!! Total " Shapes.Move(Ball[i],shapes.GetLeft(shp["5:"+bn/2][9])+10,shapes.Gettop(shp["5:"+bn/2][9])+30)'<----**** Shapes.HideShape(Ball[i]) '<----**** EndIf '==========================Collision Check Here================================= Cannon_X=shapes.GetLeft(shp[BNMB][5]) Cannon_Y=shapes.GetTop(shp[BNMB][5]) ballX=shapes.GetLeft(ball[i]) '<----**** bally=shapes.GetTop(ball[i]) '<----**** If (Cannon_XVLP541.sb< Start>VLT808.sb< '============================================================= 'INITIALISATION '============================================================= GraphicsWindow.BackgroundColor = "#200050" 'A dark sky background 'Load an image of a sprite and get its half width and half height spriteURL = "http://icons.iconarchive.com/icons/lboi/tweetscotty/128/rocket-icon.png" spriteImage = ImageList.LoadImage(spriteURL) spriteW = ImageList.GetWidthOfImage(spriteImage)/2 spriteH = ImageList.GetHeightOfImage(spriteImage)/2 speed = 5 'The sprite speed nSprite = 10 'The number of sprites 'Create the sprites For i = 1 To nSprite 'Create sprite using the image sprite[i] = Shapes.AddImage(spriteImage) 'Set the sprite initial position - just off screen to the right and randomly down the screen resetPosition() 'Move the sprite to be centred on its X and Y coordinates Shapes.Move(sprite[i],spriteX[i]-spriteW,spriteY[i]-spriteH) Shapes.Rotate(sprite[i],-90) 'Rotate to point the sprite in the direction it is travelling EndFor '============================================================= 'MAIN PROGRAM LOOP '============================================================= 'Keep looping forever do the loop step 50 times a second (20ms delay each update) While ("True") start = Clock.ElapsedMilliseconds 'Just used for the delay later 'Move the sprites For i = 1 To nSprite 'Update the sprite X position - move it to the left spriteX[i] = spriteX[i]-speed Shapes.Move(sprite[i],spriteX[i]-spriteW,spriteY[i]-spriteH) 'If the sprite has moved off screen then just move it to the right of the screen If (spriteX[i] < -spriteW) Then resetPosition() EndIf EndFor 'Do a delay up to 20 ms, depending on the time used to do the visuals delay = 20 - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile '============================================================= 'SUBROUTINES '============================================================= Sub resetPosition 'Do in a sub since it is done in different parts of the code and we may want to modify it often spriteX[i] = GraphicsWindow.Width+spriteW+Math.GetRandomNumber(GraphicsWindow.Width+2*spriteW) spriteY[i] = spriteH+Math.GetRandomNumber(GraphicsWindow.Height-2*spriteH) EndSub End>VLT808.sb< Start>VMB267.sb< Body_Init() Body_Draw() nl=text.GetCharacter (13) Controls.ButtonClicked =bcc GraphicsWindow.KeyDown =kkk Sub kkk bkk= GraphicsWindow.LastKey If bkk="Return" Then skey="= endif EndSub While "True If skey="" Then else GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize iX = Button_iX0 + (iCol - 1) * Button_idX iY = Button_iY0 + (iRow - 1) * Button_idY If sKey = "AC" Then Calc_sExp = "" bbt=nl+nl+" 0.c "+nl ldControls.RichTextBoxSetText (bb bbt "true") ElseIf sKey = "GT" Then bbt=nl+nl+" ------------------------------ "+nl bbt=bbt+gt ldControls.RichTextBoxSetText (bb bbt "true") gt=0 ElseIf sKey = "1/X" Then Calc_sExp =ldmath.FixDecimal (math.Power (Calc_sExp, -1) f4) ElseIf sKey = "FN" Then kset2() iPX =0 ElseIf sKey = "NUM" Then kset1() iPX =0 ElseIf text.IsSubText (sKey "=") Then Calc_sExp= Controls.GetTextBoxText (st) Calc_EvalExp() gt=gt+ Calc_sExp ElseIf sKey = "C" Then Calc_sExp = "" Else Calc_sExp = Text.Append ( Calc_sExp skey) EndIf LCD_Draw() skey="" EndIf EndWhile ' ' Body | Initialization Sub Body_Init VERSION = "03" ' v0.3 TYPE = "A" Calc_sExp = "" ix=0 iy=0 GraphicsWindow.Title="Calculator init="true f4=8 'decimals precision Body_iWidth = 300 Body_iHeight = 400 Body_sFontName = "Arial" Body_iFontSize = 14 LCD_iWX0 = 35 ' LCD window size LCD_iWX1 = 265 LCD_iWY0 = 80 LCD_iWY1 = 130 LCD_sFontName = "arial" LCD_iFontSize = 30 LCD_iEX0 = LCD_iWX0 + 15 LCD_iEY0 = LCD_iWY0 + 15 Button_iX0 = LCD_iWX0 - 20 Button_iY0 = LCD_iWY1 + 50 Button_iX1 = LCD_iWX1 + 20 Button_iY1 = LCD_iWY1 + 400 Button_iWidth = 60 Button_iHeight = 30 Button_iGX = Math.Floor(((Button_iX1 - Button_iX0) - Button_iWidth * 4) / 3) Button_iGY = Math.Floor(((Button_iY1 - Button_iY0) - Button_iWidth * 5) / 4) Button_idX = Button_iWidth + Button_iGX Button_idY = Button_iHeight + Button_iGY kset1() EndSub Sub kset1 Button_sKey[1][1] = "AC" Button_sKey[2][1] = "C" Button_sKey[3][1] = "FN" Button_sKey[4][1] = " GT " Button_sKey[1][2] = " 7 " Button_sKey[2][2] = " 8 " Button_sKey[3][2] = " 9 " Button_sKey[4][2] = " * " Button_sKey[1][3] = " 4 " Button_sKey[2][3] = " 5 " Button_sKey[3][3] = " 6 " Button_sKey[4][3] = " - " Button_sKey[1][4] = " 1 " Button_sKey[2][4] = " 2 " Button_sKey[3][4] = " 3 " Button_sKey[4][4] = " + " Button_sKey[1][5] = " 0 " Button_sKey[2][5] = "." Button_sKey[3][5] = " = " Button_sKey[4][5] = "E" km="" For y=1 To 5 For x=1 To 4 km=text.Append (km ldtext.Trim (Button_sKey[x][y])+" ") EndFor EndFor kmm=ldtext.Split (km " ") ff= LDShapes.GetAllShapes () For r=1 To Array.GetItemCount (ff) If Text.StartsWith (ff[r] "But") Then Controls.SetButtonCaption (ff[r] kmm[r-2]) EndIf EndFor EndSub Sub kset2 Button_sKey[1][1] = "AC" Button_sKey[2][1] = "C" Button_sKey[3][1] = "NUM" Button_sKey[4][1] = "1/X" Button_sKey[1][2] = "SIN(" Button_sKey[2][2] = "COS(" Button_sKey[3][2] = "TAN(" Button_sKey[4][2] = "ABS(" Button_sKey[1][3] = "INT(" Button_sKey[2][3] = "FRC(" Button_sKey[3][3] = "RND(" Button_sKey[4][3] = " ) " Button_sKey[1][4] = "LN(" Button_sKey[2][4] = "LOG(" Button_sKey[3][4] = "EXP(" Button_sKey[4][4] = "SQR(" Button_sKey[1][5] = " F! " Button_sKey[2][5] = " PI " Button_sKey[3][5] = " = " Button_sKey[4][5] = "," km="" For y=1 To 5 For x=1 To 4 km=text.Append (km ldtext.Trim (Button_sKey[x][y])+" ") EndFor EndFor kmm=ldtext.Split (km " ") ff= LDShapes.GetAllShapes () 'TextWindow.WriteLine (ff) For r=1 To Array.GetItemCount (ff) If Text.StartsWith (ff[r] "But") Then Controls.SetButtonCaption (ff[r] kmm[r-2]) EndIf EndFor EndSub Sub Body_Draw GraphicsWindow.Width = Body_iWidth GraphicsWindow.Height = Body_iHeight GraphicsWindow.BrushColor = "lightgray" ' body color GraphicsWindow.BackgroundColor="teal GraphicsWindow.FontName = "Arial Black" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(15, 10, "CalculusXXI") GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize GraphicsWindow.DrawText(15, 34, "CA-" + VERSION + TYPE) GraphicsWindow.DrawText(220, 10, "12 DIGITS") exx=Shapes.AddText (">>>") Shapes.Move (exx Body_iWidth-50 40) LDShapes.SetShapeEvent (exx) LDShapes.ShapeEvent=see LCD_Draw() Button_DrawNumKeys() LDControls.RichTextBoxFontFamily="Lucida console LDControls.RichTextBoxTextAlignment ="Right" bb=ldControls.AddRichTextBox (Body_iWidth +5 5) LDControls.RichTextBoxDefault (bb) Controls.Move (bb Body_iWidth +5 5) Controls.SetSize (bb 250 Body_iHeight-10) EndSub Sub see If LDShapes.LastEventType="MouseDown" then GraphicsWindow.Width=Body_iWidth+260 EndIf endsub Sub Button_DrawNumKeys GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize For iRow = 1 To 5 iY = Button_iY0 + (iRow - 1) * Button_idY For iCol = 1 To 4 iX = Button_iX0 + (iCol - 1) * Button_idX GraphicsWindow.BrushColor = "black ss=Controls.AddButton (Button_sKey[iCol][iRow] iX, iy) LDEffect.DropShadow (ss "") EndFor EndFor EndSub Sub bcc skey= kmm[text.GetSubTextToEnd (Controls.LastClickedButton 7)] EndSub Sub Calc_EvalExp'------------------------- Calc | Evaluate expression sf=math.Pi/180 cc= Calc_sExp cc=ldText.Replace (cc "SIN(" "math.sin("+sf+"*") cc=ldText.Replace (cc "COS(" "math.cos("+sf+"*") cc=ldText.Replace (cc "TAN(" "math.tan("+sf+"*") cc=ldText.Replace (cc "LN(" "Math.Log(") cc=ldText.Replace (cc "PI" Math.Pi) If Text.IsSubText (cc "(") Then If Text.IsSubText (cc ")") Then Else cc=cc+")" EndIf endif Program.Delay (55) Calc_sExp =ldmath.FixDecimal (LDMath.Evaluate2 (cc ) f4) bbt=nl+cc+" = "+Calc_sExp ldControls.RichTextBoxSetText (bb bbt "true") Calc_sExp = text.GetSubText (Calc_sExp 1 12) LCD_Draw() EndSub Sub LCD_Draw If init Then iWidth = LCD_iWX1 - LCD_iWX0 iHeight = LCD_iWY1 - LCD_iWY0 GraphicsWindow.FontName = LCD_sFontName GraphicsWindow.FontSize = LCD_iFontSize st=Controls.AddTextBox (LCD_iWX0 LCD_iWY0) LDShapes.BrushColour (st "DimGray") ' LCD frame color Controls.SetSize (st iWidth , iHeight ) init="false EndIf LDShapes.PenColour (st "white") If st="" then Controls .SetTextBoxText (st "0") else Controls .SetTextBoxText(st Calc_sExp) endif EndSub End>VMB267.sb< Start>VMB673.sb< 'Create some springs numSpring = 5 For i = 1 To numSpring length[i] = 100 'Unstretched length fixedPosX[i] = Math.GetRandomNumber(500) fixedPosY[i] = Math.GetRandomNumber(500) EndFor 'Create a weight GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 weightX = 50+Math.GetRandomNumber(500) 'Position weightY = 50+Math.GetRandomNumber(500) weightU = 0 'Velocity weightV = 0 radius = 30 damping = 0.01 'Some damping to the velocity weight = Shapes.AddEllipse(2*radius,2*radius) While ("True") 'Calculate the force (Hooke's Law) and it is summed for each spring forceX = 0 forceY = 0 For i = 1 To numSpring vecX = weightX-fixedPosX[i] vecY = weightY-fixedPosY[i] len = Math.SquareRoot(vecX*vecX+vecY*vecY) forceX = forceX - vecX/len * (len-length[i]) forceY = forceY - vecY/len * (len-length[i]) EndFor 'Update the velocity and positio of the weight weightU = (1-damping)*(weightU+forceX/20) weightV = (1-damping)*(weightV+forceY/20) weightX = weightX+weightU weightY = weightY+weightV 'Do the update drawing Shapes.Move(weight,weightX-radius,weightY-radius) GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(-10,-10,GraphicsWindow.Width+20,GraphicsWindow.Height+20) GraphicsWindow.BrushColor = "Black" For i = 1 To numSpring GraphicsWindow.DrawLine(fixedPosX[i],fixedPosY[i],weightX,weightY) EndFor Program.Delay(20) EndWhile End>VMB673.sb< Start>VMB996.sb< 'Animation Of Text Font Size While ("true") GraphicsWindow.FontSize = 100 tb = Controls.AddTextBox(0,0) Controls.SetSize(tb,1000,500) Controls.SetTextBoxText(tb,"small basic") Program.Delay(2000) GraphicsWindow.Clear() Program.Delay(1) GraphicsWindow.FontSize = 50 tb = Controls.AddTextBox(0,0) Controls.SetSize(tb,1000,500) Controls.SetTextBoxText(tb,"small basic") Program.Delay(2000) EndWhile End>VMB996.sb< Start>VMC450.sb< init() '================ SHOT'S (jalpc, CFZ944 save landings) ===================== '================ modify by Pappa Lapub ============================ '================ modify by jalpc ================================== GraphicsWindow.PenColor="Red" For angle = 90 To 15 Step -15 ' To 0 Step -15 updateCanyon() alpha = Math.GetRadians(angle) xpos = ox ypos = oy lap= 0.1 vi = 40 gravity = 9.81 time=0 factX=3 'expansion factor X factY=3 'expansion factor Y ' While xpos <= pgW And ypos <= oy '////////////////// change DIFPROBLEM=50 'new !!!! While xpos <= pgW And ypos <= oy +DIFPROBLEM 'change time=time+lap X=Vi*time * Math.Cos(alpha) Y=Vi*time * Math.Sin(alpha) - gravity/2 * time*time ' If angle = 90 Then 'new !!!! PROBLEMX=0 'new !!!! Else 'new !!!! PROBLEMX=-50 'new !!!! Endif ' xpos = ox+(X*factX) ypos = oy-(Y*factY) ' Shapes.Move(ball,xpos-b_w/2,ypos-b_h/2) 'Shapes.Move(canyonRight, xpos-60, pgH) '////////////////// change Shapes.Move(canyonRight, xpos-60-PROBLEMX, pgH) 'change 'Controls.SetSize(canyonGround, xpos-ox+10, 5) '////////////////// change Controls.SetSize(canyonGround, xpos-ox+10-PROBLEMX, 5) 'change GraphicsWindow.DrawEllipse(xpos-1,ypos-1,2,2) ' GraphicsWindow.PenColor="Gray" 'new !!!! GraphicsWindow.BrushColor="Gray" 'new !!!! index=Array.GetItemCount(smoke)+1 smoke[index]=Shapes.AddEllipse(3,3) 'new !!!! Shapes.Move(smoke[index],xpos-15,ypos) 'new !!!! Shapes.Zoom(smoke[index-1],1.5,1.5) 'new !!!! Shapes.Zoom(smoke[index-2],2,2) 'new !!!! Shapes.Zoom(smoke[index-3],3,3) 'new !!!! Shapes.Remove(smoke[index-4]) 'new !!!! GraphicsWindow.PenColor="Red" 'new !!!! ' Program.Delay(50) EndWhile ' For i = 1 to Array.GetItemCount(smoke) 'new !!!! Shapes.Remove(smoke[i]) 'new !!!! EndFor 'new !!!! ' If angle <> 90 Then 'new !!!! Shapes.Rotate(ball,-60) 'new !!!! Shapes.Animate(ball,xpos-b_w/2+30,ypos-b_h/2-50,2000) 'new !!!! Program.Delay(2000) 'new !!!! ' Shapes.Rotate(ball,0) 'new !!!! EndIf ' drawDat() Program.Delay(1000) Endfor ' GraphicsWindow.FontSize=40 GraphicsWindow.DrawBoundText(400,100,200,"Ufff..!") seísmo() '============================================ ' 'Sub's '-------- Sub init pgW = 598 pgH = 428 ox=50 oy=350 drawY=0 GraphicsWindow.Width = pgW GraphicsWindow.Height = pgH GraphicsWindow.Top=40 GraphicsWindow.Left=40 GraphicsWindow.CanResize="False" GraphicsWindow.Title="ballistic shot (save landings)" GraphicsWindow.DrawLine(0,oy,pgW,oy) GraphicsWindow.DrawLine(ox,0,ox,pgH) ' 'Tube canyon GraphicsWindow.BrushColor="Black" GraphicsWindow.PenColor="Black" c_w=15 c_h=8 c_Radio=c_h/2 c_X=ox c_Y=oy canyon=Shapes.AddRectangle(c_w,c_h) Shapes.Move(canyon,ox-c_w/2,oy-c_h/2) ' 'cannon ball 'GraphicsWindow.BrushColor="Red" GraphicsWindow.PenColor="Black" 'GraphicsWindow.PenWidth=2 GraphicsWindow.PenWidth = 0 'b_w=10 'b_h=10 'ball=Shapes.AddEllipse(b_w,b_h) GraphicsWindow.BrushColor = "Red" GraphicsWindow.FillTriangle(ox,oy, ox,pgH, ox+30,pgH) ' canyonRight = Shapes.AddTriangle(ox,oy-pgH, ox,0, ox-30,0) 'change canyonRight = Shapes.AddTriangle(ox,oy-pgH+20, ox+20,0, ox-30,0)'new canyonGround = Shapes.AddRectangle(1,5) Shapes.Move(canyonGround, ox-10,pgH-5) eKnievel = "http://l.thumbs.canstockphoto.com/canstock6287653.jpg" 'eKnievel = Program.Directory + "\img\EvelKnievel.jpg" ball = Shapes.AddImage(eKnievel) b_w = ImageList.GetWidthOfImage(eKnievel) b_h = ImageList.GetHeightOfImage(eKnievel) Shapes.Zoom(ball, .2,.2) Shapes.Move(ball,ox-b_w/2,oy-b_h/2) ' 'text angle GraphicsWindow.PenWidth=2 GraphicsWindow.BrushColor="Red" GraphicsWindow.DrawText(ox-45,oy+10,"Angle") texAngle=Shapes.AddText("0º") Shapes.Move(texAngle,ox-35,oy+25) ' GraphicsWindow.BrushColor="Black" EndSub ' Sub updateCanyon angleCanyon=-angle Shapes.Rotate(canyon,angleCanyon) Shapes.SetText(texAngle,(angle)+"º") EndSub ' Sub drawDat xMax=((Vi*Vi)/gravity)*(Math.Sin(alpha*2)) yMax=(Vi*Vi*Math.Sin(alpha)*Math.Sin(alpha))/(gravity*2) drawY=drawY+20 text1="angle: "+angle+" Vi: "+Vi+" Xmax: "+0.01*(Math.Round(100*xMax))+" Ymax: "+0.01*(Math.Round(100*yMax)) GraphicsWindow.DrawBoundText(50,drawY,300, text1) Shapes.Move(ball,ox-b_w/2,oy-b_h/2) EndSub Sub seísmo dist = 20 shakes = 20 For n = 1 To shakes For m = 1 To 2 GraphicsWindow.Top = GraphicsWindow.Top +dist GraphicsWindow.Left = GraphicsWindow.Left +dist Program.Delay(50) dist = -dist EndFor EndFor EndSub End>VMC450.sb< Start>VMC577.sb< TextWindow.Title = "Rock, Paper, Scissors" start: s: TextWindow.Write ("Rock, Paper, Scissors, Shoot: ") Choice = TextWindow.Read() If (Choice = "Rock") Then Choice = 1 ElseIf (Choice = "Paper") Then Choice = 2 Elseif (Choice = "Scissors") Then Choice = 3 Else TextWindow.WriteLine("Invalid Entry") Goto s EndIf x = Math.GetRandomNumber(3) If (Choice = x) then TextWindow.WriteLine ("Tie") ElseIf (Choice = x - 1) Then TextWindow.WriteLine ("You Win!") ElseIf (Choice = x + 1) Then TextWindow.WriteLine ("You Lose!") EndIf TextWindow.Write ("Play Again? [y/n]: ") answer = TextWindow.Read() If (answer = "y")Then Goto start Else TextWindow.WriteLine ("Goodbye!") Endif End>VMC577.sb< Start>VMD064.sb< ' Original made by msdn.yogesh waves() gui() Controls.ButtonClicked = newprogram Timer.Tick = digiwatch Timer.Interval = 1000 While ("True") Shapes.Move(msg,10, 10) '<--------- Shapes.Move(migdreem, 240, 25) Shapes.Animate(migdreem, -gww, 25, 5500) Shapes.Move(migdreem0, -240, 110) Shapes.Animate(migdreem0, gww, 110, 4800) Shapes.Animate(msg,10, 500, 10000) '<--------- Program.Delay(4800) EndWhile '-----------------------------------------------------------------------------End scrolling Sub newprogram nm=controls.GetButtonCaption( Controls.LastClickedButton) If text.IsSubText(nm,"alarm") Then GraphicsWindow.Height=250 elseif nm="Set" Then Shapes.SetText(msg,"Alarm is set!!") setHr=Controls.GetTextBoxText( box[1]) setmin=Controls.GetTextBoxText(box[2]) GraphicsWindow.Height=gwh EndIf EndSub Sub digiwatch Shapes.SetText( a, Clock.Time ) ' changes displayed text to current clock tim If (Clock.Minute=00 And Clock.Second=01) Then _Hr=Clock.hour Sound.PlayBellRing() Sound.PlayAndWait(kripayadhyande) Sound.PlayAndWait(_sound1[_Hr]) Sound.PlayAndWait(_sound2[_Hr]) Sound.PlayAndWait(bajchuke) Sound.PlayAndWait(aglaalarm1hbaadbajega) Sound.PlayAndWait(contact) ElseIf (clock.Hour=setHr and Clock.Minute=setmin And Clock.Second=01) Then Sound.PlayAndWait( kripayadhyande) Shapes.SetText(msg,"") EndIf EndSub sub waves path =Program.Directory ' "C:\Users\UTTAM\Desktop\MIGCLOCK" For i=1 To 24 _sound1[i] = path+"\night.wav" EndFor For i=4 To 11 _sound1[i] = path+"\morning.wav" EndFor For i=12 To 15 _sound1[i] = path+"\afternoon.wav" EndFor For i=16 To 19 _sound1[i] = path+"\evening.wav" EndFor For i=1 To 12 _sound2[i] = path+"\"+i+".wav" EndFor For i=13 To 24 _sound2[i] = path+"\"+(i-12)+".wav" EndFor am = path+"\am.wav" pm = path+"\pm.wav" kripayadhyande = path+"\attention.wav" kripayadobaradhyande = path+"\once again.wav" bajchuke = path+"\baj chuke.wav" aglaalarm1hbaadbajega = path+"\next alarm 1 h.wav" contact = path+"\contact.wav" EndSub Sub gui '------------------------------------------------------------------------------------------------------------------- gww = 260 gwh = 140 GraphicsWindow.Width = gww GraphicsWindow.Height =300 GraphicsWindow.Left = (Desktop.Width) - (GraphicsWindow.Width) GraphicsWindow.Top = 20 GraphicsWindow.BackgroundColor = "#50000000" GraphicsWindow.BrushColor = "#FF0000" GraphicsWindow.canResize="False" GraphicsWindow.FontSize = 9 alarmbutton = Controls.AddButton("Set alarm", 100 ,10) Controls.SetSize(alarmbutton,100,20) '------------------------------------------------------------------------------------------------------------------- x=30 ' clock x y=65 ' clock y GraphicsWindow.BrushColor = "#555555" GraphicsWindow.FontSize = 40 a= Shapes.AddText(Clock.Time) shapes.Move(a,x,y) ' -------------------------------------------------------------------------------------------------------------Scrolling GraphicsWindow.BrushColor = "#FFFFFF" GraphicsWindow.FillRectangle(0,50,GWW, 1) GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "#FFFFFF" migdreem = Shapes.AddText(" www.migdreem.in") migdreem0 = Shapes.AddText(" Hello ! I am Scientific Yogesh") '------------------------------------------------------------------------------------------------------------------- msg= Shapes.AddText(" ") '<--------- Shapes.Move(msg,10,20) '<--------- '------------------------------------------------------------------------------------------------------------------- GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(60,150,"Set alarm time") GraphicsWindow.DrawText(105,180"Hr") GraphicsWindow.DrawText(175,180"min") GraphicsWindow.BrushColor="Navy" btn= Controls.AddButton("Set",220,180) box[1]=Controls.AddTextBox(60,180) Controls.SetSize(box[1],40,25) box[2]=Controls.AddTextBox(130,180) Controls.SetSize(box[2],40,25) GraphicsWindow.Height=gwh EndSub End>VMD064.sb< Start>VMG501.sb< ' Infrared simulation ' program by par Yvan Leduc - May 22th 2016 ' program no: image=ImageList.LoadImage("https://rstorage.filemobile.com/storage/25388938/15") ' common bee image IH=ImageList.GetHeightOfImage(image) IW=ImageList.GetWidthOfImage(image) GraphicsWindow.Title = " I N F R A R E D simulation" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=IH GraphicsWindow.Width=IW GraphicsWindow.BackgroundColor="BLACK" GraphicsWindow.Clear() GraphicsWindow.DraWImage(image,0,0) Pixels = LDImage.GetImagePixels(image) For y = 1 To IH-1 For x= 1 To IW-1 hex=Pixels[x][y] R=LDColours.GetRed(hex) G=LDColours.Getgreen(hex) B=LDColours.Getblue(hex) ' here is my formula for infrared bw simulation hR=MATH.Floor(Math.Abs((R-B))) hG=MATH.Floor(Math.Abs((G*8))) hB=MATH.Floor(Math.Abs((B*0.25))) GV=(hR+hG+hB)/6 If GV > 255 Then GV=245 ElseIf GV < 0 then GV=10 EndIf GREY_value=GraphicsWindow.GetColorFromRGB (GV,GV,GV) GraphicsWindow.SetPixel(x,y,GREY_value) Endfor EndFor Sound.PlayBellRing() ' ************************** END OF PROGRAM *************************************************** End>VMG501.sb< Start>VMG691-1.sb< digits[1] = "1=one ;2=two ;3=three ;4=four ;5=five ;6=six ;7=seven ;8=eight ;9=nine " teensdigits = "0=ten ;1=eleven ;2=twelve ;3=thirteen ;4=fourteen ;5=fifteen ;6=sixteen ;7=seventeen ;8=eighteen ;9=nineteen " digits[2] = "1=ten ;2=twenty ;3=thirty ;4=forty ;5=fifty ;6=sixty ;7=seventy ;8=eighty ;9=ninety " For i = 1 To 9 digits[3][i] = digits[1][i]+"hundred " EndFor While 1=1 txt = "" TextWindow.Clear() TextWindow.WriteLine("Enter a number to write in word form:") num = TextWindow.ReadNumber() length = Text.GetLength(num) For i = 1 To length digitentered[i] = Text.GetSubText(num,length-i+1,1) If i = 2 And digitentered[i] = 1 Then txt = teensdigits[digitentered[1]] Else txt = Text.Append(digits[i][digitentered[i]],txt) EndIf EndFor TextWindow.WriteLine(txt) Program.Delay(2000) EndWhile End>VMG691-1.sb< Start>VMG691-3.sb< digits[1] = "1=one ;2=two ;3=three ;4=four ;5=five ;6=six ;7=seven ;8=eight ;9=nine " teensdigits = "0=ten ;1=eleven ;2=twelve ;3=thirteen ;4=fourteen ;5=fifteen ;6=sixteen ;7=seventeen ;8=eighteen ;9=nineteen " digits[2] = "1=ten ;2=twenty ;3=thirty ;4=forty ;5=fifty ;6=sixty ;7=seventy ;8=eighty ;9=ninety " For i = 1 To 9 digits[3][i] = digits[1][i]+"hundred " digits[4][i] = digits[1][i]+"thousand " digits[5][i] = digits[2][i] digits[6][i] = digits[3][i] digits[7][i] = digits[1][i]+"million " digits[8][i] = digits[2][i] digits[9][i] = digits[3][i] EndFor digits[4][0] = "thousand " While 1=1 txt = "" TextWindow.Clear() TextWindow.WriteLine("Enter a number to write in word form:") num = TextWindow.ReadNumber() length = Text.GetLength(num) For i = 1 To 3 digitentered[i] = Text.GetSubText(num,length-i+1,1) If Math.Remainder(i,3) = 2 And digitentered[i] = 1 Then txt[1] = teensdigits[digitentered[i-1]] Else txt[1] = Text.Append(digits[i][digitentered[i]],txt[1]) EndIf EndFor For i = 4 To 6 digitentered[i] = Text.GetSubText(num,length-i+1,1) If Math.Remainder(i,3) = 2 And digitentered[i] = 1 Then txt[2] = teensdigits[digitentered[i-1]]+"thousand " Else txt[2] = Text.Append(digits[i][digitentered[i]],txt[2]) EndIf EndFor For i = 7 To 9 digitentered[i] = Text.GetSubText(num,length-i+1,1) If Math.Remainder(i,3) = 2 And digitentered[i] = 1 Then txt[3] = teensdigits[digitentered[i-1]]+"million " Else txt[3] = Text.Append(digits[i][digitentered[i]],txt[3]) EndIf EndFor txt = txt[3]+txt[2]+txt[1] TextWindow.WriteLine(txt) Program.Delay(4000) EndWhile End>VMG691-3.sb< Start>VMH193.sb< '----------------------------------------------------------------------------------------------------- 'Sets window's title, size and position '----------------------------------------------------------------------------------------------------- GraphicsWindow.Title = "MorseIM" GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Width = 290 GraphicsWindow.Height = 240 GraphicsWindow.CanResize = "false" '----------------------------------------------------------------------------------------------------- 'Sets gui elements '----------------------------------------------------------------------------------------------------- textBox = Controls.AddMultiLineTextBox(5, 200) enterButton = Controls.AddButton("Enter", 250, 200) convertButton = Controls.AddButton("English-Morse", 0, 0) Controls.SetSize(textBox, 245, 45) Controls.SetSize(enterButton, 45, 45) 'Draws a rectangle for visual appeal :P GraphicsWindow.PenWidth = 0.5 GraphicsWindow.DrawRectangle(5, 28, 290, 170) GraphicsWindow.FontSize = 25 '----------------------------------------------------------------------------------------------------- 'Determines what happens when a button is pressed '----------------------------------------------------------------------------------------------------- Controls.ButtonClicked = buttonClicked Sub buttonClicked x = 10 y = 20 If (Controls.LastClickedButton = enterButton) Then boxText = Controls.GetTextBoxText(textBox) 'Reads the boxText characters one at a time and checks them against the indices library For i = 1 To Array.GetItemCount(morse) character = text.GetSubText(boxText, i, 1) 'draws the morse code to the window GraphicsWindow.DrawText(x, y, morse[character]) Controls.SetTextBoxText(textBox, "") lastText = GraphicsWindow.LastText length = Text.GetLength(lastText) x = x + (2 * length) EndFor EndIf 'gui effect to make the "convert button" change captions convert = Controls.GetButtonCaption(convertButton) If (Controls.LastClickedButton = convertButton) And (convert = "English-Morse") Then Controls.SetButtonCaption(convertButton, "Morse-English") ElseIf (Controls.LastClickedButton = convertButton) And (convert = "Morse-English") Then Controls.SetButtonCaption(convertButton, "English-Morse") EndIf EndSub '----------------------------------------------------------------------------------------------------- 'English to morse indices '----------------------------------------------------------------------------------------------------- morse["a"] = ".-" morse["b"] = "-..." morse["c"] = "-.-." morse["d"] = "-.." morse["e"] = "." morse["f"] = "..-." morse["g"] = "--." morse["h"] = "...." morse["i"] = ".." morse["j"] = ".---" morse["k"] = "-.-" morse["l"] = ".-.." morse["m"] = "--" morse["n"] = "-." morse["o"] = "---" morse["p"] = ".--." morse["q"] = "--.-" morse["r"] = ".-." morse["s"] = "..." morse["t"] = "-" morse["u"] = "..-" morse["v"] = "...-" morse["w"] = ".--" morse["x"] = "-..-" morse["y"] = "-.--" morse["z"] = "--.." morse["0"] = "-----" morse["1"] = ".----" morse["2"] = "..---" morse["3"] = "...--" morse["4"] = "....-" morse["5"] = "....." morse["6"] = "-...." morse["7"] = "--..." morse["8"] = "---.." morse["9"] = "----." 'not sure if this'll work... morse["Space"] = " " End>VMH193.sb< Start>VMH447.sb< ' Nonk's Twenty Five Line Program with (Apple) added by Shapes.AddImage ' mahreen miangul Updated Program with (Apple)added by Shapes.AddText GraphicsWindow.Width = 1010 GraphicsWindow.height = 555 GraphicsWindow.BackgroundColor = "snow" For i = 1 To 10 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FontSize =44 APL[i] = Shapes.AddText("🍎") Shapes.Move(APL[i],Math.GetRandomNumber(640),-100-Math.GetRandomNumber(200) ) fal[i]=(5+Math.GetRandomNumber(10))/5 Shapes.Zoom(APL[i],fal[i]/3,fal[i]/3) EndFor bct = Shapes.AddRectangle(40,20) '---------------- backet --------------- GraphicsWindow.FontSize=20 msg=Shapes.AddText(" ") While "true" Shapes.move(bct,GraphicsWindow.MouseX,430) ' move backet For i = 1 To 10 Shapes.Move(APL[i], shapes.GetLeft(APL[i]), shapes.Gettop(APL[i])+fal[i]) ' move apples If Math.Abs(Shapes.GetLeft(bct)-Shapes.GetLeft(APL[i]))<80 And Math.abs(Shapes.GetTop(bct)-Shapes.Gettop(APL[i]))<20 Then ' if you catch apple(s) NN=NN+1 Sound.PlayClick() Shapes.move(APL[i] ,Math.GetRandomNumber(640),-100-Math.GetRandomNumber(200)) ' elseIf shapes.Gettop(APL[i])>500 Then MM=MM+1 Shapes.Move(APL[i], Math.GetRandomNumber(640),-100-Math.GetRandomNumber(200) ) EndIf EndFor Shapes.SetText(msg,"Hit count= "+NN+ " Total= "+(MM+NN)) Program.Delay(10) endWhile End>VMH447.sb< Start>VMH886.sb< ' Challenge of the Month - March 2017 KUMIKO pattern -6 by NaochanON dL="1=1000;2=60;" dL=dl+"2dX="+(dL[2]*Math.SquareRoot(3)/2) Color="1=#F8E58C;2=#007B43;" YN=9 XN=12 GraphicsWindow.BackgroundColor="Black" GraphicsWindow.Width=900 GraphicsWindow.Height=600 for M=-5 to 16 _C="X="+(Math.SquareRoot(3)*dL[2]*(M-1))+";Y=300" make_triangle() endfor For N= 1 to YN Step 2 For M=1 To XN Step 2 _C="X="+(Math.SquareRoot(3)*dL[2]*(M-1))+";Y="+(dL[2]*(N-1)) make_diamond() EndFor endfor sub make_triangle NMB=M+":" GraphicsWindow.BrushColor=Color[1] GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor=Color[1] Dia[NMB][1]=Shapes.AddLine(1000,-1000/Math.SquareRoot(3),-1000,1000/Math.SquareRoot(3)) Dia[NMB][2]=Shapes.AddLine(1000,1000/Math.SquareRoot(3),-1000,-1000/Math.SquareRoot(3)) Dia[NMB][3]=Shapes.AddLine(0,-1000,0,1000) Dia[NMB][4]=Shapes.AddLine(dL["2dX"],-1000,dL["2dX"],1000) For L=1 To 4 Shapes.Animate(Dia[NMB][L],_C["X"]+dL["2dX"],_C["Y"],200) EndFor Program.Delay(20) EndSub Sub make_diamond NMB=M+":" pos["X"]="1=-2;2=-1;3=1;4=2;5=1;6=-1;7=-4;8=4" pos["Y"]="1=0;2=-1;3=-1;4=0;5=1;6=1;7=0;8=0" GraphicsWindow.PenColor=Color[2] for L=1 To 8 pat= Math.Remainder(pos["X"][L]-6,3) If pat=-1 Then ' 2,4,6,7, Dia[NMB+":"+L][1]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3-2/3),pos["Y"][L]*dL[2]/2) Dia[NMB+":"+L][2]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3+1/3),(pos["Y"][L]-1)*dL[2]/2) Dia[NMB+":"+L][3]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3+1/3),(pos["Y"][L]+1)*dL[2]/2) For k=1 To 3 Shapes.Move(Dia[NMB+":"+L][k],_C["X"],_C["Y"]+dL[2]/2) EndFor ElseIf pat=-2 then ' 1,3,5,8, Dia[NMB+":"+L][1]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3+2/3),pos["Y"][L]*dL[2]/2) Dia[NMB+":"+L][2]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3-1/3),(pos["Y"][L]-1)*dL[2]/2) Dia[NMB+":"+L][3]= Shapes.AddLine( dL["2dX"]*(pos["X"][L]/3),pos["Y"][L]*dL[2]/2,dL["2dX"]*(pos["X"][L]/3-1/3),(pos["Y"][L]+1)*dL[2]/2) For k=1 To 3 Shapes.Move(Dia[NMB+":"+L][k],_C["X"],_C["Y"]+dL[2]/2) EndFor EndIf EndFor EndSub End>VMH886.sb< Start>VML310-1.sb< '========================================================== ' KALEIDOSCOPE '========================================================== gw = 600 'Window size numBits = 15 'Number of bits in kaleidoscope size = 60 'Size of bits - radius equivalent Initialise() While ("True") moveMasterBit() updateBits() Program.Delay(100) EndWhile '========================================================== ' SUBROUTINES '========================================================== Sub Initialise gh = gw GraphicsWindow.CanResize = "False" GraphicsWindow.Top = 0 GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Title = "Kaleidoscope" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.PenWidth = 1 Mouse.HideCursor() 'Create the bit shapes and the position/velocity of the master bit For i = 1 To numBits GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() random = Math.GetRandomNumber(3) randomsize1 = Math.GetRandomNumber(2) randomsize2 = Math.GetRandomNumber(2) randomsize3 = Math.GetRandomNumber(2) For j = 1 To 8 If random = 1 Then 'bit[i][j] = Shapes.AddEllipse(randomsize3*size,randomsize3*size) bit[i][j] = Shapes.AddTriangle(0,0,randomsize2*size,0,randomsize2*size,randomsize2*size) ElseIf random = 2 Then bit[i][j] = Shapes.AddRectangle(randomsize2*size,randomsize2*size) Else bit[i][j] = Shapes.AddTriangle(0,0,randomsize1*size,0,randomsize1*size,randomsize1*size) EndIf Shapes.SetOpacity(bit[i][j],25) EndFor bitX[i] = Math.GetRandomNumber(gw) bitY[i] = Math.GetRandomNumber(gh) bitU[i] = 1+Math.GetRandomNumber(100)/50 bitV[i] = 1+Math.GetRandomNumber(100)/50 rotation[i] = 3+Math.GetRandomNumber(10) If (Math.Remainder(rotation[i],2) = 0) Then rotation[i] = -rotation[i] EndIf EndFor 'Dividing lines GraphicsWindow.PenColor = "LightGray" GraphicsWindow.DrawLine(0,gh/2,gw,gh/2) GraphicsWindow.DrawLine(gw/2,0,gw/2,gh) GraphicsWindow.DrawLine(0,0,gw,gh) GraphicsWindow.DrawLine(gw,0,0,gh) 'Create the lens GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = gw/2+20 GraphicsWindow.BrushColor = "#30000000" lens = Shapes.AddEllipse(gw*2,gh*2) Shapes.Move(lens,-gw/2,-gh/2) EndSub Sub moveMasterBit 'Just a simple move and rotate of the master bit For i = 1 To numBits bitX[i] = bitX[i]+bitU[i] bitY[i] = bitY[i]+bitV[i] angle[i] = angle[i]+rotation[i] If (bitX[i] < size) Then bitX[i] = size bitU[i] = -bitU[i] ElseIf (bitX[i] > gw-size) Then bitX[i] = gw-size bitU[i] = -bitU[i] EndIf If (bitY[i] < size) Then bitY[i] = size bitV[i] = -bitV[i] ElseIf (bitY[i] > gh-size) Then bitY[i] = gh-size bitV[i] = -bitV[i] EndIf EndFor EndSub Sub updateBits 'Including the 8 reflections For i = 1 To numBits Shapes.Move(bit[i][1],bitX[i]-size,bitY[i]-size) Shapes.Move(bit[i][2],bitY[i]-size,bitX[i]-size) Shapes.Move(bit[i][3],gw-bitX[i]-size,bitY[i]-size) Shapes.Move(bit[i][4],gw-bitY[i]-size,bitX[i]-size) Shapes.Move(bit[i][5],bitX[i]-size,gh-bitY[i]-size) Shapes.Move(bit[i][6],bitY[i]-size,gh-bitX[i]-size) Shapes.Move(bit[i][7],gw-bitX[i]-size,gh-bitY[i]-size) Shapes.Move(bit[i][8],gw-bitY[i]-size,gh-bitX[i]-size) Shapes.Rotate(bit[i][1],angle[i]) Shapes.Rotate(bit[i][2],-angle[i]+180) Shapes.Rotate(bit[i][3],-angle[i]+270) Shapes.Rotate(bit[i][4],angle[i]+90) Shapes.Rotate(bit[i][5],-angle[i]+90) Shapes.Rotate(bit[i][6],angle[i]+270) Shapes.Rotate(bit[i][7],angle[i]+180) Shapes.Rotate(bit[i][8],-angle[i]) EndFor EndSub End>VML310-1.sb< Start>VML310.sb< '========================================================== ' KALEIDOSCOPE '========================================================== gw = 800 'Window size numBits = 15 'Number of bits in kaleidoscope size = 40 'Size of bits - radius equivalent Initialise() While ("True") moveMasterBit() updateBits() Program.Delay(50) EndWhile '========================================================== ' SUBROUTINES '========================================================== Sub Initialise gh = gw GraphicsWindow.CanResize = "False" GraphicsWindow.Top = 0 GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Title = "Kaleidoscope" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.PenWidth = 1 Mouse.HideCursor() 'Create the bit shapes and the position/velocity of the master bit For i = 1 To numBits GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() For j = 1 To 8 'bit[i][j] = Shapes.AddEllipse(2*size,2*size) 'bit[i][j] = Shapes.AddRectangle(2*size,2*size) bit[i][j] = Shapes.AddTriangle(0,0,2*size,0,2*size,2*size) Shapes.SetOpacity(bit[i][j],25) EndFor bitX[i] = Math.GetRandomNumber(gw) bitY[i] = Math.GetRandomNumber(gh) bitU[i] = 1+Math.GetRandomNumber(100)/50 bitV[i] = 1+Math.GetRandomNumber(100)/50 rotation[i] = 3+Math.GetRandomNumber(10) If (Math.Remainder(rotation[i],2) = 0) Then rotation[i] = -rotation[i] EndIf EndFor 'Dividing lines GraphicsWindow.PenColor = "LightGray" GraphicsWindow.DrawLine(0,gh/2,gw,gh/2) GraphicsWindow.DrawLine(gw/2,0,gw/2,gh) GraphicsWindow.DrawLine(0,0,gw,gh) GraphicsWindow.DrawLine(gw,0,0,gh) 'Create the lens GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = gw/2+20 GraphicsWindow.BrushColor = "#30000000" lens = Shapes.AddEllipse(gw*2,gh*2) Shapes.Move(lens,-gw/2,-gh/2) EndSub Sub moveMasterBit 'Just a simple move and rotate of the master bit For i = 1 To numBits bitX[i] = bitX[i]+bitU[i] bitY[i] = bitY[i]+bitV[i] angle[i] = angle[i]+rotation[i] If (bitX[i] < size) Then bitX[i] = size bitU[i] = -bitU[i] ElseIf (bitX[i] > gw-size) Then bitX[i] = gw-size bitU[i] = -bitU[i] EndIf If (bitY[i] < size) Then bitY[i] = size bitV[i] = -bitV[i] ElseIf (bitY[i] > gh-size) Then bitY[i] = gh-size bitV[i] = -bitV[i] EndIf EndFor EndSub Sub updateBits 'Including the 8 reflections For i = 1 To numBits Shapes.Move(bit[i][1],bitX[i]-size,bitY[i]-size) Shapes.Move(bit[i][2],bitY[i]-size,bitX[i]-size) Shapes.Move(bit[i][3],gw-bitX[i]-size,bitY[i]-size) Shapes.Move(bit[i][4],gw-bitY[i]-size,bitX[i]-size) Shapes.Move(bit[i][5],bitX[i]-size,gh-bitY[i]-size) Shapes.Move(bit[i][6],bitY[i]-size,gh-bitX[i]-size) Shapes.Move(bit[i][7],gw-bitX[i]-size,gh-bitY[i]-size) Shapes.Move(bit[i][8],gw-bitY[i]-size,gh-bitX[i]-size) Shapes.Rotate(bit[i][1],angle[i]) Shapes.Rotate(bit[i][2],-angle[i]+180) Shapes.Rotate(bit[i][3],-angle[i]+270) Shapes.Rotate(bit[i][4],angle[i]+90) Shapes.Rotate(bit[i][5],-angle[i]+90) Shapes.Rotate(bit[i][6],angle[i]+270) Shapes.Rotate(bit[i][7],angle[i]+180) Shapes.Rotate(bit[i][8],-angle[i]) EndFor EndSub End>VML310.sb< Start>VMM615.sb< 'Go to SubOnkeyDown/SubKeyUp when a key is pressed/released: GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp 'Reset Variables: left = 0 right = 0 up = 0 down = 0 X=0 Y=0 'Add the objects: GraphicsWindow.PenColor="Black" GraphicsWindow.BrushColor="Black" GraphicsWindow.FillRectangle(0,350,700,1) Box=Shapes.AddRectangle(50,50) GraphicsWindow.BrushColor="Orange" GraphicsWindow.PenColor="Orange" LightSource=Shapes.AddEllipse(30,30) 'Move the objects: Shapes.Move(Box,300,300) Shapes.Move(LightSource,400,50) 'Prepare the Pen for the shadow: GraphicsWindow.pencolor="Gray" '"#11000000" GraphicsWindow.PenWidth=10 GraphicsWindow.PenColor="transparent" GraphicsWindow.BrushColor="#88000000" 'Set Turtle settings and Variables: Turtle.speed=10 Turtle.Show() Turtle.PenUp() BoxX=Shapes.GetLeft(Box) BoxY=Shapes.GetTop(Box) 'Loop the whole time: While "True" ResetTurtleXY() 'Just create a new shadow if the lightsource moved: If Xold <> Shapes.GetLeft(LightSource) Or Yold <> Shapes.GetTop(LightSource) then CreateShadow() else Program.Delay(10) endif Xold=Shapes.GetLeft(LightSource) Yold=Shapes.GetTop(LightSource) If Right=1 Then X=10 ElseIf Left = 1 then X=-10 elseif Left = 0 And Right = 0 then X=0 endif If up=1 Then Y=-10 ElseIf down = 1 then Y=10 elseif up = 0 And down = 0 then Y=0 endif LightSourceX=Shapes.GetLeft(LightSource)+15 LightSourceY=Shapes.GetTop(LightSource)+15 Shapes.Move(LightSource,Shapes.GetLeft(LightSource)+X,Shapes.GetTop(LightSource)+Y) endwhile 'Move the Turtle back to the lightsource: Sub ResetTurtleXY Turtle.Y=LightSourceY Turtle.X=LightSourceX endsub 'Create the Shadow: Sub CreateShadow If LightSourceXBoxX+25 then Turtle.MoveTo(BoxX,BoxY) Touchsensor() Shadow=Shapes.AddTriangle(BoxX,350,Turtle.X,350,boxX,BoXY) endif endsub 'Get if the Turtle reached the ground: Sub Touchsensor While Turtle.Y < 350 Turtle.Move(50) endwhile Shapes.Remove(shadow) endsub 'When a key is pressed: Sub OnKeyDown Key = GraphicsWindow.LastKey If (Key = "Left") Then left = 1 ElseIf (Key = "Right") Then right = 1 endIf If (Key = "Up") Then up = 1 ElseIf (Key = "Down") Then down = 1 endIf EndSub 'When a key is Released: Sub OnKeyUp Key = GraphicsWindow.LastKey If (Key = "Left") Then left = 0 ElseIf (Key = "Right") Then right = 0 endif If (Key = "Up") Then up = 0 ElseIf (Key = "Down") Then down = 0 endif EndSub End>VMM615.sb< Start>VMP249.sb< cc[ 1]="..####.. ##### . #### . #### .######. ###### .$#####. #### .#$ @# #### #$ @# $# #### @#### ###### #######. #$ # @# # # #$ #@ .#####...#####...#$ @# .#$ @#.@# $#.#$ #@ cc[ 2]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# $# #$ @# $# #$ $# . #$ ## @# ## ## #$ #@ .#$ @#..#$ @#..#$ @# .#$ @# @# $# #$ #@ cc[ 3]=".#$ @#. ##### .#$ . #$ @# .##### . ##### . $# . #$ $# .#$ @# #$ ###### $# #### @# $# #$ $# . #$ #$# @# #$##@# ###@ .#$ @#..#$ @#..#$ @# .#$ @# @## #$#@ cc[ 4]=".######. #$ @# .#$ . #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ ### #$ @# #@ $# $# @# # $# #$ $# . #$ #@$#@# #$ @# #$$# .##### ..##### ..#$ @# .#$ @# $## #$ cc[ 5]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# #@ $# #$ $# @# #$# #$ $# . #$ #@ $## #$ @# #$ $# .#$ ..#$ @# .. #$@# .#$##@# $# @# #$ cc[ 6]=".#$ @#. ##### . #### . #### .######. #$ .$#####. #### . #### #### #$ @# #### #### @#### ###### $# . ###### #@ $# #$ @# #$ $# .#$ ..#$ @#.. ## . # # $# @# #$ cc[ 7]="................................................................................................................................................................................................................. cc[ 8]="................................................................................................................................................................................................................. cc[ 9]="................................................................................................................................................................................................................. cc[10]=" ..##. . ### . ## . ### .#### . #### . # . ## .# # ### # # # ### ## #### ##### # # # # # # # . ###. ..###.. # # .# # .# # .# # cc[11]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # # . # ## # ## ## # # . # # ..# #. # # .# # # # # # cc[12]=" .#### . ### .# . # # .### . ### . # . # # .# # # ## #### # ## # # # # . # # ## # # # ## . ### ..### . # # .# # # # cc[13]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # ## # # . # # # # # # # . # ..# # . # # .# # # # # # cc[14]=" .# # . ### . ## . ### .#### . # . # . ## . ## ### # # ## ### # # #### # . #### # # # # # # . # ..# #. # . # # # # # GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor="DarkSlateGray GraphicsWindow.BrushColor="darkblue GraphicsWindow.Width=1500 GraphicsWindow.Height=900 GraphicsWindow.Top=5 GraphicsWindow.Title="ZX Screen Hommage ix="ABCDEFIOUGHJSQZTLNMKPRVWXY " args=0 shh[0]=LDText.Split("8 7 6 5 4 3 2 1" " ") shh[1]=LDText.Split("1 2 3 4 5 6 7 8" " ") shh[2]=LDText.Split("2 4 1 8 6 7 5 3" " ") shh[3]=LDText.Split("3 8 2 7 1 5 4 6" " ") shh[4]=LDText.Split("5 1 8 2 3 4 6 7" " ") TXTm=LDText.Split(".THE QUICK BROWN .FOX JUMPS HOVER LIZZY .DOG" " ") For n=0 To 20 r=Math.Remainder(n 5) For m=1 To 8 txtw[n][m]=text.GetSubText( txtm[shh[r][m]]+" " 1 5) EndFor EndFor bl="# For h=65 To 90 LDCall.Function("gencb" Text.GetCharacter(h)) LDCall.Function("gench" Text.GetCharacter(h)) LDCall.Function("gencm" Text.GetCharacter(h)) jj[Text.GetCharacter(h)]=LDImage.Copy(ii[Text.GetCharacter(h)]) LDImage.ReplaceColour(ii[Text.GetCharacter(h)] "red" "white" 5) LDImage.ReplaceColour(ii[Text.GetCharacter(h)] "blue" "black" 5) LDImage.ReplaceColour(jj[Text.GetCharacter(h)] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(jj[Text.GetCharacter(h)] "red" "black" 5) LDImage.ReplaceColour(kk[Text.GetCharacter(h)] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(kk[Text.GetCharacter(h)] "red" "lime" 5) LDImage.ReplaceColour(im[Text.GetCharacter(h)] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(im[Text.GetCharacter(h)] "red" "black" 5) EndFor GraphicsWindow.KeyDown=kkk ss=1 ttw="1=1;2=3;3=4 While "true For ps=0 To 22 gc=gc+1 ttt=ttw[Math.Remainder(gc 3)+1] fx=0 rr=math.Remainder( ps 20) bl="#" For w=1 To 8 txt=txtw[rr][w] If w=ss Then c1=ttt Else c1=(Math.Remainder(w+ps 2)+1)*2 EndIf LDCall.Function5("print" fx rr txt LDColours.HSLtoRGB(240 .8 (Math.Remainder(w+ps 2)*10+w+rr)/60) c1) EndFor EndFor Program.Delay(333) For ps=0 To 20 fx=0 rr=math.Remainder( ps 20) bl="#" For w=1 To 8 txt=txtw[rr][w] c1=(Math.Remainder(w+ps 2)+1)*2 LDCall.Function5("print" fx rr txt LDColours.HSLtoRGB(240 .8 (Math.Remainder(w+ps 2)*10+w+rr)/60) c1) EndFor EndFor Program.Delay(333) EndWhile Sub kkk ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) If ll="right" Then ss=ss+1 ElseIf ll="left" Then ss=ss-1 EndIf GraphicsWindow.Title=ss EndSub Sub print fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1=args[5] tu= Text.ConvertToUpperCase(tt) For f=1 To Text.GetLength(tt) qw=text.GetSubText(tu f 1) If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=ii[qw] EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf EndFor EndSub Sub gencm ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y+8] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor im[ch]=FCDrawings.GenerateImage(gg) Shapes.Remove(ss) EndSub Sub gench ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor ii[ch]=FCDrawings.GenerateImage(gg) Shapes.Remove(ss) EndSub Sub gencb ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText ("#$@" text.getSubText(cc[y] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor kk[ch]=FCDrawings.GenerateImage(gg) Shapes.Remove(ss) EndSub End>VMP249.sb< Start>VMR034.sb< TimerPlus.Interval =10 TimerPlus .tick=ttt 'TextWindow .WriteLine (LDMath.Convert2Radial(100,100,200,0)) tmm=0 tmx=0 tmy=0 args=0 mi=1 grf=LDGraph.AddGraph (0,0,400,300,"glitch","time","delay") grf1=LDGraph.AddGraph (0,310,400,300,"direction","time","angle") GraphicsWindow.MouseMove =mww GraphicsWindow .MouseDown =mdd GraphicsWindow .MouseUp =muu stt=0 Sub mdd tii=0 stt=1 If Mouse.IsRightButtonDown Then GraphicsWindow.BrushColor="#ddeeff GraphicsWindow.FillRectangle (0,0,1700,1100) mi=1 tmm=0 tmx=0 tmy=0 endif EndSub Sub c2rad ox= args[1] oy= args[2] nx= args[3] ny= args[4] ta= Turtle.Angle aag= mathplus.GetDegrees ( MathPlus.ATan2(nx-ox,ny-oy)+Math.Pi/2) -ta If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif da=ox-nx db=oy-ny rr[2]=math.Round(aag)-90 rr[1]=Math.SquareRoot (da*da+db*db) endsub Sub muu stt=0 'TextWindow .Clear () 'TextWindow .WriteLine (tmm) LDGraph.DeleteSeries (grf,"ll") LDGraph.DeleteSeries (grf,"tt") LDGraph.DeleteSeries (grf,"df") LDGraph.DeleteSeries (grf1,"dd") LDGraph.DeleteSeries (grf1,"tr") tmm[1]=0 If mi>3 then LDGraph.AddSeriesLine (grf,"ll",tmm,"red") tr=LDGraph.CreateTrend (tmm,2) LDGraph.AddSeriesPoints (grf,"tt",tr,"Green") tk=LDGraph.TrendCoef () LDStatistics.SetArray (tk) df=LDStatistics.Differentiate (tk) LDGraph.AddSeriesLine (grf,"df",df,"Blue") dar=0 For x=2 To mi-1 LDCall.Function4 ("C2Rad", tmx[x-1],tmy[x-1],tmx[x],tmy[x]) dar[x-1]=90+math.Round (rr[2]*100)/100 lar[x-1]=rr[1] EndFor LDGraph.AddSeriesLine (grf1,"dd",dar,"red") tr1=LDGraph.CreateTrend (dar,2) LDGraph.AddSeriesPoints (grf1,"tr",tr1,"Green") tk1=LDGraph.TrendCoef () 'TextWindow.WriteLine (tk1) GraphicsWindow.PenColor="Green zz=0 ozz=0 For x=1 To mi-2 GraphicsWindow.PenColor="#ffeeff GraphicsWindow.DrawLine (tmx[x],tmy[x],tmx[x+1],tmy[x+1]) EndFor t_x=tmx[1] t_y=tmy[1] zz=0 For zz=1 To mi-1 GraphicsWindow.PenColor="Green 'TextWindow.WriteLine (zz+"|"+lar[z]) t_Angle=math.Round (tk1[0]+zz*tk1[1]+zz*zz*tk1[2]) ds=lar[zz] T_Move() EndFor endif tmx=0 tmy=0 tmm=0 mi=1 EndSub Sub mww If stt=1 then tmm[mi]=tii tmx[mi]= GraphicsWindow.MouseX tmy[mi]= GraphicsWindow.Mousey mi=mi+1 endif EndSub Sub ttt tii=tii+1 endsub sub t_Move 'ds-param mm=LDMath.Convert2Cartesian (t_x,t_y,ds, t_Angle-90 ) GraphicsWindow.DrawLine (math.Round(t_x),math.Round(t_y),math.Round (mm[1]),math.Round (mm[2])) t_x= (mm[1]) t_y= (mm[2]) EndSub End>VMR034.sb< Start>VMS075-2.sb< ' mml to mid file exchanger made by NaochanON 2016/07/26 // 20160925 VMS075-0 // 20161002 VMS075-1 ' This uses Free compiler mml2mid.exe. Redistribute free ' mml2mid compiles MML(Music Macro Language) file into SMF(Standard MIDI File format 0 and 1). ' mml2mid.exe is made by Akito Monden, Hideki Fujii, Hisayasu Kuroda and Naoyuki Nide ' See http://hpc.jp/~mml2mid/index-e.html ' you can dowload it from here. http://hpc.jp/~mml2mid/download.html ' select mml530.zip -> download -> unzip ' mml2mid.exe is in the "bin_w32" folder. copy this in your mml file folder. ' mml readme is refered to http://tutorial.jp/music/mml/mmlman.pdf#search=%27mml2mid+%E8%A7%A3%E8%AA%AC%27 ' Use Litdev extension // see http://litdev.co.uk/ ' MML tutorial is here. (Manabu Daikoku ) http://tutorial.jp/music/mml/mmlman.pdf ( Japanese ) Redistribute free ' < Usage > ' Click .... You can select a mml file and its data is shown in the textbox. mml file path is shown in the textbox. ' save ..... Edited mml data is saved (doesnt play) ' save&Play.... mml data is saved and changed to mid file and played.(LDmediaplayer) ' stop ..... stop player ' Readme, Sample , Instrument buttons .. show readme, mml samples,instruments list Controls.ButtonClicked=Clicked LDControls.ListBoxItemChanged = OnListBoxItemChanged init() Timer.Interval=50 Timer.Tick=Tick Timer.Pause() Sub Tick position = LDControls.MediaPlayerPosition(player) playTime = LDControls.MediaPlayerPlayTime(player)+0.00001 shapes.SetText(msg,position+"/"+text.GetCharacter(10)+math.Floor(playTime)+"mS") If position/playTime>0.995 Then Timer.Pause() LDControls.MediaPlayerStop(player) EndIf EndSub Sub Clicked nm= Controls.GetButtonCaption( Controls.LastClickedButton) If nm="Save" then mmlsave() elseif nm="Clear" then Controls.setTextBoxText(Mbox[1],"") Controls.SetTextBoxText(box[1],path) elseif nm="Stop" then playdumy() Timer.Pause() elseif Text.IsSubText(nm,"Play") then Timer.Pause() mmlsave() midfile=LDText.Replace(_thisfile,".mml",".mid") ' .mml --> .mid ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(midfile) ' delete its mid file fname= LDShell.GetDetail(Controls.GetTextBoxText(box[1]) ,0) ' file name res= LDProcess.Start(path+"mml2mid.exe", fname) LDControls.MediaPlayerStop(player) GraphicsWindow.Title= fname+" : "+res Program.Delay(500) LDControls.MediaPlayerLoad(player,midfile) Program.Delay(1500) LDControls.MediaPlayerPlay(player) Program.Delay(50) Timer.Resume() folderlist() elseif Text.IsSubText(nm,"Readme") then Controls.SetTextBoxText(Mbox[2],Readme) ' show readme elseif Text.IsSubText(nm,"Sample") then Controls.SetTextBoxText(Mbox[2],Sample) ' show mml samples elseif Text.IsSubText(nm,"Instrument") then Controls.SetTextBoxText(Mbox[2],Instruments) ' show instruments list EndIf EndSub Sub folderlist Shapes.Remove(box[2]) ' The following line could be harmful and has been automatically commented. ' fls= File.GetFiles(path) NN=0 For i=1 To Array.GetItemCount(fls) If Text.IsSubText(text.ConvertToLowerCase(fls[i]),".mml") Then NN=NN+1 List[NN]=LDShell.GetDetail(fls[i],0) ' sample.mml EndIf EndFor box[2]=LDControls.AddListBox(List,230,270) ' mml file list Shapes.Move(box[2],680,10) EndSub Sub playdumy LDControls.MediaPlayerStop(player) Program.Delay(100) LDControls.MediaPlayerLoad(player,path+"Dumy.mid") ' to kill previous player Program.Delay(500) LDControls.MediaPlayerPlay(player) Program.Delay(500) EndSub Sub mmlsave Timer.Pause() _thisfile=Controls.GetTextBoxText(box[1]) ' fullpath RD= Controls.GetTextBoxText(Mbox[1]) ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(_thisfile) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(_thisfile,RD) folderlist() EndSub Sub OnListBoxItemChanged _mml=list[LDControls.LastListBoxIndex]'+".mml" ' The following line could be harmful and has been automatically commented. ' RD= File.ReadContents(path+_mml) Controls.SetTextBoxText(Mbox[1],RD) Controls.SetTextBoxText(box[1],path+_mml) EndSub Sub init GraphicsWindow.BackgroundColor="#69B076" GraphicsWindow.Width=1000 GraphicsWindow.Height=650 Controls.AddButton("Save",930,340) Controls.AddButton("Save&"+text.GetCharacter(10)+"Play",930,380) Controls.AddButton("Stop",930,430) Controls.AddButton("Clear",930,460) box[1]= Controls.AddTextBox(10,290) Controls.SetSize(box[1],900,30) Mbox[1]= Controls.AddMultiLineTextBox(10,330) Controls.SetSize(mbox[1],900,300) Mbox[2]= Controls.AddMultiLineTextBox(10,10) Controls.SetSize(mbox[2],560,270) button[1]= controls.AddButton("Readme",575,50) button[2]= controls.AddButton("Samples",575,90) button[3]= controls.AddButton("Instruments",575,130) '----------------------------------------------------------------------------------- path= Program.Directory+"\" '----------------------------------------------------------------------------------- conts="A o4 l8" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path+"Dumy.mid",conts) ' make dumy.mid res= LDProcess.Start(path+"mml2mid.exe", path+"Dumy") '----------------------------------------------------------------------------------- player = LDControls.AddMediaPlayer(80,100) ' Media Player // not visible Shapes.Move(player,905,520) GraphicsWindow.BrushColor="Lightcyan" rec= Shapes.AddRectangle(80,100) Shapes.Move(rec,915,120) GraphicsWindow.BrushColor="Navy" msg=Shapes.AddText(" mS") Shapes.Move(msg,925,150) CRLF=text.GetCharacter(13)+Text.GetCharacter(10) dq=text.GetCharacter(34) '----------------------------------------------------------------------------------------------------------------------------------- Readme="NaochanON translated Japanese text to English by using Google Translator . 2016/09/30"+CRLF Readme=Readme+" mml2mid command chart"+CRLF Readme=Readme+"'----------------------------------------------------------------------------------------"+CRLF Readme=Readme+"#title ....."+dq+" Title"+dq+CRLF Readme=Readme+"#copyright ....."+dq+" Copyright notice"+dq+CRLF Readme=Readme+"#timebase n timebase"+CRLF Readme=Readme+"#include ..... Reading of the external file"+CRLF Readme=Readme+"#swap<> swap raising and lowering of the octave mark >, <"+CRLF Readme=Readme+"#swap() swap raising and lowering of the velocity mark >, <"+CRLF Readme=Readme+"#german Use the note name of Germany flow。h =si 、b =si flat。"+CRLF Readme=Readme+"#number "+dq+"Name"+dq+" Cooperation function with external preprocessor"+CRLF Readme=Readme+""+CRLF Readme=Readme+"a b c d e f g la, si. do, re, mi, fa, sol"+CRLF Readme=Readme+"h if "+dq+"#german"+dq+" si "+CRLF Readme=Readme+"- flat"+CRLF Readme=Readme+"+ sharp"+CRLF Readme=Readme+"* natural"+CRLF Readme=Readme+"< octave 1 down 。"+CRLF Readme=Readme+"> octave 1 up。"+CRLF Readme=Readme+"ln Sound length. The initial value is 4. 4 , l8, l%5 also OK."+CRLF Readme=Readme+"(n velocity n down。"+CRLF Readme=Readme+")n velocity n up。"+CRLF Readme=Readme+"on octave. The initial value is 4. "+CRLF Readme=Readme+"vn Volume。range: 0~127。"+CRLF Readme=Readme+"r rest"+CRLF Readme=Readme+"tn Setting the tempo。range: 1~65535。The initial value is undefined"+CRLF Readme=Readme+"Cn MIDI channel。 range:1~16。Track name written in Cn ...。"+CRLF Readme=Readme+"C Character that represents the current MIDI channel。"+CRLF Readme=Readme+"P Damper pedal ON(Control change number 64)。"+CRLF Readme=Readme+"X Turn off the damper pedal。"+CRLF Readme=Readme+"! ignore the later data of the track。"+CRLF Readme=Readme+"/* comment starts from here 。"+CRLF Readme=Readme+"; comment starts from here。"+CRLF Readme=Readme+"$n Macro。$0a~$9a, ..., $0z~$9z"+CRLF Readme=Readme+"[...]n repeat '[]' section n times."+CRLF Readme=Readme+"@n program change。range:0~127。"+CRLF Readme=Readme+"@+n Increase the value of the program change by n 。"+CRLF Readme=Readme+"| Bar line."+CRLF Readme=Readme+"'----------------------------------------------------------------------------------------"+CRLF Readme=Readme+"i --"+CRLF Readme=Readme+"j --"+CRLF Readme=Readme+"kn1(,n2,n3) Velocity, change value, switch"+CRLF Readme=Readme+"krn1(,n2) Random velocity, type"+CRLF Readme=Readme+"m --"+CRLF Readme=Readme+"n --"+CRLF Readme=Readme+"pn1(,n2,n3) Pan pot, change value, switch"+CRLF Readme=Readme+"qn1,n2 Gate time, the lowest note length"+CRLF Readme=Readme+"s Released omitted features, such as Control Change only once."+CRLF Readme=Readme+"u --"+CRLF Readme=Readme+"wn Key-off velocity。Initial value is 0。"+CRLF Readme=Readme+"xnn Hexadecimal specified。"+CRLF Readme=Readme+"yn1,n2 Control Change。range: 0~127。"+CRLF Readme=Readme+"zn valuable z0~z255"+CRLF Readme=Readme+"An1(,n2) Polyphonic key pressure"+CRLF Readme=Readme+"BSn Bend。range:0~12 "+CRLF Readme=Readme+"BRn Bend range。"+CRLF Readme=Readme+"BTn1,n2 Beat。The denominator is the n2 in the molecule is n1。(EX;BT6,8 = 6/8)"+CRLF Readme=Readme+"BWn 2 bytes Bend。range:0~16383。BS64=BW8192,BS127=BW16383。"+CRLF Readme=Readme+"Dn Detune.n range:-64~63。"+CRLF Readme=Readme+"En Expression。"+CRLF Readme=Readme+"EEn1,n2,n3,n4.... Output data directly to SMF。"+CRLF Readme=Readme+"EXn1,n2,n3,n4.... Exclusive。if enclosed in {...} ,checksum automatically calculated。"+CRLF Readme=Readme+"FBn1,n2,n3,n4.... Envelope (Bend)"+CRLF Readme=Readme+"FWn1,n2,n3,n4.... Envelope (2 bytes of Bend)"+CRLF Readme=Readme+"FEn1,n2,n3,n4.... Envelope (Expression)"+CRLF Readme=Readme+"FPn1,n2,n3,n4.... Envelope (pan pot)"+CRLF Readme=Readme+"FVn1,n2,n3,n4.... Envelope (volume)"+CRLF Readme=Readme+"FCn1,n2,n3,n4.... Envelope (cut-off frequency)"+CRLF Readme=Readme+"FRn1,n2,n3,n4.... Envelope (Resonance)"+CRLF Readme=Readme+"FMn1,n2,n3,n4.... Envelope (Modulation)"+CRLF Readme=Readme+"FAn1,n2,n3,n4.... Envelope (after touch)"+CRLF Readme=Readme+"FTn1,n2,n3,n4.... Envelope (tempo)"+CRLF Readme=Readme+"Gn Channel Pressure.(0 <= n <=127)"+CRLF Readme=Readme+"Hn1,n2 Bank change(Hn1, n2 are the same as y0, n1 y32, n2)"+CRLF Readme=Readme+"IBn1,n2,n3,n4(,n5) Amplitude modulation (Bend)"+CRLF Readme=Readme+"IWn1,n2,n3,n4(,n5) Amplitude modulation (2 bytes of Bend)"+CRLF Readme=Readme+"IEn1,n2,n3,n4(,n5) Amplitude modulation (Expression)"+CRLF Readme=Readme+"IPn1,n2,n3,n4(,n5) Amplitude modulation (pan pot)"+CRLF Readme=Readme+"IVn1,n2,n3,n4(,n5) Amplitude modulation (volume))"+CRLF Readme=Readme+"ICn1,n2,n3,n4(,n5) Amplitude modulation (cut-off frequency)"+CRLF Readme=Readme+"IRn1,n2,n3,n4(,n5) Amplitude modulation (Resonance)"+CRLF Readme=Readme+"IMn1,n2,n3,n4(,n5) Amplitude modulation (Modulation)"+CRLF Readme=Readme+"IAn1,n2,n3,n4(,n5) Amplitude modulation (after touch)"+CRLF Readme=Readme+"ITn1,n2,n3,n4(,n5) Amplitude modulation (tempo)"+CRLF Readme=Readme+"Jn Specify the scale in the number, ignore the subsequent scale. Released by J0.。"+CRLF Readme=Readme+"Kn1(,n2) Key-on, the velocity"+CRLF Readme=Readme+"KI Specify key signature (minor)"+CRLF Readme=Readme+"KJ Specify key signature (major)"+CRLF Readme=Readme+"L --"+CRLF Readme=Readme+"Mn1,n2 Delay time (n1) with modulation (n2)"+CRLF Readme=Readme+"MOF Cancellation of MONn and Mn1, n2 command.same as MON0."+CRLF Readme=Readme+"MONn Unconditional modulation。range:0~127。"+CRLF Readme=Readme+"Nn1,n2,n3 NRPNcommand。n1...MSB、n2...LSB、n3...data"+CRLF Readme=Readme+"O --"+CRLF Readme=Readme+"Qn Percentage specified gate time。Initial value is 8。"+CRLF Readme=Readme+"R Characters representing the channel number of the Rowland-style。"+CRLF Readme=Readme+"RT Specify the track to the rhythm part。"+CRLF Readme=Readme+"S Displays (at compile time) information such as the current number of steps。"+CRLF Readme=Readme+"TCn Specify the cut-off frequency。(0<=n<=127)"+CRLF Readme=Readme+"TRn It specifies the resonance。(0<=n<=127)"+CRLF Readme=Readme+"UBn1,n2,n3,n4.... The second envelope(Bend)"+CRLF Readme=Readme+"UWn1,n2,n3,n4.... The second envelope(2 bytes of Bend)"+CRLF Readme=Readme+"UEn1,n2,n3,n4.... The second envelope(Expression)"+CRLF Readme=Readme+"UPn1,n2,n3,n4.... The second envelope(pan pot)"+CRLF Readme=Readme+"UVn1,n2,n3,n4.... The second envelope(volume)"+CRLF Readme=Readme+"UCn1,n2,n3,n4.... The second envelope(cut-off frequency)"+CRLF Readme=Readme+"URn1,n2,n3,n4.... The second envelope(Resonance)"+CRLF Readme=Readme+"UMn1,n2,n3,n4.... The second envelope(Modulation)"+CRLF Readme=Readme+"UAn1,n2,n3,n4.... The second envelope(after touch)"+CRLF Readme=Readme+"UTn1,n2,n3,n4.... The second envelope(tempo)"+CRLF Readme=Readme+"Vn 「(n」and「)n」set n value . Initial value is 4。"+CRLF Readme=Readme+"WT.... Text description。It describes the text characters, such as the memo"+CRLF Readme=Readme+"WI.... Instrument names description。"+CRLF Readme=Readme+"WL.... Lyrics description。"+CRLF Readme=Readme+"WM.... marker。It describes the rehearsal marks and section name。"+CRLF Readme=Readme+"WC.... It describes the memos such as cue points。"+CRLF Readme=Readme+"Y --"+CRLF Readme=Readme+"Z{...} Variable operation command。Assignment of value, addition, subtraction。"+CRLF Readme=Readme+"& Do not key off the front of the sound。"+CRLF Readme=Readme+": exit from the last iteration in the loop '[]'。"+CRLF Readme=Readme+"_n modulation"+CRLF Readme=Readme+"__n relative modulation"+CRLF Readme=Readme+"&n Specifying note number n."+CRLF Readme=Readme+"%n Specifying the sound length due to clock speed。"+CRLF Readme=Readme+"=n Performance switch。=1 Playing skip。=0 Play start。"+CRLF Readme=Readme+"~n Bend。same as BSn。"+CRLF Readme=Readme+"? Track designation of wild card('?' represents'A'~'Z')"+CRLF Readme=Readme+"\ Line wrapping"+CRLF Controls.SetTextBoxText(Mbox[2],readme) '----------------------------------------------------------------------------------------------------------------------------------- Instruments=Instruments+" < Instrument > "+CRLF Instruments=Instruments+"0. Acoustic Grand Piano 64. Soprano Sax"+CRLF Instruments=Instruments+"1. Bright Acoustic Piano 65. Alto Sax"+CRLF Instruments=Instruments+"2. Electric Grand Piano 66. Tenor Sax"+CRLF Instruments=Instruments+"3. Honky-tonk Piano 67. Baritone Sax"+CRLF Instruments=Instruments+"4. Electric Piano 1 68. Oboe"+CRLF Instruments=Instruments+"5. Electric Piano 2 69. English Horn"+CRLF Instruments=Instruments+"6. Harpsichord 70. Bassoon"+CRLF Instruments=Instruments+"7. Clavi 71. Clarinet"+CRLF Instruments=Instruments+"8. Celesta 72. Piccolo"+CRLF Instruments=Instruments+"9. Glockenspiel 73. Flute"+CRLF Instruments=Instruments+"10. Music Box 74. Recorder"+CRLF Instruments=Instruments+"11. Vibraphone 75. Pan Flute"+CRLF Instruments=Instruments+"12. Marimba 76. Blown Bottle"+CRLF Instruments=Instruments+"13. Xylophone 77. Shakuhachi"+CRLF Instruments=Instruments+"14. Tubular Bells 78. Whistle"+CRLF Instruments=Instruments+"15. Dulcimer 79. Ocarina"+CRLF Instruments=Instruments+"16. Drawbar Organ 80. Lead 1 (square)"+CRLF Instruments=Instruments+"17. Percussive Organ 81. Lead 2 (sawtooth)"+CRLF Instruments=Instruments+"18. Rock Organ 82. Lead 3 (calliope)"+CRLF Instruments=Instruments+"19. Church Organ 83. Lead 4 (chiff)"+CRLF Instruments=Instruments+"20. Reed Organ 84. Lead 5 (charang)"+CRLF Instruments=Instruments+"21. Accordion 85. Lead 6 (voice)"+CRLF Instruments=Instruments+"22. Harmonica 86. Lead 7 (fifths)"+CRLF Instruments=Instruments+"23. Tango Accordion 87. Lead 8 (bass + lead)"+CRLF Instruments=Instruments+"24. Acoustic Guitar (nylon) 88. Pad 1 (new age)"+CRLF Instruments=Instruments+"25. Acoustic Guitar (steel) 89. Pad 2 (warm)"+CRLF Instruments=Instruments+"26. Electric Guitar (jazz) 90. Pad 3 (polysynth)"+CRLF Instruments=Instruments+"27. Electric Guitar (clean) 91. Pad 4 (choir)"+CRLF Instruments=Instruments+"28. Electric Guitar (muted) 92. Pad 5 (bowed)"+CRLF Instruments=Instruments+"29. Overdriven Guitar 93. Pad 6 (metallic)"+CRLF Instruments=Instruments+"30. Distortion Guitar 94. Pad 7 (halo)"+CRLF Instruments=Instruments+"31. Guitar harmonics 95. Pad 8 (sweep)"+CRLF Instruments=Instruments+"32. Acoustic Bass 96. FX 1 (rain)"+CRLF Instruments=Instruments+"33. Electric Bass (finger) 97. FX 2 (soundtrack)"+CRLF Instruments=Instruments+"34. Electric Bass (pick) 98. FX 3 (crystal)"+CRLF Instruments=Instruments+"35. Fretless Bass 99. FX 4 (atmosphere)"+CRLF Instruments=Instruments+"36. Slap Bass 1 100. FX 5 (brightness)"+CRLF Instruments=Instruments+"37. Slap Bass 2 101. FX 6 (goblins)"+CRLF Instruments=Instruments+"38. Synth Bass 1 102. FX 7 (echoes)"+CRLF Instruments=Instruments+"39. Synth Bass 2 103. FX 8 (sci-fi)"+CRLF Instruments=Instruments+"40. Violin 104. Sitar"+CRLF Instruments=Instruments+"41. Viola 105. Banjo"+CRLF Instruments=Instruments+"42. Cello 106. Shamisen"+CRLF Instruments=Instruments+"43. Contrabass 107. Koto"+CRLF Instruments=Instruments+"44. Tremolo Strings 108. Kalimba"+CRLF Instruments=Instruments+"45. Pizzicato Strings 109. Bag pipe"+CRLF Instruments=Instruments+"46. Orchestral Harp 110. Fiddle"+CRLF Instruments=Instruments+"47. Timpani 111. Shanai"+CRLF Instruments=Instruments+"48. String Ensemble 1 112. Tinkle Bell"+CRLF Instruments=Instruments+"49. String Ensemble 2 113. Agogo"+CRLF Instruments=Instruments+"50. SynthStrings 1 114. Steel Drums"+CRLF Instruments=Instruments+"51. SynthStrings 2 115. Woodblock"+CRLF Instruments=Instruments+"52. Choir Aahs 116. Taiko Drum"+CRLF Instruments=Instruments+"53. Voice Oohs 117. Melodic Tom"+CRLF Instruments=Instruments+"54. Synth Voice 118. Synth Drum"+CRLF Instruments=Instruments+"55. Orchestra Hit 119. Reverse Cymbal"+CRLF Instruments=Instruments+"56. Trumpet 120. Guitar Fret Noise"+CRLF Instruments=Instruments+"57. Trombone 121. Breath Noise"+CRLF Instruments=Instruments+"58. Tuba 122. Seashore"+CRLF Instruments=Instruments+"59. Muted Trumpet 123. Bird Tweet"+CRLF Instruments=Instruments+"60. French Horn 124. Telephone Ring"+CRLF Instruments=Instruments+"61. Brass Section 125. Helicopter"+CRLF Instruments=Instruments+"62. SynthBrass 1 126. Applause"+CRLF Instruments=Instruments+"63. SynthBrass 2 127. Gunshot"+CRLF '----------------------------------------------------------------------------------------------------------------------------------- Sample=Sample+"'These mml samples are made by Manabu Daikoku // Redistribute free"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample arpeggio.mml"+CRLF Sample=Sample+"A o4 l1"+CRLF Sample=Sample+"A c4&e4&g1-2 c4&e4&g1-2 c8&e1-4 c8&e1-4"+CRLF Sample=Sample+"A d16&f16&a1-8 d16&f16&a1-8"+CRLF Sample=Sample+"A d32&f1-16. d32&f1-16. c64&e64&g1^1-32"+CRLF Sample=Sample+"A g4&e4&c1-2 g4&e4&c1-2 e8&c8& e8&c8&"+CRLF Sample=Sample+"A a16&f16&d1-8 a16&f16&d1-8"+CRLF Sample=Sample+"A f32&d32& f32&d32& g64&e64&c1^1-32"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample bflatma.mml"+CRLF Sample=Sample+"A o3 b->cde-fgab- b-agfe-dcc4< ]4 gf4 e4.dc2"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample channel.mml"+CRLF Sample=Sample+"$d dafa"+CRLF Sample=Sample+"$g dbgb"+CRLF Sample=Sample+"$a caga"+CRLF Sample=Sample+"A l1 t120"+CRLF Sample=Sample+"B C1 @82 p64 v100 KJd- o4 l8 k80 V10 q4 ; calliope"+CRLF Sample=Sample+"C C2 @12 p117 v70 KJd- o3 l8 k80 V10 q0 ; marimba"+CRLF Sample=Sample+"D C3 @11 p10 v110 KJd- o3 l1 k80 V10 q0 ; vibraphone"+CRLF Sample=Sample+"A r r"+CRLF Sample=Sample+"B r1 r1"+CRLF Sample=Sample+"C [$d]2 [$d]2"+CRLF Sample=Sample+"D d d"+CRLF Sample=Sample+"A r r r r"+CRLF Sample=Sample+"B f4.ga2 abagf2 b4fgabf4 ( d4e4f2"+CRLF Sample=Sample+"C [$d]2 [$d]2 [$g]2 ( [$d]2"+CRLF Sample=Sample+"D d d g ( d"+CRLF Sample=Sample+"A r r t-20 r t-20"+CRLF Sample=Sample+"B ) f4.ga2 ) ag>cdd< ( f4e4d2"+CRLF Sample=Sample+"C ) [$d]2 ) [$g]2 ( $d$a ( $dd2"+CRLF Sample=Sample+"D ) d ) g ( d2a2 ( d"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample chord.mml"+CRLF Sample=Sample+"A o4 l2"+CRLF Sample=Sample+"A c0e0g c0e0g c0e0g c0e0g"+CRLF Sample=Sample+"A c0e c0e c0e c0e"+CRLF Sample=Sample+"A d0f0a d0f0a d0f0a d0f0a"+CRLF Sample=Sample+"A d0f d0f d0f d0f"+CRLF Sample=Sample+"A c0e0g c0e0g c0e0g1"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample chords.mml"+CRLF Sample=Sample+"$c c0e0g"+CRLF Sample=Sample+"$a c0e"+CRLF Sample=Sample+"$d d0f0a"+CRLF Sample=Sample+"$g d0f"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample comment.mml"+CRLF Sample=Sample+"A cdefgab>c ; ascending scale of C major"+CRLF Sample=Sample+"/* This comment"+CRLF Sample=Sample+"contains"+CRLF Sample=Sample+"newlines. */"+CRLF Sample=Sample+"A c(c4<"+CRLF Sample=Sample+"A c4.)d)e)f)g4 )f4.)g)a)b>)c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample defvelo.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A k40 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A k127 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample depend.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"1A o3 l8"+CRLF Sample=Sample+"1A g4.ab>cd4 c4.defg4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample dmajor.mml"+CRLF Sample=Sample+"A o4 def+gab>c+d dc+c4"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample fmajor.mml"+CRLF Sample=Sample+"A o3 fgab->cdef fedccdef+g gf+edccdefg gfedccdef fedccdefgab bagfedccde edccd+e ed+cc+d+e edcc4<"+CRLF Sample=Sample+"A q-12 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample length.mml"+CRLF Sample=Sample+"A o4 c1 f2a2 g4f4e4d4 e8f8g8a8g8f8g8a8"+CRLF Sample=Sample+"A d16f16g16e16d16f16g16e16d16e16f16g16f16e16f16g16"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample length2.mml"+CRLF Sample=Sample+"A o4 l1 c l2 fa l4 gfed l8 efgagfga l16 dfgedfgedefgfefg"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample macro.mml"+CRLF Sample=Sample+"$a [cd]8"+CRLF Sample=Sample+"$b [cdefgfed]2"+CRLF Sample=Sample+"$c cdefgab>cdccdefga agfedccd*e*fga*b*>c c cdefgab > cdefgab > cdefgab > cc"+CRLF Sample=Sample+"A < bagfedc < bagfedc < bagfedc < bagfedc"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample panpot.mml"+CRLF Sample=Sample+"$m c4.d8e8f8g4 f4.g8a8b8>c4<"+CRLF Sample=Sample+"A C1 p0"+CRLF Sample=Sample+"o3 ; left"+CRLF Sample=Sample+"B C2 p127 o4 ; right"+CRLF Sample=Sample+"A $m r1r1 $m"+CRLF Sample=Sample+"B r1r1 $m $m"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample pitch.mml "+CRLF Sample=Sample+"A cdefgab"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample relvelo.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A c4.d (20 efg4 (20 f4.g (20 ab>c4<"+CRLF Sample=Sample+"A c4.d )20 efg4 )20 f4.g )20 ab>c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample repeat.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A [ c4.defg4 f4.gab>c4< ]4"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample rest.mml"+CRLF Sample=Sample+"A o4 c8r8c8d8e8r8e8f8 g8r8g8a8b8r4b8 >c1"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample rest2.mml"+CRLF Sample=Sample+"A o4 l4 cder efgr gabr >c1"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample rhythm.mml"+CRLF Sample=Sample+"$h [f+8]16 ; closed hi-hat"+CRLF Sample=Sample+"$s [r4d4]4 ; snare drum"+CRLF Sample=Sample+"$b [c4r4]3c8c8r4 ; bass drum"+CRLF Sample=Sample+"A RT C10 o2 k60 [$h]4"+CRLF Sample=Sample+"B RT C10 o2 k50 [$s]4"+CRLF Sample=Sample+"C RT C10 o2 k120 [$b]4"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample stacca.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A q12 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A q24,1 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A q48,1 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A q72,1 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample tempo.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A t120 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A t60 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A t240 c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample tie.mml"+CRLF Sample=Sample+"A o4 l4"+CRLF Sample=Sample+"A efgaa1 agfee1"+CRLF Sample=Sample+"A efga^1 agfe^1"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample timbre.mml"+CRLF Sample=Sample+"$m c4.d8e8f8g4 f4.g8a8b8>c4<"+CRLF Sample=Sample+"A C1 @11 o4 ; vibraphone"+CRLF Sample=Sample+"B C2 @19 o3 ; church organ"+CRLF Sample=Sample+"A $m r1r1 $m"+CRLF Sample=Sample+"B r1r1 $m $m"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample track.mml"+CRLF Sample=Sample+"$d dafa"+CRLF Sample=Sample+"$g dbgb"+CRLF Sample=Sample+"$a caga"+CRLF Sample=Sample+"A l1 t120"+CRLF Sample=Sample+"B KJd- o4 l8 k80 V10 q0"+CRLF Sample=Sample+"C KJd- o3 l8 k80 V10 q0"+CRLF Sample=Sample+"D KJd- o2 l1 k80 V10 q0"+CRLF Sample=Sample+"A r r"+CRLF Sample=Sample+"B r1 r1"+CRLF Sample=Sample+"C [$d]2 [$d]2"+CRLF Sample=Sample+"D d d"+CRLF Sample=Sample+"A r r r r"+CRLF Sample=Sample+"B f4.ga2 abagf2 b4fgabf4 ( d4e4f2"+CRLF Sample=Sample+"C [$d]2 [$d]2 [$g]2 ( [$d]2"+CRLF Sample=Sample+"D d d g ( d"+CRLF Sample=Sample+"A r r t-20 r t-20"+CRLF Sample=Sample+"B ) f4.ga2 ) ag>cdd< ( f4e4d2"+CRLF Sample=Sample+"C ) [$d]2 ) [$g]2 ( $d$a ( $dd2"+CRLF Sample=Sample+"D ) d ) g ( d2a2 ( d"+CRLF Sample=Sample+""+CRLF Sample=Sample+"A cdefg2"+CRLF Sample=Sample+"A fgab>c2"+CRLF Sample=Sample+"1A defga2"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample tree.mml"+CRLF Sample=Sample+"$1a o4 c0e0g cgeg"+CRLF Sample=Sample+"$1b c0e caea"+CRLF Sample=Sample+"$1c d0f0a dafa"+CRLF Sample=Sample+"$1d d0f gfg"+CRLF Sample=Sample+"$a [$1a]2 [$1b]2 [$1c]2 [$1d]2"+CRLF Sample=Sample+"A o4 l8 [$a]3 [$1d]2 c1"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample tuplet.mml"+CRLF Sample=Sample+"A o4 c4 e4 l12gfe a4 d4 f4 l20efgfe c4"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample velo.mml"+CRLF Sample=Sample+"A o4 l8"+CRLF Sample=Sample+"A c4.defg4 f4.gab>c4<"+CRLF Sample=Sample+"A c4.,100 d,90 e,80 f,70 g4,60 f4.,50 g,40 a,30 b,20 > c4,10"+CRLF Sample=Sample+""+CRLF Sample=Sample+"MML sample volume.mml"+CRLF Sample=Sample+"$m c4.d8e8f8g4 f4.g8a8b8>c4<"+CRLF Sample=Sample+"A C1 @19 p0 v30 o3 ; small"+CRLF Sample=Sample+"B C2 @19 p127 v120 o4 ; large"+CRLF Sample=Sample+"A $m r1r1 $m"+CRLF Sample=Sample+"B r1r1 $m $m"+CRLF Sample=Sample+""+CRLF '----------------------------------------------------------------------------------------------------------------------------------- Controls.SetTextBoxText(box[1],path) ' show its folder folderlist() EndSub End>VMS075-2.sb< Start>VMT326.sb< background = ImageList.LoadImage("e:\skbg.png") cppi = ImageList.LoadImage("e:\skp2.png") cpp1 = ImageList.LoadImage("e:\skp1.png") cpp11 = ImageList.LoadImage("e:\skp11.png") cpp12 = ImageList.LoadImage("e:\skp12.png") cpp13 = ImageList.LoadImage("e:\skp13.png") GraphicsWindow.Title="SokoCute turtle GraphicsWindow.Clear () LDGraphicsWindow.BackgroundImage (background) s[1]=Shapes.AddImage (cpp1) s[2]=Shapes.AddImage (cpp11) s[3]=Shapes.AddImage (cpp12) s[4]=Shapes.AddImage (cpp13) s[5]=Shapes.AddImage (cppi) For x=1 To 5 Shapes.Move(s[x] 100 100) If x>1 And x<5 then Shapes.HideShape (s[x]) Endif EndFor GraphicsWindow.Keyup=kup GraphicsWindow.KeyDown =kkk kuu="true args=0 Timer.Interval=505 Timer.Pause () Timer.Tick =ttt done="true Sub ttt done="true Timer.Pause () drlin() EndSub Sub drlin nx=Shapes.GetLeft (s[1]) ny=Shapes.Gettop (s[1]) ll=Shapes .AddLine (ox+25 oy+70 nx+25 ny+70) LDShapes.ZIndex (ll,-1) EndSub Sub kup kuu="true EndSub Sub kkk If kuu And done then ox=Shapes.GetLeft (s[1]) oy=Shapes.Gettop (s[1]) ll= text.ConvertToLowerCase (GraphicsWindow.LastKey) If done and (ll="up" Or ll="rightshift") Then done="false LDCall.Function ("shps" "2 1 3 4") For r=1 To 5 Shapes .Animate (s[r] Shapes.GetLeft (s[r]) Shapes.GetTop(s[r])-30 450) If r=1 then Timer.Resume () endif endfor ElseIf done and ll="down" then done="false LDCall.Function ("shps" "1 2 3 4") For r=1 To 5 If r=1 then Timer.Resume () endif If r=1 or r=5 then Shapes .Animate (s[r] Shapes.GetLeft (s[r]) Shapes.GetTop(s[r])+30 450) Else Shapes.Move (s[r] Shapes.GetLeft (s[r]) Shapes.GetTop(s[r])+30) endif endfor ElseIf done and ll="left" then done="false LDCall.Function ("shps" "4 2 1 3") For r=1 To 5 Shapes .Animate (s[r] Shapes.GetLeft (s[r])-40 Shapes.GetTop(s[r]) 450) endfor Timer.Resume () ElseIf done and ll="right" then LDCall.Function ("shps" "3 2 4 1") done="false For r=1 To 5 Shapes .Animate (s[r] Shapes.GetLeft (s[r])+40 Shapes.GetTop(s[r]) 450) endfor Timer.Resume () endif EndIf ddd="true kuu="false EndSub Sub shps aa=LDText.Split (args[1] " ") Shapes.ShowShape (s[aa[1]]) Shapes.HideShape (s[aa[2]]) Shapes.HideShape (s[aa[3]]) Shapes.HideShape (s[aa[4]]) EndSub End>VMT326.sb< Start>VMW884.sb< ' Permutation without loop Not = "False=True;True=False;" i = 1 One() Two() Three() Four() Sub One If Not[Array.ContainsValue(n, 1)] Then n[i] = 1 If i = 4 Then Print() ElseIf i < 4 Then i = i + 1 All() i = i - 1 EndIf n[i] = "" EndIF EndSub Sub Two If Not[Array.ContainsValue(n, 2)] Then n[i] = 2 If i = 4 Then Print() ElseIf i < 4 Then i = i + 1 All() i = i - 1 EndIf n[i] = "" EndIF EndSub Sub Three If Not[Array.ContainsValue(n, 3)] Then n[i] = 3 If i = 4 Then Print() ElseIf i < 4 Then i = i + 1 All() i = i - 1 EndIf n[i] = "" EndIF EndSub Sub Four If Not[Array.ContainsValue(n, 4)] Then n[i] = 4 If i = 4 Then Print() ElseIf i < 4 Then i = i + 1 All() i = i - 1 EndIf n[i] = "" EndIF EndSub Sub All One() Two() Three() Four() EndSub Sub Print TextWindow.Write("(") TextWindow.Write(n[1]) TextWindow.Write(",") TextWindow.Write(n[2]) TextWindow.Write(",") TextWindow.Write(n[3]) TextWindow.Write(",") TextWindow.Write(n[4]) TextWindow.WriteLine(")") EndSub End>VMW884.sb< Start>VNC295.sb< ' アクションゲーム 1作目 ' ' 岡山科学技術専門学校 情報システム学科 教材 ' 各種定数の定義 '実行するときは、上の青色の三角(実行)を押してください cls: GraphicsWindow.Width = 700 GraphicsWindow.Height = 530 GraphicsWindow.BackgroundColor = "#B0F0E6" GraphicsWindow.FontSize = 60 GraphicsWindow.BrushColor = "#C050B0" GraphicsWindow.DrawText(170,8, "ロールボール") GraphicsWindow.FontSize = 30 GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(1,90, "[十字キー]で移動") GraphicsWindow.BrushColor = "Blue" GraphicsWindow.DrawText(1,140, "[スペースキー]で一時停止") GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawText(1,190, "敵に当たらないようにゴールを目指せ") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(1,240, "[ S ]を押すと始まるよ") GraphicsWindow.BrushColor = "#6030A0" GraphicsWindow.DrawText(1,300, "[終了]ボタンを押すと終了します") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(1,360, "注意") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(1,390, "ステージにある[山田]という字に意味はありません") IF GraphicsWindow.LastKey="S"then Goto rt endif Goto cls rt: ss=0 DEATH = 0 lc=0 click=0 st: GraphicsWindow.Clear() SCREEN_WIDTH = 24 ' スクリーンの幅(ユニット数) SCREEN_HEIGHT = 18 ' スクリー��の高さ(ユニット数) UNIT_SIZE = 30 ' ユニットサイズ(ピクセル) GOAL_X = 1 GOAL_Y = 1 ENEMY_NUM = 5 SPEED = 5 ' 一度に移動するピクセル数 ENEMY_SPEED = 10 ' Enemy Speed DELAY = 50 ' ループ毎の待機時間(ミリ秒) WALL_COLOR = "#808080" ' 壁の色 BACK_COLOR = "#B0F0E6" ' 背景の色 ROBO_COLOR = "#0000FF" ' ロボットの色 ENEMY_COLOR = "#FF0000" ' Enemy Color ' 壁の配置(マップ)を定義 (1:壁あり, それ以外:壁なし) If ss=0 then WALLS [1] = "111111111111111111111111" WALLS [2] = "101010101010111110111111" WALLS [3] = "101010101010111110111111" WALLS [4] = "101010101010110110110111" WALLS [5] = "101010101010110110110111" WALLS [6] = "101010101010110110110111" WALLS [7] = "101010101000110000000111" WALLS [8] = "101000101010111111111111" WALLS [9] = "101010100010000000000001" WALLS [10] = "100010001010111111111001" WALLS [11] = "111010101010100000001001" WALLS [12] = "111010101010101101101001" WALLS [13] = "111010101010101101101001" WALLS [14] = "111010101010100000001001" WALLS [15] = "111010101010101101101001" WALLS [16] = "111010101010101101101001" WALLS [17] = "111010101000100000001001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 1 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 5 ey[2] = UNIT_SIZE * 6 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 7 ey[3] = UNIT_SIZE * 4 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 9 ey[4] = UNIT_SIZE * 8 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 2 exd[5] = 0 eyd[5] = -1 Endif If ss=1 then ENEMY_NUM = 11 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "101111101110111111111111" WALLS [3] = "101000000000000011111111" WALLS [4] = "101011011011011001111111" WALLS [5] = "101000000000000011111111" WALLS [6] = "101011011011011011111111" WALLS [7] = "101011011011011011111111" WALLS [8] = "101000000000000011111111" WALLS [9] = "101011011011011000000001" WALLS [10] = "100011011011011011111001" WALLS [11] = "111000000000000011111001" WALLS [12] = "111011011011011011111001" WALLS [13] = "111011011011011011111001" WALLS [14] = "111000000000000011111001" WALLS [15] = "111011011011011001111001" WALLS [16] = "111000000000000011111001" WALLS [17] = "111111101110111111111001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 15 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 6 ey[2] = UNIT_SIZE * 9 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 9 ey[3] = UNIT_SIZE * 5 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 12 ey[4] = UNIT_SIZE * 12 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 15 ey[5] = UNIT_SIZE * 2 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 3 ey[6] = UNIT_SIZE * 2 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 7 ey[7] = UNIT_SIZE * 4 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 12 ey[8] = UNIT_SIZE * 7 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 4 ey[9] = UNIT_SIZE * 10 exd[9] = 1 eyd[9] = 0 ex[10] = UNIT_SIZE * 9 ey[10] = UNIT_SIZE * 13 exd[10] = 1 eyd[10] = 0 ex[11] = UNIT_SIZE * 3 ey[11] = UNIT_SIZE * 15 exd[11] = 1 eyd[11] = 0 Endif If ss=2 then ENEMY_NUM = 14 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100111001111111111110111" WALLS [3] = "100111000000000111010101" WALLS [4] = "100111000000000111010101" WALLS [5] = "100011000000000111000001" WALLS [6] = "100001000000000011111111" WALLS [7] = "100100001000100000011111" WALLS [8] = "111110000000000000011111" WALLS [9] = "111111000000001000011111" WALLS [10] = "111111100000000000011111" WALLS [11] = "111111110000000000011111" WALLS [12] = "111111111000001000011111" WALLS [13] = "100000111100000000011111" WALLS [14] = "101010111110000000001111" WALLS [15] = "100000111111000000001001" WALLS [16] = "101010111111100111111001" WALLS [17] = "100000111111110000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 6 ey[1] = UNIT_SIZE * 2 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 7 ey[2] = UNIT_SIZE * 2 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 9 ey[3] = UNIT_SIZE * 2 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 10 ey[4] = UNIT_SIZE * 2 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 11 ey[5] = UNIT_SIZE * 2 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 13 ey[6] = UNIT_SIZE * 2 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 14 ey[7] = UNIT_SIZE * 2 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 18 ey[8] = UNIT_SIZE * 6 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 18 ey[9] = UNIT_SIZE * 7 exd[9] = -1 eyd[9] = 0 ex[10] = UNIT_SIZE * 18 ey[10] = UNIT_SIZE * 9 exd[10] = -1 eyd[10] = 0 ex[11] = UNIT_SIZE * 18 ey[11] = UNIT_SIZE * 10 exd[11] = -1 eyd[11] = 0 ex[12] = UNIT_SIZE * 18 ey[12] = UNIT_SIZE * 11 exd[12] = -1 eyd[12] = 0 ex[13] = UNIT_SIZE * 18 ey[13] = UNIT_SIZE * 13 exd[13] = -1 eyd[13] = 0 ex[14] = UNIT_SIZE * 18 ey[14] = UNIT_SIZE * 14 exd[14] = -1 eyd[14] = 0 Endif If ss=3 then ENEMY_NUM = 17 ENEMY_SPEED = 7 WALLS [1] = "111111111111111111111111" WALLS [2] = "100011000110001100111001" WALLS [3] = "100011000110001100111001" WALLS [4] = "111011000000001100011001" WALLS [5] = "100011000000101100000001" WALLS [6] = "100111000110001100011001" WALLS [7] = "100011010110001100111001" WALLS [8] = "100011000111001100011001" WALLS [9] = "100011000110001110011001" WALLS [10] = "100011001110001100011001" WALLS [11] = "100011000110001100011001" WALLS [12] = "100011000110001100011001" WALLS [13] = "100011100110001100011001" WALLS [14] = "100000000110000000011001" WALLS [15] = "110000000110000000011001" WALLS [16] = "100011000110001100011001" WALLS [17] = "101111100110011110011001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 1 ey[1] = UNIT_SIZE * 4 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 2 ey[2] = UNIT_SIZE * 12 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 3 ey[3] = UNIT_SIZE * 6 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 18 ey[4] = UNIT_SIZE * 7 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 1 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 7 ey[6] = UNIT_SIZE * 1 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 7 ey[7] = UNIT_SIZE * 7 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 8 ey[8] = UNIT_SIZE * 2 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 8 ey[9] = UNIT_SIZE * 10 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 11 ey[10] = UNIT_SIZE * 1 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 11 ey[11] = UNIT_SIZE * 8 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 12 ey[12] = UNIT_SIZE * 1 exd[12] = 0 eyd[12] = 1 ex[13] = UNIT_SIZE * 12 ey[13] = UNIT_SIZE * 5 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 13 ey[14] = UNIT_SIZE * 1 exd[14] = 0 eyd[14] = 1 ex[15] = UNIT_SIZE * 16 ey[15] = UNIT_SIZE * 1 exd[15] = 0 eyd[15] = 1 ex[16] = UNIT_SIZE * 16 ey[16] = UNIT_SIZE * 9 exd[16] = 0 eyd[16] = 1 ex[17] = UNIT_SIZE * 17 ey[17] = UNIT_SIZE * 1 exd[17] = 0 eyd[17] = 1 Endif If ss=4 then ENEMY_NUM = 14 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000000000000001" WALLS [3] = "111111111111111111111001" WALLS [4] = "100000011000100001010001" WALLS [5] = "100000000000000000000001" WALLS [6] = "100100100001111000100011" WALLS [7] = "100011111111111111111111" WALLS [8] = "110011111011111000001111" WALLS [9] = "100011101010111010101111" WALLS [10] = "100011101010111000001111" WALLS [11] = "100111100000111010101111" WALLS [12] = "100011111111111000001111" WALLS [13] = "100011000010011100000001" WALLS [14] = "100000000000000000000001" WALLS [15] = "110000001101001000111001" WALLS [16] = "110111111111111111111001" WALLS [17] = "111111111111111111111001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 3 ey[1] = UNIT_SIZE * 13 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 7 ey[2] = UNIT_SIZE * 13 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 12 ey[3] = UNIT_SIZE * 13 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 4 ey[4] = UNIT_SIZE * 13 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 13 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 2 ey[6] = UNIT_SIZE * 5 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 2 ey[7] = UNIT_SIZE * 8 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 2 ey[8] = UNIT_SIZE * 6 exd[8] = 0 eyd[8] = -1 ex[9] = UNIT_SIZE * 2 ey[9] = UNIT_SIZE * 13 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 7 ey[10] = UNIT_SIZE * 4 exd[10] = -1 eyd[10] = 0 ex[11] = UNIT_SIZE * 13 ey[11] = UNIT_SIZE * 4 exd[11] = -1 eyd[11] = 0 ex[12] = UNIT_SIZE * 17 ey[12] = UNIT_SIZE * 4 exd[12] = 1 eyd[12] = 0 ex[13] = UNIT_SIZE * 10 ey[13] = UNIT_SIZE * 4 exd[13] = 1 eyd[13] = 0 ex[14] = UNIT_SIZE * 6 ey[14] = UNIT_SIZE * 4 exd[14] = 1 eyd[14] = 0 Endif If ss=5 then ENEMY_NUM = 16 ENEMY_SPEED = 7 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000001111110111" WALLS [3] = "100011111100001111110111" WALLS [4] = "111111110000000011010101" WALLS [5] = "111111100000000001000001" WALLS [6] = "111111000000000000111111" WALLS [7] = "111110000000000000011111" WALLS [8] = "111100000000000000001111" WALLS [9] = "111000000000000000000111" WALLS [10] = "111000000000000000000111" WALLS [11] = "111100000000000000001111" WALLS [12] = "111110000000000000011111" WALLS [13] = "111111000000000000111111" WALLS [14] = "100000100000000001111111" WALLS [15] = "101010110000000011111111" WALLS [16] = "100000111110011111110001" WALLS [17] = "101010111100000000000001" WALLS [18] = "100000111111111111111111" ex[1] = UNIT_SIZE * 15 ey[1] = UNIT_SIZE * 3 exd[1] = -1 eyd[1] = 0 ex[2] = UNIT_SIZE * 16 ey[2] = UNIT_SIZE * 4 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 17 ey[3] = UNIT_SIZE * 5 exd[3] = -1 eyd[3] = 0 ex[4] = UNIT_SIZE * 18 ey[4] = UNIT_SIZE * 6 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 19 ey[5] = UNIT_SIZE * 7 exd[5] = -1 eyd[5] = 0 ex[6] = UNIT_SIZE * 19 ey[6] = UNIT_SIZE * 10 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 18 ey[7] = UNIT_SIZE * 11 exd[7] = -1 eyd[7] = 0 ex[8] = UNIT_SIZE * 17 ey[8] = UNIT_SIZE * 12 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 16 ey[9] = UNIT_SIZE * 13 exd[9] = -1 eyd[9] = 0 ex[10] = UNIT_SIZE * 15 ey[10] = UNIT_SIZE * 14 exd[10] = -1 eyd[10] = 0 ex[11] = UNIT_SIZE * 11 ey[11] = UNIT_SIZE * 8 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 12 ey[12] = UNIT_SIZE * 8 exd[12] = -1 eyd[12] = 0 ex[13] = UNIT_SIZE * 11 ey[13] = UNIT_SIZE * 9 exd[13] = 1 eyd[13] = 0 ex[14] = UNIT_SIZE * 12 ey[14] = UNIT_SIZE * 9 exd[14] = 0 eyd[14] = -1 ex[15] = UNIT_SIZE * 13 ey[15] = UNIT_SIZE * 2 exd[15] = 0 eyd[15] = 1 ex[16] = UNIT_SIZE * 10 ey[16] = UNIT_SIZE * 14 exd[16] = 0 eyd[16] = -1 Endif If ss=6 then ENEMY_NUM = 40 ENEMY_SPEED = 7 WALLS [1] = "111111111111111111111111" WALLS [2] = "100010000000000000000001" WALLS [3] = "100010000000000000000001" WALLS [4] = "100010011111001111110001" WALLS [5] = "100000011111001111111001" WALLS [6] = "111110011111001111111001" WALLS [7] = "100000000000000000000001" WALLS [8] = "100000000000000000000001" WALLS [9] = "100110011111001110011001" WALLS [10] = "100110011111001110011001" WALLS [11] = "100110000000001110011111" WALLS [12] = "100010000000001110011111" WALLS [13] = "100110011011001110011111" WALLS [14] = "100110011111001110000001" WALLS [15] = "100110011111001110010001" WALLS [16] = "100000000000000000010001" WALLS [17] = "100000000000000000010001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 7 ey[1] = UNIT_SIZE * 1 exd[1] = 0 eyd[1] = 0 ex[2] = UNIT_SIZE * 11 ey[2] = UNIT_SIZE * 2 exd[2] = 0 eyd[2] = 0 ex[3] = UNIT_SIZE * 15 ey[3] = UNIT_SIZE * 1 exd[3] = 0 eyd[3] = 0 ex[4] = UNIT_SIZE * 18 ey[4] = UNIT_SIZE * 2 exd[4] = 0 eyd[4] = 0 ex[5] = UNIT_SIZE * 5 ey[5] = UNIT_SIZE * 5 exd[5] = 0 eyd[5] = 0 ex[6] = UNIT_SIZE * 6 ey[6] = UNIT_SIZE * 5 exd[6] = 0 eyd[6] = 0 ex[7] = UNIT_SIZE * 12 ey[7] = UNIT_SIZE * 4 exd[7] = 0 eyd[7] = 0 ex[8] = UNIT_SIZE * 13 ey[8] = UNIT_SIZE * 4 exd[8] = 0 eyd[8] = 0 ex[9] = UNIT_SIZE * 7 ey[9] = UNIT_SIZE * 6 exd[9] = 0 eyd[9] = 0 ex[10] = UNIT_SIZE * 11 ey[10] = UNIT_SIZE * 7 exd[10] = 0 eyd[10] = 0 ex[11] = UNIT_SIZE * 15 ey[11] = UNIT_SIZE * 6 exd[11] = 0 eyd[11] = 0 ex[12] = UNIT_SIZE * 19 ey[12] = UNIT_SIZE * 7 exd[12] = 0 eyd[12] = 0 ex[13] = UNIT_SIZE * 1 ey[13] = UNIT_SIZE * 9 exd[13] = 0 eyd[13] = 0 ex[14] = UNIT_SIZE * 2 ey[14] = UNIT_SIZE * 13 exd[14] = 0 eyd[14] = 0 ex[15] = UNIT_SIZE * 5 ey[15] = UNIT_SIZE * 9 exd[15] = 0 eyd[15] = 0 ex[16] = UNIT_SIZE * 6 ey[16] = UNIT_SIZE * 9 exd[16] = 0 eyd[16] = 0 ex[17] = UNIT_SIZE * 12 ey[17] = UNIT_SIZE * 9 exd[17] = 0 eyd[17] = 0 ex[18] = UNIT_SIZE * 13 ey[18] = UNIT_SIZE * 9 exd[18] = 0 eyd[18] = 0 ex[19] = UNIT_SIZE * 17 ey[19] = UNIT_SIZE * 10 exd[19] = 0 eyd[19] = 0 ex[20] = UNIT_SIZE * 18 ey[20] = UNIT_SIZE * 10 exd[20] = 0 eyd[20] = 0 ex[21] = UNIT_SIZE * 9 ey[21] = UNIT_SIZE * 15 exd[21] = 0 eyd[21] = 0 ex[22] = UNIT_SIZE * 9 ey[22] = UNIT_SIZE * 16 exd[22] = 0 eyd[22] = 0 ex[23] = UNIT_SIZE * 5 ey[23] = UNIT_SIZE * 1 exd[23] = 0 eyd[23] = 1 ex[24] = UNIT_SIZE * 5 ey[24] = UNIT_SIZE * 2 exd[24] = 1 eyd[24] = 0 ex[25] = UNIT_SIZE * 12 ey[25] = UNIT_SIZE * 1 exd[25] = 0 eyd[25] = 1 ex[26] = UNIT_SIZE * 21 ey[26] = UNIT_SIZE * 1 exd[26] = 0 eyd[26] = 1 ex[27] = UNIT_SIZE * 22 ey[27] = UNIT_SIZE * 1 exd[27] = -1 eyd[27] = 0 ex[28] = UNIT_SIZE * 1 ey[28] = UNIT_SIZE * 6 exd[28] = 0 eyd[28] = 1 ex[29] = UNIT_SIZE * 1 ey[29] = UNIT_SIZE * 7 exd[29] = 1 eyd[29] = 0 ex[30] = UNIT_SIZE * 18 ey[30] = UNIT_SIZE * 6 exd[30] = 0 eyd[30] = 1 ex[31] = UNIT_SIZE * 22 ey[31] = UNIT_SIZE * 6 exd[31] = -1 eyd[31] = 0 ex[32] = UNIT_SIZE * 22 ey[32] = UNIT_SIZE * 9 exd[32] = 0 eyd[32] = -1 ex[33] = UNIT_SIZE * 5 ey[33] = UNIT_SIZE * 10 exd[33] = 1 eyd[33] = 0 ex[34] = UNIT_SIZE * 13 ey[34] = UNIT_SIZE * 11 exd[34] = -1 eyd[34] = 0 ex[35] = UNIT_SIZE * 1 ey[35] = UNIT_SIZE * 15 exd[35] = 1 eyd[35] = 0 ex[36] = UNIT_SIZE * 2 ey[36] = UNIT_SIZE * 16 exd[36] = 0 eyd[36] = -1 ex[37] = UNIT_SIZE * 6 ey[37] = UNIT_SIZE * 16 exd[37] = 0 eyd[37] = -1 ex[38] = UNIT_SIZE * 13 ey[38] = UNIT_SIZE * 16 exd[38] = 0 eyd[38] = -1 ex[39] = UNIT_SIZE * 17 ey[39] = UNIT_SIZE * 16 exd[39] = 0 eyd[39] = -1 ex[40] = UNIT_SIZE * 18 ey[40] = UNIT_SIZE * 16 exd[40] = -1 eyd[40] = 0 Endif If ss=7 then ENEMY_NUM = 8 ENEMY_SPEED = 7 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000011011111111110111" WALLS [3] = "100111011011111111110111" WALLS [4] = "111111011011011111010101" WALLS [5] = "110000000000011111000001" WALLS [6] = "111111011011011011111111" WALLS [7] = "111111011011011011111111" WALLS [8] = "111100000000000011011111" WALLS [9] = "111111111011011011011111" WALLS [10] = "111111111011011011011111" WALLS [11] = "111111000000000000011111" WALLS [12] = "111111111111011011011111" WALLS [13] = "100000111111011011011111" WALLS [14] = "101010110000000000001111" WALLS [15] = "100000111111111011011111" WALLS [16] = "101010111111111011011001" WALLS [17] = "100000111111111000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 2 ey[1] = UNIT_SIZE * 4 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 4 ey[2] = UNIT_SIZE * 7 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 6 ey[3] = UNIT_SIZE * 10 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 8 ey[4] = UNIT_SIZE * 13 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 9 ey[5] = UNIT_SIZE * 1 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 12 ey[6] = UNIT_SIZE * 3 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 15 ey[7] = UNIT_SIZE * 5 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 18 ey[8] = UNIT_SIZE * 7 exd[8] = 0 eyd[8] = 1 Endif If ss=8 then ENEMY_NUM = 8 ENEMY_SPEED = 11 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000011111111111" WALLS [3] = "100000000100011111011111" WALLS [4] = "100000011101011111011111" WALLS [5] = "100000011100011101010111" WALLS [6] = "100111111101011101010111" WALLS [7] = "100111111100011100000111" WALLS [8] = "100111111001001111111111" WALLS [9] = "100000000000000000000001" WALLS [10] = "100101010100010101010001" WALLS [11] = "100000000000000000000001" WALLS [12] = "111111111001001111111001" WALLS [13] = "110000011100011111111001" WALLS [14] = "110101011101011111000001" WALLS [15] = "110000011100011111000001" WALLS [16] = "110101011101010000000001" WALLS [17] = "110000011100000000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 10 ey[1] = UNIT_SIZE * 8 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 12 ey[2] = UNIT_SIZE * 10 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 10 ey[3] = UNIT_SIZE * 10 exd[3] = -1 eyd[3] = 0 ex[4] = UNIT_SIZE * 12 ey[4] = UNIT_SIZE * 8 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 10 ey[5] = UNIT_SIZE * 8 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 12 ey[6] = UNIT_SIZE * 10 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 10 ey[7] = UNIT_SIZE * 8 exd[7] = 0 eyd[7] = -1 ex[8] = UNIT_SIZE * 12 ey[8] = UNIT_SIZE * 10 exd[8] = 0 eyd[8] = -1 Endif If ss=9 then ENEMY_NUM = 10 ENEMY_SPEED = 10 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000001000000100000001" WALLS [3] = "100000000011110000000001" WALLS [4] = "110000011100001000000001" WALLS [5] = "100000000000001000000001" WALLS [6] = "110000010100001000000011" WALLS [7] = "100111111101101111001001" WALLS [8] = "101000000000000000000101" WALLS [9] = "101111111100000000000101" WALLS [10] = "101000000000001111111101" WALLS [11] = "101000000000000000000101" WALLS [12] = "100100111101101111111001" WALLS [13] = "110000000100001000000011" WALLS [14] = "100000000100000000000001" WALLS [15] = "100000000100001110000011" WALLS [16] = "100000000011110000000001" WALLS [17] = "100000001000000100000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 1 ey[1] = UNIT_SIZE * 4 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 22 ey[2] = UNIT_SIZE * 13 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 10 ey[3] = UNIT_SIZE * 3 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 13 ey[4] = UNIT_SIZE * 14 exd[4] = 0 eyd[4] = -1 ex[5] = UNIT_SIZE * 3 ey[5] = UNIT_SIZE * 7 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 20 ey[6] = UNIT_SIZE * 10 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 10 ey[7] = UNIT_SIZE * 1 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 10 ey[8] = UNIT_SIZE * 16 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 1 ey[9] = UNIT_SIZE * 10 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 22 ey[10] = UNIT_SIZE * 10 exd[10] = 0 eyd[10] = 1 Endif If ss=10 then ENEMY_NUM = 22 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000000000000001" WALLS [3] = "111111111111111111111001" WALLS [4] = "110000000000000000000001" WALLS [5] = "111100000000000000001111" WALLS [6] = "111100000000000000001111" WALLS [7] = "111100000000000000001111" WALLS [8] = "111100000000000000001111" WALLS [9] = "111100000000000000001111" WALLS [10] = "111100000000000000001111" WALLS [11] = "111100000000000000001111" WALLS [12] = "111100000000000000001111" WALLS [13] = "111100000000000000001111" WALLS [14] = "100000000000000000000011" WALLS [15] = "100100010010010010001111" WALLS [16] = "100111111111111111111111" WALLS [17] = "100000000000000000000001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 21 ey[1] = UNIT_SIZE * 13 exd[1] = -1 eyd[1] = 0 ex[2] = UNIT_SIZE * 2 ey[2] = UNIT_SIZE * 3 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 4 ey[3] = UNIT_SIZE * 4 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 5 ey[4] = UNIT_SIZE * 6 exd[4] = 0 eyd[4] = -1 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 13 exd[5] = 0 eyd[5] = -1 ex[6] = UNIT_SIZE * 7 ey[6] = UNIT_SIZE * 11 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 8 ey[7] = UNIT_SIZE * 7 exd[7] = 0 eyd[7] = -1 ex[8] = UNIT_SIZE * 9 ey[8] = UNIT_SIZE * 3 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 10 ey[9] = UNIT_SIZE * 9 exd[9] = 0 eyd[9] = -1 ex[10] = UNIT_SIZE * 11 ey[10] = UNIT_SIZE * 5 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 12 ey[11] = UNIT_SIZE * 10 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 13 ey[12] = UNIT_SIZE * 8 exd[12] = 0 eyd[12] = 1 ex[13] = UNIT_SIZE * 14 ey[13] = UNIT_SIZE * 3 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 15 ey[14] = UNIT_SIZE * 13 exd[14] = 0 eyd[14] = -1 ex[15] = UNIT_SIZE * 16 ey[15] = UNIT_SIZE * 6 exd[15] = 0 eyd[15] = -1 ex[16] = UNIT_SIZE * 17 ey[16] = UNIT_SIZE * 7 exd[16] = 0 eyd[16] = 1 ex[17] = UNIT_SIZE * 18 ey[17] = UNIT_SIZE * 4 exd[17] = 0 eyd[17] = -1 ex[18] = UNIT_SIZE * 19 ey[18] = UNIT_SIZE * 10 exd[18] = 0 eyd[18] = -1 ex[19] = UNIT_SIZE * 17 ey[19] = UNIT_SIZE * 5 exd[19] = -1 eyd[19] = 0 ex[20] = UNIT_SIZE * 5 ey[20] = UNIT_SIZE * 7 exd[20] = 1 eyd[20] = 0 ex[21] = UNIT_SIZE * 12 ey[21] = UNIT_SIZE * 9 exd[21] = -1 eyd[21] = 0 ex[22] = UNIT_SIZE * 10 ey[22] = UNIT_SIZE * 11 exd[22] = 1 eyd[22] = 0 Endif If ss=11 then ENEMY_NUM = 25 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100001100000000000000001" WALLS [3] = "101101101101101101101101" WALLS [4] = "101101101101101101101101" WALLS [5] = "100000000000000000000001" WALLS [6] = "111101101101101101101101" WALLS [7] = "111101101101101101101101" WALLS [8] = "100000000000000000000001" WALLS [9] = "101101101101101101101101" WALLS [10] = "101101101101101101101101" WALLS [11] = "100000000000000000000001" WALLS [12] = "101101101101101101101111" WALLS [13] = "101101101101101101101111" WALLS [14] = "100000000000000000000001" WALLS [15] = "101101101101101101101101" WALLS [16] = "101101101101101101101101" WALLS [17] = "100000000000000001100001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 7 ey[1] = UNIT_SIZE * 1 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 1 ey[2] = UNIT_SIZE * 4 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 22 ey[3] = UNIT_SIZE * 7 exd[3] = -1 eyd[3] = 0 ex[4] = UNIT_SIZE * 1 ey[4] = UNIT_SIZE * 13 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 1 ey[5] = UNIT_SIZE * 16 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 1 ey[6] = UNIT_SIZE * 7 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 4 ey[7] = UNIT_SIZE * 1 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 7 ey[8] = UNIT_SIZE * 16 exd[8] = 0 eyd[8] = -1 ex[9] = UNIT_SIZE * 10 ey[9] = UNIT_SIZE * 1 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 13 ey[10] = UNIT_SIZE * 16 exd[10] = 0 eyd[10] = -1 ex[11] = UNIT_SIZE * 16 ey[11] = UNIT_SIZE * 1 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 19 ey[12] = UNIT_SIZE * 16 exd[12] = 0 eyd[12] = -1 ex[13] = UNIT_SIZE * 22 ey[13] = UNIT_SIZE * 1 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 22 ey[14] = UNIT_SIZE * 1 exd[14] = 0 eyd[14] = 0 ex[15] = UNIT_SIZE * 13 ey[15] = UNIT_SIZE * 1 exd[15] = 0 eyd[15] = 0 ex[16] = UNIT_SIZE * 7 ey[16] = UNIT_SIZE * 4 exd[16] = 0 eyd[16] = 0 ex[17] = UNIT_SIZE * 19 ey[17] = UNIT_SIZE * 4 exd[17] = 0 eyd[17] = 0 ex[18] = UNIT_SIZE * 7 ey[18] = UNIT_SIZE * 7 exd[18] = 0 eyd[18] = 0 ex[19] = UNIT_SIZE * 13 ey[19] = UNIT_SIZE * 7 exd[19] = 0 eyd[19] = 0 ex[20] = UNIT_SIZE * 4 ey[20] = UNIT_SIZE * 10 exd[20] = 0 eyd[20] = 0 ex[21] = UNIT_SIZE * 16 ey[21] = UNIT_SIZE * 10 exd[21] = 0 eyd[21] = 0 ex[22] = UNIT_SIZE * 10 ey[22] = UNIT_SIZE * 13 exd[22] = 0 eyd[22] = 0 ex[23] = UNIT_SIZE * 13 ey[23] = UNIT_SIZE * 13 exd[23] = 0 eyd[23] = 0 ex[24] = UNIT_SIZE * 7 ey[24] = UNIT_SIZE * 16 exd[24] = 0 eyd[24] = 0 ex[25] = UNIT_SIZE * 10 ey[25] = UNIT_SIZE * 10 exd[25] = 1 eyd[25] = 0 Endif If ss=12 then ENEMY_NUM = 27 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "101111011101110111011111" WALLS [3] = "100000000000000000000001" WALLS [4] = "110101010101010101010101" WALLS [5] = "110000000000000000000001" WALLS [6] = "110101010101010101010101" WALLS [7] = "100000000000000000000001" WALLS [8] = "110101010101010101010101" WALLS [9] = "110000000000000000000001" WALLS [10] = "110101010101010101010101" WALLS [11] = "100000000000000000000001" WALLS [12] = "110101010101010101010101" WALLS [13] = "110000000000000000000001" WALLS [14] = "110101010101010101010111" WALLS [15] = "100000000000000000000001" WALLS [16] = "110101010101010101010101" WALLS [17] = "110000000000000000010001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 2 ey[1] = UNIT_SIZE * 2 exd[1] = 0 eyd[1] = 1 ex[2] = UNIT_SIZE * 4 ey[2] = UNIT_SIZE * 16 exd[2] = 0 eyd[2] = -1 ex[3] = UNIT_SIZE * 6 ey[3] = UNIT_SIZE * 1 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 8 ey[4] = UNIT_SIZE * 11 exd[4] = 0 eyd[4] = -1 ex[5] = UNIT_SIZE * 10 ey[5] = UNIT_SIZE * 4 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 12 ey[6] = UNIT_SIZE * 3 exd[6] = 0 eyd[6] = -1 ex[7] = UNIT_SIZE * 14 ey[7] = UNIT_SIZE * 9 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 16 ey[8] = UNIT_SIZE * 10 exd[8] = 0 eyd[8] = -1 ex[9] = UNIT_SIZE * 18 ey[9] = UNIT_SIZE * 16 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 20 ey[10] = UNIT_SIZE * 7 exd[10] = 0 eyd[10] = -1 ex[11] = UNIT_SIZE * 22 ey[11] = UNIT_SIZE * 2 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 1 ey[12] = UNIT_SIZE * 2 exd[12] = 1 eyd[12] = 0 ex[13] = UNIT_SIZE * 22 ey[13] = UNIT_SIZE * 4 exd[13] = -1 eyd[13] = 0 ex[14] = UNIT_SIZE * 7 ey[14] = UNIT_SIZE * 6 exd[14] = 1 eyd[14] = 0 ex[15] = UNIT_SIZE * 15 ey[15] = UNIT_SIZE * 8 exd[15] = -1 eyd[15] = 0 ex[16] = UNIT_SIZE * 17 ey[16] = UNIT_SIZE * 10 exd[16] = 1 eyd[16] = 0 ex[17] = UNIT_SIZE * 3 ey[17] = UNIT_SIZE * 12 exd[17] = -1 eyd[17] = 0 ex[18] = UNIT_SIZE * 4 ey[18] = UNIT_SIZE * 14 exd[18] = 1 eyd[18] = 0 ex[19] = UNIT_SIZE * 18 ey[19] = UNIT_SIZE * 16 exd[19] = -1 eyd[19] = 0 ex[20] = UNIT_SIZE * 2 ey[20] = UNIT_SIZE * 12 exd[20] = 0 eyd[20] = 0 ex[21] = UNIT_SIZE * 6 ey[21] = UNIT_SIZE * 8 exd[21] = 0 eyd[21] = 0 ex[22] = UNIT_SIZE * 8 ey[22] = UNIT_SIZE * 16 exd[22] = 0 eyd[22] = 0 ex[23] = UNIT_SIZE * 10 ey[23] = UNIT_SIZE * 6 exd[23] = 0 eyd[23] = 0 ex[24] = UNIT_SIZE * 12 ey[24] = UNIT_SIZE * 14 exd[24] = 0 eyd[24] = 0 ex[25] = UNIT_SIZE * 14 ey[25] = UNIT_SIZE * 10 exd[25] = 0 eyd[25] = 0 ex[26] = UNIT_SIZE * 16 ey[26] = UNIT_SIZE * 2 exd[26] = 0 eyd[26] = 0 ex[27] = UNIT_SIZE * 18 ey[27] = UNIT_SIZE * 8 exd[27] = 0 eyd[27] = 0 Endif If ss=13 then ENEMY_NUM = 9 WALLS [1] = "111111111111111111111111" WALLS [2] = "100011000000000000000011" WALLS [3] = "100011011010111101111011" WALLS [4] = "101111011110111101111011" WALLS [5] = "101111011110111101111011" WALLS [6] = "101111011110111101111011" WALLS [7] = "100000000000000000000011" WALLS [8] = "101111011110111101111011" WALLS [9] = "101111001110111101111011" WALLS [10] = "101111011110111001111011" WALLS [11] = "101111011110111101111011" WALLS [12] = "100000000000000000000011" WALLS [13] = "101111011110111101111011" WALLS [14] = "101111011110111101111011" WALLS [15] = "101111011110111101111011" WALLS [16] = "101111011110101101110001" WALLS [17] = "100000000000000001110001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 6 ey[1] = UNIT_SIZE * 1 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 21 ey[2] = UNIT_SIZE * 6 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 1 ey[3] = UNIT_SIZE * 11 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 16 ey[4] = UNIT_SIZE * 16 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 1 ey[5] = UNIT_SIZE * 3 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 6 ey[6] = UNIT_SIZE * 16 exd[6] = 0 eyd[6] = -1 ex[7] = UNIT_SIZE * 11 ey[7] = UNIT_SIZE * 1 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 16 ey[8] = UNIT_SIZE * 16 exd[8] = 0 eyd[8] = -1 ex[9] = UNIT_SIZE * 21 ey[9] = UNIT_SIZE * 1 exd[9] = 0 eyd[9] = 1 EndIf If ss=14 then ENEMY_NUM = 34 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "101111111000001111111111" WALLS [3] = "101111110000000111111111" WALLS [4] = "101111100000000011111111" WALLS [5] = "101111000000000001111111" WALLS [6] = "101110000000000000111111" WALLS [7] = "101100000000000000011111" WALLS [8] = "101000000000000000001111" WALLS [9] = "100000000000000000000111" WALLS [10] = "111000000000000000000001" WALLS [11] = "111000000000000000000101" WALLS [12] = "111000000000000000000101" WALLS [13] = "111000000000000000000101" WALLS [14] = "111000000000000000000101" WALLS [15] = "111000000000000000000101" WALLS [16] = "111000000000000000000101" WALLS [17] = "111000000000000000000101" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 9 ey[1] = UNIT_SIZE * 1 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 8 ey[2] = UNIT_SIZE * 2 exd[2] = 1 eyd[2] = 0 ex[3] = UNIT_SIZE * 7 ey[3] = UNIT_SIZE * 3 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 6 ey[4] = UNIT_SIZE * 4 exd[4] = 1 eyd[4] = 0 ex[5] = UNIT_SIZE * 5 ey[5] = UNIT_SIZE * 5 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 4 ey[6] = UNIT_SIZE * 6 exd[6] = 1 eyd[6] = 0 ex[7] = UNIT_SIZE * 3 ey[7] = UNIT_SIZE * 7 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 1 ey[8] = UNIT_SIZE * 8 exd[8] = 1 eyd[8] = 0 ex[9] = UNIT_SIZE * 22 ey[9] = UNIT_SIZE * 9 exd[9] = -1 eyd[9] = 0 ex[10] = UNIT_SIZE * 3 ey[10] = UNIT_SIZE * 10 exd[10] = 1 eyd[10] = 0 ex[11] = UNIT_SIZE * 20 ey[11] = UNIT_SIZE * 11 exd[11] = -1 eyd[11] = 0 ex[12] = UNIT_SIZE * 3 ey[12] = UNIT_SIZE * 12 exd[12] = 1 eyd[12] = 0 ex[13] = UNIT_SIZE * 20 ey[13] = UNIT_SIZE * 13 exd[13] = -1 eyd[13] = 0 ex[14] = UNIT_SIZE * 3 ey[14] = UNIT_SIZE * 14 exd[14] = 1 eyd[14] = 0 ex[15] = UNIT_SIZE * 20 ey[15] = UNIT_SIZE * 15 exd[15] = -1 eyd[15] = 0 ex[16] = UNIT_SIZE * 3 ey[16] = UNIT_SIZE * 16 exd[16] = 1 eyd[16] = 0 ex[17] = UNIT_SIZE * 3 ey[17] = UNIT_SIZE * 7 exd[17] = 0 eyd[17] = 1 ex[18] = UNIT_SIZE * 4 ey[18] = UNIT_SIZE * 6 exd[18] = 0 eyd[18] = 1 ex[19] = UNIT_SIZE * 5 ey[19] = UNIT_SIZE * 5 exd[19] = 0 eyd[19] = 1 ex[20] = UNIT_SIZE * 6 ey[20] = UNIT_SIZE * 4 exd[20] = 0 eyd[20] = 1 ex[21] = UNIT_SIZE * 7 ey[21] = UNIT_SIZE * 3 exd[21] = 0 eyd[21] = 1 ex[22] = UNIT_SIZE * 8 ey[22] = UNIT_SIZE * 2 exd[22] = 0 eyd[22] = 1 ex[23] = UNIT_SIZE * 9 ey[23] = UNIT_SIZE * 1 exd[23] = 0 eyd[23] = 1 ex[24] = UNIT_SIZE * 10 ey[24] = UNIT_SIZE * 16 exd[24] = 0 eyd[24] = -1 ex[25] = UNIT_SIZE * 11 ey[25] = UNIT_SIZE * 1 exd[25] = 0 eyd[25] = 1 ex[26] = UNIT_SIZE * 12 ey[26] = UNIT_SIZE * 16 exd[26] = 0 eyd[26] = -1 ex[27] = UNIT_SIZE * 13 ey[27] = UNIT_SIZE * 1 exd[27] = 0 eyd[27] = 1 ex[28] = UNIT_SIZE * 14 ey[28] = UNIT_SIZE * 2 exd[28] = 0 eyd[28] = 1 ex[29] = UNIT_SIZE * 15 ey[29] = UNIT_SIZE * 3 exd[29] = 0 eyd[29] = 1 ex[30] = UNIT_SIZE * 16 ey[30] = UNIT_SIZE * 4 exd[30] = 0 eyd[30] = 1 ex[31] = UNIT_SIZE * 17 ey[31] = UNIT_SIZE * 5 exd[31] = 0 eyd[31] = 1 ex[32] = UNIT_SIZE * 18 ey[32] = UNIT_SIZE * 6 exd[32] = 0 eyd[32] = 1 ex[33] = UNIT_SIZE * 19 ey[33] = UNIT_SIZE * 7 exd[33] = 0 eyd[33] = 1 ex[34] = UNIT_SIZE * 20 ey[34] = UNIT_SIZE * 8 exd[34] = 0 eyd[34] = 1 EndIf If ss=15 then ENEMY_NUM = 20 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100100001111111111111111" WALLS [3] = "100001100000000000111111" WALLS [4] = "100111011011011011011111" WALLS [5] = "111111000000000000011111" WALLS [6] = "111111011011011011011111" WALLS [7] = "111111000000000000011111" WALLS [8] = "111111111011011011011111" WALLS [9] = "111111000000000000011111" WALLS [10] = "111111011011011011011111" WALLS [11] = "111111000000000000011111" WALLS [12] = "111111011011011011011111" WALLS [13] = "111111000000000000011111" WALLS [14] = "111111011011011011111111" WALLS [15] = "111111000000000000011001" WALLS [16] = "111111011011011011000001" WALLS [17] = "111111000000000000011001" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 7 ey[1] = UNIT_SIZE * 2 exd[1] = 1 eyd[1] = 0 ex[2] = UNIT_SIZE * 18 ey[2] = UNIT_SIZE * 4 exd[2] = -1 eyd[2] = 0 ex[3] = UNIT_SIZE * 6 ey[3] = UNIT_SIZE * 6 exd[3] = 1 eyd[3] = 0 ex[4] = UNIT_SIZE * 18 ey[4] = UNIT_SIZE * 8 exd[4] = -1 eyd[4] = 0 ex[5] = UNIT_SIZE * 6 ey[5] = UNIT_SIZE * 10 exd[5] = 1 eyd[5] = 0 ex[6] = UNIT_SIZE * 18 ey[6] = UNIT_SIZE * 12 exd[6] = -1 eyd[6] = 0 ex[7] = UNIT_SIZE * 6 ey[7] = UNIT_SIZE * 14 exd[7] = 1 eyd[7] = 0 ex[8] = UNIT_SIZE * 18 ey[8] = UNIT_SIZE * 16 exd[8] = -1 eyd[8] = 0 ex[9] = UNIT_SIZE * 6 ey[9] = UNIT_SIZE * 8 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 9 ey[10] = UNIT_SIZE * 4 exd[10] = 0 eyd[10] = 1 ex[11] = UNIT_SIZE * 12 ey[11] = UNIT_SIZE * 11 exd[11] = 0 eyd[11] = 1 ex[12] = UNIT_SIZE * 15 ey[12] = UNIT_SIZE * 7 exd[12] = 0 eyd[12] = -1 ex[13] = UNIT_SIZE * 18 ey[13] = UNIT_SIZE * 3 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 12 ey[14] = UNIT_SIZE * 2 exd[14] = 0 eyd[14] = 0 ex[15] = UNIT_SIZE * 12 ey[15] = UNIT_SIZE * 6 exd[15] = 0 eyd[15] = 0 ex[16] = UNIT_SIZE * 9 ey[16] = UNIT_SIZE * 8 exd[16] = 0 eyd[16] = 0 ex[17] = UNIT_SIZE * 15 ey[17] = UNIT_SIZE * 8 exd[17] = 0 eyd[17] = 0 ex[18] = UNIT_SIZE * 12 ey[18] = UNIT_SIZE * 12 exd[18] = 0 eyd[18] = 0 ex[19] = UNIT_SIZE * 15 ey[19] = UNIT_SIZE * 14 exd[19] = 0 eyd[19] = 0 ex[20] = UNIT_SIZE * 9 ey[20] = UNIT_SIZE * 16 exd[20] = 0 eyd[20] = 0 EndIf If ss=16 then GraphicsWindow.ShowMessage("全ステージクリア", "おめでとう") Goto gameend Endif ' ���クリーンの初期設定 GraphicsWindow.Show() ' 表示 GraphicsWindow.Width = SCREEN_WIDTH * UNIT_SIZE ' 幅を設定 GraphicsWindow.Height = SCREEN_HEIGHT * UNIT_SIZE ' 高さを設定 GraphicsWindow.CanResize = "False" ' サイズを固定 GraphicsWindow.BackgroundColor = BACK_COLOR ' 背景色を設定 ' 壁の描画 GraphicsWindow.BrushColor = WALL_COLOR ' ブラシの色を設定 For iy = 1 To Array.GetItemCount(WALLS) ' 縦方向の繰り返し(WALLS配列の数だけ) For ix = 1 To Text.GetLength(WALLS [iy]) ' 横方向の繰り返し(文字列の長さだけ) If Text.GetSubText(WALLS [iy], ix, 1) = "1" Then ' 文字が"1"だったら GraphicsWindow.FillRectangle(UNIT_SIZE * (ix - 1), UNIT_SIZE * (iy - 1), UNIT_SIZE, UNIT_SIZE) EndIf EndFor EndFor ' GOAL GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = "True" GraphicsWindow.DrawText(GOAL_X * UNIT_SIZE, GOAL_Y * UNIT_SIZE, "GOAL") ' ロボットのスタート地点 x = UNIT_SIZE * 22 ' 横位置 (左から12ユニット) y = UNIT_SIZE * 16 ' 縦位置 (上から10ユニット) xd = 0 ' 横移動方向 (-1:左, 0:止, 1:右) 移動用 yd = 0 ' 縦移動方向 (-1:上, 0:止, 1:下) 移動用 xk = 0 ' 横移動方向 (-1:左, 0:止, 1:右) キーボード受付用 yk = 0 ' 縦移動方向 (-1:上, 0:止, 1:下) キーボード受付用 ' ロボット初期描画 GraphicsWindow.BrushColor = ROBO_COLOR ' ブラシの色を設定 GraphicsWindow.PenColor = ROBO_COLOR ' ペンの色を設定 robot = Shapes.AddEllipse(UNIT_SIZE, UNIT_SIZE) ' ロボットのシェイプを設定 Shapes.Move(robot, x, y) ' ロボットのシェイプを初期位置に ' 敵の描画 GraphicsWindow.BrushColor = ENEMY_COLOR GraphicsWindow.PenColor = ENEMY_COLOR For ie = 1 To ENEMY_NUM enemy[ie] = Shapes.AddEllipse(UNIT_SIZE, UNIT_SIZE) Shapes.Move(enemy[ie], ex[ie], ey[ie]) EndFor Controls.AddButton("終了",660,5) Controls.ButtonClicked = onbutton1 ' キーボードイベントの設定 GraphicsWindow.KeyDown = onKeyDown ' キーが押されたらonKeyDownサブルーチンを呼ぶ While xk = 0 And yk = 0 EndWhile starttime = Clock.ElapsedMilliseconds ' メインループ status = "" While status = "" ' 繰り返し(無条件に) ' キーボードからの方向指示を受け付ける ' ロボットの縦位置・横位置ともにユニット単位だったら If Math.Remainder(x, UNIT_SIZE) = 0 And Math.Remainder(y, UNIT_SIZE) = 0 Then ' キーボード受け付け用の方向情報を移動用の方向情報にコピー xd = xk ' 横方向 yd = yk ' 縦方向 EndIf ' このまま一回分進んだ場合のマップ上の位置を求める ' まずピクセル単位で位置を求め、それをユニットのサイズで割ることでマップ上の位置を求める If xd < 0 Then nx = x - 1 ElseIf 0 < xd then nx = x + UNIT_SIZE + 1 Else nx = x EndIf nxi = Math.Floor(nx / UNIT_SIZE) + 1 If yd < 0 Then ny = y - 1 ElseIf 0 < yd then ny = y + UNIT_SIZE + 1 Else ny = y EndIf nyi = Math.Floor(ny / UNIT_SIZE) + 1 ' マップ上の求めた位置に壁があるか If Text.GetSubText(WALLS [nyi], nxi, 1) = "1" Then ' すべての移動方向を0に設定する(つまり、停止させる) xk = 0 yk = 0 xd = 0 yd = 0 EndIf ' ロボットの移動位置を計算 x = x + xd * SPEED y = y + yd * SPEED ' ロボットのシェイプを移動 Shapes.Move(robot, x, y) ' ゴール判定 If x = GOAL_X * UNIT_SIZE And y = GOAL_Y * UNIT_SIZE Then status = "GOAL" gametime = Clock.ElapsedMilliseconds - starttime GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(300,200, gametime / 100) EndIf ' 敵の動き For ie = 1 To ENEMY_NUM If exd[ie] < 0 Then enx = ex[ie] - 1 ElseIf 0 < exd[ie] then enx = ex[ie] + UNIT_SIZE + 1 Else enx = ex[ie] EndIf enxi = Math.Floor(enx / UNIT_SIZE) + 1 If eyd[ie] < 0 Then eny = ey[ie] - 1 ElseIf 0 < eyd[ie] then eny = ey[ie] + UNIT_SIZE + 1 Else eny = ey[ie] EndIf enyi = Math.Floor(eny / UNIT_SIZE) + 1 If Text.GetSubText(WALLS [enyi], enxi, 1) = "1" Then ' 敵が壁にぶつかった時、逆方向に動く exd[ie] = -exd[ie] eyd[ie] = -eyd[ie] EndIf ex[ie] = ex[ie] + exd[ie] * ENEMY_SPEED ey[ie] = ey[ie] + eyd[ie] * ENEMY_SPEED Shapes.Move(enemy[ie], ex[ie], ey[ie]) If (x - ex[ie]) * (x - ex[ie]) + (y - ey[ie]) * (y - ey[ie]) < UNIT_SIZE * UNIT_SIZE Then status = "GAME OVER" GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.PenColor = "Yellow" GraphicsWindow.FillEllipse(x - 135, y - 135, 300, 300) Program.Delay(DELAY) GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.FillEllipse(x - 135, y - 135, 300, 300) GraphicsWindow.ShowMessage("ギャーーー!!", "OUT") DEATH=DEATH+1 GraphicsWindow.ShowMessage("あなたの死亡回数は"+DEATH+"です", "OUT") If DEATH = 50 then GraphicsWindow.ShowMessage("つらくなってきたかな?", "がんばれ") Endif If DEATH = 100 then GraphicsWindow.ShowMessage("もうだめぽ", "OUT") GraphicsWindow.Clear() Goto gameend Endif Goto st EndIf If click = 1 then GraphicsWindow.ShowMessage("お疲れさまでした", "ゲームを終了します") GraphicsWindow.Clear() click = 0 Goto cls EndIf EndFor ' 速度調整のための待機 Program.Delay(DELAY) EndWhile If status = "GOAL" then If ss=6 then GraphicsWindow.ShowMessage ("残機が15機増えた","命を���に入れた") DEATH = DEATH - 15 If DEATH < 0 then DEATH = 0 EndIf EndIf GraphicsWindow.ShowMessage("次のステージへ", "ゴール") ss=ss+1 goto st EndIf gameend: Goto cls Sub onbutton1 click = click + 1 EndSub ' サブルーチン (キーが押されたときに呼ばれる) Sub onKeyDown KeyName = GraphicsWindow.LastKey ' 最後に操作されたキーの名前を取得 If KeyName = "Left" Then ' カーソル(左)キーだったら xk = -1 ' 横移動方向を左(-1)に yk = 0 ' 縦移動方向を止(0)に ElseIf KeyName = "Right" Then ' カーソル(右)キーだったら xk = 1 ' 横移動方向を右(1)に yk = 0 ' 縦移動方向を止(0)に ElseIf KeyName = "Up" Then ' カーソル(上)キーだったら xk = 0 ' 横移動方向を止(0)に yk = -1 ' 縦移動方向を上(-1)に ElseIf KeyName = "Down" Then ' カーソル(下)キーだったら xk = 0 ' 横移動方向を止(0)に yk = 1 ' 縦移動方向を下(1)に ElseIf KeyName = "Space" Then xk = 0 yk = 0 EndIf EndSub End>VNC295.sb< Start>VND704.sb< ' SmallBasic Version 1.2 ' Program: (De)Charge Capacitor (w.Coil) ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/0f062147-a4b9-4f43-a3f5-0dd04dd20b3d/26012017 ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: http://gfs.khmeyberg.de/Materialien/Materialien-Start.html ' http://gfs.khmeyberg.de/Materialien/IIPhysik/KondensatorSpuleMathematik.pdf ' http://gfs.khmeyberg.de/Materialien/IIPhysik/UebungenZuKondensatorEntAufLaden.pdf ' http://gfs.khmeyberg.de/was%20ist%20neu.html ' http://gfs.khmeyberg.de/0607/0607Kurs12Ph2/KondensatorSpuleMathematik.pdf ' http://we.pb.edu.pl/~kaie/kaie-md/TREiT/TREiTsem4wyk2.pdf PL: Cewka pojemnościowy równanie różniczkowe pdf ' https://www.if.pw.edu.pl/~malys/2013-w17-Drgaia-i-fale.pdf ' http://docs3.chomikuj.pl/2337775570,PL,0,0,sciaga_na_elektronike.doc ' http://www.mif.pg.gda.pl/homepages/bzyk/elel/K2_wzto_w3_SN1.pdf ' Variables: ' ToDo: ' ================================================================================ gw = Desktop.Width - 14 gh = Desktop.Height - 96 ' for taskbar height 60 BuildData() GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = 0 GraphicsWindow.Top = 0 graph = LDGraph.AddGraph(0,0, gw,gh, "Capacitor U/I , +Coil I-On/U-Off", "Time [s]", "U [V] / I [A]") LDGraph.AddSeriesLine(graph, "Cap U(t)", arrCapU, "Red") LDGraph.AddSeriesLine(graph, "Cap I(t)", arrCapI, "Blue") LDGraph.AddSeriesLine(graph, "+Coil On I(t)", arrCoilOn, "Green") LDGraph.AddSeriesLine(graph, "+Coil Off U(t)", arrCoilOff, "Orange") GraphicsWindow.KeyDown = OnKeyDown Sub BuildData '' U/I on Cap U1 = 10 ' [V] R = 2 ' [Ohm, Ω] I0 = U1 / R ' [A] C = 0.01 ' "10E-3" [F] h = 0.004 ' "4E-3" [sec] '' w.Coil (Inductor?) On/Off U = 10 ' arrCapU["0.100"] = 9.93262053000914530 [V] I1 = U / R 'arrCapI["0.100"] = 0.03368973499542735 [A] L = 0.05 ' [H] hypothetic value to fit into the graph For t = 0 To 0.1 Step h ' "4E-3" arrCapU[t] = U1 * (1 - LDMath.Exp(-t/R/C)) arrCapI[t] = I0 * LDMath.Exp(-t/R/C) arrCoilOn[t] = I1 * (1 - LDMath.Exp(-R*t/L)) arrCoilOff[t] = U * LDMath.Exp(-R*t/L) EndFor EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub End>VND704.sb< Start>VNF563.sb< lastcmd = 0 quot = Text.GetCharacter(34) compiler = "" filename = "" While lastcmd <> 5 Mainmenu() Choice() EndWhile Sub Choice TextWindow.Clear() If lastcmd = 1 Then GetFile() ElseIf lastcmd = 2 Then GetCompiler() ElseIf lastcmd = 3 Then GetReference() ElseIf lastcmd = 4 Then GetName() ElseIf lastcmd = 5 Then CreateLine() EndIf EndSub Sub GetFile TextWindow.WriteLine("Enter the path to the file you're compiling.") TextWindow.Write("File: ") tfile = TextWindow.Read() fcnt = Array.GetItemCount("file") If Array.ContainsValue("file", tfile) = "False" Then Array.SetValue("file", fcnt, tfile) EndIf EndSub Sub GetCompiler TextWindow.WriteLine("Enter the path to the compiler you're using.") TextWindow.Write("Compiler: ") compiler = TextWindow.Read() EndSub Sub GetReference TextWindow.WriteLine("Enter the path to the reference file you're using.") TextWindow.Write("Reference: ") tref = TextWindow.Read() rcnt = Array.GetItemCount("ref") If Array.ContainsValue("ref", tref) = "False" Then Array.SetValue("ref", rcnt, tref) EndIf EndSub Sub GetName TextWindow.WriteLine("Enter the filename of the DLL you're compiling.") TextWindow.WriteLine("(Example: myext.dll, c:\small basic\lib\myext.dll)") TextWindow.Write("Filename: ") filename = TextWindow.Read() EndSub Sub CreateLine line = compiler + " " fcnt = 0 While fcnt < Array.GetItemCount("file") line = line + quot + Array.GetValue("file", fcnt) + quot + " " fcnt = fcnt + 1 EndWhile line = line + "/out:" + quot + filename + quot + " /target:library " line = line + " /r:" + quot + Array.GetValue("ref", 0) + quot rcnt = 1 While rcnt < Array.GetItemCount("ref") line = line + ";" + quot + Array.GetValue("ref", rcnt) + quot rcnt = rcnt + 1 EndWhile TextWindow.WriteLine("Use the following line to compile your DLL.") TextWindow.WriteLine("") TextWindow.WriteLine(line) TextWindow.WriteLine("") TextWindow.Write("Press any key to colntinue...") TextWindow.PauseWithoutMessage() Program.End() EndSub Sub Mainmenu TextWindow.Clear() TextWindow.WriteLine("1. Input the file to compile.") TextWindow.WriteLine("2. Input the path to the compiler.") TextWindow.WriteLine("3. Input the path of a reference file.") TextWindow.WriteLine("4. Input the name of DLL you're compiling.") TextWindow.WriteLine("5. Create compiler line and exit.") TextWindow.Write("") TextWindow.Write("Choose: ") lastcmd = TextWindow.ReadNumber() EndSub End>VNF563.sb< Start>VNF823.sb< ' Flag of the Netherlands ' Copyright © 2020 Nonki Takahashi. The MIT License. ' Last update 2020-03-01 GraphicsWindow.Title = "Flag of the Netherlands" SB_Workaround() Init() ' initialize shapes Shapes_Init_Netherlands() name = "Netherlands" scale = gw / 9 Group_Add() Sub Init gw = 600 gh = 400 GraphicsWindow.Width = gw GraphicsWindow.Height = gh angle = 0 EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY, origin of shape array ' param scale - scale of group ' param shape[] - shape array ' param nGroup - number of group ' return nGroup - updated number of group ' return group - group array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["cx"] = shWidth / 2 grp["height"] = shHeight s = scale grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = i To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init_Netherlands ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 0 ' x offset shY = 0 ' y offset shape = "" shape[1] = "func=rect;x=0;y=0;width=9;height=6;bc=#21468B;pw=0;" shape[2] = "func=rect;x=0;y=0;width=9;height=4;bc=#FFF;pw=0;" shape[3] = "func=rect;x=0;y=0;width=9;height=2;bc=#AE1C28;pw=0;" EndSub End>VNF823.sb< Start>VNG363.sb< Initialise() 'Main Loop While("True") start = Clock.ElapsedMilliseconds movePlayers() updateScoring() delay = 25 - (Clock.ElapsedMilliseconds-start) 'Max delay of 25ms is 40 fps If (delay > 0) Then Program.Delay(delay) EndIf EndWhile '=============================================== 'SUBROUTINES '=============================================== Sub Initialise gw = 800 gh = 400 GraphicsWindow.Title = "Float like a butterfly Sting like a bee" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp 'Images - speed up start by downloading the images to local folder or better create some good images! dir = "http://litdev.hostoi.com/game_images/" 'dir = Program.Directory+"\" GraphicsWindow.DrawResizedImage(dir+"field.jpg",0,0,gw,gh) standL = ImageList.LoadImage(dir+"StandL.png") standR = ImageList.LoadImage(dir+"StandR.png") punchL = ImageList.LoadImage(dir+"PunchL.png") punchR = ImageList.LoadImage(dir+"PunchR.png") blockL = ImageList.LoadImage(dir+"BlockL.png") blockR = ImageList.LoadImage(dir+"BlockR.png") For i = 1 To 3 walkL[i] = ImageList.LoadImage(dir+"WalkL"+i+".png") walkR[i] = ImageList.LoadImage(dir+"WalkR"+i+".png") EndFor imageWidth = ImageList.GetWidthOfImage(standL) ' assume all the same size imageHeight = ImageList.GetHeightOfImage(standL) 'Image shapes for each player playerStand[1] = Shapes.AddImage(standR) playerStand[2] = Shapes.AddImage(standL) Shapes.HideShape(playerStand[1]) Shapes.HideShape(playerStand[2]) playerPunch[1] = Shapes.AddImage(punchR) playerPunch[2] = Shapes.AddImage(punchL) Shapes.HideShape(playerPunch[1]) Shapes.HideShape(playerPunch[2]) playerBlock[1] = Shapes.AddImage(blockR) playerBlock[2] = Shapes.AddImage(blockL) Shapes.HideShape(playerBlock[1]) Shapes.HideShape(playerBlock[2]) For j = 1 To 3 playerWalk[1][j] = Shapes.AddImage(walkR[j]) playerWalk[2][j] = Shapes.AddImage(walkL[j]) Shapes.HideShape(playerWalk[1][j]) Shapes.HideShape(playerWalk[2][j]) EndFor 'Positioning and control playerX[1] = (gw-imageWidth)/2-100 'Initial X (Left of player) playerY[1] = gh - imageHeight 'Initial Y (Top of player) playerX[2] = (gw-imageWidth)/2+100 'Initial X (Left of player) playerY[2] = gh - imageHeight 'Initial Y (Top of player) proximity = 80 'How close players can get - they must be at this distance to score a punch actionDelay = 10 'Number of frames to hold an action For i = 1 To 2 ' These are per player since they could change with game play e.g. getting tired or being hit too much actionRepeat[i] = 10 'Number of frames before a new action can be performed EndFor 'Show initial players player[1] = playerStand[1] player[2] = playerStand[2] For i = 1 To 2 playerFrame[i] = 1 'First frame Shapes.Move(player[i],playerX[i],playerY[i]) Shapes.ShowShape(player[i]) EndFor 'Scoring GraphicsWindow.BrushColor = "Black" For i = 1 To 2 scoreBox[i] = Shapes.AddText("") score[i] = 0 EndFor Shapes.Move(scoreBox[1],10,10) Shapes.Move(scoreBox[2],gw-200,10) 'Instructions GraphicsWindow.DrawText(10,40,"Back (Z) Forward (X) Punch (Q) Block (A)") GraphicsWindow.DrawText(gw-300,40,"Back (Right) Forward (Left) Punch (P) Block (L)") EndSub 'Move players 'player[i] is the current active shown image for each player (there is only ever one not hidden at a time) Sub movePlayers i = 1 'Player 1 j = 2 'Player 2 actionFrame[i] = actionFrame[i]+1 If (keyDown["Z"]) Then If (playerX[i] > 0) Then playerX[i] = playerX[i]-2 'Move player position left move() EndIf ElseIf (keyDown["X"]) Then If (playerX[i] < playerX[j]-proximity) Then playerX[i] = playerX[i]+2 'Move player position right move() EndIf ElseIf (keyDown["Q"] And actionFrame[i] > actionRepeat[i]) Then punch() keyDown["Q"] = "False" 'Setting to "False" means punch will not be restarted untill Q is pressed again (after it is released, no autorepeat) ElseIf (keyDown["A"] And actionFrame[i] > actionRepeat[i]) Then block() keyDown["A"] = "False" ElseIf (actionFrame[i] = actionDelay) Then 'Check for hit at end of action - time for defender to do a block if they are quick enough hitCheck() ElseIf (actionFrame[i] > actionDelay) Then stand() iFrame[i] = 0 'Reset frame count for next movement playerFrame[i] = 1 'Reset first frame for next movement EndIf i = 2 'Player 2 j = 1 'Player 1 actionFrame[i] = actionFrame[i]+1 If (keyDown["Left"]) Then If (playerX[i] > playerX[j]+proximity) Then playerX[i] = playerX[i]-2 move() EndIf ElseIf (keyDown["Right"]) Then If (playerX[i] < gw-imageWidth) Then playerX[i] = playerX[i]+2 move() EndIf ElseIf (keyDown["P"] And actionFrame[i] > actionRepeat[i]) Then punch() keyDown["P"] = "False" ElseIf (keyDown["L"] And actionFrame[i] > actionRepeat[i]) Then block() keyDown["L"] = "False" ElseIf (actionFrame[i] = actionDelay) Then hitCheck() ElseIf (actionFrame[i] > actionDelay) Then stand() iFrame[i] = 0 playerFrame[i] = 1 EndIf EndSub Sub move If (Math.Remainder(iFrame[i],8) = 0) Then 'Update player every 8 frames of movement Shapes.HideShape(player[i]) 'Hide current player image (will be last player image) playerFrame[i] = 1+Math.Remainder(playerFrame[i],3) 'Cycle player image in group (these for walking left) player[i] = playerWalk[i][playerFrame[i]] 'The next player image in group is now the current player image Shapes.Move(player[i],playerX[i],playerY[i]) 'Move the image before we show it Shapes.ShowShape(player[i]) 'Show current player image Else Shapes.Move(player[i],playerX[i],playerY[i]) 'Just move player EndIf If (actionRepeat[i] > 10) Then actionRepeat[i] = actionRepeat[i]-1 'Get your energy back EndIf iFrame[i] = iFrame[i]+1 EndSub Sub stand If (player[i] <> playerStand[i]) Then Shapes.HideShape(player[i]) player[i] = playerStand[i] Shapes.Move(player[i],playerX[i],playerY[i]) Shapes.ShowShape(player[i]) EndIf EndSub Sub punch If (player[i] <> playerPunch[i]) Then 'Only update if changed actionFrame[i] = 0 Shapes.HideShape(player[i]) player[i] = playerPunch[i] Shapes.Move(player[i],playerX[i],playerY[i]) Shapes.ShowShape(player[i]) actionRepeat[i] = actionRepeat[i]+2 'starting to tire EndIf EndSub Sub block If (player[i] <> playerBlock[i]) Then 'Only update if changed actionFrame[i] = 0 Shapes.HideShape(player[i]) player[i] = playerBlock[i] Shapes.Move(player[i],playerX[i],playerY[i]) Shapes.ShowShape(player[i]) EndIf EndSub Sub hitCheck If (Math.Abs(playerX[1]-playerX[2]) = proximity) Then If (player[i] = playerPunch[i] And player[j] <> playerBlock[j]) Then score[i] = score[i]+1 Sound.PlayClick() actionRepeat[j] = actionRepeat[j]+5 'getting hit zaps your energy EndIf EndIf EndSub Sub updateScoring For i = 1 To 2 Shapes.SetText(scoreBox[i],"Player "+i+" Tiredness: "+(actionRepeat[i]-10)+" Hits: "+score[i]) EndFor EndSub '=============================================== 'EVENT SUBROUTINES '=============================================== Sub OnKeyDown key = GraphicsWindow.LastKey If (keyDown[key] = "") Then 'Prevent autorepeat of action keys i.e. we need a key up before registering a new key down keyDown[key] = "True" EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey keyDown[key] = "" EndSub End>VNG363.sb< Start>VNH506.sb< GraphicsWindow.Width=1600 GraphicsWindow.Height=900 GraphicsWindow.Top =10 GraphicsWindow.Left=10 GraphicsWindow.Title ="3D Lab GraphicsWindow.BackgroundColor="darkblue view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"white",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") For t=0 To 360 Step 2 px=ldmath.Sin (t)+ ldmath.Sin (t*2)*2 py=ldmath. cos(t)-ldmath.cos (t*2)*2 pz=-ldmath.Sin (t*3) pp=pp+px+":"+pz+":"+py+":" EndFor GraphicsWindow.KeyDown=kdd ya=6 rtt=1 LDEvents.MouseWheel =mww LD3DView.AddTube(view3D pp .4 1 "gold" "D") r35=10 While "true For aa=0 To 362 Step 2 px= LDMath.Cos(aa) py= LDMath.sin (aa) If rtt=1 then LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Else aa=aa-2 endif Program.Delay (22) EndFor EndWhile Sub kdd If GraphicsWindow.LastKey="Space" Then rtt= 1-rtt EndIf EndSub Sub mww ya=ya+ LDEvents.LastMouseWheelDelta/2 GraphicsWindow.Title =ya endsub End>VNH506.sb< Start>VNJ530.sb< ' TO DO LIST '--------------------------- 'Monsters: Got Zombie,Skeleton, demon 'Satan appears only on (6,66) 'need bosses: demon general, skeleton king, zombie hulk 'armor and weapons (update shop) 'quests? 'level and exp, skills? 'towns? 'graphics??? LF = Text.GetCharacter(10) path=program.Directory+"\var_data.txt" TextWindow.Title = "Overworld Slayer" 'background music Sound.Play(Program.Directory + "/XTHEMEX.mp3") init_variables() '<------------ changed sub name // Load initial data Menu() 'variables that need to be saved Sub Init_variables '<------------ changed sub name gold = 0 exp = 0 xxx = 0 yyy = 0 HPPot = 3 MPPot = 3 SmokeBomb = 3 level = 0 str = 10 end = 10 int = 10 intinc = 0 vit = 10 vitinc = 0 sp = 0 PLAYERHP = 100 + vitinc PLAYERTOTALHP = 100 + vitinc PLAYERMP = 30 + intinc PLAYERTOTALMP = 30 + intinc EndSub Sub Set_Variables_data '<----------------------- If lol = 2 then PLAYERHP=variables["hp"] gold=variables["gold"] exp=variables["exp"] xxx=variables["xxx"] yyy=variables["yyy"] HPPot=variables["HPPot"] MPPot =variables["MPPot"] SmokeBomb=variables["SmokeBomb"] level=variables["level"] str=variables["strength"] end=variables["endurance"] vit=variables["vitality"] int=variables["intelligence"] PLAYERMP=variables["mp"] PLAYERTOTALHP=variables["totalhp"] PLAYERMP=variables["totalmp"] sp=variables["stat point"] intinc=variables["intelligence increase"] vitinc=variables["vitality increase"] elseif lol = 1 then variables["hp"] = PLAYERHP variables["gold"] = gold variables["exp"] = exp variables["xxx"] = xxx variables["yyy"] = yyy variables["HPPot"] = HPPot variables["MPPot"] = MPPot variables["SmokeBomb"] = SmokeBomb variables["level"] = level variables["strength"] = str variables["endurance"] = end variables["vitality"] = vit variables["intelligence"] = int variables["mp"] = PLAYERMP variables["totalhp"] = PLAYERTOTALHP variables["totalmp"] = PLAYERMP variables["stat point"] = sp variables["intelligence increase"] = intinc variables["vitality increase"] = vitinc EndIf EndSub Sub Menu TextWindow.WriteLine(" Overworld Slayer") TextWindow.WriteLine(" ") TextWindow.WriteLine(" Created by Dinomite07") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" 1. New Game") TextWindow.WriteLine(" 2. Load Game") TextWindow.WriteLine(" 3. Sound") TextWindow.WriteLine(" 4. Exit") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" Copyrighted @ 2014") TextWindow.WriteLine(" ") lol = TextWindow.ReadNumber() If lol = 1 Then TextWindow.Clear() Set_Variables_data() '<--------------------- set initial data to varibales array intro() ElseIf lol = 2 then TextWindow.Clear() ' The following line could be harmful and has been automatically commented. ' variables= File.ReadContents(path) '<--------------------- load saved data(varibales array) Set_Variables_data() '<--------------------- set variables array to initial data(Updated) selectLocation() ElseIf lol = 3 then TextWindow.Clear() sound() ElseIf lol = 4 then Program.End() Else wrongOption() Menu() EndIf endsub Sub sound TextWindow.WriteLine("1. Sound: ON") TextWindow.WriteLine("2. Sound: OFF") TextWindow.WriteLine(" ") TextWindow.WriteLine("3. Menu") TextWindow.WriteLine(" ") sound = TextWindow.ReadNumber() If sound = 1 Then Sound.Play(Program.Directory + "/XTHEMEX.mp3") TextWindow.Clear() sound() ElseIf sound = 2 then Sound.Stop(Program.Directory + "/XTHEMEX.mp3") TextWindow.Clear() sound() ElseIf sound = 3 then TextWindow.Clear() Menu() Else TextWindow.Clear() wrongOption() sound() EndIf EndSub Sub soundmap TextWindow.WriteLine("1. Sound: ON") TextWindow.WriteLine("2. Sound: OFF") TextWindow.WriteLine(" ") TextWindow.WriteLine("3. Return") TextWindow.WriteLine(" ") sound = TextWindow.ReadNumber() If sound = 1 Then Sound.Play(Program.Directory + "/XTHEMEX.mp3") TextWindow.Clear() sound() ElseIf sound = 2 then Sound.Stop(Program.Directory + "/XTHEMEX.mp3") TextWindow.Clear() sound() ElseIf sound = 3 then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongOption() sound() EndIf EndSub Sub intro TextWindow.WriteLine("Story:") TextWindow.WriteLine(" ") TextWindow.WriteLine("You have been reborned in Hell and vowed to slay Satan himself!!!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() EndSub Sub randencounter rande = Math.GetRandomNumber(25) TextWindow.WriteLine(rande) '16% chance of meeting a skeleton If (rande = 2 Or rande = 8 Or rande = 3 Or rande = 7) Then TextWindow.Clear() skeletonfight() '16% chance of meeting a zombie ElseIf (rande = 10 Or rande = 21 Or rande = 17 Or rande = 15) Then TextWindow.Clear() zombiefight() '4% chance of meeting a demon ElseIf (rande = 25) Then TextWindow.Clear() demonfight() '4% chance of finding a hp potion ElseIf (rande = 4) then TextWindow.Clear() TextWindow.WriteLine("You found a HP Potion!") HPPot = HPPot + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() '4% chance of finding a mp potion ElseIf (rande = 20) then TextWindow.Clear() TextWindow.WriteLine("You found a MP Potion!") MPPot = MPPot + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() '4% chance of finding a smokebomb ElseIf (rande = 5) then TextWindow.Clear() TextWindow.WriteLine("You found a Smoke Bomb!") SmokeBomb = SmokeBomb + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() '8% chance of finding a shop elseIf (rande = 1 Or rande = 9) Then TextWindow.Clear() TextWindow.WriteLine("You found a shop!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() shop() Else TextWindow.Clear() selectLocation() EndIf EndSub Sub maprandencounter rande = Math.GetRandomNumber(25) TextWindow.WriteLine(rande) '16% chance of meeting a skeleton If (rande = 2 Or rande = 8 Or rande = 3 Or rande = 7) Then TextWindow.Clear() skeletonfight() '16% chance of meeting a zombie ElseIf (rande = 10 Or rande = 21 Or rande = 17 Or rande = 15) Then TextWindow.Clear() zombiefight() '4% chance of meeting a demon ElseIf (rande = 25) Then TextWindow.Clear() demonfight() '4% chance of finding a hp potion ElseIf (rande = 4) then TextWindow.Clear() TextWindow.WriteLine("You found a HP Potion!") HPPot = HPPot + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() map() '4% chance of finding a mp potion ElseIf (rande = 20) then TextWindow.Clear() TextWindow.WriteLine("You found a MP Potion!") MPPot = MPPot + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() map() '4% chance of finding a smokebomb ElseIf (rande = 5) then TextWindow.Clear() TextWindow.WriteLine("You found a Smoke Bomb!") SmokeBomb = SmokeBomb + 1 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() map() '8% chance of finding a shop elseIf (rande = 1 Or rande = 9) Then TextWindow.Clear() TextWindow.WriteLine("You found a shop!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() shop() Else TextWindow.Clear() map() EndIf EndSub Sub stat TextWindow.WriteLine("Level: " + level) TextWindow.WriteLine("Stat Point: " + SP) TextWindow.WriteLine(" ") TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Strength: " + str + " Gives 1 dmg per point") TextWindow.WriteLine("2. Vitality: " + vit + " Gives 5 HP per point") TextWindow.WriteLine("3. Endurance: " + end + " Gives reduces 1 dmg per point") TextWindow.WriteLine("4. Intelligence: " + int + " Gives 3 MP per point") TextWindow.WriteLine(" ") TextWindow.WriteLine("5. Exit") TextWindow.WriteLine(" ") staat = TextWindow.ReadNumber() If staat = 5 Then TextWindow.Clear() selectLocation() ElseIf staat = 1 then spiszero() sp = sp - 1 str = str + 1 TextWindow.Clear() stat() elseif staat = 2 then spiszero() sp = sp - 1 vit = vit + 1 vitinc = vitinc + 5 TextWindow.Clear() stat() elseif staat = 3 then spiszero() sp = sp - 1 end = end + 1 TextWindow.Clear() stat() elseif staat = 4 then spiszero() sp = sp - 1 int = int +1 intinc = intinc + 3 TextWindow.Clear() stat() Else TextWindow.Clear() wrongOption() TextWindow.PauseWithoutMessage() enter() stat() EndIf endsub Sub spiszero If sp = 0 Then TextWindow.Clear() stat() EndIf EndSub Sub skills TextWindow.WriteLine("1. Insta-Crit: 5 MP") TextWindow.WriteLine("2. Heal: 5 MP") TextWindow.WriteLine(" ") TextWindow.WriteLine("3. Return") TextWindow.WriteLine(" ") skiill = TextWindow.ReadNumber() endsub Sub player 'every 50 exp is 1 level 'level 10 is cap If (exp > 49 And exp < 100) then sp = sp + 1 level = level + 1 ElseIf (exp < 101 And exp > 149) then sp = sp + 1 level = level + 1 ElseIf (exp < 150 And exp > 199) then sp = sp + 1 level = level + 1 ElseIf (exp < 200 And exp > 249) then sp = sp + 1 level = level + 1 ElseIf (exp < 250 And exp > 299) then sp = sp + 1 level = level + 1 ElseIf (exp < 300 And exp > 349) then sp = sp + 1 level = level + 1 ElseIf (exp < 350 And exp > 399) then sp = sp + 1 level = level + 1 ElseIf (exp < 400 And exp > 449) then sp = sp + 1 level = level + 1 ElseIf (exp < 450 And exp > 499) then sp = sp + 1 level = level + 1 Else sp = sp + 1 level = level + 1 endif '1 -15 dmg firstwep = Math.GetRandomNumber(15) 'starting dmg is 10 - 25 pdmg = firstwep + str TextWindow.WriteLine("PLAYER") TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP + LF) EndSub Sub enter TextWindow.WriteLine(LF) TextWindow.WriteLine("PRESS ENTER") EndSub Sub wrongOption TextWindow.Clear() TextWindow.WriteLine("You can only select the options listed!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() EndSub Sub gameover TextWindow.Clear() TextWindow.WriteLine("You have been defeated!!!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() ending() EndSub Sub ending TextWindow.WriteLine("1. Menu") TextWindow.WriteLine("2. Quit") TextWindow.WriteLine(" ") End = TextWindow.ReadNumber() If End = 1 Then TextWindow.Clear() init_variables() TextWindow.Clear() Menu() ElseIf End = 2 then Program.End() Else wrongOption() ending() EndIf EndSub '50% chance of going back to select location '50% chance of losing Sub runaway If runaway = 1 Then TextWindow.Clear() selectLocation() ElseIf runaway = 2 then TextWindow.Clear() gameover() EndIf EndSub 'select location Sub map TextWindow.Clear() TextWindow.WriteLine("Coordinates: " + "(" + xxx + "," + yyy + ")" + " O. Return") TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Walk North 2. Walk East") TextWindow.WriteLine("3. Walk West 4. Walk South") TextWindow.WriteLine(" ") TextWindow.WriteLine("Map Dislays Here") abc = TextWindow.ReadNumber() If abc = 1 Then TextWindow.Clear() yyy = yyy + 1 maprandencounter() elseIf abc = 2 Then TextWindow.Clear() xxx = xxx + 1 maprandencounter() elseIf abc = 3 Then TextWindow.Clear() xxx = xxx - 1 maprandencounter() elseIf abc = 4 Then TextWindow.Clear() yyy = yyy - 1 maprandencounter() elseIf abc = 0 Then TextWindow.Clear() selectLocation() Else wrongOption() map() EndIf EndSub Sub journal TextWindow.Clear() TextWindow.WriteLine("Mobs") TextWindow.WriteLine(" ") TextWindow.WriteLine("---------------------------------------------------------------------------") TextWindow.WriteLine(" ") TextWindow.WriteLine("Skeleton: 5 - 10 dmg, 25 HP, 10 exp and 5 gold, 16% chance of spawning in") TextWindow.WriteLine("Zombie: 10 - 15 dmg, 30 HP, 15 exp and 10 gold, 16% chance of spawning in") TextWindow.WriteLine("Demon: 20 - 30 dmg, 50 HP, 25 exp and 15 gold, 4% chance of spawning in") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine("Bosses") TextWindow.WriteLine(" ") TextWindow.WriteLine("---------------------------------------------------------------------------") TextWindow.WriteLine(" ") TextWindow.WriteLine("Skeleton King:") TextWindow.WriteLine("Zombie Hulk:") TextWindow.WriteLine("Demon General:") TextWindow.WriteLine("Satan: 50 - 75 dmg, 1000 hp, appears only on (6,66), once defeated you win") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Return") TextWindow.WriteLine(" ") journal1 =TextWindow.ReadNumber() If journal1 = 1 Then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongOption() TextWindow.Clear() journal() EndIf endsub Sub misc TextWindow.Clear() TextWindow.WriteLine("Select an option below") TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Save") TextWindow.WriteLine("2. Exit") TextWindow.WriteLine("3. Sound") TextWindow.WriteLine("4. Return") TextWindow.WriteLine(" ") misc1 = TextWindow.ReadNumber() If misc1 = 1 Then TextWindow.Clear() Set_Variables_data() '<---------------------------- set updated data to varibles array ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path, variables) '<---------------------------- save variables array data TextWindow.Clear() TextWindow.WriteLine("Game has been saved!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() misc() ElseIf misc1 = 2 then TextWindow.Clear() Program.End() elseif misc1 = 3 then TextWindow.Clear() soundmap() elseif misc1 = 4 then TextWindow.Clear() selectLocation() Else wrongOption() enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() misc() endif endsub Sub selectLocation SNHP = 25 'Skeleton's HP ZEHP = 30 'Zombie HP DNHP = 50 'Demon HP STHP = 1000 'Satan HP TextWindow.WriteLine("Level: " + level) TextWindow.WriteLine("Experience Points: " + exp + " Gold: " + gold) TextWindow.WriteLine(" ") TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("HP Pot: x" + HPPot + " MP Pot: x" + MPPot) TextWindow.WriteLine("Smoke Bomb: x" + SmokeBomb) TextWindow.WriteLine(" ") TextWindow.WriteLine("Coordinates: " + "(" + xxx + "," + yyy + ")" ) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Walk North") TextWindow.WriteLine("2. Walk East") TextWindow.WriteLine("3. Walk West") TextWindow.WriteLine("4. Walk South" + LF) TextWindow.WriteLine(" ") TextWindow.WriteLine("5. Use HP Pot") TextWindow.WriteLine("6. Use MP Pot") TextWindow.WriteLine(" ") TextWindow.WriteLine("7. Stats") TextWindow.WriteLine("8. Map") TextWindow.WriteLine("9. Journal") TextWindow.WriteLine(" ") TextWindow.WriteLine("0. Misc") TextWindow.WriteLine(" ") loc = TextWindow.ReadNumber() If loc = 0 then misc() elseIf loc = 1 Then TextWindow.Clear() yyy = yyy + 1 randencounter() elseIf loc = 2 Then TextWindow.Clear() xxx = xxx + 1 randencounter() elseIf loc = 3 Then TextWindow.Clear() xxx = xxx - 1 randencounter() elseIf loc = 4 Then TextWindow.Clear() yyy = yyy - 1 randencounter() elseIf loc = 5 Then HPoverhun() TextWindow.Clear() zerohppot() PLAYERHP = PLAYERHP + 25 HPPot = HPPot - 1 TextWindow.WriteLine("You gain 25 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() elseIf loc = 6 Then MPoverhun() TextWindow.Clear() zeromppot() PLAYERMP = PLAYERMP + 5 MPPot = MPPot - 1 TextWindow.WriteLine("You gain 5 MP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() elseif loc = 7 then TextWindow.Clear() stat() elseIf loc = 8 then map() elseIf loc = 9 then journal() Else wrongOption() selectLocation() EndIf EndSub Sub MPoverhun If PlayerMP = 30 Or PlayerMP > 30 Then TextWindow.Clear() selectLocation() EndIf EndSub Sub HPoverhun If PlayerHP = 100 Or PlayerHP > 100 Then TextWindow.Clear() selectLocation() EndIf EndSub Sub zeromppot If MPPot = 0 Then TextWindow.Clear() selectLocation() EndIf EndSub Sub zerohppot If HPPot = 0 Then TextWindow.Clear() selectLocation() EndIf EndSub 'shop Sub shop TextWindow.WriteLine("Gold: " + gold) TextWindow.WriteLine(" ") TextWindow.WriteLine("HP Pot: " + HPPot) TextWindow.WriteLine("Smoke Bomb: " + SmokeBomb) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Buy 1 HP Potion: 10 Gold") TextWindow.WriteLine("2. Buy 1 MP Potion: 10 Gold") TextWindow.WriteLine("3. Buy 1 Smoke Bomb: 10 Gold") TextWindow.WriteLine(" ") TextWindow.WriteLine("4. Sell 1 HP Potion: 5 Gold") TextWindow.WriteLine("5. Sell 1 MP Potion: 5 Gold") TextWindow.WriteLine("6. Sell 1 Smoke Bomb: 5 Gold") TextWindow.WriteLine(" ") TextWindow.WriteLine("7. Exit Shop") TextWindow.WriteLine(" ") item = TextWindow.ReadNumber() If item = 1 Then notenoughgoldforhpandmpandsb() gold = gold - 10 HPPot = HPPot + 1 TextWindow.Clear() shop() elseIf item = 1 Then notenoughgoldforhpandmpandsb() gold = gold - 10 MPPot = MPPot + 1 TextWindow.Clear() shop() ElseIf item = 3 then notenoughgoldforhpandmpandsb() gold = gold - 10 smokeb = smokeb + 1 TextWindow.Clear() shop() elseIf item = 4 Then shopzerohppot() gold = gold + 5 HPPot = HPPot - 1 TextWindow.Clear() shop() elseIf item = 5 Then shopzeromppot() gold = gold + 5 MPPot = MPPot - 1 TextWindow.Clear() shop() ElseIf item = 6 then shopzerosmokebomb() gold = gold + 5 smokebomb = smokebomb - 1 TextWindow.Clear() shop() elseif item = 7 then TextWindow.Clear() selectLocation() Else wrongoption() shop() EndIf EndSub Sub goldiszero If gold = 0 Then TextWindow.Clear() shop() EndIf endsub Sub notenoughgoldforhpandmpandsb If gold = 0 or gold = 5 Then TextWindow.Clear() shop() EndIf endsub Sub shopzerosmokebomb If SmokeBomb = 0 Then TextWindow.Clear() shop() EndIf EndSub Sub shopzerohppot If HPPot = 0 Then TextWindow.Clear() shop() EndIf EndSub Sub shopzeromppot If MPPot = 0 Then TextWindow.Clear() shop() EndIf EndSub 'monsters 'demon Sub demonskill If PLAYERMP < 5 Then TextWindow.Clear() demonfight() endif skills() If skiill = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + (pdmg *1.5) + " damage!") enter() PLAYERMP = PLAYERMP - 5 TextWindow.PauseWithoutMessage() TextWindow.Clear() DNHP = DNHP - (pdmg * 1.5) If (DNHP <= 0) Then TextWindow.Clear() demonwin() EndIf demonattack() ElseIf skiill = 2 then TextWindow.Clear() demonHPoverhun() PLAYERMP = PLAYERMP - 5 PLAYERHP = PLAYERHP + 50 TextWindow.WriteLine("You healed yourself for 50 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() demonattack() elseif skiill = 3 then TextWindow.Clear() demonfight() Else wrongOption() TextWindow.Clear() demonfight() EndIf EndSub Sub demon '20-30 dmg ddmg = (Math.GetRandomNumber(21) + 29) - End TextWindow.WriteLine("DEMON") TextWindow.WriteLine("HP: " + DNHP + "/50"+LF)'Display Health Here EndSub sub demonitem TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Use a HP Potion x" + HPPot) TextWindow.WriteLine("2. Use a MP Potion x" + MPPot) TextWindow.WriteLine("3. Use a Smoke Bomb x" + SmokeBomb) TextWindow.WriteLine(" ") itemenc =TextWindow.ReadNumber() If itemenc = 1 Then demonHPoverhun() TextWindow.Clear() demonzerohppot() PLAYERHP = PLAYERHP + 25 HPPot = HPPot - 1 TextWindow.WriteLine("You gain 25 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() demonattack() elseIf itemenc = 2 Then demonMPoverhun() TextWindow.Clear() demonzeromppot() PLAYERMP = PLAYERMP + 5 MPPot = MPPot - 1 TextWindow.WriteLine("You gain 5 MP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() demonattack() elseIf itemenc = 3 Then TextWindow.Clear() demonzerosmokebomb() SmokeBomb = SmokeBomb - 1 selectLocation() else TextWindow.Clear() wrongOption() enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() demonitem() endif endsub Sub demonfight TextWindow.WriteLine("A demon appeared!!!" + LF) demon() player() TextWindow.WriteLine("1. Use your sword") TextWindow.WriteLine("2. Items") TextWindow.WriteLine("3. Run Away") TextWindow.WriteLine("4. Skills") TextWindow.WriteLine("5. Do Nothing" + LF) 'used for testing encounter1 = TextWindow.ReadNumber() demonmove() EndSub Sub demonmove If encounter1 = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + pdmg + " damage!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() DNHP = DNHP - pdmg If (DNHP <= 0) Then TextWindow.Clear() demonwin() EndIf demonattack() ElseIf encounter1 = 2 then TextWindow.Clear() demonitem() elseIf encounter1 = 3 Then runaway = Math.GetRandomNumber(2) runaway() elseIf encounter1 = 4 Then TextWindow.Clear() demonskill() demonattack() elseIf encounter1 = 5 Then TextWindow.Clear() demonattack() Else wrongoption() demonfight() endif EndSub sub demonwin TextWindow.WriteLine("You defeated a demon!") TextWindow.WriteLine(" ") TextWindow.WriteLine("You gain 25 exp and 15 gold") gold = gold + 15 exp = exp + 25 TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() EndSub Sub demonattack TextWindow.WriteLine("The Demon strikes and deals " + ddmg + " damge!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() PLAYERHP = PLAYERHP - ddmg if (PLAYERHP <= 0) Then TextWindow.Clear() gameover() EndIf demonfight() EndSub Sub demonzerosmokebomb If SmokeBomb = 0 Then TextWindow.Clear() demon() EndIf EndSub Sub demonzerohppot If HPPot = 0 Then TextWindow.Clear() demon() EndIf EndSub Sub demonzeromppot If MPPot = 0 Then TextWindow.Clear() demon() EndIf EndSub Sub demonHPoverhun If PlayerHP = 100 Or PlayerHP > 100 Then TextWindow.Clear() demonfight() EndIf EndSub Sub demonMPoverhun If PlayerMP = 30 Or PlayerMP > 30 Then TextWindow.Clear() demonfight() EndIf EndSub 'skeleton Sub skeletonattack TextWindow.WriteLine("The Skeleton strikes and deals " + sdmg + " damge!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() PLAYERHP = PLAYERHP - sdmg if (PLAYERHP <= 0) Then TextWindow.Clear() gameover() EndIf skeletonfight() EndSub sub skeletonitem TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Use a HP Potion x" + HPPot) TextWindow.WriteLine("2. Use a MP Potion x" + MPPot) TextWindow.WriteLine("3. Use a Smoke Bomb x" + SmokeBomb) TextWindow.WriteLine(" ") itemenc = TextWindow.ReadNumber() If itemenc = 1 Then skeletonHPoverhun() TextWindow.Clear() skeletonzerohppot() PLAYERHP = PLAYERHP + 25 HPPot = HPPot - 1 TextWindow.WriteLine("You gain 25 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() skeletonattack() elseIf itemenc = 2 Then skeletonMPoverhun() TextWindow.Clear() skeletonzeromppot() PLAYERMP = PLAYERMP + 5 MPPot = MPPot - 1 TextWindow.WriteLine("You gain 5 MP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() skeletonattack() elseIf itemenc = 3 Then TextWindow.Clear() skeletonzerosmokebomb() SmokeBomb = SmokeBomb - 1 selectLocation() else TextWindow.Clear() wrongOption() enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() skeletonitem() endif endsub Sub skeletonmove If encounter1 = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + pdmg + " damage!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() SNHP = SNHP - pdmg If (SNHP <= 0) Then TextWindow.Clear() skeletonwin() EndIf skeletonattack() ElseIf encounter1 = 2 then TextWindow.Clear() skeletonitem() elseIf encounter1 = 3 Then runaway = Math.GetRandomNumber(2) runaway() elseIf encounter1 = 4 Then TextWindow.Clear() skeletonskill() skeletonattack() elseIf encounter1 = 5 Then TextWindow.Clear() skeletonattack() Else wrongoption() skeletonfight() endif EndSub Sub skeletonfight TextWindow.WriteLine("A skeleton appeared!!!" + LF) skeleton() player() TextWindow.WriteLine("1. Use your sword") TextWindow.WriteLine("2. Items") TextWindow.WriteLine("3. Run Away") TextWindow.WriteLine("4. Skills") TextWindow.WriteLine("5. Do Nothing" + LF) 'used for testing encounter1 = TextWindow.ReadNumber() skeletonmove() EndSub Sub skeleton '5- 10 dmg sdmg = (Math.GetRandomNumber(16) + 14) - End TextWindow.WriteLine("SKELETON") TextWindow.WriteLine("HP: " + SNHP + "/25"+LF)'Display Health Here EndSub sub skeletonwin TextWindow.WriteLine("You defeated a skeleton!") TextWindow.WriteLine(" ") TextWindow.WriteLine("You gain 10 exp and 5 gold") gold = gold + 5 exp = exp + 10 TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() EndSub Sub skeletonskill If PLAYERMP < 5 Then TextWindow.Clear() skeletonfight() endif skills() If skiill = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + (pdmg *1.5) + " damage!") enter() PLAYERMP = PLAYERMP - 5 TextWindow.PauseWithoutMessage() TextWindow.Clear() SNHP = SNHP - (pdmg * 1.5) If (SNHP <= 0) Then TextWindow.Clear() skeletonwin() EndIf skeletonattack() ElseIf skiill = 2 then TextWindow.Clear() skeletonHPoverhun() PLAYERMP = PLAYERMP - 5 PLAYERHP = PLAYERHP + 50 TextWindow.WriteLine("You healed yourself for 50 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() skeletonattack() elseif skiill = 3 then TextWindow.Clear() skeletonfight() Else wrongOption() TextWindow.Clear() skeletonfight() EndIf EndSub Sub skeletonzerosmokebomb If SmokeBomb = 0 Then TextWindow.Clear() skeleton() EndIf EndSub Sub skeletonzerohppot If HPPot = 0 Then TextWindow.Clear() skeleton() EndIf EndSub Sub skeletonzeromppot If MPPot = 0 Then TextWindow.Clear() skeleton() EndIf endsub Sub skeletonHPoverhun If PlayerHP = 100 Or PlayerHP > 100 Then TextWindow.Clear() skeletonfight() EndIf EndSub Sub skeletonMPoverhun If PlayerMP = 30 Or PlayerMP > 30 Then TextWindow.Clear() skeletonfight() EndIf EndSub 'zombie Sub zombieskill If PLAYERMP < 5 Then TextWindow.Clear() zombiefight() endif skills() If skiill = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + (pdmg *1.5) + " damage!") enter() PLAYERMP = PLAYERMP - 5 TextWindow.PauseWithoutMessage() TextWindow.Clear() ZEHP = ZEHP - (pdmg * 1.5) If (ZEHP <= 0) Then TextWindow.Clear() zombiewin() EndIf zombieattack() ElseIf skiill = 2 then TextWindow.Clear() PLAYERHP = PLAYERHP + 50 TextWindow.WriteLine("You healed yourself for 50 HP!") PLAYERMP = PLAYERMP - 5 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() zombieattack() elseif skiill = 3 then TextWindow.Clear() zombiefight() Else wrongOption() TextWindow.Clear() zombiefight() EndIf EndSub Sub zombieattack TextWindow.WriteLine("The Zombie strikes and deals " + zdmg + " damge!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() PLAYERHP = PLAYERHP - zdmg if (PLAYERHP <= 0) Then TextWindow.Clear() gameover() EndIf zombiefight() EndSub sub zombieitem TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Use a HP Potion x" + HPPot) TextWindow.WriteLine("2. Use a MP Potion x" + MPPot) TextWindow.WriteLine("3. Use a Smoke Bomb x" + SmokeBomb) TextWindow.WriteLine(" ") itemenc = TextWindow.ReadNumber() If itemenc = 1 Then zombieHPoverhun() TextWindow.Clear() zombiezerohppot() PLAYERHP = PLAYERHP + 25 HPPot = HPPot - 1 TextWindow.WriteLine("You gain 25 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() zombieattack() elseIf itemenc = 2 Then zombieMPoverhun() TextWindow.Clear() zombiezeromppot() PLAYERMP = PLAYERMP + 5 MPPot = MPPot - 1 TextWindow.WriteLine("You gain 5 MP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() zombieattack() elseIf itemenc = 3 Then TextWindow.Clear() zombiezerosmokebomb() SmokeBomb = SmokeBomb - 1 selectLocation() else TextWindow.Clear() wrongOption() enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() zombieitem() endif endsub Sub zombie '10-15 dmg zdmg = (Math.GetRandomNumber(16) + 19) - End TextWindow.WriteLine("ZOMBIE") TextWindow.WriteLine("HP: " + ZEHP + "/30"+LF)'Display Health Here EndSub Sub zombiefight TextWindow.WriteLine("A zombie appeared!!!" + LF) zombie() player() TextWindow.WriteLine("1. Use your sword") TextWindow.WriteLine("2. Items") TextWindow.WriteLine("3. Run Away") TextWindow.WriteLine("4. Skills") TextWindow.WriteLine("5. Do Nothing" + LF) 'used for testing encounter1 = TextWindow.ReadNumber() zombiemove() EndSub Sub zombiemove If encounter1 = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + pdmg + " damage!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() ZEHP = ZEHP - pdmg If (ZEHP <= 0) Then TextWindow.Clear() zombiewin() EndIf zombieattack() elseIf encounter1 = 2 Then TextWindow.Clear() zombieitem() elseIf encounter1 = 3 Then runaway = Math.GetRandomNumber(2) runaway() elseIf encounter1 = 4 Then TextWindow.Clear() zombieskill() zombieattack() elseIf encounter1 = 5 Then TextWindow.Clear() zombieattack() Else wrongoption() zombiefight() endif EndSub sub zombiewin TextWindow.WriteLine("You defeated a zombie!") TextWindow.WriteLine(" ") TextWindow.WriteLine("You gain 15 exp and 10 gold") gold = gold + 10 exp = exp + 15 TextWindow.PauseWithoutMessage() TextWindow.Clear() selectLocation() EndSub Sub zombiezerosmokebomb If SmokeBomb = 0 Then TextWindow.Clear() zombie() EndIf EndSub Sub zombiezerohppot If HPPot = 0 Then TextWindow.Clear() zombie() EndIf EndSub Sub zombieHPoverhun If PlayerHP = 100 Or PlayerHP > 100 Then TextWindow.Clear() zombiefight() EndIf EndSub Sub zombieMPoverhun If PlayerMP = 30 Or PlayerMP > 30 Then TextWindow.Clear() zombiefight() EndIf EndSub Sub zombiezeromppot If MPPot = 0 Then TextWindow.Clear() zombie() EndIf EndSub 'SATAN Sub satanskill If PLAYERMP < 5 Then TextWindow.Clear() satanfight() endif skills() If skiill = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + (pdmg *1.5) + " damage!") enter() PLAYERMP = PLAYERMP - 5 TextWindow.PauseWithoutMessage() TextWindow.Clear() STHP = STHP - (pdmg * 1.5) If (ZEHP <= 0) Then TextWindow.Clear() satanwin() EndIf satanattack() ElseIf skiill = 2 then TextWindow.Clear() PLAYERHP = PLAYERHP + 50 TextWindow.WriteLine("You healed yourself for 50 HP!") PLAYERMP = PLAYERMP - 5 enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() satanattack() elseif skiill = 3 then TextWindow.Clear() satanfight() Else wrongOption() TextWindow.Clear() satanfight() EndIf EndSub Sub satanattack TextWindow.WriteLine("Satan strikes and deals " + stdmg + " damge!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() PLAYERHP = PLAYERHP - stdmg if (PLAYERHP <= 0) Then TextWindow.Clear() gameover() EndIf satanfight() EndSub Sub satanHPoverhun If PlayerHP = 100 Or PlayerHP > 100 Then TextWindow.Clear() satanfight() EndIf EndSub Sub satanMPoverhun If PlayerMP = 30 Or PlayerMP > 30 Then TextWindow.Clear() satanfight() EndIf EndSub Sub satanzeromppot If MPPot = 0 Then TextWindow.Clear() satan() EndIf EndSub Sub satanzerohppot If HPPot = 0 Then TextWindow.Clear() satan() EndIf EndSub sub satanitem TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP) TextWindow.WriteLine(" ") TextWindow.WriteLine("1. Use a HP Potion x" + HPPot) TextWindow.WriteLine("2. Use a MP Potion x" + MPPot) TextWindow.WriteLine(" ") itemenc = TextWindow.ReadNumber() If itemenc = 1 Then satanHPoverhun() TextWindow.Clear() satanzerohppot() PLAYERHP = PLAYERHP + 25 HPPot = HPPot - 1 TextWindow.WriteLine("You gain 25 HP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() satanattack() elseIf itemenc = 2 Then satanMPoverhun() TextWindow.Clear() satanzeromppot() PLAYERMP = PLAYERMP + 5 MPPot = MPPot - 1 TextWindow.WriteLine("You gain 5 MP!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() satanattack() else TextWindow.Clear() wrongOption() enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() satanitem() endif endsub Sub satanlocation If xxx = 6 And yyy = 66 Then satanfight() EndIf endsub Sub satan '50-75 dmg stdmg = (Math.GetRandomNumber(36) + 59) - End TextWindow.WriteLine("ZOMBIE") TextWindow.WriteLine("HP: " + STHP + "/1000"+LF)'Display Health Here EndSub Sub satanfight TextWindow.WriteLine("Satan appeared!!!" + LF) satan() player() TextWindow.WriteLine("1. Use your sword") TextWindow.WriteLine("2. Items") TextWindow.WriteLine("3. Skills") TextWindow.WriteLine("4. Do Nothing" + LF) 'used for testing encounter1 = TextWindow.ReadNumber() satanmove() EndSub Sub satanmove If encounter1 = 1 Then TextWindow.Clear() TextWindow.WriteLine("You use your sword and deal " + pdmg + " damage!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() STHP = STHP - pdmg If (STHP <= 0) Then TextWindow.Clear() satanwin() EndIf satanattack() elseIf encounter1 = 2 Then TextWindow.Clear() satanitem() elseIf encounter1 = 3 Then TextWindow.Clear() satanskill() satanattack() elseIf encounter1 = 4 Then TextWindow.Clear() satanattack() Else wrongoption() satanfight() endif EndSub sub satanwin TextWindow.WriteLine("You have slain Satan!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() TextWindow.WriteLine("You have won the game!") enter() TextWindow.PauseWithoutMessage() TextWindow.Clear() Program.End() EndSub End>VNJ530.sb< Start>VNN889.sb< SetGraphicsWindow() SetGlobalVariables() DefineShapes() While (FlagRun = 1) AdvanceSystem() Shapes.Move(star1, x1, y1) Shapes.Move(star2, x2, y2) CheckBorder() Program.Delay(4) EndWhile Sub SetGraphicsWindow gw_width = 800 gw_height = 600 gw_title = "2-Body Simulation | Closed Universe (v1.0)" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Width = gw_width GraphicsWindow.Height = gw_height GraphicsWindow.Title = gw_title EndSub Sub SetGlobalVariables FlagRun = 1 radius = 20 epsilon = 0.2 epsilon2 = epsilon * epsilon h = 0.1 t = 0 M1 = 2 M2 = 1 M = M1 * M2 M_ratio = M2 / M1 x1 = 200 y1 = 300 x2 = 600 y2 = 500 vx1 = 0 vy1 = 0 vx2 = 1 vy2 = -1 EndSub Sub DefineShapes star1 = Shapes.AddEllipse(radius, radius) star2 = Shapes.AddEllipse(radius * M_ratio, radius * M_ratio) EndSub Sub AdvanceSystem acel() x1 = x1 + h * vx1 y1 = y1 + h * vy1 x2 = x2 + h * vx2 y2 = y2 + h * vy2 vx1 = vx1 + h * ax vy1 = vy1 + h * ay vx2 = vx2 - h * ax vy2 = vy2 - h * ay t = t + h EndSub Sub acel dx = x2 - x1 dy = y2 - y1 d = Math.SquareRoot(dx * dx + dy * dy + epsilon2) f = M / d ax = f * dx ay = f * dy EndSub Sub CheckBorder If ( x1 > gw_width) Then vx1 = -vx1 x1 = gw_width EndIf If ( y1 > gw_height) Then vy1 = -vy1 y1 = gw_height EndIf If ( x2 > gw_width) Then vx2 = -vx2 x2 = gw_width EndIf If ( y2 > gw_height) Then vy2 = -vy2 y2 = gw_height EndIf If ( x1 < 0) Then vx1 = -vx1 x1 = 0 EndIf If ( y1 < 0) Then vy1 = -vy1 y1 = 0 EndIf If ( x2 < 0) Then vx2 = -vx2 x2 = 0 EndIf If ( y2 < 0) Then vy2 = -vy2 y2 = 0 EndIf EndSub End>VNN889.sb< Start>VNP375.sb< GraphicsWindow.Width = Desktop.Width GraphicsWindow.Height = Desktop.Height GraphicsWindow.Top = 0 GraphicsWindow.Left = -7 zoomScaleX = 0.1 zoomScaleY = 0.1 cir = Shapes.AddEllipse(25,25) Shapes.Move(cir,600,300) While "True" zoomScaleX = zoomScaleX + 0.1 zoomScaleY = zoomScaleY + 0.1 Shapes.Zoom(cir,zoomScaleX,zoomScaleY) If zoomScaleX = 20 Then zoomScaleX = 0.1 EndIf If zoomScaleY = 20 Then zoomScaleY = 0.1 EndIf Program.Delay(10) EndWhile End>VNP375.sb< Start>VNP431.sb< ' June Challenge 2016, greek symbol keyboard on screen ' yled program GraphicsWindow.width=725 GraphicsWindow.height=300 GraphicsWindow.top=100 GraphicsWindow.left=150 GraphicsWindow.BackgroundColor="black" GraphicsWindow.FontName="calibri light" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize=22 ' size of each touch sz=55 defin() ' RANGÉ #1 DE LETTRES s=0 For t=1 To 10 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+s,20) Shapes.SetOpacity(carre[t],30) s=s+60 EndFor s=0 For t=1 To 10 GraphicsWindow.DrawText(40+s,32,touche[t]) s=s+60 EndFor ' RANGÉ #2 DE LETTRES s=0 For t=11 To 21 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],40+s,80) Shapes.SetOpacity(carre[t],30) s=s+60 EndFor s=0 For t = 11 To 21 If T= 21 Then GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="YELLOW" Else GraphicsWindow.FontSize=22 EndIf GraphicsWindow.DrawText(60+s,90,touche[t]) s=s+60 EndFor ' RANGÉ #3 DE LETTRES s=0 For t=22 To 32 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+s,140) Shapes.SetOpacity(carre[t],30) s=s+60 EndFor s=0 For t=22 To 32 If t= 32 Then GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="magenta" Else GraphicsWindow.FontSize=22 EndIf GraphicsWindow.DrawText(40+s,150,touche[t]) s=s+60 EndFor ' RANGÉ #4 DE LETTRES s=0 For t=33 To 34 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+s,200) Shapes.SetOpacity(carre[t],30) s=s+60 EndFor s=0 For t=33 To 34 GraphicsWindow.FontSize=24 If t= 33 Then GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="blue" Else GraphicsWindow.FontSize=22 GraphicsWindow.BrushColor="white" EndIf GraphicsWindow.DrawText(36+s,210,touche[t]) s=s+60 EndFor ' space bar GraphicsWindow.BrushColor="white" carre[35]=Shapes.AddRectangle(350,sz) Shapes.Move(carre[35],140,200) Shapes.SetOpacity(carre[35],30) ' mail GraphicsWindow.BrushColor="white" carre[36]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[36],500,200) Shapes.SetOpacity(carre[36],30) GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawText(510,210,touche[36]) ' ctrl GraphicsWindow.BrushColor="white" carre[37]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[37],560,200) Shapes.SetOpacity(carre[37],30) GraphicsWindow.FontSize=18 GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(570,210,touche[37]) mouse_input() Sub mouse_input ' mouse routine wait GraphicsWindow.MouseDown = OnMouseDown OnMouseDown() endsub ' click mouse routine Sub OnMouseDown space=0 If (Mouse.IsLeftButtonDown = "True") Then show_Letter_press() EndIf EndSub Sub show_Letter_press mx=graphicswindow.Mousex my=graphicswindow.mousey ' RANGÉ #1 DE LETTRES mouse input s=0 For t = 1 To 10 If mx > 20+s And mx < 60+s and my > 20 and my < 60 Then GraphicsWindow.brushcolor="magenta" GraphicsWindow.FontSize=22 GraphicsWindow.DrawText(40+s,32,touche[t]) GraphicsWindow.ShowMessage(letters[t],"you have press") EndIf s=s+60 EndFor ' RANGÉ #2 DE LETTRES mouse input s=0 For t = 11 To 21 If mx > 40+s And mx < 80+s and my > 80 and my < 120 Then GraphicsWindow.brushcolor="lime" GraphicsWindow.FontSize=22 GraphicsWindow.DrawText(60+s,90,touche[t]) GraphicsWindow.ShowMessage(letters[t],"you have press") EndIf s=s+60 EndFor ' RANGÉ #3 DE LETTRES mouse input s=0 For t = 22 To 32 If mx > 20+s And mx < 60+s and my > 140 and my < 180 Then GraphicsWindow.brushcolor="yellow" GraphicsWindow.FontSize=22 GraphicsWindow.DrawText(40+s,150,touche[t]) GraphicsWindow.ShowMessage(letters[t],"you have press") EndIf s=s+60 EndFor If mx > 20 And mx< 60 and my > 200 and my < 240 Then GraphicsWindow.ShowMessage(letters[33],"you have press") EndIf If mx > 510 And mx< 550 and my > 200 and my < 240 Then GraphicsWindow.ShowMessage(letters[36],"you have press") EndIf If mx > 570 And mx< 610 and my > 200 and my < 240 Then GraphicsWindow.ShowMessage(touche[37],"you have press Ctrl") EndIf EndSub Sub defin touche[1]="" touche[2]="φ"' phi letters[2]= "phi" touche[3]="ε" 'epsilon letters[3]= "epsilon" touche[4]="ρ" ' rho letters[4]= "rho" touche[5]="τ" ' tau letters[5]= "tau" touche[6]="" touche[7]="υ" ' upsilon letters[7]= "upsilon" touche[8]="ι" ' iota letters[8]= "iota" touche[9]="ο" ' omicron letters[9]= "omicron" touche[10]="π" ' Pi letters[10]= "Pi" touche[11]="α" ' alpha letters[11]= "alpha" touche[12]="σ" ' sigma letters[12]= "sigma" touche[13]="δ" ' delta letters[13]= "delta" touche[14]="ζ" ' zeta letters[14]= "zeta" touche[15]="η" ' eta letters[15]= "eta" touche[16]="θ" ' theta letters[16]= "theta" touche[17]="" touche[18]="κ" ' kappa letters[18]= "kappa" touche[19]="λ" ' lamda letters[19]= "lamda" touche[20]="" touche[21]="⏎" touche[22]="ω" ' omega letters[22]= "omega" touche[23]="χ" ' chi letters[23]= "chi" touche[24]="γ" ' gamma letters[24]= "gamma" touche[25]="ψ" ' psi letters[25]= "psi" touche[26]="β" ' beta letters[26]= "beta" touche[27]="ν" ' nu letters[27]= "nu" touche[28]="μ" ' mu letters[28]= "mu" touche[29]="ξ" ' xi letters[29]= "xi" touche[30]=":" touche[31]="!" touche[32]="⇧" touche[33]="℮" letters[33]= "INTERNET EXPLORER" touche[34]="alt" touche[35]=" " touche[36]="✉" letters[36]= "MAIL" touche[37]="Ctrl" endsub End>VNP431.sb< Start>VNQ956-0.sb< Init() GameWindow.Left=0 GameWindow.top=0 GameWindow.Width = 1024 GameWindow.Height = 576 GameWindow.BackgroundColor = "#000000" GameWindow.Show() GameKeyboard.KeyDown=clavier ' add this code intro : Media.stop(player) VideoFile =Program.Directory+"\"+"Lobinson.mp4" ' "C:\Users_________________.mov" Player = Media.CreateMediaPlayer(VideoFile, 0, 0, GameWindow.Width,GameWindow.Height) ' Create Media PLayer Media.Play(Player) 'Start Playing ' Sub clavier key = GameKeyboard.LastKey If (key = "Space") Then Goto passe Else' ' add this code Goto end1' ' add this code EndIf passe : Media.stop(player)' add this code GameWindow.RemoveElement(player) gamewindow.Clear() ' add this code GameWindow.Hide() ' add this code testnext() end1: '' add this code endsub Sub Init GraphicsWindow.Clear() GraphicsWindow.top=5 GraphicsWindow.Left=5 GraphicsWindow.Width = 1000 GraphicsWindow.Height = 500 GraphicsWindow.BackgroundColor="black" BMB="http://www.ctv-production.com/smallbasic/forum/BOMBE" For i=1 to 10 dum[i]=imagelist.LoadImage(BMB+i+".png") sprite[i]=FCControls.AddImage(dum[i]) ' Shapes.AddImage(dum[i]) FCControls.Move(sprite[i],1150,200) ' Shapes.move(sprite[i],1150,200) ' Endfor wb=ImageList.GetWidthOfImage(dum[1]) EndSub Sub testnext While "true" count=0 Y=200 For X=1050 To -50 Step -wb/10 count=count+1 Y=math.Sin(3.14/180*count*36)*20+200 FCControls.Move(sprite[count], X, Y) 'Shapes.move(sprite[count], X, Y) FCControls.Zoom(sprite[count], 1) 'Shapes.Zoom(sprite[count],2,2) FCControls.Zoom(sprite[count], 1) FCControls.Move(sprite[count], x,-80) ' Shapes.move(sprite[count], 1150, Y) Program.Delay(80) If count=10 Then count=0 EndIf EndFor EndWhile EndSub End>VNQ956-0.sb< Start>VNQ956.sb< GameWindow.Left=50 GameWindow.top=50 GameWindow.Width = 1024 GameWindow.Height = 576 GameWindow.BackgroundColor = "#000000" GameWindow.Show() GameKeyboard.KeyDown=clavier ' add this code intro : Media.stop(player) VideoFile =Program.Directory+"\"+"Lobinson.mp4" ' "C:\Users_________________.mov" Player = Media.CreateMediaPlayer(VideoFile, 0, 0, GameWindow.Width,GameWindow.Height) ' Create Media PLayer Media.Play(Player) 'Start Playing ' Sub clavier key = GameKeyboard.LastKey If (key = "Space") Then Goto passe Else' ' add this code Goto end1' ' add this code EndIf passe : Media.stop(player)' add this code GameWindow.RemoveElement(player) gamewindow.Clear() ' add this code GameWindow.Hide() ' add this code testnext() end1: '' add this code endsub Sub testnext GraphicsWindow.Clear() GraphicsWindow.top=135 GraphicsWindow.Left=175 GraphicsWindow.Width = 1000 GraphicsWindow.Height = 500 GraphicsWindow.BackgroundColor="black" BMB="http://www.ctv-production.com/smallbasic/forum/BOMBE" For i=1 to 10 dum[i]=imagelist.LoadImage(BMB+i+".png") sprite[i]=Shapes.AddImage(dum[i]) Endfor wb=ImageList.GetWidthOfImage(dum[1]) While "true" count=0 Y=200 For X=1050 To -50 Step -wb/5 count=count+1 Y=math.Sin(3.14/180*count*36)*20+200 Shapes.move(sprite[count], X, Y) Program.Delay(100) Shapes.move(sprite[count], 1150, Y) If count=10 Then count=0 EndIf EndFor EndWhile EndSub End>VNQ956.sb< Start>VNR260.sb< 'learning aid revised by Ezra94 gw = 400 gh = 400 GraphicsWindow.Height = gh GraphicsWindow.Width = gw GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/4 createGUI() Controls.ButtonClicked = onButtonClick Sub createGUI bw = gw/2 bh = gh/10 bx = (gw - bw)/2 by = (gh - bh)/2 mainTxtBox = Controls.AddTextBox(bx,by) Controls.SetSize(mainTxtBox,bw,bh) mainButton = Controls.AddButton("Enter",bx,by+bh) Controls.SetSize(mainButton,bw,bh) clearButton = Controls.AddButton("Clear",bx,by+bh*2) Controls.SetSize(clearButton,bw,bh) For i = 0 To 9 digits[i] = i EndFor EndSub Sub onButtonClick input = Controls.GetTextBoxText(mainTxtBox) If (Controls.GetButtonCaption(Controls.LastClickedButton) = "Enter") Then keyWordL = Text.GetLength(input) For i = 1 To keyWordL nums[i] = Text.GetSubText(input,i,1) 'breaks down input into seperate variables If Text.IsSubText("0123456789",nums[i]) Then GraphicsWindow.DrawText(bx,by-bh*2,nums[i]) bx = bx + 8 EndIf EndFor ElseIf (Controls.GetButtonCaption(Controls.LastClickedButton) = "Clear") Then GraphicsWindow.Clear() createGUI() EndIf EndSub End>VNR260.sb< Start>VNR982.sb< max_col = 50 max_row = 50 t = "True" f = "False" init() While 1=1 Program.Delay(20) EndWhile Program.End() sub init GraphicsWindow.Title = "Small Basic Calc Table writen by MartMen 05/2016" GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GWW = Desktop.Width - 10 GWH = Desktop.Height - 70 GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH For col = 1 To max_col If col > 26 Then num1 = Math.Remainder(col, 26) + 64 num2 = Math.Floor(col / 26) + 64 headtitle[col] = Text.Append(Text.GetCharacter(num2), Text.GetCharacter(num1)) Else headtitle[col] = Text.GetCharacter(col + 64) EndIf EndFor CreateData() LDGraphicsWindow.PauseUpdates() dv = LDControls.AddDataView(GWW,GWH-30,headtitle) Shapes.Move(dv, 0, 30) UpdateRows() LDControls.DataViewAllowUserEntry(dv, f) LDControls.DataViewAllowSort(dv, t) LDGraphicsWindow.ResumeUpdates() EndSub 'init Sub CreateData For i = 1 To max_row data[i] = " " EndFor EndSub Sub UpdateRows For n = 1 To max_row For r = 1 To max_col row[r] = data[n] EndFor LDControls.DataViewSetRow(dv, n, row) EndFor EndSub End>VNR982.sb< Start>VNT629.sb< 'WINDOW w= Desktop.Width h = Desktop.Height GraphicsWindow.Title = "Piano" GraphicsWindow.BackgroundColor = "navy" GraphicsWindow.Left = (w - 624) / 2 GraphicsWindow.Top = (h - 444) / 2 'TRAFFIC_POLICEMAN ac = 1 in = 0 na = Controls.AddButton(ac, 0, 0) Controls.HideControl(na) ra = Controls.AddButton(in, 0, 0) Controls.HideControl(ra) 'PIANO GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle((w - 1000) / 2, (h - 535), 1000, 300) For a = 1 To 1000 Step 100 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawRectangle((w - 1000) / 2 + a, (h - 300) / 2, 100, 300) EndFor GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize = 30 GraphicsWindow.DrawText(((w - 1000) / 2) + 40, h - 310, "A") GraphicsWindow.DrawText(((w - 1000) / 2) + 140, h - 310, "B") GraphicsWindow.DrawText(((w - 1000) / 2) + 240, h - 310, "C") GraphicsWindow.DrawText(((w - 1000) / 2) + 340, h - 310, "D") GraphicsWindow.DrawText(((w - 1000) / 2) + 440, h - 310, "E") GraphicsWindow.DrawText(((w - 1000) / 2) + 540, h - 310, "F") GraphicsWindow.DrawText(((w - 1000) / 2) + 640, h - 310, "G") GraphicsWindow.DrawText(((w - 1000) / 2) + 740, h - 310, "H") GraphicsWindow.DrawText(((w - 1000) / 2) + 840, h - 310, "A") GraphicsWindow.DrawText(((w - 1000) / 2) + 940, h - 310, "B") 'DATA wpos = ((w - 1000) / 2) hpos = ((h - 300) / 2) 'CONTROLS GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = 30 plus = Controls.AddButton("+", wpos + 1000, h - 740) Controls.SetSize(plus, 53, 53) GraphicsWindow.FontBold = "false" GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize = 15 clear = Controls.AddButton("Clear", wpos + 1000, hpos - 155) Controls.SetSize(clear, 90, 30) edit = Controls.AddButton("Edit", wpos + 1000, hpos - 125) Controls.SetSize(edit, 90, 30) record = Controls.AddButton("Record", wpos + 1000, hpos - 95) Controls.SetSize(record, 90, 30) close = Controls.AddButton("Close", wpos + 1000, hpos - 65) Controls.SetSize(close, 90, 30) Controls.HideControl(clear) Controls.HideControl(edit) Controls.HideControl(record) Controls.HideControl(close) bxp = ((w - 100) / 2) byp = ((h - 30) / 2) save = Controls.AddButton("Save", bxp - 450, byp + 200) Controls.SetSize(save, 100, 30) load = Controls.AddButton("Load", bxp - 300, byp + 200) Controls.SetSize(load, 100, 30) cancel = Controls.AddButton("Cancel", bxp + 302, byp + 200) Controls.SetSize(cancel, 100, 30) done = Controls.AddButton("Done", bxp + 452, byp + 200) Controls.SetSize(done, 100, 30) GraphicsWindow.FontBold = "true" ds = Controls.AddButton("Done!", wpos + 902, hpos + 385) Controls.SetSize(ds, 100, 30) dl = Controls.AddButton("Done!", wpos + 902, hpos + 385) Controls.SetSize(dl, 100, 30) Controls.HideControl(save) Controls.HideControl(load) Controls.HideControl(cancel) Controls.HideControl(done) Controls.HideControl(ds) Controls.HideControl(dl) 'SALO GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = "false" GraphicsWindow.BrushColor = "black" salo = Controls.AddTextBox(wpos, hpos + 385) Controls.SetSize(salo, 902, 30) GraphicsWindow.BrushColor = "white" st = Shapes.AddText("Save file to:") Shapes.Move(st, wpos + 400, hpos + 360) Shapes.HideShape(st) Controls.HideControl(salo) 'TONE_or_somethin... xD <-- : ) GraphicsWindow.FontBold = "true" GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize = 20 o1 = Controls.AddButton("1", wpos + 25, hpos - 100) Controls.SetSize(o1, 50, 50) Shapes.SetOpacity(o1, 50) o2 = Controls.AddButton("2", wpos + 125, hpos - 100) Controls.SetSize(o2, 50, 50) Shapes.SetOpacity(o2, 50) o3 = Controls.AddButton("3", wpos + 225, hpos - 100) Controls.SetSize(o3, 50, 50) Shapes.SetOpacity(o3, 50) o4 = Controls.AddButton("4", wpos + 425, hpos - 100) Controls.SetSize(o4, 50, 50) Shapes.SetOpacity(o4, 75) o5 = Controls.AddButton("5", wpos + 525, hpos - 100) Controls.SetSize(o5, 50, 50) Shapes.SetOpacity(o5, 75) o6 = Controls.AddButton("6", wpos + 725, hpos - 100) Controls.SetSize(o6, 50, 50) Shapes.SetOpacity(o6, 50) o7 = Controls.AddButton("7", wpos + 825, hpos - 100) Controls.SetSize(o7, 50, 50) Shapes.SetOpacity(o7, 50) o8 = Controls.AddButton("8", wpos + 925, hpos - 100) Controls.SetSize(o8, 50, 50) Shapes.SetOpacity(o8, 50) 'SCREEN GraphicsWindow.FontBold = "true" GraphicsWindow.FontSize = "25" GraphicsWindow.BrushColor = "blue" screen = Controls.AddMultiLineTextBox(wpos, h - 740) Controls.SetSize(screen, 1000, 53) 'RECORDING GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor = "red" rs = Shapes.AddEllipse(50, 50) Shapes.Move(rs, wpos + 475, hpos + 360) recinf = Shapes.AddText("Now recording...") Shapes.Move(recinf, wpos + 443, hpos + 330) GraphicsWindow.BrushColor = "black" play = Controls.AddButton("Play", wpos + 325, hpos + 425) Controls.SetSize(play, 150, 30) abort = Controls.AddButton("Abort", wpos + 525, hpos + 425) Controls.SetSize(abort, 150, 30) Shapes.HideShape(rs) Shapes.HideShape(recinf) Controls.HideControl(play) Controls.HideControl(abort) 'HIDE_ALL GraphicsWindow.BrushColor = "navy" ha = Shapes.AddRectangle(w, h) Controls.HideControl(ha) 'IF_STATEMENTS ''''''''''''''''''''''''''''''''''''''' 'BUTTON_CLICKED Controls.ButtonClicked = bcl Sub bcl lcb = Controls.LastClickedButton If lcb = o1 Then Sound.PlayClick() Sound.PlayMusic("O1") EndIf If lcb = o2 Then Sound.PlayClick() Sound.PlayMusic("O2") EndIf If lcb = o3 Then Sound.PlayClick() Sound.PlayMusic("O3") EndIf If lcb = o4 Then Sound.PlayClick() Sound.PlayMusic("O4") EndIf If lcb = o5 Then Sound.PlayClick() Sound.PlayMusic("O5") EndIf If lcb = o6 Then Sound.PlayClick() Sound.PlayMusic("O6") EndIf If lcb = o7 Then Sound.PlayClick() Sound.PlayMusic("O7") EndIf If lcb = o8 Then Sound.PlayClick() Sound.PlayMusic("O8") EndIf 'PLUS If lcb = plus Then Sound.PlayClick() Controls.ShowControl(clear) Controls.ShowControl(edit) Controls.ShowControl(record) Controls.ShowControl(close) EndIf 'CLEAR If lcb = clear Then Sound.PlayClick() Controls.HideControl(clear) Controls.HideControl(edit) Controls.HideControl(record) Controls.HideControl(close) Controls.SetTextBoxText(screen, "") EndIf 'EDIT If lcb = edit Then Sound.PlayClick() Controls.HideControl(plus) Controls.HideControl(clear) Controls.HideControl(edit) Controls.HideControl(record) Controls.HideControl(close) Controls.ShowControl(save) Controls.ShowControl(load) Controls.ShowControl(cancel) Controls.ShowControl(done) Controls.SetSize(screen, 1002, 510) prevtxt = Controls.GetTextBoxText(screen) gna = Controls.GetButtonCaption(na) If gna = in Then Shapes.HideShape(rs) Shapes.HideShape(recinf) Controls.HideControl(play) Controls.HideControl(abort) EndIf EndIf 'RECORD If lcb = record Then Sound.PlayClick() Controls.HideControl(clear) Controls.HideControl(edit) Controls.HideControl(record) Controls.HideControl(close) gna = Controls.GetButtonCaption(na) If gna = ac Then Shapes.ShowShape(ha) GraphicsWindow.ShowMessage("This command will always clear your screen first, so be sure to save your notes before proceeding to recording mode.", "Keep in mind that:") Controls.SetButtonCaption(na, in) Shapes.HideShape(ha) EndIf Controls.SetButtonCaption(ra, ac) gra = Controls.GetButtonCaption(ra) If gra = ac Then Controls.SetTextBoxText(screen, "") Shapes.ShowShape(rs) Shapes.ShowShape(recinf) Controls.ShowControl(play) Controls.ShowControl(abort) EndIf EndIf 'PLAY If lcb = play Then Sound.PlayClick() gscreen = Controls.GetTextBoxText(screen) Sound.PlayMusic(gscreen) EndIf 'ABORT If lcb = abort Then Sound.PlayClick() Controls.HideControl(play) Controls.HideControl(abort) Shapes.HideShape(rs) Shapes.HideShape(recinf) Controls.SetButtonCaption(ra, in) EndIf 'CLOSE If lcb = close Then Sound.PlayClick() Controls.HideControl(clear) Controls.HideControl(edit) Controls.HideControl(record) Controls.HideControl(close) EndIf 'DONE If lcb = done Then Sound.PlayChimes() Controls.HideControl(done) Controls.HideControl(save) Controls.HideControl(load) Controls.HideControl(cancel) Controls.SetSize(screen, 1000, 53) Controls.ShowControl(plus) gra = Controls.GetButtonCaption(ra) If gra = ac Then Shapes.ShowShape(rs) Shapes.ShowShape(recinf) Controls.ShowControl(play) Controls.ShowControl(abort) EndIf EndIf 'CANCEL If lcb = cancel Then Sound.PlayClick() Controls.HideControl(cancel) Controls.HideControl(save) Controls.HideControl(load) Controls.HideControl(done) Controls.SetSize(screen, 1000, 53) Controls.ShowControl(plus) Controls.SetTextBoxText(screen, prevtxt) gra = Controls.GetButtonCaption(ra) If gra = ac Then Shapes.ShowShape(rs) Shapes.ShowShape(recinf) Controls.ShowControl(play) Controls.ShowControl(abort) EndIf EndIf 'SAVE If lcb = save Then Sound.PlayClick() Controls.HideControl(save) Controls.HideControl(load) Controls.HideControl(cancel) Controls.HideControl(done) Controls.ShowControl(salo) Shapes.SetText(st, "Save file to:") Shapes.ShowShape(st) Controls.ShowControl(ds) EndIf 'LOAD If lcb = load Then Sound.PlayClick() Controls.HideControl(save) Controls.HideControl(load) Controls.HideControl(cancel) Controls.HideControl(done) Controls.ShowControl(salo) Shapes.SetText(st, "Load file from:") Shapes.ShowShape(st) Controls.ShowControl(dl) EndIf 'DONE_LOADING If lcb = dl Then Sound.PlayClick() Controls.HideControl(dl) Controls.HideControl(salo) Shapes.HideShape(st) Controls.ShowControl(save) Controls.ShowControl(load) Controls.ShowControl(cancel) Controls.ShowControl(done) prevtxt = Controls.GetTextBoxText(screen) gsalo = Controls.GetTextBoxText(salo) ' The following line could be harmful and has been automatically commented. ' contents = File.ReadContents(gsalo) Controls.SetTextBoxText(screen, contents) gscreen = Controls.GetTextBoxText(screen) If gscreen = "" Then Controls.SetTextBoxText(screen, prevtxt) EndIf EndIf 'DONE_SAVING If lcb = ds Then Sound.PlayClick() Controls.HideControl(ds) Controls.HideControl(salo) Shapes.HideShape(st) gsalo = Controls.GetTextBoxText(salo) gscreen = Controls.GetTextBoxText(screen) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(gsalo, gscreen) Controls.ShowControl(save) Controls.ShowControl(load) Controls.ShowControl(cancel) Controls.ShowControl(done) EndIf EndSub 'MOUSE_DOWN GraphicsWindow.MouseDown = click Sub click x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY wpos = ((w - 1000) / 2) hpos = ((h - 300) / 2) If x > wpos And x < wpos + 100 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("A") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "A ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 100 And x < wpos + 200 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("B") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "B ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 200 And x < wpos + 300 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("C") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "C ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 300 And x < wpos + 400 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("D") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "D ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 400 And x < wpos + 500 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("E") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "E ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 500 And x < wpos + 600 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("F") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "F ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 600 And x < wpos + 700 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("G") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "G ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 700 And x < wpos + 800 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("H") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "H ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 800 And x < wpos + 900 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("A") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "A ") Controls.SetTextBoxText(screen, append) EndIf If x > wpos + 900 And x < wpos + 1000 And y > hpos And y < hpos + 300 Then Sound.PlayMusic("B") gs = Controls.GetTextBoxText(screen) append = Text.Append(gs, "B ") Controls.SetTextBoxText(screen, append) EndIf EndSub End>VNT629.sb< Start>VNT672.sb< ' SmallBasic Version 1.2 ' Program: ColorWheel ' Changelog: 15.11/12 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/ca8db35c-abc7-4a9f-9e92-a1e4ae7c4ea4/colors-shapes-and-brushes ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: http://www.leifiphysik.de/themenbereiche/farben/lb/heimversuche-farbkreisel ' http://www.leifiphysik.de/printpdf/730?v=ok (leifi_physik_-_heimversuche_-_farbkreisel_-_2015-05-26.pdf) ' http://www.leifiphysik.de/sites/default/files/medien/farben_versuch_farbkreisel.svg ' KEYS: Escape ... Exit, Space ... Stop rotation, R|D ... toggle direction R<->L ' Left/Right ... -/+ rotation speed (dStep) ' Down/Up ... prev./next wheel image ' ================================================================================ r = 200 '' Wheel Radius [Pxl], eg. 300 dStep = 100 '' Delta -/+ rpm, eg. 50 rpm = 0 '' Initial Wheel RotSpeed [Revolutions/Minute], eg. 100 imgDir = Program.Directory + "\img\Wheels" '' Directory for additional wheel images, with ... arrAllowed = "1=bmp;2=gif;3=ico;4=jpg;5=jpeg;6=png;7=tiff;" '' ... allowed extensions to filter out '' 1.) Drawing wheel with different color sectors (●, highest wheel# and is selected from start) arrCols = "1=Red;2=Lime;3=Blue;" '' Best (white/gray) result at 1200 rpm 'arrDegs = "1=180;2=90;3=90;" '' Degrees for arrCols eg: 180° Red, 90° Lime, 90° Blue (Sum = 360°) '' eg. Alternative 7-color wheel, with equal (arrDegs = "") or variable sector angles (from arrDegs) 'arrCols = "1=#8B00FF;2=Indigo;3=Blue;4=Lime;5=Yellow;6=Orange;7=Red;" ' 1=DarkViolet; 'arrCols = "1=DarkViolet;2=DarkBlue;3=LightBlue;4=Green;5=Yellow;6=Orange;7=Red;" 'arrDegs = "1=61;2=34;3=54;4=61;5=55;6=34;7=61;" '' ~ Bandwidth in visible 7-color spectrum [°], Sum = 360 nCols = Array.GetItemCount(arrCols) '' Check/Correct the last value in arrDegs, if sum <> 360° (as long as sum of prev. values <= 360) '' eg. "1=180;2=90;3=9;" is corrected to "1=180;2=90;3=90;" now with sum = 360 If Array.IsArray(arrDegs) Then AutoCorrectDegs() Else arrDegs = "" EndIf 'ReverseCols() '' optional sort colors in reverse order (for drawing wheel) '' 2.) Additional image files to select/change (○, optional) from defined directory path (imgDir) GetImages() ' ================ NO changes below ================ lastRPM = 0 lf = Text.GetCharacter(10) nPics = Array.GetItemCount(arrPics) pi = 3.14159 rads = 2 * pi / nCols brush = LDShapes.BrushImage("") '' #FF6A5ACD (106,90,205), to support transparency for wheel image LDUtilities.ShowErrors = "False" '' ignore ERROR, and support transparency for wheel image LDGraphicsWindow.TransparentGW() LDGraphicsWindow.TopMost = "True" GraphicsWindow.Width = 2 * r GraphicsWindow.Height = 2 * r WheelImage() '' Textinfo for RpM, RpS, Image# GraphicsWindow.BrushColor = "Orange" shpInfo = Shapes.AddText("") UpdateInfo() LDShapes.BrushEllipse(brush, 0,0, 2*r,2*r) GraphicsWindow.PenWidth = 0 shpWheel = Shapes.AddEllipse(2*r, 2*r) LDShapes.BrushShape(shpWheel, brush) SetActivePic() OnKeyDown() GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove ' ////////// EVENTs \\\\\\\\\\ Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then ' Exit Program.End() ElseIf lastKey = "Left" Then ' Decrease speed rpm = rpm - dStep ElseIf lastKey = "Right" Then ' Increase speed rpm = rpm + dStep ElseIf lastKey = "Space" Then ' Stop rpm = 0 ElseIf lastKey = "R" Or lastKey = "D" Then ' Change direction rpm = -rpm ElseIf lastKey = "Up" And nPics > 1 Then ' Next image activePic = Math.Remainder(activePic, nPics) + 1 SetActivePic() ElseIf lastKey = "Down" And nPics > 1 Then ' Previous image activePic = Math.Remainder(nPics + activePic-2, nPics) + 1 SetActivePic() EndIf If rpm <> lastRPM Then T = 0 If rpm <> 0 Then T = 60000 / rpm EndIf LDShapes.AnimateRotation(shpWheel, T,0) ' Change speed ... UpdateInfo() ' ... and Info lastRPM = rpm EndIf EndSub '' 3 Events to drag GW Sub OnMouseDown xOff = GraphicsWindow.MouseX yOff = GraphicsWindow.MouseY dragOn = "True" EndSub Sub OnMouseUp dragOn = "" EndSub Sub OnMouseMove If dragOn Then GraphicsWindow.Left = Mouse.MouseX - xOff GraphicsWindow.Top = Mouse.MouseY - yOff EndIf EndSub ' ////////// SUBs \\\\\\\\\\ Sub GetImages ' The following line could be harmful and has been automatically commented. ' arrFiles = File.GetFiles(imgDir) For n = 1 To Array.GetItemCount(arrFiles) ' The following line could be harmful and has been automatically commented. ' ext = Text.ConvertToLowerCase(LDFile.GetExtension(arrFiles[n])) If Array.ContainsValue(arrAllowed, ext) Then arrPics[Array.GetItemCount(arrPics) + 1] = arrFiles[n] EndIf EndFor EndSub Sub AutoCorrectDegs For i = 1 To nCols-1 sum = sum + arrDegs[i] EndFor If sum + arrDegs[nCols] <> 360 Then arrDegs[nCols] = 360 - sum EndIf EndSub Sub ReverseCols For n = nCols To 1 Step -1 rev[Array.GetItemCount(rev) + 1] = arrCols[n] EndFor arrCols = rev EndSub Sub WheelImage GraphicsWindow.BrushColor = arrCols[1] GraphicsWindow.FillEllipse(0,0, 2*r,2*r) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = arrCols[2] GraphicsWindow.DrawLine(r,r, 2*r,r) For n = 1 To nCols-1 If Array.IsArray(arrDegs) Then rads = arrDegs[n] * pi/180 EndIf ang = ang + rads x = r + r * Math.Cos(ang) y = r + r * Math.Sin(ang) GraphicsWindow.PenColor = arrCols[n+1] GraphicsWindow.DrawLine(r,r, x,y) xP = r + r/2 * Math.Cos(ang + rads/2) yP = r + r/2 * Math.Sin(ang + rads/2) GraphicsWindow.BrushColor = arrCols[n+1] LDGraphicsWindow.FloodFill(xP,yP, arrCols[n+1]) EndFor GraphicsWindow.PenColor = arrCols[nCols] GraphicsWindow.DrawLine(r,r, 2*r,r) nPics = nPics + 1 arrPics[nPics] = LDGraphicsWindow.Capture("","") '' add drawing image ... activePic = nPics '' ... and set active GraphicsWindow.Clear() EndSub Sub SetActivePic brush = LDShapes.BrushImage(arrPics[activePic]) LDShapes.BrushShape(shpWheel, brush) UpdateInfo() EndSub Sub UpdateInfo rps = Math.Round(rpm / 60) ' The following line could be harmful and has been automatically commented. ' ' picName = LDFile.GetFile(arrPics[activePic]) If activePic = nPics Then symb = "● " Else symb = "○ " EndIf txt = rpm +" r/min"+lf+ rps +" r/sec"+lf+ symb + activePic ' or ... + picName Shapes.SetText(shpInfo, txt) EndSub End>VNT672.sb< Start>VNV951-1.sb< 'Circling Squares - Rotating sqares around a center, Farris Wheel style. -- Compliments of codingCat aka Matthew L. Parets - No rights resevered as long as no money is earned blckCnt = 12 'Number of blocks to create blckSiz = 50 'How big are the blocks radious = 275 'Size of the circle rotationSpeed = 1 'Angle change between steps in rotation LDUtilities.ShowNoShapeErrors ="false LDUtilities.ShowErrors ="false GraphicsWindow.BackgroundColor = "darkblue GraphicsWindow.BrushColor = "White" GraphicsWindow.Width = 700 GraphicsWindow.Height = 700 centerx = GraphicsWindow.Width/2 - blckSiz / 2 'Find the center of the circle - offset will need to be nudged with different sized shapes centery = centerx GraphicsWindow.PenWidth=10 GraphicsWindow.PenColor ="gold GraphicsWindow.DrawEllipse(centerx-275+20,centerx-275+5,550 550) GraphicsWindow.PenWidth=0 angleStep = 360 / blckCnt ' Amount of space (angle count) between shapes CreateShapes() 'Create and place shapes GraphicsWindow.Title ="Carousel wheel pos = 1 'Start with the first block '--- Main Program Loop ----------------------------------------------------------------------- GraphicsWindow.PenWidth =7 GraphicsWindow.PenColor ="gold 'calcuate x/y based on angle around the circle For a=1 To 360 *2 For pos=1 To 12 angle[pos] = angle[pos] + rotationSpeed/2 x[a][pos] = ldMath.Cos(Angle[pos]) * radious + centerx y[a][pos] = ldMath.Sin(Angle[pos]) * radious + centery endfor If a<360 Then li=shapes.AddLine (x[a][1]+20,y[a][1]+5,x[a][7]+20,y[a][7]+5) LDShapes.ZIndex (li,-1555) lin[a]=LDFastShapes.ShapeIndex (li) ldfastShapes.HideShape (lin[a]) endif EndFor LDFastShapes.Update () While "True For a=1 To 360*2 For pos=1 To 12 LDFastShapes.Move (blck[pos],x[a][pos],y[a][pos]) endfor GraphicsWindow.penColor ="gold GraphicsWindow.PenWidth=6 For xx=0 to 5 ldfastShapes.HideShape (lin[math.Remainder (a,60)+1+xx*60]) ldfastShapes.ShowShape (lin[math.Remainder (a+1,60)+1+xx*60]) endfor LDFastShapes.Update () program.Delay(10) endfor EndWhile Sub CreateShapes For i = 1 To blckCnt baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle angle[i] = baseAngle 'Store the shapes angle GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bll= Shapes.AddRectangle(blckSiz,blckSiz) 'Create the shape blck[i] =LDFastShapes.ShapeIndex (bll) x = ldMath.Cos(Angle[i]) * radious + centerx y = ldMath.Sin(Angle[i]) * radious + centery ldfastShapes.Move(blck[i],x,y) 'Place the shape on the circle EndFor LDFastShapes.Update () EndSub End>VNV951-1.sb< Start>VNV951-2.sb< 'Circling Squares - Rotating sqares around a center, Farris Wheel style. -- Compliments of codingCat aka Matthew L. Parets - No rights resevered as long as no money is earned blckCnt = 12 'Number of blocks to create blckSiz = 50 'How big are the blocks radious = 275 'Size of the circle rotationSpeed = 1 'Angle change between steps in rotation 'LDUtilities.ShowNoShapeErrors ="false 'LDUtilities.ShowErrors ="false GraphicsWindow.BackgroundColor = "darkblue GraphicsWindow.BrushColor = "White" GraphicsWindow.Width = 700 GraphicsWindow.Height = 700 centerx = GraphicsWindow.Width/2 - blckSiz / 2 'Find the center of the circle - offset will need to be nudged with different sized shapes centery = centerx GraphicsWindow.PenWidth=10 GraphicsWindow.PenColor ="gold GraphicsWindow.DrawEllipse(centerx-275+20,centerx-275+5,550 550) GraphicsWindow.PenWidth=0 angleStep = 360 / blckCnt ' Amount of space (angle count) between shapes CreateShapes() 'Create and place shapes GraphicsWindow.Title ="Carousel wheel pos = 1 'Start with the first block '--- Main Program Loop ----------------------------------------------------------------------- GraphicsWindow.PenWidth =7 GraphicsWindow.PenColor ="gold 'calcuate x/y based on angle around the circle For a=1 To 360 *2 For pos=1 To 12 angle[pos] = angle[pos] + rotationSpeed/2 x[a][pos] = Math.Cos(Angle[pos]) * radious + centerx y[a][pos] = Math.Sin(Angle[pos]) * radious + centery endfor If a<360 Then li=shapes.AddLine (x[a][1]+20,y[a][1]+5,x[a][7]+20,y[a][7]+5) 'LDShapes.ZIndex (li,-1555) lin[a]=li Shapes.HideShape (lin[a]) endif EndFor 'LDFastShapes.Update () While "True For a=1 To 360*2 For pos=1 To 12 Shapes.Move (blck[pos],x[a][pos],y[a][pos]) endfor GraphicsWindow.penColor ="gold GraphicsWindow.PenWidth=6 For xx=0 to 5 Shapes.HideShape (lin[math.Remainder (a,60)+1+xx*60]) Shapes.ShowShape (lin[math.Remainder (a+1,60)+1+xx*60]) endfor 'LDFastShapes.Update () program.Delay(50) endfor EndWhile Sub CreateShapes For i = 1 To blckCnt baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle angle[i] = baseAngle 'Store the shapes angle GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bll= Shapes.AddRectangle(blckSiz,blckSiz) 'Create the shape blck[i] =bll x = Math.Cos(Angle[i]) * radious + centerx y = Math.Sin(Angle[i]) * radious + centery Shapes.Move(blck[i],x,y) 'Place the shape on the circle EndFor 'LDFastShapes.Update () EndSub End>VNV951-2.sb< Start>VNV951.sb< 'Circling Squares - Rotating sqares around a center, Farris Wheel style. -- Compliments of codingCat aka Matthew L. Parets - No rights resevered as long as no money is earned blckCnt = 13 'Number of blocks to create blckSiz = 50 'How big are the blocks radious = 275 'Size of the circle rotationSpeed = 1 'Angle change between steps in rotation frameLength = 45 'Number of milleseconds between animation frames GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "White" GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 GraphicsWindow.Show() angleStep = 360 / blckCnt ' Amount of space (angle count) between shapes centerx = GraphicsWindow.Width/2 - blckSiz / 2 'Find the center of the circle - offset will need to be nudged with different sized shapes centery = GraphicsWindow.Height/2 - blckSiz / 2 CreateShapes() 'Create and place shapes pos = 1 'Start with the first block framestart = Clock.ElapsedMilliseconds 'Start the clock '--- Main Program Loop ----------------------------------------------------------------------- While "True" 'calcuate x/y based on angle around the circle angle[pos] = angle[pos] + rotationSpeed angle[pos] = Math.Remainder(angle[pos],360) radAngle = Math.GetRadians(angle[pos]) x = Math.Cos(radAngle) * radious + centerx y = Math.Sin(radAngle) * radious + centery Shapes.Move(blck[pos],x,y) 'Change the position pos = pos + 1 ' Next shape If pos > blckCnt Then 'Reached the end? start over frameDelay() 'Wait a tick or two between moves pos = 1 EndIf EndWhile Sub CreateShapes For i = 1 To blckCnt baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle angle[i] = baseAngle 'Store the shapes angle GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() blck[i] = Shapes.AddRectangle(blckSiz,blckSiz) 'Create the shape radAngle = Math.GetRadians(angle[i]) x = Math.Cos(radAngle) * radious + centerx y = Math.Sin(radAngle) * radious + centery Shapes.Move(blck[i],x,y) 'Place the shape on the circle EndFor EndSub Sub frameDelay 'Precise frame timing. More exact that program.delay While Clock.ElapsedMilliseconds - framestart < frameLength EndWhile framestart = Clock.ElapsedMilliseconds EndSub End>VNV951.sb< Start>VNX111.sb< Player=Shapes.AddRectangle(30,30) playerAngle=135 playerSpeed=0.1 gameHeight=600 gameWidth=600 While "True" Shapes.Rotate(Player,playerAngle) x = Math.Remainder(Shapes.GetLeft(player) + (Math.Cos(Math.GetRadians(playerAngle - 90)) * playerSpeed) + gameWidth, gameWidth) y = Math.Remainder(Shapes.GetTop(player) + (Math.Sin(Math.GetRadians(playerAngle - 90)) * playerSpeed) + gameHeight, gameHeight) Shapes.Move(player, x, y) endwhile End>VNX111.sb< Start>VNX260.sb< GraphicsWindow.Title="XBasic v0.41 GraphicsWindow.Width =800 GraphicsWindow.Height=600 GraphicsWindow.BackgroundColor="teal GraphicsWindow.Left =10 GraphicsWindow.Top =10 GraphicsWindow.BrushColor ="#00ffee tt=Controls.AddMultiLineTextBox (5 5) LDShapes.BrushColour (tt "#000099") GraphicsWindow.BrushColor ="darkblue Controls.SetSize (tt 300 560) ex=Controls.AddTextBox (5 570) Controls.SetSize (ex 250 25) Controls.AddButton ("<<< Xc" 255 570) Controls.ButtonClicked=bcc nn=Text.GetCharacter (13)+Text.GetCharacter(10) nw=text.GetCharacter(34) spp="" dbg="false dty=10 prg[1]="!100 93|c|= 30|= hh ++ 0|= cc 0|n 0 1|: ll|h cc %hh 1 .5|n %cc 1|+ hh 1.5|a $r2 %1|* 1.05|g ll 50|p 20| prg[2]="!15 summer|= %%|* 400|= %%|* 300|= %%|* 200|+ 50|= %%|* 150|+ 40|q %1 %2 %3 %4 prg[3]="!12 |= vl 5|= hi ++ 0|= hh 0|= ww 1|: ll|h hh %hi 1 .4|n %hh %ww|+ ww .5|+ hi 2|a %vl 6|- vl .3|g ll 51| prg[4]="= x 0 y 0 z 50 hh 0 hi 0|c |: rr|+ x .3|e z %z+%%*10-5|e y Math.Sin(%x/10)*%z+150|+ hi .2|h hh %hi 1 .6|s %x %y %hh|g rr 2300 prg[5]="= x 0 y 0 z 0 hh 0 hi 0|c |: rr|+ x .3|e z Math.Abs(Math.Sin(%x/30))*90|e y Math.Sin(%x/10)*%z+150|+ hi .2|h hh %hi 1 .6|s %x %y %hh|g rr 2300 prg[6]="!0 74;c;];= 30|= hh 0 cc 0;n 0 1|: ll;m $r2 %1;* 1.05;g ll 50|= i 5 j 6 k 1 l 0;: ff|h cc %hh 1 .5;+ hh 8|x %i %j %k %l 0 teal %cc 0 1|i 1 i j k l;g ff 30|= n 0;: hh;j 482 268 %n|- n 5;p 30;g hh GraphicsWindow.MouseMove =mmww htx="Help:!= [x] v ~ define var x = v | var ref. by %x or %1! later, only byval. if ommited [x] var is! ref. by number! ref. by name is for export only: @var!+-*/ [x] v ~ add/sub/mul/div var x/[last] by v! htx=htx+"V ~ list all vars to cons.!F fnt_nm;siz;[b];[i] ~ font name/size/bold/itl!? ttt ~ Print text to graphWnd !C ~ clear GW!X ~ clear console!B ccc ~ backgrnd color!G lll ~ goto lbl lll!: lll ~ label lll!T ttt ~ write txt to console+nl!W ttt ~ write txt to cons.!L x1 y1 dx dy ~ draws line!"'{ / } ~ Begin..End block!" htx=htx+"[ va v1/v2/v3/... ~ array 'va' of values v1,v2...!] [n] ~ resets var counter to 0/[n]!Q x y ww hh ~ draws rounded rect. at x,y!I ~ defines fill for Q cmd by file 'htx=htx+"< cc / > ~ while/ endwh. blk., const $t/$f true/fls! htx=htx+"!!cmdline commands:!xp ~ expands cmds!u ~ undoes xp cmd!run ~ starts prog. w args $r2..$r9!save ~ saves prg !new ~ clear prg!load ~ loads prg!Xam ~ export as xamarin code!Xsb ~ export as small basic code!Xx-sb~ convert SB to xamarin file hlptxt=LDText.Replace (htx "!" nn) Controls.SetTextBoxText (ex "?") bcc() LDFocus.SetFocus (ex) args=0 di=LDText.Split ("run save new load stop list sampl1 sampl2 sampl3 sampl4 sampl5 sampl6 xam<-sb xam x-sb anim" " ") LDDialogs.AddRightClickMenu (di "") LDDialogs.RightClickMenu=rrr Controls.SetTextBoxText (tt ldtext.Replace (prg[1] "|" nn)) GraphicsWindow.MouseDown=mdd GraphicsWindow.KeyDown=kkk GraphicsWindow.KeyUp=kku LDEvents.MouseWheel=mwhh zz=1 Sub mwhh If cttr Then zz=zz+ LDEvents.LastMouseWheelDelta /10 LDGraphicsWindow.Reposition (zz zz 0 0 0) endif EndSub Sub mmww If cttr Then GraphicsWindow.Title =GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY EndIf EndSub Sub kkk If Text.IsSubText (text.ConvertToLowerCase (GraphicsWindow.LastKey) "ctrl") Then cttr="true endif lk= GraphicsWindow.LastKey If lk="F1" Then Controls.SetTextBoxText (ex "run") elseIf lk="F2" Then Controls.SetTextBoxText (ex "save") elseIf lk="F3" Then Controls.SetTextBoxText (ex "load") elseIf lk="F4" Then Controls.SetTextBoxText (ex "new") elseIf lk="F5" Then Controls.SetTextBoxText (ex "stop") elseIf lk="F6" Then Controls.SetTextBoxText (ex "list") Else Goto xxx endif bcc() xxx: EndSub Sub kku If Text.IsSubText (text.ConvertToLowerCase (GraphicsWindow.LastKey) "ctrl") Then cttr="false endif EndSub Sub mdd If cttr then ccc= LDColours.HSLtoRGB (math.Remainder (cch 360) 1 .6) cch=cch+5 ldGraphicsWindow.FloodFill (GraphicsWindow.MouseX GraphicsWindow.MouseY ccc) EndIf EndSub Sub rrr ett=di[LDDialogs.LastRightClickMenuItem] If Text.StartsWith (ett "samp") Then cmm=ett else Controls.SetTextBoxText (ex ett ) endif EndSub Sub veval'------------------------------------------------evaluate vars----------------------------- aa=args[1] ii=Array.GetAllIndices(var) For r=1 to 9 aa=LDText.Replace (aa "%"+r var[r]) EndFor For r=1 to Array.GetItemCount (ii) aa=LDText.Replace (aa "!"+ii[r] math.Floor (var[ii[r]])) aa=LDText.Replace (aa "%"+ii[r] var[ii[r]]) For d=30 To 1 Step -1 ' -------------------------------------------------- arrays For n=1 To 5 aa=LDText.Replace (aa "^"+n+":"+d var[n][d]) endfor EndFor aa=LDText.Replace (aa "%%" Math.GetRandomNumber (100)/100) endfor return=aa EndSub Sub xpnd ppm="" xpl=ldtext.Split ("h clr_HSB p pause c clr_gw = let + inc - dec / divide * multiply n pen_Clr_Wid g goto : ***-label--------------->> a turtle_an_dst" " ") For x=1 To Array.GetItemCount (ppp) ll=text.ConvertToLowerCase ( text.GetSubText(ppp[x] 1 1)) lq=text.GetSubTextToEnd (ppp[x] 2) For y=1 To Array.GetItemCount(xpl) Step 2 if ll=xpl[y] Then ll=xpl[y+1] Goto exx EndIf EndFor exx: ppm=ppm+ll+lq+nn EndFor Controls.SetTextBoxText (tt ppm) EndSub ''''''''''''''''''''''''''''''''''''''''''''''----------------------------------------------------------------------main loop---------------------------- not="false=true;true=false cin=0 While "true If cmm="xsc" Then cmm="" cl=0 cv=0 ppp=ldtext.Split (ldtext.Replace (Controls.GetTextBoxText (tt) ";" nn) nn) xsecc() elseIf text.StartsWith (cmm "sampl") Then Controls.SetTextBoxText (tt ldtext.Replace (prg[Text.GetSubTextToEnd (cmm 6)] "|" nn)) cmm="" elseIf cmm="xamm" Then ss=LDDialogs.SaveFile ("txt","e:\") xammx() cmm="" elseIf cmm="xll" Then ott=Controls.GetTextBoxText (tt) ppp=ldtext.Split (ldtext.Replace (ott ";" nn) nn) ccx="" For f=1 to Array.GetItemCount (ppp) ccx=text.Append (ccx ppp[f]+nn) endfor Controls.SetTextBoxText (tt ccx) cmm="" elseIf cmm="xpnd" Then ott=Controls.GetTextBoxText (tt) ppp=ldtext.Split (ott nn) cmm="" xpnd() elseIf text.StartsWith (cmm "anm") Then cx=text.GetSubTextToEnd (cmm 5) ci=0 cmm="" si=not[stpp] While si 'TextWindow.Write (ci) GraphicsWindow.Title=ci im=ImageList.LoadImage (Program.Directory+"\f"+(ci)+".png") GraphicsWindow .DrawImage (im 0 0 ) Program.Delay (90) ci=ci+1 ci=math.Remainder (ci cx) si=not[stpp] EndWhile elseIf cmm="sav" Then ss=LDDialogs.SaveFile ("txt","e:\") ' The following line could be harmful and has been automatically commented. ' File.WriteContents (ss Controls.GetTextBoxText (tt)) cmm="" elseIf cmm="sbo" Then ss=LDDialogs.SaveFile ("sb","e:\") cmm="" xsb() pph=LDShell.SpecialFolderPaths stt=pph["Program Files (x86)"] LDProcess.Start (stt+"\Microsoft\Small Basic\sb.exe" ss) elseif cmm="ldd" then ss= LDDialogs.OpenFile ("txt" "e:\") ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists (ss) then ' The following line could be harmful and has been automatically commented. ' controls.SetTextBoxText (tt File.ReadContents (ss)) endif cmm="" elseif cmm="xxsb" then ss= LDDialogs.OpenFile ("sb" "e:\") ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists (ss) then ' The following line could be harmful and has been automatically commented. ' controls.SetTextBoxText (tt File.ReadContents (ss)) cnvxam() endif cmm="" endif endwhile'--------------------------------------------------------------------------------------------------------------------======================= Sub xsb'-----------------------------------------------------------sb output-----------------------***************** cc=Controls.GetTextBoxText (tt) mfl="false gg=" " If Text.IsSubText (cc nn+"a ") Then dtt="Turtle.x=600;Turtle.y=400;Turtle.Speed=10;" endif If Text.StartsWith (cc "!") Then c1=LDText.Split (cc nn) c11=LDText.Split (c1[1] " ") For r=2 To Array.GetItemCount (c11) cc=LDText.Replace (cc "$r"+r c11[r]) EndFor endif cc1="GraphicsWindow.BackgroundColor="+nw+"teal" cc1=cc1+nn+"GraphicsWindow.Left=5 cc1=cc1+nn+"GraphicsWindow.Top=5 cc1=cc1+nn+"GraphicsWindow.Width=1200 cc1=cc1+nn+"GraphicsWindow.Height=800"+nn cc=ldtext.Replace (cc "%%" "(Math.GetRandomNumber(100)/100)") cc=LDText.Split (cc1+cc nn) cti=0 qi=0 For xx=1 To Array.GetItemCount (cc) for r=1 to 9 cc[xx]=LDText.Replace (cc[xx] "%"+r "_v"+r) EndFor cc[xx]=LDText.Replace (cc[xx] "%" "") pp=ldtext.Split (cc[xx] " ") ac=Array.GetItemCount (pp) cm=text.ConvertToLowerCase (pp[1]) If cm=":" Then cti=cti+1 cc[xx]="ct"+cti+" = 0;"+pp[2]+":" elseIf cm="c" Then cc[xx]= "GraphicsWindow.Clear();" elseIf cm="q" Then cc[xx]="pt=LDShapes.BrushImage (Flickr.GetPictureOfMoment()); LDShapes.BrushRoundedRectangle(pt "+pp[2]+gg+pp[3]+gg+pp[4]+gg+pp[5]+" 30)" elseIf cm="s" Then cc[xx]="GraphicsWindow.SetPixel("+pp[2]+gg+pp[3]+gg+pp[4]+")" elseIf cm="e" Then cc[xx]=pp[2]+" = "+pp[3] elseIf cm="g" Then dg="ct"+cti cc[xx]=dg+" = "+dg+" + 1; If "+dg+"<="+pp[3]+" Then; Goto "+pp[2]+"; Endif" cti=cti-1 elseIf cm="a" Then cc[xx]="Turtle.Turn("+pp[2]+"); Turtle.Move("+pp[3]+") elseIf cm="++" Then elseIf cm="+" Then If ac>=3 then cc[xx]=pp[2]+" = "+pp[2]+" + " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]=pp[2]+" = "+pp[2]+" - " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]=pp[2]+" *= " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]="" For vq=2 to ac step 2 cc[xx]=cc[xx]+pp[vq]+" = "+pp[vq+1]+"; " EndFor Else qi=qi+1 cc[xx]="_v"+qi+" = "+pp[2]+"; " endif elseIf cm="+" Then endif EndFor oo="" For xx=0 To Array.GetItemCount (cc) oo=oo+cc[xx]+nn EndFor oo=LDText.Replace (oo ";" nn) If mfl Then oo=oo+nn+"Endfor"+nn EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteContents (ss oo) EndSub Sub xammx'----------------------------------------------------------xamarin output-------------------------- cc=Controls.GetTextBoxText (tt) If Text.IsSubText (cc nn+"a ") Then dtt="Turtle.Speed=10;" endif If Text.StartsWith (cc "!") Then c1=LDText.Split (cc nn) c11=LDText.Split (c1[1] " ") For r=2 To Array.GetItemCount (c11) cc=LDText.Replace (cc "$r"+r c11[r]) EndFor endif cc=LDText.Split (cc nn) cti=0 qi=0 cc[0]="using Microsoft.SmallBasic.Library;" For xx=1 To Array.GetItemCount (cc) cc[xx]=LDText.Replace (cc[xx] "%" "v") pp=ldtext.Split (cc[xx] " ") ac=Array.GetItemCount (pp) cm=text.ConvertToLowerCase (pp[1]) If cm=":" Then cti=cti+1 cc[xx]="int ct"+cti+" = 0; do { elseIf cm="c" Then cc[xx]= "GraphicsWindow.Clear();"+dtt dtt="" elseIf cm="g" Then cc[xx]="ct"+cti+"++; } while(ct"+cti+"<="+pp[3]+"); cti=cti-1 elseIf cm="a" Then cc[xx]="Turtle.Turn("+pp[2]+"); Turtle.Move("+pp[3]+"); elseIf cm="+" Then If ac>=3 then cc[xx]=pp[2]+" += " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]=pp[2]+" -= " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]=pp[2]+" *= " For vq=3 to ac cc[xx]=cc[xx]+pp[vq] If vq=3 then cc[xx]="" For vq=2 to ac step 2 cc[xx]=cc[xx]+"Primitive "+pp[vq]+" = "+pp[vq+1]+"; " EndFor Else qi=qi+1 cc[xx]="Primitive v"+qi+" = "+pp[2]+"; " endif elseIf cm="+" Then endif EndFor oo="" For xx=0 To Array.GetItemCount (cc) oo=oo+cc[xx]+nn EndFor If mfl Then oo=oo+"}"+nn EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteContents (ss oo) EndSub sub cnvxam cc=Controls.GetTextBoxText (tt) cc=LDText.Split (cc nn) For x=1 To Array.GetItemCount (cc) cc[x]=ldtext.Trim(cc[x]) If cc[x]="" Then cc[x]=" // " endif EndFor nt="using Microsoft.SmallBasic.Library"+nn For x=1 To Array.GetItemCount (cc) nt=nt+cc[x]+nn EndFor oc=nt cc=nt cc= LDText.Replace (text.ConvertToLowerCase (cc) nn "~"+nn) cc= LDText.Replace (cc "endsub~" "} //endsub"+nn) cc= LDText.Replace (cc "endif~" "} //endif"+nn+nn) cc= LDText.Replace (cc "endwhile~" "} //endwhile"+nn+nn) cc= LDText.Replace (cc "endfor~" "} //endfor"+nn+nn) cc= LDText.Replace (cc "elseif" "}"+nn+"else{ //") cc= LDText.Replace (cc "else " "}"+nn+"else {") cc= LDText.Replace (cc "while " nn+"while (") cc= LDText.Replace (cc "if " nn+"if (") cc= LDText.Replace (cc " then~" ") {") cc= LDText.Replace (cc "' " "//") cc= LDText.Replace (cc "for " "for (int _x_ = _y_; _x_<=_xx_; _x_++) { //") cc= LDText.Replace (cc "sub " "void _") cc= LDText.Replace (cc "shapes. " "Shapes.") cc= LDText.Replace (cc "math." "Math.") cc= LDText.Replace (cc nw+"true"+nw "true") cc= LDText.Replace (cc nw+"false"+nw "false") cc=LDText.Split (cc nn) oc=LDText.Split (oc nn) id="" For x=1 To Array.GetItemCount (cc) pdt=text.GetIndexOf(cc[x] ".") peq=text.GetIndexOf(cc[x] "=") If pdt=0 Then pdt=peq+1 endif If Text.StartsWith (cc[x] "void _") Then id=" " cc[x]=LDText.Replace (cc[x] "~" "(){") cc[x]=LDText.Replace (cc[x] "_" "") elseIf Text.StartsWith (cc[x] "for (") Then dofor() cc[x]=id+cc[x] id=id+" " elseIf Text.StartsWith (cc[x] "while (") Then cc[x]=LDText.Replace (cc[x] "~" "){") elseIf Text.StartsWith (cc[x] "if (") Then cc[x]=id+cc[x] If Text.IsSubText (cc[x] "=") then cc[x]=LDText.Replace (cc[x] "=" "==") cc[x]=LDText.Replace (cc[x] ">==" ">=") cc[x]=LDText.Replace (cc[x] "<==" "<=") EndIf cc[x]=LDText.Replace (cc[x] "<>" "!=") id=id+" " elseIf Text.StartsWith (cc[x] "while (") Then cc[x]=id+cc[x] id=id+" " elseIf Text.StartsWith (cc[x] "}") then id=Text.GetSubTextToEnd (id 3) cc[x]=id+cc[x] elseif Text.IsSubText (cc[x] "=") and pdt>peq then tyy="int " If Text.IsSubText (cc[x] Text.GetCharacter(34)) then tyy="Primitive endif dc=ldtext.Split (cc[x] "=") dt=ldtext.Trim (cc[1]) If Array.ContainsValue (dv dt) then cc[x]=id+cc[x] else cc[x]=id+tyy+cc[x] dix=dix+1 dv[dix]=dt endif Else cc[x]=id+cc[x] endif cupcc()'--------------------turns back uppercased chars EndFor nt="" For x=1 To Array.GetItemCount (cc) nt=nt+cc[x]+nn EndFor nt=LDText.Replace (nt "~" ";") Controls.SetTextBoxText (tt nt) EndSub Sub dofor cy=ldtext.Replace (cc[x] "to" "~") cy=ldtext.Replace (cy "=" "~") cy=ldtext.Replace (cy "(" "~") cy=ldtext.Replace (cy "//" "~") cy=ldtext.Replace (cy "step" "~$$") ff=ldtext.Split (cy "~") cc[x]=ldtext.Replace (cc[x] "_x_" LDText.Trim(ff[5])) cc[x]=ldtext.Replace (cc[x] "_y_" LDText.Trim(ff[6])) cc[x]=ldtext.Replace (cc[x] "_xx_" LDText.Trim(ff[7])) If Text.IsSubText (cy "$$") Then stp=ldtext.Trim (ldtext.Replace (ff[8] "$$ " "")) ds="+=" If stp<0 Then ds="-=" cc[x]=ldtext.Replace (cc[x] "<=" ">=") endif cc[x]=ldtext.Replace (cc[x] "++" ds+math.Abs(stp) ) endif 'TextWindow.WriteLine (ff) EndSub Sub carr aq=args[1] aq=LDText.Replace (aq " " "`") aq=LDText.Replace (aq "~" "`") aq=LDText.Replace (aq "." "`") aq=LDText.Replace (aq "," "`") aq=LDText.Replace (aq "(" "`") aq=LDText.Replace (aq "=" "`") aq=LDText.Replace (aq "[" "`") 'TextWindow.WriteLine (aq) EndSub Sub cupcc LDCall.Function ("carr" LDText.Trim(cc[x])) a1=ldtext.Split (aq "`") lst= ldlist.CreateFromValues(a1) LDList.Remove (lst "if" "true") LDList.Remove (lst "for" "true") LDList.Remove (lst "while" "true") ' TextWindow.WriteLine (">:"+a1) LDCall.Function ("carr" LDText.Trim(oc[x])) a11=ldtext.Split (aq "`") 'TextWindow.WriteLine (a11) For lx=1 To Array.GetItemCount(a11) lcs=Text.ConvertToLowerCase(a11[lx]) If ldlist.Contains (lst lcs) Then cc[x]=LDText.Replace (cc[x] lcs a11[lx]) EndIf EndFor endsub Sub agln'------------------------------------------- resolve goto labels For o=1 To Array.GetItemCount (ppp) vv=ldtext.Split (text.GetSubTextToEnd (ppp[o] 3) " ") If Text.StartsWith (ppp[o] ":") Then gtm[vv[1]]=o EndIf endfor 'TextWindow.WriteLine (gtm) EndSub Sub chkk err="false For oi=1 To Array.GetItemCount (ppp) ccq=ldtext.Trim (ppp[oi]) cff=Text.GetSubText (ccq 2 1) If cff="" or (cff=" " and text.GetLength(ccq)>1) then Else GraphicsWindow.ShowMessage ("Unexpected char '"+cff+"' at line: "+oi "Error!") err="true endif endfor EndSub Sub xsecc'-------------------------------------------run script--------------------------====================================== mc=0 If text.StartsWith (ppp[1] "!") Then mc=text.GetSubTextToEnd (ppp[1] 2) df=ldtext.Split (mc " ") mc=df[1] For x=2 To Array.GetItemCount (df) If df[x]="#" then dbg="true EndIf If cml[x]="" Then cml[x]=df[x] EndIf EndFor For y= 2 To Array.GetItemCount (cml) For x=1 To Array.GetItemCount (ppp) ppp[x]=LDText.Replace (ppp[x] "$r"+y cml[y]) EndFor EndFor 'TextWindow.WriteLine(cml) For x=1 To Array.GetItemCount (ppp) ppp[x]=ppp[x+1] endfor ppp[x-1]="" ppp[x]="" ' TextWindow.WriteLine (ppp) endif chkk() If err Then Goto fxx endif agln() If dbg Then TextWindow.WriteLine ("##### DEBUG mode #####") endif For mf=0 To mc If stpp Then Goto fxx endif gtc=0 T_x=500 T_y=250 cl=0 cv=0 While cl>>>>ERR>>>>"+vv) EndIf cm=text.ConvertToLowerCase (Text.GetSubText (ppp[cl] 1 1)) If cm="=" Then If Array.GetItemCount (vv)=1 then cv=cv+1 var[cv]=vv[1] If dbg then TextWindow.WriteLine ("~v"+cv+"="+vv[1]) EndIf Else If vv[2]="++" then If Array.ContainsIndex (var vv[1]) then else var[vv[1]]=vv[3] EndIf Else For tp=1 To Array.GetItemCount(vv) Step 2 var[vv[tp]]=vv[tp+1] endfor EndIf If dbg then TextWindow.WriteLine ("~"+vv[1]+"="+vv[2]) EndIf EndIf ElseIf cm="o" then LDShapes.AnimateOpacity (po vv[1] vv[2]) ElseIf cm="z" then LDShapes.AnimateZoom (po vv[1] vv[2] vv[3] vv[4]) ElseIf cm="i" then For tp=2 To Array.GetItemCount(vv) var[vv[tp]]= var[vv[tp]]+vv[1] endfor ElseIf cm="j" then aaa=ldshapes.GetAllShapes () For qq=1 to Array.GetItemCount (aaa) If Text.StartsWith(aaa[qq] "Poly") then LDShapes.RotateAbout ( aaa[qq] vv[1] vv[2] vv[3]) EndIf endfor ElseIf cm="[" then cv=cv+1 svv=vv[2] If svv="" then svv="/" endif var[cv]=LDText.Split (vv[1] svv) ElseIf cm="a" then T_Angle= T_Angle+vv[1] ldcall.Function ("TMove" vv[2]) ElseIf cm="x" then 'TextWindow.WriteLine (vv) mmp[1][1]=mmx[vv[1]] mmp[1][2]=mmy[vv[1]] mmp[2][1]=mmx[vv[2]] mmp[2][2]=mmy[vv[2]] mmp[3][1]=mmx[vv[3]] mmp[3][2]=mmy[vv[3]] mmp[4][1]=mmx[vv[4]] mmp[4][2]=mmy[vv[4]] po=ldShapes.AddPolygon (mmp) LDShapes.PenWidth (po vv[5]) LDShapes.PenColour (po vv[6]) LDShapes.BrushColour (po vv[7]) If vv[8]<>0 then LDShapes.ZIndex (po vv[8]) EndIf If vv[9]>0 then LDEffect.DropShaddow (po "") EndIf ElseIf cm="m" then T_Angle= T_Angle+vv[1] ldcall.Function ("TMovem" vv[2]) ElseIf cm="s" then GraphicsWindow.SetPixel (vv[1]+100 vv[2] vv[3]) ElseIf cm="#" then var[vv[1]]=var[vv[2]][vv[3]] ElseIf cm="e" then If dbg then TextWindow.Show () endif ew=ldmath.Evaluate (vv[2]) GraphicsWindow.Title =ew var[vv[1]]= ew ElseIf cm="y" then 'TextWindow.WriteLine (vv) qw=vv[1] If dbg then TextWindow.Write ("Ev >>"+qw+"<< ") endif If ldmath.Evaluate3 ( qw) then cl=cl+1 If dbg then TextWindow.WriteLine ("=== T") endif Goto ggg Else cl=cl+vv[2] 'TextWindow.WriteLine ("F") Goto ggg endif ElseIf cm=":" then gtm[vv[1]]=cl ElseIf cm="l" then GraphicsWindow.DrawLine (300+vv[1] vv[2] 300+vv[1]+vv[3] vv[2]+vv[4]) ElseIf cm="p" then Program.Delay (vv[1]) ElseIf cm="^" then GraphicsWindow.Title =vv[1]+":"+vv[2] ElseIf cm=">" then Stack.PushValue (vv[2] vv[1]) ElseIf cm="<" then var[vv[1]]=Stack.PopValue (vv[2]) ElseIf cm="i" then spp= (ImageList.LoadImage(vv[1])) ElseIf cm="q" then gry="#66000000 bb= LDShapes.BrushGradient (LDText.Replace ("1=gry;2=gry" "gry" gry) "DD") LDShapes.BrushRoundedRectangle (bb vv[1]+307 vv[2]+7 vv[3] vv[4] 20) If spp="" then spp=Flickr.GetRandomPicture (cml[2]) endif bb= LDShapes.BrushImage (spp) spp="" LDShapes.BrushRoundedRectangle (bb vv[1]+300 vv[2] vv[3] vv[4] 20) ElseIf cm="r" and stpp="false" then sl=sl-1 cl=nxl[sl] Goto ggg ElseIf cm="g" and stpp="false" then If vv[2]=0 or vv[2]="" then 'uncounted goto cl=gtm[vv[1]] Goto ggg elseif gtc[vv[1]]VNX260.sb< Start>VNX976.sb< ' Subtractive Color ' Copyright © 2016 Nonki Takahashi. The MIT License. GraphicsWindow.Title = "Subtractive Color" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(0, 0, gw, gh) param = "x=200;y=50;size=200;color=#00FFFF;" ' Cyan SubCircle() param = "x=150;y=137;size=200;color=#FF00FF;" ' Magenta SubCircle() param = "x=250;y=137;size=200;color=#FFFF00;" ' Yellow SubCircle() Sub SubCircle r = param["size"] / 2 cx = param["x"] + r cy = param["y"] + r subColor = param["color"] For y = Math.Round(cy - r) To Math.Round(cy + r) _x = Math.Round(Math.SquareRoot(r * r - (cy - y) * (cy - y))) x = cx - _x width = 2 * _x GetLine() SubLine() EndFor EndSub Sub GetLine ' param x, y - left end position of the line ' param width - of the line ' return seg - segment array for the line seg = "" iSeg = 0 For _x = x To x + width - 1 color = GraphicsWindow.GetPixel(_x, y) If seg[iSeg]["color"] <> color Then iSeg = iSeg + 1 seg[iSeg]["color"] = color seg[iSeg]["x"] = _x seg[iSeg]["y"] = y seg[iSeg]["width"] = 1 Else seg[iSeg]["width"] = seg[iSeg]["width"] + 1 EndIf EndFor EndSub Sub SubLine ' param seg - segment array for a line ' param subColor - color to subtract nSeg = Array.GetItemCount(seg) index = Array.GetAllIndices(seg) color2 = subColor For iSeg = 1 To nSeg color1 = seg[iSeg]["color"] Color_Sub() GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(seg[iSeg]["x"], seg[iSeg]["y"], seg[iSeg]["width"], 1) EndFor EndSub Sub Color_Sub ' param color1, color2 - for color subtraction ' return color - result color = color1 Color_RGBToValues() rgb1 = rgb color = color2 Color_RGBToValues() rgb2 = rgb For i = 1 To 3 rgb[i] = Math.Max(rgb1[i] - (255 - rgb2[i]), 0) EndFor color = GraphicsWindow.GetColorFromRGB(rgb[1], rgb[2], rgb[3]) EndSub Sub Color_RGBToValues ' param color - "#rrggbb" ' return rgb[] - 0..255 for each red, green, and blue hex = Text.GetSubText(color, 2, 2) Math_Hex2Dec() rgb[1] = dec hex = Text.GetSubText(color, 4, 2) Math_Hex2Dec() rgb[2] = dec hex = Text.GetSubText(color, 6, 2) Math_Hex2Dec() rgb[3] = dec EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param hex - hexadecimal ' return dec - decimal dec = 0 len = Text.GetLength(hex) For ptr = 1 To len dec = dec * 16 + Text.GetIndexOf("123456789ABCDEF", Text.GetSubText(hex, ptr, 1)) EndFor EndSub End>VNX976.sb< Start>VPC159.sb< Init() Wahl_Aus_Liste() Sub Wahl_Aus_Liste Draw_Height = GraphicsWindow.FontSize + 7 Draw_Width = GraphicsWindow.FontSize * 0.60 Col_Diff = 7 GraphicsWindow.PenColor = "DarkGray" GraphicsWindow.PenWidth = 2 List_Col = Array.GetItemCount(Title_Array) GraphicsWindow.FontBold = T Y = 45 X = 15 For I = 1 To List_Col Title_Width[I] = Text.GetLength(Title_Array[I])*Draw_Width GraphicsWindow.DrawBoundText(X, Y, Title_Width[I], Title_Array[I]) X = X + Col_Diff + Title_Width[I] EndFor GraphicsWindow.FontBold = F List_Row = Array.GetItemCount(Zeilen_Array) For J = 1 To List_Row Y = Y + Draw_Height X = 15 For I = 1 To List_Col GraphicsWindow.DrawBoundText(X, Y, Title_Width[I], Zeilen_Array[J][Title_Array[I]]) X = X + Col_Diff + Title_Width[I] EndFor EndFor Yh = Y Y = 40 X = 10 Yh = Yh - Y + 12 + 7 Xww = 0 For I = 1 To List_Col Xw = Title_Width[I] + Col_Diff Xww = Xww + Xw GraphicsWindow.DrawRectangle(x, y, Xw, Yh) X = X + Title_Width[I] + 7 EndFor Xww = Xww + Col_Diff + 2 X = 10 Y = 40 Yh = Y + 12 + 8 GraphicsWindow.DrawLine(X, Yh, Xww, Yh) EndSub ' Wahl_Aus_Liste Sub Init GraphicsWindow.Show() GraphicsWindow.Top = 1 GraphicsWindow.Left = 1 GraphicsWindow.Width = Desktop.Width - 10 GraphicsWindow.Height = Desktop.Height - 70 GraphicsWindow.FontName = "Consolas" GraphicsWindow.FontSize = 12 T = "True" F = "False" Title_Array[1] = "Nr. " Title_Array[2] = "Artikelnummer " Title_Array[3] = "Artikelbezeichnung " Title_Array[4] = "Mengenart " Title_Array[5] = "Bestand" Title_Array[6] = "Einkaufspreis " Title_Array[7] = "Verkaufspreis " Zeilen_Array[1][Title_Array[1]] = " 1" Zeilen_Array[1][Title_Array[2]] = " 15425547" Zeilen_Array[1][Title_Array[3]] = "Gastherme Vailant 1589001 *" Zeilen_Array[1][Title_Array[4]] = "Stück " Zeilen_Array[1][Title_Array[5]] = " 3" Zeilen_Array[1][Title_Array[6]] = " 1.878,00" Zeilen_Array[1][Title_Array[7]] = " 2.225.00" Zeilen_Array[2][Title_Array[1]] = " 2" Zeilen_Array[2][Title_Array[2]] = " 25487572" Zeilen_Array[2][Title_Array[3]] = "Gastherme Viessmann 8725464 " Zeilen_Array[2][Title_Array[4]] = "Stück " Zeilen_Array[2][Title_Array[5]] = " 5" Zeilen_Array[2][Title_Array[6]] = " 1.775,00" Zeilen_Array[2][Title_Array[7]] = " 2.189.00" Zeilen_Array[3][Title_Array[1]] = " 3" Zeilen_Array[3][Title_Array[2]] = " 41147511" Zeilen_Array[3][Title_Array[3]] = "Heizkessel Wolf 4587585 " Zeilen_Array[3][Title_Array[4]] = "Stück " Zeilen_Array[3][Title_Array[5]] = " 4" Zeilen_Array[3][Title_Array[6]] = " 2.410,00" Zeilen_Array[3][Title_Array[7]] = " 2.800.00" Zeilen_Array[4][Title_Array[1]] = " 4" Zeilen_Array[4][Title_Array[2]] = " 154254852" Zeilen_Array[4][Title_Array[3]] = "Heizkessel Viessmann 8754325 " Zeilen_Array[4][Title_Array[4]] = "Stück " Zeilen_Array[4][Title_Array[5]] = " 6" Zeilen_Array[4][Title_Array[6]] = " 2.800,45" Zeilen_Array[4][Title_Array[7]] = " 3.158.00" Zeilen_Array[5][Title_Array[1]] = " 5" Zeilen_Array[5][Title_Array[2]] = " 1245711" Zeilen_Array[5][Title_Array[3]] = "Gasabgasrohr doppelwandig 1000" Zeilen_Array[5][Title_Array[4]] = "Stück " Zeilen_Array[5][Title_Array[5]] = " 35" Zeilen_Array[5][Title_Array[6]] = " 50,45" Zeilen_Array[5][Title_Array[7]] = " 75.00" Zeilen_Array[6][Title_Array[1]] = " 6" Zeilen_Array[6][Title_Array[2]] = " 1245715" Zeilen_Array[6][Title_Array[3]] = "Gasabgasbogen doppelwandig 90 " Zeilen_Array[6][Title_Array[4]] = "Stück " Zeilen_Array[6][Title_Array[5]] = " 12" Zeilen_Array[6][Title_Array[6]] = " 35,45" Zeilen_Array[6][Title_Array[7]] = " 65.00" Zeilen_Array[7][Title_Array[1]] = " 7" Zeilen_Array[7][Title_Array[2]] = " 1245721" Zeilen_Array[7][Title_Array[3]] = "Gasabgaswandanschluss flex " Zeilen_Array[7][Title_Array[4]] = "Stück " Zeilen_Array[7][Title_Array[5]] = " 10" Zeilen_Array[7][Title_Array[6]] = " 78,45" Zeilen_Array[7][Title_Array[7]] = " 110.00" Zeilen_Array[8][Title_Array[1]] = " 8" Zeilen_Array[8][Title_Array[2]] = " 12787711" Zeilen_Array[8][Title_Array[3]] = "Abgasrohr 1000 " Zeilen_Array[8][Title_Array[4]] = "Stück " Zeilen_Array[8][Title_Array[5]] = " 14" Zeilen_Array[8][Title_Array[6]] = " 25,45" Zeilen_Array[8][Title_Array[7]] = " 34.00" Zeilen_Array[9][Title_Array[1]] = " 9" Zeilen_Array[9][Title_Array[2]] = " 12787715" Zeilen_Array[9][Title_Array[3]] = "Abgasrohr Bogen 90 " Zeilen_Array[9][Title_Array[4]] = "Stück " Zeilen_Array[9][Title_Array[5]] = " 14" Zeilen_Array[9][Title_Array[6]] = " 45,00" Zeilen_Array[9][Title_Array[7]] = " 55.00" Zeilen_Array[10][Title_Array[1]] = " 10" Zeilen_Array[10][Title_Array[2]] = " 12787720" Zeilen_Array[10][Title_Array[3]] = "Abgasrohr Wandanschluss flex " Zeilen_Array[10][Title_Array[4]] = "Stück " Zeilen_Array[10][Title_Array[5]] = " 12" Zeilen_Array[10][Title_Array[6]] = " 68,00" Zeilen_Array[10][Title_Array[7]] = " 75.00" EndSub ' Init End>VPC159.sb< Start>VPF091.sb< GraphicsWindow.Show() GraphicsWindow.Width = 800 GraphicsWindow.Height = 450 recX = Math.GetRandomNumber(400) recY = Math.GetRandomNumber(225) posX = Math.GetRandomNumber( 800 - recX ) posY = Math.GetRandomNumber( 450 - recY ) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle( posX, posY, recX, recY ) myTurX = posX - 3 myTurY = posY - 3 Turtle.Show() Turtle.PenUp() Turtle.MoveTo( myTurX , myTurY ) Turtle.PenDown() myTurX = (myTurX + recX + 6) myTurMov() myTurY = (myTurY + recY + 6) myTurMov() myTurX = (myTurX - recX - 6) myTurMov() myTurY = (myTurY - recY - 6) myTurMov() Sub myTurMov GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.MoveTo( myTurX, myTurY ) EndSub End>VPF091.sb< Start>VPF434.sb< TextWindow.Clear() TextWindow.Title="Web Codeverter" TextWindow.ForegroundColor="Black" TextWindow.BackgroundColor="Gray" TextWindow.WriteLine("Website NAME?") webpage="http://"+TextWindow.Read()+".com" content=Network.GetWebPageContents(webpage) TextWindow.Clear() TextWindow.WriteLine(content) ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory("C:\WebSource") ' The following line could be harmful and has been automatically commented. ' File.WriteLine("C:\WebSource\webcontents.txt",1,"Decoder Provided by Ardiezc Quazhulu") ' The following line could be harmful and has been automatically commented. ' File.WriteLine("C:\WebSource\webcontents.txt",2,"-----------------------------------------------------") ' The following line could be harmful and has been automatically commented. ' File.WriteLine("C:\WebSource\webcontents.txt",3,content) TextWindow.Clear() Program.End() End>VPF434.sb< Start>VPQ569.sb< l=250 graphicsWindow.PenWidth =0 qq=shapes.AddRectangle (l 5) qq1=shapes.AddRectangle (5 40) GraphicsWindow.Width=600 GraphicsWindow.Height =600 GraphicsWindow.BackgroundColor ="darkgray LDPhysics.AddFixedShape (qq 0 0) LDPhysics.AddFixedShape (qq1 0 0) 'LDPhysics.GroupShapes (qq1 qq) LDPhysics.SetGravity (0 99) While "true x=x+6/20 'Shapes.Rotate (qq x+90) LDPhysics.SetPosition (qq 300+LDMath.cos(x-90)*l/2 300+LDMath.sin(x-90)*l/2 x+90) LDPhysics.SetPosition (qq1 300+LDMath.cos(x-90)*l 300+LDMath.sin(x-90)*l x+90) LDPhysics.DoTimestep () Program.Delay (2) If Math.Remainder (x 3)=0 And cc<250 Then If ds then else ds="true GraphicsWindow.BrushColor=LDColours.HSLtoRGB (cc,1,.5) ee=shapes.AddEllipse (16 16) cc=cc+1 GraphicsWindow.Title =cc LDPhysics.AddMovingShape (ee 0 0 1) LDPhysics.SetBullet (ee) LDPhysics.SetPosition (ee 300 10 0) EndIf Else ds="false endif EndWhile End>VPQ569.sb< Start>VPS391.sb< LF = Text.GetCharacter(10) numberOfShapesToDraw = 6 shapeType = "1=circle;2=square;3=triangle" myShape[1] = "rectangle" 'pre selected 'RANDOMLY SELECT FROM shapeType For i = 2 To numberOfShapesToDraw myShape[i] = shapeType[Math.GetRandomNumber(Array.GetItemCount(shapeType))] EndFor TextWindow.WriteLine("Random Shapes: " + myShape + LF) 'RANDOMLY RE-ORDER ALL THESE SHAPES For j = 1 To numberOfShapesToDraw rand = Math.GetRandomNumber(Array.GetItemCount(myShape)) 'CREATE A randomOrder OF THE RANDOM SHAPES(myShape) randomOrder[j] = myShape[rand] 'DELETE THIS ONE FROM myShape myShape[rand] = "" 'GET myShape INTO A NEW ARRAY (getAll) - THIS EXCLUDES THE DELETED INDEX getAll = Array.GetAllIndices(myShape) 'SWAP myShape WITH temp WHICH REINDEXES myShape WITHOUT THE DELETED VALUE For i = 1 To Array.GetItemCount(getAll) temp[i] = myShape[getAll[i]] EndFor myShape = temp temp = "" EndFor myShape = randomOrder 'NOW myShape IS RANDOMLY RE-ORDERED TextWindow.WriteLine("Randomly Re-ordered Random Shapes: " + myShape + LF) TextWindow.Pause() '=========================================================== 'ADD & POSITION ON THE GRAPICSWINDOW '=========================================================== shapeWidth = 40 For i = 1 To numberOfShapesToDraw If myShape[i] = "rectangle" Then AddRectangle() ElseIf myShape[i] = "circle" Then AddCircle() ElseIf myShape[i] = "square" Then AddSquare() ElseIf myShape[i] = "triangle" Then AddTriangle() EndIf If i = 1 Then X = 10 'space Else X = Shapes.GetLeft(shp[i-1]) + shapeWidth + 10 EndIf Y = 15 Shapes.Move(shp[i], X, Y) EndFor Sub AddTriangle shp[i] = Shapes.AddTriangle(0, 0, shapeWidth/2, shapeWidth, shapeWidth, 0) EndSub Sub AddSquare shp[i] = Shapes.AddRectangle(shapeWidth, shapeWidth) EndSub Sub AddCircle shp[i] = Shapes.AddEllipse(shapeWidth, shapeWidth) EndSub Sub AddRectangle shp[i] = Shapes.AddRectangle(shapeWidth, shapeWidth * 0.8) EndSub End>VPS391.sb< Start>VPT605-0.sb< init() GraphicsWindow.KeyDown=Move_nyan2 t0= Clock.ElapsedMilliseconds While "true" x = x + delX y = y + delY If x <= -10 Then x = 510 elseIf x >= 510 Then x = 0 elseIf y >= 410 Then y = 0 elseIf y <= -10 Then y = 410 endif if math.Abs(x-Shapes.GetLeft(food))<=5 and Math.Abs(y- Shapes.Gettop(food))<=5 then score = score + 1 ' If (x_position - food_left)<=±5 and (y_position - food_top)<=±5 then score up Shapes.SetText(sscore,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) endif If score>0 and Math.Remainder(score, 5) = 0 then ' bonus appears every 5 counts If flag=0 then ' if bonus does not exist , add bonus at random position GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bonus = Shapes.AddEllipse(20, 20) Shapes.Move(bonus, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) flag=1 ' if bonus appeared endif endif if math.Abs(x-Shapes.GetLeft(bonus))<=5 and Math.Abs(Y-Shapes.Gettop(bonus))<=5 then score = score + 3 ' If (x_position - bonus_left)<=±5 and (y_position - bonus_top)<=±5 then score up Shapes.SetText(sscore,score) Shapes.Remove(bonus) ' if you get bonus , remove bonus flag=0 ' if you get bonus , endif Shapes.move(Nyan[1], x, y) ' shapes.animate is not suitable Shapes.move(Nyan[2], x, y) Program.Delay(100) pasttime=Math.Round((clock.ElapsedMilliseconds-t0)/1000)+"sec" Shapes.SetText(stime,pasttime) endwhile Sub Move_nyan2 d=GraphicsWindow.LastKey a=text.GetCharacterCode(d) If a=76 or a=82 Then ' Left;76 Right ;82 LeftRight() elseIf a=68 or a=85 Then ' Down: 68 Up: 85 downUp() elseif d = "F" then score = 5 Shapes.SetText(sscore,score) endif EndSub Sub LeftRight b=(a-76)/6+1 ' left (76-76)/6+1=1 (82-76)/6+1=2 Shapes.HideShape(nyan[3-b]) ' left --> 3-1=2:right right--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b], 0) delX = 20*(b-1.5) ' left 20*(1-1.5)=-10 right 20*(2-1.5)=+10 delY = 0 EndSub Sub DownUp b=(a-68)/17+1 ' down (68-68)/17+1=1 Up (85-68)/17+1=2 Shapes.HideShape(nyan[3-b]) ' down--> 3-1=2:Up Up--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b],270) delX = 0 delY = 20*(1.5-b) ' down 20*(1.5-1)=+10 Up 20*(1.5-2)=-10 EndSub Sub init GraphicsWindow.Height = 390 GraphicsWindow.Width = 490 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.CanResize = 0 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Cyan" Shapes.AddRectangle(500, 400) GraphicsWindow.PenColor = "Green" Nyan[1] = Shapes.AddImage("http://ximages.net/images/28930020147868715423.png") ' left Nyan[2] = Shapes.AddImage("http://ximages.net/images/74412177564379571315.png") ' right GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize=15 sscore= Shapes.AddText("0") Shapes.Move(sscore,300, 20) food = Shapes.AddImage("http://ximages.net/images/03515726579119112960.png") Shapes.Move(food, Math.GetRandomNumber(30) * 10, Math.GetRandomNumber(40) * 10) GraphicsWindow.DrawBoundText(0, 0, 80, "0000000") ' what is this ????? Food counter?? 'maybe Flag=0 ' for start bonus=0 rot = 0 score = 0 x = 300 ' start X y = 200 ' start Y Shapes.Move(Nyan[1], x, y) Shapes.Rotate(Nyan[1], rot) delX = 0 ' initial moving X delY = 10 ' initial moving Y GraphicsWindow.BrushColor="red" stime=Shapes.AddText(" ") Shapes.Move(stime,15,5) ' past time endsub End>VPT605-0.sb< Start>VPT605.sb< GraphicsWindow.Height = 390 GraphicsWindow.Width = 490 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.CanResize = 0 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Cyan" Shapes.AddRectangle(500, 400) GraphicsWindow.PenColor = "Green" Nyan1 = Shapes.AddImage("http://ximages.net/images/28930020147868715423.png") ' left Nyan2 = Shapes.AddImage("http://ximages.net/images/74412177564379571315.png") ' right rot = 0 score = 0 x = 300 y = 200 Shapes.Move(Nyan1, x, y) Shapes.Rotate(Nyan1, rot) delX = 0 delY = 10 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize=15 sscore= Shapes.AddText("0") Shapes.Move(sscore,300, 20) food = Shapes.AddImage("http://ximages.net/images/03515726579119112960.png") Shapes.Move(food, Math.GetRandomNumber(30) * 10, Math.GetRandomNumber(40) * 10) GraphicsWindow.DrawBoundText(0, 0, 80, "0000000") ' what is this ????? Food counter?? 'maybe Loop: x = x + delX y = y + delY ax = x + 10 ay = y + 10 if GraphicsWindow.LastKey = "Left" then Shapes.HideShape(nyan2) Shapes.ShowShape(nyan1) Shapes.Rotate(Nyan1, 0) delX = -10 delY = 0 Tx = x + 10 Ty = y endif if GraphicsWindow.LastKey = "Right" then Shapes.HideShape(nyan1) Shapes.ShowShape(nyan2) Shapes.Rotate(Nyan2, 0) delX = 10 delY = 0 Tx = x - 10 Ty = y endif if GraphicsWindow.LastKey = "Down" then Shapes.HideShape(nyan2) Shapes.ShowShape(nyan1) Shapes.Rotate(Nyan1, 270) delX = 0 delY = 10 Tx = x Ty = y - 10 endif if GraphicsWindow.LastKey = "Up" then Shapes.HideShape(nyan1) Shapes.ShowShape(nyan2) Shapes.Rotate(Nyan2, 270) delX = 0 delY = -10 Tx = x Ty = y + 10 endif If x = -10 Then x = 490 endif If x = 510 Then x = 10 endif If y = 410 Then y = 10 endif If y = -10 Then y = 390 endif if GraphicsWindow.LastKey = "F" then score = 5 Shapes.SetText(sscore,score) endif if ax = Shapes.GetLeft(food)+10 and ay = Shapes.Gettop(food)+10 then score = score + 1 Shapes.SetText(sscore,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) endif if ax = Shapes.GetLeft(food) and ay = Shapes.Gettop(food) then score = score + 1 Shapes.SetText(sscore,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) endif if ax = Shapes.GetLeft(food)-10 and ay = Shapes.Gettop(food)-10 then score = score + 1 Shapes.SetText(sscore,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) endif If Math.Remainder(score, 5) = 0 then If score > 0 then GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bonus = Shapes.AddEllipse(20, 20) Shapes.Move(bonus, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) endif endif if ax = Shapes.GetLeft(bonus)+10 and ay = Shapes.Gettop(bonus)+10 then score = score + 3 Shapes.SetText(sscore,score) Shapes.Remove(bonus) endif if ax = Shapes.GetLeft(bonus) and ay = Shapes.Gettop(bonus) then score = score + 3 Shapes.SetText(sscore,score) Shapes.Remove(bonus) endif if ax = Shapes.GetLeft(bonus)-10 and ay = Shapes.Gettop(bonus)-10 then score = score + 3 Shapes.SetText(sscore,score) Shapes.Remove(bonus) endif Shapes.Animate(Nyan1, x, y, 100) Shapes.Animate(Nyan2, x, y, 100) Program.Delay(100) Goto Loop End>VPT605.sb< Start>VPV978.sb< GameWindow.ReplaceGraphicsWindow() GameWindow.Title = "Media Player" GameWindow.CanResize = "False" open_btn = GameControls2D.AddButton("Open", 5, GameWindow.Height - 35, 80, 30) GameControls2D.RegisterMouseDownEvent(open_btn, "open") play_btn = GameControls2D.AddButton("Play", 90, GameWindow.Height - 35, 80, 30) GameControls2D.RegisterMouseDownEvent(play_btn, "play") pause_btn = GameControls2D.AddButton("Pause", 175, GameWindow.Height - 35, 80, 30) GameControls2D.RegisterMouseDownEvent(pause_btn, "pause") stop_btn = GameControls2D.AddButton("Stop", 260, GameWindow.Height - 35, 80, 30) GameControls2D.RegisterMouseDownEvent(stop_btn, "stop") Sub open openfile2 = Dialogs.AskForFile("") If openfile2 <> "" Then openfile = openfile2 openmedia() EndIf EndSub Sub openmedia GameControls2D.Remove(mediaplayer) GameWindow.Title = "Media Player - " + FilePlus.GetFileName(openfile) + FilePlus.GetFileExtension(openfile) mediaplayer = Media.CreateMediaPlayer(openfile, 0, 0, GameWindow.Width, GameWindow.Height - 40) EndSub Sub play Media.Resume(mediaplayer) EndSub Sub pause Media.Pause(mediaplayer) EndSub Sub stop Media.Stop(mediaplayer) EndSub End>VPV978.sb< Start>VPW885.sb< ' Metronome for Sound.PlayMusic() ' Copyright (c) 2014 Nonki Takahashi. All rights reserved. ' GraphicsWindow.Title = "Metronome for Sound.PlayMusic()" GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(10, 14, "Tempo") oTempo = Controls.AddTextBox(60, 10) c4 = 0 tempo = 150 ' [quarter note/min] Controls.SetTextBoxText(oTempo, tempo) param = "x=10;y=40;" Controls_AddLamp() oLamp = retval Controls.TextTyped = OnTextTyped msec = 60000 / tempo / 2 Timer.Interval = msec Timer.Tick = OnTick While "True" Sound.PlayMusic("O4CDEFGFED") EndWhile Sub OnTextTyped tempo = Controls.GetTextBoxText(oTempo) Timer.Interval = 60000 / tempo / 2 EndSub Sub OnTick Stack.PushValue("param", param) param = "lamp=" + oLamp + ";" Controls_LampToggle() param = Stack.PopValue("param") EndSub Sub Controls_AddLamp ' Controls | Add Lamp ' param["x"], param["y"] - position of lamp ' return retval - lamp id savedColor = GraphicsWindow.BrushColor savedPen = GraphicsWindow.PenWidth GraphicsWindow.PenWidth = 0 nLamp = lamp["num"] + 1 lamp["num"] = nLamp x = param["x"] y = param["y"] GraphicsWindow.BrushColor = "White" lamp[nLamp]["rw"] = Shapes.AddRectangle(21, 7) Shapes.Move(lamp[nLamp]["rw"], x + 3, y + 3) GraphicsWindow.BrushColor = "DimGray" lamp[nLamp]["rg"] = Shapes.AddRectangle(21, 7) Shapes.Move(lamp[nLamp]["rg"], x, y) GraphicsWindow.BrushColor = "#330000" lamp[nLamp]["rk"] = Shapes.AddRectangle(20, 6) Shapes.Move(lamp[nLamp]["rk"], x + 2, y + 2) GraphicsWindow.BrushColor = "Red" lamp[nLamp]["rr"] = Shapes.AddRectangle(20, 6) Shapes.Move(lamp[nLamp]["rr"], x + 2, y + 2) Shapes.HideShape(lamp[nLamp]["rr"]) lamp[nLamp]["on"] = "False" retval = "Lamp" + nLamp GraphicsWindow.PenWidth = savedPen GraphicsWindow.BrushColor = savedColor EndSub Sub Controls_LampOn ' Controls | Lamp On ' param["lamp"] - the lamp id to be on Sound.PlayClick() iLamp = Text.GetSubTextToEnd(param["lamp"], 5) Shapes.ShowShape(lamp[iLamp]["rr"]) lamp[iLamp]["on"] = "True" EndSub Sub Controls_LampOff ' Controls | Lamp Off iLamp = Text.GetSubTextToEnd(param["lamp"], 5) Shapes.HideShape(lamp[iLamp]["rr"]) lamp[iLamp]["on"] = "False" EndSub Sub Controls_LampToggle ' Controls | Lamp Toggle ' param["lamp"] - the lamp id to be toggled iLamp = Text.GetSubTextToEnd(param["lamp"], 5) If lamp[iLamp]["on"] Then Controls_LampOff() Else Controls_LampOn() EndIf EndSub End>VPW885.sb< Start>VQC005.sb< GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width =1200 GraphicsWindow.Height =800 GraphicsWindow.Left =10 GraphicsWindow .top=1 GraphicsWindow.Title ="Domino args=0 GraphicsWindow.PenWidth=0 LDEvents.MouseWheel=mww GraphicsWindow.KeyDown =mdd zz=1 a225=22.5 f30=30 For x=1 to 60 LDCall.Function5("ddom" 480 80-x*f30 x Math.Remainder (x+1 6) "v") rotall() f30=f30*.996 'LDCall.Function5("ddom" 50, -50+x*120 x Math.Remainder (x+1 6) "v") endfor Sub rotall ss= LDShapes.GetAllShapes () For r=1 To Array.GetItemCount (ss) an[r]=an[r]+a225 LDShapes.RotateAbout (ss[r] 600 400 an[r]-a225) EndFor a225=a225*.97 EndSub sub ddom px=args[1] py=args[2] n1=args[3] n2=args[4] dt=args[5] If dt="h" then LDCall.Function4 ("ddrw" px py n1 "h") LDCall.Function4 ("ddrw" px+52 py n2 "h") Else LDCall.Function4 ("ddrw" px py n1 "v") LDCall.Function4 ("ddrw" px py+52 n2 "v") EndIf EndSub Sub ddrw lx=args[1] ty=args[2] nn=args[3] tt=args[4] GraphicsWindow.BrushColor="#0000aa rr=shapes.addRectangle ( 50 50) Shapes.Move (rr lx+4 ty+4) LDEffect.DropShaddow (rr "") GraphicsWindow.BrushColor="lightcyan If nn=1 Or nn=3 Or nn=5 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+25 ty+25) EndIf If tt="v" then '------------------------vertical pieces If nn>=2 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+40 ty+10) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+10 ty+40) EndIf If nn>=4 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+10 ty+10) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+40 ty+40) EndIf If nn=6 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+10 ty+25) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+40 ty+25) EndIf Else '---------------------------------horizontal pieces If nn=6 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+25 ty+10) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+25 ty+40) EndIf If nn>=4 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+40 ty+10) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+10 ty+40) EndIf If nn>=2 Then ee=shapes.AddEllipse (8 8) shapes.move(ee lx+10 ty+10) ee=shapes.AddEllipse (8 8) shapes.move(ee lx+40 ty+40) EndIf EndIf EndSub Sub mdd ll= GraphicsWindow.LastKey If ll="Left" Then px=px-50 ElseIf ll="Right" then px=px+50 ElseIf ll="Up" then py=py-50 ElseIf ll="Down" then py=py+50 endif LDGraphicsWindow.Animate (zz zz px py aa 500) EndSub Sub mww If Mouse.IsRightButtonDown Then aa=aa+ldevents.LastMouseWheelDelta*3 Else zz=zz+ LDEvents.LastMouseWheelDelta/50 endif LDGraphicsWindow.Reposition (zz zz px py aa) EndSub End>VQC005.sb< Start>VQF008.sb< ' 11/29/2015 Akiva Toronto, Canada rm = "" ' for Small Basic 1.0 and 1.2 rem = "" anm = 0 ang = 0 opc = 0 zm = 0 P = 0 g = "" a = "" b = "" c = "" d = "" w1 = "" h1 = "" Turtle.X = 500 Turtle.Y = 400 mn = Clock.Minute ch = Clock.Hour OnComboBoxItemChangedPr() OnComboBoxItemChanged() GraphicsWindow.Show() GraphicsWindow.Title = "To help learners Small Basic(В помощь изучающим Small Basic) Akiva Toronto 22/XI/2015 " GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(0,100,255) GW = 1450 GH = 880 GraphicsWindow.Width = GW GraphicsWindow.Height = GH GraphicsWindow.Top = 100 GraphicsWindow.Left = 300 GraphicsWindow.CanResize = "True" GraphicsWindow.BrushColor = "DarkGreen" GraphicsWindow.FontSize = 16 t1 = Controls.AddTextBox(277,835) Controls.SetSize(t1,80,30) LDDialogs.ToolTip(t1,"t1 for Gradient the form(Enter: H or V or DD or DU") t2 = Controls.AddTextBox(359,835) Controls.SetSize(t2,80,30) LDDialogs.ToolTip(t2,"t2 ") t3 = Controls.AddTextBox(441,835) Controls.SetSize(t3,80,30) LDDialogs.ToolTip(t3,"t3 ") t4 = Controls.AddTextBox(523,835) Controls.SetSize(t4,80,30) LDDialogs.ToolTip(t4,"t4 ") t5 = Controls.AddTextBox(605,835) Controls.SetSize(t5,80,30) LDDialogs.ToolTip(t5,"t5 ") t6 = Controls.AddTextBox(687,835) Controls.SetSize(t6,80,30) LDDialogs.ToolTip(t6,"t6 ") t11 = Controls.AddTextBox(1145,575) Controls.SetSize(t11,80,25) LDDialogs.ToolTip(t11,"t11( X = ?") t12 = Controls.AddTextBox(1227,575) Controls.SetSize(t12,80,25) LDDialogs.ToolTip(t12,"t12( Y = ?") t13 = Controls.AddTextBox(30,835) Controls.SetSize(t13,245,30) LDDialogs.ToolTip(t13,"t13 ") GraphicsWindow.FontSize = 16 t14 = Controls.AddTextBox(1145,602) Controls.SetSize(t14,80,25) t15 = Controls.AddTextBox(1227,602) Controls.SetSize(t15,80,25) t18 = Controls.AddTextBox(1145,629) Controls.SetSize(t18,80,25) t19 = Controls.AddTextBox(1227,629) Controls.SetSize(t19,80,25) t20 = Controls.AddTextBox(1145,656) Controls.SetSize(t20,80,25) t21 = Controls.AddTextBox(1227,656) Controls.SetSize(t21,80,25) t22 = Controls.AddTextBox(1145,683) Controls.SetSize(t22,80,25) t23 = Controls.AddTextBox(1227,683) Controls.SetSize(t23,80,25) t24 = Controls.AddTextBox(1145,710) Controls.SetSize(t24,80,25) t25 = Controls.AddTextBox(1227,710) Controls.SetSize(t25,80,25) t26 = Controls.AddTextBox(1145,737) Controls.SetSize(t26,80,25) t27 = Controls.AddTextBox(1227,737) Controls.SetSize(t27,80,25) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "DarkGreen" t17 = LDControls.AddRichTextBox(445,500) Controls.Move(t17,1000,27) LDDialogs.ToolTip(t17,"t17()Корректируем, копируем и выводим в редактор SB") GraphicsWindow.FontSize = 16 GraphicsWindow.BrushColor = "Red" ts1 = Controls.AddTextBox(455,765) Controls.SetSize(ts1,45,30) GraphicsWindow.BrushColor = "Green" ts2 = Controls.AddTextBox(655,765) Controls.SetSize(ts2,45,30) GraphicsWindow.BrushColor = "Blue" ts3 = Controls.AddTextBox(855,765) GraphicsWindow.BrushColor = "DarkGreen" Controls.SetSize(ts3,45,30) ts4 = Controls.AddTextBox(1055,765) Controls.SetSize(ts4,45,30) ts5 = Controls.AddTextBox(30,800) Controls.SetSize(ts5,45,30) ts6 = Controls.AddTextBox(235,800) Controls.SetSize(ts6,45,30) ts7 = Controls.AddTextBox(435,800) Controls.SetSize(ts7,45,30) ts8 = Controls.AddTextBox(633,800) Controls.SetSize(ts8,45,30) ts9 = Controls.AddTextBox(835,800) Controls.SetSize(ts9,45,30) ts10 = Controls.AddTextBox(1037,800) Controls.SetSize(ts10,45,30) ts12 = Controls.AddTextBox(1255,765) Controls.SetSize(ts12,45,30) ts11 = Controls.AddTextBox(1235,800) Controls.SetSize(ts11,45,30) ts13 = Controls.AddTextBox(812,835) Controls.SetSize(ts13,45,30) ts14 = Controls.AddTextBox(1014,835) Controls.SetSize(ts14,45,30) ts15 = Controls.AddTextBox(1212,835) Controls.SetSize(ts15,45,30) GraphicsWindow.BrushColor = "DarkGreen" b1 = Controls.AddButton("Turtle",30 ,765) Controls.SetSize(b1,80,28) b2 = Controls.AddButton("Frickr",112 ,765) Controls.SetSize(b2,80,28) b3 = Controls.AddButton("Clear ",194 ,765) Controls.SetSize(b3,80,28) b4 = Controls.AddButton("Gradient",276 ,765) Controls.SetSize(b4,80,28) LDDialogs.ToolTip(b4,"Gradient Window") b5 = Controls.AddButton("Result ",357,765) Controls.SetSize(b5,80,28) b6 = Controls.AddButton("Clear code?!",1146,540) Controls.SetSize(b6,160,32) LDDialogs.ToolTip(b6,"Очистить?!") sl1 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl1, 500, 765) LDControls.SliderValue(sl1, 0) sl2 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl2, 700, 765) LDControls.SliderValue(sl2, 0) sl3 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl3, 900, 765) LDControls.SliderValue(sl3, 0) sl4 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl4, 1100, 765) LDControls.SliderValue(sl4, 0) sl5 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl5, 76, 800) LDControls.SliderValue(sl5, 0) sl6 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl6, 280, 800) LDControls.SliderValue(sl6, 0) sl7 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl7, 481, 800) LDControls.SliderValue(sl7, 0) sl8 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl8, 679, 800) LDControls.SliderValue(sl8, 0) sl9 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl9, 880, 800) LDControls.SliderValue(sl9, 0) sl10 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl10, 1082, 800) LDControls.SliderValue(sl10, 0) sl11 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl11, 1280, 800) LDControls.SliderValue(sl11, 0) sl12 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl12, 1300, 765) LDControls.SliderValue(sl12, 0) sl13 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl13, 857, 835) LDControls.SliderValue(sl13, 0) sl14 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl14, 1059, 835) LDControls.SliderValue(sl14, 0) sl15 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl15, 1256, 835) LDControls.SliderValue(sl14, 0) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(255,255,255) GraphicsWindow.FontSize = 14 cr3[1] = LDControls.AddRadioButton("Animate","c3") LDDialogs.ToolTip(cr3[1],"Анимация") cr3[2] = LDControls.AddRadioButton("Rotate","c3") LDDialogs.ToolTip(cr3[2],"Вращение") cr3[3] = LDControls.AddRadioButton("Opacity","c3") LDDialogs.ToolTip(cr3[3],"Непрозрачность") cr3[4] = LDControls.AddRadioButton("Zoom","c3") LDDialogs.ToolTip(cr3[4],"Маштабность") cr3[5] = LDControls.AddRadioButton("Grid","c3") LDDialogs.ToolTip(cr3[5],"Сетка") cr3[6] = LDControls.AddRadioButton("Remove","c3") LDDialogs.ToolTip(cr3[6],"Очистить") cr3[7] = LDControls.AddRadioButton("*","c3") LDDialogs.ToolTip(cr3[7],"*") cr3[8] = LDControls.AddRadioButton("*","c3") LDDialogs.ToolTip(cr3[8],"*") cr3[9] = LDControls.AddRadioButton("*","c3") LDDialogs.ToolTip(cr3[9],"*") cr3[10] = LDControls.AddRadioButton("*","c3") LDDialogs.ToolTip(cr3[10],"*") cr3[11] = LDControls.AddRadioButton("Off","c3") LDDialogs.ToolTip(cr3[11],"*") For i = 1 To 11 Shapes.Move(cr3[i],1000, 20 + (21 * (i)) + 490) EndFor LDControls.RadioButtonSet(cr3[11]) cr4[1] = LDControls.AddRadioButton("Flickr","c4") LDDialogs.ToolTip(cr4[1],"Обзор красот") cr4[2] = LDControls.AddRadioButton("Turtle.Up","c4") LDDialogs.ToolTip(cr4[2],"Поднять лапку") cr4[3] = LDControls.AddRadioButton("Turtle.Down","c4") LDDialogs.ToolTip(cr4[3],"Опустить лапку") cr4[4] = LDControls.AddRadioButton("Turtle.Show","c4") LDDialogs.ToolTip(cr4[4],"Показать черепашку") cr4[5] = LDControls.AddRadioButton("turtle.Angle","c4") LDDialogs.ToolTip(cr4[5],"Черепашка под углом") cr4[6] = LDControls.AddRadioButton("","c4") LDDialogs.ToolTip(cr4[6],"*") cr4[7] = LDControls.AddRadioButton("","c4") LDDialogs.ToolTip(cr4[7],"*") cr4[8] = LDControls.AddRadioButton("","c4") LDDialogs.ToolTip(cr4[8],"*") cr4[9] = LDControls.AddRadioButton("","c4") LDDialogs.ToolTip(cr4[9],"*") cr4[10] = LDControls.AddRadioButton("","c4") LDDialogs.ToolTip(cr4[10],"*") cr4[11] = LDControls.AddRadioButton("off","c4") LDDialogs.ToolTip(cr4[11],"*") For i = 1 To 11 Shapes.Move(cr4[i],1340, 20 + (21 * (i)) + 490) EndFor LDControls.RadioButtonSet(cr4[11]) GraphicsWindow.BrushColor = "DarkGreen" GraphicsWindow.FontSize = 14 cb1[42] = "Templates, Controls, Help" cb1[1] = "GraphicsWindow()" cb1[2] = "TextWindow()" cb1[3] = "Sub Click()" cb1[4] = "Sub ArrayButton()" cb1[5] = "Sub ArrayTexBox()" cb1[6] = "Sub Array()" cb1[7] = "Sub Down() " cb1[8] = "GradientBackground for figures()" cb1[9] = "GradientBackground()" cb1[10] = "If..EndIf()" cb1[11] = "For..EndFor()" cb1[12] = "While..EndWhile()" cb1[13] = "GraphicsWindow.DrawTriangle(X1,Y1,X2,Y2,X3,Y3),,," cb1[14] = "GraphicsWindow.FillTriangle(X1,Y1,X2,Y2,X3,Y3),," cb1[15] = "LDFillPolygon: ,, " cb1[16] = "Graphics.DrawRectangle: ,,,," cb1[17] = "Graphics.FillRectangle: ,,," cb1[18] = "Graphics.DrawEllipse: ,,,," cb1[19] = "Graphics.FillEllipse: ,,," cb1[20] = "GraphicsWindow.DrawLine: ,," cb1[21] = "LDControls.Star: ,,,,, " cb1[22] = "LDRegularPolygon: ,,,, " cb1[23] = "Shapes.AddText: ,,," cb1[24] = "Shapes.AddEllipse: ,,,," cb1[25] = "Shapes.AddRectangle: ,,,," cb1[26] = "Shapes.AddImage:," cb1[27] = "*" cb1[28] = "*" cb1[29] = "*" cb1[30] = "*" cb1[31] = "Controls.AddButton: ,,,,," cb1[32] = "Controls.AddTextBox: ,,,, " cb1[33] = "Controls.AddMultiLineTextBox: ,,,," cb1[34] = "GraphicsWindow.DrawBoundText: ,,," cb1[35] = "GraphicsWindow.ShowMessage: , " cb1[36] = "*" cb1[37] = "LDControls.AddRadioButton: ," cb1[38] = "LDControls.AddSlider: ,,," cb1[39] = "FCControls.AddCheckBox: ," cb1[40] = "LDControls.AddProgressBar: ,,,," cb1[41] = "LDControls.AddBrowser: ,,, " cb1[42] = "LDControls.AddListBox: ,,, " cb1[43] = "LDControls.AddComboBox: ,,, " cb1[44] = "LDChart.AddChart: ,, " cb1[45] = "LDScrollBars.Add: , " cb1[46] = "Turtle programe: ,,,,," cb1[47] = "*" cb1[48] = "ColorLine: ,,,,<(P)PenWidth =?>" cb1[49] = "Triangles: <(P)PenWidth =?>," comboBox1 = LDControls.AddComboBox(cb1,445,500) Shapes.Move(comboBox1,1000,2) LDControls.ComboBoxItemChanged = OnComboBoxItemChangedPr Sub OnComboBoxItemChangedPr If cb1[LDControls.LastComboBoxIndex] = cb1[1] Then 'GraphicsWindow LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Title = "+Controls.GetTextBoxText(t13)+"","true") LDControls.RichTextBoxSetText(t17,"cw = GraphicsWindow.GetColorFromRGB("+R+","+G+","+B+")","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.BackgroundColor = cw","true") LDControls.RichTextBoxSetText(t17,"GW = "+w+"","True") LDControls.RichTextBoxSetText(t17,"GH = "+h+"","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Width = GW","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Height = GH","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Top = "+Y1+"","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Left = "+X1+"","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.CanResize = 'True'","true") txt = Controls.GetTextBoxText(t13) GraphicsWindow.Title = txt GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillRectangle(X1,Y1,w,h) aa = 0 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[2] Then 'TextWindow TextWindow.Title = Controls.GetTextBoxText(Controls.GetTextBoxText(t13)) TextWindow.Left = lf TextWindow.Top = tp TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Blue" TextWindow.Clear() TextWindow.WriteLine(" Напряжение = ?[v]") U = TextWindow.ReadNumber() TextWindow.WriteLine(" Сопротивление = ?[hom]") R = TextWindow.ReadNumber() I = U / R TextWindow.WriteLine(" I = V / R = ?[mA]") TextWindow.WriteLine(" I(mA)= "+ I) LDControls.RichTextBoxSetText(t17,"TextWindow.Title = "+Controls.GetTextBoxText(t13)+"","true") LDControls.RichTextBoxSetText(t17,"TextWindow.rTop = "+tp+"","true") LDControls.RichTextBoxSetText(t17,"TextWindow.Left = "+lf+"","true") LDControls.RichTextBoxSetText(t17,"TextWindow.BackgroundColor = 'White'","true") LDControls.RichTextBoxSetText(t17,"TextWindow.Clear() ","true") LDControls.RichTextBoxSetText(t17,"TextWindow.ForegroundColor = 'Blue' ","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[3] Then 'SubClick() LDControls.RichTextBoxSetText(t17,"If (Controls.LastClickedButton = b1[1]) Then","true") LDControls.RichTextBoxSetText(t17," ","true") LDControls.RichTextBoxSetText(t17,"EndIf","true") LDControls.RichTextBoxSetText(t17,"EndSub","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[4] Then 'SubArrayButton() LDControls.RichTextBoxSetText(t17,"btn[1] = 'Bockground'","true") LDControls.RichTextBoxSetText(t17,"btn[2] = 'Grid'","true") LDControls.RichTextBoxSetText(t17,"btn[3] = 'ResetInfo'","true") LDControls.RichTextBoxSetText(t17,"nButton = Array.GetItemCount(btn)","true") LDControls.RichTextBoxSetText(t17,"For i = 1 To nButton","true") LDControls.RichTextBoxSetText(t17,"b1[i] = Controls.AddButton(btn[i],X1,((H+1)*(i))-Y1)","True") LDControls.RichTextBoxSetText(t17,"Controls.SetSize(b1[i],W,H)","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[5] Then 'SubArrayTexBox() LDControls.RichTextBoxSetText(t17,"w = 120","true") LDControls.RichTextBoxSetText(t17,"h = 25","true") LDControls.RichTextBoxSetText(t17,"For i = 1 To 3","true") LDControls.RichTextBoxSetText(t17,"t1[i] = Controls.AddTextBox(X1,(h+2)*(i)+Y1-(h+2))","true") LDControls.RichTextBoxSetText(t17,"Controls.SetSize(t1[i],w,h)","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[6] Then 'Sub Array() LDControls.RichTextBoxSetText(t17,"t[1] = 'Ellipse' ","true") LDControls.RichTextBoxSetText(t17,"t[2] = 'Rectangle'","true") LDControls.RichTextBoxSetText(t17,"t[3] = 'Star'","true") LDControls.RichTextBoxSetText(t17,"n = Array.GetItemCount(t)","true") LDControls.RichTextBoxSetText(t17,"For i = 1 To n","true") LDControls.RichTextBoxSetText(t17,"f = Shapes.AddText(t[i])","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(f,"+X1+","+Y1+"*(i)-20)","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[7] Then 'Sub Down() LDControls.RichTextBoxSetText(t17,"Sub Down5 ","true") LDControls.RichTextBoxSetText(t17,"x = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"y = Graphicswindow.MouseY ","true") LDControls.RichTextBoxSetText(t17,"aa = aa + 1","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.BrushColor = 'Black'","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.FillRectangle(x, y, 2, 2)","true") LDControls.RichTextBoxSetText(t17,"If aa = 1 Then","true") LDControls.RichTextBoxSetText(t17,"X1 = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"Y1 = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"plg[0][ X ] = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"plg[0][ Y ] = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"ElseIf aa = 2 Then","true") LDControls.RichTextBoxSetText(t17,"X2 = Graphicswindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"Y2 = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"plg[1][ X ] = GraphicsWindow.MouseX ","true") LDControls.RichTextBoxSetText(t17,"plg[1][ Y ] = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"ElseIf aa = 3 Then","true") LDControls.RichTextBoxSetText(t17,"X3 = Graphicswindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"Y3 = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"plg[2][ X ] = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"plg[2][ Y ] = Graphicswindow.MouseY ","true") LDControls.RichTextBoxSetText(t17,"ElseIf aa = 4 Then","true") LDControls.RichTextBoxSetText(t17,"X4 = Graphicswindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"Y4 = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"plg[3][ X ] = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"plg[3][ Y ] = Graphicswindow.MouseY ","true") LDControls.RichTextBoxSetText(t17,"ElseIf aa = 5 Then","true") LDControls.RichTextBoxSetText(t17,"X5 = Graphicswindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"Y5 = Graphicswindow.MouseY","true") LDControls.RichTextBoxSetText(t17,"plg[4][ X ] = GraphicsWindow.MouseX","true") LDControls.RichTextBoxSetText(t17,"plg[4][ Y ] = Graphicswindow.MouseY ","true") LDControls.RichTextBoxSetText(t17,"aa = 0","true") LDControls.RichTextBoxSetText(t17," EndIf","true") LDControls.RichTextBoxSetText(t17,"EndSub","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[8] Then LDControls.RichTextBoxSetText(t17,"Sub Grad","true") LDControls.RichTextBoxSetText(t17,"gr2[1] = FCDialogs.AskForColor()","true") LDControls.RichTextBoxSetText(t17,"gr2[2] = FCDialogs.AskForColor()","true") 'Градиент для фигур LDControls.RichTextBoxSetText(t17,"gr2[3] = FCDialogs.AskForColor()","true") LDControls.RichTextBoxSetText(t17,"EndSub","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[9] Then 'GradientBackground LDControls.RichTextBoxSetText(t17,"Sub GradientForm","true") LDControls.RichTextBoxSetText(t17,"gr1[1] = FCDialogs.AskForColor()","true") LDControls.RichTextBoxSetText(t17,"gr1[2] = FCDialogs.AskForColor()","true") ' для формы LDControls.RichTextBoxSetText(t17,"gr1[3] = FCDialogs.AskForColor()","true") LDControls.RichTextBoxSetText(t17,"For i = 1 To 3","true") LDControls.RichTextBoxSetText(t17,"brush = LDShapes.BrushGradient(gr1,Controls.GetTextBoxText(t1))","true") LDControls.RichTextBoxSetText(t17,"LDShapes.BrushGradientBackground(brush)","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") LDControls.RichTextBoxSetText(t17,"EndIf","true") LDControls.RichTextBoxSetText(t17,"EndSub","true") ElseIf (cb1[LDControls.LastComboBoxIndex] = cb1[10]) Then LDControls.RichTextBoxSetText(t17,"If Clock.Hour < 12 Then","true") LDControls.RichTextBoxSetText(t17,"TextWindow.WriteLine( 'Доброе утро, мир!' )","true") LDControls.RichTextBoxSetText(t17,"ElseIf 'Clock.Hour < 18' Then","true") LDControls.RichTextBoxSetText(t17,"TextWindow.WriteLine('Добрый день, мир!')","true") LDControls.RichTextBoxSetText(t17,"Else","true") LDControls.RichTextBoxSetText(t17,"TextWindow.WriteLine(Добрый вечер, мир!)","true") LDControls.RichTextBoxSetText(t17,"EndIf","true") ElseIf (cb1[LDControls.LastComboBoxIndex] = cb1[11]) Then LDControls.RichTextBoxSetText(t17,"p = 1","true") LDControls.RichTextBoxSetText(t17,"For i = 1 To 10","true") LDControls.RichTextBoxSetText(t17,"p = p * i","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") LDControls.RichTextBoxSetText(t17,"TextWindow.WriteLine(p)","true") ElseIf (cb1[LDControls.LastComboBoxIndex] = cb1[12]) Then LDControls.RichTextBoxSetText(t17,"k = 100","true") LDControls.RichTextBoxSetText(t17,"While k > 1","true") LDControls.RichTextBoxSetText(t17,"TextWindow.WriteLine(k)","true") LDControls.RichTextBoxSetText(t17,"k = k / 2","true") LDControls.RichTextBoxSetText(t17,"EndWhile","true") ElseIf (cb1[LDControls.LastComboBoxIndex] = cb1[13]) Then 'DrawTriangle strP() ColorAndPen() GraphicsWindow.DrawTriangle(X1,Y1,X2,Y2,X3,Y3) LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawTriangle("+X1+","+Y1+","+X2+","+Y2+","+X3+","+Y3+")","true") aa = 0 ElseIf (cb1[LDControls.LastComboBoxIndex] = cb1[14]) Then 'FillTriangle strP() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillTriangle(X1,Y1,X2,Y2,X3,Y3) LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawTriangle("+X1+","+Y1+","+X2+","+Y2+","+X3+","+Y3+")","true") aa = 0 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[15] Then 'FillPolygon Grad() For i = 1 To 1 pl = LDShapes.AddPolygon(plg) LDShapes.BrushGradientShape(pl,LDShapes.BrushGradient(gr2,Controls.GetTextBoxText(t1))) EndFor rm = pl anm = pl ang = pl opc = pl zm = pl LDControls.RichTextBoxSetText(t17,"For i = 1 To 1","true") LDControls.RichTextBoxSetText(t17,"pl = LDShapes.AddPolygon(plg)'Array","true") LDControls.RichTextBoxSetText(t17,"EndFor","true") aa = 0 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[16] Then strP() ''DrawRectangle ColorAndPen() GraphicsWindow.DrawRectangle(X1,Y1,w,h) aa = 0 LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawRectangle("+X1+","+Y1+","+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[17] Then GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillRectangle(X1,Y1,w,h) aa = 0 LDControls.RichTextBoxSetText(t17,"GraphicsWindow.FillRectangle("+X1+","+Y1+","+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[18] Then strP() 'DrawEllipse ColorAndPen() GraphicsWindow.DrawEllipse(X1,Y1,w,h) aa = 0 LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawEllipse("+X1+","+Y1+","+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[19] Then strP() 'FillEllipse GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillEllipse(X1,Y1,w,h) aa = 0 LDControls.RichTextBoxSetText(t17,"GraphicsWindow.FillEllipse("+X1+","+Y1+","+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[20] Then ''DrawLine strP() ColorAndPen() GraphicsWindow.DrawLine(X1,Y1,X2,Y2) aa = 0 LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawLine("+X1+","+Y1+","+X2+","+Y2+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[21] Then 'LDStar strP() Grad() For i = 1 To 1 ps1 = LDShapes.AddStar(n,w,h) Shapes.Move(ps1,X1,Y1) LDShapes.BrushGradientShape(ps1,LDShapes.BrushGradient(gr2,Controls.GetTextBoxText(t1))) EndFor aa = 0 LDControls.RichTextBoxSetText(t17,"ps1 = LDShapes.AddStar("+n+","+w+","+h+")","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(ps1,"+X1+","+Y1+")","true") rm = ps1 anm = ps1 ang = ps1 opc = ps1 zm = ps1 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[22] Then 'RegularPolygon strP() Grad() For i = 1 To 1 ps2 = LDShapes.AddRegularPolygon(n,w) Shapes.Move(ps2,X1,Y1) LDShapes.BrushGradientShape(ps2,LDShapes.BrushGradient(gr2,Controls.GetTextBoxText(t1))) EndFor aa = 0 LDControls.RichTextBoxSetText(t17,"ps2 = LDShapes.AddRegularPolygon(n,"+w+")","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(ps2,"+X1+","+Y1+")","true") rm = ps2 anm = ps2 ang = ps2 opc = ps2 zm = ps2 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[23] Then ''Shapes.AddText strP() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FontSize = P tx = Shapes.AddText(Controls.GetTextBoxText(t13)) Shapes.Move(tx,X1,Y1) aa = 0 LDControls.RichTextBoxSetText(t17,"txt = Shapes.AddText(Controls.GetTextBoxText(t13))","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(txt,"+X1+","+Y1+")","true") rm = tx anm = tx ang = tx opc = tx zm = tx ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[24] Then 'Shapes.AddEllipse strP() Grad() For i = 1 To 1 el = Shapes.AddEllipse(w,h) Shapes.Move(el, X1, Y1) LDShapes.BrushGradientShape(el,LDShapes.BrushGradient(gr2,Controls.GetTextBoxText(t1))) EndFor aa = 0 LDControls.RichTextBoxSetText(t17,"el = Shapes.AddEllipse("+w+","+h+")","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(el,"+X1+","+Y1+")","true") rm = el anm = el ang = el opc = el zm = el ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[25] Then 'Shapes.AddRectangle Grad() strP() For i = 1 To 1 rc = Shapes.AddRectangle(w,h) Shapes.Move(rc, X1, Y1) LDShapes.BrushGradientShape(rc,LDShapes.BrushGradient(gr2,Controls.GetTextBoxText(t1))) EndFor aa = 0 LDControls.RichTextBoxSetText(t17,"rc = Shapes.AddRectangle("+w+","+h+")","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(rc,"+X1+","+Y1+")","true") rm = rc anm = rc ang = rc opc = rc zm = rc ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[26] Then strP() ' AddImage im = Shapes.AddImage(Controls.GetTextBoxText(t13)) Shapes.Move(im,x1,y1) aa = 0 LDControls.RichTextBoxSetText(t17,"im = Shapes.AddImage(file)","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(im,"+X1+","+Y1+")","true") rm = im anm = im ang = im opc = im zm = im ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[27] Then 'AddArc ColorAndPen() strP() ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[28] Then 'AddBlockArrow ColorAndPen() strP() ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[29] Then 'AddCallout ColorAndPen() strP() ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[30] Then 'AddLineArrow ColorAndPen() strP() ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[31] Then 'AddButton ColorAndPen() strP() txt = Controls.GetTextBoxText(t13) b1 = Controls.AddButton(txt,X1,Y1) Controls.SetSize(b1,w,h) aa = 0 LDControls.RichTextBoxSetText(t17,"txt = Controls.GetTextBoxText(t13)","true") LDControls.RichTextBoxSetText(t17,"b1 = Controls.AddButton(txt,"+X1+","+Y1+")","true") LDControls.RichTextBoxSetText(t17,"Controls.SetSize(b1,"+w+","+h+")","true") rm = b1 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[32] Then 'Controls.AddTextBox ColorAndPen() strP() t1 = Controls.AddTextBox(X1,Y1) Controls.SetSize(t1,w,h) aa = 0 rm = t1 LDControls.RichTextBoxSetText(t17," t1 = Controls.AddTextBox("+X1+","+Y1+")","true") LDControls.RichTextBoxSetText(t17,"Controls.SetSize(t1,"+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[33] Then 'Controls.AddMultiLineTextBox ColorAndPen() strP() tm = Controls.AddMultiLineTextBox(X1,Y1) Controls.SetSize(tm,w,h) aa = 0 rm = tm LDControls.RichTextBoxSetText(t17,"tm = Controls.AddMultiLineTextBox("+X1+","+Y1+")","true") LDControls.RichTextBoxSetText(t17,"Controls.SetSize(tm,"+w+","+h+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[34] Then 'GraphicsWindow.DrawBoundText ColorAndPen() txb = Controls.GetTextBoxText(t13) GraphicsWindow.DrawBoundText(X1,Y1,w,txb) aa = 0 rm = txb LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawBoundText("+X1+","+Y1+","+w+",txt)","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[35] Then 'GraphicsWindow.ShowMessage txt = Controls.GetTextBoxText(t13) GraphicsWindow.ShowMessage(txt,"Info") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.ShowMessage(txt,Info)","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[36] Then 'GraphicsWindow.DrawText ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[37] Then 'LDControls.AddRadioButton strP() cr5[1] = LDControls.AddRadioButton("rb1","c5") cr5[2] = LDControls.AddRadioButton("rb2","c5") cr5[3] = LDControls.AddRadioButton("rb3","c5") For i = 1 To 3 Shapes.Move(cr5[i],X1,Y1 + (20 * (i))) EndFor LDControls.RadioButtonSet(cr5[3]) aa = 0 rm = cr5 LDControls.RichTextBoxSetText(t17,"cr5[1] = LDControls.AddRadioButton('rb1','c5')","true") LDControls.RichTextBoxSetText(t17,"cr5[2] = LDControls.AddRadioButton('rb2','c5')","true") LDControls.RichTextBoxSetText(t17,"cr5[3] = LDControls.AddRadioButton('rb3','c5')","true") LDControls.RichTextBoxSetText(t17," For i = 1 To 3","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(cr5[i],"+X1+","+Y1+" + (20 * (i)))","true") LDControls.RichTextBoxSetText(t17," EndFor","true") LDControls.RichTextBoxSetText(t17,"LDControls.RadioButtonSet(cr5[3])","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[38] Then 'LDControls.AddSlider strP() sl15 = LDControls.AddSlider(w, h, Controls.GetTextBoxText(t1)) Shapes.Move(sl15, X1, Y1) LDControls.SliderValue(sl15, 0) LDControls.SliderChanged = Slider sv15 = LDControls.SliderGetValue(sl15) R1 = Math.Ceiling(sv15 * 2.55) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,0,0) Controls.SetTextBoxText(ts1, R1) aa = 0 rm = sl1 LDControls.RichTextBoxSetText(t17,"sl1 = LDControls.AddSlider("+w+","+h+"), Controls.GetTextBoxText(t1))","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(sl15,"+X1+","+Y1+"))","true") LDControls.RichTextBoxSetText(t17,"LDControls.SliderValue(sl15, d)'0 or 100","true") LDControls.RichTextBoxSetText(t17,"LDControls.SliderChanged = Slider","true") LDControls.RichTextBoxSetText(t17,"sv15 = LDControls.SliderGetValue(sl1)","true") LDControls.RichTextBoxSetText(t17,"R1 = Math.Ceiling(sv15 * 2.55)","true") LDControls.RichTextBoxSetText(t17,"Controls.SetTextBoxText(ts15, R1)","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[39] Then 'FCControls.AddCheckBox strP() a = Controls.GetTextBoxText(t13) chb = LDControls.CheckBoxGetState(a) 'FCControls.AddCheckBox(a) Shapes.Move(chb,x1,y1) rm = ch aa = 0 LDControls.RichTextBoxSetText(t17,"a = Controls.GetTextBoxText(t13)","true") LDControls.RichTextBoxSetText(t17,"chb = FCControls.CheckBox(a)","true") LDControls.RichTextBoxSetText(t17,"Controls.Move(chb,"+X1+","+Y1+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[40] Then GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) pgb = LDControls.AddProgressBar(w, h,Controls.GetTextBoxText(t1)) LDControls.ProgressBarValue(pgb,Controls.GetTextBoxText(t2)) Shapes.Move(pgb,X1,Y1) rm = pgb aa = 0 LDControls.RichTextBoxSetText(t17,"pgb = LDControls.AddProgressBar("+w+","+h+",(t1)H;V)","true") LDControls.RichTextBoxSetText(t17,"LDControls.ProgressBarValue(pgb,(t2))","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(pgb,"+X1+","+Y1+")","true") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[41] Then 'LDControls.AddBrowser strP() bw = LDControls.AddBrowser(w,h,Controls.GetTextBoxText(t13)) Shapes.Move(bw, x1, y1) rm = bw aa = 0 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[42] Then LDControls.RichTextBoxSetText(t17,"bw = LDControls.AddBrowser("+w+","+h+",Controls.GetTextBoxText(t13))'http://)","true") LDControls.RichTextBoxSetText(t17,"Shapes.Move(bw,"+X1+","+Y1+")","true") 'LDControls.AddListBox list[1] = "Mark" list[2] = "Anton" list = LDSort.ByValue(list) lb = LDControls.AddListBox(list,w,h) Shapes.Move(lb,X1,Y1) rm = lb aa = 0 LDControls.RichTextBoxSetText(t17,"list[1] = 'Mark'","True") LDControls.RichTextBoxSetText(t17,"list[2] = 'Anton'","true") LDControls.RichTextBoxSetText(t17,"list = LDSort.ByValue(list)","True") LDControls.RichTextBoxSetText(t17,"lb = LDControls.AddListBox(list,"+w+","+h+")","True") LDControls.RichTextBoxSetText(t17,"Shapes.Move(lb,"+X1+","+Y1+")","True") LDControls.RichTextBoxSetText(t17,"LDControls.ListBoxItemChanged = OnListBoxChanged","True") LDControls.RichTextBoxSetText(t17,"Sub OnListBoxChanged","True") LDControls.RichTextBoxSetText(t17,"EndSub","True") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[43] Then 'LDControls.AddComboBox strP() OnComboBoxItemChanged() cb[4] = "Color" cb[1] = "Red" cb[2] = "Green" cb[3] = "Blue" comboBox = LDControls.AddComboBox(cb,w,h) Shapes.Move(comboBox,x1,y1) LDControls.ComboBoxItemChanged = OnComboBoxItemChanged rm = cb aa = 0 LDControls.RichTextBoxSetText(t17,"cb[4] = 'Color'","True") LDControls.RichTextBoxSetText(t17,"cb[1] = 'Red'","True") LDControls.RichTextBoxSetText(t17,"cb[2] = 'Green'","True") LDControls.RichTextBoxSetText(t17,"cb[3] = 'Blue'","True") LDControls.RichTextBoxSetText(t17,"comboBox = LDControls.AddComboBox(cb,"+w+","+h+")","True") LDControls.RichTextBoxSetText(t17,"Shapes.Move(comboBox,"+X1+","+Y1+")","True") LDControls.RichTextBoxSetText(t17,"LDControls.ComboBoxItemChanged = OnComboBoxItemChanged","True") LDControls.RichTextBoxSetText(t17,"Sub OnComboBoxItemChanged","True") LDControls.RichTextBoxSetText(t17,"If (cb[LDControls.LastComboBoxIndex] = cb[1]) Then","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.BackgroundColor = 'Red'","True") LDControls.RichTextBoxSetText(t17,"ElseIf (cb[LDControls.LastComboBoxIndex] = cb[2]) Then","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.BackgroundColor = 'Green'","True") LDControls.RichTextBoxSetText(t17,"ElseIf (cb[LDControls.LastComboBoxIndex] = cb[3]) Then","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.BackgroundColor = 'Blue'","True") LDControls.RichTextBoxSetText(t17,"EndIf","True") LDControls.RichTextBoxSetText(t17,"EndSub","True") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[44] Then '.AddChart strP() For i = 1 To 8 data["Test Data "+i] = Math.GetRandomNumber(8) EndFor GraphicsWindow.PenColor = "White" chart1 = LDChart.AddChart(w,h) Shapes.Move(chart1,x1,y1) LDChart.Properties(chart1, "Pie", 1) LDChart.Legend(chart1, 1, "Precent", "false") LDChart.ColourMap(chart1, 360, 0.85, 0.55, 1, 0, 1, "LightBlue") LDChart.SetData(chart1, Data) LDChart.ValueClicked = OnValueClicked rm = chart1 aa = 0 LDControls.RichTextBoxSetText(t17,"For i = 1 To 8","True") LDControls.RichTextBoxSetText(t17,"data['Test Data '+i] = Math.GetRandomNumber(8)","True") LDControls.RichTextBoxSetText(t17,"EndFor","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.PenColor = 'White","True") LDControls.RichTextBoxSetText(t17,"chart1 = LDChart.AddChart("+w+","+h+")","True") LDControls.RichTextBoxSetText(t17,"Shapes.Move(chart1,"+X1+","+Y1+")","True") LDControls.RichTextBoxSetText(t17,"LDChart.Properties(chart1, 'Pie' , 1)","True") LDControls.RichTextBoxSetText(t17,"LDChart.Legend(chart1, 1, 'Precent' , 1)","True") LDControls.RichTextBoxSetText(t17,"LDChart.ColourMap(chart1, 360, 0.85, 0.55, 1, 0, 1, 'LightBlue')","True") LDControls.RichTextBoxSetText(t17,"LDChart.SetData(chart1, Data)","True") LDControls.RichTextBoxSetText(t17,"LDChart.ValueClicked = OnValueClicked","True") LDControls.RichTextBoxSetText(t17,"Sub OnValueClicked","True") LDControls.RichTextBoxSetText(t17,"LDChart.Highlight(LDChart.LastChart, LDChart.LastLabel, 0.1)","True") LDControls.RichTextBoxSetText(t17,"EndSub","True") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[45] Then 'LDScrollBars.Add LDScrollBars.Add(w,h) LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Width = gw","True") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.Height = gw","True") LDControls.RichTextBoxSetText(t17,"LDScrollBars.Add(gw + 100, gh + 100)","True") ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[46] Then 'TurtleProgram Turtle.Speed = 10 GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.PenWidth = P numSides = n ' Triangle(3),Cub(4)... repeatCount = ng sideLen1 = w sideLen2 = h For I = 1 To repeatCount For J = 1 To numSides Turtle.Move(sideLen1) Turtle.Turn(360 / numSides) EndFor For J = 1 To numSides Turtle.Move(sideLen2) Turtle.Turn(360 / numSides) EndFor Turtle.Turn(360 / repeatCount) EndFor ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[47] Then ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[48] Then Down5() r = h / w GraphicsWindow.PenWidth = P GraphicsWindow.Left = x1 GraphicsWindow.Top = y1 For x = 0 To w Step ng GraphicsWindow.PenColor = "Yellow" l1 = Shapes.AddLine(0,x * r,w - x,0) Shapes.Move(l1,x1,y1) GraphicsWindow.PenColor = "Magenta" l2 = Shapes.AddLine(0,(w - x)* r,w - x, w * r) Shapes.Move(l2,x1,y1) GraphicsWindow.PenColor = "Green" l3 = Shapes.AddLine(w - x,0 * r,w, (w - x)* r) Shapes.Move(l3,x1,y1) GraphicsWindow.PenColor = "White" l4 = Shapes.AddLine(w - x, w * r,w, x * r) Shapes.Move(l4,x1,y1) EndFor aa = 0 ElseIf cb1[LDControls.LastComboBoxIndex] = cb1[49] Then ColorAndPen() Down5() Size = 32 X1 = 500 - Size / 2 Y1 = 100 dy = Size * Math.Sin(Math.GetRadians(60)) yt = Y1 xt = X1 For J = 0 To 14 y1 = yt + J * dy * 1.5 x1 = xt - Size / 4 * 3 * J For i = 1 To 15 - 1.5 * j drawTre() Y1 = Y1 + dy EndFor y1 = yt + J * dy * 1.5 x1 = xt + Size / 4 * 3 * J For i = 1 To 15 - 1.5 * J drawTre() Y1 = Y1 + dy EndFor EndFor EndIf GraphicsWindow.PenWidth = 0 EndSub Controls.ButtonClicked = Click Sub Click GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,0,145) GraphicsWindow.FontSize = 14 lrb = LDControls.LastRadioButton If Controls.LastClickedButton = b5 And lrb = cr3[1] Then 'Animate Shapes.Animate(anm,X1,Y1,mm * 10) aa = 0 ElseIf Controls.LastClickedButton = b5 And lrb = cr3[2] Then 'Rotate Shapes.Rotate(ang,mm) ElseIf Controls.LastClickedButton = b5 And lrb = cr3[3] Then 'Opacity Shapes.SetOpacity(opc,mm) ElseIf Controls.LastClickedButton = b5 And lrb = cr3[4] Then ''Zoom Shapes.Zoom(zm, zw, zh) ElseIf Controls.LastClickedButton = b5 And lrb = cr3[5] Then 'Grid Grid() ElseIf Controls.LastClickedButton = b5 And lrb = cr3[6] Then 'Remove Shapes.Remove(rm) ElseIf Controls.LastClickedButton = b1 And lrb = cr3[7] Then ' ElseIf Controls.LastClickedButton = b1 And lrb = cr3[8] Then ' ElseIf (Controls.LastClickedButton = b1 And lrb = cr3[9]) Then ' ElseIf (Controls.LastClickedButton = b1 And lrb = cr3[10]) Then ' ElseIf (Controls.LastClickedButton = b2 And lrb = cr4[1]) Then 'Flickr pic = Flickr.GetRandomPicture(Controls.GetTextBoxText(t13)) GraphicsWindow.DrawResizedImage(pic,X1,Y1,w,h) rm = pic LDControls.RichTextBoxSetText(t17,"pic = Flickr.GetRandomPicture(Controls.GetTextBoxText(t13)'nature","true") LDControls.RichTextBoxSetText(t17,"GraphicsWindow.DrawResizedImage(pic,"+X1+","+Y1+")","true") aa = 0 ElseIf (Controls.LastClickedButton = b1 And lrb = cr4[2]) Then ' TurtleUp() strP() Turtle.Speed = 9 Turtle.PenUp() Turtle.MoveTo(X1,Y1) aa = 0 LDControls.RichTextBoxSetText(t17,"Turtle.Speed = 9","true") LDControls.RichTextBoxSetText(t17,"Turtle.PenUp()","true") LDControls.RichTextBoxSetText(t17,"Turtle.MoveTo("+X1+","+Y1+")","true") ElseIf (Controls.LastClickedButton = b1 And lrb = cr4[3]) Then ' TurtleDown() strP() Turtle.Speed = 9 ColorAndPen() Turtle.PenDown() Turtle.MoveTo(X1,Y1) aa = 0 LDControls.RichTextBoxSetText(t17,"ColorAndPen()","true") LDControls.RichTextBoxSetText(t17,"Turtle.Speed = 9","true") LDControls.RichTextBoxSetText(t17,"Turtle.PenDown()","true") LDControls.RichTextBoxSetText(t17,"Turtle.MoveTo("+X1+","+Y1+")","true") ElseIf (Controls.LastClickedButton = b1 And lrb = cr4[4]) Then ' TurtleShow() Turtle.Show() ElseIf (Controls.LastClickedButton = b1 And lrb = cr4[5]) Then ' TurtleAngle() strP() ColorAndPen() Turtle.X = 500 Turtle.Y = 360 Turtle.PenDown() Turtle.Angle = n Turtle.Move(mt) aa = 0 LDControls.RichTextBoxSetText(t17,"ColorAndPen()","true") LDControls.RichTextBoxSetText(t17,"Turtle.PenDown()","true") LDControls.RichTextBoxSetText(t17,"Turtle.Angle = "+n+")","true") LDControls.RichTextBoxSetText(t17,"Turtle.Move("+mt+")","true") ElseIf (Controls.LastClickedButton = b3) Then 'Reset GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,100,255) GraphicsWindow.FillRectangle(0,0,995,725) Controls.SetTextBoxText(t1," ") Controls.SetTextBoxText(t2," ") Controls.SetTextBoxText(t3," ") Controls.SetTextBoxText(t4," ") Controls.SetTextBoxText(t5," ") Controls.SetTextBoxText(t6," ") Controls.SetTextBoxText(t11," ") Controls.SetTextBoxText(t12," ") Controls.SetTextBoxText(t13," ") Controls.SetTextBoxText(t18," ") Controls.SetTextBoxText(t19," ") Controls.SetTextBoxText(t20," ") Controls.SetTextBoxText(t21," ") Controls.SetTextBoxText(t22," ") Controls.SetTextBoxText(t23," ") Controls.SetTextBoxText(t24," ") Controls.SetTextBoxText(t25," ") Controls.SetTextBoxText(t26," ") Controls.SetTextBoxText(t27," ") LDControls.RadioButtonSet(cr3[11]) LDControls.RadioButtonSet(cr4[11]) LDShapes.ResetTurtle() LDShapes.RemoveTurtleLines() Turtle.Hide() ElseIf (Controls.LastClickedButton = b4) Then gr1[1] = LDDialogs.Colour() gr1[2] = LDDialogs.Colour() ' для формы gr1[3] = LDDialogs.Colour() For i = 1 To 3 brush = LDShapes.BrushGradient(gr1,Controls.GetTextBoxText(t1)) LDShapes.BrushGradientBackground(brush) EndFor LDControls.RadioButtonSet(cr3[11]) LDControls.RadioButtonSet(cr4[11]) GraphicsWindow.PenWidth = 0 ElseIf (Controls.LastClickedButton = b6) Then LDControls.RichTextBoxClear(t17) EndIf EndSub Sub OnValueClicked LDChart.Highlight(LDChart.LastChart, LDChart.LastLabel, 0.1) EndSub Sub OnComboBoxItemChanged If cb[LDControls.LastComboBoxIndex] = cb[1] Then GraphicsWindow.BackgroundColor = "Red" ElseIf cb[LDControls.LastComboBoxIndex] = cb[2] Then GraphicsWindow.BackgroundColor = "Green" ElseIf cb[LDControls.LastComboBoxIndex] = cb[3] Then GraphicsWindow.BackgroundColor = "Blue" EndIf EndSub Sub OnMouseMove Controls.SetTextBoxText(t11, "X=" + GraphicsWindow.MouseX) Controls.SetTextBoxText(t12, "Y=" + GraphicsWindow.Mousey) EndSub GraphicsWindow.MouseDown = Down5 Sub Down5 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) x = GraphicsWindow.MouseX y = Graphicswindow.MouseY aa = aa + 1 GraphicsWindow.FillRectangle(x, y, 3, 3) If aa = 1 Then X1 = GraphicsWindow.MouseX Controls.SetTextBoxText(t18,"X1= "+ X1) Y1 = Graphicswindow.MouseY Controls.SetTextBoxText(t19,"Y1= "+ Y1) plg[0][" X "] = x plg[0][" Y "] = y ElseIf aa = 2 Then X2 = GraphicsWindow.MouseX Controls.SetTextBoxText(t20,"X2= "+ X2) Y2 = Graphicswindow.MouseY Controls.SetTextBoxText(t21,"Y2= "+ Y2) plg[1][" X "] = x plg[1][" Y "] = y ElseIf aa = 3 Then X3 = GraphicsWindow.MouseX Controls.SetTextBoxText(t22,"X3= "+ X3) Y3 = Graphicswindow.MouseY Controls.SetTextBoxText(t23,"Y3= "+ Y3) plg[2][" X "] = x plg[2][" Y "] = y ElseIf aa = 4 Then X4 = GraphicsWindow.MouseX Controls.SetTextBoxText(t24,"X4= "+ X4) Y4 = Graphicswindow.MouseY Controls.SetTextBoxText(t25,"Y4= "+ Y4) plg[3][" X "] = x plg[3][" Y "] = y ElseIf aa = 5 Then X5 = GraphicsWindow.MouseX Controls.SetTextBoxText(t26,"X5= "+ X5) Y5 = Graphicswindow.MouseY Controls.SetTextBoxText(t27,"Y5= "+ Y5) plg[4][" X "] = x plg[4][" Y "] = y aa = 0 EndIf EndSub LDControls.SliderChanged = Slider Sub Slider sv1 = LDControls.SliderGetValue(sl1) R = Math.Ceiling(sv1 * 2.55) Controls.SetTextBoxText(ts1, R) LDDialogs.ToolTip(ts1,"Red Color") sv2 = LDControls.SliderGetValue(sl2) G = Math.Ceiling(sv2 * 2.55) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillEllipse(637,730,80,30) LDDialogs.ToolTip(ts2,"Green Color") Controls.SetTextBoxText(ts2, G) sv3 = LDControls.SliderGetValue(sl3) B = Math.Ceiling(sv3 * 2.55) Controls.SetTextBoxText(ts3, B) LDDialogs.ToolTip(ts3,"Blue Color") sv4 = LDControls.SliderGetValue(sl4) P = Math.Ceiling(sv4 * 1.0) LDDialogs.ToolTip(ts4,"PenWidth(P)") Controls.SetTextBoxText(ts4, P) sv5 = LDControls.SliderGetValue(sl5) w = Math.Ceiling(sv5 * 6.95) LDDialogs.ToolTip(ts5,"Width") Controls.SetTextBoxText(ts5, w) sv6 = LDControls.SliderGetValue(sl6) h = Math.Ceiling(sv6 * 6.95) LDDialogs.ToolTip(ts6,"Height") Controls.SetTextBoxText(ts6, h) sv7 = LDControls.SliderGetValue(sl7) lf = Math.Ceiling(sv7 * 3.5) LDDialogs.ToolTip(ts7,"lf (Left)") Controls.SetTextBoxText(ts7, lf) sv8 = LDControls.SliderGetValue(sl8) tp = Math.Ceiling(sv8 * 3.5) LDDialogs.ToolTip(ts8,"tp(Top)") Controls.SetTextBoxText(ts8, tp) sv9 = LDControls.SliderGetValue(sl9) n = Math.Ceiling(sv9 * 3.6) LDDialogs.ToolTip(ts9, "n(Corners,startDigree,Turtle.Angle)") Controls.SetTextBoxText(ts9, n) sv10 = LDControls.SliderGetValue(sl10) mm = Math.Ceiling(sv10 * 3.6) LDDialogs.ToolTip(ts10,"(mm)Rotate,Opasity,Animate") Controls.SetTextBoxText(ts10, mm) sv11 = LDControls.SliderGetValue(sl11) zw = Math.Ceiling((sv11 * 0.5)/10) LDDialogs.ToolTip(ts11,"ZoomWidth") Controls.SetTextBoxText(ts11, zw ) sv12 = LDControls.SliderGetValue(sl12) zh = Math.Ceiling((sv12 * 0.5)/10) LDDialogs.ToolTip(ts12,"ZoomHeight") Controls.SetTextBoxText(ts12, zh ) sv13 = LDControls.SliderGetValue(sl13) nn = Math.Ceiling((sv13 * 1)/10) LDDialogs.ToolTip(ts13,"nn") Controls.SetTextBoxText(ts13, nn) sv14 = LDControls.SliderGetValue(sl14) mt = Math.Ceiling(sv14 * 5) LDDialogs.ToolTip(ts14,"Move(Turtle(mt))") Controls.SetTextBoxText(ts14, mt) sv15 = LDControls.SliderGetValue(sl15) ng = Math.Ceiling(sv15 * 1) LDDialogs.ToolTip(ts15,"Grid(ng)") Controls.SetTextBoxText(ts15, ng) EndSub Sub ColorAndPen GraphicsWindow.PenWidth = P GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(R,G,B) ' Для контура фигур GraphicsWindow.FontSize = GraphicsWindow.GetColorFromRGB(R,G,B) EndSub Sub Grad gr2[1] = LDDialogs.Colour() gr2[2] = LDDialogs.Colour() 'Градиент для фигур gr2[3] = LDDialogs.Colour() EndSub Sub Grid GraphicsWindow.PenWidth = 0.1 GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(R,G,B) For gg = 1 To 245 Step ng GraphicsWindow.DrawLine(4 * gg,4,4 * gg,725) 'gorizontal EndFor For vv = 1 To 180 Step ng GraphicsWindow.DrawLine(4,4 * vv,960,4 * vv) 'vertical EndFor EndSub Sub strP Controls.SetTextBoxText(t18," ") Controls.SetTextBoxText(t19," ") Controls.SetTextBoxText(t20," ") Controls.SetTextBoxText(t21," ") Controls.SetTextBoxText(t22," ") Controls.SetTextBoxText(t23," ") Controls.SetTextBoxText(t24," ") Controls.SetTextBoxText(t25," ") Controls.SetTextBoxText(t26," ") Controls.SetTextBoxText(t27," ") EndSub 'Sub Risovalka ' If Mouse.IsLeftButtonDown ="True" Or Mouse.IsRightButtonDown = "True" Then 'GraphicsWindow.DrawLine(mx1,my1,GraphicsWindow.MouseX,GraphicsWindow.MouseY) 'EndIf 'mx1 = GraphicsWindow.MouseX 'my1 = GraphicsWindow.MouseY 'EndSub Sub drawTre GraphicsWindow.FillTriangle(x1,y1,x1 + size,y1,x1 + Size / 2,Y1 + dy) EndSub End>VQF008.sb< Start>VQG555.sb< GraphicsWindow.KeyDown = HandleKey GraphicsWindow.BackgroundColor = "teal not="true=false;false=true rstt="false While "True"'--------------------------------------------------------------------main loop----- BOXES = 5 ' number of boxes per piece BWIDTH = 25 ' box width in pixels XOFFSET = 40 ' Screen X offset in pixels of where the board starts YOFFSET = 40 ' Screen Y offset in pixels of where the board starts CWIDTH = 10 ' Canvas Width, in number of boxes CHEIGHT = 20 ' Canvas Height, in number of boxes. STARTDELAY = 800 ENDDELAY = 175 PREVIEW_xpos = 13 PREVIEW_ypos = 2 GraphicsWindow.Clear() GraphicsWindow.Title = "Quintis GraphicsWindow.Height = 580 GraphicsWindow.Width = 700 GraphicsWindow.Show() SetupTemplates() SetupCanvas() template = Text.Append("template", Math.GetRandomNumber(4)) CreatePiece() ' in: template ret: h nextPiece = h ch=LDText.Split("11111 11211 12221 11211 11111" " ") end = 0 sessionDelay = STARTDELAY While end = 0 If sessionDelay > ENDDELAY Then sessionDelay = sessionDelay - 1 EndIf delay = sessionDelay thisPiece = nextPiece template = Text.Append("template", Math.GetRandomNumber(4)) CreatePiece() ' in: template ret: h nextPiece = h DrawPreviewPiece() h = thisPiece ypos = 0 done = 0 xpos = 3 ' always drop from column 3 CheckStop() ' in: ypos, xpos, h ret: done If done = 1 Then ypos = ypos - 1 MovePiece() 'in: ypos, xpos, h end = 1 EndIf yposdelta = 0 While (done = 0 Or yposdelta > 0) and not[rstt] MovePiece() 'in: ypos, xpos, h ' Delay, but break If the delay get set To 0 If the piece gets dropped delayIndex = delay While delayIndex > 0 And delay > 0 Program.Delay(11) delayIndex = delayIndex - 10 EndWhile If yposdelta > 0 Then yposdelta = yposdelta - 1 ' used To create freespin, when the piece is rotated Else ypos = ypos + 1 ' otherwise, move the piece down. EndIf ' Check If the piece should stop. CheckStop() ' in: ypos, xpos, h ret: done tt=tt+1 If Math.Remainder(tt 40)=0 Then iii=LDGraphicsWindow.Capture("" "false") ' GraphicsWindow.DrawResizedImage(iii 0 0 100 100) For fy=0 To 19 arr[fy]="" For fx=0 To 9 pp=LDImage.GetPixel(iii XOFFSET+BWIDTH*fx+3 YOFFSET+BWIDTH*fy+3) pp=text.ConvertToLowerCase( Text.GetSubTextToEnd(pp Text.GetLength(pp)-5)) ' TextWindow.WriteLine(pp) If pp="ff0000" Then arr[fy]=text.Append(arr[fy] 1) ElseIf pp="ffffff" Then arr[fy]=text.Append(arr[fy] 2) Else arr[fy]=text.Append(arr[fy] ".") EndIf EndFor ' TextWindow.WriteLine(arr[fy]) EndFor ' TextWindow.WriteLine(" ") pz="true For q=0 To 5 For o=0 To 15 sq=0 For p=0 To 4 If Text.GetSubText(arr[o+p] q 5)=ch[p+1] Then sq=sq+1 Else Goto nxx 'exitfor EndIf EndFor nxx: If sq=5 Then GraphicsWindow.ShowMessage("Swiss done!" "WON!") Program.End() EndIf EndFor EndFor EndIf EndWhile If rstt Then rstt="false Goto exx EndIf EndWhile exx: GraphicsWindow.ShowMessage( "Game Over", "Small Basic Tetris" ) EndWhile'---------------------------------------------------------------------------------------------------- Sub HandleKey ' Stop game If GraphicsWindow.LastKey = "Escape" Then rr=LDDialogs.Confirm("Reset level ?" "Q-tis") If rr="Yes" Then rstt="true EndIf EndIf If GraphicsWindow.LastKey = "Left" Then moveDirection = -1 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 If move is invalid, otherwise 0 If invalidMove = 0 Then xpos = xpos + moveDirection EndIf MovePiece() 'in: ypos, xpos, h EndIf If GraphicsWindow.LastKey = "Right" Then moveDirection = 1 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 If move is invalid, otherwise 0 If invalidMove = 0 Then xpos = xpos + moveDirection EndIf MovePiece() 'in: ypos, xpos, h EndIf If GraphicsWindow.LastKey = "Down" or GraphicsWindow.LastKey = "Space" Then delay = 20 EndIf If GraphicsWindow.LastKey = "Up" Then basetemplate = array.GetValue(h, -1) ' array.GetValue(h, -1) = the template name template = "temptemplate" rotation = "CW" CopyPiece() 'in basetemplate, template, rotation array.SetValue(h, -1, template) ' array.GetValue(h, -1) = the template name moveDirection = 0 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 If move is invalid, otherwise 0 xposbk = xpos yposdelta = 0 While yposdelta = 0 And Math.Abs(xposbk - xpos) < 3 ' move up To 3 times only ' If the rotation move worked, copy the temp To "rotatedtemplate" and use that from now on If invalidMove = 0 Then basetemplate = template template = "rotatedtemplate" array.SetValue(h, -1, template) ' array.GetValue(h, -1) = the template name rotation = "COPY" CopyPiece() 'in basetemplate, template, rotation yposdelta = 1 ' Don't move down If we rotate MovePiece() 'in: ypos, xpos, h ElseIf invalidMove = 2 Then ' Don't support shifting piece when hitting another piece To the right or left. xpos = 99 ' exit the loop Else ' If the rotated piece can't be placed, move it left or right and try again. xpos = xpos - invalidMove ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 If move is invalid, otherwise 0 EndIf EndWhile If invalidMove <> 0 Then xpos = xposbk array.SetValue(h, -1, basetemplate) ' array.GetValue(h, -1) = the template name template = "" EndIf EndIf EndSub Sub DrawPreviewPiece xpos = PREVIEW_xpos ypos = PREVIEW_ypos h = nextPiece XOFFSETBK = XOFFSET YOFFSETBK = YOFFSET XOFFSET = XOFFSET + array.GetValue(array.GetValue(h, -1), "pviewx") ' array.GetValue(h, -1) = the template name YOFFSET = YOFFSET + array.GetValue(array.GetValue(h, -1), "pviewy") ' array.GetValue(h, -1) = the template name MovePiece() 'in: ypos, xpos, h XOFFSET = XOFFSETBK YOFFSET = YOFFSETBK EndSub Sub CopyPiece 'in basetemplate, template, rotation L = array.GetValue(basetemplate, "dim") If rotation = "CW" Then For i = 0 To BOXES - 1 ' x' = y y' = L - 1 - x v = array.GetValue(basetemplate, i) x = (Math.Remainder(v, 10)) y = (L - 1 - Math.Floor(v/10)) array.SetValue(template, i, x * 10 + y) EndFor ElseIf rotation = "COPY" Then For i = 0 To BOXES - 1 array.SetValue(template, i, array.GetValue(basetemplate, i)) EndFor EndIf array.SetValue(template, "color", array.GetValue(basetemplate, "color")) array.SetValue(template, "dim", array.GetValue(basetemplate, "dim")) array.SetValue(template, "pviewx", array.GetValue(basetemplate, "pviewx")) array.SetValue(template, "pviewy", array.GetValue(basetemplate, "pviewy")) EndSub Sub CreatePiece ' in: template ret: h hcount = hcount + 1 h = Text.Append("piece", hcount) array.SetValue(h, -1, template) ' array.GetValue(h, -1) = the template name GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = array.GetValue(template, "color") For i = 0 To BOXES - 1 s = Shapes.AddRectangle(BWIDTH, BWIDTH) Shapes.Move(s, -BWIDTH, -BWIDTH) ' move off screen array.SetValue(h, i, s) EndFor EndSub Sub MovePiece 'in: ypos, xpos, h. ypos/xpos is 0-19, representing the top/left box coordinate of the piece on the canvas. h returned by CreatePiece For i = 0 To BOXES - 1 v = array.GetValue(array.GetValue(h, -1), i) ' array.GetValue(h, -1) = the template name x = Math.Floor(v/10) y = Math.Remainder(v, 10) Shapes.Move(array.GetValue(h, i), XOFFSET + xpos * BWIDTH + x * BWIDTH, YOFFSET + ypos * BWIDTH + y * BWIDTH) EndFor EndSub Sub ValidateMove ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 If move is invalid, otherwise 0 i = 0 invalidMove = 0 While i < BOXES v = array.GetValue(array.GetValue(h, -1), i) ' array.GetValue(h, -1) = the template name x = Math.Floor(v/10) y = Math.Remainder(v, 10) If (x + xpos + moveDirection) < 0 Then invalidMove = -1 i = BOXES ' force getting out of the loop EndIf If (x + xpos + moveDirection) >= CWIDTH Then invalidMove = 1 i = BOXES ' force getting out of the loop EndIf If array.GetValue("c", (x + xpos + moveDirection) + (y + ypos) * CWIDTH) <> "." Then invalidMove = 2 i = BOXES ' force getting out of the loop EndIf i = i + 1 EndWhile EndSub Sub CheckStop ' in: ypos, xpos, h ret: done done = 0 i = 0 While i < BOXES v = array.GetValue(array.GetValue(h, -1), i) ' array.GetValue(h, -1) = the template name x = Math.Floor(v/10) y = Math.Remainder(v, 10) If y + ypos > CHEIGHT Or array.GetValue("c", (x + xpos) + (y + ypos) * CWIDTH) <> "." Then done = 1 Goto lxx EndIf i = i + 1 EndWhile lxx: If done = 1 Then For i = 0 To BOXES - 1 v = array.GetValue(array.GetValue(h, -1), i) ' array.GetValue(h, -1) = the template name array.SetValue("c", (Math.Floor(v/10) + xpos) + (Math.Remainder(v, 10) + ypos - 1) * CWIDTH, array.GetValue(h, i)) EndFor score = score + 1 GraphicsWindow.Title="Q-Swiss Score: "+score+" pts" DeleteLines() EndIf EndSub Sub DeleteLines linesCleared = 0 ' Iterate over each row, starting from the bottom For y = CHEIGHT - 1 To 0 Step -1 x = CWIDTH While x = CWIDTH x = 0 While x < CWIDTH piece = array.GetValue("c", x + y * CWIDTH) If piece = "." Then x = CWIDTH EndIf x = x + 1 EndWhile If x = CWIDTH Then For x1 = 0 To CWIDTH - 1 Shapes.Remove(array.GetValue("c", x1 + y * CWIDTH)) EndFor linesCleared = linesCleared + 1 ' Move everything Else down one. For y1 = y To 1 Step -1 For x1 = 0 To CWIDTH - 1 piece = array.GetValue("c", x1 + (y1 - 1) * CWIDTH) array.SetValue("c", x1 + y1 * CWIDTH, piece) Shapes.Animate(piece, Shapes.GetLeft(piece), Shapes.GetTop(piece) + BWIDTH,250) EndFor EndFor Program.Delay(500) EndIf EndWhile EndFor If linesCleared > 0 Then score = score + 100 * Math.Round(linesCleared * 2.15 - 1) GraphicsWindow.Title="Q-Swiss Score: "+score+" pts EndIf EndSub Sub SetupCanvas GraphicsWindow.BackgroundColor="teal GraphicsWindow.Clear() GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "PeachPuff For x = 0 To CWIDTH-1 For y = 0 To CHEIGHT-1 array.SetValue("c", x + y * CWIDTH, ".") ' "." indicates spot is free GraphicsWindow.DrawRectangle(XOFFSET + x * BWIDTH, YOFFSET + y * BWIDTH, BWIDTH, BWIDTH) EndFor EndFor GraphicsWindow.PenWidth = 4 GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(XOFFSET, YOFFSET, XOFFSET, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH, YOFFSET, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.DrawLine(XOFFSET, YOFFSET + CHEIGHT*BWIDTH, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.PenColor = "Lime" GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET, XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 6) GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 6) GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 4, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 4) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "cyan x = XOFFSET + PREVIEW_xpos * BWIDTH - BWIDTH y = YOFFSET + PREVIEW_ypos * BWIDTH - BWIDTH score = 0 GraphicsWindow.Title="Q-Swiss Score: 0 pts" EndSub Sub SetupTemplates array.SetValue("template1", 0, 00) array.SetValue("template1", 1, 01) array.SetValue("template1", 2, 11) array.SetValue("template1", 3, 21) array.SetValue("template1", 4, 20) array.SetValue("template1", "color", "red") array.SetValue("template1", "dim", 3) array.SetValue("template1", "pviewx", -12) array.SetValue("template1", "pviewy", 12) array.SetValue("template3", 0, 10) array.SetValue("template3", 1, 01) array.SetValue("template3", 2, 11) array.SetValue("template3", 3, 21) array.SetValue("template3", 4, 12) array.SetValue("template3", "color", "white") array.SetValue("template3", "dim", 3) array.SetValue("template3", "pviewx", 0) array.SetValue("template3", "pviewy", 25) array.SetValue("template2", 0, 10) array.SetValue("template2", 1, 11) array.SetValue("template2", 2, 12) array.SetValue("template2", 3, 13) array.SetValue("template2", 4, 14) array.SetValue("template2", "color", "red") array.SetValue("template2", "dim", 5) array.SetValue("template2", "pviewx", 0) array.SetValue("template2", "pviewy", 0) array.SetValue("template4", 0, 01) array.SetValue("template4", 1, 11) array.SetValue("template4", 2, 21) array.SetValue("template4", 3, 12) array.SetValue("template4", 4, 13) array.SetValue("template4", "color", "cyan") array.SetValue("template4", "dim", 4) array.SetValue("template4", "pviewx", 0) array.SetValue("template4", "pviewy", 25) EndSub End>VQG555.sb< Start>VQH744-0.sb< ' Program by Y LEDUC , March 22th 2016 'for classical guitar but my adaptation for a grand piano ' Andantino de Ferdinando Carulli 1770-1841 ' https://en.wikipedia.org/wiki/Ferdinando_Carulli GraphicsWindow.Top =0 GraphicsWindow.left =0 GraphicsWindow.Height=768 GraphicsWindow.Width=1366 GraphicsWindow.fontname="AR Decode" GraphicsWindow.FontSize=75 GraphicsWindow.BrushColor="#1F41A3" GraphicsWindow.BackgroundColor="#E7D3AD" image1=imagelist.LoadImage( "https://upload.wikimedia.org/wikipedia/commons/1/17/Full_score.jpg") image2=imagelist.LoadImage( "https://upload.wikimedia.org/wikipedia/commons/c/cc/Ferdinando_Carulli.jpg") GraphicsWindow.DrawImage(image1,0,0) GraphicsWindow.DrawresizedImage(image2,50,50,400,400) ' Andantino de Ferdinando Carulli 1770-1841 ' MESURE 4/4 with F# GraphicsWindow.DrawText(500,300,"Ferdinando Carulli 1770-1841") GraphicsWindow.DrawText(550,400,"Andantino") GraphicsWindow.FontSize=25 GraphicsWindow.DrawText(350,650,"Program and Music Arangement by Yvan Leduc @ 2016") LDMusic.Instrument = LDMusic.Electric_Guitar_clean intro() For reapeat =1 to 2 For M= 1 To 8 ' scores is 16 measure of 4:4 IF M=1 THEN MESURE_1() ElseIf M=2 THEN MESURE_2() ElseIf M=3 THEN MESURE_3() ElseIf M=4 THEN MESURE_4() ElseIf M=5 THEN MESURE_5() ElseIf M=6 THEN MESURE_6() ElseIf M=7 THEN MESURE_7() ElseIf M=8 THEN MESURE_8() Else EndIf For T=1 TO 8 ' soundplaymusic ( accord avant, et la note )on grand piano LDMusic.PlayMusic (a[t]+n[t]) ' ici pour effacer les accords et notes en mémoire de la mesure précédente , si pas jouer dans la mesure active a[t]="" n[t]="" endfor ENDFOR endfor ' section II For M= 9 To 16 ' scores is 16 measure of 4:4 IF M=9 THEN MESURE_9() ElseIf M=10 THEN MESURE_10() ElseIf M=11 THEN MESURE_11() ElseIf M=12 THEN MESURE_12() ElseIf M=13 THEN MESURE_13() ElseIf M=14 THEN MESURE_14() ElseIf M=15 THEN MESURE_15() ElseIf M=16 THEN MESURE_16() Else EndIf For T=1 TO 8 ' soundplaymusic ( accord avant, et la note )on grand piano LDMusic.PlayMusic (a[t]+n[t]) ' ici pour effacer les accords et notes en mémoire de la mesure précédente , si pas jouer dans la mesure active a[t]="" n[t]="" endfor ENDFOR ' octave longueur BASS + NOTE ' O 1-8 L 1-64 C=do D=ré E=mi F=fa G=sol A=la B=si Sub intro LDMusic.PlayMusic ("O3L4 G" +"O4L4 B"+"O5L4 G") Program.Delay(1000) EndSub SUB MESURE_1 a[1]="O3L64 G" +"O4L64 B" n[1]="o5l6 B" n[2]="o4l6 G" a[3]="o3l64 G" +"o4l64 B" n[3]="o5l6 B" n[4]="o5l6 G" a[5]="O3L64 A" +"O4L64 C" n[5]="o5l6 C" n[6]="o4l6 G" a[7]="o3l64 A" +"o4l64 C" n[7]="o5l6 C" n[8]="o4l6 G" ENDSUB SUB MESURE_2 a[1]="O3L64 B" +"O4L64 D" n[1]="o5l6 D" n[2]="o4l6 G" a[3]="o3l64 B" +"o4l64 D" n[3]="o5l5 D" n[4]="o4l5 G" a[5]="O4L64 B" +"O4L64 D" n[5]="o5l2 D" ' un noire n[6]="" 'un silence n[7]="o5l5 E" n[8]="o5l4 F#" ENDSUB SUB MESURE_3 a[1]="O4L64 E" +"O5L64 G" n[1]="o5l6 G" n[2]="o4l6 G" a[3]="o4l64 E" +"o5l64 G" n[3]="o5l6 G" n[4]="o4l6 G" a[5]="O4L64 D" +"O5L64 F#" n[5]="o5l6 F#" n[6]="o4l6 G" a[7]="o4l64 D" +"o5l64 F#" n[7]="o5l6 F#" n[8]="o4l6 G" ENDSUB SUB MESURE_4 a[1]="O4L64 C" +"O5L64 E" n[1]="o5l6 E" n[2]="o4l6 G" a[3]="o4l64 C" +"o5l64 E" n[3]="o5l5 D" ' eu peu de human feeling n[4]="o4l5 G" a[5]="O3L64 B" +"O4L64 D" n[5]="o5l1 D" ' un noire n[6]="" 'un silence n[7]="" 'un silence n[8]="" 'un silence ENDSUB SUB MESURE_5 a[1]="O5L64 C" +"O4L64 A" n[1]="o4l6 A" n[2]="o4l6 D" a[3]="o5l64 C" +"o4l64 A" n[3]="o4l6 A" n[4]="o4l6 D" a[5]="O5L64 C" +"O4L64 A" n[5]="o4l6 A" n[6]="o4l6 D" n[7]="o5l5 E" n[8]="o5l4 D" ENDSUB Sub MESURE_6 a[1]="O5L64 B" +"O4L64 G" n[1]="o4l6 G" n[2]="o4l6 D" a[3]="o5l64 B" +"o4l64 G" n[3]="o4l6 G" n[4]="o4l6 D" a[5]="O5L64 B" +"O4L64 G" n[5]="o4l6 G" n[6]="o4l6 D" n[7]="o5l5 G" n[8]="o5l4 F#" EndSub Sub MESURE_7 n[1]="o4l6 C" n[2]="o5l6 E" n[3]="o4l6 B" n[4]="o5l5 D" n[5]="o4l5 A" n[6]="o5l5 C" n[7]="o4l5 G" n[8]="o5l4 B" EndSub Sub MESURE_8 a[1]="O5L64 B" +"O4L64 D" n[1]="o4l6 D" n[2]="o5l4 C" n[3]="o5l4 C#" n[4]="o5l4 D" a[5]="O4L64 D" +"O4L64 A" n[5]="o4l1 A" n[6]="" n[7]="" n[8]="" EndSub Sub MESURE_9 n[1]="o4l6 D" n[2]="o5l6 C" n[3]="o5l6 F#" n[4]="o5l5 C" n[5]="o4l6 D" n[6]="o5l6 C" n[7]="o5l6 F#" n[8]="o5l5 C" EndSub Sub MESURE_10 n[1]="o4l6 G" n[2]="o5l6 G" n[3]="o4l6 D" n[4]="o5l5 C" n[5]="O4L6 G" n[6]="o4l6 B" n[7]="o4l6 G" n[8]="o4l5 D" EndSub Sub MESURE_11 n[1]="o4l6 D" n[2]="o5l6 C" n[3]="o5l6 F#" n[4]="o5l5 C" n[5]="o4l6 D" n[6]="o5l6 C" n[7]="o5l6 F#" n[8]="o5l5 C" EndSub Sub MESURE_12 n[1]="o4l6 G" n[2]="o5l6 G" n[3]="o4l6 D" n[4]="o5l5 C" n[5]="O4L6 G" n[6]="o4l6 B" n[7]="o4l5 G" n[8]="o4l5 D" ENDSUB Sub MESURE_13 n[1]="o3l6 C" n[2]="o4l6 G" n[3]="o5l6 E" n[4]="o3l6 C" n[5]="O3L6 B" n[6]="o4l6 G" n[7]="o5l6 D" n[8]="o3l5 B" EndSub Sub MESURE_14 n[1]="o3l6 D" n[2]="o4l6 C" n[3]="o5l6 F#" n[4]="o3l5 D" n[5]="O3L6 E" n[6]="o4l6 B" n[7]="o5l5 G" n[8]="o3l5 E" EndSub Sub MESURE_15 n[1]="o4l6 C" n[2]="o5l6 E" n[3]="o4l5 C" n[4]="o4l5 A" a[5]="O4L64 B" +"O4L64 D" n[5]="o4l6 D" n[6]="o5l5 D" a[7]="O4L64 B" +"O4L64 C" n[7]="o4l5 C" n[8]="o4l4 A" EndSub Sub MESURE_16 a[1]="O2L64 G" +"O3L64 B"+"O4L64 G" n[1]="o4l5 B" n[2]="o4l4 G" ' la vitesse diminue pour la fin n[3]="o3l4 D" n[4]="o3l3 G" a[5]="O2L64 G" +"O3L64 B" n[5]="O4L1 G" EndSub End>VQH744-0.sb< Start>VQH744.sb< ' Program by Y LEDUC , March 22th 2016 'for classical guitar but my adaptation for a grand piano ' Andantino de Ferdinando Carulli 1770-1841 ' https://en.wikipedia.org/wiki/Ferdinando_Carulli GraphicsWindow.Top =0 GraphicsWindow.left =0 GraphicsWindow.Height=768 GraphicsWindow.Width=1366 GraphicsWindow.fontname="AR Decode" GraphicsWindow.FontSize=75 GraphicsWindow.BrushColor="#1F41A3" GraphicsWindow.BackgroundColor="#E7D3AD" image1=imagelist.LoadImage( "https://upload.wikimedia.org/wikipedia/commons/1/17/Full_score.jpg") image2=imagelist.LoadImage( "https://upload.wikimedia.org/wikipedia/commons/c/cc/Ferdinando_Carulli.jpg") GraphicsWindow.DrawImage(image1,0,0) GraphicsWindow.DrawresizedImage(image2,50,50,400,400) ' Andantino de Ferdinando Carulli 1770-1841 ' MESURE 4/4 with F# GraphicsWindow.DrawText(500,300,"Ferdinando Carulli 1770-1841") GraphicsWindow.DrawText(550,400,"Andantino") GraphicsWindow.FontSize=25 GraphicsWindow.DrawText(350,650,"Program and Music Arangement by Yvan Leduc @ 2016") intro() For reapeat =1 to 2 For M= 1 To 8 ' scores is 16 measure of 4:4 IF M=1 THEN MESURE_1() ElseIf M=2 THEN MESURE_2() ElseIf M=3 THEN MESURE_3() ElseIf M=4 THEN MESURE_4() ElseIf M=5 THEN MESURE_5() ElseIf M=6 THEN MESURE_6() ElseIf M=7 THEN MESURE_7() ElseIf M=8 THEN MESURE_8() Else EndIf For T=1 TO 8 ' soundplaymusic ( accord avant, et la note )on grand piano sound.PlayMusic (a[t]+n[t]) ' ici pour effacer les accords et notes en mémoire de la mesure précédente , si pas jouer dans la mesure active a[t]="" n[t]="" endfor ENDFOR endfor ' section II For M= 9 To 16 ' scores is 16 measure of 4:4 IF M=9 THEN MESURE_9() ElseIf M=10 THEN MESURE_10() ElseIf M=11 THEN MESURE_11() ElseIf M=12 THEN MESURE_12() ElseIf M=13 THEN MESURE_13() ElseIf M=14 THEN MESURE_14() ElseIf M=15 THEN MESURE_15() ElseIf M=16 THEN MESURE_16() Else EndIf For T=1 TO 8 ' soundplaymusic ( accord avant, et la note )on grand piano sound.PlayMusic (a[t]+n[t]) ' ici pour effacer les accords et notes en mémoire de la mesure précédente , si pas jouer dans la mesure active a[t]="" n[t]="" endfor ENDFOR ' octave longueur BASS + NOTE ' O 1-8 L 1-64 C=do D=ré E=mi F=fa G=sol A=la B=si Sub intro sound.PlayMusic ("O3L4 G" +"O4L4 B"+"O5L4 G") Program.Delay(1000) EndSub SUB MESURE_1 a[1]="O3L64 G" +"O4L64 B" n[1]="o5l6 B" n[2]="o4l6 G" a[3]="o3l64 G" +"o4l64 B" n[3]="o5l6 B" n[4]="o5l6 G" a[5]="O3L64 A" +"O4L64 C" n[5]="o5l6 C" n[6]="o4l6 G" a[7]="o3l64 A" +"o4l64 C" n[7]="o5l6 C" n[8]="o4l6 G" ENDSUB SUB MESURE_2 a[1]="O3L64 B" +"O4L64 D" n[1]="o5l6 D" n[2]="o4l6 G" a[3]="o3l64 B" +"o4l64 D" n[3]="o5l5 D" n[4]="o4l5 G" a[5]="O4L64 B" +"O4L64 D" n[5]="o5l2 D" ' un noire n[6]="" 'un silence n[7]="o5l5 E" n[8]="o5l4 F#" ENDSUB SUB MESURE_3 a[1]="O4L64 E" +"O5L64 G" n[1]="o5l6 G" n[2]="o4l6 G" a[3]="o4l64 E" +"o5l64 G" n[3]="o5l6 G" n[4]="o4l6 G" a[5]="O4L64 D" +"O5L64 F#" n[5]="o5l6 F#" n[6]="o4l6 G" a[7]="o4l64 D" +"o5l64 F#" n[7]="o5l6 F#" n[8]="o4l6 G" ENDSUB SUB MESURE_4 a[1]="O4L64 C" +"O5L64 E" n[1]="o5l6 E" n[2]="o4l6 G" a[3]="o4l64 C" +"o5l64 E" n[3]="o5l5 D" ' eu peu de human feeling n[4]="o4l5 G" a[5]="O3L64 B" +"O4L64 D" n[5]="o5l1 D" ' un noire n[6]="" 'un silence n[7]="" 'un silence n[8]="" 'un silence ENDSUB SUB MESURE_5 a[1]="O5L64 C" +"O4L64 A" n[1]="o4l6 A" n[2]="o4l6 D" a[3]="o5l64 C" +"o4l64 A" n[3]="o4l6 A" n[4]="o4l6 D" a[5]="O5L64 C" +"O4L64 A" n[5]="o4l6 A" n[6]="o4l6 D" n[7]="o5l5 E" n[8]="o5l4 D" ENDSUB Sub MESURE_6 a[1]="O5L64 B" +"O4L64 G" n[1]="o4l6 G" n[2]="o4l6 D" a[3]="o5l64 B" +"o4l64 G" n[3]="o4l6 G" n[4]="o4l6 D" a[5]="O5L64 B" +"O4L64 G" n[5]="o4l6 G" n[6]="o4l6 D" n[7]="o5l5 G" n[8]="o5l4 F#" EndSub Sub MESURE_7 n[1]="o4l6 C" n[2]="o5l6 E" n[3]="o4l6 B" n[4]="o5l5 D" n[5]="o4l5 A" n[6]="o5l5 C" n[7]="o4l5 G" n[8]="o5l4 B" EndSub Sub MESURE_8 a[1]="O5L64 B" +"O4L64 D" n[1]="o4l6 D" n[2]="o5l4 C" n[3]="o5l4 C#" n[4]="o5l4 D" a[5]="O4L64 D" +"O4L64 A" n[5]="o4l1 A" n[6]="" n[7]="" n[8]="" EndSub Sub MESURE_9 n[1]="o4l6 D" n[2]="o5l6 C" n[3]="o5l6 F#" n[4]="o5l5 C" n[5]="o4l6 D" n[6]="o5l6 C" n[7]="o5l6 F#" n[8]="o5l5 C" EndSub Sub MESURE_10 n[1]="o4l6 G" n[2]="o5l6 G" n[3]="o4l6 D" n[4]="o5l5 C" n[5]="O4L6 G" n[6]="o4l6 B" n[7]="o4l6 G" n[8]="o4l5 D" EndSub Sub MESURE_11 n[1]="o4l6 D" n[2]="o5l6 C" n[3]="o5l6 F#" n[4]="o5l5 C" n[5]="o4l6 D" n[6]="o5l6 C" n[7]="o5l6 F#" n[8]="o5l5 C" EndSub Sub MESURE_12 n[1]="o4l6 G" n[2]="o5l6 G" n[3]="o4l6 D" n[4]="o5l5 C" n[5]="O4L6 G" n[6]="o4l6 B" n[7]="o4l5 G" n[8]="o4l5 D" ENDSUB Sub MESURE_13 n[1]="o3l6 C" n[2]="o4l6 G" n[3]="o5l6 E" n[4]="o3l6 C" n[5]="O3L6 B" n[6]="o4l6 G" n[7]="o5l6 D" n[8]="o3l5 B" EndSub Sub MESURE_14 n[1]="o3l6 D" n[2]="o4l6 C" n[3]="o5l6 F#" n[4]="o3l5 D" n[5]="O3L6 E" n[6]="o4l6 B" n[7]="o5l5 G" n[8]="o3l5 E" EndSub Sub MESURE_15 n[1]="o4l6 C" n[2]="o5l6 E" n[3]="o4l5 C" n[4]="o4l5 A" a[5]="O4L64 B" +"O4L64 D" n[5]="o4l6 D" n[6]="o5l5 D" a[7]="O4L64 B" +"O4L64 C" n[7]="o4l5 C" n[8]="o4l4 A" EndSub Sub MESURE_16 a[1]="O2L64 G" +"O3L64 B"+"O4L64 G" n[1]="o4l5 B" n[2]="o4l4 G" ' la vitesse diminue pour la fin n[3]="o3l4 D" n[4]="o3l3 G" a[5]="O2L64 G" +"O3L64 B" n[5]="O4L1 G" EndSub End>VQH744.sb< Start>VQH845.sb< Controls.ButtonClicked = OnButtonClick M0 = Controls.AddButton("E N D E", 200, 1) M1 = Controls.AddButton("Zeichnen", 1, 1) M2 = Controls.AddButton("Qadrat", 10, 28) Controls.HideControl(M2) B2 = "OFF" M3 = Controls.AddButton("Qadrat 80x80", 20, 55) Controls.HideControl(M3) B3 = "OFF" Ende = 1 While Ende = 1 endwhile Program.End() Sub OnButtonClick ButtonClickEventID = 0 ButtonClickName = Controls.LastClickedButton If ButtonClickName = M0 Then Ende = 0 EndIf If ButtonClickName = M1 Then If B2 = "ON" Then Controls.HideControl(M2) B2 = "OFF" Else Controls.ShowControl(M2) B2 = "ON" EndIf If B3 = "ON" Then Controls.HideControl(M3) B3 = "OFF" EndIf EndIf If ButtonClickName = M2 Then If B3 = "ON" Then Controls.HideControl(M3) B3 = "OFF" Else Controls.ShowControl(M3) B3 = "ON" EndIf EndIf If ButtonClickName = M3 Then For i = 1 To 10 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(200,150,80,80) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(200,150,80,80) Program.Delay(50) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(200,150,80,80) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(200,150,80,80) Program.Delay(25) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(200,150,80,80) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(200,150,80,80) Program.Delay(15) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(200,150,80,80) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(200,150,80,80) Program.Delay(10) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(200,150,80,80) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(200,150,80,80) EndFor EndIf EndSub 'OnButtonClick End>VQH845.sb< Start>VQJ436.sb< '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 'Train is a simple PC based simulator used for conducting basic 'excersises in directional drilling. ' Designed and prepared by Angus L Jamieson June 1993 ' Converted to Small Basic by Micheal Lanham December 2010 '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 'INITIALIZATION bha = 0 'DEFAULT inclination = 0 'up to date well attitude direction = 0 ander = 0 spin = 0 ob = 1 wd[1][ 1] = 0 wd[1][2] = 0 wd[1][3] = 0 wd[1][4] = 0 wd[1][5] = 0 wd[1][6] = 0 andrex = 1 'Screen 12, 0: CLS --- graphic window init GraphicsWindow.Title = "Drilling Simulator" GraphicsWindow.Width = 1024 GraphicsWindow.Height = 768 GraphicsWindow.CanResize = "false" GraphicsWindow.Clear() GraphicsWindow.Show() debug = "off" xScale = GraphicsWindow.Width/46.1 '21 yScale = GraphicsWindow.Height/35 '20.5 If xScale > yScale then rscale = yScale else rscale = xScale endif GraphicsWindow.FontSize = 12 * GraphicsWindow.Height/480 bStr = "None" GraphicsWindow.KeyUp = Await 'On Error GoTo smack p1 = 3.1415936 / 180 'degrees radians convertor maxrpm = 200 maxwob = 100 '1000 lbs MWOB = 0 'CHECK MAX TORQUE DURING FIRST 2 DEGS OF BUILD maxmud = 200 mud = 0 'initial setting for mud pumps toolsav = 3 'both MWD and SRG tf = 0 rotary = 1 Weight = 0 son = 1 startdepth = 615 holedepth = startdepth rotgear = 1 'DRILL FLOOR UNLOCKED liftgear = 1 'direction downhole 'assigned variables BUNG = 0 md = 0 binc = 0 hit = 0 SetColors() Chars() Layout() Gears() If bha = 0 Then 'BhaSetup() endif Sub Await bStr = GraphicsWindow.LastKey 'TextWindow.WriteLine(bStr) endsub Sub SetColors BGColor = GraphicsWindow.GetColorFromRGB(0,0,255) FRColor = GraphicsWindow.GetColorFromRGB(255,255,255) LFRColor = GraphicsWindow.GetColorFromRGB(128,128,128) LBGColor = GraphicsWindow.GetColorFromRGB(64,64,64) TXColor = GraphicsWindow.GetColorFromRGB(255,255,255) TXSHColor = GraphicsWindow.GetColorFromRGB(64,64,64) Color0 = GraphicsWindow.GetColorFromRGB(0,0,0) Color1 = GraphicsWindow.GetColorFromRGB(0,0,255) Color2 = GraphicsWindow.GetColorFromRGB(0,255,0) Color3 = GraphicsWindow.GetColorFromRGB(0,255,255) 'CYAN Color4 = GraphicsWindow.GetColorFromRGB(170,0,0) Color5 = GraphicsWindow.GetColorFromRGB(255,0,255) Color7 = GraphicsWindow.GetColorFromRGB(222,222,222) Color8 = GraphicsWindow.GetColorFromRGB(128,128,128) Color9 = GraphicsWindow.GetColorFromRGB(64,64,255) Color10 = GraphicsWindow.GetColorFromRGB(128,255,128) Color11 = GraphicsWindow.GetColorFromRGB(100,255,255) Color12 = GraphicsWindow.GetColorFromRGB(128,64,64) Color13 = GraphicsWindow.GetColorFromRGB(255,100,255) Color14 = GraphicsWindow.GetColorFromRGB(255,255,0) Color15 = GraphicsWindow.GetColorFromRGB(255,255,255) Color16 = GraphicsWindow.GetColorFromRGB(128,128,150) Color17 = GraphicsWindow.GetColorFromRGB(64,64,64) endsub Sub Layout GraphicsWindow.Clear() GraphicsWindow.BrushColor = BGColor GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,GraphicsWindow.Height) GraphicsWindow.PenColor = FRColor GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawRectangle(2,2,GraphicsWindow.Width-2,GraphicsWindow.Height-2) createHandle = "true" openWindowStack = "openwindow" gauges: aStr = "JTS DRILLING SIMULATOR H=HELP ESC=EXIT" lx0 = (-8 + 32) * xScale '-8 ly0 = (24 - 22.4) * yScale '22.4 lx = 0.5 * xScale ly = .8 * yScale Label() StartSelect() r = 4 * rscale cx = (-25 + 32) * xScale cy = (24 - 18) * yScale minv = 0 maxv = 200 iv = 10 Gauge() aStr = "ROTARY R.P.M." lx0 = (-29 + 32) * xScale '-29 ly0 = (24 - 12.1) * yScale '12.1 lx = 0.6 * xScale '.6 ly = 1 * yScale '1 Label() r = 5.6 * rscale cx = (-13.86 + 32) * xScale cy = (24 - 17.65) * yScale minv = 0 maxv = 100 iv = 1 Gauge() aStr = "Weight on BIT" lx0 = (-17 + 32) * xScale '-17 ly0 = (24 - 23) * yScale '23 lx = 0.4 * xScale '.4 ly = 0.6 * yScale '.6 Label() r = 4 * rscale cx = (-25 + 32) * xScale cy = (24 - 5) * yScale minv = 0 maxv = 5000 iv = 100 Gauge() aStr = "DRILL PIPE PSI" lx0 = (-29 + 32) * xScale '-29 ly0 = (24 - -1) * yScale '-1 lx = 0.6 * xScale '.6 ly = 1 * yScale '1 Label() r = 2.5 * rscale cx = (-27 + 32) * xScale cy = (24 - -6) * yScale minv = 0 maxv = maxmud iv = 10 Gauge() r = 2.5 * rscale cx = (-21.5 + 32) * xScale cy = (24 - -6) * yScale Gauge() aStr = "MUD PUMPS S.P.M" lx0 = (-29 + 32) * xScale ly0 = (24 - -10.5) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "SURVEY DATA" lx0 = (-17 + 32) * xScale ly0 = (24 - -11) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() SURVEY() Box() endsub Sub Box 'DRILL FLOOR BOX 'Line (-8.5, -8.5)-(8.5, 16.6), 14, BF x0 = -8.5 y0 = -8.5 X1 = 8.5 Y1 = 16.6 gfxcolor = Color14 FillRectangleConvert() 'Line (-8, -8)-(8, 16.1), 0, BF x0 = -8.0 y0 = -8.0 X1 = 8.0 Y1 = 16.1 gfxcolor = Color0 FillRectangleConvert() DY = 4 'Line (-8.5, -8.5)-(-8, -8), DY x0 = -8.5 y0 = -8.5 X1 = -8.0 Y1 = -8.0 gfxcolor = Color4 DrawLineConvert() 'Line -(-8, 16), DY x0 = -8.0 y0 = -8.0 X1 = -8.0 Y1 = 16.0 gfxcolor = Color4 DrawLineConvert() 'Line -(8, 16), DY x0 = -8.0 y0 = 16 X1 = 8.0 Y1 = 16 gfxcolor = Color4 DrawLineConvert() 'Line -(8.5, 16.6), DY x0 = 8.0 y0 = 16 X1 = 8.5 Y1 = 16.6 gfxcolor = Color4 DrawLineConvert() 'Line -(-8.5, 16.6), DY x0 = 8.5 y0 = 16.6 X1 = -8.5 Y1 = 16.6 gfxcolor = Color4 DrawLineConvert() 'Line -(-8.5, -8.5), DY x0 = -8.5 y0 = 16.6 X1 = -8.5 Y1 = -8.5 gfxcolor = Color4 DrawLineConvert() 'PAINT (-8.2, 16.2), DY aStr = "DRILL FLOOR WINDOW" lx0 = -5 ly0 = -9.7 ly = 1 lx = 0.6 ConvertLabel() Label() 'stars For i = 0 To 50 X = -8 + Math.GetRandomNumber(16) '16 * Rnd Y = 6 + Math.GetRandomNumber(10) '10 * RND X = (X + 32) * xScale Y = (24 - Y) * yScale GraphicsWindow.PenColor = Color15 GraphicsWindow.DrawLine(x,y,x+.5,y+.5) GraphicsWindow.PenColor = Color14 GraphicsWindow.DrawLine(x-.5,y-.5,x,y) 'Line (X, Y)-(X, Y), 15 endfor 'Line (-8, -8)-(8, 6), 2, BF x0 = -8 y0 = -8 X1 = 8 Y1 = 6 gfxcolor = Color2 FillRectangleConvert() shadow: 'Line (-1.25, 0)-(6, 6), 8 x0 = -1.25 y0 = 0 X1 = 6 Y1 = 6 gfxcolor = Color8 DrawLineConvert() 'Line -(6.6, 6), 8 x0 = 6 y0 = 6 X1 = 6.6 Y1 = 6 gfxcolor = Color8 DrawLineConvert() 'Line -(0, -1.5), 8 x0 = 6.6 y0 = 6 X1 = 0 Y1 = -1.5 gfxcolor = Color8 DrawLineConvert() 'Line -(-1.25, 0), 8 x0 = 0 y0 = -1.5 X1 = -1.25 Y1 = 0 gfxcolor = Color8 DrawLineConvert() 'PAINT (0, 0), 8 x0 = -1.25 Y0 = 0 X1 = 6 Y1 = 6 X2 = 0 Y2 = -1.5 gfxcolor = Color8 FillTriangleConvert() x0 = 0 Y0 = -1.5 X1 = 6.6 Y1 = 6 X2 = 6 Y2 = 6 gfxcolor = Color8 FillTriangleConvert() ARROW: 'save up just now 'Line (0, -6.3)-(0, -5.3), 15 GraphicsWindow.PenWidth = 2 x0 = 0 y0 = -6.3 X1 = 0 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() GraphicsWindow.PenWidth = 1 x0 = 0 y0 = -6.3 X1 = 0 Y1 = -5.3 gfxcolor = Color15 DrawLineConvert() GraphicsWindow.PenWidth = 2 'Line -(-1, -5.3), 15 x0 = 0 y0 = -5.3 X1 = -1 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() 'Line -(0, -3.3), 15 x0 = -1 y0 = -5.3 X1 = 0 Y1 = -3.3 gfxcolor = Color8 DrawLineConvert() 'Line -(1, -5.3), 15 x0 = 0 y0 = -3.3 X1 = 1 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() 'Line -(0, -5.3), 15 x0 = 1 y0 = -5.3 X1 = 0 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() GraphicsWindow.PenWidth = 1 x0 = -1 Y0 = -5.3 X1 = 1 Y1 = -5.3 X2 = 0 Y2 = -3.3 gfxcolor = Color15 FillTriangleConvert() 'PAINT (0, -4.4), 15 Y = 6 For D = 12 To 3 Step -1 'Line (-8, Y)-(8, Y), 3 x0 = -8 y0 = y X1 = 8 Y1 = y gfxcolor = Color3 DrawLineConvert() Y = Y - 9 / D endfor For i = 0 To 8 X1 = 2 * i Y1 = -8 If X1 > 8 Then Y1 = (X1 - 8) / (i + 0.0001) * 14 - 8 X1 = 8 EndIf sx1 = X1 sy1 = y1 'Line (-X1, Y1)-(-i, 6), 3 x0 = -sx1 y0 = sy1 X1 = -i Y1 = 6 gfxcolor = Color3 DrawLineConvert() 'Line (X1, Y1)-(i, 6), 3 x0 = sx1 y0 = sy1 X1 = i Y1 = 6 gfxcolor = Color3 DrawLineConvert() EndFor 'Line (-8, -8)-(8, 16.1), 15, B x0 = -8 y0 = -8 X1 = 8 Y1 = 16.1 gfxcolor = Color15 DrawRectangleConvert() FLOOR() 'HOLE() DRILL() aStr = "B.H.A Now Running: " lx0 = 1.4 ly0 = -6.4 lx = 0.37 ly = 0.9 ConvertLabel() Label() 'LOCATE 26, 71: Print " " 'LOCATE 26, 72: Print bha astr = "" If bha = 6 Or (bha = 8 And andrex = 1) Then If ander = 1 Then aStr = "F" endif If ander = 0 Then aStr = "U" endif EndIf 'LOCATE 26, 74: Print a$ X = 71 Y = 25 aStr = bha + " " + aStr gfxcolor = Color1 BuildTextShapeConvert() aStr = "BRAKE" lx0 = 9 ly0 = 15 lx = 0.5 ly = 0.8 ConvertLabel() Label() aStr = "OFF" lx0 = 9 ly0 = 13 lx = 0.5 ly = 0.8 ConvertLabel() label1() aStr = " ON" lx0 = 9 ly0 = -3 lx = 0.5 ly = 0.8 ConvertLabel() label1() 'Line (9, -1)-(11, -1), 12 'Line -(9, 12), 12 'Line -(9, -1), 12 'PAINT (10, 3), 12 x0 = 9 Y0 = -1 X1 = 11 Y1 = -1 X2 = 9 Y2 = 12 gfxcolor = Color12 FillTriangleConvert() 'Line (9, 12)-(11, 12), 10 'Line -(11, -1), 10 'Line -(9, 12), 10 'PAINT (10, 7), 10 x0 = 9 Y0 = 12 X1 = 11 Y1 = 12 X2 = 11 Y2 = -1 gfxcolor = Color10 FillTriangleConvert() brake = 1 L = (1 - brake) * 13 - 1 'GET (7, L)-(12, L + 1), h'get old background at handle position Lasthandle = L Handle() endsub sub Handle 'PUT (7, Lasthandle), h, PSET 'replace background L = (1 - brake) * 13 - 1 'GET (7, L)-(12, L + 1), h'get old background at new handle position If createHandle = "true" then i = 1 'Line (8 + 0.5, L)-(9, L + 0.5), 0, BF x0 = 8 + .5 y0 = L X1 = 9 Y1 = L + .5 gfxcolor = Color0 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() 'Line (11, L)-(11, L + 0.5), 0 'Line -(12, L), 0 'Line -(11, L), 0 'PAINT (11 + .5, L + .1), 0 x0 = 11 Y0 = L X1 = 11 Y1 = L+.5 X2 = 12 Y2 = L gfxcolor = Color0 BuildTriangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() 'Line (8, L)-(8 + 0.5, L + 0.5), 4, BF x0 = 8 y0 = L X1 = 8 + .5 Y1 = L + .5 gfxcolor = Color0 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() 'Line (8, L)-(8, L + 0.5), 0 x0 = 8 y0 = L X1 = 8 Y1 = L + .5 gfxcolor = Color0 BuildLineShapeConvert() AddHandleShape() 'Line (9, L)-(9 + 2 * brake, L + 0.5), 4, BF x0 = 9 y0 = L X1 = 9 + 2*brake Y1 = L + .5 gfxcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() 'Line (9 + 2 * brake, L)-(11, L + 0.5), 2, BF x0 = 9+2*brake y0 = L X1 = 11 Y1 = L + .5 gfxcolor = Color2 BuildRectangleShapeConvert() AddHandleShape() hp = 13 'Line (7, L + 0.5)-(11, L + 1), hp, BF x0 = 7 y0 = L + .5 X1 = 11 Y1 = L + 1 gfxcolor = Color13 BuildRectangleShapeConvert() AddHandleShape() 'Line (11, L + 1)-(12, L + 0.5), hp 'Line -(12, L), hp 'Line -(11, L + 0.5), hp 'PAINT (11.5, L + .5), hp x0 = 11 Y0 = L + 1 X1 = 12 Y1 = L + .5 X2 = 11 Y2 = L + .5 gfxcolor = Color13 BuildTriangleShapeConvert() AddHandleShape() x0 = 11 Y0 = L + .5 X1 = 12 Y1 = L + .5 X2 = 12 Y2 = L gfxcolor = Color13 BuildTriangleShapeConvert() AddHandleShape() 'Line (7, L + 0.5)-(7, L + 1), 15 x0 = 7 y0 = L + .5 X1 = 7 Y1 = L + 1 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() 'Line -(11, L + 1), 15 x0 = 7 y0 = L + 1 X1 = 11 Y1 = L + 1 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() 'Line -(12, L + 0.5), 15 x0 = 11 y0 = L + 1 X1 = 12 Y1 = L + .5 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() createHandle = "false" handleShapeCnt = i endif 'brake = .8 L = (1 - brake) * 13 - 1 ly0 = (24 - -1) * yScale 'starting point ly1 = (24 - L) * yScale lyMove = (ly1 - ly0) 'TextWindow.WriteLine(ly1 + "<" + ly0) If lyMove <> 0 then For i = 1 to handleShapeCnt shape = handleShapes[i]["Name"] X = handleShapes[i]["Left"] Y = handleShapes[i]["Top"] + lyMove 'TextWindow.WriteLine(shape + "," + X + "," + Y) Shapes.Move(shape,x,y) endfor endif Lasthandle = L endsub Sub AddHandleShape handleShapes[i]["Name"] = shape handleShapes[i]["Top"] = Shapes.GetTop(shape) handleShapes[i]["Left"] = Shapes.GetLeft(shape) i = i + 1 endsub Sub FLOOR 'SHADOW For i = 125 To 40 Step -0.2 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) 'Line (X, Y - 1)-(X + 0.3, Y - 0.6), 8 x0 = X y0 = Y - 1 X1 = X + .3 Y1 = Y - .6 gfxcolor = Color8 DrawLineConvert() endfor For i = 0 To 360 Step .25 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) If i = 0 Then 'Line (X, Y)-(X, Y), 1 x0 = X y0 = Y X1 = X Y1 = Y shx = X shy = y gfxcolor = Color1 DrawLineConvert() endif 'Line -(X, Y), 1 x0 = shx y0 = shy X1 = X Y1 = Y gfxcolor = Color1 'debug = "on" 'GraphicsWindow.PenWidth = 2 DrawLineConvert() endfor 'PAINT (0, 0), 1 'GraphicsWindow.PenWidth = 1 For i = 0 To 38 Step .25 j = i * p1 X = 5 * Math.Sin(j) Y = 2.55 * Math.Cos(j) If i = 0 Then 'Line (0, 0)-(X, Y), 0 x0 = .95 y0 = -.15 X1 = X Y1 = Y shx = x0 shy = y0 gfxcolor = Color17 DrawLineConvert() endif 'Line -(X, Y), 0 x0 = shx y0 = shy X1 = X Y1 = Y gfxcolor = Color17 DrawLineConvert() endfor shx = X shy = Y 'Line -(1.3, -0.3), 0 x0 = shx y0 = shy X1 = 1.3 Y1 = -.3 gfxcolor = Color8 'DrawLineConvert() 'Line -(0, 0), 0 x0 = 1.3 y0 = -.3 X1 = 0 Y1 = 0 gfxcolor = Color8 'DrawLineConvert() 'PAINT (1, 1), 0 For i = 270 To 90 Step -0.3 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) pp = Color4 If i > 130 Then pp = Color12 endif 'Line (X, Y)-(X, Y - 1), pp x0 = x y0 = Y X1 = X Y1 = Y-1 gfxcolor = pp DrawLineConvert() EndFor endsub Sub DRILL r = 1.25 'Line (r, 16)-(r, 0), 9 x0 = r y0 = 16 X1 = r Y1 = 0 gfxcolor = Color1 'DrawLineConvert() shx = r shy = 0 For i = 90 To 270 'Line -(r * Sin(i * p1), 0.5 * r * Cos(i * p1)), 9 x0 = shx y0 = 16 X1 = r * Math.Sin(i * p1) Y1 = 0.5 * r * Math.Cos(i * p1) shx = x1 shy = y1 gfxcolor = Color9 'debug = "on" DrawLineConvert() 'debug = "off" endfor 'Line -(-r, 16), 9 'Line -(r, 16), 9 'PAINT (0, 4), 9 endsub sub StartSelect errorSelect: x0 = -24 y0 = 3 X1 = -1 Y1 = 10.5 OpenWindow() QB = 1.16 B = 2 a = 9 + B 'Line (-20.9, 18.2 - QB * a)-(-7.1, 19.3 - QB * a), 12, B x0 = -19.9 y0 = 18.2-QB*a X1 = -6.1 Y1 = 19.3-QB*a gfxcolor = Color8 gfxPcolor = Color14 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) Stack.PushValue(openWindowStack,shape) highlight = shape 'Color 13: LOCATE 13, 18: gfxcolor = Color13 X = 22 Y = 12 aStr = "Please Select Starting Point" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) 'Color 11 gfxcolor = Color11 'LOCATE 15, 21: Print " Previous Status " 'LOCATE 16, 21: Print " NEW " X = 25 Y = 14 aStr = " Previous Status" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) X = 25 Y = 15 aStr = " NEW" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) startsel: if bStr = "None" Then Goto startsel endif If bStr = "Up" And B <> 1 Then B = B - 1 hmove = -1.167 * yScale X = Shapes.GetLeft(highlight) Y = Shapes.GetTop(highlight)+hmove 'TextWindow.WriteLine(X + "," + Y + "," + hmove) Shapes.Move(highlight,x,y) EndIf If bStr = "Down" And B <> 2 Then B = B + 1 hmove = 1.167 * yScale X = Shapes.GetLeft(highlight) Y = Shapes.GetTop(highlight)+hmove 'TextWindow.WriteLine(X + "," + Y + "," + hmove) Shapes.Move(highlight,x,y) endif 'TextWindow.WriteLine(bStr) If bStr = "Return" Then GoTo accepted3 endif GoTo startsel accepted3: SHUTWINDOW() If stuck = 0 Then SHUTWINDOW() endif If B = 1 Then 'recover data If Text.GetLength(simStr) < 4 Then simStr = "status.sim" EndIf 'Open sim$ For Input As #gg fileText = "" line = 1 ' The following line could be harmful and has been automatically commented. ' fileText = File.ReadLine(simStr,line) 'TextWindow.WriteLine(fileText) line = line + 1 If fileText = "" Then 'error GraphicsWindow.ShowMessage("File " + simStr + " cannot be found.","No File") Goto errorselect endif SplitFileCommaString() 'Input #gg, inclination = split[1] direction = split[2] holedepth = split[3] BD = split[4] md = split[5] bha = split[6] back = split[7] toolsav = split[8] ob = split[9] rotary = split[10] spin = split[11] rotgear = split[12] liftgear = split[13] toolorient = split[14] tf = split[15] startdepth = split[16] mud = split[17] ander = split[18] 'For i = 1 To 18 'TextWindow.Write(split[i] + ",") 'EndFor MEASUREDDEPTH = md tch: If toolsav = 1 Then surtool = 1 Else surtool = 2 'MWD unless SRG only endif For i = 1 To ob For j = 1 To 6 'Input #gg, wd(i, j) ' The following line could be harmful and has been automatically commented. ' wd[i][j] = File.ReadLine(simStr,line) line = line + 1 endfor endfor nobs = ob ' calculate XYZ 'wd(1, 4) = 0: wd(1, 5) = 0: wd(1, 6) = 0 wd[1][4] = 0 wd[1][5] = 0 wd[1][6] = 0 For ob = 1 To nobs - 1 'Call SURVEY(wd(), ob) EndFor ob = nobs 'GoTo nold1 Else exn = 1 'GoSub exselect If B = 5 Then exn = 2 stuck = 1 'GoSub exselect stuck = B simStr = "Stuck" + stuck + ".sim" B = 1 GoTo accepted3 EndIf EndIf 'GoSub getex endsub sub SplitFileCommaString For i = 1 to Text.GetLength(fileText) str = Text.GetSubText(fileText,i,1) 'TextWindow.Write(str) If str = "," Then j = j + 1 Else split[j] = Text.Append(split[j],str) EndIf endfor 'TextWindow.WriteLine(" ") endsub Sub SHUTWINDOW While Stack.GetCount(openWindowStack) > 0 shape = Stack.PopValue(openWindowStack) Shapes.Remove(shape) endwhile endsub Sub Label w = (Text.GetLength(aStr) + 1 ) * lx h = 1.5 * ly GraphicsWindow.BrushColor = Color0 GraphicsWindow.FillRectangle(lx0 - .5 * lx + 2, ly0 + 2 - h, w , h ) ' Line (lx0 - 0.5 * lx + 0.2, ly0 - 0.2)-(lx0 - 0.5 * lx + 0.2 + w, ly0 - 0.2 + h), 0, BF GraphicsWindow.BrushColor = Color8 GraphicsWindow.FillRectangle(lx0 - .5 * lx, ly0 - h, w, h) 'Line (lx0 - 0.5 * lx, ly0)-(lx0 - 0.5 * lx + w, ly0 + h), 4, BF shd = 1 GraphicsWindow.PenWidth = 1.5 GraphicsWindow.PenColor = Color15 GraphicsWindow.DrawRectangle(lx0 - .5 * lx, ly0 - h, w, h) 'Line (lx0 - 0.5 * lx, ly0)-(lx0 - 0.5 * lx + w, ly0 + h), 15, B GraphicsWindow.PenWidth = 1 ly0 = ly0 + 0.3 * h - h/2 label1() shd = 0 endsub Sub ConvertLabel lx0 = (lx0 + 32) * xScale ly0 = (24 - ly0) * yScale lx = lx * xScale ly = ly * yScale endsub sub label1 'TextWindow.WriteLine("Test Output") keeplx0 = lx0 keeply0 = ly0 For ofst = shd To 0 Step -1 'TextWindow.WriteLine(" enter offset = " + ofst ) If ofst = 0 then GraphicsWindow.PenColor = Color15 GraphicsWindow.PenWidth = ly / 13 Else GraphicsWindow.PenColor = Color0 GraphicsWindow.PenWidth = ly / 13 EndIf 'lp = 15 * (1 - ofst) lx0 = keeplx0 ly0 = keeply0 For LABI = 1 To Text.GetLength(aStr) LABC = Text.GetCharacterCode(Text.GetSubText(aStr, LABI, 1)) 'TextWindow.WriteLine(" letter = " + Text.GetSubText(aStr, LABI, 1) + " , " + LABC ) For LABJ = 1 To GH[LABC][1] 'TextWindow.WriteLine(" steps = " + GH[LABC][1] ) LABJ1 = LABJ * 3 ch1 = lx * GH[LABC][LABJ1 - 1] / 12 CH2 = ly * GH[LABC][LABJ1] / 12 X = lx0 + ch1 + ofst '* 0.07 Y = ly0 - CH2 + ofst '* 0.07 'TextWindow.WriteLine(" " + x + "," + y) If GH[LABC][LABJ1 + 1] = 1 Then GraphicsWindow.DrawLine(x,y,x,y) 'Line (X, Y)-(X, Y), lp oldx = X oldy = y endif GraphicsWindow.DrawLine(oldx,oldy,x,y) 'Line -(X, Y), lp oldx = X oldy = y endfor 'LABJ lx0 = lx0 + lx EndFor 'LABI endfor 'ofst GraphicsWindow.PenWidth = 1 EndSub Sub Gauge If r = 5.6 Then EXTRA = 19 Else EXTRA = 0 endif r1 = r X1 = cx + .3 * rscale Y1 = cy + .3 * rscale gfxcolor = Color0 FillCircle() 'P = 0: GOSUB cir: PAINT (cx, cy), 0 X1 = cx Y1 = cy gfxcolor = Color12 FillCircle() 'P = 12: GOSUB cir: PAINT (cx, cy), P r1 = .9 * r gfxcolor = Color8 FillCircle() 'P = 8: GOSUB cir: PAINT (cx, cy), P r1 = r gfxcolor = Color15 DrawCircle()'P = 15: GoSub cir r1 = 0.9 * r gfxcolor = Color1 DrawCircle()'P = 1: GoSub cir r1 = .2 * r gfxcolor = Color14 FillCircle() 'P = 14: GOSUB cir: PAINT (cx, cy), P 'numbers s = 300 / (maxv - minv) c = 0 For i = minv To maxv + EXTRA Step iv labit = 0 q = 0.06 * r If Math.Remainder(c,5) = 0 Then q = 1.5 * q EndIf If Math.Remainder(c,10) = 0 Then q = 1.5 * q labit = 1 endif a = (-150 + s * (i - minv)) * p1 'angle r1 = 0.86 * r r2 = r1 - q lp = 14 If i > maxv Then gfxColor = Color12 'lp = 12 Else gfxcolor = Color14 endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(cx + r1 * Math.Sin(a), cy - r1 * Math.Cos(a),cx + r2 * Math.Sin(a), cy - r2 * Math.Cos(a)) 'Line (cx + r1 * Sin(a), cy + r1 * Cos(a))-(cx + r2 * Sin(a), cy + r2 * Cos(a)), lp If labit = 1 And i <= maxv Then 'a$ = LTrim$(RTrim$(Str$(i))) aStr = i lx = 0.09 * r ly = 0.12 * r lx0 = cx + 0.6 * r * Math.Sin(a) - 0.6 * lx * Text.GetLength(aStr) ly0 = cy - 0.6 * r * Math.Cos(a) + 0.6 * ly Label1() endif c = c + 1 endfor G = G + 1 'gauge counter gag[G][1] = r gag[G][2] = cx gag[G][3] = cy gag[G][4] = minv gag[G][5] = maxv gag[G][6] = 0 'first value newval = 0 Needle() 'If EXTRA > 0 Then LOCATE 6, 31: Print " " endsub Sub Needle gfxColor = color8 ' P = 8 v = gag[G][6] Needpos() gfxColor = Color12 'P = 12 v = newval Needpos() gag[G][6] = newval EndSub sub Needpos a = (-150 + 300 * (v - gag[G][4]) / (gag[G][5] - gag[G][4])) * p1 'angle X = gag[G][2] Y = gag[G][3] r = gag[G][1] X1 = X + 0.4 * r * Math.Sin(a) Y1 = Y - 0.4 * r * Math.Cos(a) X2 = X + 0.22 * r * Math.Sin(a - 0.15) Y2 = Y - 0.22 * r * Math.Cos(a - 0.15) x3 = X + 0.22 * r * Math.Sin(a + 0.15) y3 = Y - 0.22 * r * Math.Cos(a + 0.15) GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(X1,Y1,X2,Y2) ' Line (X1, Y1)-(X2, Y2), P GraphicsWindow.DrawLine(x2,y2,x3,y3) 'Line -(x3, y3), P GraphicsWindow.DrawLine(x3,y3,x1,y1) 'Line -(X1, Y1), P endsub sub Gears aStr = "ROTARY TABLE" lx0 = (-8 + 32) * xScale ly0 = (24 - 20) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "UNLK" lx0 = (-8 + 32) * xScale ly0 = (24 - 18) * yscale lx = 0.4 * xscale ly = 0.7 * yScale Label() aStr = "LOCK" lx0 = (-4 + 32) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() aStr = "DRAWWORKS CLUTCH" lx0 = (2 + 32) * xScale ly0 = (24 - 20) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "OUT" lx0 = (32 + 2) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() aStr = "IN" lx0 = (32 + 6) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() r1 = .6 * rscale X1 = (32 + -5.5) * xScale Y1 = (24 - 18.35) * yScale gfxcolor = Color15 FillCircle() ' P = 15: GOSUB cir: PAINT (X1, Y1), P X1 = (32 + -1.5) * xScale FillCircle() ' P = 15: GOSUB cir: PAINT (X1, Y1), P X1 = (32 + 4.5) * xScale FillCircle() ' P = 15: GOSUB cir: PAINT (X1, Y1), P X1 = (32 + 8.5) * xScale FillCircle() ' P = 15: GOSUB cir: PAINT (X1, Y1), P Gears1() endsub Sub Gears1 gfxcolor = Color10 ' P = 10: If rotgear = 0 Then gfxcolor = Color0 endif r1 = .5 * rscale X1 = (32 + -5.5) * xScale Y1 = (24 - 18.35) * yScale FillCircle() ' GOSUB cir: PAINT (X1, Y1), P gfxcolor = Color12 ' P = 12: If rotgear = 1 Then gfxcolor = Color0 endif X1 = (32 + -1.5) * xScale FillCircle() ' GOSUB cir: PAINT (X1, Y1), P gfxcolor = Color10 ' P = 10: If liftgear = -1 Then gfxcolor = Color0 ' P = 0 endif X1 = (32 + 4.5) * xScale FillCircle() ' GOSUB cir: PAINT (X1, Y1), P gfxcolor = Color12 ' P = 12: If liftgear = 1 Then gfxcolor = Color0 endif X1 = (32 + 8.5) * xScale FillCircle() ' GOSUB cir: PAINT (X1, Y1), P endsub sub SURVEY 'Line (-18.5, -9)-(-9, 11.5), 14, BF x0 = -18.5 y0 = -9 X1 = -9 Y1 = 11.5 gfxcolor = Color14 FillRectangleConvert() 'Line (-18, -8.5)-(-9.5, 11), 7, BF x0 = -18 y0 = -8.5 X1 = -9.5 Y1 = 11 gfxcolor = Color7 FillRectangleConvert() 'Line (-18, 7)-(-9, 7.5), 14, BF x0 = -18 y0 = 7 X1 = -9 Y1 = 7.5 gfxcolor = Color14 FillRectangleConvert() 'Line (-18, 3)-(-9, 3.5), 14, BF x0 = -18 y0 = 3 X1 = -9 Y1 = 3.5 gfxcolor = Color14 FillRectangleConvert() 'Line (-18, -1)-(-9, -0.5), 14, BF x0 = -18 y0 = -1 X1 = -9 Y1 = -.5 gfxcolor = Color14 FillRectangleConvert() 'Line (-18, -5)-(-9, -4.5), 14, BF x0 = -18 y0 = -5 X1 = -9 Y1 = -4.5 gfxcolor = Color14 FillRectangleConvert() 'Line (-18.5, -9)-(-18.4, 11.5), 15, BF x0 = -18.5 y0 = -9 X1 = -18.4 Y1 = 11.5 gfxcolor = Color15 FillRectangleConvert() 'Line (-18.5, 11.4)-(-9, 11.5), 15, BF x0 = -18.5 y0 = 11.4 X1 = -9 Y1 = 11.5 gfxcolor = Color15 FillRectangleConvert() 'Line (-18.5, -9)-(-9, -8.9), 4, BF x0 = -18.5 y0 = -9 X1 = -9 Y1 = -8.9 gfxcolor = Color4 FillRectangleConvert() 'Line (-9.1, -9)-(-9, 11.5), 4, BF x0 = -9.1 y0 = -9 X1 = -9 Y1 = 11.5 gfxcolor = Color4 FillRectangleConvert() For j = 7.5 To -8.5 Step -4 'Line (-18.1, j)-(-18, j + 3.5), 4, BF x0 = -18.1 y0 = j X1 = -18 Y1 = j + 3.5 gfxcolor = Color4 FillRectangleConvert() 'Line (-18, j + 3.5)-(-9.5, j + 3.6), 4, BF x0 = -18 y0 = j + 3.5 X1 = -9.5 Y1 = j + 3.6 gfxcolor = Color4 FillRectangleConvert() 'Line (-18.1, j)-(-9.5, j + 0.1), 15, BF x0 = -18.1 y0 = j X1 = -9.5 Y1 = j + .1 gfxcolor = Color4 FillRectangleConvert() 'Line (-9.6, j)-(-9.5, j + 3.5), 15, BF x0 = -9.6 y0 = j X1 = -9.5 Y1 = j + 3.5 gfxcolor = Color4 FillRectangleConvert() endfor 'TextWindow.Write("survey boxes done") 'Line (-16.5, 2.27 + 8)-(-10.5, 2.93 + 8), 1, BF x0 = -16.5 y0 = 2.22 + 8 X1 = -10.5 Y1 = 2.93 + 8 gfxcolor = Color1 FillRectangleConvert() aStr = "BIT Depth" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 10.3 ConvertLabel() label1() 'Line (-16.5, 2.27 + 4)-(-10.5, 2.93 + 4), 1, BF x0 = -16.5 y0 = 2.22 + 4 X1 = -10.5 Y1 = 2.93 + 4 gfxcolor = Color1 FillRectangleConvert() aStr = "HOLE Depth" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 6.3 ConvertLabel() label1() 'Line (-16.5, 2.27)-(-10.5, 2.93), 1, BF x0 = -16.5 y0 = 2.22 X1 = -10.5 Y1 = 2.93 gfxcolor = Color1 FillRectangleConvert() aStr = "HOLE Dir'n" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 2.3 ConvertLabel() label1() 'Line (-16.5, 2.27 - 4)-(-10.5, 2.93 - 4), 1, BF x0 = -16.5 y0 = 2.22 - 4 X1 = -10.5 Y1 = 2.93 - 4 gfxcolor = Color1 FillRectangleConvert() aStr = "INCLINAT'n" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = -1.7 ConvertLabel() label1() 'Line (-16.5, 2.27 - 8)-(-10.5, 2.93 - 8), 1, BF x0 = -16.5 y0 = 2.22 - 8 X1 = -10.5 Y1 = 2.93 - 8 gfxcolor = Color1 FillRectangleConvert() aStr = " TOOLFACE " lx = 0.5 ly = 0.5 lx0 = -16 ly0 = -5.7 ConvertLabel() label1() panel: 'TextWindow.Write("survey boxes done") BDDISP() 'TextWindow.Write("survey bddisp done") MDDISP() 'TextWindow.Write("survey mddisp done") DIRDISP() 'TextWindow.Write("survey dirdisp done") INCDISP() 'TextWindow.Write("survey incdisp done") TFDISP() 'TextWindow.Write("survey tfdisp done") 'TextWindow.Write("survey done") EndSub sub BDDISP If BUNG <= 0 Then BD = md nx = -18 ny = 8 Value = BD keepblank = blank blank = 0 dis() blank = keepblank 'Line (-12.3, 8)-(-11.9, 8.4), 0, BF x0 = -12.3 y0 = 8 X1 = -11.9 Y1 = 8.4 gfxcolor = Color0 FillRectangleConvert() endif EndSub Sub MDDISP nx = -18 ny = 4 Value = holedepth keepblank = blank blank = 0 dis() blank = keepblank 'Line (-12.3, 4)-(-11.9, 4.4), 0, BF x0 = -12.3 y0 = 4 X1 = -11.9 Y1 = 4.4 gfxcolor = Color0 FillRectangleConvert() endsub sub DIRDISP nx = -18 ny = 0 If bdir < 0 Then bdir = bdir + 360 EndIf If bdir > 360 Then bdir = bdir - 360 endif Value = bdir dis() 'Line (-12.3, 0)-(-11.9, 0.4), 0, BF x0 = -12.3 y0 = 0 X1 = -11.9 Y1 = 0.4 gfxcolor = Color0 FillRectangleConvert() endsub Sub INCDISP nx = -18 ny = -4 Value = binc fd = 2 dis() 'Line (-12.3, -4)-(-11.9, -3.6), 0, BF x0 = -12.3 y0 = -4 X1 = -11.9 Y1 = -3.6 gfxcolor = Color0 FillRectangleConvert() endsub Sub TFDISP nx = -18 ny = -8 'tf = 99.76 aStr = Math.Round(tf*100) ' Right$(" " + LTrim$(Str$(Int(100 * tf))), 7) keepblank = blank If tf = -99 Then blank = 1 EndIf Value = tf If hit = 1 And tf > 180 Then Value = 360 - tf endif fd = 2 dis() blank = keepblank 'Line (-12.3, -8)-(-11.9, -7.6), 0, BF x0 = -12.3 y0 = -8 X1 = -11.9 Y1 = -7.6 gfxcolor = Color0 FillRectangleConvert() tfc = 11 tfcStr = "A" If hit = 1 Then If tf > 180 Then tfc = Color12 tfcStr = "L" EndIf If tf <= 180 Then tfc = color10 tfcStr = "R" endif EndIf 'LOCATE 27, 26: Color tfc: Print tfc$ X = 27 Y = 26 aStr = tfcStr gfxcolor = tfc BuildTextShapeConvert() Endsub sub dis u = 0 aStr = " " + Math.Round(Value * 100) 'Right$(" " + LTrim$(Str$(Int(100 * Value))), 7) aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6) If Value < 1 Then aStr = " 00" + aStr aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6)' a$ = Right$(" 0" + LTrim$(Str$(Int(100 * Value))), 7) endif If Value < 0.1 Then aStr = " 000" + aStr aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6)'' a$ = Right$(" 00" + LTrim$(Str$(Int(100 * Value))), 7) endif 'TextWindow.WriteLine(" ") 'TextWindow.Write(astr + " len = " + Text.GetLength(astr)) dsx = nx + 1.2 * fd nx = dsx u = 0 For a = fd + 1 To 7 A1Str = Text.GetSubText(aStr, a, 1) ' Mid$(a$, a, 1) 'TextWindow.WriteLine(aStr + "," + Text.GetLength(astr) + " = " + A1Str) If A1Str <> " " And u = 0 And a >= fd Then 'Line (dsx + 0.1, ny)-(nx, ny + 2), 7, BF 'empty x0 = dsx + .1 y0 = ny x1 = nx Y1 = ny + 2 gfxcolor = Color7 'TextWindow.WriteLine(x0 + "," + y0 + "," + X1 + "," + y1) 'debug = "on" FillRectangleConvert() 'debug = "off" u = 1 EndIf 'TextWindow.Write(a1str + " len = " + Text.GetLength(a1str)) i = A1Str If blank = 1 Then i = 10 endif If u = 1 Then 'TextWindow.write(i) Digit() endif nx = nx + 1.2 If a = 5 Then nx = nx + 0.3 endif EndFor fd = 0 endsub sub Digit 'Line (nx + 0.26, ny + 1.86)-(nx + 0.54, ny + 2), L(i, 1), BF 'top x0 = nx + .26 y0 = ny + 1.86 X1 = nx + .54 Y1 = ny + 2 gfxcolor = L[i][1] FillRectangleConvert() 'TextWindow.Write(1) 'Line (nx + 0.26, ny + 1)-(nx + 0.54, ny + 1.14), L(i, 2), BF 'middle x0 = nx + .26 y0 = ny + 1 X1 = nx + .54 Y1 = ny + 1.14 gfxcolor = L[i][2] FillRectangleConvert() 'TextWindow.Write(2) 'Line (nx + 0.26, ny)-(nx + 0.54, ny + 0.14), L(i, 3), BF 'bottom x0 = nx + .26 y0 = ny X1 = nx + .54 Y1 = ny + .14 gfxcolor = L[i][3] FillRectangleConvert() 'TextWindow.Write(3) 'Line (nx, ny + 1)-(nx + 0.14, ny + 2), L(i, 4), BF 'top left x0 = nx y0 = ny + 1 X1 = nx + .14 Y1 = ny + 2 gfxcolor = L[i][4] FillRectangleConvert() 'TextWindow.Write(4) 'Line (nx, ny)-(nx + 0.14, ny + 1), L(i, 5), BF 'bot left x0 = nx y0 = ny X1 = nx + .14 Y1 = ny + 1 gfxcolor = L[i][5] FillRectangleConvert() 'TextWindow.Write(5) 'Line (nx + 0.66, ny + 1)-(nx + 0.8, ny + 2), L(i, 6), BF 'top right x0 = nx + .66 y0 = ny + 1 X1 = nx + .8 Y1 = ny + 2 gfxcolor = L[i][6] 'debug = "on" FillRectangleConvert() 'debug = "off" 'TextWindow.Write(6) ' Line (nx + 0.66, ny)-(nx + 0.8, ny + 1), L(i, 7), BF 'bot right x0 = nx + .66 y0 = ny X1 = nx + .8 Y1 = ny + 1 gfxcolor = L[i][7] FillRectangleConvert() 'TextWindow.Write(7) endsub Sub FillRectangleConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor If w > 0 and h > 0 then GraphicsWindow.FillRectangle(x0,y1,w,h) Else 'TextWindow.WriteLine("Application Error, width and/or height on object negative values") 'TextWindow.WriteLine(" width = " + w + " height = " + h) endif endsub Sub DrawRectangleConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif GraphicsWindow.PenColor = gfxcolor If w > 0 and h > 0 then GraphicsWindow.DrawRectangle(x0,y1,w,h) Else 'TextWindow.WriteLine("Application Error, width and/or height on object negative values") 'TextWindow.WriteLine(" width = " + w + " height = " + h) endif endsub sub BuildRectangleShapeConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif If gfxPcolor <> 0 then GraphicsWindow.PenColor = gfxPcolor else GraphicsWindow.PenColor = gfxcolor endif GraphicsWindow.BrushColor = gfxcolor shape = Shapes.AddRectangle(w,h) Shapes.Move(shape,x0,y1) Shapes.ShowShape(shape) endsub Sub DrawLineConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(x0,y0,x1,y1) endsub sub BuildTextShapeConvert x = ((X * 8 / 640 * 46.1)) * xScale y = Y * 16 / 480 * 35 * yScale If debug = "on" then TextWindow.WriteLine(x + ", " + y ) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor shape = Shapes.AddText(aStr) Shapes.Move(shape,x,y) Shapes.ShowShape(shape) endsub Sub BuildLineShapeConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor shape = Shapes.AddLine(x0,y0,x1,y1) Shapes.ShowShape(shape) endsub Sub FillTriangleConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) X2 = (X2 + 32) * xScale Y2 = (24 - y2) * yScale If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.FillTriangle(x0,y0,x1,y1,x2,y2) endsub Sub BuildTriangleShapeConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) X2 = (X2 + 32) * xScale Y2 = (24 - y2) * yScale If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.PenColor = gfxcolor shape = Shapes.AddTriangle(x0,y0,x1,y1,x2,y2) Shapes.ShowShape(shape) endsub sub OpenWindow wind: 'GET (x0, y0)-(X1, Y1), holder sx0 = x0 sy0 = y0 sx1 = X1 sy1 = Y1 'window shadow x0 = sx0 + 1 y0 = sy0 X1 = sX1 Y1 = sY1 - 2 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) Stack.PushValue(openWindowStack,shape) 'TextWindow.WriteLine(y0 + " , " + y1) ' Line (x0, y0 + 1)-(X1 - 1, Y1), 0, BF x0 = sx0 y0 = sy0 + 1 X1 = sX1 -1 Y1 = sY1 gfxcolor = Color0 gfxPcolor = Color14 BuildRectangleShapeConvert() Stack.PushValue(openWindowStack,shape) ' Line (x0, y0 + 1)-(X1 - 1, Y1), 14, B endsub Sub DrawCircle GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawEllipse(X1-r1,Y1-r1,r1*2,r1*2) endsub Sub FillCircle GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.FillEllipse(X1-r1,Y1-r1,r1*2,r1*2) endsub Sub Chars Nums() pr = 1 DEP = 1 line = 1 'filePath = Network.DownloadFile("http://www.advgeotech.com/tech21/CHARBANK") filepath = "CHARBANK" For i = 1 To 128 GH[i][1] = 0 ' The following line could be harmful and has been automatically commented. ' GH[i][1] = File.ReadLine(filepath,line) line = line + 1 For j = 1 To 3 * GH[i][1] GH[i][j+1] = 0 ' The following line could be harmful and has been automatically commented. ' GH[i][j+1] = File.ReadLine(filepath,line) line = line + 1 EndFor EndFor 'TestChars() EndSub Sub TestChars 'test input/output for Chars For i = 1 To 128 TextWindow.WriteLine(GH[i][1]) For j = 1 To 3 TextWindow.WriteLine(GH[i][j+1]) EndFor EndFor EndSub sub Nums Data[0] = "1711111" Data[1] = "7777711" Data[2] = "1117117" Data[3] = "1117711" Data[4] = "7171711" Data[5] = "1111771" Data[6] = "7111171" Data[7] = "1777711" Data[8] = "1111111" Data[9] = "1111711" Data[10] = "7777777" For i = 0 To 10 'TextWindow.WriteLine(" ") For j = 1 To 7 aStr = Text.GetSubText(Data[i],j,1) If aStr = "1" Then L[i][j] = Color1 ElseIf aStr = "7" then L[i][j] = Color7 EndIf 'TextWindow.Write(L[i][j]) EndFor EndFor endsub End>VQJ436.sb< Start>VQL120.sb< ' SmallBasic Version 1.2 ' Program: CapitalizeWords ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/82e661f8-5189-4aa5-9f7f-6f5d7965e744/challenge-of-the-month-march-2018 ' ImportURL: http://smallbasic.com/program/? ' Extension: --- ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ tab = Text.GetCharacter(9) lf = Text.GetCharacter(10) crlf = Text.GetCharacter(13) +lf elseLow = "True" ' all other chars to LowerCase? "True" or "False" reverse = "False" ' reverse whole text? "True" or "False" txt = "statistics Is lIKe a bikini:"+ tab +"everyThiNG inSIGnificant iS vIsIbLe,"+ lf +"buT the interesTING aNd decisivE"+ crlf +"reMAInS hIdDeN." TextWindow.WriteLine(txt +lf+lf +"-->"+ lf) len = Text.GetLength(txt) ws = "1=9;2=10;3=13;4=32;" ' 5=133;6=160;..." For n = 1 To len chr = Text.GetSubText(txt, n,1) If n = 1 Or Array.ContainsValue(ws, Text.GetCharacterCode(Text.GetSubText(txt, n-1,1))) Then chr = Text.ConvertToUpperCase(chr) ElseIf elseLow Then chr = Text.ConvertToLowerCase(chr) EndIf If reverse Then str = Text.Append(chr, str) Else str = Text.Append(str, chr) EndIf EndFor TextWindow.WriteLine(str +lf) End>VQL120.sb< Start>VQN325.sb< ' Animation Stick Figures 'mahreen miangul ' JuNe 2018 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = "1280" GraphicsWindow.Height = "720" GraphicsWindow.BackgroundColor = "LightYellow" For i = 0 to 440 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FontSize = Math.GetRandomNumber(40) x = -544+Math.getrandomnumber(GraphicsWindow.width)/.44 y = -144+Math.getrandomnumber(GraphicsWindow.height)/.44 Shapes.Move(Shapes.AddText("👹🙌 mahreen miangul 😘😚"),x,y) Program.Delay(10) endfor m_init() shape=m Name="m" add_shapes() MakeSprite() ddx=5 ddy=0 man=1 While "True" If Shapes.GetLeft(sMan[man][0])=215+100*man-ddx Then man=man+1 If man>4 Then man=1 EndIf EndIf For i=0 To 7 Shapes.Move(sMan[man][i],Shapes.GetLeft(sMan[man][i])+ddx,shapes.GetTop(sMan[man][i])+ddy) EndFor If Shapes.GetLeft(sMan[man][0])>1200 Then moveright() EndIf Program.Delay(20) EndWhile Sub moveright el1y=shapes.GetTop(sMan[man][0]) ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y For i=0 To 7 Shapes.Move(sMan[man][i],Shapes.GetLeft(sMan[man][i])-1200,shapes.GetTop(sMan[man][i])+ddy) EndFor ddy=0 EndSub ' Add shapes // Human-Cell Sub add_shapes For M=1 To Array.GetItemCount(scale) ss=scale[M] SName=Name+"_"+M for i=1 To Array.GetItemCount(shape) GraphicsWindow.PenWidth = shape[i]["pw"] GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.penColor = shape[i]["pc"] If shape[i]["func"]="ell" Then shp[SName][i] = Shapes.AddEllipse(shape[i]["width"]*ss, shape[i]["height"]*ss) ElseIf shape[i]["func"]="rect" Then shp[SName][i] = Shapes.AddRectangle(shape[i]["width"]*ss, shape[i]["height"]*ss) ElseIf shape[i]["func"]="tri" Then shp[SName][i] = Shapes.Addtriangle(shape[i]["x1"]*ss, shape[i]["y1"]*ss,shape[i]["x2"]*ss, shape[i]["y2"]*ss, shape[i]["x3"]*ss, shape[i]["y3"]*ss) ElseIf shape[i]["func"]="line" Then shp[SName][i] = Shapes.Addline(shape[i]["x1"]*ss, shape[i]["y1"]*ss,shape[i]["x2"]*ss, shape[i]["y2"]*ss) ElseIf shape[i]["func"]="txt" Then GraphicsWindow.FontSize=shape[i]["Size"] shp[SName][i] = Shapes.Addtext(shape[i]["Letter"]) EndIf Shapes.Animate(shp[SName][i], shape[i]["x"]*ss+shX[M], shape[i]["y"]*ss+shY[M], 500) Shapes.Rotate(shp[SName][i], Shape[i]["angle"]) EndFor EndFor endsub Sub MakeSprite col="1=green;2=orange;3=blue;4=red" GraphicsWindow.penwidth = 12 For man=1 To 4 GraphicsWindow.penColor=col[man] GraphicsWindow.brushColor=col[man] sMan[man][0] = Shapes.addEllipse(50,50) Shapes.Move(sMan[man][0], 215+100*man,150) sMan[man][1] = Shapes.Addline(100*man+240, 200, 100*man+240, 260) '<-- body sMan[man][2] = Shapes.Addline(100*man+240, 205, 100*man+210, 240) '<-- Shoulder 1 sMan[man][3] = Shapes.Addline(100*man+213, 235, 100*man+195, 280) '<-- arm 1 sMan[man][4] = Shapes.Addline(100*man+240, 205, 100*man+270, 240) '<-- Shoulder 2 sMan[man][5] = Shapes.Addline(100*man+268, 235, 100*man+290, 270) '<-- arm 2 sMan[man][6] = Shapes.Addline(100*man+240, 260, 100*man+200, 350) '<-- leg 1 sMan[man][7] = Shapes.Addline(100*man+240, 260, 100*man+280, 350) '<-- leg 2 EndFor EndSub Sub m_init' scale ="1=0.8" shX ="1=150" shY ="1=420" m[1] = "func=ell;x=-100;y=-500;width=100;height=100;angle=0;bc=orange;pc=black;pw=2"' <------ m[2] = "func=ell;x=-80;y=-480;width=30;height=45;angle=20;bc=white;pc=black;pw=2" ' <------ m[3] = "func=ell;x=-48;y=-480;width=30;height=45;angle=20;bc=white;pc=black;pw=2" ' <------ m[4] = "func=ell;x=-72;y=-465;width=15;height=15;angle=0;bc=black;pc=black;pw=2" ' <------ m[5] = "func=ell;x=-42;y=-465;width=15;height=15;angle=0;bc=black;pc=black;pw=2" ' <------ m[6] = "func=ell;x=-80;y=-435;width=50;height=25;angle=0;bc=black;pc=black;pw=0" ' <------ m[7] = "func=ell;x=-70;y=-438;width=40;height=20;angle=0;bc=orange;pc=black;pw=0" ' <------ endsub End>VQN325.sb< Start>VQP786.sb< 'Simple Calculator.sb ' by Airwaves GraphicsWindow.Hide() GraphicsWindow.Width = 200 GraphicsWindow.Height = 330 GraphicsWindow.Title = "Calculator" GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "DarkSlateGray" 'For keyboard to work, uncomment the line below! 'GraphicsWindow.KeyDown = OnKeyDown holder = "" intdivon = "False" GraphicsWindow.BrushColor = "White" 'uncomment the line below to make the output easier to see 'GraphicsWindow.FillRectangle(10, 10, GraphicsWindow.Width - 20, 40) GraphicsWindow.FontSize = 36 GraphicsWindow.BrushColor = "Black" numbers = Shapes.AddText("0") Shapes.Move(numbers, 20, 10) btn7 = FCControls.AddButton(30, 30, "7") FCControls.Move(btn7, 22, 100) FCControls.RegisterMouseDownEvent(btn7, "n7") btn8 = FCControls.AddButton(30, 30, "8") FCControls.Move(btn8, 54, 100) FCControls.RegisterMouseDownEvent(btn8, "n8") btn9 = FCControls.AddButton(30, 30, "9") FCControls.Move(btn9, 86, 100) FCControls.RegisterMouseDownEvent(btn9, "n9") btn4 = FCControls.AddButton(30, 30, "4") FCControls.Move(btn4, 22, 132) FCControls.RegisterMouseDownEvent(btn4, "n4") btn5 = FCControls.AddButton(30, 30, "5") FCControls.Move(btn5, 54, 132) FCControls.RegisterMouseDownEvent(btn5, "n5") btn6 = FCControls.AddButton(30, 30, "6") FCControls.Move(btn6, 86, 132) FCControls.RegisterMouseDownEvent(btn6, "n6") btn1 = FCControls.AddButton(30, 30, "1") FCControls.Move(btn1, 22, 164) FCControls.RegisterMouseDownEvent(btn1, "n1") btn2 = FCControls.AddButton(30, 30, "2") FCControls.Move(btn2, 54, 164) FCControls.RegisterMouseDownEvent(btn2, "n2") btn3 = FCControls.AddButton(30, 30, "3") FCControls.Move(btn3, 86, 164) FCControls.RegisterMouseDownEvent(btn3, "n3") btnbck = FCControls.AddButton(30, 30, "←") FCControls.Move(btnbck, 22, 67) FCControls.RegisterMouseDownEvent(btnbck, "bck") ent = FCControls.AddButton(30, 94, "=") FCControls.Move(ent, 152, 132) FCControls.RegisterMouseDownEvent(ent, "calculate") btnbck = FCControls.AddButton(30, 30, "←") FCControls.Move(btnbck, 22, 67) FCControls.RegisterMouseDownEvent(btnbck, "bck") clear = FCControls.AddButton(30, 30, "C") FCControls.Move(clear, 54, 67) FCControls.RegisterMouseDownEvent(clear, "c") plus = FCControls.AddButton(30, 30, "+") FCControls.Move(plus, 86, 67) FCControls.RegisterMouseDownEvent(plus, "add") minus = FCControls.AddButton(30, 30, "-") FCControls.Move(minus, 119, 100) FCControls.RegisterMouseDownEvent(minus, "subtract") divide = FCControls.AddButton(30, 30, "÷") FCControls.Move(divide, 119, 132) FCControls.RegisterMouseDownEvent(divide, "slash") multiply = FCControls.AddButton(30, 30, "*") FCControls.Move(multiply, 119, 164) FCControls.RegisterMouseDownEvent(multiply, "mult") btn0 = FCControls.AddButton(94, 30, "0") FCControls.Move(btn0, 22, 196) FCControls.RegisterMouseDownEvent(btn0, "n0") btndot = FCControls.AddButton(30, 30, ".") FCControls.Move(btndot, 119, 196) FCControls.RegisterMouseDownEvent(btndot, "ndot") btnper = FCControls.AddButton(30, 30, "%") FCControls.Move(btnper, 152, 67) FCControls.RegisterMouseDownEvent(btnper, "nper") btnsqrt = FCControls.AddButton(30, 30, "√") FCControls.Move(btnsqrt, 119, 67) FCControls.RegisterMouseDownEvent(btnsqrt, "nsqrt") btnpwr = FCControls.AddButton(30, 30, "^") FCControls.Move(btnpwr, 152, 100) FCControls.RegisterMouseDownEvent(btnpwr, "npwr") btnintdiv = FCControls.AddButton(30, 30, "Int÷") FCControls.Move(btnintdiv, 22, 228) FCControls.RegisterMouseDownEvent(btnintdiv, "nintdiv") btnmemadd = FCControls.AddButton(30, 30, "M+") FCControls.Move(btnmemadd, 54, 228) FCControls.RegisterMouseDownEvent(btnmemadd, "memadd") btnmemm = FCControls.AddButton(30, 30, "M-") FCControls.Move(btnmemm, 86, 228) FCControls.RegisterMouseDownEvent(btnmemm, "memm") btnmemmr = FCControls.AddButton(30, 30, "MR") FCControls.Move(btnmemmr, 119, 228) FCControls.RegisterMouseDownEvent(btnmemmr, "memmr") btnsin = FCControls.AddButton(30, 30, "sin") FCControls.Move(btnsin, 152, 228) FCControls.RegisterMouseDownEvent(btnsin, "sin") btncos = FCControls.AddButton(30, 30, "cos") FCControls.Move(btncos, 22, 260) FCControls.RegisterMouseDownEvent(btncos, "cos") btntan = FCControls.AddButton(30, 30, "tan") FCControls.Move(btntan, 54, 260) FCControls.RegisterMouseDownEvent(btntan, "tan") btnlog = FCControls.AddButton(30, 30, "log") FCControls.Move(btnlog, 86, 260) FCControls.RegisterMouseDownEvent(btnlog, "LOG") btncosh = FCControls.AddButton(30, 30, "cosh") FCControls.Move(btncosh, 119, 260) FCControls.RegisterMouseDownEvent(btncosh, "cosh") btnsinh = FCControls.AddButton(30, 30, "sinh") FCControls.Move(btnsinh, 152, 260) FCControls.RegisterMouseDownEvent(btnsinh, "sinh") btnrnd = FCControls.AddButton(30, 30, "RND") FCControls.Move(btnrnd, 22, 292) FCControls.RegisterMouseDownEvent(btnrnd, "rnd") btnmax = FCControls.AddButton(30, 30, "↑/↓") FCControls.Move(btnmax, 22, 292) FCControls.RegisterMouseDownEvent(btnmax, "maxmin") Sub n1 holder = TextPlus.Append(holder, 1) draw() EndSub Sub n2 holder = TextPlus.Append(holder, 2) draw() EndSub Sub n3 holder = TextPlus.Append(holder, 3) draw() EndSub Sub n4 holder = TextPlus.Append(holder, 4) draw() EndSub Sub n5 holder = TextPlus.Append(holder, 5) draw() EndSub Sub n6 holder = TextPlus.Append(holder, 6) draw() EndSub Sub n7 holder = TextPlus.Append(holder, 7) draw() EndSub Sub n8 holder = TextPlus.Append(holder, 8) draw() EndSub Sub n9 holder = TextPlus.Append(holder, 9) draw() EndSub Sub n0 holder = TextPlus.Append(holder, 0) draw() EndSub Sub draw GraphicsWindow.FontSize = 36 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText(holder) Shapes.Move(numbers, 20, 10) If maxfinderon = "True" then holder3 = FCControls.GetText(numbers) EndIf EndSub Sub bck holder = TextPlus.RemoveSubText(holder, TextPlus.GetLength(holder)-1, 1) draw() EndSub Sub c holder = "" output = "" draw() EndSub Sub calculate GraphicsWindow.FontSize = 36 'Check if Operation is Add If Text.GetIndexOf(holder, "+") <> 0 Then operationindex = Text.GetIndexOf(holder, "+") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation + textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Subtract If Text.GetIndexOf(holder, "-") <> 0 Then operationindex = Text.GetIndexOf(holder, "-") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation - textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Multiply If Text.GetIndexOf(holder, "*") <> 0 Then operationindex = Text.GetIndexOf(holder, "*") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation * textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf 'Check if Operation is Divide If Text.GetIndexOf(holder, "÷") <> 0 Then operationindex = Text.GetIndexOf(holder, "÷") textbeforoperation = Text.GetSubText(holder, 1, operationindex - 1) textafteroperation = Text.GetSubTextToEnd(holder, operationindex + 1) output = textbeforoperation / textafteroperation If output > 10000000 then showaserror() else showonscreen() endif EndIf If pwron = "True" then textbeforoperation = TextPlus.GetSubText(holder, 1, TextPlus.GetIndexOf(holder, "^") - 1) textafteroperation = TextPlus.GetSubTextToEnd(holder, TextPlus.GetIndexOf(holder, "^") + 1) output = MathPlus.Power(textbeforoperation, textafteroperation) pwron = "False" If output > 10000000 then showaserror() else showonscreen() endif EndIf If intdivon = "True" then textbeforoperation = TextPlus.GetSubText(holder, 1, TextPlus.GetIndexOf(holder, "÷R") - 1) textafteroperation = TextPlus.GetSubTextToEnd(holder, TextPlus.GetIndexOf(holder, "÷R") + 2) remainder = MathPlus.Remainder(textbeforoperation, textafteroperation) outputmain = textbeforoperation / textafteroperation intoutput = MathPlus.Round(outputmain) output = intoutput + "R " + remainder intdivon = "False" showonscreen() EndIf If Text.GetIndexOf(holder, "÷") = 0 and Text.GetIndexOf(holder, "+") = 0 and Text.GetIndexOf(holder, "-") = 0 and Text.GetIndexOf(holder, "÷R") = 0 and Text.GetIndexOf(holder, "^") = 0 and Text.GetIndexOf(holder, "*") = 0 then GraphicsWindow.FontSize = 20 output = "Syntax Error" holder = "" showonscreen() EndIf If maxfinderon = "True" then themax = Math.Max(holder2, holder3) themin = Math.Min(holder2, holder3) Shapes.Remove(smallnumbers) output = "MAX" + themax + ";MIN" + themin showonscreen() maxfinderon = "False" EndIf EndSub Sub showonscreen GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText(output) Shapes.Move(numbers, 20, 10) EndSub Sub add holder = TextPlus.Append(holder, "+") draw() EndSub Sub subtract holder = TextPlus.Append(holder, "-") draw() EndSub Sub slash holder = TextPlus.Append(holder, "÷") draw() EndSub Sub mult holder = TextPlus.Append(holder, "*") draw() EndSub Sub ndot holder = TextPlus.Append(holder, ".") draw() EndSub Sub nsqrt holder = MathPlus.SquareRoot(holder) draw() EndSub Sub nper percentconvert = holder * 100 holder = percentconvert + "%" draw() EndSub Sub npwr holder = TextPlus.Append(holder, "^") pwron = "True" draw() EndSub Sub nintdiv holder = TextPlus.Append(holder, "÷R") intdivon = "True" draw() EndSub Sub memadd GraphicsWindow.BrushColor = "Black" memory = holder If holder = "" Then memory = "0" EndIf GraphicsWindow.FontSize = 10 Shapes.Remove(showmem) showmem = Shapes.AddText(memory) Shapes.Move(showmem, GraphicsWindow.Width - 25, 38) EndSub Sub memm Shapes.Remove(showmem) memory = "" EndSub Sub memmr holder = memory draw() EndSub Sub sin holder = Math.Sin(holder) draw() EndSub Sub cos holder = Math.Sin(holder) draw() EndSub Sub tan holder = Math.Tan(holder) draw() EndSub Sub log holder = Math.Log(holder) draw() EndSub Sub cosh holder = MathPlus.Cosh(holder) draw() EndSub Sub sinh holder = MathPlus.Sinh(holder) draw() EndSub Sub rnd holder = Math.Round(holder) draw() EndSub Sub maxmin Shapes.Remove(numbers) GraphicsWindow.FontSize = 10 GraphicsWindow.BrushColor = "Black" Shapes.Remove(smallnumbers) If holder <> "" then smallnumbers = Shapes.AddText("NUM1=" + holder) maxfinderon = "True" draw() else GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText("Syntax Error") Shapes.Move(numbers, 20, 10) maxfinderon = "False" Endif Shapes.Move(smallnumbers, 140, 15) holder2 = holder holder = "" EndSub Sub showaserror GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" Shapes.Remove(numbers) numbers = Shapes.AddText("Overflow Error") Shapes.Move(numbers, 20, 10) EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "D0" Then n0() ElseIf GraphicsWindow.LastKey = "D1" Then n1() ElseIf GraphicsWindow.LastKey = "D2" Then n2() ElseIf GraphicsWindow.LastKey = "D3" Then n3() ElseIf GraphicsWindow.LastKey = "D4" Then n4() ElseIf GraphicsWindow.LastKey = "D5" Then n5() ElseIf GraphicsWindow.LastKey = "D6" Then n6() ElseIf GraphicsWindow.LastKey = "D7" Then n7() ElseIf GraphicsWindow.LastKey = "D8" Then n8() ElseIf GraphicsWindow.LastKey = "D9" Then n9() ElseIf GraphicsWindow.LastKey = "Tab" Then calculate() ElseIf GraphicsWindow.LastKey = "Back" Then bck() ElseIf GraphicsWindow.LastKey = "NumPad1" Then n1() ElseIf GraphicsWindow.LastKey = "NumPad2" Then n2() ElseIf GraphicsWindow.LastKey = "NumPad3" Then n3() ElseIf GraphicsWindow.LastKey = "NumPad4" Then n4() ElseIf GraphicsWindow.LastKey = "NumPad5" Then n5() ElseIf GraphicsWindow.LastKey = "NumPad6" Then n6() ElseIf GraphicsWindow.LastKey = "NumPad7" Then n7() ElseIf GraphicsWindow.LastKey = "NumPad8" Then n8() ElseIf GraphicsWindow.LastKey = "NumPad9" Then n9() ElseIf GraphicsWindow.LastKey = "NumPad0" Then n0() ElseIf GraphicsWindow.LastKey = "Decimal" Then ndot() ElseIf GraphicsWindow.LastKey = "Add" Then add() ElseIf GraphicsWindow.LastKey = "Subtract" Then subtract() ElseIf GraphicsWindow.LastKey = "Multiply" Then mult() ElseIf GraphicsWindow.LastKey = "Divide" Then slash() ElseIf GraphicsWindow.LastKey = "Clear" Then c() ElseIf GraphicsWindow.LastKey = "C" Then c() ElseIf Keyboard.CtrlDown Then memadd() ElseIf Keyboard.AltDown Then memm() ElseIf Keyboard.ShiftDown Then nintdiv() EndIf EndSub End>VQP786.sb< Start>VQS181.sb< Program_Directory = Program.Directory Image = ImageList.LoadImage("http://fxmxfq.bay.livefilestore.com/y1piq-gDUDLTer5yiWB4bi4FVf5ihkl8SvFlWl28AO2PaKZPXVor02jk8UySL9NWvF7Yf5eK7Ka5kFwc6-q1j1Ix6dFbECu4FNw/imhappyplz.gif") Image_Height = ImageList.GetHeightOfImage(Image) line = line + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program_Directory+"\imhappyplz.txt",line,Image_Height) Image_Width = ImageList.GetWidthOfImage(Image) line = line + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program_Directory+"\imhappyplz.txt",line,Image_Width) Pixel_Amount = Image_Height*Image_Width line = line + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program_Directory+"\imhappyplz.txt",line,Pixel_Amount) GraphicsWindow.DrawImage(Image,0,0) For i = 1 To Pixel_Amount TextWindow.WriteLine(GraphicsWindow.GetPixel(X,Y)) line = line + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program_Directory+"\imhappyplz.txt",line,GraphicsWindow.GetPixel(X,Y)) X = X + 1 If X > Image_Width Then Y = Y + 1 X = 0 endif endfor End>VQS181.sb< Start>VQS613.sb< 'WinDOS, version 1.2 programdir = Program.Directory configfile = programdir + "system.config" spawnfile = programdir + "spawn.config" backgroundcolor = "DarkBlue" foregroundcolor = "White" BIOS() Sub BIOS TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Black" TextWindow.CursorLeft = 67 TextWindow.Write(" ") TextWindow.CursorLeft = 67 TextWindow.Write(" ▒▒▒▒▒▒▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" ▒ ▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" ▒ ▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" ███████ ▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" █ ▒ █ ▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" █ ▒▒█▒▒▒▒ ") TextWindow.CursorLeft = 67 TextWindow.Write(" █ █ ") TextWindow.CursorLeft = 67 TextWindow.Write(" █ █ ") TextWindow.CursorLeft = 67 TextWindow.Write(" ███████ ") TextWindow.CursorLeft = 67 TextWindow.Write(" ") TextWindow.CursorTop = 0 TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" TextWindow.WriteLine("BIOS version 1.00") TextWindow.WriteLine("") TextWindow.WriteLine("") Program.Delay(1000) ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 1) = "WinDOS v1.1" Then TextWindow.WriteLine("Configuration file present.") ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadContents(configfile) <> "" Then 'Checks WHOLE FILE instead of ln01 -- INTENTIONAL. Data may be present even if ID is not. TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine("Configuration file format mismatch.") TextWindow.ForegroundColor = "White" TextWindow.WriteLine("The configuration file begins with:") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(configfile, 1)) TextWindow.WriteLine("instead of:") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(configspawnfile, 1)) configattempt() Else TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("Configuration file is missing.") ' The following line could be harmful and has been automatically commented. ' File.CopyFile(configspawnfile, configdir) TextWindow.ForegroundColor = "White" TextWindow.WriteLine("New configuration file created.") EndIf TextWindow.WriteLine("") TextWindow.WriteLine("") Program.Delay(1000) TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("Starting WinDOS v1.1...") Program.Delay(2000) TextWindow.Clear() osbootscreen() EndSub Sub configattempt TextWindow.Write("Attempt to continue using this configuration file? (y/n) ") attemptprompt = TextWindow.Read() If attemptprompt = "y" Then TextWindow.WriteLine("Attempting.") ElseIf attemptprompt = "n" Then configreplace() Else configattempt() EndIf EndSub Sub configreplace TextWindow.Write("Replace configuration file? (y/n) ") replaceprompt = TextWindow.Read() If replaceprompt = "y" Then ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(configfile) ' The following line could be harmful and has been automatically commented. ' File.CopyFile(configspawnfile, configdir) TextWindow.WriteLine("Done.") ElseIf replaceprompt = "n" Then TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("This program cannot continue. Check the configuration file and try again.") TextWindow.WriteLine("The program will now close.") Program.Delay(5000) Program.End() Else configreplace() EndIf EndSub Sub osbootscreen 'sets background() with delay TextWindow.BackgroundColor = "DarkBlue" TextWindow.ForegroundColor = "White" For i = 1 To 1189 WinSpace() EndFor WinDShade() For i = 1 To 9 WinFill() EndFor For i = 1 To 68 WinSpace() EndFor WinLShade() WinMShade() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 71 WinSpace() EndFor WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 71 WinSpace() EndFor WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 70 WinSpace() EndFor WinDShade() For i = 1 To 9 WinFill() EndFor For i = 1 To 68 WinSpace() EndFor WinLShade() WinMShade() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 71 WinSpace() EndFor WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 71 WinSpace() EndFor WinFill() WinSpace() WinSpace() WinSpace() WinFill() WinSpace() WinSpace() WinSpace() WinFill() For i = 1 To 70 WinSpace() EndFor WinDShade() For i = 1 To 9 WinFill() EndFor For i = 1 To 68 WinSpace() EndFor WinLShade() WinMShade() For i = 1 To 91 WinSpace() EndFor 'If any user present Then 'show loginbox 'Else 'show newuserbox 'EndIf ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 3) <> "" Or File.ReadLine(configfile, 9) <> "" Or File.ReadLine(configfile, 15) <> "" Or File.ReadLine(configfile, 21) <> "" Then loginbox() Else newuserbox() EndIf EndSub Sub newuserbox background() 'required -- newuserbox() may be invoked after login, hence the screen needs to be overwritten 'TextWindow.Write("newuserbox") TextWindow.CursorTop = 8 TextWindow.CursorLeft = 21 TextWindow.WriteLine("┌────────────────────────────────────┐") TextWindow.CursorLeft = 21 TextWindow.WriteLine("│ WinDOS v1.1 │") TextWindow.CursorLeft = 21 TextWindow.WriteLine("├────────────────────────────────────┤") TextWindow.CursorLeft = 21 TextWindow.WriteLine("│ │") 'situation identifier TextWindow.CursorLeft = 21 TextWindow.WriteLine("│ │") TextWindow.CursorLeft = 21 TextWindow.WriteLine("│ │") 'username field TextWindow.CursorLeft = 21 TextWindow.WriteLine("│ │") 'password field TextWindow.CursorLeft = 21 TextWindow.WriteLine("└────────────────────────────────────┘") 'If no users are present Then 'Say "There are no accounts yet." 'ElseIf one to three users are present Then 'Say "New user account setup" 'Else it is implied that there are four users 'Say "Account limit reached!" 'EndIf 'proglist() ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 3) = "" And File.ReadLine(configfile, 9) = "" And File.ReadLine(configfile, 15) = "" And File.ReadLine(configfile, 21) = "" Then TextWindow.CursorTop = 11 TextWindow.CursorLeft = 27 TextWindow.Write("There are no accounts yet.") TextWindow.CursorTop = 13 TextWindow.CursorLeft = 22 TextWindow.WriteLine("Enter new username:") TextWindow.CursorLeft = 22 TextWindow.ForegroundColor = "DarkGray" TextWindow.WriteLine("Enter new password:") TextWindow.ForegroundColor = "White" TextWindow.CursorTop = 13 TextWindow.CursorLeft = 42 newusername = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, 3, newusername) 'the config file is fully empty, hence ln03 ln = 4 TextWindow.ForegroundColor = "DarkGray" TextWindow.CursorTop = 13 TextWindow.CursorLeft = 22 TextWindow.WriteLine("Enter new username: " + newusername) TextWindow.ForegroundColor = "White" TextWindow.CursorLeft = 22 TextWindow.Write("Enter new password: ") newpassword = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, newpassword) TextWindow.CursorTop = 14 TextWindow.CursorLeft = 22 TextWindow.ForegroundColor = "DarkGray" TextWindow.Write("Enter new password: " + newpassword) ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "DarkBlue") ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "White") ln = ln - 2 TextWindow.CursorTop = 11 TextWindow.CursorLeft = 22 TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" Success! ") TextWindow.CursorLeft = 22 TextWindow.Write(" You are now logged in.") Program.Delay(2000) background() proglist() ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadLine(configfile, 3) = "" Or File.ReadLine(configfile, 9) = "" Or File.ReadLine(configfile, 15) = "" Or File.ReadLine(configfile, 21) = "" Then TextWindow.CursorTop = 11 TextWindow.CursorLeft = 29 TextWindow.Write("New user account setup") TextWindow.CursorTop = 13 TextWindow.CursorLeft = 22 TextWindow.WriteLine("Enter new username:") TextWindow.CursorLeft = 22 TextWindow.WriteLine("Enter new password:") TextWindow.CursorTop = 13 TextWindow.CursorLeft = 42 newusername = TextWindow.Read() 'check for empty userpass slot ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 3) = "" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, 3, newusername) ln = 4 ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadLine(configfile, 9) = "" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, 9, newusername) ln = 10 ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadLine(configfile, 15) = "" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, 15, newusername) ln = 16 Else ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, 21, newusername) ln = 22 EndIf TextWindow.CursorLeft = 42 newpassword = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, newpassword) ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "DarkBlue") ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "White") ln = ln - 2 TextWindow.CursorTop = 11 TextWindow.CursorLeft = 22 TextWindow.Write(" Success! ") Program.Delay(2000) background() prompt() Else TextWindow.CursorTop = 11 TextWindow.CursorLeft = 29 TextWindow.Write("Account limit reached!") TextWindow.CursorTop = 13 TextWindow.CursorLeft = 24 TextWindow.WriteLine("Only four accounts are allowed.") TextWindow.CursorLeft = 27 TextWindow.Write("Press ENTER to continue...") TextWindow.Read() background() prompt() EndIf EndSub Sub loginbox 'reset colour config backgroundcolor = "DarkBlue" foregroundcolor = "White" background() 'required -- loginbox() may be invoked through user logout 'TextWindow.Write("loginbox") TextWindow.CursorTop = 9 TextWindow.CursorLeft = 26 TextWindow.WriteLine("┌──────────────────────────┐") TextWindow.CursorLeft = 26 TextWindow.WriteLine("│ WinDOS v1.1 │") TextWindow.CursorLeft = 26 TextWindow.WriteLine("├──────────────────────────┤") TextWindow.CursorLeft = 26 TextWindow.WriteLine("│ │") TextWindow.CursorLeft = 26 TextWindow.WriteLine("│ │") TextWindow.CursorLeft = 26 TextWindow.WriteLine("└──────────────────────────┘") TextWindow.CursorTop = 12 TextWindow.CursorLeft = 27 TextWindow.WriteLine("Username:") TextWindow.CursorLeft = 27 TextWindow.ForegroundColor = "DarkGray" TextWindow.WriteLine("Password:") TextWindow.ForegroundColor = "White" TextWindow.CursorTop = 12 TextWindow.CursorLeft = 37 usernameprompt = TextWindow.Read() TextWindow.CursorTop = 12 TextWindow.CursorLeft = 27 TextWindow.ForegroundColor = "DarkGray" TextWindow.WriteLine("Username: " + usernameprompt) ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 3) <> usernameprompt And File.ReadLine(configfile, 9) <> usernameprompt And File.ReadLine(configfile, 15) <> usernameprompt And File.ReadLine(configfile, 21) <> usernameprompt Then TextWindow.CursorTop = 15 TextWindow.CursorLeft = 32 TextWindow.ForegroundColor = "Yellow" TextWindow.Write("No such username") Program.Delay(1000) TextWindow.CursorLeft = "32" TextWindow.Write(" ") 'blank out the message loginbox() Else 'match username to password ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, 3) = usernameprompt Then ln = 4 ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadLine(configfile, 9) = usernameprompt Then ln = 10 ' The following line could be harmful and has been automatically commented. ' ElseIf File.ReadLine(configfile, 15) = usernameprompt Then ln = 16 Else 'it is assumed that the username is in ln21 (slot 4) ln = 22 EndIf TextWindow.ForegroundColor = "White" TextWindow.CursorLeft = 27 TextWindow.Write("Password: ") passwordprompt = TextWindow.Read() TextWindow.CursorTop = 13 TextWindow.CursorLeft = 27 TextWindow.ForegroundColor = "DarkGray" TextWindow.Write("Password: " + passwordprompt) ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, ln) <> passwordprompt Then TextWindow.CursorTop = 15 TextWindow.CursorLeft = 31 TextWindow.ForegroundColor = "Yellow" TextWindow.Write("Incorrect password") Program.Delay(1000) TextWindow.CursorLeft = "31" TextWindow.Write(" ") 'blank out the message loginbox() Else TextWindow.CursorTop = 15 TextWindow.CursorLeft = 32 TextWindow.ForegroundColor = "Green" TextWindow.Write("Login successful") Program.Delay(1000) ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, ln) = "Black" Or File.ReadLine(configfile, ln) = "Blue" Or File.ReadLine(configfile, ln) = "Cyan" Or File.ReadLine(configfile, ln) = "Gray" Or File.ReadLine(configfile, ln) = "Green" Or File.ReadLine(configfile, ln) = "Magenta" Or File.ReadLine(configfile, ln) = "Red" Or File.ReadLine(configfile, ln) = "White" Or File.ReadLine(configfile, ln) = "Yellow" Or File.ReadLine(configfile, ln) = "DarkBlue" Or File.ReadLine(configfile, ln) = "DarkCyan" Or File.ReadLine(configfile, ln) = "DarkGray" Or File.ReadLine(configfile, ln) = "DarkGreen" Or File.ReadLine(configfile, ln) = "DarkMagenta" Or File.ReadLine(configfile, ln) = "DarkRed" Or File.ReadLine(configfile, ln) = "DarkYellow" Then ' The following line could be harmful and has been automatically commented. ' backgroundcolor = File.ReadLine(configfile, ln) TextWindow.BackgroundColor = backgroundcolor Else configformaterr() EndIf ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(configfile, ln) = "Black" Or File.ReadLine(configfile, ln) = "Blue" Or File.ReadLine(configfile, ln) = "Cyan" Or File.ReadLine(configfile, ln) = "Gray" Or File.ReadLine(configfile, ln) = "Green" Or File.ReadLine(configfile, ln) = "Magenta" Or File.ReadLine(configfile, ln) = "Red" Or File.ReadLine(configfile, ln) = "White" Or File.ReadLine(configfile, ln) = "Yellow" Or File.ReadLine(configfile, ln) = "DarkBlue" Or File.ReadLine(configfile, ln) = "DarkCyan" Or File.ReadLine(configfile, ln) = "DarkGray" Or File.ReadLine(configfile, ln) = "DarkGreen" Or File.ReadLine(configfile, ln) = "DarkMagenta" Or File.ReadLine(configfile, ln) = "DarkRed" Or File.ReadLine(configfile, ln) = "DarkYellow" Then ' The following line could be harmful and has been automatically commented. ' foregroundcolor = File.ReadLine(configfile, ln) TextWindow.ForegroundColor = foregroundcolor Else configformaterr() EndIf ln = ln - 2 background() proglist() EndIf EndIf EndSub Sub configformaterr backgroundcolor = "DarkRed" foregroundcolor = "White" background() TextWindow.CursorTop = 8 TextWindow.CursorLeft = 20 TextWindow.WriteLine("┌──────────────────────────────���──────┐") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ Configuration file format error! │") TextWindow.CursorLeft = 20 TextWindow.WriteLine("├─────────────────────────────────────┤") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'background/foreground? TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'reset notification TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'prompt TextWindow.CursorLeft = 20 TextWindow.WriteLine("└─────────────────────────────────────┘") TextWindow.CursorTop = 11 TextWindow.CursorLeft = 21 If ln = 5 Or ln = 11 Or ln = 17 Or ln = 23 Then TextWindow.WriteLine("The set background colour is invalid.") ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "DarkBlue") ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "White") ln = ln - 1 Else TextWindow.WriteLine("The set foreground colour is invalid.") ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "White") ln = ln - 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, "DarkBlue") ln = ln + 1 EndIf TextWindow.CursorLeft = 23 TextWindow.Write("The colour scheme will be reset.") TextWindow.CursorTop = 14 TextWindow.CursorLeft = 26 TextWindow.Write("Press ENTER to continue...") TextWindow.Read() backgroundcolor = "DarkBlue" foregroundcolor = "White" EndSub Sub proglist TextWindow.Write("Programs available: Commands available: ") Program.Delay(50) TextWindow.Write("TimeDate about ") Program.Delay(50) TextWindow.Write("Calculator colorsetup ") Program.Delay(50) TextWindow.Write("GoodMornAftEve logout ") Program.Delay(50) TextWindow.Write("DecToBin newuser ") Program.Delay(50) TextWindow.Write(" ") Program.Delay(50) TextWindow.Write("Programs and commands are case-sensitive. ") Program.Delay(50) TextWindow.Write(" ") Program.Delay(50) TextWindow.Write("To display this list again, type in 'list'. ") Program.Delay(50) TextWindow.Write(" ") Program.Delay(50) prompt() EndSub Sub prompt TextWindow.Write("C:\>") promptinput = TextWindow.Read() If promptinput = "TimeDate" Then TimeDate() ElseIf promptinput = "Calculator" Then Calculator() ElseIf promptinput = "GoodMornAftEve" Then GoodMornAftEve() ElseIf promptinput = "DecToBin" Then DecToBin() ElseIf promptinput = "about" Then about() ElseIf promptinput = "colorsetup" Then colorsetup() ElseIf promptinput = "logout" Then loginbox() ElseIf promptinput = "newuser" Then newuserbox() ElseIf promptinput = "list" Then background() proglist() Else TextWindow.BackgroundColor = foregroundcolor TextWindow.ForegroundColor = backgroundcolor TextWindow.WriteLine("No such program or command.") TextWindow.BackgroundColor = backgroundcolor TextWindow.ForegroundColor = foregroundcolor prompt() EndIf EndSub Sub TimeDate TextWindow.WriteLine("Today's date is " + Clock.Date) TextWindow.WriteLine("The time now is " + Clock.Time) prompt() EndSub Sub Calculator background() TextWindow.BackgroundColor = foregroundcolor TextWindow.ForegroundColor = backgroundcolor TextWindow.Write("+-×÷ Basic calculator +-×÷") TextWindow.BackgroundColor = backgroundcolor TextWindow.ForegroundColor = foregroundcolor TextWindow.WriteLine("") TextWindow.WriteLine("How to use this program:") TextWindow.WriteLine("1. Type in 'add', 'subtract', 'multiply' or 'divide'. Press ENTER.") TextWindow.WriteLine("2. Type in the first number. Press ENTER.") TextWindow.WriteLine("3. Type in the second number. Press ENTER for the answer.") TextWindow.WriteLine("") TextWindow.WriteLine("When you are done, type in 'exit'.") TextWindow.WriteLine("") calculatoroperation() EndSub Sub GoodMornAftEve TopLeft() If (Clock.Hour < 12) Then TextWindow.BackgroundColor = "DarkBlue" TextWindow.ForegroundColor = "White" TextWindow.Write(" ████ * ") TextWindow.Write(" ████ * ") TextWindow.Write(" ████ * ") TextWindow.Write(" ") TextWindow.Write(" * * ") 'ln05 TextWindow.Write(" ") TextWindow.Write(" * ") TextWindow.Write(" * ") TextWindow.Write(" ") TextWindow.Write(" ") 'ln10 TextWindow.Write(" * * ") TextWindow.Write(" * ") TextWindow.Write(" ┌────┐ ") TextWindow.Write(" │■ ■ │ ") TextWindow.Write(" ┌─────┐ ┌─────┐ │ ■■│ ") 'ln15 TextWindow.Write(" │■■ ■ │ │ ■ ■│ │ ■ ■│┌────┐ ┌────┐ ") TextWindow.Write("────┐ │ ■ ■ │ │■■■ │ │■■■ ││■■ │ │ ■ │ ┌───────┐ ") TextWindow.Write("■ ■│ │■ ■■│ │■ ■■ │ │ ■ ││ ■ ■│ │ ■■■│ │ ■ ■■ │ ") TextWindow.Write("■ ■ │ │■ │ │ ■ ■│ │ ■ ││■ │ │■ ■│ │■ ■ │ ") TextWindow.Write(" ■ │ │ ■ │ │ ■ │ │ ■■ ││■■■ │ │ ■ │ │ ■│ ") 'ln20 TextWindow.Write("────┴────┴─────┴──┴─────┴─────────────┴────┴┴────┴─┴────┴─────────────┴───────┴─") TextWindow.Write(" ┌─────────────┐ ") TextWindow.Write(" │Good morning!│ ") TextWindow.Write(" └─────────────┘ ") TextWindow.Write(" ") 'ln25 ElseIf (Clock.Hour >= 12 And Clock.Hour < 18) Then TextWindow.BackgroundColor = "DarkYellow" TextWindow.ForegroundColor = "White" TextWindow.Write(" ████ ") TextWindow.Write(" ████ ") TextWindow.Write(" ████ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" ▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ") 'ln05 TextWindow.Write(" ▒▒▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") 'ln10 TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ┌────┐ ") TextWindow.Write(" │■■■■│ ") TextWindow.Write(" ┌─────┐ ┌─────┐ │■■■■│ ") 'ln15 TextWindow.Write(" │■■■■■│ │■■■■■�� │■■■■│┌────┐ ┌────┐ ") TextWindow.Write("────┐ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ ┌───────┐ ") TextWindow.Write("■■■■│ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") TextWindow.Write("■■■■│ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") TextWindow.Write("■■■■│ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") 'ln20 TextWindow.Write("────┴────┴─────┴──┴─────┴──��──────────┴────┴┴────┴─┴────┴─────────────┴───────┴─") TextWindow.Write(" ┌───────────────┐ ") TextWindow.Write(" │Good afternoon!│ ") TextWindow.Write(" └───────────────┘ ") TextWindow.Write(" ") 'ln25 Else TextWindow.BackgroundColor = "DarkRed" TextWindow.ForegroundColor = "White" TextWindow.Write(" * ") TextWindow.Write(" ▒▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" ▒▒▒▒▒▒▒▒▒▒ ") TextWindow.Write(" * ") 'ln05 TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" * ") TextWindow.Write(" ") 'ln10 TextWindow.Write(" * ") TextWindow.Write(" ") TextWindow.Write(" ┌────┐ ") TextWindow.Write(" │■■■■│ ") TextWindow.Write(" ┌─────┐ ┌─────┐ │■■■■│ ") 'ln15 TextWindow.Write(" │■■■■■│ │■■■■■│ │■■■■│┌────┐ ┌────┐ ") TextWindow.Write("────┐ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ ┌───────┐ ") TextWindow.Write("■■■■│ │■■■■■│ │■��■■■│ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") TextWindow.Write("■■■■│ │■■■■■│ │■■■■■│ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") TextWindow.Write("■■■■│ │■■■■■│ │■■■■■│ ████ │■■■■││■■■■│ │■■■■│ │■■■■■■■│ ") 'ln20 TextWindow.Write("────┴────┴─────┴──┴─────┴───────▀▀▀▀──┴────┴┴────┴─┴────┴─────────────┴───────┴─") TextWindow.Write(" ┌─────────────┐ ") TextWindow.Write(" │Good evening!│ ") TextWindow.Write(" └─────────────┘ ") TextWindow.Write(" ") 'ln25 EndIf TopLeft() 'necessary to prevent scrolling off TextWindow.CursorTop = 24 TextWindow.CursorLeft = 27 TextWindow.Write("Press ENTER to continue...") TextWindow.Read() TextWindow.BackgroundColor = backgroundcolor TextWindow.ForegroundColor = foregroundcolor background() prompt() EndSub Sub DecToBin background() TextWindow.BackgroundColor = foregroundcolor TextWindow.ForegroundColor = backgroundcolor TextWindow.Write("01001101 Decimal-to-binary converter 10100111") TextWindow.BackgroundColor = backgroundcolor TextWindow.ForegroundColor = foregroundcolor TextWindow.WriteLine("") TextWindow.WriteLine("When you are done, type in 'exit'.") TextWindow.WriteLine("") dectobinprompt() EndSub Sub about TopLeft() TextWindow.Write("┌──────────────────────────────────────────────────────────────────────────────┐") TextWindow.Write("│ About WinDOS │") TextWindow.Write("├──────────────────────────────────────────────────────────────────────────────┤") TextWindow.Write("│ ▓█████████ WinDOS, version 1.1 │") TextWindow.Write("│ ░▒ █ █ █ │") 'ln05 TextWindow.Write("│ █ █ █ This program is a simulation of a multi-user OS environment. │") TextWindow.Write("│ █ █ █ │") TextWindow.Write("│ ▓█████████ Changes made in this version: │") TextWindow.Write("│ ░▒ █ █ █ - User information is stored in a separate file. │") TextWindow.Write("│ █ █ █ - Four users can be set up with custom username and password.│") 'ln10 TextWindow.Write("│ █ █ █ - More CLI graphics! │") TextWindow.Write("│ ▓█████████ - Users can change colours, which will be saved to the file. │") TextWindow.Write("��� ░▒ │") TextWindow.Write("│ Known issues: │") TextWindow.Write("│ - Users can log in with a blank username and password. │") 'ln15 TextWindow.Write("│ - Users with identical usernames are accepted. │") TextWindow.Write("│ - The four-user cap. │") TextWindow.Write("│ │") TextWindow.Write("│ │") TextWindow.Write("│ Made by Eduard Popov, using Microsoft Small Basic. │") 'ln20 TextWindow.Write("│ Twitter: @0x64hacker117 │") TextWindow.Write("│ Tumblr: theotherosproject.tumblr.com │") TextWindow.Write("│ │") TextWindow.Write("│ This isn't even my final form. │") TextWindow.Write("└──────────────────────────────────────────────────────────────────────────────┘") 'ln25 TopLeft() TextWindow.CursorTop = 23 TextWindow.CursorLeft = 55 TextWindow.Read() background() prompt() EndSub Sub colorsetup background() TextWindow.WriteLine("Available colours:") TextWindow.Write("White Gray Red Green Blue Yellow Cyan Magenta ") TextWindow.Write("Black DarkGray DarkRed DarkGreen DarkBlue DarkYellow DarkCyan DarkMagenta") TextWindow.CursorTop = 8 TextWindow.CursorLeft = 20 TextWindow.WriteLine("┌──────────────────────────────────────┐") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ Colour setup │") TextWindow.CursorLeft = 20 TextWindow.WriteLine("├──────────────────────────────────────┤") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'current bgcolor TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'current fgcolor TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'new bgcolor TextWindow.CursorLeft = 20 TextWindow.WriteLine("│ │") 'newfgcolor TextWindow.CursorLeft = 20 TextWindow.WriteLine("└──────────────────────────────────────┘") TextWindow.CursorTop = 11 TextWindow.CursorLeft = 21 TextWindow.WriteLine("Current background colour: " + backgroundcolor) TextWindow.CursorLeft = 21 TextWindow.Write("Current foreground colour: " + foregroundcolor) TextWindow.CursorTop = 14 TextWindow.CursorLeft = 21 TextWindow.WriteLine("New background colour:") TextWindow.CursorLeft = 21 TextWindow.Write("New foreground colour:") TextWindow.CursorTop = 14 TextWindow.CursorLeft = 44 newbackgroundcolor = TextWindow.Read() If newbackgroundcolor = "Black" Or newbackgroundcolor = "Blue" Or newbackgroundcolor = "Cyan" Or newbackgroundcolor = "Gray" Or newbackgroundcolor = "Green" Or newbackgroundcolor = "Magenta" Or newbackgroundcolor = "Red" Or newbackgroundcolor = "White" Or newbackgroundcolor = "Yellow" Or newbackgroundcolor = "DarkBlue" Or newbackgroundcolor = "DarkCyan" Or newbackgroundcolor = "DarkGray" Or newbackgroundcolor = "DarkGreen" Or newbackgroundcolor = "DarkMagenta" Or newbackgroundcolor = "DarkRed" Or newbackgroundcolor = "DarkYellow" Then TextWindow.CursorLeft = 44 newforegroundcolor = TextWindow.Read() Else TextWindow.CursorTop = 17 TextWindow.CursorLeft = 33 TextWindow.Write("Invalid colour") Program.Delay(1000) colorsetup() EndIf If newforegroundcolor = "Black" Or newforegroundcolor = "Blue" Or newforegroundcolor = "Cyan" Or newforegroundcolor = "Gray" Or newforegroundcolor = "Green" Or newforegroundcolor = "Magenta" Or newforegroundcolor = "Red" Or newforegroundcolor = "White" Or newforegroundcolor = "Yellow" Or newforegroundcolor = "DarkBlue" Or newforegroundcolor = "DarkCyan" Or newforegroundcolor = "DarkGray" Or newforegroundcolor = "DarkGreen" Or newforegroundcolor = "DarkMagenta" Or newforegroundcolor = "DarkRed" Or newforegroundcolor = "DarkYellow" Then ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, newbackgroundcolor) backgroundcolor = newbackgroundcolor ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(configfile, ln, newforegroundcolor) foregroundcolor = newforegroundcolor ln = ln - 2 background() prompt() Else TextWindow.CursorTop = 17 TextWindow.CursorLeft = 33 TextWindow.Write("Invalid colour") Program.Delay(1000) colorsetup() EndIf EndSub '!! This subroutine has problems. 'Sub colorapply ' If newcolorapply = "" Then ' oldbackgroundcolor = backgroundcolor ' oldforegroundcolor = foregroundcolor ' ' backgroundcolor = newbackgroundcolor ' foregroundcolor = newforegroundcolor ' EndIf ' ' background() ' TextWindow.CursorTop = 8 ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("┌──────────────────────────────────────┐") ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ Colour setup │") ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("├──────────────────────────────────────┤") ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ │") 'current bgcolor ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ │") 'current fgcolor ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ │") ' "Apply? (y/n) _" ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ │") 'new bgcolor ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("│ │") 'newfgcolor ' TextWindow.CursorLeft = 20 ' TextWindow.WriteLine("└──────────────────────────────────────┘") ' TextWindow.CursorTop = 13 ' TextWindow.CursorLeft = 33 ' TextWindow.Write("Apply? (y/n) ") ' newcolorapply = TextWindow.Read() ' If newcolorapply = "y" Then ' ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(configfile, ln, backgroundcolor) ' ln = ln + 1 ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(configfile, ln, foregroundcolor) ' ln = ln - 2 ' ' background() ' prompt() ' ElseIf newcolorapply = "n" Then ' backgroundcolor = oldbackgroundcolor ' foregroundcolor = oldforegroundcolor ' colorsetup() ' Else ' colorapply() ' EndIf 'EndSub 'This draws the background -- essentially an osbootscreen() without delays Sub background TopLeft() TextWindow.BackgroundColor = backgroundcolor TextWindow.ForegroundColor = foregroundcolor TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") 'ln05 TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") 'ln10 TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ") TextWindow.Write(" ▓█████████ ") 'ln15 TextWindow.Write(" ░▒ █ █ █ ") TextWindow.Write(" █ █ █ ") TextWindow.Write(" █ █ █ ") TextWindow.Write(" ▓█████████ ") TextWindow.Write(" ░▒ █ █ █ ") 'ln20 TextWindow.Write(" █ █ █ ") TextWindow.Write(" █ █ █ ") TextWindow.Write(" ▓█████████ ") TextWindow.Write(" ░▒ ") TextWindow.Write(" ") 'ln25 TopLeft() EndSub 'These function as coordinates. Sub TopLeft TextWindow.CursorTop = 0 TextWindow.CursorLeft = 0 EndSub 'These subroutines are used for loginscreen(). Sub WinSpace Program.Delay(1) TextWindow.Write(" ") EndSub Sub WinLShade Program.Delay(1) TextWindow.Write("░") EndSub Sub WinMShade Program.Delay(1) TextWindow.Write("▒") EndSub Sub WinDShade Program.Delay(1) TextWindow.Write("▓") EndSub Sub WinFill Program.Delay(1) TextWindow.Write("█") EndSub 'These subroutines are used for Calculator() Sub calculatoroperation operation = TextWindow.Read() If operation = "add" Then calculatoradd() ElseIf operation = "subtract" Then calculatorsubtract() ElseIf operation = "multiply" Then calculatormultiply() ElseIf operation = "divide" Then calculatordivide() ElseIf operation = "exit" Then background() prompt() Else TextWindow.WriteLine("Invalid input.") calculatoroperation() EndIf EndSub Sub calculatoradd num1 = TextWindow.ReadNumber() num2 = TextWindow.ReadNumber() ans = num1 + num2 TextWindow.WriteLine("The answer is " + ans) calculatoroperation() EndSub Sub calculatorsubtract num1 = TextWindow.ReadNumber() num2 = TextWindow.ReadNumber() ans = num1 - num2 TextWindow.WriteLine("The answer is " + ans) calculatoroperation() EndSub Sub calculatormultiply num1 = TextWindow.ReadNumber() num2 = TextWindow.ReadNumber() ans = num1 * num2 TextWindow.WriteLine("The answer is " + ans) calculatoroperation() EndSub Sub calculatordivide num1 = TextWindow.ReadNumber() num2 = TextWindow.ReadNumber() If num2 = 0 Then TextWindow.WriteLine("Error: Division by zero.") Else ans = num1 / num2 TextWindow.WriteLine("The answer is " + ans) EndIf calculatoroperation() EndSub 'These subroutines are used for DecToBin() Sub dectobinprompt TextWindow.Write("Enter number in decimal: ") decimal = TextWindow.Read() If decimal = "exit" Then background() prompt() ElseIf decimal > 255 Or decimal < 0 Then TextWindow.WriteLine("Please enter a value between 0 and 255, both inclusive.") dectobinprompt() Else dectobinconvert() dectobinprompt() EndIf EndSub Sub dectobinconvert bitvalue = 128 TextWindow.Write(decimal + " in binary is ") For i = 1 To 8 If decimal >= bitvalue Then TextWindow.Write("1") decimal = decimal - bitvalue Else TextWindow.Write("0") EndIf bitvalue = bitvalue / 2 EndFor TextWindow.WriteLine("") EndSub End>VQS613.sb< Start>VQT172.sb< ' Challenge of the Month - February 2018 // Maths Challenge// Dice 7 //by NaochanON dr=40 GraphicsWindow.FontSize=18 GraphicsWindow.BrushColor="Red" msg= Shapes.AddText(" *** ") Shapes.Move(msg,50,290) GraphicsWindow.DrawText(200,5,"Dice A") For i=1 To 6 GraphicsWindow.DrawText(100+dr*(i-1),30,i) EndFor GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(2,125,"Dice B") For j=1 To 6 GraphicsWindow.DrawText(80,50+dr*(j-1),j) EndFor for j=1 to 6 For i=1 To 6 NN=NN+1 GraphicsWindow.BrushColor="Navy" GraphicsWindow.DrawText(100+dr*(i-1),50+dr*(j-1),i+j) Program.Delay(100) If (i+j)=7 Then MM=MM+1 GraphicsWindow.BrushColor="Red" GraphicsWindow.penColor="Red" GraphicsWindow.DrawEllipse(100+dr*(i-1)-5,50+dr*(j-1),25,25) endif Shapes.SetText(msg,"Appearance ratio of combined score of 7 "+Text.GetCharacter(10)+" = "+(MM+"/"+NN)+" = "+(Math.Floor(MM/NN*10000)/100)+"%") EndFor EndFor End>VQT172.sb< Start>VQZ681-0.sb< WB=25 GraphicsWindow.CanResize="FALSE" ' POUR QUE MES COORDONNES DE SOURIS ARRIVE AVEC LA DIEMSION DE LA FENETRE GraphicsWindow.Width = 1366 GraphicsWindow.Height = 768 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.BackgroundColor = "Black" chalk() GraphicsWindow.PenColor = chalk_white GraphicsWindow.DrawEllipse(100,100,20,20) GraphicsWindow.brushColor=chalk_green GraphicsWindow.FillEllipse(100,100,20,20) GraphicsWindow.DrawEllipse(150,100,20,20) GraphicsWindow.brushColor=chalk_pink GraphicsWindow.FillEllipse(150,100,20,20) GraphicsWindow.DrawEllipse(200,100,20,20) GraphicsWindow.brushColor=chalk_yellow GraphicsWindow.FillEllipse(200,100,20,20) GraphicsWindow.DrawEllipse(250,100,20,20) GraphicsWindow.brushColor=chalk_white GraphicsWindow.FillEllipse(250,100,20,20) GraphicsWindow.DrawEllipse(300,100,20,20) GraphicsWindow.brushColor=chalk_blue GraphicsWindow.FillEllipse(300,100,20,20) GraphicsWindow.PenWidth=4 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove LDDialogs.AddRightClickMenu ("1=List;2=Save;3=Load" "") LDDialogs.RightClickMenu =rcc Sub OnMouseDown x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown = "True") Then If Mouse.MouseX > 100 and Mouse.MouseX < 120 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_green dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 150 and Mouse.MouseX < 170 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_pink dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 200 and Mouse.MouseX < 220 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_yellow dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 250 and Mouse.MouseX < 270 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_white dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 300 and Mouse.MouseX < 320 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_blue dt=dt+"CL:"+GraphicsWindow.PenColor +"|" EndIf EndIf EndSub Sub OnMouseMove x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown then ' draw chlak is on the blackboard GraphicsWindow .DrawLine (x1 y1 x2 y2) dt=dt+x1+":"+y1+":"+x2+":"+y2+"|" endif x2 = x1 y2 = y1 EndSub ' chalk colors , there is no over saturated colors in chalks world ! only pastel colors Sub chalk chalk_pink=GraphicsWindow.GetColorFromRGB(230,130,170) chalk_green=GraphicsWindow.GetColorFromRGB(170,230,170) chalk_yellow=GraphicsWindow.GetColorFromRGB(230,180,100) chalk_white=GraphicsWindow.GetColorFromRGB(230,230,230) chalk_blue=GraphicsWindow.GetColorFromRGB(100,180,230) endsub Sub rcc If LDDialogs.LastRightClickMenuItem=1 Then TextWindow.WriteLine (dt) ElseIf LDDialogs.LastRightClickMenuItem=2 Then pp=LDDialogs.SaveFile ("txt" "d:\") If pp="" then else ' The following line could be harmful and has been automatically commented. ' File.WriteContents (pp dt) endif else pp=LDDialogs.OpenFile ("txt" "d:\") dt=file.ReadContents (pp) mm=ldtext.Split (dt "|") For x=1 To array.GetItemCount (mm) ll=ldtext.Split (mm[x] ":") If ll[1]="CL" Then GraphicsWindow.PenColor =ll[2] else GraphicsWindow.DrawLine (ll[1] ll[2] ll[3] ll[4]) endif endfor endif EndSub End>VQZ681-0.sb< Start>VQZ681-1.sb< not="False=True;True=False WB=25 view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"#77aaaaaa",-1 ,-1 ,-1) 'LD3DView.AutoControl ("true" "true", -1 .5) sl=LD3DView.AddspotLight(view3D,"white",5,25, 5 ,-1 ,-1 ,-1 90 150) LD3DView.AddAmbientLight(view3D,"#77555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") GraphicsWindow.Width = 1366 GraphicsWindow.Height = 768 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.BackgroundColor = "Black" chalk() GraphicsWindow.PenColor = chalk_white GraphicsWindow.DrawEllipse(100,100,20,20) GraphicsWindow.brushColor=chalk_green GraphicsWindow.FillEllipse(100,100,20,20) GraphicsWindow.DrawEllipse(150,100,20,20) GraphicsWindow.brushColor=chalk_pink GraphicsWindow.FillEllipse(150,100,20,20) GraphicsWindow.DrawEllipse(200,100,20,20) GraphicsWindow.brushColor=chalk_yellow GraphicsWindow.FillEllipse(200,100,20,20) GraphicsWindow.DrawEllipse(250,100,20,20) GraphicsWindow.brushColor=chalk_white GraphicsWindow.FillEllipse(250,100,20,20) GraphicsWindow.DrawEllipse(300,100,20,20) GraphicsWindow.brushColor=chalk_blue GraphicsWindow.FillEllipse(300,100,20,20) GraphicsWindow.PenWidth=4 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove LDDialogs.AddRightClickMenu ("1=List;2=Save;3=Load;4=3D mode" "") LDDialogs.RightClickMenu =rcc While "true If amd Then ya=55 r35=99 LDEvents.MouseWheel =mww While "true For aa=0 To 360 Step .5 px= LDMath.Cos(aa) py= LDMath.sin (aa) If text.IsSubText ("Space" GraphicsWindow.LastKey) Then aa=aa-.5 else LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndIf Program.Delay (22) EndFor endwhile Else Program.Delay (2) EndIf endwhile Sub OnMouseDown x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown = "True") And not[amd] Then If Mouse.MouseX > 100 and Mouse.MouseX < 120 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_green dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 150 and Mouse.MouseX < 170 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_pink dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 200 and Mouse.MouseX < 220 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_yellow dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 250 and Mouse.MouseX < 270 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_white dt=dt+"CL:"+GraphicsWindow.PenColor +"|" elseif Mouse.MouseX > 300 and Mouse.MouseX < 320 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then GraphicsWindow.PenColor = chalk_blue dt=dt+"CL:"+GraphicsWindow.PenColor +"|" EndIf EndIf EndSub Sub OnMouseMove x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown And not[amd] then ' draw chlak is on the blackboard GraphicsWindow .DrawLine (x1 y1 x2 y2) dt=dt+x1+":"+y1+":"+x2+":"+y2+"|" endif x2 = x1 y2 = y1 EndSub ' chalk colors , there is no over saturated colors in chalks world ! only pastel colors Sub chalk chalk_pink=GraphicsWindow.GetColorFromRGB(230,130,170) chalk_green=GraphicsWindow.GetColorFromRGB(170,230,170) chalk_yellow=GraphicsWindow.GetColorFromRGB(230,180,100) chalk_white=GraphicsWindow.GetColorFromRGB(230,230,230) chalk_blue=GraphicsWindow.GetColorFromRGB(100,180,230) endsub Sub rcc If LDDialogs.LastRightClickMenuItem=1 Then TextWindow.WriteLine (dt) ElseIf LDDialogs.LastRightClickMenuItem=2 Then pp=LDDialogs.SaveFile ("txt" "d:\") If pp="" then else ' The following line could be harmful and has been automatically commented. ' File.WriteContents (pp dt) endif ElseIf LDDialogs.LastRightClickMenuItem=4 Then clr="white" GraphicsWindow.BackgroundColor ="teal ft="true GraphicsWindow.BrushColor="teal GraphicsWindow.FillRectangle (0 0 1600 1200) For x=1 To array.GetItemCount (mm) ll=ldtext.Split (mm[x] ":") If ll[1]="CL" Then clr =ll[2] else If ll[3]=ol[1] and ll[4]=ol[2] then tt=tt+ll[1]/10+":"+ ll[2]/10+":0:" Else If ft then Else LD3DView.AddTube (view3D tt .5 22 clr "D") 'TextWindow.WriteLine (tt) endif ft="false tt=ll[1]/10+":"+ll[2]/10+":0:" endif endif ol=ll endfor amd="true else pp=LDDialogs.OpenFile ("txt" "d:\") dt=file.ReadContents (pp) mm=ldtext.Split (dt "|") For x=1 To array.GetItemCount (mm) ll=ldtext.Split (mm[x] ":") If ll[1]="CL" Then GraphicsWindow.PenColor =ll[2] else GraphicsWindow.DrawLine (ll[1] ll[2] ll[3] ll[4]) endif endfor endif EndSub Sub mww If Mouse.IsLeftButtonDown Then ya=ya+ LDEvents.LastMouseWheelDelta*3 Else r35 =r35 + LDEvents.LastMouseWheelDelta*3 EndIf EndSub End>VQZ681-1.sb< Start>VQZ681.sb< ' CHALK drawing program ' program no: ' LA FENETRE GRAPHQIUE A TOUJOURS SA BARRE DE TIRE QUI MESURE 25 PIXEL POUR LA VALEUR Y WB=25 GraphicsWindow.Clear() GraphicsWindow.CanResize="FALSE" ' POUR QUE MES COORDONNES DE SOURIS ARRIVE AVEC LA DIEMSION DE LA FENETRE GraphicsWindow.Width = 1366 GraphicsWindow.Height = 768 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.BackgroundColor = "Black" chalk() GraphicsWindow.PenColor = chalk_white GraphicsWindow.DrawEllipse(100,100,20,20) GraphicsWindow.brushColor=chalk_green GraphicsWindow.FillEllipse(100,100,20,20) GraphicsWindow.DrawEllipse(150,100,20,20) GraphicsWindow.brushColor=chalk_pink GraphicsWindow.FillEllipse(150,100,20,20) GraphicsWindow.DrawEllipse(200,100,20,20) GraphicsWindow.brushColor=chalk_yellow GraphicsWindow.FillEllipse(200,100,20,20) GraphicsWindow.DrawEllipse(250,100,20,20) GraphicsWindow.brushColor=chalk_white GraphicsWindow.FillEllipse(250,100,20,20) GraphicsWindow.DrawEllipse(300,100,20,20) GraphicsWindow.brushColor=chalk_blue GraphicsWindow.FillEllipse(300,100,20,20) GraphicsWindow.PenWidth=10 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove Sub OnMouseDown x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown = "True") Then If Mouse.MouseX > 100 and Mouse.MouseX < 120 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then    GraphicsWindow.PenColor = chalk_green elseif Mouse.MouseX > 150 and Mouse.MouseX < 170 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then     GraphicsWindow.PenColor = chalk_pink elseif Mouse.MouseX > 200 and Mouse.MouseX < 220 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then     GraphicsWindow.PenColor = chalk_yellow elseif Mouse.MouseX > 250 and Mouse.MouseX < 270 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then     GraphicsWindow.PenColor = chalk_white elseif Mouse.MouseX > 300 and Mouse.MouseX < 320 AND Mouse.MouseY > 100+WB and Mouse.MouseY < 120+WB Then     GraphicsWindow.PenColor = chalk_blue   EndIf EndIf EndSub Sub OnMouseMove x1 = GraphicsWindow.MouseX y1 = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown then ' draw chlak is on the blackboard GraphicsWindow.DrawLine(x1,y1,x2,y2) endif x2 = x1 y2 = y1 EndSub ' chalk colors , there is no over saturated colors in chalks world ! only pastel colors Sub chalk chalk_pink=GraphicsWindow.GetColorFromRGB(230,130,170) chalk_green=GraphicsWindow.GetColorFromRGB(170,230,170) chalk_yellow=GraphicsWindow.GetColorFromRGB(230,180,100) chalk_white=GraphicsWindow.GetColorFromRGB(230,230,230) chalk_blue=GraphicsWindow.GetColorFromRGB(100,180,230) endsub End>VQZ681.sb< Start>VRF464.sb< Sub rainbow colours[1]=GraphicsWindow.GetColorFromRGB (255,13,13) colours[2]=GraphicsWindow.GetColorFromRGB (255,91,13) colours[3]=GraphicsWindow.GetColorFromRGB (254,70,14) colours[4]=GraphicsWindow.GetColorFromRGB (255,201,13) colours[5]=GraphicsWindow.GetColorFromRGB (255,249,13) colours[6]=GraphicsWindow.GetColorFromRGB (200,254,14) colours[7]=GraphicsWindow.GetColorFromRGB (140,253,15) colours[8]=GraphicsWindow.GetColorFromRGB (44,254,14) colours[9]=GraphicsWindow.GetColorFromRGB (14,254,98) colours[10]=GraphicsWindow.GetColorFromRGB (14,254,164) colours[11]=GraphicsWindow.GetColorFromRGB (16,252,228) colours[12]=GraphicsWindow.GetColorFromRGB (14,200,254) colours[13]=GraphicsWindow.GetColorFromRGB (14,128,253) colours[14]=GraphicsWindow.GetColorFromRGB (14,100,254) colours[15]=GraphicsWindow.GetColorFromRGB (14,44,254) colours[16]=GraphicsWindow.GetColorFromRGB (63,15,253) colours[17]=GraphicsWindow.GetColorFromRGB (128,15,253) colours[18]=GraphicsWindow.GetColorFromRGB (170,13,254) colours[19]=GraphicsWindow.GetColorFromRGB (237,13,254) colours[20]=GraphicsWindow.GetColorFromRGB (255,13,252) colours[21]=GraphicsWindow.GetColorFromRGB (254,14,219) colours[22]=GraphicsWindow.GetColorFromRGB (254,14,104) colours[23]=GraphicsWindow.GetColorFromRGB (254,14,50) Endsub End>VRF464.sb< Start>VRG084.sb< GraphicsWindow.Width=1100 GraphicsWindow.Height=600 GraphicsWindow.BackgroundColor="#00aabb LDUtilities.ShowNoShapeErrors="False GraphicsWindow.Title="Sun/Moon" itt= LDText.Split("Path ON;Path OFF;Fast;Norm;Slow ",";") LDDialogs.AddRightClickMenu(itt,"") LDDialogs.RightClickMenu=rmm bset() LDEvents.MouseWheel=mww d50=55 px=200 py=200 gr=2 rr=20 pth=1 csinn() q=0 bsett=0 While 1=1 For z=1 To 360 wss=ldmath.Sin(z)*200+30 wsc=ldmath.cos(z)*400+290 ttt: For x=0 to 4 LDQueue.Enqueue("qq",math.Remainder (q+x*15,180)) endfor For x=1 to 5 qx=LDQueue.Dequeue("qq") dpx=ccs[qx]+wsc dpy=csn[qx]+wss Shapes.Move (ee[x],dpx,dpy) if x=5 and pth=1 then GraphicsWindow.FillEllipse(dpx,dpy,5,5) endif If bsett=1 Then bsett=0 bset() While LDQueue.GetCount("qq")>0 LDQueue.Dequeue("qq") EndWhile Goto ttt endif EndFor Program.Delay(d50) q=q+15 q=math.Remainder(q,180) EndFor EndWhile Sub mww d50=d50+ LDEvents.LastMouseWheelDelta If d50<1 Then d50=1 EndIf GraphicsWindow.Title=d50 EndSub Sub csinn q=0 For aa=0 To 360 Step gr ccs[q]=LDMath.Cos(aa)*rr+px csn[q]=ldmath.Sin (aa)*rr+py q=q+1 EndFor EndSub sub rmm'"Path ON;Path OFF;Fast;Norm;Slow ff= LDDialogs.LastRightClickMenuItem If ff=1 Then pth=1 ElseIf ff=2 then pth=0 ElseIf ff=3 then d50=10 ElseIf ff=4 then d50=70 else d50=150 EndIf bsett=1 EndSub Sub bset GraphicsWindow.Clear() GraphicsWindow.BrushColor="Yellow GraphicsWindow.FillEllipse(460,200,60,60) GraphicsWindow.BrushColor="Brown For cx=1 to 5 ee[cx]=0 ee[cx]=Shapes.AddEllipse (10,10) LDShapes.BrushColour (ee[cx], LDColours.HSLtoRGB (180+cx*10,0.6-cx/20,0.6-cx/20)) LDShapes.PenWidth (ee[cx],0) Shapes.SetOpacity (ee[cx],14+(cx-1)*19) Shapes.Move (ee[cx],200,200) endfor EndSub End>VRG084.sb< Start>VRG237.sb< 'Subroutines - System '******************** 'ButtonDown Controls.ButtonClicked = ButtonClicked Sub ButtonClicked LastBtn = Controls.LastClickedButton If LastBtn = SmShape[9] Then SprayColors = 1 Shapes.HideShape(SmShape[17]) Shapes.Move(SmShape[22], dDownPosX + 98, 98) ElseIf LastBtn = SmShape[10] Then SprayColors = 2 Shapes.ShowShape(SmShape[17]) Shapes.Move(SmShape[22], dDownPosX + 98, 133) ElseIf LastBtn = SmShape[11] Then SpraySpeed = 10 xSpraySpeedIndi = dDownPosX + 93 Shapes.Move(SmShape[21], xSpraySpeedIndi, 298) ElseIf LastBtn = SmShape[12] Then SpraySpeed = 1 xSpraySpeedIndi = dDownPosX + 188 Shapes.Move(SmShape[21], xSpraySpeedIndi, 298) ElseIf LastBtn = SmShape[24][1] Then Controls.Move(SmShape[23], dDownPosX + 10, 65) DdSpraySizeIndiTop = 65 SpraySize = 10 ElseIf LastBtn = SmShape[24][2] Then Controls.Move(SmShape[23], dDownPosX + 10, 115) DdSpraySizeIndiTop = 115 SpraySize = 15 ElseIf LastBtn = SmShape[24][3] Then Controls.Move(SmShape[23], dDownPosX + 10, 165) DdSpraySizeIndiTop = 165 SpraySize = 20 ElseIf LastBtn = SmShape[24][4] Then Controls.Move(SmShape[23], dDownPosX + 10, 215) DdSpraySizeIndiTop = 215 SpraySize = 25 ElseIf LastBtn = SmShape[24][5] Then Controls.Move(SmShape[23], dDownPosX + 10, 265) DdSpraySizeIndiTop = 265 SpraySize = 30 ElseIf LastBtn = SmShape[25][1] Then Shapes.Move(SmShape[20], dDownPosX + 91, 218) DdDotSizeIndiLeft = dDownPosX + 91 SprayDotSize = 1 ElseIf LastBtn = SmShape[25][2] Then Shapes.Move(SmShape[20], dDownPosX + 129, 218) DdDotSizeIndiLeft = dDownPosX + 129 SprayDotSize = 2 ElseIf LastBtn = SmShape[25][3] Then Shapes.Move(SmShape[20], dDownPosX + 167, 218) DdDotSizeIndiLeft = dDownPosX + 167 SprayDotSize = 3 ElseIf LastBtn = SmShape[25][4] Then Shapes.Move(SmShape[20], dDownPosX + 205, 218) DdDotSizeIndiLeft = dDownPosX + 205 SprayDotSize = 4 ElseIf LastBtn = SmShape[25][5] Then Shapes.Move(SmShape[20], dDownPosX + 243, 218) DdDotSizeIndiLeft = dDownPosX + 243 SprayDotSize = 5 ElseIf LastBtn = TmShape[5] Then Controls.SetTextBoxText(TmShape[4], "") ElseIf LastBtn = TmShape[19] Then If OldTxtFontBold = "False" Then OldTxtFontBold = "True" Shapes.ShowShape(TmShape[21]) Else OldTxtFontBold = "False" Shapes.HideShape(TmShape[21]) EndIf ElseIf LastBtn = TmShape[20] Then If OldTxtFontItalic = "False" Then OldTxtFontItalic = "True" Shapes.ShowShape(TmShape[22]) Else OldTxtFontItalic = "False" Shapes.HideShape(TmShape[22]) EndIf ElseIf LastBtn = TmShape[18] Then OldTxtSolid = "True" OldTxtTransparent = "False" Shapes.ShowShape(TmShape[23]) Shapes.HideShape(TmShape[24]) ElseIf LastBtn = TmShape[25] Then ffn=LDDialogs.Font("") Controls.SetTextBoxText (TmShape [9],ffn[1]) Controls.SetTextBoxText (TmShape [13] ,ffn[2]) ElseIf LastBtn = TmShape[14] Then OldTxtTransparent = "True" OldTxtSolid = "False" Shapes.ShowShape(TmShape[24]) Shapes.HideShape(TmShape[23]) ElseIf LastBtn = ShMShape[23][1] Then If BackgroundShapes = "Transparent" Then GraphicsWindow.ShowMessage("The thickness of the border can't be 0 when the background of the shape is transparent.", "Information") Else xIndiPenWidthSh = 451.5 PenWidthShapes = 0 Shapes.Move(ShMShape[22], xIndiPenWidthSh, 358.5) UpdateShapesDialog() EndIf ElseIf LastBtn = ShMShape[23][2] Then xIndiPenWidthSh = 493.5 PenWidthShapes = 1 Shapes.Move(ShMShape[22], xIndiPenWidthSh, 358.5) UpdateShapesDialog() ElseIf LastBtn = ShMShape[23][3] Then xIndiPenWidthSh = 535.5 PenWidthShapes = 2 Shapes.Move(ShMShape[22], xIndiPenWidthSh, 358.5) UpdateShapesDialog() ElseIf LastBtn = ShMShape[23][4] Then xIndiPenWidthSh = 577.5 PenWidthShapes = 3 Shapes.Move(ShMShape[22], xIndiPenWidthSh, 358.5) UpdateShapesDialog() ElseIf LastBtn = ShMShape[23][5] Then xIndiPenWidthSh = 619.5 PenWidthShapes = 4 Shapes.Move(ShMShape[22], xIndiPenWidthSh, 358.5) UpdateShapesDialog() ElseIf LastBtn = ShMShape[15] Then BackgroundShapes = "Solid" UpdateShapesDialog() ElseIf LastBtn = ShMShape[16] Then If PenWidthShapes = 0 Then GraphicsWindow.ShowMessage("The background of the shape can't be transparent when the thickness of the border is 0.", "Information") Else BackgroundShapes = "Transparent" UpdateShapesDialog() EndIf ElseIf LastBtn = MmShape[5] Then AddHorizontalMirror() ElseIf LastBtn = MmShape[6] Then AddVerticalMirror() ElseIf LastBtn = MmShape[9] Then RemoveMirrors() ElseIf LastBtn = VpmShape[4] Then CloseVerifyPaste() Paste() ElseIf LastBtn = VpmShape[5] Then CloseVerifyPaste() ReAddIndiSelect() LoadSelectLoadingMenu() ShowSelectActionMenu() ElseIf LastBtn = PmShape[22] Then ParticleBorders = "True" Shapes.ShowShape(PmShape[42]) Shapes.Move(PmShape[41], 613, 353) xIndiPatternBorder = 613 ElseIf LastBtn = PmShape[23] Then ParticleBorders = "False" Shapes.HideShape(PmShape[42]) Shapes.Move(PmShape[41], 763, 353) xIndiPatternBorder = 763 ElseIf LastBtn = PmShape[43] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 10 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 1 ElseIf LastBtn = PmShape[44] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 52 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 2 ElseIf LastBtn = PmShape[45] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 94 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 3 ElseIf LastBtn = PmShape[46] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 136 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 4 ElseIf LastBtn = PmShape[47] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 178 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 5 ElseIf LastBtn = PmShape[48] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 220 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 6 ElseIf LastBtn = PmShape[49] And ParticleBorders = "True" Then xIndiPatternBorderThickness = dDownPosX + 262 Shapes.Move(PmShape[42], xIndiPatternBorderThickness, 416) PatternBorderThickness = 7 ElseIf LastBtn = PmShape[50] Then xIndiPattern = 613 yIndiPattern = 83 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Lines" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[51] Then xIndiPattern = 673 yIndiPattern = 83 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Squares" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[52] Then xIndiPattern = 733 yIndiPattern = 83 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Circles" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[53] Then xIndiPattern = 793 yIndiPattern = 83 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Triangles" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[54] Then xIndiPattern = 853 yIndiPattern = 83 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Rhombuses" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[55] Then xIndiPattern = 613 yIndiPattern = 143 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Cubes" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[56] Then xIndiPattern = 673 yIndiPattern = 143 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Spheres" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[57] Then xIndiPattern = 733 yIndiPattern = 143 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Pyramids" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[58] Then xIndiPattern = 793 yIndiPattern = 143 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Ellipses" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[59] Then xIndiPattern = 853 yIndiPattern = 143 Shapes.Move(PmShape[40], xIndiPattern, yIndiPattern) CurrentPattern = "Crosses" Shapes.SetText(PmShape[71], CurrentPattern) ElseIf LastBtn = PmShape[60] Then DrawFullscreen = "True" ClosePatternMenu() DrawPattern() DrawFullscreen = "False" ElseIf LastBtn = PmShape[74] Then PatternRandomClrs = "True" xIndiPatRandClrs = 613 Shapes.Move(PmShape[76], xIndiPatRandClrs, 493) ElseIf LastBtn = PmShape[75] Then PatternRandomClrs = "False" xIndiPatRandClrs = 763 Shapes.Move(PmShape[76], xIndiPatRandClrs, 493) EndIf EndSub 'MouseDown GraphicsWindow.MouseDown = MouseDown Sub MouseDown xDown = GraphicsWindow.MouseX yDown = GraphicsWindow.MouseY If CurrentMenu = "MainPaint" Then If yDown > 0 And yDown < 50 Then If xDown > 0 And xDown < 50 Then Sound.PlayClick() dDownPosX = 0 BrushColor =LDDialogs.Colour() ElseIf xDown > 55 And xDown < 105 Then Sound.PlayClick() CurrentTool = "Pencil" AddTool() If Mouse.IsRightButtonDown Then dDownPosX = 57 DropDownTool = "Pencil" ShowDropDown() EndIf ElseIf xDown > 110 and xDown < 160 then Sound.PlayClick() CurrentTool = "Brush" AddTool() If Mouse.IsRightButtonDown Then dDownPosX = 112 DropDownTool = "Brush" ShowDropDown() EndIf ElseIf xDown > 165 and xDown < 215 then Sound.PlayClick() CurrentTool = "Eraser" AddTool() If Mouse.IsRightButtonDown Then dDownPosX = 167 DropDownTool = "Eraser" ShowDropDown() EndIf ElseIf xDown > 220 And xDown < 270 Then If Mouse.IsLeftButtonDown = "True" Then LoadColorPicker() Sound.PlayClick() Mouse.HideCursor() CurrentTool = "ColorPicker" CurrentMenu = "ColorPicker" AddTool() EndIf ElseIf xDown > 275 And xDown < 325 Then Sound.PlayClick() CurrentTool = "Spray" If Mouse.IsRightButtonDown Then dDownPosX = 285 LoadSprayMenu() EndIf ElseIf xDown > 330 And xDown < 380 Then Sound.PlayClick() CurrentTool = "Text" AddTool() If Mouse.IsRightButtonDown = "True" Then dDownPosX = 330 RemoveAllIndicatorIcons() LoadTextMenu() EndIf ElseIf xDown > 385 And xDown < 435 Then Sound.PlayClick() CurrentTool = "Fill" AddTool() RemoveAllIndicatorIcons() ElseIf xDown > 440 And xDown < 490 Then Sound.PlayClick() CurrentTool = "Shapes" AddTool() If Mouse.IsRightButtonDown = "True" Then dDownPosX = 440 LoadShapesMenu() EndIf ElseIf xDown > 495 And xDown < 545 Then Sound.PlayClick() dDownPosX = 495 CurrentTool = "Mirror" LoadMirrorMenu() ElseIf xDown > 605 And xDown < 655 Then Sound.PlayClick() CurrentTool = "Pattern" AddTool() If Mouse.IsRightButtonDown = "True" Then dDownPosX = 605 LoadPatternsMenu() EndIf EndIf Else CanDraw = "True" Draw() EndIf If yDown > 50 Then If CurrentTool = "Select" And CanAddIndiSelect = "True" Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "SkyBlue" IndiSelect = Shapes.AddRectangle(0, 0) Shapes.Move(IndiSelect, xDown, yDown) Shapes.SetOpacity(IndiSelect, 30) CanMoveIndiSelect = "True" ElseIf CurrentTool = "Pattern" Then GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "White" IndiDrawPat = Shapes.AddRectangle(0, 0) Shapes.Move(IndiDrawPat, xDown, yDown) Shapes.SetOpacity(IndiDrawPat, 50) CanResizeIndiDrawPat = "True" ElseIf CurrentTool = "Text" Then GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "Black" TxtIndi["LineH"] = Shapes.AddLine(xDown, yDown, xDown + 50, yDown) TxtIndi["LineV"] = Shapes.AddLine(xDown, yDown, xDown, yDown + 50) TxtIndi["LineH2"] = Shapes.AddLine(0, 0, 50, 0) TxtIndi["LineV2"] = Shapes.AddLine(0, 0, 0, 50) CanMoveTxtIndies = "True" ElseIf CurrentTool = "Shapes" Then GraphicsWindow.PenColor = BrushColor GraphicsWindow.BrushColor = SecondColor GraphicsWindow.PenWidth = PenWidthShapes If CurrentShape = "Rectangle" Or CurrentShape = "Triangle" Then IndiDraw["Rec"] = Shapes.AddRectangle(0, 0) Shapes.Move(IndiDraw["Rec"], xDown, yDown) ElseIf CurrentShape = "Ellipse" Then IndiDraw["El"] = Shapes.AddEllipse(0, 0) Shapes.Move(IndiDraw["El"], xDown, yDown) ElseIf CurrentShape = "Line" Then GraphicsWindow.PenWidth = 1 IndiDraw["Line1"] = Shapes.AddEllipse(10, 10) IndiDraw["Line2"] = Shapes.AddEllipse(10, 10) Shapes.Move(IndiDraw["Line1"], xDown - 5, yDown - 5) Shapes.Move(IndiDraw["Line2"], xDown, yDown) Shapes.SetOpacity(IndiDraw["Line1"], 50) Shapes.SetOpacity(IndiDraw["Line2"], 50) EndIf EndIf EndIf ElseIf CurrentMenu = "ColorPicker" Then If Mouse.IsLeftButtonDown = "True" Then xCpBorder = Shapes.GetLeft(CpShape[1]) yCpBorder = Shapes.GetTop(CpShape[1]) xCloseCp = Shapes.GetLeft(CpShape[5]) yCloseCp = Shapes.GetTop(CpShape[5]) If xDown > xCpBorder And xDown < xCpBorder + 130 And yDown > yCpBorder And yDown < yCpBorder + 155 Then If xDown > xCloseCp And xDown < xCloseCp + 32 And yDown > yCloseCp And yDown < yCloseCp + 32 Then RemoveAllSubMenus() Else CanMoveCp = "True" EndIf EndIf If CanGetPixel = "True" Then PixelPicked = GraphicsWindow.GetPixel(xDown, yDown) GraphicsWindow.PenColor = ClrBorderDark GraphicsWindow.BrushColor = PixelPicked Shapes.Remove(CpShape[4]) CpShape[4] = Shapes.AddRectangle(110, 60) Shapes.Move(CpShape[4], CpLeft + 10, CpTop + 85) Shapes.SetText(CpShape[3], PixelPicked) BrushColor = PixelPicked GraphicsWindow.PenColor = PixelPicked EndIf ElseIf Mouse.IsRightButtonDown = "True" Then PixelPicked = GraphicsWindow.GetPixel(xDown, yDown) GraphicsWindow.PenColor = ClrBorderDark GraphicsWindow.BrushColor = PixelPicked Shapes.Remove(CpShape[4]) CpShape[4] = Shapes.AddRectangle(110, 60) Shapes.Move(CpShape[4], CpLeft + 10, CpTop + 85) Shapes.SetText(CpShape[3], PixelPicked) GraphicsWindow.PenColor = PixelPicked SecondColor = PixelPicked EndIf ElseIf CurrentMenu = "SprayMenu" Then xCloseSm = Shapes.GetLeft(SmShape[18]) yCloseSm = Shapes.GetTop(SmShape[18]) If xDown > xCloseSm And xDown < xCloseSm + 32 And yDown > yCloseSm And yDown < yCloseSm + 32 Then Sound.PlayClick() CloseSprayMenu() EndIf ElseIf CurrentMenu = "TextMenu" Then If xDown > xCloseTm And xDown < xCloseTm + 32 And yDown > yCloseTm And yDown < yCloseTm + 32 Then Sound.PlayClick() TxtBody = Controls.GetTextBoxText(TmShape[4]) TxtName = Controls.GetTextBoxText(TmShape[9]) TxtSize = Controls.GetTextBoxText(TmShape[13]) If TxtBody = "" Or TxtName = "" Or TxtSize = "" Then GraphicsWindow.ShowMessage("Please enter all the data in order to proceed.", "Information") Else If TxtSize < 8 Then TxtSize = 8 EndIf OldTxtBody = TxtBody OldTxtName = TxtName OldTxtSize = TxtSize RemoveAllSubMenus() EndIf EndIf ElseIf CurrentMenu = "ShapesMenu" Then xCloseShM = Shapes.GetLeft(ShMShape[0]) yCloseShM = Shapes.GetTop(ShMShape[0]) If xDown > xCloseShM And xDown < xCloseShM + 32 And yDown > yCloseShM And yDown < yCloseShM + 32 Then Sound.PlayClick() CanCloseIndiSelect = "True" RemoveAllSubMenus() EndIf If xDown > dDownPosX + 10 And xDown < dDownPosX + 110 And yDown > 85 And yDown < 165 Then CurrentShape = "Line" UpdateShapesDialog() ElseIf xDown > dDownPosX + 120 And xDown < dDownPosX + 220 And yDown > 85 And yDown < 165 Then CurrentShape = "Rectangle" UpdateShapesDialog() ElseIf xDown > dDownPosX + 10 And xDown < dDownPosX + 110 And yDown > 175 And yDown < 255 Then CurrentShape = "Ellipse" UpdateShapesDialog() ElseIf xDown > dDownPosX + 120 And xDown < dDownPosX + 220 And yDown > 175 And yDown < 255 Then CurrentShape = "Triangle" UpdateShapesDialog() EndIf ElseIf CurrentMenu = "MirrorMenu" Then xCloseMm = Shapes.GetLeft(MmShape[12]) yCloseMm = Shapes.GetTop(MmShape[12]) If xDown > xCloseMm And xDown < xCloseMm + 32 And yDown > yCloseMm And yDown < yCloseMm + 32 Then Sound.PlayClick() RemoveAllSubMenus() EndIf ElseIf CurrentMenu = "PastingMenu" Then If CanPaste = "True" Then xIndiPaste = xDown - (AreaWidth / 2) yIndiPaste = yDown - (AreaHeight / 2) LoadVerifyPaste() CanPaste = "False" EndIf ElseIf CurrentMenu = "PatternsMenu" Then xClosePm = Shapes.GetLeft(PmShape[0]) yClosePm = Shapes.GetTop(PmShape[0]) If xDown > xClosePm And xDown < xClosePm + 32 And yDown > yClosePm And yDown < yClosePm + 32 Then Sound.PlayClick() ClosePatternMenu() EndIf EndIf If DropDownTool = "Pencil" Then If xDown > dDownPosX And xDown < dDownPosX + 47 Then If yDown > 50 And yDown < 97 Then PencilSize = 1.5 RemoveAllSubMenus() ElseIf yDown > 97 And yDown < 144 Then PencilSize = 2.5 RemoveAllSubMenus() ElseIf yDown > 144 And yDown < 191 Then PencilSize = 3.5 RemoveAllSubMenus() ElseIf yDown > 191 And yDown < 238 Then PencilSize = 4.5 RemoveAllSubMenus() ElseIf yDown > 238 And yDown < 285 Then PencilSize = 5.5 RemoveAllSubMenus() EndIf EndIf ElseIf DropDownTool = "Brush" Then If xDown > dDownPosX And xDown < dDownPosX + 47 Then If yDown > 50 And yDown < 97 Then BrushSize = 6 RemoveAllSubMenus() ElseIf yDown > 97 And yDown < 144 Then BrushSize = 10 RemoveAllSubMenus() ElseIf yDown > 144 And yDown < 191 Then BrushSize = 14 RemoveAllSubMenus() ElseIf yDown > 191 And yDown < 238 Then BrushSize = 18 RemoveAllSubMenus() ElseIf yDown > 238 And yDown < 285 Then BrushSize = 22 RemoveAllSubMenus() EndIf EndIf ElseIf DropDownTool = "Eraser" Then If xDown > dDownPosX And xDown < dDownPosX + 47 Then If yDown > 50 And yDown < 97 Then EraserSize = 10 RemoveAllSubMenus() ElseIf yDown > 97 And yDown < 144 Then EraserSize = 15 RemoveAllSubMenus() ElseIf yDown > 144 And yDown < 191 Then EraserSize = 20 RemoveAllSubMenus() ElseIf yDown > 191 And yDown < 238 Then EraserSize = 25 RemoveAllSubMenus() ElseIf yDown > 238 And yDown < 285 Then EraserSize = 30 RemoveAllSubMenus() EndIf EndIf ElseIf DropDownTool = "Spray" Then If xDown > dDownPosX And xDown < dDownPosX + 47 Then If yDown > 50 And yDown < 97 Then SpraySize = 10 RemoveAllSubMenus() ElseIf yDown > 97 And yDown < 144 Then SpraySize = 15 RemoveAllSubMenus() ElseIf yDown > 144 And yDown < 191 Then SpraySize = 20 RemoveAllSubMenus() ElseIf yDown > 191 And yDown < 238 Then SpraySize = 25 RemoveAllSubMenus() ElseIf yDown > 238 And yDown < 285 Then SpraySize = 30 RemoveAllSubMenus() EndIf EndIf EndIf If CurrentMenu = "SelectAction" Then xCloseSm = Shapes.GetLeft(SlmShape[12]) yCloseSm = Shapes.GetTop(SlmShape[12]) If xDown > xCloseSm And xDown < xCloseSm + 32 And yDown > yCloseSm And yDown < yCloseSm + 32 Then Sound.PlayClick() CanCloseIndiSelect = "True" CloseSelectLoadingMenu() CanClickSelectTool = "True" ElseIf xDown > (wWidth2 - 323) / 2 And xDown < (wWidth2 - 323) / 2 + 54 And yDown > wHeight2 / 2 + 8 And yDown < wHeight2 / 2 + 8 + 54 Then CurrentAction = "Cut" PerformAction() ElseIf xDown > (wWidth2 - 200) / 2 And xDown < (wWidth2 - 200) / 2 + 54 And yDown > wHeight2 / 2 + 8 And yDown < wHeight2 / 2 + 8 + 54 Then CurrentAction = "Copy" PerformAction() ElseIf xDown > (wWidth2 - 65) / 2 And xDown < (wWidth2 - 65) / 2 + 54 And yDown > wHeight2 / 2 + 8 And yDown < wHeight2 / 2 + 8 + 54 Then CurrentAction = "Paste" PerformAction() ElseIf xDown > wWidth2 / 2 + 35 And xDown < wWidth2 / 2 + 89 And yDown > wHeight2 / 2 + 8 And yDown < wHeight2 / 2 + 8 + 54 Then CurrentAction = "FlipHorizontal" PerformAction() ElseIf xDown > wWidth2 / 2 + 100 And xDown < wWidth2 / 2 + 154 And yDown > wHeight2 / 2 + 8 And yDown < wHeight2 / 2 + 8 + 54 Then CurrentAction = "FlipVertical" PerformAction() EndIf EndIf EndSub 'MouseMove GraphicsWindow.MouseMove = MouseMove Sub MouseMove xMove = GraphicsWindow.MouseX yMove = GraphicsWindow.MouseY If CurrentMenu = "MainPaint" Then Draw() If yMove < 50 Then Shapes.ShowShape(ToolIndicator) If xMove > 0 And xMove < 50 Then Shapes.Move(ToolIndicator, 2, 0) ElseIf xMove > 55 And xMove < 105 Then Shapes.Move(ToolIndicator, 57, 0) ElseIf xMove > 110 and xMove < 160 Then Shapes.Move(ToolIndicator, 112, 0) ElseIf xMove > 165 and xMove < 215 Then Shapes.Move(ToolIndicator, 167, 0) ElseIf xMove > 220 And xMove < 270 Then Shapes.Move(ToolIndicator, 222, 0) ElseIf xMove > 275 And xMove < 325 Then Shapes.Move(ToolIndicator, 277, 0) ElseIf xMove > 330 And xMove < 380 Then Shapes.Move(ToolIndicator, 332, 0) ElseIf xMove > 385 And xMove < 435 Then Shapes.Move(ToolIndicator, 387, 0) ElseIf xMove > 440 And xMove < 490 Then Shapes.Move(ToolIndicator, 442, 0) ElseIf xMove > 495 And xMove < 545 Then Shapes.Move(ToolIndicator, 497, 0) ElseIf xMove > 550 And xMove < 600 Then Shapes.Move(ToolIndicator, 552, 0) ElseIf xMove > 605 And xMove < 655 Then Shapes.Move(ToolIndicator, 607, 0) EndIf Else Shapes.HideShape(ToolIndicator) If CurrentTool = "Select" Then If xMove > xDown And yMove > yDown And CanMoveIndiSelect = "True" Then Controls.SetSize(IndiSelect, xMove - xDown, yMove - yDown) EndIf ElseIf CurrentTool = "Text" Then If xMove > xDown And yMove > yDown And CanMoveTxtIndies = "True" Then Shapes.Move(TxtIndi["LineH2"], xMoveNew - 50, yMoveNew) Shapes.Move(TxtIndi["LineV2"], xMoveNew, yMoveNew - 50) EndIf ElseIf CurrentTool = "Shapes" Then If xMove > xDown And yMove > yDown Then Controls.SetSize(IndiDraw["Rec"], xMove - xDown, yMove - yDown) Controls.SetSize(IndiDraw["El"], xMove - xDown, yMove - yDown) EndIf Shapes.Move(IndiDraw["Line2"], xMove - 5, yMove - 5) ElseIf CurrentTool = "Pattern" Then If xMove > xDown And yMove > yDown And CanResizeIndiDrawPat = "True" Then Controls.SetSize(IndiDrawPat, xMove - xDown, yMove - yDown) EndIf EndIf EndIf ElseIf CurrentMenu = "ColorPicker" Then If yMove > 50 Then Mouse.HideCursor() CanGetPixel = "True" If xMove > CpLeft And xMove < CpLeft + 130 And yMove > CpTop And yMove < CpTop + 205 Then CanGetPixel = "False" RemoveAllIndicatorIcons() Mouse.ShowCursor() ToolAdded = "False" Else If ToolAdded = "False" Then AddTool() ToolAdded = "True" EndIf EndIf Else CanGetPixel = "False" EndIf If CanMoveCp = "True" Then Mouse.ShowCursor() CpLeft = xMove - 62 CpTop = yMove - 60 MoveColorPicker() EndIf ElseIf CurrentMenu = "SelectAction" Then If xMove > (wWidth2 - 323) / 2 And xMove < (wWidth2 - 323) / 2 + 54 And yMove > wHeight2 / 2 + 8 And yMove < wHeight2 / 2 + 8 + 54 Then Shapes.Move(SlmShape[13], Math.Round((wWidth2 - 323) / 2), Math.Round(wHeight2 / 2 + 8)) Shapes.SetText(SlmShape[3], "Select an action for the selected area - Cut") ElseIf xMove > (wWidth2 - 200) / 2 And xMove < (wWidth2 - 200) / 2 + 54 And yMove > wHeight2 / 2 + 8 And yMove < wHeight2 / 2 + 8 + 54 Then Shapes.Move(SlmShape[13], Math.Round((wWidth2 - 200) / 2), Math.Round(wHeight2 / 2 + 8)) Shapes.SetText(SlmShape[3], "Select an action for the selected area - Copy") ElseIf xMove > (wWidth2 - 65) / 2 And xMove < (wWidth2 - 65) / 2 + 54 And yMove > wHeight2 / 2 + 8 And yMove < wHeight2 / 2 + 8 + 54 Then Shapes.Move(SlmShape[13], Math.Round((wWidth2 - 65) / 2), Math.Round(wHeight2 / 2 + 8)) Shapes.SetText(SlmShape[3], "Select an action for the selected area - Paste") ElseIf xMove > wWidth2 / 2 + 35 And xMove < wWidth2 / 2 + 89 And yMove > wHeight2 / 2 + 8 And yMove < wHeight2 / 2 + 8 + 54 Then Shapes.Move(SlmShape[13], Math.Round(wWidth2 / 2 + 35), Math.Round(wHeight2 / 2 + 10)) Shapes.SetText(SlmShape[3], "Select an action for the selected area - Horizontal flip") ElseIf xMove > wWidth2 / 2 + 100 And xMove < wWidth2 / 2 + 154 And yMove > wHeight2 / 2 + 8 And yMove < wHeight2 / 2 + 8 + 54 Then Shapes.Move(SlmShape[13], Math.Round(wWidth2 / 2 + 100), Math.Round(wHeight2 / 2 + 10)) Shapes.SetText(SlmShape[3], "Select an action for the selected area - Vertical flip") Else Shapes.SetText(SlmShape[3], "Select an action for the selected area") EndIf EndIf If DropDownTool = "None" Then Else If xMove > dDownPosX And xMove < dDownPosX + 47 Then If yMove > 50 And yMove < 97 Then Shapes.Move(SizeIndicator, dDownPosX - 1.15, 48) ElseIf yMove > 97 And yMove < 144 Then Shapes.Move(SizeIndicator, dDownPosX - 1.15, 95) ElseIf yMove > 144 And yMove < 191 Then Shapes.Move(SizeIndicator, dDownPosX - 1.15, 142) ElseIf yMove > 191 And yMove < 238 Then Shapes.Move(SizeIndicator, dDownPosX - 1.15, 189) ElseIf yMove > 238 And yMove < 285 Then Shapes.Move(SizeIndicator, dDownPosX - 1.15, 236) EndIf EndIf EndIf If CurrentMenu = "PastingMenu" Then If CanPaste = "True" Then Shapes.Move(IndiPaste, xMove, yMove) EndIf EndIf Shapes.Move(tindicator["Pencil"], xMove - 2, yMove - 38) Shapes.Move(tindicator["Brush"], xMove - 3, yMove - 33) Shapes.Move(tindicator["Eraser"], xMove - EraserSize / 2, yMove - EraserSize / 2) Shapes.Move(tindicator["ClrPck"], xMove, yMove - 29) xMoveNew = GraphicsWindow.MouseX yMoveNew = GraphicsWindow.MouseY EndSub ' GraphicsWindow.MouseUp = MouseUp Sub MouseUp xUp = GraphicsWindow.MouseX yUp = GraphicsWindow.MouseY CanDraw = "False" If CurrentMenu = "MainPaint" And yDown < 50 And CanClickSelectTool = "True" Then If xDown > 550 And xDown < 600 Then Sound.PlayClick() PreSelectTool = CurrentTool CurrentTool = "Select" CanAddSelectLm = "True" CanClickSelectTool = "False" EndIf EndIf If CurrentMenu = "ColorPicker" Then CanMoveCp = "False" ElseIf CurrentMenu = "MainPaint" Then If yUp > 50 Then If CurrentTool = "Select" Then AreaLeft = xDown AreaTop = yDown AreaWidth = xUp - xDown AreaHeight = yUp - yDown CanMoveIndiSelect = "False" CanAddIndiSelect = "False" LoadSelectLoadingMenu() ShowSelectActionMenu() ElseIf CurrentTool = "Text" Then If xDown >= xUp Or yDown >= yUp Then CanMoveTxtIndies = "False" Else If OldTxtFontBold = "True" Then GraphicsWindow.FontBold = "True" Else GraphicsWindow.FontBold = "False" EndIf If OldTxtFontItalic = "True" Then GraphicsWindow.FontItalic = "True" Else GraphicsWindow.FontItalic = "False" EndIf GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FontName = TxtName GraphicsWindow.FontSize = TxtSize If OldTxtTransparent = "True" Then GraphicsWindow.DrawBoundText(xDown, yDown, xUp - xDown, TxtBody) ElseIf OldTxtSolid = "True" Then GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillRectangle(xDown, yDown, xUp - xDown, yUp - yDown) GraphicsWindow.BrushColor = BrushColor GraphicsWindow.DrawBoundText(xDown, yDown, xUp - xDown, TxtBody) EndIf CanMoveTxtIndies = "False" EndIf EndIf EndIf EndIf If CurrentMenu = "MainPaint" Then If yUp > 50 And yDown > 50 Then If CurrentTool = "Pattern" Then CanResizeIndiDrawPat = "False" Shapes.Remove(IndiDrawPat) DrawPattern() ElseIf CurrentTool = "Shapes" Then GraphicsWindow.PenWidth = PenWidthShapes GraphicsWindow.PenColor = BrushColor GraphicsWindow.BrushColor = SecondColor If CurrentShape = "Line" Then If PenWidthShapes = 0 Then GraphicsWindow.PenWidth = 1 Else GraphicsWindow.PenWidth = PenWidthShapes + 1 EndIf GraphicsWindow.DrawLine(xDown, yDown, xUp, yUp) EndIf If CurrentTool = "Shapes" And xDown < xUp And yDown < yUp Then GraphicsWindow.PenWidth = PenWidthShapes GraphicsWindow.PenColor = BrushColor GraphicsWindow.BrushColor = SecondColor If CurrentShape = "Rectangle" Then If BackgroundShapes = "Solid" Then GraphicsWindow.FillRectangle(xDown, yDown, xUp - xDown, yUp - yDown) GraphicsWindow.DrawRectangle(xDown, yDown, xUp - xDown, yUp - yDown) ElseIf BackgroundShapes = "Transparent" Then GraphicsWindow.DrawRectangle(xDown, yDown, xUp - xDown, yUp - yDown) EndIf ElseIf CurrentShape = "Ellipse" Then If BackgroundShapes = "Solid" Then GraphicsWindow.FillEllipse(xDown, yDown, xUp - xDown, yUp - yDown) GraphicsWindow.DrawEllipse(xDown, yDown, xUp - xDown, yUp - yDown) ElseIf BackgroundShapes = "Transparent" Then GraphicsWindow.DrawEllipse(xDown, yDown, xUp - xDown, yUp - yDown) EndIf ElseIf CurrentShape = "Triangle" Then TriangleWidth = xUp - xDown If BackgroundShapes = "Solid" Then GraphicsWindow.FillTriangle(xDown + (TriangleWidth / 2), yDown, xDown, yUp, xUp, yUp) GraphicsWindow.DrawTriangle(xDown + (TriangleWidth / 2), yDown, xDown, yUp, xUp, yUp) ElseIf BackgroundShapes = "Transparent" Then GraphicsWindow.DrawTriangle(xDown + (TriangleWidth / 2), yDown, xDown, yUp, xUp, yUp) EndIf EndIf EndIf EndIf EndIf EndIf fx=ldtext.Split ("LineH LineH2 LineV LineV2 Rec Line1 Line2 El"," ") For f=1 To 4 Shapes.Remove (TxtIndi[fx[f]]) Shapes.Remove (IndiDraw[fx[f]]) endfor GraphicsWindow.FontBold = "False" GraphicsWindow.FontItalic = "False" GraphicsWindow.FontName = "Microsoft Sans Serif" GraphicsWindow.FontSize = 12 GraphicsWindow.PenWidth = 1 EndSub ' GraphicsWindow.KeyDown = KeyDown Sub KeyDown LastKey = GraphicsWindow.LastKey If LastKey = "Escape" Then If CurrentMenu = "SelectLoadingMenu" Or CurrentMenu = "SelectAction" Or CurrentMenu = "PastingMenu" Or CurrentMenu = "VerifyPasteMenu" Or CurrentMenu = "hFlipMenu" Or CurrentMenu = "vFlipMenu" Then Else RemoveAllSubMenus() EndIf ElseIf LastKey = "Delete" Then GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(0, 0, dWidth, dHeight) Sound.PlayClick() EndIf EndSub 'Timer Timer.Interval = SpraySpeed Timer.Tick = SprayCanvas Sub SprayCanvas If CurrentMenu = "MainPaint" And CurrentTool = "Spray" And CanDraw = "True" Then If SprayColors = 1 Then xSpot = Math.GetRandomNumber(SpraySize) ySpot = Math.GetRandomNumber(SpraySize) GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) If MirrorAdded = "True" Then If CurrentMirror = "Horizontal" Then If xDown < (dWidth / 2) Then GraphicsWindow.FillEllipse(dWidth - xMove + xSpot - SpraySize / 2 + 14, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) ElseIf xDown > (dWidth / 2) Then xPosSprayOne = xMove - (dWidth / 2) GraphicsWindow.FillEllipse((dWidth / 2) - xPosSprayOne + xSpot - SpraySize / 2 + 14, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) EndIf ElseIf CurrentMirror = "Vertical" Then yPosVSeparator = dHeight / 2 If yDown < yPosVSeparator Then GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, dHeight - yMove + ySpot - SpraySize / 2 - 8, SprayDotSize, SprayDotSize) ElseIf yDown > yPosVSeparator Then yPosSprayOne = yMove - (dHeight / 2) GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, (dHeight / 2) - yPosSprayOne + ySpot - SpraySize / 2 - 7, SprayDotSize, SprayDotSize) EndIf EndIf EndIf ElseIf SprayColors = 2 Then xSpot = Math.GetRandomNumber(SpraySize) ySpot = Math.GetRandomNumber(SpraySize) xSpot2 = Math.GetRandomNumber(SpraySize) ySpot2 = Math.GetRandomNumber(SpraySize) GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillEllipse(xMove + xSpot2 - SpraySize / 2 - 16, yMove + ySpot2 - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) If MirrorAdded = "True" Then If CurrentMirror = "Horizontal" Then If xDown < (dWidth / 2) Then GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse(dWidth - xMove + xSpot - SpraySize / 2 + 14, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillEllipse(dWidth - xMove + xSpot2 - SpraySize / 2 + 14, yMove + ySpot2 - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) ElseIf xDown > (dWidth / 2) Then xPosSprayOne = xMove - (dWidth / 2) GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse((dWidth / 2) - xPosSprayOne + xSpot - SpraySize / 2 + 14, yMove + ySpot - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillEllipse((dWidth / 2) - xPosSprayOne + xSpot2 - SpraySize / 2 + 14, yMove + ySpot2 - SpraySize / 2 - 16, SprayDotSize, SprayDotSize) EndIf ElseIf CurrentMirror = "Vertical" Then yPosVSeparator = dHeight / 2 If yDown < yPosVSeparator Then GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, dHeight - yMove + ySpot - SpraySize / 2 - 8, SprayDotSize, SprayDotSize) GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillEllipse(xMove + xSpot2 - SpraySize / 2 - 16, dHeight - yMove + ySpot2 - SpraySize / 2 - 8, SprayDotSize, SprayDotSize) ElseIf yDown > yPosVSeparator Then yPosSprayOne = yMove - (dHeight / 2) GraphicsWindow.BrushColor = BrushColor GraphicsWindow.FillEllipse(xMove + xSpot - SpraySize / 2 - 16, (dHeight / 2) - yPosSprayOne + ySpot - SpraySize / 2 - 7, SprayDotSize, SprayDotSize) GraphicsWindow.BrushColor = SecondColor GraphicsWindow.FillEllipse(xMove + xSpot2 - SpraySize / 2 - 16, (dHeight / 2) - yPosSprayOne + ySpot2 - SpraySize / 2 - 7, SprayDotSize, SprayDotSize) EndIf EndIf EndIf EndIf EndIf EndSub End>VRG237.sb< Start>VRH508.sb< 'Copyright © All Rights Reserved 'ProfessionalOfSmallBasic init() 'initialise-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sub init GraphicsWindow.Top=-30 GraphicsWindow.Left=-10 GraphicsWindow.Width=Desktop.Width GraphicsWindow.Height=Desktop.Height GraphicsWindow.BackgroundColor="cyan" grass=ImageList.LoadImage("http://img-fotki.yandex.ru/get/6402/160878850.4ce/0_88f38_e6cefdd0_XL.png") GraphicsWindow.DrawResizedImage(grass,0,Desktop.Height/2,Desktop.Width,Desktop.Height/2) trgt=ImageList.LoadImage("http://appinventor.mit.edu/explore/sites/all/files/ai2tutorials/moleMash2/mole.png") NN=10 For i=1 To NN target[i]=Shapes.AddImage(trgt) n[i]=Math.GetRandomNumber(Desktop.Width-50) m[i]=Desktop.Height-Math.GetRandomNumber(Desktop.Height/2)-50 EndFor crsr=ImageList.LoadImage("http://img513.imageshack.us/img513/5213/type5pickvp6.png") cursor=Shapes.AddImage(crsr) Mouse.HideCursor() GraphicsWindow.MouseDown=onmousedown score=0 EndSub 'loop-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- loop: x=Mouse.MouseX-25 y=Mouse.MouseY Shapes.Move(cursor,x,y) For i=1 To NN Shapes.Move(target[i],n[i],m[i]) EndFor scoretable() Goto loop 'events------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sub onmousedown For i=1 To NN If x>n[i]-25 And xm[i]-25 And yVRH508.sb< Start>VRH672.sb< '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 'Train is a simple PC based simulator used for conducting basic 'excersises in directional drilling. ' Designed and prepared by Angus L Jamieson June 1993 ' Converted to Small Basic by Micheal Lanham December 2010 '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 'INITIALIZATION bha = 0 'DEFAULT inclination = 0 'up to date well attitude direction = 0 ander = 0 spin = 0 ob = 1 wd[1][ 1] = 0 wd[1][2] = 0 wd[1][3] = 0 wd[1][4] = 0 wd[1][5] = 0 wd[1][6] = 0 andrex = 1 GraphicsWindow.Title = "Drilling Simulator" GraphicsWindow.Width = 1024 GraphicsWindow.Height = 768 GraphicsWindow.CanResize = "false" GraphicsWindow.Clear() GraphicsWindow.Show() debug = "off" xScale = GraphicsWindow.Width/46.1 '21 yScale = GraphicsWindow.Height/35 '20.5 If xScale > yScale then rscale = yScale else rscale = xScale endif GraphicsWindow.FontSize = 12 * GraphicsWindow.Height/480 bStr = "None" GraphicsWindow.KeyUp = Await p1 = 3.1415936 / 180 'degrees radians convertor maxrpm = 200 maxwob = 100 '1000 lbs MWOB = 0 'CHECK MAX TORQUE DURING FIRST 2 DEGS OF BUILD maxmud = 200 mud = 0 'initial setting for mud pumps toolsav = 3 'both MWD and SRG tf = 0 rotary = 1 Weight = 0 son = 1 startdepth = 615 holedepth = startdepth rotgear = 1 'DRILL FLOOR UNLOCKED liftgear = 1 'direction downhole 'assigned variables BUNG = 0 md = 0 binc = 0 hit = 0 SetColors() Chars() Layout() Gears() If bha = 0 Then 'BhaSetup() endif Sub Await bStr = GraphicsWindow.LastKey endsub Sub SetColors BGColor = GraphicsWindow.GetColorFromRGB(0,0,255) FRColor = GraphicsWindow.GetColorFromRGB(255,255,255) LFRColor = GraphicsWindow.GetColorFromRGB(128,128,128) LBGColor = GraphicsWindow.GetColorFromRGB(64,64,64) TXColor = GraphicsWindow.GetColorFromRGB(255,255,255) TXSHColor = GraphicsWindow.GetColorFromRGB(64,64,64) Color0 = GraphicsWindow.GetColorFromRGB(0,0,0) Color1 = GraphicsWindow.GetColorFromRGB(0,0,255) Color2 = GraphicsWindow.GetColorFromRGB(0,255,0) Color3 = GraphicsWindow.GetColorFromRGB(0,255,255) 'CYAN Color4 = GraphicsWindow.GetColorFromRGB(170,0,0) Color5 = GraphicsWindow.GetColorFromRGB(255,0,255) Color7 = GraphicsWindow.GetColorFromRGB(222,222,222) Color8 = GraphicsWindow.GetColorFromRGB(128,128,128) Color9 = GraphicsWindow.GetColorFromRGB(64,64,255) Color10 = GraphicsWindow.GetColorFromRGB(128,255,128) Color11 = GraphicsWindow.GetColorFromRGB(100,255,255) Color12 = GraphicsWindow.GetColorFromRGB(128,64,64) Color13 = GraphicsWindow.GetColorFromRGB(255,100,255) Color14 = GraphicsWindow.GetColorFromRGB(255,255,0) Color15 = GraphicsWindow.GetColorFromRGB(255,255,255) Color16 = GraphicsWindow.GetColorFromRGB(128,128,150) Color17 = GraphicsWindow.GetColorFromRGB(64,64,64) endsub Sub Layout GraphicsWindow.Clear() GraphicsWindow.BrushColor = BGColor GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,GraphicsWindow.Height) GraphicsWindow.PenColor = FRColor GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawRectangle(2,2,GraphicsWindow.Width-2,GraphicsWindow.Height-2) createHandle = "true" openWindowStack = "openwindow" gauges: aStr = "JTS DRILLING SIMULATOR H=HELP ESC=EXIT" lx0 = (-8 + 32) * xScale '-8 ly0 = (24 - 22.4) * yScale '22.4 lx = 0.5 * xScale ly = .8 * yScale Label() 'StartSelect() r = 4 * rscale cx = (-25 + 32) * xScale cy = (24 - 18) * yScale minv = 0 maxv = 200 iv = 10 Gauge() aStr = "ROTARY R.P.M." lx0 = (-29 + 32) * xScale ly0 = (24 - 12.1) * yScale lx = 0.6 * xScale '.6 ly = 1 * yScale '1 Label() r = 5.6 * rscale cx = (-13.86 + 32) * xScale cy = (24 - 17.65) * yScale minv = 0 maxv = 100 iv = 1 Gauge() aStr = "Weight on BIT" lx0 = (-17 + 32) * xScale ly0 = (24 - 23) * yScale lx = 0.4 * xScale ly = 0.6 * yScale Label() r = 4 * rscale cx = (-25 + 32) * xScale cy = (24 - 5) * yScale minv = 0 maxv = 5000 iv = 100 Gauge() aStr = "DRILL PIPE PSI" lx0 = (-29 + 32) * xScale ly0 = (24 - -1) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() r = 2.5 * rscale cx = (-27 + 32) * xScale cy = (24 - -6) * yScale minv = 0 maxv = maxmud iv = 10 Gauge() r = 2.5 * rscale cx = (-21.5 + 32) * xScale cy = (24 - -6) * yScale Gauge() aStr = "MUD PUMPS S.P.M" lx0 = (-29 + 32) * xScale ly0 = (24 - -10.5) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "SURVEY DATA" lx0 = (-17 + 32) * xScale ly0 = (24 - -11) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() SURVEY() Box() endsub Sub Box 'DRILL FLOOR BOX x0 = -8.5 y0 = -8.5 X1 = 8.5 Y1 = 16.6 gfxcolor = Color14 FillRectangleConvert() x0 = -8.0 y0 = -8.0 X1 = 8.0 Y1 = 16.1 gfxcolor = Color0 FillRectangleConvert() DY = 4 x0 = -8.5 y0 = -8.5 X1 = -8.0 Y1 = -8.0 gfxcolor = Color4 DrawLineConvert() x0 = -8.0 y0 = -8.0 X1 = -8.0 Y1 = 16.0 gfxcolor = Color4 DrawLineConvert() x0 = -8.0 y0 = 16 X1 = 8.0 Y1 = 16 gfxcolor = Color4 DrawLineConvert() x0 = 8.0 y0 = 16 X1 = 8.5 Y1 = 16.6 gfxcolor = Color4 DrawLineConvert() x0 = 8.5 y0 = 16.6 X1 = -8.5 Y1 = 16.6 gfxcolor = Color4 DrawLineConvert() x0 = -8.5 y0 = 16.6 X1 = -8.5 Y1 = -8.5 gfxcolor = Color4 DrawLineConvert() aStr = "DRILL FLOOR WINDOW" lx0 = -5 ly0 = -9.7 ly = 1 lx = 0.6 ConvertLabel() Label() 'stars For i = 0 To 50 X = -8 + Math.GetRandomNumber(16) '16 * Rnd Y = 6 + Math.GetRandomNumber(10) '10 * RND X = (X + 32) * xScale Y = (24 - Y) * yScale GraphicsWindow.PenColor = Color15 GraphicsWindow.DrawLine(x,y,x+.5,y+.5) GraphicsWindow.PenColor = Color14 GraphicsWindow.DrawLine(x-.5,y-.5,x,y) endfor x0 = -8 y0 = -8 X1 = 8 Y1 = 6 gfxcolor = Color2 FillRectangleConvert() shadow: x0 = -1.25 y0 = 0 X1 = 6 Y1 = 6 gfxcolor = Color8 DrawLineConvert() x0 = 6 y0 = 6 X1 = 6.6 Y1 = 6 gfxcolor = Color8 DrawLineConvert() x0 = 6.6 y0 = 6 X1 = 0 Y1 = -1.5 gfxcolor = Color8 DrawLineConvert() x0 = 0 y0 = -1.5 X1 = -1.25 Y1 = 0 gfxcolor = Color8 DrawLineConvert() x0 = -1.25 Y0 = 0 X1 = 6 Y1 = 6 X2 = 0 Y2 = -1.5 gfxcolor = Color8 FillTriangleConvert() x0 = 0 Y0 = -1.5 X1 = 6.6 Y1 = 6 X2 = 6 Y2 = 6 gfxcolor = Color8 FillTriangleConvert() ARROW: 'save up just now GraphicsWindow.PenWidth = 2 x0 = 0 y0 = -6.3 X1 = 0 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() GraphicsWindow.PenWidth = 1 x0 = 0 y0 = -6.3 X1 = 0 Y1 = -5.3 gfxcolor = Color15 DrawLineConvert() GraphicsWindow.PenWidth = 2 x0 = 0 y0 = -5.3 X1 = -1 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() x0 = -1 y0 = -5.3 X1 = 0 Y1 = -3.3 gfxcolor = Color8 DrawLineConvert() x0 = 0 y0 = -3.3 X1 = 1 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() x0 = 1 y0 = -5.3 X1 = 0 Y1 = -5.3 gfxcolor = Color8 DrawLineConvert() GraphicsWindow.PenWidth = 1 x0 = -1 Y0 = -5.3 X1 = 1 Y1 = -5.3 X2 = 0 Y2 = -3.3 gfxcolor = Color15 FillTriangleConvert() Y = 6 For D = 12 To 3 Step -1 x0 = -8 y0 = y X1 = 8 Y1 = y gfxcolor = Color3 DrawLineConvert() Y = Y - 9 / D endfor For i = 0 To 8 X1 = 2 * i Y1 = -8 If X1 > 8 Then Y1 = (X1 - 8) / (i + 0.0001) * 14 - 8 X1 = 8 EndIf sx1 = X1 sy1 = y1 x0 = -sx1 y0 = sy1 X1 = -i Y1 = 6 gfxcolor = Color3 DrawLineConvert() x0 = sx1 y0 = sy1 X1 = i Y1 = 6 gfxcolor = Color3 DrawLineConvert() EndFor x0 = -8 y0 = -8 X1 = 8 Y1 = 16.1 gfxcolor = Color15 DrawRectangleConvert() FLOOR() 'HOLE() DRILL() aStr = "B.H.A Now Running: " lx0 = 1.4 ly0 = -6.4 lx = 0.37 ly = 0.9 ConvertLabel() Label() astr = "" If bha = 6 Or (bha = 8 And andrex = 1) Then If ander = 1 Then aStr = "F" endif If ander = 0 Then aStr = "U" endif EndIf X = 71 Y = 25 aStr = bha + " " + aStr gfxcolor = Color1 BuildTextShapeConvert() aStr = "BRAKE" lx0 = 9 ly0 = 15 lx = 0.5 ly = 0.8 ConvertLabel() Label() aStr = "OFF" lx0 = 9 ly0 = 13 lx = 0.5 ly = 0.8 ConvertLabel() label1() aStr = " ON" lx0 = 9 ly0 = -3 lx = 0.5 ly = 0.8 ConvertLabel() label1() x0 = 9 Y0 = -1 X1 = 11 Y1 = -1 X2 = 9 Y2 = 12 gfxcolor = Color12 FillTriangleConvert() x0 = 9 Y0 = 12 X1 = 11 Y1 = 12 X2 = 11 Y2 = -1 gfxcolor = Color10 FillTriangleConvert() brake = 1 L = (1 - brake) * 13 - 1 Lasthandle = L Handle() endsub sub Handle L = (1 - brake) * 13 - 1 If createHandle = "true" then i = 1 x0 = 8 + .5 y0 = L X1 = 9 Y1 = L + .5 gfxcolor = Color0 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() x0 = 11 Y0 = L X1 = 11 Y1 = L+.5 X2 = 12 Y2 = L gfxcolor = Color0 BuildTriangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() x0 = 8 y0 = L X1 = 8 + .5 Y1 = L + .5 gfxcolor = Color0 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() x0 = 8 y0 = L X1 = 8 Y1 = L + .5 gfxcolor = Color0 BuildLineShapeConvert() AddHandleShape() x0 = 9 y0 = L X1 = 9 + 2*brake Y1 = L + .5 gfxcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) AddHandleShape() x0 = 9+2*brake y0 = L X1 = 11 Y1 = L + .5 gfxcolor = Color2 BuildRectangleShapeConvert() AddHandleShape() hp = 13 x0 = 7 y0 = L + .5 X1 = 11 Y1 = L + 1 gfxcolor = Color13 BuildRectangleShapeConvert() AddHandleShape() x0 = 11 Y0 = L + 1 X1 = 12 Y1 = L + .5 X2 = 11 Y2 = L + .5 gfxcolor = Color13 BuildTriangleShapeConvert() AddHandleShape() x0 = 11 Y0 = L + .5 X1 = 12 Y1 = L + .5 X2 = 12 Y2 = L gfxcolor = Color13 BuildTriangleShapeConvert() AddHandleShape() x0 = 7 y0 = L + .5 X1 = 7 Y1 = L + 1 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() x0 = 7 y0 = L + 1 X1 = 11 Y1 = L + 1 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() x0 = 11 y0 = L + 1 X1 = 12 Y1 = L + .5 gfxcolor = Color15 BuildLineShapeConvert() AddHandleShape() createHandle = "false" handleShapeCnt = i endif L = (1 - brake) * 13 - 1 ly0 = (24 - -1) * yScale 'starting point ly1 = (24 - L) * yScale lyMove = (ly1 - ly0) If lyMove <> 0 then For i = 1 to handleShapeCnt shape = handleShapes[i]["Name"] X = handleShapes[i]["Left"] Y = handleShapes[i]["Top"] + lyMove Shapes.Move(shape,x,y) endfor endif Lasthandle = L endsub Sub AddHandleShape handleShapes[i]["Name"] = shape handleShapes[i]["Top"] = Shapes.GetTop(shape) handleShapes[i]["Left"] = Shapes.GetLeft(shape) i = i + 1 endsub Sub FLOOR 'SHADOW For i = 125 To 40 Step -0.2 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) x0 = X y0 = Y - 1 X1 = X + .3 Y1 = Y - .6 gfxcolor = Color8 DrawLineConvert() endfor For i = 0 To 360 Step .25 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) If i = 0 Then x0 = X y0 = Y X1 = X Y1 = Y shx = X shy = y gfxcolor = Color1 DrawLineConvert() endif x0 = shx y0 = shy X1 = X Y1 = Y gfxcolor = Color1 DrawLineConvert() endfor For i = 0 To 38 Step .25 j = i * p1 X = 5 * Math.Sin(j) Y = 2.55 * Math.Cos(j) If i = 0 Then x0 = .95 y0 = -.15 X1 = X Y1 = Y shx = x0 shy = y0 gfxcolor = Color17 DrawLineConvert() endif x0 = shx y0 = shy X1 = X Y1 = Y gfxcolor = Color17 DrawLineConvert() endfor shx = X shy = Y x0 = shx y0 = shy X1 = 1.3 Y1 = -.3 gfxcolor = Color8 x0 = 1.3 y0 = -.3 X1 = 0 Y1 = 0 gfxcolor = Color8 'DrawLineConvert() For i = 270 To 90 Step -0.3 j = i * p1 X = 5 * Math.Sin(j) Y = 2.5 * Math.Cos(j) pp = Color4 If i > 130 Then pp = Color12 endif x0 = x y0 = Y X1 = X Y1 = Y-1 gfxcolor = pp DrawLineConvert() EndFor endsub Sub DRILL r = 1.25 x0 = r y0 = 16 X1 = r Y1 = 0 gfxcolor = Color1 'DrawLineConvert() shx = r shy = 0 For i = 90 To 270 x0 = shx y0 = 16 X1 = r * Math.Sin(i * p1) Y1 = 0.5 * r * Math.Cos(i * p1) shx = x1 shy = y1 gfxcolor = Color9 DrawLineConvert() endfor endsub sub StartSelect errorSelect: x0 = -24 y0 = 3 X1 = -1 Y1 = 10.5 OpenWindow() QB = 1.16 B = 2 a = 9 + B x0 = -19.9 y0 = 18.2-QB*a X1 = -6.1 Y1 = 19.3-QB*a gfxcolor = Color8 gfxPcolor = Color14 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) Stack.PushValue(openWindowStack,shape) highlight = shape gfxcolor = Color13 X = 22 Y = 12 aStr = "Please Select Starting Point" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) gfxcolor = Color11 X = 25 Y = 14 aStr = " Previous Status" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) X = 25 Y = 15 aStr = " NEW" BuildTextShapeConvert() Stack.PushValue(openWindowStack,shape) startsel: if bStr = "None" Then Goto startsel endif If bStr = "Up" And B <> 1 Then B = B - 1 hmove = -1.167 * yScale X = Shapes.GetLeft(highlight) Y = Shapes.GetTop(highlight)+hmove Shapes.Move(highlight,x,y) EndIf If bStr = "Down" And B <> 2 Then B = B + 1 hmove = 1.167 * yScale X = Shapes.GetLeft(highlight) Y = Shapes.GetTop(highlight)+hmove Shapes.Move(highlight,x,y) endif If bStr = "Return" Then GoTo accepted3 endif GoTo startsel accepted3: SHUTWINDOW() If stuck = 0 Then SHUTWINDOW() endif If B = 1 Then 'recover data If Text.GetLength(simStr) < 4 Then simStr = "status.sim" EndIf fileText = "" line = 1 ' The following line could be harmful and has been automatically commented. ' fileText = File.ReadLine(simStr,line) line = line + 1 If fileText = "" Then 'error GraphicsWindow.ShowMessage("File " + simStr + " cannot be found.","No File") Goto errorselect endif SplitFileCommaString() inclination = split[1] direction = split[2] holedepth = split[3] BD = split[4] md = split[5] bha = split[6] back = split[7] toolsav = split[8] ob = split[9] rotary = split[10] spin = split[11] rotgear = split[12] liftgear = split[13] toolorient = split[14] tf = split[15] startdepth = split[16] mud = split[17] ander = split[18] MEASUREDDEPTH = md tch: If toolsav = 1 Then surtool = 1 Else surtool = 2 'MWD unless SRG only endif For i = 1 To ob For j = 1 To 6 ' The following line could be harmful and has been automatically commented. ' wd[i][j] = File.ReadLine(simStr,line) line = line + 1 endfor endfor nobs = ob ' calculate XYZ wd[1][4] = 0 wd[1][5] = 0 wd[1][6] = 0 For ob = 1 To nobs - 1 'Call SURVEY(wd(), ob) EndFor ob = nobs 'GoTo nold1 Else exn = 1 'GoSub exselect If B = 5 Then exn = 2 stuck = 1 'GoSub exselect stuck = B simStr = "Stuck" + stuck + ".sim" B = 1 GoTo accepted3 EndIf EndIf 'GoSub getex endsub Sub SHUTWINDOW While Stack.GetCount(openWindowStack) > 0 shape = Stack.PopValue(openWindowStack) Shapes.Remove(shape) endwhile endsub Sub Label w = (Text.GetLength(aStr) + 1 ) * lx h = 1.5 * ly GraphicsWindow.BrushColor = Color0 GraphicsWindow.FillRectangle(lx0 - .5 * lx + 2, ly0 + 2 - h, w , h ) GraphicsWindow.BrushColor = Color8 GraphicsWindow.FillRectangle(lx0 - .5 * lx, ly0 - h, w, h) shd = 1 GraphicsWindow.PenWidth = 1.5 GraphicsWindow.PenColor = Color15 GraphicsWindow.DrawRectangle(lx0 - .5 * lx, ly0 - h, w, h) GraphicsWindow.PenWidth = 1 ly0 = ly0 + 0.3 * h - h/2 label1() shd = 0 endsub Sub ConvertLabel lx0 = (lx0 + 32) * xScale ly0 = (24 - ly0) * yScale lx = lx * xScale ly = ly * yScale endsub sub label1 keeplx0 = lx0 keeply0 = ly0 For ofst = shd To 0 Step -1 If ofst = 0 then GraphicsWindow.PenColor = Color15 GraphicsWindow.PenWidth = ly / 13 Else GraphicsWindow.PenColor = Color0 GraphicsWindow.PenWidth = ly / 13 EndIf lx0 = keeplx0 ly0 = keeply0 For LABI = 1 To Text.GetLength(aStr) LABC = Text.GetCharacterCode(Text.GetSubText(aStr, LABI, 1)) For LABJ = 1 To GH[LABC][1] LABJ1 = LABJ * 3 ch1 = lx * GH[LABC][LABJ1 - 1] / 12 CH2 = ly * GH[LABC][LABJ1] / 12 X = lx0 + ch1 + ofst Y = ly0 - CH2 + ofst If GH[LABC][LABJ1 + 1] = 1 Then GraphicsWindow.DrawLine(x,y,x,y) oldx = X oldy = y endif GraphicsWindow.DrawLine(oldx,oldy,x,y) oldx = X oldy = y endfor 'LABJ lx0 = lx0 + lx EndFor 'LABI endfor 'ofst GraphicsWindow.PenWidth = 1 EndSub Sub Gauge If r = 5.6 Then EXTRA = 19 Else EXTRA = 0 endif r1 = r X1 = cx + .3 * rscale Y1 = cy + .3 * rscale gfxcolor = Color0 FillCircle() X1 = cx Y1 = cy gfxcolor = Color12 FillCircle() r1 = .9 * r gfxcolor = Color8 FillCircle() r1 = r gfxcolor = Color15 DrawCircle() r1 = 0.9 * r gfxcolor = Color1 DrawCircle() r1 = .2 * r gfxcolor = Color14 FillCircle() 'numbers s = 300 / (maxv - minv) c = 0 For i = minv To maxv + EXTRA Step iv labit = 0 q = 0.06 * r If Math.Remainder(c,5) = 0 Then q = 1.5 * q EndIf If Math.Remainder(c,10) = 0 Then q = 1.5 * q labit = 1 endif a = (-150 + s * (i - minv)) * p1 'angle r1 = 0.86 * r r2 = r1 - q lp = 14 If i > maxv Then gfxColor = Color12 'lp = 12 Else gfxcolor = Color14 endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(cx + r1 * Math.Sin(a), cy - r1 * Math.Cos(a),cx + r2 * Math.Sin(a), cy - r2 * Math.Cos(a)) If labit = 1 And i <= maxv Then aStr = i lx = 0.09 * r ly = 0.12 * r lx0 = cx + 0.6 * r * Math.Sin(a) - 0.6 * lx * Text.GetLength(aStr) ly0 = cy - 0.6 * r * Math.Cos(a) + 0.6 * ly Label1() endif c = c + 1 endfor G = G + 1 'gauge counter gag[G][1] = r gag[G][2] = cx gag[G][3] = cy gag[G][4] = minv gag[G][5] = maxv gag[G][6] = 0 'first value newval = 0 Needle() endsub Sub Needle gfxColor = color8 ' P = 8 v = gag[G][6] Needpos() gfxColor = Color12 'P = 12 v = newval Needpos() gag[G][6] = newval EndSub sub Needpos a = (-150 + 300 * (v - gag[G][4]) / (gag[G][5] - gag[G][4])) * p1 'angle X = gag[G][2] Y = gag[G][3] r = gag[G][1] X1 = X + 0.4 * r * Math.Sin(a) Y1 = Y - 0.4 * r * Math.Cos(a) X2 = X + 0.22 * r * Math.Sin(a - 0.15) Y2 = Y - 0.22 * r * Math.Cos(a - 0.15) x3 = X + 0.22 * r * Math.Sin(a + 0.15) y3 = Y - 0.22 * r * Math.Cos(a + 0.15) GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(X1,Y1,X2,Y2) GraphicsWindow.DrawLine(x2,y2,x3,y3) GraphicsWindow.DrawLine(x3,y3,x1,y1) endsub sub Gears aStr = "ROTARY TABLE" lx0 = (-8 + 32) * xScale ly0 = (24 - 20) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "UNLK" lx0 = (-8 + 32) * xScale ly0 = (24 - 18) * yscale lx = 0.4 * xscale ly = 0.7 * yScale Label() aStr = "LOCK" lx0 = (-4 + 32) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() aStr = "DRAWWORKS CLUTCH" lx0 = (2 + 32) * xScale ly0 = (24 - 20) * yScale lx = 0.6 * xScale ly = 1 * yScale Label() aStr = "OUT" lx0 = (32 + 2) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() aStr = "IN" lx0 = (32 + 6) * xScale ly0 = (24 - 18) * yScale lx = 0.4 * xScale ly = 0.7 * yScale Label() r1 = .6 * rscale X1 = (32 + -5.5) * xScale Y1 = (24 - 18.35) * yScale gfxcolor = Color15 FillCircle() X1 = (32 + -1.5) * xScale FillCircle() X1 = (32 + 4.5) * xScale FillCircle() X1 = (32 + 8.5) * xScale FillCircle() Gears1() endsub Sub Gears1 gfxcolor = Color10 If rotgear = 0 Then gfxcolor = Color0 endif r1 = .5 * rscale X1 = (32 + -5.5) * xScale Y1 = (24 - 18.35) * yScale FillCircle() gfxcolor = Color12 If rotgear = 1 Then gfxcolor = Color0 endif X1 = (32 + -1.5) * xScale FillCircle() gfxcolor = Color10 If liftgear = -1 Then gfxcolor = Color0 endif X1 = (32 + 4.5) * xScale FillCircle() gfxcolor = Color12 ' P = 12: If liftgear = 1 Then gfxcolor = Color0 endif X1 = (32 + 8.5) * xScale FillCircle() endsub sub SURVEY x0 = -18.5 y0 = -9 X1 = -9 Y1 = 11.5 gfxcolor = Color14 FillRectangleConvert() x0 = -18 y0 = -8.5 X1 = -9.5 Y1 = 11 gfxcolor = Color7 FillRectangleConvert() x0 = -18 y0 = 7 X1 = -9 Y1 = 7.5 gfxcolor = Color14 FillRectangleConvert() x0 = -18 y0 = 3 X1 = -9 Y1 = 3.5 gfxcolor = Color14 FillRectangleConvert() x0 = -18 y0 = -1 X1 = -9 Y1 = -.5 gfxcolor = Color14 FillRectangleConvert() x0 = -18 y0 = -5 X1 = -9 Y1 = -4.5 gfxcolor = Color14 FillRectangleConvert() x0 = -18.5 y0 = -9 X1 = -18.4 Y1 = 11.5 gfxcolor = Color15 FillRectangleConvert() x0 = -18.5 y0 = 11.4 X1 = -9 Y1 = 11.5 gfxcolor = Color15 FillRectangleConvert() x0 = -18.5 y0 = -9 X1 = -9 Y1 = -8.9 gfxcolor = Color4 FillRectangleConvert() x0 = -9.1 y0 = -9 X1 = -9 Y1 = 11.5 gfxcolor = Color4 FillRectangleConvert() For j = 7.5 To -8.5 Step -4 x0 = -18.1 y0 = j X1 = -18 Y1 = j + 3.5 gfxcolor = Color4 FillRectangleConvert() x0 = -18 y0 = j + 3.5 X1 = -9.5 Y1 = j + 3.6 gfxcolor = Color4 FillRectangleConvert() x0 = -18.1 y0 = j X1 = -9.5 Y1 = j + .1 gfxcolor = Color4 FillRectangleConvert() x0 = -9.6 y0 = j X1 = -9.5 Y1 = j + 3.5 gfxcolor = Color4 FillRectangleConvert() endfor x0 = -16.5 y0 = 2.22 + 8 X1 = -10.5 Y1 = 2.93 + 8 gfxcolor = Color1 FillRectangleConvert() aStr = "BIT Depth" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 10.3 ConvertLabel() label1() x0 = -16.5 y0 = 2.22 + 4 X1 = -10.5 Y1 = 2.93 + 4 gfxcolor = Color1 FillRectangleConvert() aStr = "HOLE Depth" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 6.3 ConvertLabel() label1() x0 = -16.5 y0 = 2.22 X1 = -10.5 Y1 = 2.93 gfxcolor = Color1 FillRectangleConvert() aStr = "HOLE Dir'n" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = 2.3 ConvertLabel() label1() x0 = -16.5 y0 = 2.22 - 4 X1 = -10.5 Y1 = 2.93 - 4 gfxcolor = Color1 FillRectangleConvert() aStr = "INCLINAT'n" lx = 0.5 ly = 0.5 lx0 = -16 ly0 = -1.7 ConvertLabel() label1() x0 = -16.5 y0 = 2.22 - 8 X1 = -10.5 Y1 = 2.93 - 8 gfxcolor = Color1 FillRectangleConvert() aStr = " TOOLFACE " lx = 0.5 ly = 0.5 lx0 = -16 ly0 = -5.7 ConvertLabel() label1() panel: BDDISP() MDDISP() DIRDISP() INCDISP() TFDISP() EndSub sub BDDISP If BUNG <= 0 Then BD = md nx = -18 ny = 8 Value = BD keepblank = blank blank = 0 dis() blank = keepblank x0 = -12.3 y0 = 8 X1 = -11.9 Y1 = 8.4 gfxcolor = Color0 FillRectangleConvert() endif EndSub Sub MDDISP nx = -18 ny = 4 Value = holedepth keepblank = blank blank = 0 dis() blank = keepblank x0 = -12.3 y0 = 4 X1 = -11.9 Y1 = 4.4 gfxcolor = Color0 FillRectangleConvert() endsub sub DIRDISP nx = -18 ny = 0 If bdir < 0 Then bdir = bdir + 360 EndIf If bdir > 360 Then bdir = bdir - 360 endif Value = bdir dis() x0 = -12.3 y0 = 0 X1 = -11.9 Y1 = 0.4 gfxcolor = Color0 FillRectangleConvert() endsub Sub INCDISP nx = -18 ny = -4 Value = binc fd = 2 dis() x0 = -12.3 y0 = -4 X1 = -11.9 Y1 = -3.6 gfxcolor = Color0 FillRectangleConvert() endsub Sub TFDISP nx = -18 ny = -8 aStr = Math.Round(tf*100) keepblank = blank If tf = -99 Then blank = 1 EndIf Value = tf If hit = 1 And tf > 180 Then Value = 360 - tf endif fd = 2 dis() blank = keepblank x0 = -12.3 y0 = -8 X1 = -11.9 Y1 = -7.6 gfxcolor = Color0 FillRectangleConvert() tfc = 11 tfcStr = "A" If hit = 1 Then If tf > 180 Then tfc = Color12 tfcStr = "L" EndIf If tf <= 180 Then tfc = color10 tfcStr = "R" endif EndIf X = 27 Y = 26 aStr = tfcStr gfxcolor = tfc BuildTextShapeConvert() Endsub sub dis u = 0 aStr = " " + Math.Round(Value * 100) aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6) If Value < 1 Then aStr = " 00" + aStr aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6) endif If Value < 0.1 Then aStr = " 000" + aStr aStr = Text.GetSubTextToEnd(aStr,text.GetLength(aStr)-6) endif dsx = nx + 1.2 * fd nx = dsx u = 0 For a = fd + 1 To 7 A1Str = Text.GetSubText(aStr, a, 1) If A1Str <> " " And u = 0 And a >= fd Then x0 = dsx + .1 y0 = ny x1 = nx Y1 = ny + 2 gfxcolor = Color7 FillRectangleConvert() u = 1 EndIf i = A1Str If blank = 1 Then i = 10 endif If u = 1 Then Digit() endif nx = nx + 1.2 If a = 5 Then nx = nx + 0.3 endif EndFor fd = 0 endsub sub Digit x0 = nx + .26 y0 = ny + 1.86 X1 = nx + .54 Y1 = ny + 2 gfxcolor = L[i][1] FillRectangleConvert() x0 = nx + .26 y0 = ny + 1 X1 = nx + .54 Y1 = ny + 1.14 gfxcolor = L[i][2] FillRectangleConvert() x0 = nx + .26 y0 = ny X1 = nx + .54 Y1 = ny + .14 gfxcolor = L[i][3] FillRectangleConvert() x0 = nx y0 = ny + 1 X1 = nx + .14 Y1 = ny + 2 gfxcolor = L[i][4] FillRectangleConvert() x0 = nx y0 = ny X1 = nx + .14 Y1 = ny + 1 gfxcolor = L[i][5] FillRectangleConvert() x0 = nx + .66 y0 = ny + 1 X1 = nx + .8 Y1 = ny + 2 gfxcolor = L[i][6] FillRectangleConvert() x0 = nx + .66 y0 = ny X1 = nx + .8 Y1 = ny + 1 gfxcolor = L[i][7] FillRectangleConvert() endsub Sub FillRectangleConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor If w > 0 and h > 0 then GraphicsWindow.FillRectangle(x0,y1,w,h) Else 'TextWindow.WriteLine("Application Error, width and/or height on object negative values") 'TextWindow.WriteLine(" width = " + w + " height = " + h) endif endsub Sub DrawRectangleConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif GraphicsWindow.PenColor = gfxcolor If w > 0 and h > 0 then GraphicsWindow.DrawRectangle(x0,y1,w,h) Else 'TextWindow.WriteLine("Application Error, width and/or height on object negative values") 'TextWindow.WriteLine(" width = " + w + " height = " + h) endif endsub sub BuildRectangleShapeConvert x0 = (x0 + 32) * xScale y1 = (24 - y1) * yScale w = ((X1 + 32) * xScale) - x0 h = ((24 - Y0) * yScale) - y1 If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + w + " ," + h) endif If gfxPcolor <> 0 then GraphicsWindow.PenColor = gfxPcolor else GraphicsWindow.PenColor = gfxcolor endif GraphicsWindow.BrushColor = gfxcolor shape = Shapes.AddRectangle(w,h) Shapes.Move(shape,x0,y1) Shapes.ShowShape(shape) endsub Sub DrawLineConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawLine(x0,y0,x1,y1) endsub sub BuildTextShapeConvert x = ((X * 8 / 640 * 46.1)) * xScale y = Y * 16 / 480 * 35 * yScale If debug = "on" then TextWindow.WriteLine(x + ", " + y ) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor shape = Shapes.AddText(aStr) Shapes.Move(shape,x,y) Shapes.ShowShape(shape) endsub Sub BuildLineShapeConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor shape = Shapes.AddLine(x0,y0,x1,y1) Shapes.ShowShape(shape) endsub Sub FillTriangleConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) X2 = (X2 + 32) * xScale Y2 = (24 - y2) * yScale If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.PenColor = gfxcolor GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.FillTriangle(x0,y0,x1,y1,x2,y2) endsub Sub BuildTriangleShapeConvert x0 = (x0 + 32) * xScale y0 = (24 - y0) * yScale x1 = ((X1 + 32) * xScale) y1 = ((24 - Y1) * yScale) X2 = (X2 + 32) * xScale Y2 = (24 - y2) * yScale If debug = "on" then TextWindow.WriteLine(x0 + ", " + y1 + ", " + " ," + x1 + " ," + y1) endif GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.PenColor = gfxcolor shape = Shapes.AddTriangle(x0,y0,x1,y1,x2,y2) Shapes.ShowShape(shape) endsub sub OpenWindow wind: 'GET (x0, y0)-(X1, Y1), holder sx0 = x0 sy0 = y0 sx1 = X1 sy1 = Y1 'window shadow x0 = sx0 + 1 y0 = sy0 X1 = sX1 Y1 = sY1 - 2 gfxPcolor = Color0 BuildRectangleShapeConvert() Shapes.SetOpacity(shape,50) Stack.PushValue(openWindowStack,shape) 'TextWindow.WriteLine(y0 + " , " + y1) ' Line (x0, y0 + 1)-(X1 - 1, Y1), 0, BF x0 = sx0 y0 = sy0 + 1 X1 = sX1 -1 Y1 = sY1 gfxcolor = Color0 gfxPcolor = Color14 BuildRectangleShapeConvert() Stack.PushValue(openWindowStack,shape) ' Line (x0, y0 + 1)-(X1 - 1, Y1), 14, B endsub Sub DrawCircle GraphicsWindow.PenColor = gfxcolor GraphicsWindow.DrawEllipse(X1-r1,Y1-r1,r1*2,r1*2) endsub Sub FillCircle GraphicsWindow.BrushColor = gfxcolor GraphicsWindow.FillEllipse(X1-r1,Y1-r1,r1*2,r1*2) endsub Sub Chars Nums() LoadChars() Goto bypass pr = 1 DEP = 1 line = 1 'filePath = Network.DownloadFile("http://www.advgeotech.com/tech21/CHARBANK") filepath = Network.DownloadFile("http://www.advgeotech.com/tech21/CHARBANK") For i = 1 To 128 GH[i][1] = 0 ' The following line could be harmful and has been automatically commented. ' GH[i][1] = File.ReadLine(filepath,line) line = line + 1 For j = 1 To 3 * GH[i][1] GH[i][j+1] = 0 ' The following line could be harmful and has been automatically commented. ' GH[i][j+1] = File.ReadLine(filepath,line) line = line + 1 EndFor EndFor bypass: 'TestChars() EndSub sub SplitFileCommaString For splitIndx = 1 to 256 split[splitIndx] = "" endfor splitIndx = 1 For textIndx = 1 to Text.GetLength(fileText) str = Text.GetSubText(fileText,textIndx,1) If str = "," Then splitIndx = splitIndx + 1 Else split[splitIndx] = Text.Append(split[splitIndx],str) EndIf endfor endsub Sub LoadChars chardata[0] = "start" chardata[1] = "0," chardata[2] = "0," chardata[3] = "0," chardata[4] = "6,4,8,1,4,0,1,1,4,2,4,8,2,7,4,2,4,0,2," chardata[5] = "0," chardata[6] = "0," chardata[7] = "0," chardata[8] = "0," chardata[9] = "0," chardata[10] = "0," chardata[11] = "0," chardata[12] = "0," chardata[13] = "0," chardata[14] = "0," chardata[15] = "0," chardata[16] = "0," chardata[17] = "0," chardata[18] = "0," chardata[19] = "0," chardata[20] = "0," chardata[21] = "0," chardata[22] = "0," chardata[23] = "0," chardata[24] = "6,4,12,1,0,6,2,8,6,2,4,12,2,4,6,1,4,0,2," chardata[25] = "7,0,6,1,8,6,2,4,0,2,0,6,2,4,6,1,4,12,1,4,6,2," chardata[26] = "5,0,6,1,8,6,2,6,8,2,8,6,2,6,4,2," chardata[27] = "5,8,6,1,0,6,2,2,8,2,2,4,1,0,6,2," chardata[28] = "3,3,8,1,3,3,2,7,3,2," chardata[29] = "12,0,6,1,2,8,2,2,4,1,2,8,2,0,6,1,2,4,2,2,6,1,6,6,2,6,8,2,8,6,2,6,4,2,6,6,2," chardata[30] = "0," chardata[31] = "0," chardata[32] = "0," chardata[33] = "14,3,0,1,3,1,2,4,1,2,4,0,2,3,0,2,3,3,1,2,8,2,2,11,2,3,12,2,4,12,2,5,11,2,5,8,2,4,3,2,3,3,2," chardata[34] = "10,2,12,1,3,12,2,3,10,2,2,9,2,2,12,2,5,12,1,6,12,2,6,10,2,5,9,2,5,12,2," chardata[35] = "8,2,0,1,2,12,2,6,12,1,6,0,2,8,3,1,0,3,2,0,9,1,8,9,2," chardata[36] = "16,0,2,1,2,1,2,6,1,2,8,3,2,8,4,2,6,6,2,2,6,2,0,8,2,0,9,2,2,11,2,6,11,2,8,10,2,4,12,1,4,11,2,4,1,1,4,0,2," chardata[37] = "6,8,12,1,0,0,2,2,9,1,2,9,2,5,3,1,5,3,2," chardata[38] = "12,8,0,1,1,8,2,1,10,2,2,12,2,3,12,2,4,10,2,4,8,2,0,4,2,0,2,2,2,0,2,5,0,2,7,5,2," chardata[39] = "8,2,12,1,5,12,1,2,12,2,2,9,2,5,9,2,5,12,2,5,8,2,3,6,2," chardata[40] = "6,5,0,1,3,2,2,2,4,2,2,8,2,3,10,2,5,12,2," chardata[41] = "6,3,0,1,5,2,2,6,4,2,6,8,2,5,10,2,3,12,2," chardata[42] = "8,1,6,1,7,6,2,1,3,1,7,9,2,2,9,1,7,3,2,4,3,1,4,9,2," chardata[43] = "4,1,6,1,7,6,2,4,3,1,4,9,2," chardata[44] = "7,3,0,1,4,0,2,5,1,2,5,4,2,3,4,2,3,2,2,5,2,2," chardata[45] = "2,1,6,1,7,6,2," chardata[46] = "5,3,0,1,5,0,2,5,2,2,3,2,2,3,0,2," chardata[47] = "2,0,0,1,8,12,2," chardata[48] = "10,2,0,1,0,2,2,0,10,2,2,12,2,6,12,2,2,0,2,6,0,2,8,2,2,8,10,2,6,12,2," chardata[49] = "5,3,10,1,4,12,2,4,0,2,2,0,2,6,0,2," chardata[50] = "8,0,10,1,2,12,2,6,12,2,8,10,2,8,8,2,6,6,2,0,0,2,8,0,2," chardata[51] = "13,0,10,1,2,12,2,6,12,2,8,10,2,8,8,2,6,6,2,4,6,2,6,6,2,8,4,2,8,2,2,6,0,2,2,0,2,0,2,2," chardata[52] = "4,6,0,1,6,12,2,0,3,2,8,3,2," chardata[53] = "9,0,2,1,2,0,2,6,0,2,8,2,2,8,5,2,6,7,2,0,7,2,0,12,2,8,12,2," chardata[54] = "11,0,6,1,6,6,2,8,4,2,8,2,2,6,0,2,2,0,2,0,2,2,0,10,2,2,12,2,6,12,2,8,10,2," chardata[55] = "3,0,12,1,8,12,2,1,0,2," chardata[56] = "16,2,6,1,0,8,2,0,10,2,2,12,2,6,12,2,8,10,2,8,8,2,6,6,2,2,6,2,0,4,2,0,2,2,2,0,2,6,0,2,8,2,2,8,4,2,6,6,2," chardata[57] = "11,0,2,1,2,0,2,6,0,2,8,2,2,8,10,2,6,12,2,2,12,2,0,10,2,0,8,2,2,6,2,8,6,2," chardata[58] = "10,3,2,1,5,2,2,5,4,2,3,4,2,3,2,2,3,6,1,5,6,2,5,8,2,3,8,2,3,6,2," chardata[59] = "13,3,7,1,5,7,1,3,7,2,3,4,2,5,4,2,5,7,2,5,0,1,3,0,2,3,3,2,5,3,2,5,0,2,5,-1,2,4,-2,2," chardata[60] = "3,8,12,1,0,6,2,8,0,2," chardata[61] = "4,2,6,1,6,6,2,2,4,1,6,4,2," chardata[62] = "3,0,12,1,8,6,2,0,0,2," chardata[63] = "10,2,8,1,2,10,2,4,12,2,6,12,2,8,10,2,8,7,2,5,4,2,5,2,2,5,0,1,5,0,2," chardata[64] = "12,4,0,1,2,0,2,1,2,2,1,8,2,3,10,2,5,10,2,7,8,2,7,5,2,4,5,2,4,7,2,5,9,2,5,10,2," chardata[65] = "5,0,0,1,4,12,2,8,0,2,1,3,1,7,3,2," chardata[66] = "12,0,0,1,0,12,2,5,12,2,7,10,2,7,8,2,6,7,2,0,7,2,6,7,1,8,5,2,8,2,2,6,0,2,0,0,2," chardata[67] = "8,8,2,1,6,0,2,2,0,2,0,2,2,0,10,2,2,12,2,6,12,2,8,10,2," chardata[68] = "7,0,0,1,0,12,2,6,12,2,8,10,2,8,2,2,6,0,2,0,0,2," chardata[69] = "6,8,0,1,0,0,2,0,12,2,8,12,2,7,6,1,0,6,2," chardata[70] = "5,0,0,1,0,12,2,8,12,2,7,6,1,0,6,2," chardata[71] = "10,5,5,1,8,5,2,8,2,2,6,0,2,2,0,2,0,2,2,0,10,2,2,12,2,6,12,2,8,10,2," chardata[72] = "6,0,0,1,0,12,2,0,6,2,8,6,2,8,12,2,8,0,2," chardata[73] = "6,3,0,1,5,0,2,4,0,2,4,12,2,3,12,2,5,12,2," chardata[74] = "8,4,12,1,8,12,2,6,12,2,6,2,2,4,0,2,2,0,2,0,2,2,0,4,2," chardata[75] = "6,0,0,1,0,12,2,0,5,2,7,12,2,2,7,2,8,0,2," chardata[76] = "3,0,12,1,0,0,2,8,0,2," chardata[77] = "5,0,0,1,0,12,2,4,0,2,8,12,2,8,0,2," chardata[78] = "4,0,0,1,0,12,2,8,0,2,8,12,2," chardata[79] = "9,2,0,1,0,2,2,0,10,2,2,12,2,6,12,2,8,10,2,8,2,2,6,0,2,2,0,2," chardata[80] = "7,0,0,1,0,12,2,6,12,2,8,10,2,8,8,2,6,6,2,0,6,2," chardata[81] = "11,2,0,1,0,2,2,0,10,2,2,12,2,6,12,2,8,10,2,8,2,2,6,0,2,2,0,2,5,3,1,8,0,2," chardata[82] = "9,0,0,1,0,12,2,6,12,2,8,10,2,8,8,2,6,6,2,0,6,2,5,6,1,8,0,2," chardata[83] = "12,0,2,1,2,0,2,6,0,2,8,2,2,8,4,2,6,6,2,2,6,2,0,8,2,0,10,2,2,12,2,6,12,2,8,10,2," chardata[84] = "4,4,0,1,4,12,2,0,12,2,8,12,2," chardata[85] = "6,0,12,1,0,2,2,2,0,2,6,0,2,8,2,2,8,12,2," chardata[86] = "3,0,12,1,4,0,2,8,12,2," chardata[87] = "5,0,12,1,2,0,2,4,12,2,6,0,2,8,12,2," chardata[88] = "4,0,0,1,8,12,2,0,12,1,8,0,2," chardata[89] = "5,0,12,1,4,6,2,4,0,2,4,6,2,8,12,2," chardata[90] = "4,0,12,1,8,12,2,0,0,2,8,0,2," chardata[91] = "4,5,12,1,4,12,2,4,0,2,5,0,2," chardata[92] = "2,0,12,1,8,0,2," chardata[93] = "4,3,12,1,4,12,2,4,0,2,3,0,2," chardata[94] = "4,4,12,1,2,9,2,4,12,2,6,9,2," chardata[95] = "2,2,-2,1,6,-2,2," chardata[96] = "9,2,12,1,5,12,1,2,12,2,2,9,2,5,9,2,5,12,2,2,9,1,2,8,2,5,6,2," chardata[97] = "13,2,8,1,6,8,2,7,7,2,7,0,2,8,0,2,7,1,1,6,0,2,1,0,2,0,2,2,0,3,2,0,4,2,2,5,2,7,5,2," chardata[98] = "12,0,12,1,1,12,2,1,0,2,0,0,2,1,7,1,3,8,2,6,8,2,8,6,2,8,2,2,6,0,2,3,0,2,1,1,2," chardata[99] = "8,8,6,1,6,8,2,2,8,2,0,6,2,0,2,2,2,0,2,6,0,2,8,2,2," chardata[100] = "12,8,12,1,7,12,2,7,0,2,8,0,2,7,1,1,5,0,2,2,0,2,0,2,2,0,6,2,2,8,2,5,8,2,7,7,2," chardata[101] = "10,0,4,1,8,4,2,8,6,2,6,8,2,2,8,2,0,6,2,0,2,2,2,0,2,6,0,2,8,1,2," chardata[102] = "9,0,8,1,4,8,2,4,0,1,0,0,2,2,0,1,2,10,2,4,12,2,6,12,2,8,10,2," chardata[103] = "14,8,8,1,7,8,2,7,-2,2,5,-4,2,2,-4,2,0,-3,2,7,1,1,5,0,2,2,0,2,0,3,2,0,6,2,2,8,2,5,8,2,7,7,2," chardata[104] = "9,0,12,1,1,12,2,1,0,2,0,0,2,1,6,1,3,8,2,6,8,2,8,6,2,8,0,2," chardata[105] = "4,4,8,1,4,0,2,4,10,1,4,10,2," chardata[106] = "9,8,8,1,7,8,2,7,-2,2,5,-4,2,2,-4,2,0,-3,2,0,0,2,7,10,1,7,10,2," chardata[107] = "8,0,12,1,1,12,2,1,0,2,0,0,2,1,3,1,6,8,2,4,6,1,8,0,2," chardata[108] = "5,3,12,1,4,12,2,4,0,2,2,0,2,6,0,2," chardata[109] = "13,1,0,1,1,8,2,1,7,2,2,8,2,3,8,2,4,7,2,4,6,2,5,6,2,5,7,2,6,8,2,7,8,2,8,7,2,8,0,2," chardata[110] = "9,0,8,1,1,8,2,1,0,2,0,0,2,1,6,1,3,8,2,6,8,2,8,6,2,8,0,2," chardata[111] = "9,6,0,1,2,0,2,0,2,2,0,6,2,2,8,2,6,8,2,8,6,2,8,2,2,6,0,2," chardata[112] = "13,0,9,1,1,8,2,1,-4,2,0,-4,1,2,-4,2,1,7,1,1,6,2,3,8,2,6,8,2,8,6,2,8,2,2,6,0,2,1,0,2," chardata[113] = "16,8,8,1,7,7,2,6,8,2,2,8,2,0,6,2,0,2,2,2,0,2,6,0,2,7,1,2,7,1,2,7,1,2,7,1,2,7,1,2,7,7,2,7,-4,2,8,-3,2," chardata[114] = "8,1,0,1,1,8,2,0,9,2,1,6,1,3,8,2,6,8,2,8,6,2,8,4,2," chardata[115] = "13,8,7,1,7,8,2,3,8,2,2,8,2,0,7,2,0,5,2,2,4,2,6,4,2,8,3,2,8,1,2,6,0,2,1,0,2,0,1,2," chardata[116] = "8,4,12,1,4,2,2,4,1,2,5,0,2,6,0,2,7,1,2,2,7,1,6,7,2," chardata[117] = "8,1,8,1,1,2,2,3,0,2,5,0,2,7,2,2,7,8,2,7,2,1,8,0,2," chardata[118] = "5,1,8,1,1,4,2,4,0,2,7,4,2,7,8,2," chardata[119] = "11,1,8,1,1,1,2,2,0,2,3,0,2,4,1,2,4,4,2,4,1,2,5,0,2,6,0,2,7,1,2,7,8,2," chardata[120] = "12,0,8,1,2,8,2,1,8,2,7,0,2,6,0,2,8,0,2,6,8,1,8,8,2,7,8,2,1,0,2,0,0,2,2,0,2," chardata[121] = "10,0,8,1,0,2,2,2,0,2,6,0,2,8,2,2,8,8,2,8,-2,2,6,-4,2,3,-4,2,2,-4,2," chardata[122] = "6,0,7,1,1,8,2,8,8,2,0,0,2,7,0,2,8,1,2," chardata[123] = "9,6,11,1,5,11,2,4,10,2,4,6,2,3,5,2,4,4,2,4,1,2,5,0,2,6,0,2," chardata[124] = "11,3,12,1,4,12,1,3,12,2,3,9,2,4,9,2,4,12,2,3,7,1,4,7,2,4,4,2,3,4,2,3,7,2," chardata[125] = "9,3,11,1,4,11,2,5,10,2,5,6,2,6,5,2,5,4,2,5,1,2,4,0,2,3,0,2," chardata[126] = "9,3,12,1,4,12,2,5,11,2,5,9,2,4,8,2,3,8,2,2,9,2,2,11,2,3,12,2," chardata[127] = "6,4,6,1,2,3,2,2,0,2,6,0,2,6,3,2,4,6,2," chardata[128] = "0," For i = 1 To 128 fileText = "" fileText = chardata[i] SplitFileCommaString() GH[i][1] = split[1] 'TextWindow.Write(fileText + " = " + GH[i][1] + ",") temp = 3 * GH[i][1] 'TextWindow.Write("(" + temp + ")") For j = 2 To 3 * GH[i][1] GH[i][j] = split[j] 'TextWindow.Write(GH[i][j] + ",") EndFor 'TextWindow.WriteLine("("+j+")") EndFor EndSub Sub TestChars 'test input/output for Chars For i = 1 To 128 TextWindow.WriteLine(GH[i][1]) For j = 1 To 3 TextWindow.WriteLine(GH[i][j+1]) EndFor EndFor EndSub sub Nums Data[0] = "1711111" Data[1] = "7777711" Data[2] = "1117117" Data[3] = "1117711" Data[4] = "7171711" Data[5] = "1111771" Data[6] = "7111171" Data[7] = "1777711" Data[8] = "1111111" Data[9] = "1111711" Data[10] = "7777777" For i = 0 To 10 'TextWindow.WriteLine(" ") For j = 1 To 7 aStr = Text.GetSubText(Data[i],j,1) If aStr = "1" Then L[i][j] = Color1 ElseIf aStr = "7" then L[i][j] = Color7 EndIf 'TextWindow.Write(L[i][j]) EndFor EndFor endsub End>VRH672.sb< Start>VRH793.sb< '=========================================================== ' A SIMPLE 3D MAZE GAME for SMALL BASIC using LITDEV extension '=========================================================== LDUtilities.GWState = 2 gw = GraphicsWindow.Width gh = GraphicsWindow.Height 'GraphicsWindow.Width = gw 'GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Title = "Small Basic 3D Cone Maze" 'User name GraphicsWindow.BrushColor = "Red" GraphicsWindow.FontSize = 20 user = "" userBox = Controls.AddTextBox(50,100) Controls.SetTextBoxText(userBox,"") Controls.SetSize(userBox,200,30) userTxt = Shapes.AddText("Enter your user name here") Shapes.Move(userTxt,50,50) userButton = Controls.AddButton("OK",50,150) Controls.ButtonClicked = OnButtonClicked While (user = "") Program.Delay(100) EndWhile Shapes.Remove(userBox) Shapes.Remove(userButton) Shapes.Remove(userTxt) Sub OnButtonClicked user = Controls.GetTextBoxText(userBox) EndSub '=========================================================== ' INITIALISATION '=========================================================== GraphicsWindow.DrawText(50,50,"KEYS: Keypad + W, S, A, D, Escape") GraphicsWindow.DrawText(50,100,"Recommend just Left, Right and W (forward)") GraphicsWindow.DrawText(50,150,"Find all the evil spinning cones to get a high score!") GraphicsWindow.DrawText(50,200,"Go when the title bar timer starts...") 'Load images and set main control variables wallImg = ImageList.LoadImage(Program.Directory+"\wall.jpg") stonesImg = ImageList.LoadImage(Program.Directory+"\stones.jpg") waterImg = ImageList.LoadImage(Program.Directory+"\water.jpg") args = "" 'For use with LDCall speed = 1 'Control speed size = 1 ' The image per tile scaling proximity = size/10 'Closest approach to an object 'Wait for OK button = Controls.AddButton("OK",50,250) ok = 0 Controls.ButtonClicked = OnOK While (ok = 0) Program.Delay(100) EndWhile START: GraphicsWindow.Clear() 'Create a view view3D = LD3DView.AddView(gw,gh,"True") 'Will not clip to size if window rescaled creation = Shapes.AddText("Creating Scene") 'Create a cone geometry createCone() 'Create a basic wall tile object createBasicWall() 'Animation end event LD3DView.TranslationCompleted = OnTranslationCompleted 'Create a world based on layout ' X is an empty room ' L is a room with a light ' C is a room with a rotating illuminated cone layout = "" layout[15] = "LXX LXXXXXXXXXXXXXXXLXXXX" layout[14] = "X X XXLXX X X XCX " layout[13] = "XXLXX X X X L " layout[12] = "L C XXL XL X LXXXXXXXLXXXXX" layout[11] = "XXX L X X LXXXX X XCX" layout[10] = "L XXXXXX X L X XXLXXXLXXXLX" layout[9] = "X X L XXXXLXXXXXXXXL X X X" layout[8] = " X X X L X XLXX" layout[7] = "LXXX LXXXXXXXXXXXLXXXXXX L X X" layout[6] = "C X XLXX X X XXXXX L " layout[5] = "XXLXX X XXXX LXXXXXXX L X" layout[4] = "L X XXL XL X XXXXXXXXXX" layout[3] = "XXX L X XXXXXXXLXXXX XCX" layout[2] = "X XXXXXX X X XXLXXXXXXXLX" layout[1] = "XXL XX XLXXXXXXXXXXXXXXXXXXXXLXXXXXXX" createWorld() 'Some different light types 'LD3DView.AddDirectionalLight(view3D,"#201010",1,1,1) 'LD3DView.AddDirectionalLight(view3D,"#201010",-1,1,-1) LD3DView.AddAmbientLight(view3D,"#101010") 'Dim ambient light Shapes.Remove(creation) '=========================================================== ' GAME LOOP '=========================================================== startTime = Clock.ElapsedMilliseconds progress = 0 While (progress < coneCount) start = Clock.ElapsedMilliseconds 'Use the keys to move the camera - comment S to prevent backwards movement out of the maze, or Up, Down, A and D to simplify movement yaw = 0 pitch = 0 roll = 0 move = 0 If (LDUtilities.KeyDown("Left")) Then yaw = yaw-1.5*speed EndIf If (LDUtilities.KeyDown("Right")) Then yaw = yaw+1.5*speed EndIf If (LDUtilities.KeyDown("Up")) Then pitch = pitch-1.5*speed EndIf If (LDUtilities.KeyDown("Down")) Then pitch = pitch+1.5*speed EndIf If (LDUtilities.KeyDown("A")) Then roll = roll+1.5*speed EndIf If (LDUtilities.KeyDown("D")) Then roll = roll-1.5*speed EndIf If (LDUtilities.KeyDown("W")) Then move = move+size/25*speed TextWindow.CursorTop = 1 TextWindow.WriteLine("W detected") EndIf If (LDUtilities.KeyDown("S")) Then move = move-size/25*speed EndIf 'Prevent forward movement into an object hit = LD3DView.HitTest(view3D,-1,-1) If (hit <> "" And hit[2] < proximity) Then TextWindow.CursorTop = 3 TextWindow.WriteLine("HIT "+hit[1]+" : "+hit[2]) TextWindow.CursorTop = 5 TextWindow.WriteLine("Proximity "+proximity) move = Math.Min(0,move) 'We can still back up For i = 1 To coneCount If (hit[1] = cone[i]) Then 'Remove cones as we find them LD3DView.ModifyObject(view3D,cone[i],"H") progress = progress+1 EndIf EndFor EndIf 'Perhaps better without the pitch and roll LD3DView.MoveCamera(view3D,yaw,pitch,roll,move) 'These are relative changes wrt current view 'Exit If (LDUtilities.KeyDown("Escape")) Then Program.End() EndIf 'Reanimate cones For kCone = 1 To coneCount If (startConeAnimation[kCone] = 1) Then startConeAnimation[kCone] = 0 LDCall.Function("animateCone",kCone) EndIf EndFor 'Display the camera position and direction and game time pos = LDCall.Function2("truncate",LD3DView.GetCameraPosition(view3D),2) dir = LDCall.Function2("truncate",LD3DView.GetCameraDirection(view3D),2) GraphicsWindow.Title = "Time = "+Math.Round((Clock.ElapsedMilliseconds-startTime)/1000)+" Cones remaining = "+(coneCount-progress)+" Position = ("+pos[1]+" , "+pos[2]+" , "+pos[3]+") Direction = "+dir[1]+" , "+dir[2]+" , "+dir[3]+")" delay = 20 - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile 'Game ends - check the scores Shapes.Remove(view3D) timesec = Math.Round((Clock.ElapsedMilliseconds-startTime)/1000) GraphicsWindow.DrawText(50,50,"You did it in "+timesec+" seconds") score = Math.Max(0,1000-timesec) hightscore = LDNetwork.HighScore("3DMazeGame2",user,score) GraphicsWindow.DrawText(50,100,"Your score is "+score) GraphicsWindow.DrawText(50,150,"The high score is "+hightscore[2]+" by "+hightscore[1]) 'Wait for OK button = Controls.AddButton("OK",50,200) ok = 0 Controls.ButtonClicked = OnOK While (ok = 0) Program.Delay(100) EndWhile GoTo START '=========================================================== ' SUBROUTINES '=========================================================== 'Creata a basic wall tile object Sub createBasicWall points = "" indices = "" textures = "" index = 0 For i = 1 To size For j = 1 To size x1 = i-1 x2 = i y1 = j-1 y2 = j z = 0 'Triangle1 points = points+x1+":"+y1+":"+z+":" points = points+x2+":"+y1+":"+z+":" points = points+x2+":"+y2+":"+z+":" indices = indices + index+":"+(index+1)+":"+(index+2)+":" index = index+3 textures = textures + "0 0:0 1:1 1:" 'Triangle2 points = points+x1+":"+y1+":"+z+":" points = points+x2+":"+y2+":"+z+":" points = points+x1+":"+y2+":"+z+":" indices = indices + index+":"+(index+1)+":"+(index+2)+":" index = index+3 textures = textures + "0 0:1 1:1 0:" EndFor EndFor wall = LD3DView.AddGeometry(view3D,points,indices,"","White","D") LD3DView.AddImage(view3D,wall,textures,wallImg,"D") LD3DView.ModifyObject(view3D,wall,"H") EndSub Sub createWall i = args[1] 'Left to Right j = args[2] 'Front to Back k = args[3] 'Down to Up dir = args[4] If (dir = "F") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.TranslateGeometry(view3D,return,i*size,k*size,-j*size) ElseIf (dir = "B") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,180) LD3DView.TranslateGeometry(view3D,return,i*size,k*size,-j*size+size) ElseIf (dir = "L") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,90) LD3DView.TranslateGeometry(view3D,return,i*size-size/2,k*size,-j*size+size/2) ElseIf (dir = "R") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,-90) LD3DView.TranslateGeometry(view3D,return,i*size+size/2,k*size,-j*size+size/2) ElseIf (dir = "U") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.AddImage(view3D,return,textures,waterImg,"D") LD3DView.RotateGeometry(view3D,return,1,0,0,90) LD3DView.TranslateGeometry(view3D,return,i*size,k*size+size/2,-j*size+size/2) ElseIf (dir = "D") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.AddImage(view3D,return,textures,stonesImg,"D") LD3DView.RotateGeometry(view3D,return,1,0,0,-90) LD3DView.TranslateGeometry(view3D,return,i*size,k*size-size/2,-j*size+size/2) EndIf LD3DView.Freeze(view3D,return) ' We won't ever modify this so freeze it EndSub 'Change the input array of numbers to the required number of decimal places Sub truncate return = args[1] sigfig = args[2] multiplier = Math.Power(10,sigfig) For i = 1 To Array.GetItemCount(return) return[i] = (1/multiplier)*Math.Round(multiplier*return[i]) EndFor EndSub 'Get layout character Sub getChar i = args[1] j = args[2] return = Text.GetSubText(layout[i],j,1) If (return = " ") Then return = "" EndIf EndSub 'Crearte a maze layout - the large indexes are forward Sub createWorld cameraSet = 0 coneCount = 0 For y = 1 To Array.GetItemCount(layout) Shapes.Remove(creation) creation = Shapes.AddText("Creating Scene "+Math.Round(100*(y)/(Array.GetItemCount(layout)))+"%") For x = 1 To Text.GetLength(layout[y]) char = LDCall.Function2("getChar",y,x) If (char <> "") Then If (cameraSet = 0) Then 'Initial camera position and direction and view angle LD3DView.ResetCamera(view3D,x*size+size/2,0.4*size,-size/2,0,0,-1,"","","") LD3DView.CameraProperties(view3D,0,30*size,60) ' limit to 30 blocks (the longest corridor) cameraSet = 1 'The first room is the start point EndIf 'Floor and ceiling LDCall.Function4("createWall",x,y,0,"U") LDCall.Function4("createWall",x,y,0,"D") 'Left and right walls If (LDCall.Function2("getChar",y,x-1) = "") Then LDCall.Function4("createWall",x,y,0,"L") EndIf If (LDCall.Function2("getChar",y,x+1) = "") Then LDCall.Function4("createWall",x,y,0,"R") EndIf 'Front and back walls If (LDCall.Function2("getChar",y-1,x) = "") Then LDCall.Function4("createWall",x,y,0,"B") EndIf If (LDCall.Function2("getChar",y+1,x) = "") Then LDCall.Function4("createWall",x,y,0,"F") EndIf 'Add a lit cone - these are the main performance limiters so keep this kind of thing to a minimum If (char = "C") Then 'Lots of spotlights are slow. 'spot = LD3DView.AddSpotLight(view3D,"Red",x*size+0.1,size/2,-(y*size)+0.1,1,0,1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Green",x*size+size-0.1,size/2,-(y*size)+0.1,-1,0,1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Blue",x*size+size-0.1,size/2,-(y*size-size)-0.1,-1,0,-1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Yellow",x*size+0.1,size/2,-(y*size-size)-0.1,1,0,-1,80,0.8*size) color = LDColours.HSLtoRGB(Math.GetRandomNumber(360),1,0.5)' A random high brightness colour 'spot = LD3DView.AddSpotLight(view3D,color,x*size+size/2,size,-(y*size-size/2),0,-1,0,30,size/2) 'spot = LD3DView.AddPointLight(view3D,color,x*size+size/2,0.98*size,-(y*size-size/2),2*size) coneCount = coneCount+1 cone[coneCount] = LD3DView.AddGeometry(view3D,pointsCone,indicesCone,"",color,"D") 'A base colour LD3DView.AddImage(view3D,cone[coneCount],texturesCone,waterImg,"S") ' Some shiny texture that is stronly affected by lights LD3DView.TranslateGeometry(view3D,cone[coneCount],x*size+size/2,size/3,-(y*size-size/2)) LD3DView.AnimateRotation(view3D,cone[coneCount], 0, 1, 0, 0, 360, 3, -1) coneX[coneCount] = x coneY[coneCount] = y LDCall.Function("animateCone",coneCount) EndIf 'Add a point light If (char = "L") Then point = LD3DView.AddPointLight(view3D,"White",x*size+size/2,0.98*size,-(y*size-size/2),5*size) EndIf EndIf EndFor EndFor EndSub 'Create a cone geometry Sub createCone nside = 10 height = size/2 radius = size/4 pointsCone = "0:"+(2/3*height)+":0:" indicesCone = "" texturesCone = "0.5:1:" For i = 0 To nside angle = i/nside*2*Math.Pi x = radius*Math.Cos(-angle) y = radius*Math.Sin(-angle) pointsCone = pointsCone+x+":"+(-height/3)+":"+y+":" If (i < nside) Then indicesCone = indicesCone + "0:"+(i+1)+":"+(i+2)+":" Else indicesCone = indicesCone + "0:"+(i+1)+":"+1+":" EndIf texturesCone = texturesCone + i/nside+":0:" EndFor EndSub 'OK button Sub OnOK ok = 1 EndSub 'Animate a cone Sub animateCone iCone = args[1] 'Current position xPos = coneX[iCone] yPos = coneY[iCone] 'The 4 possible new positions newX[1] = xPos-1 newY[1] = yPos newX[2] = xPos newY[2] = yPos+1 newX[3] = xPos+1 newY[3] = yPos newX[4] = xPos newY[4] = yPos-1 'Check for directions we can move For iDir = 1 To 4 move[iDir] = LDCall.Function2("getChar",newY[iDir],newX[iDir]) EndFor 'coneMoveDir is the last direction 1 to 4 as listed above - start in +Y direction if unset If (coneMoveDir[iCone] = "") Then coneMoveDir[iCone] = 2 EndIf 'Find the forward, back, left and right wrt current direction dirForward = coneMoveDir[iCone] dirLeft = coneMoveDir[iCone]-1 If (dirLeft < 1) Then dirLeft = 4+dirLeft EndIf dirRight = coneMoveDir[iCone]-3 If (dirRight < 1) Then dirRight = 4+dirRight EndIf dirBack = coneMoveDir[iCone]-2 If (dirBack < 1) Then dirBack = 4+dirBack EndIf 'Move forward with high chance If (move[dirForward] <> "" And Math.GetRandomNumber(10) > 2) Then coneX[iCone] = newX[dirForward] coneY[iCone] = newY[dirForward] coneMoveDir[iCone] = dirForward Else 'If not then move left or right with 50% chance each - otherwise move back If (move[dirLeft] <> "" And Math.GetRandomNumber(2) = 1) Then coneX[iCone] = newX[dirLeft] coneY[iCone] = newY[dirLeft] coneMoveDir[iCone] = dirLeft ElseIf (move[dirRight] <> "") Then coneX[iCone] = newX[dirRight] coneY[iCone] = newY[dirRight] coneMoveDir[iCone] = dirRight ElseIf (move[dirLeft] <> "") Then 'Move left if we cannot go right coneX[iCone] = newX[dirLeft] coneY[iCone] = newY[dirLeft] coneMoveDir[iCone] = dirLeft ElseIf (move[dirBack] <> "") Then coneX[iCone] = newX[dirBack] coneY[iCone] = newY[dirBack] coneMoveDir[iCone] = dirBack ElseIf (move[dirForward] <> "") Then ' It is possible we can only go forward coneX[iCone] = newX[dirForward] coneY[iCone] = newY[dirForward] coneMoveDir[iCone] = dirForward EndIf EndIf 'Do the move LD3DView.AnimateTranslation(view3D,cone[iCone],coneX[iCone]*size+size/2,size/3,-(coneY[iCone]*size-size/2),1) EndSub 'Move the cone when its last translation is completed Sub OnTranslationCompleted 'Handle rare possibility that a cone can 'get stuck' by ending its animation at the same time as another so check for all queued completed animations While (LD3DView.QueuedTranslationCompleted > 0) 'Almost always exactly one. lastCone = LD3DView.LastTranslationCompleted ' Get this value only once since it will dequeue any queued items For jCone = 1 To coneCount ' We use jCone because iCone and kCone are used elsewhere and we don't want them to conflict If (cone[jCone] = lastCone) Then startConeAnimation[jCone] = 1 EndIf EndFor EndWhile EndSub End>VRH793.sb< Start>VRM696.sb< GraphicsWindow.Clear() x=0 y=350 a=20 b=20 z=0 main: color=graphicswindow.GetRandomColor() GraphicsWindow.BrushColor=color square=Shapes.AddRectangle(a,b) Shapes.Move(square,x,y) While 1=1 y=y-10 If y=z+10 Then y=350 x=x+20 Goto main endif If x=640 Then x=0 z=z+20 endif Program.Delay(10) Shapes.Move(square,x,y) endwhile End>VRM696.sb< Start>VRN586.sb< ' Fidget Spinner ' Copyright © 2018 Nonki Takahashi. The MIT License. ' Last update 2018-07-20 GraphicsWindow.Title = "Fidget Spinner" Init() da = 45 While "True" a = a + da If 360 <= a Then a = a - 360 EndIf For i = 1 To 3 _a = Math.GetRadians(a + (i - 1) * 120) x = ox + r * Math.Sin(_a) y = oy - r * Math.Cos(_a) Shapes.Move(out[i], x - 35, y - 35) Shapes.Move(in[i], x - 25, y - 25) EndFor Program.Delay(100) EndWhile Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh ox = gw / 2 oy = gh / 2 r = 60 i = 0 GraphicsWindow.BrushColor = "Transparent" GraphicsWindow.PenWidth = 12 color = "GreenYellow" For i = 1 To 3 a = (i - 1) * 120 _a = Math.GetRadians(a) x = ox + r * Math.Sin(_a) y = oy - r * Math.Cos(_a) GraphicsWindow.PenColor = color out[i] = Shapes.AddEllipse(70, 70) Shapes.Move(out[i], x - 35, y - 35) GraphicsWindow.PenColor = "Black" in[i] = Shapes.AddEllipse(48, 48) Shapes.Move(in[i], x - 24, y - 24) EndFor GraphicsWindow.BrushColor = color GraphicsWindow.PenWidth = 0 ell = Shapes.AddEllipse(70, 70) Shapes.Move(ell, ox - 35, oy - 35) GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "DimGray" ell = Shapes.AddEllipse(50, 50) Shapes.Move(ell, ox - 25, oy - 25) EndSub End>VRN586.sb< Start>VRQ268.sb< GraphicsWindow.Show() '112 is where my attempt at automatic fireing would be Gw = 800 Gh = 600 GraphicsWindow.Width = Gw GraphicsWindow.Height = Gh GraphicsWindow.CanResize = "No" GraphicsWindow.BrushColor = "Black" Rec = Shapes.AddRectangle(RangeRad * 2 , RangeRad * 2) Shapes.SetOpacity(Rec,50) Timer.Interval = 5 Timer.Tick = CheckFire TankHeight = 10 TankSpeed = 1 numOfTanks = 5 RangeRad = 200 Ballcount = 10 Topimg = ImageList.LoadImage("C:\Tower defence\Top.Png") BottomImg = ImageList.LoadImage("C:\Tower defence\Base.Png") Background = ImageList.LoadImage("C:\Tower defence\Background.png") BackgroundW = ImageList.GetWidthOfImage(Background) BackgroundH = ImageList.GetHeightOfImage(Background) ' For By = 1 To GraphicsWindow.Height Step BackgroundH For Bx = 1 To GraphicsWindow.Width Step BackgroundW GraphicsWindow.DrawImage(Background,Bx,By) EndFor EndFor Rapidcount = 50 SetUp() SpawnTanks() Tnum = 1 GraphicsWindow.MouseDown = Md GraphicsWindow.MouseMove = Mm While 1 = 1 Program.Delay(5) MoveTanks() GetAngle() OldTimeStart = Timestart Timestart = Clock.ElapsedMilliseconds TimeElapsed = Timestart - OldTimeStart EndWhile '_____________________________________________________ '_____________________________________________________ '_____________________________________________________ Sub GetAngle For num = 1 To TurretNum Posx[num] = Tankx[Tnum] Posy[num] = Tanky[Tnum] If Posx[num] > Tx[num] Then AngleRadians[num] = Math.ArcTan((Posy[num] - Ty[num]) / (Posx[num] - Tx[num])) + 1.57079 '90 Degs. In Radians ElseIf Posx[num] < Tx[num] Then AngleRadians[num] = Math.ArcTan((Posy[num] - Ty[num]) / (Posx[num] - Tx[num])) - 1.57079 '90 Degs. In Radians ElseIf Posx[num] = Tx[num] And Posy[num] > Ty[num] Then AngleRadians[num] = Math.ArcTan((Posy[num] - Ty[num]) / (Posx[num] - Tx[num])) + 3.14159 EndIf Angle[num] = Math.GetDegrees(AngleRadians[num]) ii = num For iii = 1 To Ballcount If Tx[num] <> "" Then Shapes.Rotate(Top[ii], Angle[ii]) Xstart[ii][iii] = 8 * Math.Cos(AngleRad[ii][iii]) + (Tx[ii] + 15) Ystart[ii][iii] = 8 * Math.Sin(AngleRad[ii][iii]) + (Ty[ii] + 15) Time[ii][iii] = Time[ii][iii] + .002 x[ii][iii] = Vh[ii][iii] * Time[ii][iii] + Xstart[ii][iii] y[ii][iii] = Vv[ii][iii] * Time[ii][iii] + Math.Power(Time[ii][iii],2) + Ystart[ii][iii] For l = 1 To numOfTanks If Tankx[l] < (Tx[ii] + RangeRad) And Tankx[l] > (Tx[ii] - RangeRad) And Tanky[l] < (Ty[ii] + RangeRad) And Tanky[l] > (Ty[ii] - RangeRad) Then Canfire[ii] = "Yes" Tnum = l '----- If The tank is inside the fireing Range, then fire at it. ----- Else Canfire = "No" EndIf If x[ii][iii] > Tankx[l] And x[ii][iii] < Tankx[l] + 40 And y[ii][iii] > Tanky[l] And y[ii][iii] < Tanky[l] + TankHeight Then Tank[l] = "" EndIf EndFor Shapes.Move(Ball[ii][iii],x[ii][iii],y[ii][iii]) EndIf EndFor EndFor EndSub '______________________________________________________ Sub Md Mousex = GraphicsWindow.MouseX MouseY = GraphicsWindow.MouseY If Objectmove = "TbTurret" Then Tx[TurretNum] = Mousex Ty[TurretNum] = MouseY Objectmove = "" numshotsfired = " " TurretFire[TurretNum] = Math.GetRandomNumber(Rapidcount - 1) Else EndIf If Mousex > 100 And Mousex < 130 And MouseY > 10 And MouseY < 40 And Money > 0 Then Objectmove = "TbTurret" TurretNum = TurretNum + 1 TurretBase[TurretNum] = Shapes.AddImage(BottomImg) Top[TurretNum] = LDShapes.AddAnimatedGif("C:\Tower defence\Top.gif","False") LDShapes.AnimationSet(Top,LDShapes.AnimationCount(Top[TurretNum])) Shapes.Move(TurretBase[TurretNum],Mousex,MouseY) Shapes.Move(Top[TurretNum],Mousex,MouseY - 5) Money = Money - 10 Shapes.SetText(MoneyText,Money + " $") Else EndIf EndSub '__________________________________ Sub SetUp out = 1 IntMoney = 50 Money = IntMoney MoneyText = Shapes.AddText(IntMoney + " $") Shapes.Move(MoneyText,10,10) GraphicsWindow.DrawImage(BottomImg, 100,10) GraphicsWindow.DrawImage(Topimg, 100,5) GraphicsWindow.DrawText(105,40,"10 $") EndSub '_________________________________ Sub Mm Mousex = GraphicsWindow.MouseX MouseY = GraphicsWindow.MouseY If Objectmove = "TbTurret" Then Shapes.Move(TurretBase[TurretNum],Mousex,MouseY) Shapes.Move(Top[TurretNum],Mousex,MouseY - 5) EndIf EndSub '______________________________________ Sub Fire t = FireNum numshotsfired = numshotsfired + 1 If numshotsfired = BallCount Then numshotsfired = 1 EndIf If Ball[t][numshotsfired] = "" Then Ball[t][numshotsfired] = Shapes.AddEllipse(10,10) EndIf LDShapes.AnimationSet(Top[t],1) AngleRad[t][numshotsfired] = Math.GetRadians(Angle[t] - 90) V[t][numshotsfired] = 100 Vh[t][numshotsfired] = Math.GetDegrees(Math.Cos(AngleRad[t][numshotsfired])) * V[t][numshotsfired] Vv[t][numshotsfired] = Math.GetDegrees(Math.Sin(AngleRad[t][numshotsfired])) * V[t][numshotsfired] Time[t][numshotsfired] = 0 EndSub '____________________________________________________ Sub CheckFire For ll = 1 To TurretNum If Tx[ll] <> "" Then TurretFire[ll] = TurretFire[ll] + 1 If TurretFire[ll] > Rapidcount Then If Canfire[ll] <> "No" Then FireNum = ll Fire() TurretFire[ll] = 0 EndIf EndIf EndIf EndFor EndSub '_______________________________________________ Sub SpawnTanks For Tnum = 1 To numOfTanks Tankx[Tnum] = Gw + Math.GetRandomNumber(Gw) Tanky[Tnum] = Math.GetRandomNumber(Gh - TankHeight) Tank[Tnum] = Shapes.AddRectangle(40,10) Shapes.Move(Tank[Tnum],Tankx[Tnum],Tanky[Tnum]) EndFor EndSub '___________________________ Sub MoveTanks For Tnum = 1 To numOfTanks Tankx[Tnum] = Tankx[Tnum] - TankSpeed Shapes.Move(Tank[Tnum],Tankx[Tnum],Tanky[Tnum]) EndFor EndSub End>VRQ268.sb< Start>VRR483.sb< Controls.ButtonClicked = OnButtonClicked Init() Ende = 0 While Ende = 0 If BC = 1 Then BC = 0 If LCB = Save Then Ende = 1 Shapes.HideShape(dv) ElseIf LCB = Report Then Reporting() EndIf EndIf EndWhile LDControls.DataViewSaveAsCSV(DV, FN, F) Program.Delay(100) Program.End() Sub Reporting EndSub 'Reporting Sub OnButtonClicked BC = 1 LCB = Controls.LastClickedButton EndSub 'OnButtonClicked Sub Init T = "True" F = "False" 'GraphicsWindow DTW = Desktop.Width DTH = Desktop.Height GWW = DTW - 10 GWH = DTH - 71 GWT = 0 GWL = -10 GraphicsWindow.Top = GWT GraphicsWindow.Left = GWL GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH GWFN = "Consolas" GWFS = 14 GraphicsWindow.FontName = GWFN GraphicsWindow.FontSize = GWFS BD = " Datum " BB = " € Betrag " BK = " Konto " BGK = " Gegenkonto " BT = "...............Buchungstext..............." headings[1] = BD headings[2] = BB headings[3] = BK headings[4] = BGK headings[5] = BT DV = LDControls.AddDataView(DTW -100, DTH - 200, headings) Shapes.Move(DV, 10, 30) FN = "E:\Buchung/Buchungen.csv" CSVD = ";" LDUtilities.CSVDeliminator = CSVD ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(FN) = T Then LDControls.DataViewReadFromCSV(DV, FN, F) EndIf K[1] = "10" KT[1] = "Kasse" K[2] = "12" KT[2] = "Bank" K[3] = "13" KT[3] = "Geldtransit" K[4] = "14" KT[4] = "Forderungen" K[5] = "16" KT[5] = "Verbindlichkeiten" K[6] = "40" KT[6] = "Lebensmittel" K[7] = "41" KT[7] = "Kleidung" K[8] = "45" KT[8] = "Fahrzeuge" K[9] = "49" KT[9] = "sonstige Kosten" K[10] = "80" KT[10] = "Einnahmen" For i = 1 To 10 KUT[i] = K[i] + " = " + KT[i] EndFor LDControls.DataViewSetColumnComboBox(DV,3,KUT) LDControls.DataViewSetColumnComboBox(DV,4,KUT) LDControls.DataViewColumnWidths(DV,"") LDControls.DataViewColAlignment(DV,2,"Right") Save = Controls.AddButton("Speichern", 10, DTH - 100) Report = Controls.AddButton("Auswertung", 100, DTH - 100) EndSub 'Init End>VRR483.sb< Start>VRS505.sb< '3D environment 'observer can move forward, back, shift left or right, and turn. 'based on original code by Path_DRC 'user can add rectangles at any x,y,z location 'Zeven Provincien April 2010 GraphicsWindow.BackgroundColor="Black" GraphicsWindow.Height = 600 GraphicsWindow.Width = 800 GraphicsWindow.Show() GraphicsWindow.KeyDown = ReadKey 'Information frame on left infoFrameWidth = 200 grFrameWidth = GraphicsWindow.Width - infoFrameWidth GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.FillRectangle(0,0,infoFrameWidth,grFrameWidth) 'text in Info Frame GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(48,1,"Adventurer's Name") GraphicsWindow.DrawText(48,80,"Map Coordinates:") GraphicsWindow.DrawText(5,220,"Forward = Up Arrow") GraphicsWindow.DrawText(5,240,"Back = Down Arrow") GraphicsWindow.DrawText(5,260,"Strafe left = Left Arrow") GraphicsWindow.DrawText(5,280,"Strafe right = Right Arrow") GraphicsWindow.DrawText(5,320,"Turn left/right = A / D") GraphicsWindow.DrawText(5,340,"End program = Esc") 'draw box around Maze-View window on the right GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawRectangle(infoFrameWidth,0,grFrameWidth,grFrameWidth) noObjects = 4 'Setup object's coordinates z1[1] = 101 z2[1] = 101 x1[1] = -11 y1[1] = 11 x2[1] = 11 y2[1] = -11 zc[1] = (z1[1] + z2[1]) / 2 xc[1] = (x1[1] + x2[1]) / 2 z1[2] = 201 z2[2] = 201 x1[2] = -11 y1[2] = 11 x2[2] = 11 y2[2] = -11 zc[2] = (z1[2] + z2[2]) / 2 xc[2] = (x1[2] + x2[2]) / 2 z1[3] = 301 z2[3] = 321 x1[3] = 1 y1[3] = 11 x2[3] = 1 y2[3] = -11 zc[3] = (z1[3] + z2[3]) / 2 xc[3] = (x1[3] + x2[3]) / 2 z1[4] = 1 z2[4] = 1 x1[4] = 51 y1[4] = 11 x2[4] = 71 y2[4] = 1 zc[4] = (z1[4] + z2[4]) / 2 xc[4] = (x1[4] + x2[4]) / 2 CameraAngle = 0 cameraX = 0 cameraY = 0 cameraZ = 0 deltaAngle = Math.Pi/90 Main: 'erase walls from Maze-View window GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenWidth = 2 GraphicsWindow.FillRectangle(infoFrameWidth,0,grFrameWidth,GraphicsWindow.Width) GraphicsWindow.PenColor = "White" 'draw box around Maze-View window on the right GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawRectangle(infoFrameWidth,0,grFrameWidth,grFrameWidth) For i = 1 to noObjects x1tmp[i] = (x1[i] - cameraX) * Math.Cos(CameraAngle) - (z1[i] - cameraZ) * Math.Sin(CameraAngle) z1tmp[i] = (z1[i] - cameraZ) * Math.Cos(CameraAngle) + (x1[i] - cameraX) * Math.Sin(CameraAngle) x2tmp[i] = (x2[i] - cameraX) * Math.Cos(CameraAngle) - (z2[i] - cameraZ) * Math.Sin(CameraAngle) z2tmp[i] = (z2[i] - cameraZ) * Math.Cos(CameraAngle) + (x2[i] - cameraX) * Math.Sin(CameraAngle) left_X[i] = grFrameWidth * (x1tmp[i] / z1tmp[i] + 0.5) right_X[i] = grFrameWidth * (x2tmp[i] / z2tmp[i] + 0.5) 'Y topLeft_Y[i] = grFrameWidth * (y1[i] / z1tmp[i] + 0.5) topRight_Y[i] = grFrameWidth * (y1[i] / z2tmp[i] + 0.5) bottomRight_Y[i] = grFrameWidth * (y2[i] / z2tmp[i] + 0.5) bottomLeft_Y[i] = grFrameWidth * (y2[i] / z1tmp[i] + 0.5) 'Draw maze If (left_X[i]*right_X[i]) > 0 then 'this condition avoids some extraneous line draws IsObjectinFront() If (objectinFront) then 'only draw objects in front of observer GraphicsWindow.PenWidth = 2 GraphicsWindow.DrawLine(left_X[i] + infoFrameWidth, topLeft_Y[i], right_X[i] + infoFrameWidth, topRight_Y[i]) GraphicsWindow.DrawLine(right_X[i] + infoFrameWidth, topRight_Y[i], right_X[i] + infoFrameWidth, bottomRight_Y[i]) GraphicsWindow.DrawLine(right_X[i] + infoFrameWidth, bottomRight_Y[i], left_X[i] + infoFrameWidth, bottomLeft_Y[i]) GraphicsWindow.DrawLine(left_X[i] + infoFrameWidth, bottomLeft_Y[i], left_X[i] + infoFrameWidth, topLeft_Y[i]) EndIf EndIf 'for debugging TextWindow.WriteLine("") TextWindow.Write("Z1 " + i + ": ") TextWindow.WriteLine(z1[i]) TextWindow.Write("Z2 " + i + ": ") TextWindow.WriteLine(z2[i]) TextWindow.Write("B1 L1 X1 " + i + ": ") TextWindow.WriteLine(left_X[i]) TextWindow.Write("B1 L1 X2 " + i + ": ") TextWindow.WriteLine(right_X[i]) TextWindow.Write("B1 L1 Y1 " + i + ": ") TextWindow.WriteLine(topLeft_Y[i]) TextWindow.Write("B1 L1 Y2 " + i + ": ") TextWindow.WriteLine(topRight_Y[i]) Endfor TextWindow.Write("Camera X : ") TextWindow.WriteLine(cameraX) TextWindow.Write("Camera Y : ") TextWindow.WriteLine(cameraY) TextWindow.Write("Camera Z : ") TextWindow.WriteLine(cameraZ) TextWindow.Write("Camera Angle : ") TextWindow.WriteLine(Math.GetDegrees(CameraAngle)) TextWindow.WriteLine(key) TextWindow.WriteLine("**********") unassignedkeypress: keyisupdated = "False" key = "" While (keyisupdated = "False") EndWhile If key = "Up" Then 'move forward cameraZ = cameraZ + 10 * Math.Cos(CameraAngle) cameraX = cameraX + 10 * Math.Sin(CameraAngle) ElseIf key = "Down" Then 'move backward cameraZ = cameraZ - 10 * Math.Cos(CameraAngle) cameraX = cameraX - 10 * Math.Sin(CameraAngle) ElseIf key = "Left" Then 'strafe left cameraZ = cameraZ + 10 * Math.Sin(CameraAngle) cameraX = cameraX - 10 * Math.Cos(CameraAngle) ElseIf key = "Right" Then 'strafe right cameraZ = cameraZ - 10 * Math.Sin(CameraAngle) cameraX = cameraX + 10 * Math.Cos(CameraAngle) ElseIf key = "A" Then 'turn left CameraAngle = CameraAngle - deltaAngle ElseIf key = "D" Then 'turn right CameraAngle = CameraAngle + deltaAngle ElseIf key = "Escape" Then Program.End() Else Goto unassignedkeypress EndIf Goto Main Sub ReadKey key = GraphicsWindow.LastKey keyisupdated = "True" EndSub 'determine if object is in front of observer 'method is to take a forward step and evaluate whether distance decreased between object and observer Sub IsObjectinFront stepx = 10 * Math.Sin(CameraAngle) stepz = 10 * Math.Cos(CameraAngle) dist1 = Math.Squareroot(Math.Power((xc[i]-cameraX),2) + Math.Power((zc[i]-cameraZ),2)) dist2 = Math.Squareroot(Math.Power((xc[i]-(cameraX + stepx)),2) + Math.Power((zc[i]-(cameraZ + stepz)),2)) deltaObjVector = dist2 - dist1 If deltaObjVector < 0 then objectinFront = "true" Else objectinFront = "false" EndIf EndSub End>VRS505.sb< Start>VRW388.sb< ' August Challenge 2016 ' colorful flashing complementary colors screen saver ' and screensaver program ' program by Yvan Leduc ' program: TDS275 'program: no : GraphicsWindow.Width=1366 GraphicsWindow.Height =768 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.BackgroundColor="black" While "true" k=(Math.GetRandomNumber(255)) For y = 1 To 255 step 0.5 GraphicsWindow.DrawRectangle(0+s,h+s,255+h,255-y) GraphicsWindow.brushcolor=graphicswindow.GetColorFromRGB(255-h,y+k,255-y) GraphicsWindow.FillRectangle(0+s,h+s,255+h,255-y) EndFor For x = 1 To 255 step 2 GraphicsWindow.DrawRectangle(s-h,255-h,255-x,255) GraphicsWindow.brushcolor=graphicswindow.GetColorFromRGB(s+x,255-x,x+k) GraphicsWindow.FillRectangle(s-h,255-h,255-x,255) EndFor For x = 255 To 1 step 3 GraphicsWindow.DrawRectangle(s,s-h,255-k,255-x) GraphicsWindow.brushcolor=graphicswindow.GetColorFromRGB(x+k,255-x,255-h) GraphicsWindow.FillRectangle(s,s-h,255-k,255-x) EndFor s=s+(Math.GetRandomNumber(1366)) h=h+(Math.GetRandomNumber(768)) If s>1366 Then s=0 EndIf If h>768 Then h=0 EndIf w=w+1 If w=100 Then GraphicsWindow.Clear() EndIf EndWhile End>VRW388.sb< Start>VRZ081-0.sb< ' Solitaire Marbles Game ' Version 0.2 ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Last update 2016-03-18 ' Program ID VRZ081-0 ' GraphicsWindow.Title = "Solitaire Marbles Game 0.2" gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh InitBoard() img = ImageList.LoadImage(folder + "/Marble.png") n = 0 For row = 1 To 7 y = y1 + (row - 1) * size * 2 For col = 1 To 7 x = x1 + (col - 1) * size * 2 If board[row][col] Then n = n + 1 shp[n] = Shapes.AddImage(img) Shapes.Move(shp[n], x - size / 2, y - size / 2) r[n] = row c[n] = col EndIf EndFor EndFor GraphicsWindow.MouseDown = OnMouseDown While "True" If mouseDown Then If 0 < picked Then y = y1 + (r[picked] - 1) * size * 2 x = x1 + (c[picked] - 1) * size * 2 Shapes.Move(shp[picked], x - size / 2, y - size / 2) picked = 0 Else CheckPicked() If 0 < picked Then y = y1 + (r[picked] - 1) * size * 2 x = x1 + (c[picked] - 1) * size * 2 Shapes.Move(shp[picked], x - size / 2, y - size * 0.7) EndIf EndIf mouseDown = "False" Else Program.Delay(200) EndIf EndWhile Sub CheckPicked For i = 1 To n y = y1 + (r[i] - 1) * size * 2 x = x1 + (c[i] - 1) * size * 2 ox = x - mx ' offset oy = y - my d = Math.SquareRoot(ox * ox + oy * oy) If d < size / 2 Then picked = i i = n ' break EndIf EndFor EndSub Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY mouseDown = "True" EndSub Sub InitBoard b[1] = "XX@@@XX" b[2] = "X@@@@@X" b[3] = "@@@@@@@" b[4] = "@@@ @@@" b[5] = "@@@@@@@" b[6] = "X@@@@@X" b[7] = "XX@@@XX" For row = 1 To 7 For col = 1 To 7 c = Text.GetSubText(b[row], col, 1) If c = "@" Then board[row][col] = "True" ElseIf c = " " Then board[row][col] = "False" ElseIf c = "X" Then board[row][col] = "OB" EndIf EndFor EndFor folder = "http://www.nonkit.com/smallbasic.files" GraphicsWindow.DrawImage(folder + "/SolitaireMarblesGameBoard.png", 0, 0) size = 30 ' ball size xc = gw / 2 yc = gh / 2 x1 = xc - 6 * size y1 = xc - 6 * size EndSub End>VRZ081-0.sb< Start>VRZ081-1.sb< ' Solitaire Marbles ' Version 0.3b ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Last update 2016-03-19 ' Program ID VRZ081-1 ' GraphicsWindow.Title = "Solitaire Marbles 0.3b" Not = "False=True;True=False;" gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh InitBoard() img = ImageList.LoadImage(folder + "/Marble.png") n = 0 For row = 1 To 7 y = y1 + (row - 1) * size * 2 For col = 1 To 7 x = x1 + (col - 1) * size * 2 If board[row][col] Then n = n + 1 shp[n] = Shapes.AddImage(img) Shapes.Move(shp[n], x - size / 2, y - size / 2) r[n] = row c[n] = col index[row][col] = n removed[n] = "False" EndIf EndFor EndFor GraphicsWindow.MouseDown = OnMouseDown While "True" If mouseDown Then If 0 < picked Then For i = 1 To nc ox = xt[i] - mx ' offset oy = yt[i] - my d = Math.SquareRoot(ox * ox + oy * oy) If d < size / 2 Then Move() picked = 0 i = nc ' break EndIf EndFor Else CheckPicked() If 0 < picked Then CanPick() If 0 < picked Then y = y1 + (r[picked] - 1) * size * 2 x = x1 + (c[picked] - 1) * size * 2 Shapes.Move(shp[picked], x - size / 2, y - size * 0.7) EndIf EndIf EndIf mouseDown = "False" Else Program.Delay(200) EndIf EndWhile Sub Move ' param picked - marble index to check ' param i - candidate move index index[r[picked]][c[picked]] = "" board[r[picked]][c[picked]] = "False" If 0 < ir[i] Then index[r[ir[i]]][c[ir[i]]] = "" board[r[ir[i]]][c[ir[i]]] = "False" Shapes.Remove(shp[ir[i]]) EndIf index[rt[i]][ct[i]] = picked board[rt[i]][ct[i]] = "True" removed[ir[i]] = "True" Shapes.Move(shp[picked], xt[i] - size / 2, yt[i] - size / 2) r[picked] = rt[i] c[picked] = ct[i] EndSub Sub CanPick ' param picked - marble index to check row = r[picked] col = c[picked] nc = 0 ' number of candidate moves xt = "" ' target x candidate array yt = "" ' target y candidate array rt = "" ' target row candidate array ct = "" ' target column candidate array rr = "" ' row array to remove cr = "" ' column array to remove For d = 1 To 4 row2 = row + dr[d] * 2 col2 = col + dc[d] * 2 rp = row + dr[d] cp = col + dc[d] If board[rp][cp] And Not[board[row2][col2]] Then nc = nc + 1 yt[nc] = y1 + (row2 - 1) * size * 2 xt[nc] = x1 + (col2 - 1) * size * 2 rt[nc] = row2 ct[nc] = col2 ir[nc] = index[rp][cp] ' marble index to remove EndIf EndFor If nc = 0 Then picked = 0 Else nc = nc + 1 yt[nc] = y1 + (row - 1) * size * 2 xt[nc] = x1 + (col2 - 1) * size * 2 rt[nc] = row ct[nc] = col EndIf EndSub Sub CheckPicked ' param n - number of marbles ' param mx, my - mouse clicked coordinate ' return picked - picked marble index or 0 For i = 1 To n If Not[removed[i]] Then y = y1 + (r[i] - 1) * size * 2 x = x1 + (c[i] - 1) * size * 2 ox = x - mx ' offset oy = y - my d = Math.SquareRoot(ox * ox + oy * oy) If d < size / 2 Then picked = i i = n ' break EndIf EndIf EndFor EndSub Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY mouseDown = "True" EndSub Sub InitBoard b[1] = "XX@@@XX" b[2] = "X@@@@@X" b[3] = "@@@@@@@" b[4] = "@@@ @@@" b[5] = "@@@@@@@" b[6] = "X@@@@@X" b[7] = "XX@@@XX" For row = 1 To 7 For col = 1 To 7 m = Text.GetSubText(b[row], col, 1) If m = "@" Then board[row][col] = "True" ElseIf m = " " Then board[row][col] = "False" ElseIf m = "X" Then board[row][col] = "OB" EndIf EndFor EndFor folder = "http://www.nonkit.com/smallbasic.files" GraphicsWindow.DrawImage(folder + "/SolitaireMarblesGameBoard.png", 0, 0) size = 30 ' ball size xc = gw / 2 yc = gh / 2 x1 = xc - 6 * size y1 = yc - 6 * size dc = "1=1;2=0;3=-1;4=0;" ' direction coloumn dr = "1=0;2=1;3=0;4=-1;" ' direction row EndSub Sub DumpBoard For row = 1 To 7 For col = 1 To 7 If board[row][col] Then m = "@" ElseIf Not[board[row][col]] Then m = "." Else m = " " EndIf TextWindow.Write(m) EndFor TextWindow.WriteLine("") EndFor TextWindow.WriteLine("") EndSub End>VRZ081-1.sb< Start>VRZ081.sb< ' Solitair Marbles Art ' Version 0.1 ' Copyright © 2014-2016 Nonki Takahashi. The MIT License. ' Last update 2016-03-14 ' Ported from KFJ748-2 ' GraphicsWindow.Title = "Solitair Marbles Art" gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = 420 yo = 640 dark = GraphicsWindow.GetColorFromRGB(239, 148, 80) light = GraphicsWindow.GetColorFromRGB(244, 182, 136) GraphicsWindow.BackgroundColor = dark GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "#00000000" s = 30 ' ball size f = (s * 17 - s * 15) / 2 For d = s * 17 To s * 15 Step -2 u = ((d - s * 15) - f) / f v = 1 - Math.SquareRoot(1 - u * u) o = v * 30 e = Shapes.AddEllipse(d, d) Shapes.SetOpacity(e, o) Shapes.Move(e, (gw - d) / 2, (gh - d) / 2) EndFor f = s - 2 For y = gh / 2 - s * 6.5 To gh / 2 + s * 5.5 Step s * 2 dy = (y + s / 2) - gh / 2 For x = gw / 2 - s * 6.5 To gw / 2 + s * 5.5 Step s * 2 dx = (x + s / 2) - gw / 2 r = Math.SquareRoot(dx * dx + dy * dy) + s / 2 If r < s * 7.5 Then a = 0 For d = s To 2 Step -2 u = (d - 2) / f v = 1 - Math.SquareRoot(1 - u * u) o = v * 30 e = Shapes.AddEllipse(d, d) Shapes.SetOpacity(e, o) Shapes.Move(e, x + a, y + a) a = a + 1 EndFor EndIf EndFor EndFor d = 7 ratio = 14 ' vertical / horizontal For y = 0 To gh - 1 For x = 0 To gw - 1 GetColor() GraphicsWindow.SetPixel(x, y, medium) EndFor EndFor Sub GetColor ' param x, y - point to get color nx = x - xo ny = (y - yo) / ratio r = Math.Remainder(Math.SquareRoot(nx * nx + ny * ny), d) half = d / 2 If "True" Then p = Math.Floor((1 - Math.Power(r / half - 1, 2)) * 100) Else If r < half Then p = Math.Floor(r / half * 100) Else p = Math.Floor((d - r) / half * 100) EndIf EndIf MediumColor() GraphicsWindow.PenColor = medium EndSub Sub MediumColor ' param dark, light - given colors ' param p - percentage ' return medium - medium color For i = 1 To 3 hex = Text.GetSubText(dark, i * 2, 2) Math_Hex2Dec() a = dec hex = Text.GetSubText(light, i * 2, 2) Math_Hex2Dec() b = dec v[i] = Math.Floor(a * (1 - p / 100) + b * p / 100) EndFor medium = GraphicsWindow.GetColorFromRGB(v[1], v[2], v[3]) EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param hex - hexadecimal ' return dec - decimal dec = 0 len = Text.GetLength(hex) For ptr = 1 To len dec = dec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(hex, ptr, 1)) - 1 EndFor EndSub End>VRZ081.sb< Start>VRZ516-0.sb< ' http://technet.microsoft.com/en-us/library/ee198902.aspx ' http://www.merlyn.demon.co.uk/batfiles.htm ' http://www.merlyn.demon.co.uk/vb-dates.htm ' formatdatetime(date,vblongdate) ' formatdatetime(date,vbshortdate) ' eg ...>cscript.exe //nologo Calendar.vbs 1 2010 ' ...>cscript.exe //nologo Calendar.vbs [MM YYYY] Option Explicit Dim X, Mo, Yr, KW, YS, MN, WD, LD, Wk, D Set X = WScript.Arguments : '' WScript.Echo "Parameter:", X(0), X(1) 'If X.Count < 2 Then ' WScript.Echo (" MonthCalender: (" & WeekDayName(WeekDay(Now), True) & Date & ")" & vbCrLf & _ ' " ..>cscript //nologo " & WScript.ScriptName & " [MM YYYY]" & vbCrLf & _ ' " ---------------------") ' WScript.Quit 'End If If X.Count <> 2 Then Mo = Month(Now) Yr = Year(Now) KW = Right(100 + DatePart("ww", Now, vbMonday, vbFirstFullWeek), 2) WScript.Echo (" MonthCalender (Today ist " & FormatDateTime(Now, vbLongDate) & ", CW " & KW & ")" & vbCrLf & _ " Syntax: [cscript //nologo] " & WScript.ScriptName & " [MM YYYY]" & vbCrLf & _ " ------------------------") Else Mo = X(0) : Yr = X(1) End If Set X = Nothing YS = "JanFebMarAprMayJunJulAugSepOctNovDec" MN = Mid(YS, 3*Mo-2, 3) : if MN="" then MN = Mo '' Month Name WScript.echo " ", MN, " ", Yr WScript.echo " CW Mo Tu We Th Fr Sa So" WD = WeekDay(DateSerial(Yr, Mo, 1), 2) '' Weekday Number from 1st (1st in Month) LD = Day(DateSerial(Yr, Mo+1, 0)) '' Last Day Number in Month Wk = Left(" ", (WD-1)*3) '' Previous Month Spaces-String ' WScript.Echo "WD: " & WD & "LD: " & LD For D = 1 To LD Wk = Wk & " " & Right(100+D, 2) : WD = WD + 1 If (WD=8) or (D=LD) Then WScript.Echo " " & Right(100 + DatePart("ww", DateValue(D & "." & Mo & "." & Yr), vbMonday, vbFirstFullWeek), 2) & " " & Wk WD = WD-7 : Wk = "" End If Next End>VRZ516-0.sb< Start>VSC113-0.sb< ' Game Clock 0.2b ' Copyright (c) 2014 Nonki Takahashi. ' ' Lisence: ' The MIT Lisence (MIT) ' http://en.wikipedia.org/wiki/MIT_License ' ' History: ' 0.2b 2014-04-21 Supported Fischer and hourglass mode. (VSC113-0) ' 0.1a 2014-04-19 Created. (VSC113) ' title = "Game Clock 0.2b" debug = "False" Init() While "True" SelectMode() Game() Wait() EndWhile Sub Game GraphicsWindow.BackgroundColor = "#333333" GraphicsWindow.BrushColor = "DarkSeaGreen" cx[1] = 20 cy[1] = 20 cw[1] = (gw - 60) / 2 ch[1] = gh - 100 GraphicsWindow.FillRectangle(cx[1], cy[1], cw[1], ch[1]) cx[2] = gw / 2 + 10 cy[2] = 20 cw[2] = (gw - 60) / 2 ch[2] = gh - 100 GraphicsWindow.FillRectangle(cx[2], cy[2], cw[2], ch[2]) atime[1] = atime atime[2] = atime[1] For i = 1 To 2 _time = atime[i] TimeToMillisecond() ms[i] = _ms EndFor _time = delay TimeToMillisecond() delayms = _ms GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Courier New" fs = 50 GraphicsWindow.FontSize = fs For i = 1 To 2 otime[i] = Shapes.AddText(atime[i]) If i = 1 Then x = 34 Else x = gw / 2 + 24 EndIf y = (gh - 80 - fs) / 2 Shapes.Move(otime[i], x, y) EndFor GraphicsWindow.FontSize = 30 GraphicsWindow.FontName = "Arial" bpause = Controls.AddButton("Pause", 20, gh - 70) Controls.SetSize(bpause, gw - 40, 50) ingame = "True" clicked = "False" turn = 0 GraphicsWindow.MouseDown = OnMouseDown ticked = "False" Timer.Interval = 1000 Timer.Tick = OnTick While ingame If clicked Then For i = 1 To 2 cx1 = cx[i] + cw[i] cy1 = cy[i] + ch[i] If (turn <> (3 - i)) And (cx[i] <= mx) And (mx < cx1) And (cy[i] <= my) And (my < cy1) Then If (turn <> 0) And (imode = 2) Then ms[3 - i] = ms[3 - i] + delayms EndIf PauseClock() turn = 3 - i StartClock() If imode = 2 Then _ms = ms[turn] MillisecondToTime() Shapes.SetText(otime[turn], _time) ElseIf imode = 3 Then EndIf EndIf EndFor clicked = "False" EndIf If ticked Then If 0 < turn Then _ms = ms[turn] - (ems - lastems) If _ms <= 0 Then _ms = 0 ingame = "False" Timer.Pause() Shapes.SetText(otime[turn], "TIME UP") turn = 0 Else MillisecondToTime() Shapes.SetText(otime[turn], _time) EndIf If imode = 3 Then _ms = ms[3 - turn] + (ems - lastems) MillisecondToTime() Shapes.SetText(otime[3 - turn], _time) EndIf EndIf ticked = "False" EndIf Program.Delay(200) EndWhile EndSub Sub Init GraphicsWindow.Title = title Not = "False=True;True=False;" gw = 598 gh = 300 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" mode = "1=Sudden Death;2=Fischer Delay;3=Hourglass;" imode = 1 ' current mode index turn = 0 EndSub Sub Wait Controls.SetButtonCaption(bpause, "Exit") exit = "False" Controls.ButtonClicked = OnExit While Not[exit] Program.Delay(200) EndWhile GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.Clear() EndSub Sub OnExit exit = "True" EndSub Sub SelectMode GraphicsWindow.FontName = "Arial" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "Black" bmode = Controls.AddButton("Mode", 10, 10) cmode = mode[imode] ' current mode omode = Shapes.AddText(cmode) Shapes.Move(omode, 60, 16) end = "False" atime = "00:30:00" GraphicsWindow.DrawText(10, 44, "Allotted Time") otime = Controls.AddTextBox(96, 40) Controls.SetSize(otime, 60, 22) Controls.SetTextBoxText(otime, atime) delay = "00:00:30" bok = Controls.AddButton("OK", 10, 100) Controls.TextTyped = OnTextTyped Controls.ButtonClicked = OnButtonClicked While Not[end] Program.Delay(200) EndWhile atime = Controls.GetTextBoxText(otime) delay = Controls.GetTextBoxText(odelay) GraphicsWindow.Clear() EndSub Sub PauseClock ' param turn If turn <> 0 Then ms[turn] = ms[turn] - (ems - lastems) If imode = 3 Then ms[3 - turn] = ms[3 - turn] + (ems - lastems) EndIf turn = 0 EndIf EndSub Sub StartClock ' parm turn lastems = ems EndSub Sub MillisecondToTime ' param _ms ' return _time tsec = Math.Round(_ms / 1000) sec = Math.Remainder(tsec, 60) _time = sec If sec < 10 Then _time = Text.Append("0", _time) EndIf _time = ":" + _time tmin = Math.Floor(tsec / 60) min = Math.Remainder(tmin, 60) _time = min + _time If min < 10 Then _time = Text.Append("0", _time) EndIf _time = ":" + _time hour = Math.Floor(tmin / 60) _time = hour + _time If hour < 10 Then _time = Text.Append("0", _time) EndIf EndSub Sub TimeToMillisecond ' param _time ' return _ms hour = Text.GetSubText(_time, 1, 2) min = Text.GetSubText(_time, 4, 2) sec = Text.GetSubText(_time, 7, 2) _ms = ((((hour * 60) + min) * 60) + sec) * 1000 EndSub Sub OnButtonClicked ems = Clock.ElapsedMilliseconds If Controls.LastClickedButton = bmode Then imode = imode + 1 n = Array.GetItemCount(mode) If n < imode Then imode = 1 EndIf cmode = mode[imode] ' current mode Shapes.SetText(omode, cmode) If imode = 2 Then cdelay = Shapes.AddText("Delay") ' caption Shapes.Move(cdelay, 54, 74) odelay = Controls.AddTextBox(96, 70) Controls.SetSize(odelay, 60, 22) Controls.SetTextBoxText(odelay, delay) ElseIf imode = 3 Then Shapes.Remove(cdelay) Controls.Remove(odelay) EndIf ElseIf Controls.LastClickedButton = bok Then end = "True" ElseIf Controls.LastClickedButton = bpause Then PauseClock() EndIf EndSub Sub OnMouseDown If Not[clicked] Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY ems = Clock.ElapsedMilliseconds clicked = "True" EndIf EndSub Sub OnTextTyped If Controls.LastTypedTextBox = otime Then atime = Controls.GetTextBoxText(otime) ElseIf Controls.LastTypedTextBox = odelay Then delay = Controls.GetTextBoxText(odelay) EndIf EndSub Sub OnTick ems = Clock.ElapsedMilliseconds ticked = "True" EndSub End>VSC113-0.sb< Start>VSC113.sb< ' Game Clock 0.1a ' Copyright (c) 2014 Nonki Takahashi. ' ' Lisence: ' The MIT Lisence (MIT) ' http://en.wikipedia.org/wiki/MIT_License ' ' History: ' 0.1a 2014-04-19 Created. () ' title = "Game Clock 0.1a" debug = "False" Init() While "True" SelectMode() Game() EndWhile Sub Game GraphicsWindow.BackgroundColor = "#333333" GraphicsWindow.BrushColor = "DarkSeaGreen" cx[1] = 20 cy[1] = 20 cw[1] = (gw - 60) / 2 ch[1] = gh - 100 GraphicsWindow.FillRectangle(cx[1], cy[1], cw[1], ch[1]) cx[2] = gw / 2 + 10 cy[2] = 20 cw[2] = (gw - 60) / 2 ch[2] = gh - 100 GraphicsWindow.FillRectangle(cx[2], cy[2], cw[2], ch[2]) atime[1] = atime atime[2] = atime[1] For i = 1 To 2 _time = atime[i] TimeToMillisecond() ms[i] = _ms EndFor _time = delay TimeToMillisecond() delayms = _ms GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Courier New" fs = 50 GraphicsWindow.FontSize = fs For i = 1 To 2 otime[i] = Shapes.AddText(atime[i]) If i = 1 Then x = 34 Else x = gw / 2 + 24 EndIf y = (gh - 80 - fs) / 2 Shapes.Move(otime[i], x, y) EndFor GraphicsWindow.FontSize = 30 GraphicsWindow.FontName = "Arial" bpause = Controls.AddButton("Pause", 20, gh - 70) Controls.SetSize(bpause, gw - 40, 50) ingame = "True" clicked = "False" turn = 0 GraphicsWindow.MouseDown = OnMouseDown ticked = "False" Timer.Interval = 1000 Timer.Tick = OnTick While ingame If clicked Then For i = 1 To 2 cx1 = cx[i] + cw[i] cy1 = cy[i] + ch[i] If (turn <> (3 - i)) And (cx[i] <= mx) And (mx < cx1) And (cy[i] <= my) And (my < cy1) Then PauseClock() If (turn <> 0) And (imode = 2) Then ms[3 - i] = ms[3 - i] + delayms EndIf turn = 3 - i StartClock() If (imode = 2) Then _ms = ms[turn] MillisecondToTime() Shapes.SetText(otime[turn], _time) EndIf EndIf EndFor clicked = "False" EndIf If ticked Then If debug Then msg = "turn=" + turn msg = msg + " ems=" + ems msg = msg + " lastems=" + lastems GraphicsWindow.Title = msg EndIf If 0 < turn Then If debug Then Sound.PlayClick() EndIf _ms = ms[turn] - (ems - lastems) MillisecondToTime() Shapes.SetText(otime[turn], _time) EndIf ticked = "False" EndIf Program.Delay(200) EndWhile EndSub Sub Init GraphicsWindow.Title = title Not = "False=True;True=False;" gw = 598 gh = 300 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.FontName = "Arial" mode = "1=Sudden Death;2=Fischer Delay;3=Hourglass;" imode = 1 ' current mode index EndSub Sub SelectMode GraphicsWindow.BrushColor = "Black" bmode = Controls.AddButton("Mode", 10, 10) cmode = mode[imode] ' current mode omode = Shapes.AddText(cmode) Shapes.Move(omode, 60, 16) end = "False" atime = "00:30:00" GraphicsWindow.DrawText(10, 44, "Allotted Time") otime = Controls.AddTextBox(96, 40) Controls.SetSize(otime, 60, 22) Controls.SetTextBoxText(otime, atime) delay = "00:00:30" bok = Controls.AddButton("OK", 10, 100) Controls.TextTyped = OnTextTyped Controls.ButtonClicked = OnButtonClicked While Not[end] Program.Delay(200) EndWhile atime = Controls.GetTextBoxText(otime) delay = Controls.GetTextBoxText(odelay) GraphicsWindow.Clear() EndSub Sub PauseClock ' param turn If turn <> 0 Then ms[turn] = ms[turn] - (ems - lastems) turn = 0 EndIf EndSub Sub StartClock ' parm turn lastems = ems EndSub Sub MillisecondToTime ' param _ms ' return _time tsec = Math.Floor(_ms / 1000) sec = Math.Remainder(tsec, 60) _time = sec If sec < 10 Then _time = Text.Append("0", _time) EndIf _time = ":" + _time tmin = Math.Floor(tsec / 60) min = Math.Remainder(tmin, 60) _time = min + _time If min < 10 Then _time = Text.Append("0", _time) EndIf _time = ":" + _time hour = Math.Floor(tmin / 60) _time = hour + _time If hour < 10 Then _time = Text.Append("0", _time) EndIf EndSub Sub TimeToMillisecond ' param _time ' return _ms hour = Text.GetSubText(_time, 1, 2) min = Text.GetSubText(_time, 4, 2) sec = Text.GetSubText(_time, 7, 2) _ms = ((((hour * 60) + min) * 60) + sec) * 1000 EndSub Sub OnButtonClicked ems = Clock.ElapsedMilliseconds If Controls.LastClickedButton = bmode Then imode = imode + 1 n = Array.GetItemCount(mode) If n < imode Then imode = 1 EndIf cmode = mode[imode] ' current mode Shapes.SetText(omode, cmode) If imode = 2 Then cdelay = Shapes.AddText("Delay") ' caption Shapes.Move(cdelay, 54, 74) odelay = Controls.AddTextBox(96, 70) Controls.SetSize(odelay, 60, 22) Controls.SetTextBoxText(odelay, delay) ElseIf imode = 3 Then Shapes.Remove(cdelay) Controls.Remove(odelay) EndIf ElseIf Controls.LastClickedButton = bok Then end = "True" ElseIf Controls.LastClickedButton = bpause Then PauseClock() EndIf EndSub Sub OnMouseDown If Not[clicked] Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY ems = Clock.ElapsedMilliseconds clicked = "True" EndIf EndSub Sub OnTextTyped If Controls.LastTypedTextBox = otime Then atime = Controls.GetTextBoxText(otime) ElseIf Controls.LastTypedTextBox = odelay Then delay = Controls.GetTextBoxText(odelay) EndIf EndSub Sub OnTick ems = Clock.ElapsedMilliseconds ticked = "True" EndSub End>VSC113.sb< Start>VSC500-0.sb< ' Cat's Eyes Clock 0.1 ' published as VSC500-0 ' Copyright (c) 2012 Nonki Takahashi. All rights reserved. ' ' History : ' 0.2 2012/07/11 Changed from draw to shapes. ' 0.1 2012/07/10 Created from Alarm 0.1. ' itx = 33 ity = 55 sBGColor = "White" sFGColor = "Black" sTitle = "Cat's Eyes Clock 0.2" GraphicsWindow.Title = sTitle GraphicsWindow.BrushColor = sFGColor GraphicsWindow.BackgroundColor = sBGColor left = 340 top = 60 width = 200 height = 300 InitClock() DrawCat() bTicked = "False" Timer.Interval = 1000 Timer.Tick = OnTick While "True" Program.Delay(500) If bTicked Then DrawClock() DrawIrises() bTicked = "False" If Math.Remainder(iSec, 5) = 0 Then Blink() EndIf EndIf EndWhile Sub Blink Shapes.HideShape(oLIris) Shapes.HideShape(oRIris) Shapes.HideShape(oLEye) Shapes.HideShape(oREye) Program.Delay(100) Shapes.ShowShape(oLIris) Shapes.ShowShape(oRIris) Shapes.ShowShape(oLEye) Shapes.ShowShape(oREye) EndSub Sub DrawArc ' param cx, cy - center ' param r - radius ' param a1, a2 - start and end angle [degree] ' param pw - pen width ' param pc - pen color GraphicsWindow.BrushColor = pc For a = a1 To a2 x = cx + r * Math.Cos(a * Math.Pi / 180) - pw / 2 y = cy + r * Math.Sin(a * Math.Pi / 180) - pw / 2 GraphicsWindow.FillEllipse(x, y, pw, pw) EndFor EndSub Sub DrawCat ' param left, top - left top position of cat ' param width, height - size of cat ' return lex, ley - left eye center ' return rex, rey - right eye center ' return eh - eye height ' Calculate each eye position lex = left + width * 0.33 ley = top + height * 0.35 rex = left + width * 0.67 rey = ley ew = width * 0.3 eh = height * 0.16 ' Draw body GraphicsWindow.BrushColor = "#5e5e5e" x = left + width * 0.25 y = top + height * 0.8 w = width * 0.5 h = height * 0.2 GraphicsWindow.FillEllipse(x, y, w, h) x1 = x y1 = y + h / 2 x2 = x + w y2 = y1 x3 = (x1 + x2) / 2 y3 = ley GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' Draw tail pc = "#5e5e5e" pw = width * 0.1 cx = left + width * 0.65 cy = top + height * 0.72 r = width * 0.3 a1 = 0 a2 = 90 DrawArc() ' Draw ears GraphicsWindow.BrushColor = "DimGray" ' #696969 x1 = lex - ew / 2 y1 = ley x2 = lex + ew / 2 y2 = ley x3 = (x1 + x2) / 2 y3 = top GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' left GraphicsWindow.BrushColor = "LightGray" x1 = x1 + width * 0.05 x2 = x2 - width * 0.05 y3 = top + height * 0.08 GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' left GraphicsWindow.BrushColor = "DimGray" x1 = rex - ew / 2 y1 = rey x2 = rex + ew / 2 y2 = rey x3 = (x1 + x2) / 2 y3 = top GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' right GraphicsWindow.BrushColor = "LightGray" x1 = x1 + width * 0.05 x2 = x2 - width * 0.05 y3 = top + height * 0.08 GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' right ' Draw face GraphicsWindow.BrushColor = "DimGray" x = left + width * 0.15 y = top + height * 0.15 w = width * 0.7 h = height * 0.4 GraphicsWindow.FillEllipse(x, y, w, h) ' Draw wiskers GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" x1 = lex y1 = ley + eh / 2 r = width * 0.3 For a = 165 To 195 Step 15 x2 = x1 + r * Math.Cos(a / 180 * Math.Pi) y2 = y1 + r * Math.Sin(a / 180 * Math.Pi) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor x1 = rex y1 = rey + eh / 2 For a = -15 To 15 Step 15 x2 = x1 + r * Math.Cos(a / 180 * Math.Pi) y2 = y1 + r * Math.Sin(a / 180 * Math.Pi) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor ' Draw closed eyes GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(lex - ew / 2, ley - 1, ew, 2) ' left GraphicsWindow.FillRectangle(rex - ew / 2, rey - 1, ew, 2) ' right ' Draw eyes GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" oLEye = Shapes.AddEllipse(ew, eh) ' left Shapes.Move(oLEye, lex - ew / 2, ley - eh / 2) oREye = Shapes.AddEllipse(ew, eh) ' right Shapes.Move(oREye, rex - ew / 2, rey - eh / 2) ' Draw Irises GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" oLIris = Shapes.AddEllipse(eh, eh) ' left Shapes.Move(oLIris, lex - eh / 2, ley - eh / 2) oRIris = Shapes.AddEllipse(eh, eh) ' right Shapes.Move(oRIris, rex - eh / 2, rey - eh / 2) EndSub Sub DrawIrises ' param lex, ley - left eye center ' param rex, rey - right eye center ' param eh - eye height ' param iHour - hour If (0 <= iHour And iHour <= 6) Or (18 <= iHour And iHour <= 23) Then ew = eh * 0.8 Else hr = iHour If (6 < hr And hr < 12) Then hr = 24 - hr EndIf hr = hr - 12 + 0.5 ew = eh * 0.8 * hr / 12.5 EndIf Shapes.Zoom(oLIris, ew / eh, 1) Shapes.Move(oLIris, lex - eh / 2, ley - eh / 2) Shapes.Zoom(oRIris, ew / eh, 1) Shapes.Move(oRIris, rex - eh / 2, rey - eh / 2) EndSub Sub InitClock ' return oClock - text object for clock GraphicsWindow.FontSize = ity GraphicsWindow.BrushColor = sFGColor oClock = Shapes.AddText("") Shapes.Move(oClock, itx * 1.4, ity * 3) EndSub Sub DrawClock ' param iHour - hour ' param iMin - minute ' param iSec - second If iHour < 10 Then sTime = Text.Append("0", iHour) + ":" Else sTime = iHour + ":" EndIf If iMin < 10 Then sTime = sTime + "0" + iMin + ":" Else sTime = sTime + iMin + ":" EndIf If iSec < 10 Then sTime = sTime + "0" + iSec Else sTime = sTime + iSec EndIf Shapes.SetText(oClock, sTime) EndSub Sub OnTick iHour = Clock.Hour iMin = Clock.Minute iSec = Clock.Second bTicked = "True" EndSub End>VSC500-0.sb< Start>VSC500.sb< ' Cat's Eye Clock 0.1 ' Copyright (c) 2012 Nonki Takahashi. All rights reserved. ' ' History : ' 0.1 2012/07/10 Created from Alarm 0.1. ' itx = 33 ity = 55 sBGColor = "White" sFGColor = "Black" sTitle = "Cat's Eye Clock 0.1" GraphicsWindow.Title = sTitle GraphicsWindow.BrushColor = sFGColor GraphicsWindow.BackgroundColor = sBGColor left = 340 top = 60 width = 200 height = 300 DrawCat() bTicked = "False" Timer.Interval = 1000 Timer.Tick = OnTick While "True" Program.Delay(500) If bTicked Then DrawClock() DrawEyes() bTicked = "False" EndIf EndWhile Sub DrawArc ' param cx, cy - center ' param r - radius ' param a1, a2 - start and end angle [degree] ' param pw - pen width ' param pc - pen color GraphicsWindow.BrushColor = pc For a = a1 To a2 x = cx + r * Math.Cos(a * Math.Pi / 180) - pw / 2 y = cy + r * Math.Sin(a * Math.Pi / 180) - pw / 2 GraphicsWindow.FillEllipse(x, y, pw, pw) EndFor EndSub Sub DrawCat ' param left, top - left top position of cat ' param width, height - size of cat ' return lex, ley - left eye center ' return rex, rey - right eye center ' return eh - eye height ' Calculate each eye position lex = left + width * 0.33 ley = top + height * 0.35 rex = left + width * 0.67 rey = ley ew = width * 0.3 eh = height * 0.16 ' Draw body GraphicsWindow.BrushColor = "#5e5e5e" x = left + width * 0.25 y = top + height * 0.8 w = width * 0.5 h = height * 0.2 GraphicsWindow.FillEllipse(x, y, w, h) x1 = x y1 = y + h / 2 x2 = x + w y2 = y1 x3 = (x1 + x2) / 2 y3 = ley GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' Draw tail pc = "#5e5e5e" pw = width * 0.1 cx = left + width * 0.65 cy = top + height * 0.72 r = width * 0.3 a1 = 0 a2 = 90 DrawArc() ' Draw ears GraphicsWindow.BrushColor = "DimGray" ' #696969 x1 = lex - ew / 2 y1 = ley x2 = lex + ew / 2 y2 = ley x3 = (x1 + x2) / 2 y3 = top GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' left GraphicsWindow.BrushColor = "LightGray" x1 = x1 + width * 0.05 x2 = x2 - width * 0.05 y3 = top + height * 0.08 GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' left GraphicsWindow.BrushColor = "DimGray" x1 = rex - ew / 2 y1 = rey x2 = rex + ew / 2 y2 = rey x3 = (x1 + x2) / 2 y3 = top GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' right GraphicsWindow.BrushColor = "LightGray" x1 = x1 + width * 0.05 x2 = x2 - width * 0.05 y3 = top + height * 0.08 GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) ' right ' Draw face GraphicsWindow.BrushColor = "DimGray" x = left + width * 0.15 y = top + height * 0.15 w = width * 0.7 h = height * 0.4 GraphicsWindow.FillEllipse(x, y, w, h) ' Draw wiskers GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" x1 = lex y1 = ley + eh / 2 r = width * 0.3 For a = 165 To 195 Step 15 x2 = x1 + r * Math.Cos(a / 180 * Math.Pi) y2 = y1 + r * Math.Sin(a / 180 * Math.Pi) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor x1 = rex y1 = rey + eh / 2 For a = -15 To 15 Step 15 x2 = x1 + r * Math.Cos(a / 180 * Math.Pi) y2 = y1 + r * Math.Sin(a / 180 * Math.Pi) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor ' Draw eyes GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(lex - ew / 2, ley - eh / 2, ew, eh) ' left GraphicsWindow.FillEllipse(rex - ew / 2, rey - eh / 2, ew, eh) ' right EndSub Sub DrawEyes ' param lex, ley - left eye center ' param rex, rey - right eye center ' param eh - eye height ' param iHour - hour If (0 <= iHour And iHour <= 6) Or (18 <= iHour And iHour <= 23) Then ew = eh * 0.8 Else hr = iHour If (6 < hr And hr < 12) Then hr = 24 - hr EndIf hr = hr - 12 + 0.5 ew = eh * 0.8 * hr / 12.5 EndIf GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(lex - eh / 2, ley - eh / 2, eh, eh) ' left GraphicsWindow.FillEllipse(rex - eh / 2, rey - eh / 2, eh, eh) ' right GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(lex - ew / 2, ley - eh / 2, ew, eh) ' left GraphicsWindow.FillEllipse(rex - ew / 2, rey - eh / 2, ew, eh) ' right EndSub Sub DrawClock ' param iHour - hour ' param iMin - minute ' param iSec - second If iHour < 10 Then sTime = Text.Append("0", iHour) + ":" Else sTime = iHour + ":" EndIf If iMin < 10 Then sTime = sTime + "0" + iMin + ":" Else sTime = sTime + iMin + ":" EndIf If iSec < 10 Then sTime = sTime + "0" + iSec Else sTime = sTime + iSec EndIf GraphicsWindow.FontSize = ity GraphicsWindow.BrushColor = sBGColor GraphicsWindow.FillRectangle(itx * 1.4, ity * 3, itx * 8, ity) GraphicsWindow.BrushColor = sFGColor GraphicsWindow.DrawText(itx * 1.4, ity * 3 - 3, sTime) EndSub Sub OnTick iHour = Clock.Hour iMin = Clock.Minute iSec = Clock.Second bTicked = "True" EndSub End>VSC500.sb< Start>VSH227.sb< ' Challenge of the Month - October 2017 -- Graphics Challenge -- by NaochanON GraphicsWindow.BackgroundColor="#D8E698" GraphicsWindow.Width=1200 GraphicsWindow.Height=650 init() add_shapes() dx=5 ' moving length X-direction ds=dx*360/shape[12]["wd"]/math.pi ' rotating angle dy=0 While "True" for i=1 To Array.GetItemCount(shape) Shapes.Move(shp[SName][i],Shapes.GetLeft(shp[SName][i])+dx,Shapes.Gettop(shp[SName][i])+dy) If i>19 then angle[i]=angle[i]+ds shapes.Rotate(shp[SName][i],angle[i]) endif EndFor GraphicsWindow.Title=Shapes.GetLeft(shp[SName][8]) If (math.abs(300-Shapes.GetLeft(shp[SName][8]))<25) Or (math.abs(650-Shapes.GetLeft(shp[SName][8]))<25) Or (math.abs(900-Shapes.GetLeft(shp[SName][8]))<25) Then NN=NN+1 Shapes.Move(smoke[NN],Shapes.GetLeft(shp[SName][8]),Shapes.GetTop(shp[SName][8])) EndIf For k=1 To NN Shapes.Move(smoke[k],Shapes.GetLeft(smoke[k])-dx-(15-k)/3*dx/math.Abs(dx),Shapes.Gettop(smoke[k])-9) shapes.Zoom(smoke[k],(NN-k)/2,(NN-k)/3) EndFor If Shapes.Gettop(smoke[NN])<-30 Then For k=1 to NN Shapes.Move(smoke[k],-500,-500) shapes.Zoom(smoke[k],1,1) endfor endif If (dx>0 and Shapes.GetLeft(shp[SName][16])>1250) or (dx<0 and Shapes.GetLeft(shp[SName][16])<-50) Then NN=0 dx=-dx ds=dx*360/shape[12]["wd"]/math.pi ' rotating angle pm=(325- shapes.GetTop(shp[SName][16]))/Math.Abs(325- shapes.GetTop(shp[SName][16])) dy=pm*math.GetRandomNumber(325) return() EndIf dy=0 Program.Delay(100) endwhile Sub return For j=1 To Array.GetItemCount(shape) if dx<0 then Shapes.Move(shp[SName][j],Shapes.GetLeft(shp[SName][j])-2*shape[j]["x"]-shape[j]["wd"]+dL,Shapes.Gettop(shp[SName][j])+dy) Else Shapes.Move(shp[SName][j],Shapes.GetLeft(shp[SName][j])+2*shape[j]["x"]+shape[j]["wd"]-dL,Shapes.Gettop(shp[SName][j])+dy) EndIf EndFor EndSub Sub add_shapes SName="train" ss=scale[1] for i=1 To Array.GetItemCount(shape) GraphicsWindow.PenWidth = shape[i]["pw"] GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.penColor = shape[i]["pc"] If shape[i]["fn"]="el" Then shp[SName][i] = Shapes.AddEllipse(shape[i]["wd"]*ss, shape[i]["ht"]*ss) ElseIf shape[i]["fn"]="rec" Then shp[SName][i] = Shapes.AddRectangle(shape[i]["wd"]*ss, shape[i]["ht"]*ss) EndIf Shapes.Animate(shp[SName][i], shape[i]["x"]*ss+shX[1], shape[i]["y"]*ss+shY[1], 500) shapes.Rotate(shp[SName][i],shape[i]["deg"]) angle[i]=shape[i]["deg"] EndFor EndSub Sub init scale[1]=1 shX[1]=100 shy[1]=100 Shape[1]="fn=rec;x=120;y=40;wd=120;ht=24;bc=#EA5506;pc=#EA5506;pw=0" Shape[2]="fn=rec;x=120;y=64;wd=120;ht=24;bc=#D7003A;pc=#D7003A;pw=0" Shape[3]="fn=rec;x=40;y=16;wd=86;ht=74;bc=#E95464;pc=#E95464;pw=0" Shape[4]="fn=rec;x=58;y=22;wd=45;ht=34;bc=#EAF4FC;pc=#17184B;pw=2" Shape[5]="fn=rec;x=14;y=78;wd=22;ht=14;bc=#726D40;pc=#726D40;pw=0" Shape[6]="fn=rec;x=32;y=0;wd=98;ht=16;bc=#89C3EB;pc=#88CB7F;pw=3" Shape[7]="fn=rec;x=150;y=18;wd=16;ht=24;bc=#89C3EB;pc=#89C3EB;pw=0" Shape[8]="fn=rec;x=186;y=12;wd=22;ht=30;bc=#89C3EB;pc=#89C3EB;pw=0" Shape[9]="fn=rec;x=146;y=12;wd=24;ht=6;bc=#88CB7F;pc=#88CB7F;pw=3" Shape[10]="fn=rec;x=182;y=6;wd=30;ht=6;bc=#88CB7F;pc=#88CB7F;pw=3" Shape[11]="fn=el;x=230;y=40;wd=22;ht=48;bc=#FEF263;pc=#007B43;pw=3" Shape[12]="fn=el;x=22;y=68;wd=64;ht=64;bc=#EB6EA5;pc=#A59564;pw=8" Shape[13]="fn=el;x=88;y=68;wd=64;ht=64;bc=#EB6EA5;pc=#A59564;pw=8" Shape[14]="fn=el;x=154;y=86;wd=46;ht=46;bc=#EB6EA5;pc=#A59564;pw=6" Shape[15]="fn=el;x=202;y=86;wd=46;ht=46;bc=#EB6EA5;pc=#A59564;pw=6" Shape[16]="fn=el;x=0;y=66;wd=18;ht=40;bc=#E60033;pc=#E60033;pw=0" Shape[17]="fn=el;x=80;y=22;wd=10;ht=16;bc=#17184B;pc=#17184B;pw=0" Shape[18]="fn=el;x=77;y=38;wd=14;ht=19;bc=#17184B;pc=#17184B;pw=0" Shape[19]="fn=rec;x=85;y=42;wd=14;ht=4;bc=#17184B;pc=#17184B;pw=0" Shape[20]="fn=rec;x=52;y=76;wd=4;ht=48;bc=#007B43;pc=#007B43;pw=0" Shape[21]="fn=rec;x=52;y=76;wd=4;ht=48;bc=#007B43;pc=#007B43;pw=0;deg=90" Shape[22]="fn=rec;x=118;y=76;wd=4;ht=48;bc=#007B43;pc=#007B43;pw=0" Shape[23]="fn=rec;x=118;y=76;wd=4;ht=48;bc=#007B43;pc=#007B43;pw=0;deg=90" Shape[24]="fn=rec;x=176;y=90;wd=4;ht=38;bc=#007B43;pc=#007B43;pw=0" Shape[25]="fn=rec;x=176;y=90;wd=4;ht=38;bc=#007B43;pc=#007B43;pw=0;deg=90" Shape[26]="fn=rec;x=224;y=90;wd=4;ht=38;bc=#007B43;pc=#007B43;pw=0" Shape[27]="fn=rec;x=224;y=90;wd=4;ht=38;bc=#007B43;pc=#007B43;pw=0;deg=90" dL= shape[11]["x"]-shape[16]["x"]+100 ' mirror point GraphicsWindow.BrushColor="#949495" GraphicsWindow.PenColor="#727171" For i= 1 To 40 smoke[i]= Shapes.AddEllipse(18,12) Shapes.Move(smoke[i],-100,-100) EndFor EndSub End>VSH227.sb< Start>VSJ596.sb< 'levels and xp' While (1000000<>x) TextWindow.ForegroundColor="cyan" 'You can use a subroutine to change the value of a variable you declared early in the program to a specific or random variable under certain conditions. mainmenu: TextWindow.ForegroundColor="green" p=1 d=d+p TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Day:"+d) TextWindow.WriteLine("Today is: " + Clock.Date + ".") TextWindow.WriteLine("The current time is: " + Clock.Time + ".") TextWindow.WriteLine("The current day of the week is: " + Clock.Weekday + ".") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine(" This is a Card Fighting RPG") TextWindow.WriteLine("you will choose a card and then fight other cards of other elements") TextWindow.WriteLine("This is the MainMenu") TextWindow.WriteLine(" P.S answer without Capitals") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" Options") TextWindow.WriteLine("Plz Read This (Help)") TextWindow.WriteLine("(Battle)") TextWindow.WriteLine("(Cards)") TextWindow.ForegroundColor="green" TextWindow.WriteLine(" Money:"+m) TextWindow.WriteLine("exp:"+exp2+"/"+eexp) TextWindow.WriteLine("LvL:"+a) TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(Get a Job)") TextWindow.WriteLine("(trophies)") TextWindow.WriteLine("(store)") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") x=TextWindow.Read() If(x="cards")then Goto cards ElseIf(x="bank")then Goto bank ElseIf(x="battle")then Goto battle2 ElseIf(x="job")then Goto job ElseIf(x="store")then Goto store ElseIf(x="trophies")then Goto trophies ElseIf(x="cheat")then Goto cheat ElseIf(x="cheat2")then Goto cheat2 ElseIf(x="exp")then Goto exp13 ElseIf(x="help")then Goto help TextWindow.WriteLine("") bank: TextWindow.WriteLine("Your Total balence is:"+m) TextWindow.WriteLine("(Mainmenu)") x=TextWIndow.Read() If(x="mainmenu")then Goto exp13 startz: v=Math.GetRandomNumber (100) exp=Math.GetRandomNumber(100) m=m+v TextWindow.WriteLine("You received $"+ v) exp2=exp2+exp TextWindow.WriteLine("You received "+exp+" exp") TextWindow.WriteLine("in total you have "+exp2+" exp") TextWindow.WriteLine(" ") TextWindow.WriteLine("Press (Exit) to exit battle") x=TextWindow.Read() TextWindow.WriteLine("Wow what a battle!") TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 battle2: TextWindow.WriteLine("The three starting cards are the (fire) (Ice) and (earth)") TextWindow.WriteLine("Which Card would you like to choose?") x=TextWindow.Read() If(x="fire") Then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You have chosen Fire") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") ElseIf(x="ice") then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You have chosen Ice") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") ElseIf(x="earth") then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Earth") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") EndIf TextWindow.ForegroundColor="cyan" x=TextWindow.Read() If(x="fight") Then TextWindow.WriteLine("(start when ready)") EndIf x=TextWindow.Read() If(x="start")then y=Math.GetRandomNumber (300) If(y>0 And y<100)then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You will be fighting a (Fire) card") Goto starta ElseIf(y>101 And y<200)then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You will be fighting an (Ice) card") Goto startb ElseIf(y>201 And y<300)then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You will be fighting an (earth) card") Goto startc 'Fire card' starta: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaa startaa: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaaa startaaa: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaab startaab: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startabb startabb: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaac startaac: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startacc startacc: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaad startaad: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startadd startadd: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaae startaae: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaee startaee: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz 'Ice Card' startb: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startggg startggg: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startggh startggh: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto starthhh starthhh: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto starthhi starthhi: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto starthii starthii: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startiii startiii: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startiij startiij: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startijj startijj: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startjjj startjjj: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startjjk startjjk: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz 'Earth Card' startc: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startm startm: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startmm startmm: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startmmm startmmm: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startmmn startmmn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startmnn startmnn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startnnn startnnn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startnno startnno: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startnoo startnoo: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startooo startooo: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(attack) to Attack") x=TextWindow.Read() If(x="attack") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startoop startoop: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz cards: TextWindow.WriteLine("1(Fire) 2(Ice) 3(Earth)") x=TextWindow.Read() If(x=1) Then Goto gh ElseIf(x=2) then Goto hg ElseIf(x=3) then Goto hhg gh: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:80") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:5 KP/H") TextWindow.WriteLine("Evade 12%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:70") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:7 KP/H") TextWindow.WriteLine("Evade 10%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hhg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:110") TextWindow.WriteLine("MP:50") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:4 KP/H") TextWindow.WriteLine("Evade 9%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu job: TextWindow.WriteLine("What job would you like to take") TextWindow.WriteLine(" Options") TextWindow.WriteLine("Miner") TextWindow.WriteLine("Worker") TextWindow.WriteLine("Teacher") x=TextWindow.Read() If(x="miner")then Goto miner ElseIf(x="worker")then Goto worker ElseIf(x="teacher")then Goto teacher miner: TextWindow.WriteLine("You chose to be a miner") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("You just made $55") j=55 If(j=55)then m=m+j TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 worker: TextWindow.WriteLine("You chose to be a Office Worker") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("You just made $60") i=60 If(i=60)then m=m+i TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 teacher: TextWindow.WriteLine("You chose to be a Teacher") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("You just made $70") o=70 If(o=70) then m=m+o TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 store: TextWindow.WriteLine("Welcome to the General store") TextWindow.WriteLine("what would you like to buy?") TextWindow.WriteLine(" Options") TextWindow.WriteLine("(1) Golden trophy $1000") TextWindow.WriteLine("(2) Silver trophy $800") TextWindow.WriteLine("(3) Bronze trophy $500") x=TextWindow.Read() If(x=1 And m>=1000)then Goto golden ElseIf(x=1 And m<1000)then Goto goldena ElseIf(x=2 And m>=800)then Goto silver ElseIf(x=2 And m<800)then Goto silvera ElseIf(x=3 And m>=500)then Goto bronze ElseIf(x=3 And m<500)then Goto bronzea goldena: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silvera: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronzea: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu golden: TextWindow.WriteLine("You bought the Golden trophy") b=1 j2=j2+b m=m-1000 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silver: TextWindow.WriteLine("You bought the Silver trophy") p=1 a2=a2+p m=m-800 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronze: TextWindow.WriteLine("You bought the Bronze trophy") l=1 r2=r2+l m=m-500 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu trophies: TextWindow.WriteLine("Golden trophies:"+j2) TextWindow.WriteLine("") TextWindow.WriteLine("Silver trophies:"+a2) TextWindow.WriteLine("") TextWindow.WriteLine("Bronze trophies:"+r2) TextWindow.WriteLine("(Mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu exp13: If(exp2>0 And exp2<=80)then Goto exp100 ElseIf(exp2>80 And exp2<=150)then Goto exp200 ElseIf(exp2>150 And exp2<=280)then Goto exp300 ElseIf(exp2>280 And exp2<=400)then Goto exp400 ElseIf(exp2>400 And exp2<=540)then Goto exp500 ElseIf(exp2>540 And exp2<=700)then Goto exp600 exp100: a=0 eexp=80 Goto mainmenu exp200: a=1 eexp=150 Goto mainmenu exp300: a=2 eexp=280 goto mainmenu exp400: a=3 eexp=400 Goto mainmenu exp500: a=4 eexp=540 Goto mainmenu exp600: a=5 eexp=700 Goto mainmenu cheat: m=m+500 Goto mainmenu cheat2: exp2=exp2+50 Goto exp13 help: TextWindow.WriteLine("This is a multi purpose program") TextWindow.WriteLine("it is mainly about money and fighting") TextWindow.WriteLine(" Here are all the features") TextWindow.WriteLine("fighting for money and exp") TextWindow.WriteLine("an exp system, you can lvl up") TextWindow.WriteLine("a money system, you can gain money") TextWindow.WriteLine("you can spend money on different types of trophies") TextWindow.WriteLine(" there is a clock at the top of the main menu") TextWindow.WriteLine("their is also a day counter") TextWindow.WriteLine("you can check you cards starts in the cards section") TextWindow.WriteLine("you can get a job and you will be paid for you efforts") TextWindow.WriteLine("(mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 Goto exp13 EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndWhile End>VSJ596.sb< Start>VSL030.sb< ' PROGRAM by Yled June 25th 2016 ' no: GraphicsWindow.Title = "Your weight on IO" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 700 GraphicsWindow.Width = 1200 GraphicsWindow.BackgroundColor="black" image1=ImageList.LoadImage("http://solarsystem.nasa.gov/images/galleries/hs-2015-05-f-full_jpg1.jpg") graphicswindow.DrawResizedImage(image1,1,1,700,700) image2=ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/1/14/Io%2C_moon_of_Jupiter%2C_NASA.jpg") graphicswindow.DrawResizedImage(image2,800,400,300,300) buttonclicked = 0 'Start Page' GraphicsWindow.FontSize = 18 GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(800, 50, " Enter your weight (kg) ") GraphicsWindow.BrushColor = "BLUE" textbox1 = Controls.AddTextBox(1000, 100) button = Controls.AddButton(" COMPUTE WEIGHT ", 800, 150) Controls.ButtonClicked = Click Sub Click If Controls.LastClickedButton = button Then weight=Controls.GetTextBoxText(textbox1) buttonclicked = 1 EndIf EndSub ' une loop qui attends que je clic le bouton SOUMETTRE buttonloop: If buttonclicked = 0 Then Goto buttonloop Else buttonclicked = 0 EndIf FORMULA() RESULTS() Sub FORMULA ' Cavendish gravitational constant ' https://en.wikipedia.org/wiki/Cavendish_experiment ' k = 6,67384 x 10⁻¹¹ N · m² · kg⁻² k=(math.Power(10,-11))*6.67384 ' Jupiter=(math.Power(10,27))*1.8986 ' masse de Jupiter IO=(math.Power(10,22))*8.9300 ' masse de IO distance=421800*1000 ' distance Jupiter - IO rayonIO=1822*1000 ' newton's gravitational law ' https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation G1=k*((Jupiter)/math.Power(distance,2)) G=G1*IO 'gravitational acceleration of a weight of 1 kg on IO ' https://en.wikipedia.org/wiki/Gravitational_acceleration ' 1 kg on Earth weight 9,81 N p1kg=(k*(IO/(math.Power(RayonIO,2))))/9.81 notation() FGfinal=(math.Round(number*1000))/1000 FGarrondie=(math.Round(FGfinal*1000))/1000 endsub Sub RESULTS GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 20 weightfinal=Math.Round(p1kg*weight*10)/10 GraphicsWindow.DrawText(750, 200, "Your weight on Io is: ") GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(1050, 200, weightfinal+ " kg") GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 16 GraphicsWindow.DrawText(750, 250, "Gravitationnel force of Jupiter on Io ") GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(800, 300, FGarrondie + " x 10^"+ x) GraphicsWindow.BrushColor = "lime" GraphicsWindow.DrawText(925, 300," Newtons") EndSub ' fin du progrmme Sub notation 'la réponse vérifié dans excel est de 198,341,656,327,164,230,000 Newton 'ou 1,98 x 10²⁰ N ( N pour Newton , newton ce sont des kg * mètres * sec ) ' ma methode pour afficher clairment en notation scientifique en base de 10 le résultat x=0 number = math.Round(G) While (number > 10) ' 10 pour avoir par exemple 3,57 et non 0,357 'TextWindow.WriteLine(number + " 10 exposant "+ x ) ( faire afficher cette ligne pour vérifier mon progrmme) number = number / 10 x=x+1 ' x est pour déterminer la valeur de l'exposant en base de 10 du résultat EndWhile endsub End>VSL030.sb< Start>VSL220.sb< ' Parallelogram ' mahreen miangul 2018 GraphicsWindow.Title = "Parallelogram Turtle.Speed = 9 GraphicsWindow.BrushColor = "Yellow caption = "Parallelogram x[0] = 120 y[0] = 120 a[0] = -40 a[1] = -110 l[1] = 2 * (100 / Math.SquareRoot(3)) a[2] = -120 ll = 100 * Math.Tan(Math.GetRadians(40)) l[2] = l[1] / 2 + ll a[3] = -60 l[3] = ll * Math.Sin(Math.GetRadians(20)) * 4 a[4] = -120 l[4] = 140 x[1] = x[0] + l[2] / 1 y[1] = y[0] DrawParallelogram() Sub DrawParallelogram Turtle.PenUp() Turtle.MoveTo(x[1], y[1]) Turtle.PenDown() Turtle.Turn(-Turtle.Angle + a[0]) For i = 1 To 4 GraphicsWindow.penwidth = 4 GraphicsWindow.pencolor = GraphicsWindow.GetRandomColor() Turtle.Turn(a[i]) Turtle.Move(l[i]) x[i] = Turtle.X y[i] = Turtle.Y EndFor GraphicsWindow.FillTriangle(x[1], y[1], x[2], y[2], x[3], y[3]) GraphicsWindow.FillTriangle(x[3], y[3], x[4], y[4], x[1], y[1]) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(x[1], y[2] + 10, caption) EndSub End>VSL220.sb< Start>VSS227.sb< GraphicsWindow.Width =800 GraphicsWindow.Height=1000 GraphicsWindow.Left=20 GraphicsWindow.Top =10 LDUtilities.ShowErrors="False runn=2 GraphicsWindow.BrushColor="Black GraphicsWindow.MouseMove=MWWW c2dmd=0 stl=1 LDEvents.MouseWheel=mscrr m300=600'----------------------------------maxprglines kcd=0'--------------------------------------screen keyb scancode ctc=1'--------------------------------------ctrls index LDUtilities.FixFlickr()'-----------for vb<1.1 prg=LDArray.Create(m300)'-----------prg list array For x=1 to m300 LDArray.SetValue (prg,x,0) endfor csgn=LDText.Split("K L E X S G C"," ")'----------cursors: K)eyword L)etter C)aps eX)tended-green kw E)xtra-red kw S)ymbol G)raphic md=1 grtx[1]="SIN COS TAN INT RND STR$ CHR$ ELLIP RECT TAB " grtx[2]="READ RESTORE DATA SGN ABS SQR VAL LEN USR _ " grtx[3]="LN EXP LPRINT LLIST BIN INK$ PI " rdxt[1]="ASIN ACOS ATN SHAPE MERGE WEB CUB2 IN OUT LOGO " rdxt[2]="FLCKR HSB COLR FONT REPLC CIRCLE VAL$ SCRN$ INC _ " rdxt[3]="BEEP INK PAPER UNDRL SMLCAP ITAL BOLD _ _ " rdxt[4]="SUB FN LINE OPN# CLOS# MOVE ERASE POINT DIR DELSHP " cmat[1]=LDText.Split("PLOT DRAW 'REM RUN HELP RETURN IF INPUT CUBE PRINT NEW SAVE DIM FOR GOTO CALL LOAD LIST LET `` COPY CLEAR CONT CLS BORDER NEXT PAUSE `: '_ 1 2 3 4 5 6 7 8 9 0 '"," ") cmat[2]=LDText.Split("q w e r t y u i o p a s d f g h j k l `` z x c v b n m `: `_ 1 2 3 4 5 6 7 8 9 0 `<"," ") df1="" bsx0=0 bsy0=0 bsx=300 bsy=300 cedge=50'-----------3D cube endgesize sllw=0.5 san=60 fc=0'-------------------"for"deepness nest level '----------------------------making keyword array list For x=1 to 3 df1=df1+grtx[x] endfor cmat[3]=LDText.Split(df1," ") df2="" For x=1 to 4 df2=df2+rdxt[x] endfor cmat[4]=LDText.Split(df2," ") clst=cmat[1]+cmat[3]+cmat[4] '------------------------------------------------end making kwds ki=1 t_="true f_="false sst=1 acc=ldtext.Split("|@#$%^&() /*+-=_?!;"," ")'---------FnKeys ttx=0'--------------------txt list current X pos. tty=50'-------------------txt list current Y pos. args=0'-------------------sub calls paramarray wc=12.5'------------------prg. list charwidth hc_=20'---------------------chars height pix. cclr="Yellow"'-----------cursor base paper nolst=0'--------------------blocks prg listing ipc="Black "'-------------ink color nl=Text.GetCharacter(13)+Text.GetCharacter(10) '----------newline ppc="#cccccc"'----------paper clr ,light gray clrs=LDText.Split("BLUE Red Magenta Green Cyan Yellow White Black Gray Black"," ")'----------zx spectrum default clrs clrs[0]=ppc GraphicsWindow.BackgroundColor=ppc GraphicsWindow.BrushColor="Black GraphicsWindow.FillRectangle(0,600,800,400) drwkbd() scfnt() LDShapes.ShapeEvent=shppw'---------------scrn keys shape event handler GraphicsWindow.KeyDown=kdd'-------------phys. kbd handler makecursor() Timer.Tick=ttm'-------------------------------cursor blink sub Timer.Interval=750'--------------------------cursor blink interval donw()'-------------------------------------------animation history effect dosample()'-------------------------------------optional sample prg. runn=0 While 1=1'--------===============================MAIN LOOP================================ Program.Delay(5) If runn=1 Then'----------------------if run mode then start prg runprg() runn=0 endif If kcd>0 Then'------------------------if screeen keyb press made, handle keys If kcd=20 then'----------------------enter key ww="" Timer.Pause () ccmd() If runn=0 then evc2 () endif crst () Goto xx ElseIf kcd=40 then ww="" inp=text.GetSubText (inp,1,text.GetLength (inp)-1) If inp="" then md=1 endif Goto hh ElseIf kcd=29 then'-------spc key ww=" " Goto hh ElseIf kcd=28 then'----------------------symb key press ww="" md=md+1 If md>5 then md=1 endif Goto xx endif ww=cmat[md][kcd] If Text.IsSubText ("1234567890",ww) then 'nixx else If md=1 then ww=" "+ww+" " endif md=2'-----------------------------------after keyword entered switch to chars mode endif hh: lnt=text.GetLength (ww) inp=Text.Append (inp,ww) drcln()'------------------------------cleaning cmdline xx: kcd=0'-----------------------------scrn.key handled, ready for next press endif endwhile'---------------------------========================================ENDLOOP================ Sub scfnt GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=20 GraphicsWindow.FontBold=T_ GraphicsWindow.FontItalic=f_ EndSub Sub mscrr If runn=0 Then stpp=LDEvents.LastMouseWheelDelta*3 If stpp<0 And Text.IsSubText (prrs,"'ProgEnd.") Then stpp=0 endif stl=stl- stpp If stl<1 Then stl=1 endif nolst=0 refscr() Endif endsub Sub dosample'-----------------------sample prg list-------------------- ldcall.Function2 ("lset",5,"BORDER 6\INK 7\CLS 2") LDArray.SetValue(prg,25,"25:PRINT Turtle demo by SpectBasic") LDArray.SetValue(prg,27,"27:LOGO sh Sp10 m550;200 r150") LDArray.SetValue(prg,30,"30:FOR 1 26 1") LDArray.SetValue(prg,32,"32:LOGO F50 R15") LDArray.SetValue(prg,40,"40:NEXT") ldcall.Function2 ("lset",69,"LOGO hd") ldcall.Function2 ("lset",70,"STOP") ldcall.Function2 ("lset",35,"CUB2") ldcall.Function2 ("lset",62,"LOGO F50 R15") ldcall.Function2 ("lset",65,"CUB2 0 T") ldcall.Function2 ("lset",110,"FOR 1 250 55") ldcall.Function2 ("lset",120,"FOR 1 250 55") ldcall.Function2 ("lset",130,"FOR 1 250 55") ldcall.Function2 ("lset",140,"CUBE %F2 %F3 %F1 %F1") LDCall.Function2 ("lset",150,"NEXT") LDCall.Function2 ("lset",160,"NEXT") LDCall.Function2 ("lset",170,"NEXT") LDCall.Function2 ("lset",m300-1,"'ProgEnd.") LDArray.SetValue(prg,200,"200:PRINT Done.") refscr () EndSub Sub lset sl=args[1] sln=ldtext.Split(args[2],"\") For cz=1 To Array.GetItemCount (sln) LDArray.SetValue(prg,sl,sl+":"+sln[cz]) sl=sl+5 endfor endsub Sub makecursor'-----------------------------------------makes cursor shapes and edit lines kw=Shapes.AddText ("K") cml1=Shapes.AddText ("") cml2=Shapes.AddText ("") LDShapes.BrushColour (cml1,"White") LDShapes.PenColour (cml1,"Blue") LDShapes.BrushColour (kw,"Black") LDShapes.PenColour (kw,"White") LDShapes.Font(kw,"Arial",18,T_,F_) LDShapes.Font(cml1,"Arial",18,T_,F_) LDShapes.Font(cml2,"Arial",18,T_,F_) Shapes.Move(kw,70,530) Shapes.Move(cml1,70,530) Shapes.Move(cml2,70,530) endsub Sub drcln'-----------------------------------------------------draws cmd line txt tts=LDText.Split (inp," ")'--------splits line by spaces wlw="" For m=1 To Array.GetItemCount(tts) If Text.StartsWith(tts[m],"#") Then'---------keyword entered mm=text.GetSubTextToEnd (tts[m],2) If mm<0 then tts[m]=cmat[3][-mm]'----------kw set #2 ElseIf mm>50 then tts[m]=cmat[4][mm-50]'--------keyw set #3 else tts[m]=cmat[1][mm]'-----------kw set #1 endif endif wlw=wlw+tts[m]+" " endfor tt= Shapes.GetTop (kw) Shapes.SetText(cml1,wlw) dss=ldShapes.Width(ldtext.Trim (cml1)) Shapes.Move(kw,70+dss+10,tt) Shapes.Move(cml2,70+dss+15+10,tt) EndSub Sub runprg'---------------------------------------------------running prg prgf=LDArray.CopyToSBArray(prg) prr="" if cntr=1 then cntr=0 rrx= cntt else rrx=1 endif while rrx<= Array.GetItemCount(prgf) If prgf[rrx]="0" then 'nxx rrx=rrx+1 else pt=text.GetIndexOf (prgf[rrx],":")+1 cm=text.GetSubTextToEnd ( prgf[rrx],pt) cln=rrx evprgln() endif EndWhile If hltt=1 Then GraphicsWindow.Title="D Break. Cont continues..." hltt=0 else GraphicsWindow.Title="0 Ok. All done) Endif EndSub Sub ttm'-------------------------------------------timer tick cursor flashing tc=tc+1 Shapes.SetText (kw,csgn[md]) ipc1="Black If md=3 Then ipc1="Green elseif md=4 then ipc1="Red endif If Math.Remainder(tc,2)=0 then LDShapes.BrushColour (kw,IPC1) LDShapes.PenColour (kw,cclr) Else LDShapes.BrushColour (kw,cclr) LDShapes.PenColour (kw,IPC1) endif endsub Sub kdd'---------------------------------------------phisical kbd handling************************************************* lk= GraphicsWindow.LastKey GraphicsWindow.Title=lk ww=lk If Text.StartsWith (lk,"D") And Text.GetLength (lk)=2 Then '----------regukar nuber keys ww=text.GetSubTextToEnd (lk,2) elseIf Text.StartsWith (lk,"F") And Text.GetLength (lk)=2 Then'--------func keys cf=text.GetSubTextToEnd (lk,2) ww=text.GetSubText(acc[sst],cf,1) elseif lk="OemQuestion" then ww="?" elseif lk="F11" then sst=1 md=md-1 If md<1 then md=1 EndIf elseif lk="F12" then sst=2 md=md+1 mxd=Array.GetItemCount (csgn ) If md>mxd then md=mxd EndIf elseIf Text.StartsWith (lk,"NumP") then'------------------numpad keys ww=text.GetSubTextToEnd (lk,Text.GetLength(lk)) 'TextWindow.WriteLine (ww) endif If lk="Space" Then ww=" " elseIf lk="Escape" and text.GetLength(inp)<4 Then' ----------------edits line inp=LDArray.GetValue (prg,inp) num=text.GetSubText(inp,1,5) '--------------replaces : to space in order to make line editable!)) num=LDText.Replace(num,":"," ") inp=num+text.GetSubTextToEnd(inp,6) ww="" elseIf lk="Back" Then ww="" inp=text.GetSubText (inp,1,text.GetLength (inp)-1) If inp="" then md=1 endif elseIf lk="Return" Then Timer.Pause () ccmd() If runn=0 then evc2 () Else Goto rrr endif If nodo=0 then If inp="" then For x=1 to 20 LDShapes.Move (cml1,100+x*40,550) Program.Delay(22) Endfor else For x=1 to 20 LDShapes.Move (cml1,100-x*2,550-x*20) Program.Delay(22) Endfor endif endif rrr: nodo=0 crst() endif If Text.GetLength(ww)=1 or ww="" then inp=Text.Append (inp,ww) drcln() endif EndSub Sub crst'--------------------------------reset cmdline after enter key Shapes.SetText(cml1,"") Shapes.Move(cml1,70,530) md=1 Shapes.SetText (kw,"K") inp="" Shapes.Move(kw,70,530) If runn=0 then refscr() endif Shapes.SetText(cml2,"") Timer.Resume () EndSub Sub refscr'------------------------------------------------------refresh screen GraphicsWindow.BrushColor=ppc GraphicsWindow.FillRectangle (70,40,660,550) If nolst=0 then prgf=0 prgf=LDArray.CopyToSBArray(prg) prrs="" sl=0 For x=stl To Array.GetItemCount(prgf) If prgf[x]="0" Then 'nicc else prrs=prrs+prgf[x]+nl sl=sl+1 If sl>18 then Goto skk endif endif endfor skk: ' If Text.IsSubText (prr,"'") Then ' GraphicsWindow.BrushColor ="Green ' GraphicsWindow.FontItalic=t_ 'Else GraphicsWindow.BrushColor=Ipc GraphicsWindow.FontItalic =f_ ' endif GraphicsWindow.DrawBoundText (75,45,650,prrs) endif nolst=0 endsub Sub shppw'---------------------------------------------screen keybd shape press handling lsh=ldshapes.LastEventShape lst= LDShapes.LastEventType If lst="MouseDown" Then Shapes.SetOpacity (lsh,50) GraphicsWindow.Title=lsh kcd=text.GetSubTextToEnd (lsh,10) 'TextWindow.WriteLine (kcd) Else Shapes.SetOpacity (lsh,5) endif EndSub Sub nwarr'------------------------------------------------new prg array LDArray.Delete(prg) prg=LDArray.Create(m300) For x=1 to m300 LDArray.SetValue (prg,x,0) endfor EndSub Sub ccmd'----------------------------------------------------------eval cmdline cm=ldtext.Trim(Text.ConvertToUpperCase(inp)) runn=0 If cm="NEW" Then nwarr() stl=1 inp="" runn=0 donw() elseIf cm="CONT" Then GraphicsWindow.Title="Continuing... runn=1 cntr=1 nolst=1 ww="" elseIf cm="LOAD" Then fll=LDDialogs.OpenFile ("txt","i:\") ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(fll) then ' The following line could be harmful and has been automatically commented. ' infl=File.ReadContents(fll) inlns=ldtext.Split (infl,nl) nwarr() For x=1 to Array.GetItemCount(inlns) ln=ldtext.Split(inlns[x],":") LDArray.SetValue(prg,ln[1],ln[1]+":"+ln[2]) endfor endif elseIf cm="HELP" Then showhelp() elseIf cm="?LOGO" Then showlogohlp() elseIf cm="?CUBE" Then shwcubhlp() elseIf cm="SAVE" Then fll=LDDialogs.SaveFile ("txt","i:\") If fll="" then 'nicc Else prgf=LDArray.CopyToSBArray(prg) prr="" For x=1 To Array.GetItemCount(prgf) If prgf[x]="0" then 'nxx else prr=prr+ (prgf[x])+nl endif endfor endif ' The following line could be harmful and has been automatically commented. ' File.WriteContents (fll,prr) GraphicsWindow.Title="SAVE Ok!" elseIf cm="LLIST" Then inp="" prgf=LDArray.CopyToSBArray(prg) prr="" For x=1 To Array.GetItemCount(prgf) If prgf[x]="0" then 'nxx else textwindow.WriteLine (prgf[x]) endif endfor elseIf Text.StartsWith (cm,"LIST") Then GraphicsWindow.Title="OK 0:1" nnn=LDText.Split(cm,"|") stl=nnn[2] 'TextWindow.WriteLine (stl) ww="" nodo=1 crst() nolst=0 scfnt () refscr() nolst=1 elseIf cm="CLS" Then GraphicsWindow.Title="OK 0:1" ww="" nolst=1 refscr () nolst=1 crst() nolst=1 elseIf Text.StartsWith (cm,"RUN") Then GraphicsWindow.Title="Running... runn=1 nnn=LDText.Split(cm,"|") cntt=nnn[2] If cntt>0 then cntr=1 endif nolst=1 ww="" endif endsub Sub shwcubhlp hlg="CUBE x y z clh"+nl hlg=hlg+"CUB2 clh"+nl hlg=hlg+"x,y,z = 3d coords of cubecentre"+nl hlg=hlg+"2d last coords by PLOT/DRAW for CUB2 cmd."+nl hlg=hlg+"clh = color hue (0/360=red, 60=Yllw, 120=grn, "+nl hlg=hlg+"180=cy, 240=blue, 300=magenta"+nl GraphicsWindow.ShowMessage("CUBE/CUB2 params: " + nl + hlg, "Information") EndSub Sub showhelp hlg="BORDER PAPER INK CLS LIST GOTO RUN STOP CONT"+nl hlg=hlg+"PLOT DRAW 'REM HELP CUBE CUB2 LOGO LET"+nl hlg=hlg+"FOR NEXT SAVE LOAD ?LOGO ?CUBE NEW LLIST LPRINT"+nl hlg=hlg+"FLCKR WEB CIRCLE PAUSE GraphicsWindow.ShowMessage("Operative cmds: " + nl + hlg, "Information") endsub Sub showlogohlp hlg="Fxxx=forward by xxx px, RT/LT=turn right/left 90 deg."+nl hlg=hlg+"Rxxx /Lxxx =turn right/lft by xxx deg."+nl hlg=hlg+"Annn = set heading to nnn deg."+nl hlg=hlg+"Mxxx;yyy= move to (xxx,yyy)"+nl hlg=hlg+"SH/HD= shw/hide turtle"+nl hlg=hlg+"SPnn= turtle speed 1..10" GraphicsWindow.ShowMessage("LOGO cmds: " + nl + hlg, "Information") EndSub Sub plin'--------------------------------------------line splitting nxtl=0 If ttx+text.GetLength(args[1])*wc>660 Then ls=Math.Floor ((660-ttx)/13) pl1=text.GetSubText(args[1],1,ls) pl2=text.GetSubTexttoend(args[1],ls+1) nxtl=1 Else pl1=args[1] endif endsub Sub wrarr ari=Array.GetAllIndices(varr) ' TextWindow.WriteLine("***************") For jx=1 to Array.GetItemCount(varr) TextWindow.Write(ari[jx]+"<=") TextWindow.WriteLine(varr[ari[jx]]) endfor EndSub Sub replvars inn=ldtext.Split (args[1]," ") 'TextWindow.WriteLine (inn) For fd=1 To Array.GetItemCount(inn) ao=1 an=Array.GetAllIndices (varr) vc=array.GetItemCount(an) while Text.IsSubText (inn[fd],"&") Or vn>vc vn=an[ao] inn[fd]=LDText.Replace(inn[fd],"&"+vn,varr[vn]) ao=ao+1 EndWhile EndFor ress="" For fd=1 To Array.GetItemCount(inn) ress=ress+inn[fd]+" " EndFor 'TextWindow.WriteLine(ress) endsub Sub evprgln'-------------------------------------evals prg cmds If runn=1 then For q=1 To 6 '------nest level 6 loops cm=LDText.Replace(cm,"%F"+q,fv[q]) endfor endif ldcall.Function ("replvars",cm) cm=ress lm=text.GetIndexOf(cm+"'","'")-1 lcc=text.GetSubText (cm,1,lm) ltx=ldtext.Split(lcc," ") icl=array.GetItemCount (ltx) If ltx[1]="NEXT" then fv[fc]=fv[fc]+fs[fc] If fv[fc]<=fx[fc] then rrx=flin[fc] Else rrx=rrx+1 fc=fc-1 endif else If ltx[1]="BORDER" or ltx[1]="#B" Then GraphicsWindow.BackgroundColor=clrs[ltx[2]] inp="" elseIf ltx[1]="FOR" then fc=fc+1 flin[fc]=cln+1 fv[fc]=ltx[2] fx[fc]=ltx[3] fs[fc]=ltx[4] If fs[fc]=0 then fs[fc]=1 endif elseIf ltx[1]="STOP" then hltt=1 cntt=rrx+1 rrx=999 elseIf ltx[1]="LOGO" then For lg=2 to icl LDCall.Function ("logmv",ltx[lg]) endfor elseIf ltx[1]="WEB" then www=ltx[2] If www="" then www="www.smallbasic.com" endif wd=ltx[3] ht=ltx[4] If wd*ht=0 then wd=600 ht=400 endif wbb[ctc]=LDControls.AddBrowser (wd,ht,www) wbt[ctc]="Web:"+www Shapes.Move (wbb[ctc],70,40) ctc=ctc+1 elseIf ltx[1]="FLCKR" then iml=Flickr.GetRandomPicture("Water") GraphicsWindow.DrawResizedImage (iml,0,0,800,600) elseIf ltx[1]="INC" then vn = text.ConvertToLowerCase (ltx[2]) varr[vn] = FCExtensions.MathEval( varr[vn]) + FCExtensions.MathEval( ltx[3]) wrarr() elseIf ltx[1]="LET" then nf=2 rpp: varr[text.ConvertToLowerCase (ltx[nf])]=ltx[nf+1] If ltx[nf+2]="|" then nf=nf+3 Goto rpp endif elseIf ltx[1]="PLOT" then plx=ltx[2] ply=ltx[3] GraphicsWindow.BrushColor=ipc GraphicsWindow.FillEllipse(plx,ply,2,2) elseIf ltx[1]="DRAW" then plx1=ltx[2] ply1=ltx[3] dww=ltx[4] If dww<1 then dww=1 endif GraphicsWindow.PenColor=ipc GraphicsWindow.DrawLine (plx,ply,plx1,ply1) plx=plx1 ply=ply1 elseIf ltx[1]="GOTO" then rrx=ltx[2]-1 elseIf ltx[1]="CUBE" then LDCall.Function4 ("DrawCube",ltx[2],ltx[3],ltx[4],ltx[5]) elseIf ltx[1]="CUB2" then c2dmd=1 LDCall.Function4 ("DrawCube",plx,ply,ltx[2],ltx[3]) c2dmd=0 elseIf ltx[1]="CIRCLE" then GraphicsWindow.BrushColor=ipc rr=ltx[2]*2 GraphicsWindow.FillEllipse(plx-ltx[2],ply-ltx[2],rr,rr) elseIf ltx[1]="LPRINT" then 'TextWindow.WriteLine (ltx) If ltx[3]="|" then TextWindow.Write (nl+ltx[2]) Else TextWindow.Write (ltx[2]) endif elseIf ltx[1]="PRINT" then If ltx[3]="|" then ttx=0 tty=tty+hc_ endif GraphicsWindow.FontName ="Lucida Console" GraphicsWindow.FontSize =20 GraphicsWindow.FontBold =T_ ldcall.Function ( "plin",ltx[2]) GraphicsWindow.DrawText (ttx+70,tty, pl1) ' TextWindow.WriteLine (ltx[2]) ttx=ttx+text.GetLength(pl1)*wc If ttx>660 or nxtl=1 then ttx=0 tty=tty+hc_ If nxtl=1 then GraphicsWindow.DrawText (ttx+70,tty, pl2) ttx=ttx+text.GetLength(pl2)*wc endif nxtl=0 endif inp="" elseIf ltx[1]="PAUSE" then Program.Delay(ltx[2]) elseIf ltx[1]="PAPER" or ltx[1]="#P" Then ppc=clrs[ltx[2]] inp="" elseIf ltx[1]="CLS" Then If ltx[2]>0 then GraphicsWindow.BrushColor=clrs[ltx[2]] Else GraphicsWindow.BrushColor=ppc endif GraphicsWindow.FillRectangle (70,40,660,550) GraphicsWindow.BrushColor=Ipc ttx=0 tty=50 elseIf ltx[1]="INK" or ltx[1]="#I" Then ipc=clrs[ltx[2]] if ltx[2]>4 and ltx[2]<8 then cclr="Black Else cclr="White endif inp="" endif rrx=rrx+1 endif EndSub Sub logmv'---------------------------------------------------------------logo part******************************* lc=text.ConvertToLowerCase (args[1]) If Text.StartsWith(lc,"f") Then Turtle.Move (Text.GetSubTextToEnd (lc,2)) elseIf Text.StartsWith(lc,"a") Then Turtle.Angle = (Text.GetSubTextToEnd (lc,2)) elseIf Text.StartsWith(lc,"rt") Then Turtle.TurnRight () elseIf Text.StartsWith(lc,"lt") Then Turtle.TurnLeft() elseIf Text.StartsWith(lc,"r") Then Turtle.Angle = Turtle.Angle+(Text.GetSubTextToEnd (lc,2)) elseIf Text.StartsWith(lc,"l") Then Turtle.Angle = Turtle.Angle-(Text.GetSubTextToEnd (lc,2)) elseIf Text.StartsWith(lc,"u") Then Turtle.PenUp () elseIf Text.StartsWith(lc,"d") Then Turtle.PenDown () elseIf Text.StartsWith(lc,"sh") Then LDShapes.ResetTurtle () Turtle.Show () elseIf Text.StartsWith(lc,"hd") Then Turtle.hide () LDShapes.RemoveTurtleLines() elseIf Text.StartsWith(lc,"sp") Then Turtle.Speed = (Text.GetSubTextToEnd (lc,3)) elseIf Text.StartsWith(lc,"m") Then Trx= LDText.Split (Text.GetSubTextToEnd (lc,2),";") Turtle.MoveTo(Trx[1],Trx[2]) Turtle.Angle=0 endif plx=turtle.X ply=turtle.y EndSub Sub donw'------------------------------------------------------------new cmd-reset Timer.Pause () cclr="White" ppc=clrs[0] nolst=1 refscr() Shapes.SetText(cml1,"") Shapes.SetText(cml2,"") GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=33 GraphicsWindow.FontBold=t_ GraphicsWindow.BrushColor="Black GraphicsWindow.DrawText(300,200,"Spectrum revival") GraphicsWindow.DrawText(300,230,"1982-2015") GraphicsWindow.BackgroundColor=clrs[0] brc= LDText.Split("Red Yellow Green Cyan"," ") brr= LDShapes.BrushGradient(brc,"DU") bpp[1][1]=650 bpp[1][2]=600 bpp[2][1]=750 bpp[2][2]=600 bpp[3][1]=800 bpp[3][2]=550 bpp[4][1]=800 bpp[4][2]=450 LDShapes.BrushGradientPolygon(brr,bpp) nn=Shapes.AddRectangle (660,550) Shapes.Move (nn,70,40) ipc="Black ppc=clrs[0] LDShapes.BrushColour(nn,"Black") For x=100 To 1 Step -1 Shapes.setOpacity(nn,x) Program.Delay(5) endfor Shapes.HideShape(nn) ldShapes.move (nn,1000,1000) Program.Delay(1500) scfnt () GraphicsWindow.BrushColor="Black Timer.Resume () endsub Sub evc2 If LDText.FindAll (inp," ")=0 Then ni=inp If ni>0 and nim300-2 Then ltx[1]=m300-2 endif pzz= LDText.FindAll(clst,ltx[2]) 'TextWindow.WriteLine(pzz) If pzz=0 Then ltx[2]="' rem:"+ltx[2] endif lll=ltx[1]+":" For x=2 To Array.GetItemCount(ltx) 'TextWindow.WriteLine(ltx[x]) If ltx[x]=0 then 'nicc ElseIf ltx[x]="0$" then lll=lll+"0 " else lll=lll+ltx[x]+" " EndIf endfor LDArray.SetValue(prg,ltx[1],lll) endif endif endsub Sub kyy'---------------------------------draws keys and set key shape event ---------------- LDShapes.BrushGradientRoundedRectangle(brr,args[1],args[2],args[3],args[4],5) kyb[ki]=Shapes.AddRectangle(args[3],args[4]) Shapes.Move (kyb[ki],args[1],args[2]) LDShapes.SetShapeEvent (kyb[ki]) Shapes.SetOpacity (kyb[ki],10) If ki=10 Then LDDialogs.ToolTip (kyb[10],"Type ?LOGO for help") elseIf ki=9 Then LDDialogs.ToolTip (kyb[9],"Type ?CUBE for help") elseIf ki=4 Then LDDialogs.ToolTip(kyb[ki],"Press RUN+enter to start prg") elseIf ki=11 Then LDDialogs.ToolTip(kyb[ki],"Press NEW+enter to start a new prg") endif ki=ki+1 endsub Sub drwkbd'-----------------------------------------------------------scrn keybd draw-------------------- GraphicsWindow.FontName="ARIAL GraphicsWindow.FontSize=11 GraphicsWindow.BrushColor ="Green bcc=ldtext.Split("White Gray DarkGray"," ") brr= LDShapes.BrushGradient (bcc,"DD") txl=ldtext.Split(grtx[1]," ") For x=0 To 9 LDCall.Function4 ("kyy",50+x*73,750,50,40) '---qwe GraphicsWindow.DrawText (50+x*73,730,txl[x+1]) EndFor GraphicsWindow.BrushColor ="Black GraphicsWindow.FontSize=26 For x=0 To 9 GraphicsWindow.DrawText (55+x*73,750,Text.GetSubText ("QWERTYUIOP",x+1,1)) EndFor GraphicsWindow.FontSize=11 GraphicsWindow.BrushColor ="Green txl=ldtext.Split(grtx[2]," ") For x=0 To 9 LDCall.Function4 ("kyy",70+x*73,830,50,40) '--asd GraphicsWindow.DrawText (73+x*73,812,txl[x+1]) EndFor GraphicsWindow.BrushColor ="Black GraphicsWindow.FontSize=26 For x=0 To 9 GraphicsWindow.DrawText (75+x*73,830,Text.GetSubText ("ASDFGHJKL",x+1,1)) EndFor GraphicsWindow.FontSize=11 GraphicsWindow.BrushColor ="Green txl=ldtext.Split(grtx[3]," ") For x=0 To 8 LDCall.Function4 ("kyy",110+x*73,915,50,40) '---zxc GraphicsWindow.DrawText (115+x*73,900,txl[x+1]) EndFor GraphicsWindow.BrushColor ="Black GraphicsWindow.FontSize=26 For x=0 To 9 GraphicsWindow.DrawText (114+x*73,915,Text.GetSubText ("ZXCVBNM ",x+1,1)) EndFor GraphicsWindow.FontSize=11 GraphicsWindow.BrushColor ="White txl=ldtext.Split("PLOT DRAW REM RUN HELP! RET. IF INPUT CUBE PRINT"," ") meastx() For x=0 To 9 GraphicsWindow.DrawText (94+x*73-mx[x+1],774,txl[x+1]) EndFor txl=ldtext.Split("NEW SAVE DIM FOR GOTO GSUB LOAD LIST LET ENTER"," ") meastx() For x=0 To 9 GraphicsWindow.DrawText (114+x*73-mx[x+1],853,txl[x+1]) EndFor txl=ldtext.Split("COPY CLR CONT CLS BORD. NEXT PAUSE SYMB SPC"," ") meastx() For x=0 To 8 GraphicsWindow.DrawText (155+x*73-mx[x+1],940,txl[x+1]) EndFor GraphicsWindow.BrushColor ="Red txl=ldtext.Split(rdxt[1]," ") For x=0 To 9 GraphicsWindow.DrawText (57+x*73,793,txl[x+1]) EndFor txl=ldtext.Split(rdxt[2]," ") For x=0 To 8 GraphicsWindow.DrawText (77+x*73,873,txl[x+1]) EndFor txl=ldtext.Split(rdxt[3]," ") For x=0 To 6 GraphicsWindow.DrawText (117+x*73,960,txl[x+1]) EndFor txl=ldtext.Split(rdxt[4]," ") For x=0 To 9 GraphicsWindow.DrawText (29+x*73,710,txl[x+1]) EndFor txl=ldtext.Split("! @ # $ % & ' ( ) _"," ") For x=0 To 10 LDCall.Function4 ("kyy",26+x*73,660,50,40) '---123 GraphicsWindow.DrawText (54+x*73,684,txl[x+1]) EndFor GraphicsWindow.BrushColor ="Black GraphicsWindow.FontSize=26 For x=0 To 10 GraphicsWindow.DrawText (30+x*73,670,Text.GetSubText ("1234567890←",x+1,1)) EndFor GraphicsWindow.FontSize=11 GraphicsWindow.BrushColor ="Red txl=ldtext.Split("HLT NOT < > \ ^ - + ="," ") meastx() For x=0 To 8 GraphicsWindow.DrawText (118+x*73-mx[x+1],833,txl[x+1]) EndFor nw=text.GetCharacter(34) txl=ldtext.Split("[ ] TRG { } AND OR AT ; "+nw," ") meastx() For x=0 To 9 GraphicsWindow.DrawText (99+x*73-mx[x+1],753,txl[x+1]) EndFor endsub Sub mwww GraphicsWindow.Title= GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY EndSub Sub meastx'----------------------------------------------measure txt width mx=0 For f=1 To Array.GetItemCount(txl) ia=LDText.FindAll(txl[f],"I") ic=array.GetItemCount (ia) is=text.GetLength(txl[f])-ic mx[f]=ic*4+is*8 EndFor EndSub Sub DrawCube'---------------------------------------3dcubes dmt=ldtext.Split ("1 1 1"," ") If c2dmd=1 Then edge = Math.SquareRoot(2 / 3) * cedge x=args[1] y=args[2] cci=args[3] If args[4]="T" Then dmt=ldtext.Split ("0 0 1"," ") endif ppx=0 ppy=0 x1 = ppx y1 = ppy else ppx1= args[1] ppy1= args[2] ppz1= args[3] ppx=bsx0 ppy=bsy0 ppz=0 edge = Math.SquareRoot(2 / 3) * cedge cci= args[4] x1 = ppx y1 = ppy ppx=ppx1 ppy=ppy1 ppz=ppz1 Conv3Dto2D() endif cw=1 clw1[1]=LDColours.HSLtoRGB(cci,0.4,sllw) clw1[2]=LDColours.HSLtoRGB(cci,0.4,sllw*1.2) clw1[3]=LDColours.HSLtoRGB(cci,0.4,sllw*1.4) clw2[1]=LDColours.HSLtoRGB(cci,0.5,sllw) clw2[2]=LDColours.HSLtoRGB(cci,0.5,sllw*1.2) clw2[3]=LDColours.HSLtoRGB(cci,0.5,sllw*1.4) clw3[1]=LDColours.HSLtoRGB(cci,0.7,sllw) clw3[2]=LDColours.HSLtoRGB(cci,0.7,sllw*1.3) clw3[3]=LDColours.HSLtoRGB(cci,0.7,sllw*1.5) brsh[1]=LDShapes.BrushGradient (clw1,"DD") brsh[2]=LDShapes.BrushGradient (clw2,"DU") brsh[3]=LDShapes.BrushGradient (clw3,"H") For a = san To 360+san Step 60 _a = Math.GetRadians(a) x2 = bsx0 - edge * Math.Sin(_a) y2 = bsy0 - edge * Math.Cos(_a) If a>san Then If a=360 then cc=1 Else cc=math.Remainder (a,360) / 60 endif If math.Remainder (a/60-1,2)=0 then plly[1][1]=x1+50+x plly[1][2]=y1-30+y plly[2][1]=x2+50+x plly[2][2]=y2-30+y plly[3][1]=x3+50+x plly[3][2]=y3-30+y plly[4][1]=ox3+50+x plly[4][2]=oy3-30+y If dmt[cw]=1 then ldShapes.brushGradientPolygon(brsh[cw], plly) endif cw=cw+1 pi=pi+1 endif EndIf ox3=x3 oy3=y3 x3 = x2 y3 = y2 EndFor endsub Sub Conv3Dto2D'-----------------------------------------3d to 2d cnv x = bsx - Math.SquareRoot(1 / 2) *ppx x = x + Math.SquareRoot(1 / 2) * ppy y = bsy + Math.SquareRoot(1 / 6) * ppx y = y + Math.SquareRoot(1 / 6) * ppy y = y - Math.SquareRoot(2 / 3) * ppz EndSub End>VSS227.sb< Start>VSS293.sb< Shapes.AddTriangle(450, 500, 340, 350, 140, 510) Shapes.AddTriangle(140, 510, 450, 500, 400, 540) Shapes.AddTriangle(340, 350, 140, 510, 180, 410) Shapes.AddTriangle(400, 540, 140, 510, 300, 560) Shapes.AddTriangle(140, 510, 300, 560, 150, 540) Shapes.AddTriangle(310, 39, 380, 39, 380, 89) Shapes.AddTriangle(310, 39, 310, 89, 380, 89) Shapes.AddTriangle(310, 38, 380, 38, 380, 88) Shapes.AddTriangle(310, 38, 310, 88, 380, 88) Shapes.AddTriangle(310, 37, 380, 37, 380, 87) Shapes.AddTriangle(310, 37, 310, 87, 380, 87) Shapes.AddTriangle(310, 36, 380, 36, 380, 86) Shapes.AddTriangle(310, 36, 310, 86, 380, 86) Shapes.AddTriangle(310, 35, 380, 35, 380, 85) Shapes.AddTriangle(310, 35, 310, 85, 380, 85) Shapes.AddTriangle(310, 34, 380, 34, 380, 84) Shapes.AddTriangle(310, 34, 310, 84, 380, 84) Shapes.AddTriangle(310, 33, 380, 33, 380, 83) Shapes.AddTriangle(310, 33, 310, 83, 380, 83) Shapes.AddTriangle(310, 32, 380, 32, 380, 82) Shapes.AddTriangle(310, 32, 310, 82, 380, 82) Shapes.AddTriangle(310, 31, 380, 31, 380, 81) Shapes.AddTriangle(310, 31, 310, 81, 380, 81) Shapes.AddTriangle(310, 30, 380, 30, 380, 80) Shapes.AddTriangle(310, 30, 310, 80, 380, 80) Shapes.AddTriangle(310, 29, 380, 29, 380, 79) Shapes.AddTriangle(310, 29, 310, 79, 380, 79) Shapes.AddTriangle(310, 28, 380, 28, 380, 78) Shapes.AddTriangle(310, 28, 310, 78, 380, 78) Shapes.AddTriangle(310, 27, 380, 27, 380, 77) Shapes.AddTriangle(310, 27, 310, 77, 380, 77) Shapes.AddTriangle(310, 26, 380, 26, 380, 76) Shapes.AddTriangle(310, 26, 310, 76, 380, 76) Shapes.AddTriangle(310, 25, 380, 25, 380, 75) Shapes.AddTriangle(310, 25, 310, 75, 380, 75) Shapes.AddTriangle(310, 24, 380, 24, 380, 74) Shapes.AddTriangle(310, 24, 310, 74, 380, 74) Shapes.AddTriangle(310, 23, 380, 23, 380, 73) Shapes.AddTriangle(310, 23, 310, 73, 380, 73) Shapes.AddTriangle(310, 22, 380, 22, 380, 72) Shapes.AddTriangle(310, 22, 310, 72, 380, 72) Shapes.AddTriangle(310, 21, 380, 21, 380, 71) Shapes.AddTriangle(310, 21, 310, 71, 380, 71) Shapes.AddTriangle(310, 20, 380, 20, 380, 70) Shapes.AddTriangle(310, 20, 310, 70, 380, 70) Shapes.AddTriangle(310, 19, 380, 19, 380, 69) Shapes.AddTriangle(310, 19, 310, 69, 380, 69) Shapes.AddTriangle(310, 18, 380, 18, 380, 68) Shapes.AddTriangle(310, 18, 310, 68, 380, 68) Shapes.AddTriangle(310, 17, 380, 17, 380, 67) Shapes.AddTriangle(310, 17, 310, 67, 380, 67) Shapes.AddTriangle(310, 16, 380, 16, 380, 66) Shapes.AddTriangle(310, 16, 310, 66, 380, 66) Shapes.AddTriangle(310, 15, 380, 15, 380, 65) Shapes.AddTriangle(310, 15, 310, 65, 380, 65) Shapes.AddTriangle(310, 40, 380, 40, 380, 90) Shapes.AddTriangle(310, 40, 310, 90, 380, 90) Shapes.AddTriangle(330, 88, 340, 90, 350, 75) Shapes.AddTriangle(315, 78, 310, 70, 350, 75) Shapes.AddTriangle(312, 56, 318, 50, 350, 75) Shapes.AddTriangle(332, 42, 348, 40, 350, 75) Shapes.AddTriangle(358, 41, 368, 47, 350, 75) Shapes.AddTriangle(376, 55, 380, 60, 350, 75) Shapes.AddTriangle(380, 72, 373, 80, 350, 75) Shapes.AddTriangle(350, 105, 345, 100, 410, 75) Shapes.AddTriangle(410, 75, 420, 80, 350, 105) Shapes.AddTriangle(350, 105, 355, 110, 420, 80) Shapes.AddTriangle(350, 105, 370, 95, 365, 115) Shapes.AddTriangle(370, 95, 365, 115, 380, 100) Shapes.AddTriangle(345, 100, 340, 95, 410, 75) Shapes.AddTriangle(355, 76, 358, 76, 358, 91) Shapes.AddTriangle(355, 76, 355, 91, 358, 91) Shapes.AddTriangle(370, 72, 373, 72, 373, 87) Shapes.AddTriangle(370, 72, 370, 87, 373, 87) Shapes.AddTriangle(395, 66, 398, 66, 398, 78) Shapes.AddTriangle(395, 66, 395, 78, 398, 78) Shapes.AddTriangle(405, 64, 408, 64, 408, 76) Shapes.AddTriangle(405, 64, 405, 76, 408, 76) Shapes.AddTriangle(385, 68, 388, 68, 388, 83) Shapes.AddTriangle(385, 68, 385, 83, 388, 83) Shapes.AddTriangle(340, 80, 343, 80, 343, 95) Shapes.AddTriangle(340, 80, 340, 95, 343, 95) Shapes.AddTriangle(415, 68, 418, 68, 418, 80) Shapes.AddTriangle(415, 68, 415, 80, 418, 80) Shapes.AddTriangle(340, 83, 335, 78, 410, 64) Shapes.AddTriangle(405, 64, 418, 68, 418, 72) Shapes.AddTriangle(250, 110, 500, 110, 500, 360) Shapes.AddTriangle(250, 110, 250, 360, 500, 360) Shapes.AddTriangle(490, 202, 540, 202, 540, 282) Shapes.AddTriangle(490, 202, 490, 282, 540, 282) Shapes.AddTriangle(530, 205, 550, 205, 550, 255) Shapes.AddTriangle(530, 205, 530, 255, 550, 255) Shapes.AddTriangle(530, 246, 570, 246, 570, 271) Shapes.AddTriangle(530, 246, 530, 271, 570, 271) Shapes.AddTriangle(535, 260, 565, 260, 565, 272) Shapes.AddTriangle(535, 260, 535, 272, 565, 272) Shapes.AddTriangle(540, 242, 570, 242, 570, 257) Shapes.AddTriangle(540, 242, 540, 257, 570, 257) Shapes.AddTriangle(250, 160, 515, 160, 515, 260) Shapes.AddTriangle(250, 160, 250, 260, 515, 260) Shapes.AddTriangle(250, 190, 515, 190, 515, 260) Shapes.AddTriangle(250, 190, 250, 260, 515, 260) 'GraphicsWindow.DrawEllipse(250, 190, 265, 70) Shapes.AddTriangle(295, 123, 315, 123, 315, 163) Shapes.AddTriangle(295, 123, 295, 163, 315, 163) Shapes.AddTriangle(315, 123, 315, 165, 335, 123) Shapes.AddLine(290, 128, 290, 163) Shapes.AddLine(293, 130, 260, 145) Shapes.AddLine(265, 145, 265, 170) Shapes.AddLine(295, 125, 260, 136) Shapes.AddLine(260, 135, 260, 168) Shapes.AddTriangle(270, 144, 287, 144, 287, 169) Shapes.AddTriangle(270, 144, 270, 169, 287, 169) Shapes.AddLine(272, 146, 285, 140) Shapes.AddTriangle(210, 120, 240, 120, 240, 175) Shapes.AddTriangle(210, 120, 210, 175, 240, 175) Shapes.AddTriangle(220, 130, 225, 105, 208, 110) Shapes.AddTriangle(220, 130, 238, 130, 238, 180) Shapes.AddTriangle(220, 130, 220, 180, 238, 180) Shapes.AddTriangle(240, 105, 225, 105, 220, 120) Shapes.AddTriangle(240, 105, 220, 120, 244, 115) Shapes.AddTriangle(220, 120, 236, 125, 244, 114) Shapes.AddTriangle(218, 120, 214, 130, 208, 110) Shapes.AddTriangle(180, 155, 235, 155, 235, 205) Shapes.AddTriangle(180, 155, 180, 205, 235, 205) Shapes.AddTriangle(210, 160, 250, 160, 250, 210) Shapes.AddTriangle(210, 160, 210, 210, 250, 210) 'GraphicsWindow.DrawEllipse(210, 160, 40, 50) Shapes.AddTriangle(220, 160, 270, 160, 270, 210) Shapes.AddTriangle(220, 160, 220, 210, 270, 210) Shapes.AddTriangle(235, 160, 285, 160, 285, 210) Shapes.AddTriangle(235, 160, 235, 210, 285, 210) Shapes.AddTriangle(139, 41, 156, 41, 156, 56) Shapes.AddTriangle(139, 41, 139, 56, 156, 56) Shapes.AddTriangle(138, 42, 157, 42, 157, 57) Shapes.AddTriangle(138, 42, 138, 57, 157, 57) Shapes.AddTriangle(137, 43, 158, 43, 158, 58) Shapes.AddTriangle(137, 43, 137, 58, 158, 58) Shapes.AddTriangle(136, 44, 159, 44, 159, 59) Shapes.AddTriangle(136, 44, 136, 59, 159, 59) Shapes.AddTriangle(135, 45, 160, 45, 160, 60) Shapes.AddTriangle(135, 45, 135, 60, 160, 60) Shapes.AddTriangle(134, 46, 161, 46, 161, 61) Shapes.AddTriangle(134, 46, 134, 61, 161, 61) Shapes.AddTriangle(133, 47, 162, 47, 162, 62) Shapes.AddTriangle(133, 47, 133, 62, 162, 62) Shapes.AddTriangle(132, 48, 163, 48, 163, 63) Shapes.AddTriangle(132, 48, 132, 63, 163, 63) Shapes.AddTriangle(131, 49, 164, 49, 164, 64) Shapes.AddTriangle(131, 49, 131, 64, 164, 64) Shapes.AddTriangle(130, 50, 165, 50, 165, 65) Shapes.AddTriangle(130, 50, 130, 65, 165, 65) Shapes.AddTriangle(129, 51, 166, 51, 166, 66) Shapes.AddTriangle(129, 51, 129, 66, 166, 66) Shapes.AddTriangle(128, 52, 167, 52, 167, 67) Shapes.AddTriangle(128, 52, 128, 67, 167, 67) Shapes.AddTriangle(127, 53, 168, 53, 168, 68) Shapes.AddTriangle(127, 53, 127, 68, 168, 68) Shapes.AddTriangle(126, 54, 169, 54, 169, 69) Shapes.AddTriangle(126, 54, 126, 69, 169, 69) Shapes.AddTriangle(125, 55, 170, 55, 170, 70) Shapes.AddTriangle(125, 55, 125, 70, 170, 70) Shapes.AddTriangle(124, 56, 171, 56, 171, 71) Shapes.AddTriangle(124, 56, 124, 71, 171, 71) Shapes.AddTriangle(123, 57, 172, 57, 172, 72) Shapes.AddTriangle(123, 57, 123, 72, 172, 72) Shapes.AddTriangle(122, 58, 173, 58, 173, 73) Shapes.AddTriangle(122, 58, 122, 73, 173, 73) Shapes.AddTriangle(121, 59, 174, 59, 174, 74) Shapes.AddTriangle(121, 59, 121, 74, 174, 74) Shapes.AddTriangle(120, 60, 175, 60, 175, 75) Shapes.AddTriangle(120, 60, 120, 75, 175, 75) Shapes.AddTriangle(120, 60, 175, 60, 175, 75) Shapes.AddTriangle(120, 60, 120, 75, 175, 75) Shapes.AddTriangle(132, 65, 162, 65, 162, 80) Shapes.AddTriangle(132, 65, 132, 80, 162, 80) Shapes.AddTriangle(132, 66, 162, 66, 162, 81) Shapes.AddTriangle(132, 66, 132, 81, 162, 81) Shapes.AddTriangle(132, 67, 162, 67, 162, 82) Shapes.AddTriangle(132, 67, 132, 82, 162, 82) Shapes.AddTriangle(132, 68, 162, 68, 162, 83) Shapes.AddTriangle(132, 68, 132, 83, 162, 83) Shapes.AddTriangle(132, 69, 162, 69, 162, 84) Shapes.AddTriangle(132, 69, 132, 84, 162, 84) Shapes.AddTriangle(132, 70, 162, 70, 162, 85) Shapes.AddTriangle(132, 70, 132, 85, 162, 85) Shapes.AddTriangle(132, 71, 162, 71, 162, 86) Shapes.AddTriangle(132, 71, 132, 86, 162, 86) Shapes.AddTriangle(132, 72, 162, 72, 162, 87) Shapes.AddTriangle(132, 72, 132, 87, 162, 87) Shapes.AddTriangle(132, 73, 162, 73, 162, 88) Shapes.AddTriangle(132, 73, 132, 88, 162, 88) Shapes.AddTriangle(132, 74, 162, 74, 162, 89) Shapes.AddTriangle(132, 74, 132, 89, 162, 89) Shapes.AddTriangle(132, 75, 162, 75, 162, 90) Shapes.AddTriangle(132, 75, 132, 90, 162, 90) Shapes.AddTriangle(120, 75, 175, 75, 175, 90) Shapes.AddTriangle(120, 75, 120, 90, 175, 90) Shapes.AddTriangle(120, 77, 175, 77, 175, 92) Shapes.AddTriangle(120, 77, 120, 92, 175, 92) Shapes.AddTriangle(120, 78, 175, 78, 175, 93) Shapes.AddTriangle(120, 78, 120, 93, 175, 93) Shapes.AddTriangle(120, 79, 175, 79, 175, 94) Shapes.AddTriangle(120, 79, 120, 94, 175, 94) Shapes.AddTriangle(120, 80, 175, 80, 175, 95) Shapes.AddTriangle(120, 80, 120, 95, 175, 95) Shapes.AddTriangle(120, 81, 175, 81, 175, 96) Shapes.AddTriangle(120, 81, 120, 96, 175, 96) Shapes.AddTriangle(120, 82, 175, 82, 175, 97) Shapes.AddTriangle(120, 82, 120, 97, 175, 97) Shapes.AddTriangle(120, 83, 175, 83, 175, 98) Shapes.AddTriangle(120, 83, 120, 98, 175, 98) Shapes.AddTriangle(120, 84, 175, 84, 175, 99) Shapes.AddTriangle(120, 84, 120, 99, 175, 99) Shapes.AddTriangle(120, 88, 175, 88, 175, 103) Shapes.AddTriangle(120, 88, 120, 103, 175, 103) Shapes.AddTriangle(132, 93, 162, 93, 162, 108) Shapes.AddTriangle(132, 93, 132, 108, 162, 108) Shapes.AddTriangle(132, 94, 162, 94, 162, 109) Shapes.AddTriangle(132, 94, 132, 109, 162, 109) Shapes.AddTriangle(132, 95, 162, 95, 162, 110) Shapes.AddTriangle(132, 95, 132, 110, 162, 110) Shapes.AddTriangle(132, 96, 162, 96, 162, 111) Shapes.AddTriangle(132, 96, 132, 111, 162, 111) Shapes.AddTriangle(132, 97, 162, 97, 162, 112) Shapes.AddTriangle(132, 97, 132, 112, 162, 112) Shapes.AddTriangle(132, 98, 162, 98, 162, 113) Shapes.AddTriangle(132, 98, 132, 113, 162, 113) Shapes.AddTriangle(132, 99, 162, 99, 162, 114) Shapes.AddTriangle(132, 99, 132, 114, 162, 114) Shapes.AddTriangle(132, 100, 162, 100, 162, 115) Shapes.AddTriangle(132, 100, 132, 115, 162, 115) Shapes.AddTriangle(132, 101, 162, 101, 162, 116) Shapes.AddTriangle(132, 101, 132, 116, 162, 116) Shapes.AddTriangle(132, 102, 162, 102, 162, 117) Shapes.AddTriangle(132, 102, 132, 117, 162, 117) Shapes.AddTriangle(132, 103, 162, 103, 162, 118) Shapes.AddTriangle(132, 103, 132, 118, 162, 118) Shapes.AddTriangle(120, 103, 175, 103, 175, 118) Shapes.AddTriangle(120, 103, 120, 118, 175, 118) Shapes.AddTriangle(120, 106, 175, 106, 175, 121) Shapes.AddTriangle(120, 106, 120, 121, 175, 121) Shapes.AddTriangle(120, 107, 175, 107, 175, 122) Shapes.AddTriangle(120, 107, 120, 122, 175, 122) Shapes.AddTriangle(120, 108, 175, 108, 175, 123) Shapes.AddTriangle(120, 108, 120, 123, 175, 123) Shapes.AddTriangle(120, 109, 175, 109, 175, 124) Shapes.AddTriangle(120, 109, 120, 124, 175, 124) Shapes.AddTriangle(120, 110, 175, 110, 175, 125) Shapes.AddTriangle(120, 110, 120, 125, 175, 125) Shapes.AddTriangle(120, 111, 175, 111, 175, 126) Shapes.AddTriangle(120, 111, 120, 126, 175, 126) Shapes.AddTriangle(120, 112, 175, 112, 175, 127) Shapes.AddTriangle(120, 112, 120, 127, 175, 127) Shapes.AddTriangle(120, 113, 175, 113, 175, 128) Shapes.AddTriangle(120, 113, 120, 128, 175, 128) Shapes.AddTriangle(120, 116, 175, 116, 175, 131) Shapes.AddTriangle(120, 116, 120, 131, 175, 131) Shapes.AddTriangle(121, 117, 174, 117, 174, 132) Shapes.AddTriangle(121, 117, 121, 132, 174, 132) Shapes.AddTriangle(122, 118, 173, 118, 173, 133) Shapes.AddTriangle(122, 118, 122, 133, 173, 133) Shapes.AddTriangle(123, 119, 172, 119, 172, 134) Shapes.AddTriangle(123, 119, 123, 134, 172, 134) Shapes.AddTriangle(124, 120, 171, 120, 171, 135) Shapes.AddTriangle(124, 120, 124, 135, 171, 135) Shapes.AddTriangle(125, 121, 170, 121, 170, 136) Shapes.AddTriangle(125, 121, 125, 136, 170, 136) Shapes.AddTriangle(126, 122, 169, 122, 169, 137) Shapes.AddTriangle(126, 122, 126, 137, 169, 137) Shapes.AddTriangle(127, 123, 168, 123, 168, 138) Shapes.AddTriangle(127, 123, 127, 138, 168, 138) Shapes.AddTriangle(128, 124, 167, 124, 167, 139) Shapes.AddTriangle(128, 124, 128, 139, 167, 139) Shapes.AddTriangle(129, 125, 166, 125, 166, 140) Shapes.AddTriangle(129, 125, 129, 140, 166, 140) Shapes.AddTriangle(130, 126, 165, 126, 165, 141) Shapes.AddTriangle(130, 126, 130, 141, 165, 141) Shapes.AddTriangle(131, 127, 164, 127, 164, 142) Shapes.AddTriangle(131, 127, 131, 142, 164, 142) Shapes.AddTriangle(132, 128, 163, 128, 163, 143) Shapes.AddTriangle(132, 128, 132, 143, 163, 143) Shapes.AddTriangle(133, 129, 162, 129, 162, 144) Shapes.AddTriangle(133, 129, 133, 144, 162, 144) Shapes.AddTriangle(134, 130, 161, 130, 161, 145) Shapes.AddTriangle(134, 130, 134, 145, 161, 145) Shapes.AddTriangle(135, 131, 160, 131, 160, 146) Shapes.AddTriangle(135, 131, 135, 146, 160, 146) Shapes.AddTriangle(128, 130, 167, 130, 167, 138) Shapes.AddTriangle(128, 130, 128, 138, 167, 138) Shapes.AddTriangle(128, 131, 167, 131, 167, 139) Shapes.AddTriangle(128, 131, 128, 139, 167, 139) Shapes.AddTriangle(128, 133, 167, 133, 167, 141) Shapes.AddTriangle(128, 133, 128, 141, 167, 141) Shapes.AddTriangle(128, 135, 167, 135, 167, 143) Shapes.AddTriangle(128, 135, 128, 143, 167, 143) Shapes.AddTriangle(128, 137, 167, 137, 167, 145) Shapes.AddTriangle(128, 137, 128, 145, 167, 145) Shapes.AddTriangle(128, 139, 167, 139, 167, 147) Shapes.AddTriangle(128, 139, 128, 147, 167, 147) Shapes.AddTriangle(128, 141, 167, 141, 167, 149) Shapes.AddTriangle(128, 141, 128, 149, 167, 149) Shapes.AddTriangle(128, 143, 167, 143, 167, 151) Shapes.AddTriangle(128, 143, 128, 151, 167, 151) Shapes.AddTriangle(128, 145, 167, 145, 167, 153) Shapes.AddTriangle(128, 145, 128, 153, 167, 153) Shapes.AddTriangle(128, 147, 167, 147, 167, 155) Shapes.AddTriangle(128, 147, 128, 155, 167, 155) Shapes.AddTriangle(128, 149, 167, 149, 167, 157) Shapes.AddTriangle(128, 149, 128, 157, 167, 157) Shapes.AddTriangle(128, 151, 167, 151, 167, 159) Shapes.AddTriangle(128, 151, 128, 159, 167, 159) Shapes.AddTriangle(128, 153, 167, 153, 167, 161) Shapes.AddTriangle(128, 153, 128, 161, 167, 161) Shapes.AddTriangle(128, 155, 167, 155, 167, 163) Shapes.AddTriangle(128, 155, 128, 163, 167, 163) Shapes.AddTriangle(128, 157, 167, 157, 167, 165) Shapes.AddTriangle(128, 157, 128, 165, 167, 165) Shapes.AddTriangle(128, 159, 167, 159, 167, 167) Shapes.AddTriangle(128, 159, 128, 167, 167, 167) Shapes.AddTriangle(128, 161, 167, 161, 167, 169) Shapes.AddTriangle(128, 161, 128, 169, 167, 169) Shapes.AddTriangle(128, 163, 167, 163, 167, 171) Shapes.AddTriangle(128, 163, 128, 171, 167, 171) Shapes.AddTriangle(128, 165, 167, 165, 167, 173) Shapes.AddTriangle(128, 165, 128, 173, 167, 173) Shapes.AddTriangle(128, 167, 167, 167, 167, 175) Shapes.AddTriangle(128, 167, 128, 175, 167, 175) Shapes.AddTriangle(128, 169, 167, 169, 167, 177) Shapes.AddTriangle(128, 169, 128, 177, 167, 177) Shapes.AddTriangle(128, 171, 167, 171, 167, 179) Shapes.AddTriangle(128, 171, 128, 179, 167, 179) Shapes.AddTriangle(128, 173, 167, 173, 167, 181) Shapes.AddTriangle(128, 173, 128, 181, 167, 181) Shapes.AddTriangle(128, 175, 167, 175, 167, 183) Shapes.AddTriangle(128, 175, 128, 183, 167, 183) Shapes.AddTriangle(128, 177, 167, 177, 167, 185) Shapes.AddTriangle(128, 177, 128, 185, 167, 185) Shapes.AddTriangle(128, 179, 167, 179, 167, 187) Shapes.AddTriangle(128, 179, 128, 187, 167, 187) Shapes.AddTriangle(128, 181, 167, 181, 167, 189) Shapes.AddTriangle(128, 181, 128, 189, 167, 189) Shapes.AddTriangle(128, 183, 167, 183, 167, 191) Shapes.AddTriangle(128, 183, 128, 191, 167, 191) Shapes.AddTriangle(128, 185, 167, 185, 167, 193) Shapes.AddTriangle(128, 185, 128, 193, 167, 193) Shapes.AddTriangle(128, 187, 167, 187, 167, 195) Shapes.AddTriangle(128, 187, 128, 195, 167, 195) Shapes.AddTriangle(128, 189, 167, 189, 167, 197) Shapes.AddTriangle(128, 189, 128, 197, 167, 197) Shapes.AddTriangle(120, 190, 175, 190, 175, 205) Shapes.AddTriangle(120, 190, 120, 205, 175, 205) Shapes.AddTriangle(120, 193, 175, 193, 175, 208) Shapes.AddTriangle(120, 193, 120, 208, 175, 208) Shapes.AddTriangle(120, 194, 175, 194, 175, 209) Shapes.AddTriangle(120, 194, 120, 209, 175, 209) Shapes.AddTriangle(120, 195, 175, 195, 175, 210) Shapes.AddTriangle(120, 195, 120, 210, 175, 210) Shapes.AddTriangle(120, 196, 175, 196, 175, 211) Shapes.AddTriangle(120, 196, 120, 211, 175, 211) Shapes.AddTriangle(120, 197, 175, 197, 175, 212) Shapes.AddTriangle(120, 197, 120, 212, 175, 212) Shapes.AddTriangle(120, 198, 175, 198, 175, 213) Shapes.AddTriangle(120, 198, 120, 213, 175, 213) Shapes.AddTriangle(120, 199, 175, 199, 175, 214) Shapes.AddTriangle(120, 199, 120, 214, 175, 214) Shapes.AddTriangle(120, 200, 175, 200, 175, 215) Shapes.AddTriangle(120, 200, 120, 215, 175, 215) Shapes.AddTriangle(120, 201, 175, 201, 175, 216) Shapes.AddTriangle(120, 201, 120, 216, 175, 216) Shapes.AddTriangle(120, 202, 175, 202, 175, 217) Shapes.AddTriangle(120, 202, 120, 217, 175, 217) Shapes.AddTriangle(120, 205, 175, 205, 175, 220) Shapes.AddTriangle(120, 205, 120, 220, 175, 220) 'GraphicsWindow.DrawEllipse(240, 160, 50, 50) 'GraphicsWindow.DrawEllipse(245, 160, 40, 50) 'GraphicsWindow.DrawEllipse(249, 160, 40, 50) 'GraphicsWindow.DrawEllipse(252, 160, 40, 50) 'GraphicsWindow.DrawEllipse(255, 160, 40, 50) 'GraphicsWindow.DrawEllipse(258, 160, 40, 50) 'GraphicsWindow.DrawEllipse(260, 160, 40, 50) Shapes.AddTriangle(260, 170, 270, 173, 255, 180) Shapes.AddTriangle(250, 170, 245, 160, 240, 185) Shapes.AddTriangle(270, 173, 318, 170, 260, 200) Shapes.AddTriangle(220, 200, 280, 178, 260, 220) Shapes.AddTriangle(240, 195, 245, 195, 245, 205) Shapes.AddTriangle(240, 195, 240, 205, 245, 205) Shapes.AddTriangle(240, 195, 250, 190, 280, 178) Shapes.AddTriangle(220, 200, 238, 195, 245, 190) Shapes.AddTriangle(270, 180, 335, 180, 335, 220) Shapes.AddTriangle(270, 180, 270, 220, 335, 220) Shapes.AddTriangle(270, 176, 315, 176, 315, 206) Shapes.AddTriangle(270, 176, 270, 206, 315, 206) Shapes.AddTriangle(280, 180, 325, 180, 325, 220) Shapes.AddTriangle(280, 180, 280, 220, 325, 220) Shapes.AddTriangle(310, 175, 360, 175, 360, 210) Shapes.AddTriangle(310, 175, 310, 210, 360, 210) Shapes.AddTriangle(310, 175, 350, 175, 350, 215) Shapes.AddTriangle(310, 175, 310, 215, 350, 215) Shapes.AddTriangle(290, 170, 335, 170, 335, 210) Shapes.AddTriangle(290, 170, 290, 210, 335, 210) Shapes.AddTriangle(310, 160, 355, 160, 355, 200) Shapes.AddTriangle(310, 160, 310, 200, 355, 200) Shapes.AddTriangle(200, 200, 250, 200, 250, 245) Shapes.AddTriangle(200, 200, 200, 245, 250, 245) Shapes.AddTriangle(220, 215, 270, 215, 270, 260) Shapes.AddTriangle(220, 215, 220, 260, 270, 260) Shapes.AddTriangle(240, 215, 290, 215, 290, 260) Shapes.AddTriangle(240, 215, 240, 260, 290, 260) Shapes.AddTriangle(250, 195, 290, 195, 290, 230) Shapes.AddTriangle(250, 195, 250, 230, 290, 230) Shapes.AddTriangle(260, 205, 300, 205, 300, 240) Shapes.AddTriangle(260, 205, 260, 240, 300, 240) Shapes.AddTriangle(270, 205, 310, 205, 310, 240) Shapes.AddTriangle(270, 205, 270, 240, 310, 240) Shapes.AddTriangle(285, 195, 325, 195, 325, 230) Shapes.AddTriangle(285, 195, 285, 230, 325, 230) Shapes.AddTriangle(300, 190, 340, 190, 340, 225) Shapes.AddTriangle(300, 190, 300, 225, 340, 225) Shapes.AddTriangle(315, 195, 345, 195, 345, 225) Shapes.AddTriangle(315, 195, 315, 225, 345, 225) Shapes.AddTriangle(180, 215, 230, 215, 230, 260) Shapes.AddTriangle(180, 215, 180, 260, 230, 260) Shapes.AddTriangle(170, 225, 210, 225, 210, 260) Shapes.AddTriangle(170, 225, 170, 260, 210, 260) Shapes.AddTriangle(160, 210, 200, 210, 200, 245) Shapes.AddTriangle(160, 210, 160, 245, 200, 245) Shapes.AddTriangle(175, 200, 215, 200, 215, 235) Shapes.AddTriangle(175, 200, 175, 235, 215, 235) Shapes.AddTriangle(160, 190, 200, 190, 200, 225) Shapes.AddTriangle(160, 190, 160, 225, 200, 225) Shapes.AddTriangle(170, 180, 210, 180, 210, 215) Shapes.AddTriangle(170, 180, 170, 215, 210, 215) Shapes.AddTriangle(160, 160, 200, 160, 200, 195) Shapes.AddTriangle(160, 160, 160, 195, 200, 195) Shapes.AddTriangle(160, 190, 190, 190, 190, 215) Shapes.AddTriangle(160, 190, 160, 215, 190, 215) Shapes.AddTriangle(170, 255, 210, 255, 210, 290) Shapes.AddTriangle(170, 255, 170, 290, 210, 290) Shapes.AddTriangle(160, 265, 200, 265, 200, 300) Shapes.AddTriangle(160, 265, 160, 300, 200, 300) Shapes.AddTriangle(170, 285, 210, 285, 210, 320) Shapes.AddTriangle(170, 285, 170, 320, 210, 320) Shapes.AddTriangle(150, 285, 190, 285, 190, 320) Shapes.AddTriangle(150, 285, 150, 320, 190, 320) Shapes.AddTriangle(145, 235, 180, 235, 180, 265) Shapes.AddTriangle(145, 235, 145, 265, 180, 265) Shapes.AddTriangle(130, 245, 175, 245, 175, 285) Shapes.AddTriangle(130, 245, 130, 285, 175, 285) Shapes.AddTriangle(120, 265, 165, 265, 165, 305) Shapes.AddTriangle(120, 265, 120, 305, 165, 305) Shapes.AddTriangle(120, 285, 165, 285, 165, 325) Shapes.AddTriangle(120, 285, 120, 325, 165, 325) Shapes.AddTriangle(100, 265, 145, 265, 145, 305) Shapes.AddTriangle(100, 265, 100, 305, 145, 305) Shapes.AddTriangle(90, 280, 135, 280, 135, 320) Shapes.AddTriangle(90, 280, 90, 320, 135, 320) Shapes.AddTriangle(115, 210, 165, 210, 165, 250) Shapes.AddTriangle(115, 210, 115, 250, 165, 250) Shapes.AddTriangle(140, 230, 180, 230, 180, 260) Shapes.AddTriangle(140, 230, 140, 260, 180, 260) Shapes.AddTriangle(100, 220, 150, 220, 150, 260) Shapes.AddTriangle(100, 220, 100, 260, 150, 260) Shapes.AddTriangle(120, 240, 160, 240, 160, 275) Shapes.AddTriangle(120, 240, 120, 275, 160, 275) Shapes.AddTriangle(100, 240, 140, 240, 140, 270) Shapes.AddTriangle(100, 240, 100, 270, 140, 270) Shapes.AddTriangle(240, 155, 292, 155, 292, 165) Shapes.AddTriangle(240, 155, 318, 163, 318, 170) Shapes.AddTriangle(240, 155, 220, 165, 280, 163) Shapes.AddTriangle(220, 165, 280, 162.6, 270, 173) Shapes.AddTriangle(280, 162.6, 270, 173, 318, 170) Shapes.AddTriangle(240, 155, 220, 165, 215, 160) Shapes.AddTriangle(237, 138, 240, 138, 240, 155) Shapes.AddTriangle(237, 138, 237, 155, 240, 155) Shapes.AddTriangle(215, 145, 218, 145, 218, 160) Shapes.AddTriangle(215, 145, 215, 160, 218, 160) Shapes.AddTriangle(215, 145, 237, 138, 237, 140) Shapes.AddTriangle(215, 145, 215, 150, 237, 140) Shapes.AddTriangle(250, 140, 253, 140, 253, 157) Shapes.AddTriangle(250, 140, 250, 157, 253, 157) Shapes.AddTriangle(280, 144, 282, 144, 282, 159) Shapes.AddTriangle(280, 144, 280, 159, 282, 159) Shapes.AddTriangle(294, 146, 297, 146, 297, 161) Shapes.AddTriangle(294, 146, 294, 161, 297, 161) Shapes.AddTriangle(265, 142, 268, 142, 268, 157) Shapes.AddTriangle(265, 142, 265, 157, 268, 157) Shapes.AddTriangle(237, 138, 237, 142, 300, 146) Shapes.AddTriangle(302, 162, 336, 125, 298, 128) Shapes.AddTriangle(300, 162, 322, 162, 336, 125) Shapes.AddTriangle(310, 140, 335, 140, 335, 165) Shapes.AddTriangle(310, 140, 310, 165, 335, 165) Shapes.AddTriangle(315, 130, 335, 130, 335, 150) Shapes.AddTriangle(315, 130, 315, 150, 335, 150) Shapes.AddTriangle(315, 140, 345, 140, 345, 160) Shapes.AddTriangle(315, 140, 315, 160, 345, 160) Shapes.AddTriangle(310, 155, 350, 155, 350, 185) Shapes.AddTriangle(310, 155, 310, 185, 350, 185) Shapes.AddTriangle(320, 145, 345, 145, 345, 165) Shapes.AddTriangle(320, 145, 320, 165, 345, 165) Shapes.AddTriangle(310, 160, 340, 160, 340, 190) Shapes.AddTriangle(310, 160, 310, 190, 340, 190) Shapes.AddTriangle(362, 160, 387, 160, 387, 170) Shapes.AddTriangle(362, 160, 362, 170, 387, 170) Shapes.AddTriangle(380, 160, 390, 160, 390, 170) Shapes.AddTriangle(380, 160, 380, 170, 390, 170) Shapes.AddTriangle(420, 160, 430, 160, 430, 170) Shapes.AddTriangle(420, 160, 420, 170, 430, 170) Shapes.AddTriangle(427, 163, 432, 163, 432, 171) Shapes.AddTriangle(427, 163, 427, 171, 432, 171) Shapes.AddTriangle(507, 202, 527, 202, 527, 252) Shapes.AddTriangle(507, 202, 507, 252, 527, 252) Shapes.AddTriangle(507, 192, 560, 215, 507, 201) Shapes.AddTriangle(507, 192, 560, 208, 560, 215) Shapes.AddTriangle(350, 120, 400, 120, 400, 160) Shapes.AddTriangle(350, 120, 350, 160, 400, 160) Shapes.AddTriangle(358, 120, 398, 120, 398, 158) Shapes.AddTriangle(358, 120, 358, 158, 398, 158) Shapes.AddTriangle(362, 124, 396, 124, 396, 154) Shapes.AddTriangle(362, 124, 362, 154, 396, 154) Shapes.AddTriangle(425, 120, 475, 120, 475, 160) Shapes.AddTriangle(425, 120, 425, 160, 475, 160) Shapes.AddTriangle(434, 118, 474, 118, 474, 156) Shapes.AddTriangle(434, 118, 434, 156, 474, 156) Shapes.AddTriangle(440, 122, 472, 122, 472, 152) Shapes.AddTriangle(440, 122, 440, 152, 472, 152) Shapes.AddTriangle(380, 200, 400, 194, 380, 235) Shapes.AddTriangle(380, 200, 400, 194, 380, 235) Shapes.AddTriangle(400, 199, 420, 193, 400, 230) Shapes.AddTriangle(420, 199, 440, 193, 420, 224) Shapes.AddTriangle(470, 215, 490, 215, 490, 250) Shapes.AddTriangle(470, 215, 470, 250, 490, 250) Shapes.AddTriangle(490, 230, 520, 230, 520, 250) Shapes.AddTriangle(490, 230, 490, 250, 520, 250) Shapes.AddTriangle(507, 237, 515, 237, 515, 250) Shapes.AddTriangle(507, 237, 507, 250, 515, 250) Shapes.AddTriangle(496, 232, 502, 232, 502, 242) Shapes.AddTriangle(496, 232, 496, 242, 502, 242) Shapes.AddTriangle(470, 215, 505, 215, 490, 230) Shapes.AddTriangle(505, 215, 520, 230, 490, 230) Shapes.AddTriangle(490, 215, 505, 215, 505, 230) Shapes.AddTriangle(490, 215, 490, 230, 505, 230) Shapes.AddTriangle(475, 250, 515, 250, 475, 265) Shapes.AddTriangle(482, 260, 547, 260, 547, 285) Shapes.AddTriangle(482, 260, 482, 285, 547, 285) Shapes.AddTriangle(470, 280, 535, 280, 535, 305) Shapes.AddTriangle(470, 280, 470, 305, 535, 305) Shapes.AddTriangle(480, 285, 520, 285, 520, 300) Shapes.AddTriangle(480, 285, 480, 300, 520, 300) Shapes.AddTriangle(495, 265, 530, 265, 530, 280) Shapes.AddTriangle(495, 265, 495, 280, 530, 280) Shapes.AddTriangle(470, 278, 550, 278, 550, 285) Shapes.AddTriangle(470, 278, 470, 285, 550, 285) Shapes.AddTriangle(365, 215, 390, 215, 390, 280) Shapes.AddTriangle(365, 215, 365, 280, 390, 280) Shapes.AddTriangle(390, 280, 365, 280, 365, 295) Shapes.AddTriangle(365, 295, 365, 290, 390, 275) Shapes.AddTriangle(390, 275, 390, 280, 365, 295) Shapes.AddTriangle(410, 280, 420, 280, 380, 320) Shapes.AddTriangle(420, 280, 380, 320, 390, 320) Shapes.AddTriangle(420, 280, 390, 320, 435, 280) Shapes.AddTriangle(435, 280, 390, 320, 405, 330) Shapes.AddTriangle(435, 280, 440, 280, 405, 330) Shapes.AddTriangle(440, 280, 405, 330, 410, 330) Shapes.AddTriangle(455, 280, 440, 280, 430, 300) Shapes.AddTriangle(430, 300, 455, 280, 410, 330) Shapes.AddTriangle(455, 280, 410, 330, 425, 330) Shapes.AddTriangle(425, 330, 455, 280, 460, 280) Shapes.AddTriangle(460, 280, 425, 330, 430, 330) Shapes.AddTriangle(460, 280, 470, 280, 452, 295) Shapes.AddTriangle(430, 330, 452, 295, 470, 280) Shapes.AddTriangle(470, 280, 430, 330, 440, 330) Shapes.AddTriangle(470, 280, 478, 280, 440, 330) Shapes.AddTriangle(478, 280, 440, 330, 450, 330) Shapes.AddTriangle(478, 280, 483, 280, 450, 330) Shapes.AddTriangle(390, 280, 410, 280, 370, 310) Shapes.AddTriangle(390, 280, 365, 296, 370, 310) Shapes.AddTriangle(410, 280, 370, 310, 380, 320) Shapes.AddTriangle(390, 215, 460, 215, 460, 245) Shapes.AddTriangle(390, 215, 390, 245, 460, 245) Shapes.AddTriangle(365, 215, 390, 215, 390, 245) Shapes.AddTriangle(460, 215, 495, 245, 460, 245) Shapes.AddTriangle(405, 215, 415, 215, 415, 230) Shapes.AddTriangle(405, 215, 405, 230, 415, 230) Shapes.AddTriangle(445, 215, 455, 215, 455, 230) Shapes.AddTriangle(445, 215, 445, 230, 455, 230) Shapes.AddTriangle(390, 215, 408, 230, 408, 215) Shapes.AddTriangle(430, 215, 450, 230, 450, 215) Shapes.AddTriangle(405, 217, 413, 217, 413, 230) Shapes.AddTriangle(405, 217, 405, 230, 413, 230) Shapes.AddTriangle(445, 217, 453, 217, 453, 230) Shapes.AddTriangle(445, 217, 445, 230, 453, 230) Shapes.AddTriangle(385, 215, 410, 210, 400, 220) Shapes.AddTriangle(408, 210, 406, 215, 420, 220) Shapes.AddTriangle(425, 215, 450, 210, 443, 220) Shapes.AddTriangle(448, 215, 448, 210, 460, 220) Shapes.AddTriangle(390, 245, 480, 245, 480, 280) Shapes.AddTriangle(390, 245, 390, 280, 480, 280) Shapes.AddTriangle(390, 245, 395, 245, 395, 280) Shapes.AddTriangle(390, 245, 390, 280, 395, 280) Shapes.AddTriangle(390, 275, 480, 275, 480, 280) Shapes.AddTriangle(390, 275, 390, 280, 480, 280) Shapes.AddTriangle(416, 245, 421, 245, 421, 280) Shapes.AddTriangle(416, 245, 416, 280, 421, 280) Shapes.AddTriangle(456, 245, 461, 245, 461, 280) Shapes.AddTriangle(456, 245, 456, 280, 461, 280) Shapes.AddTriangle(480, 245, 485, 245, 485, 280) Shapes.AddTriangle(480, 245, 480, 280, 485, 280) Shapes.AddTriangle(402, 252, 412, 252, 412, 267) Shapes.AddTriangle(402, 252, 402, 267, 412, 267) Shapes.AddTriangle(426, 252, 435, 252, 435, 265) Shapes.AddTriangle(426, 252, 426, 265, 435, 265) Shapes.AddTriangle(443, 252, 452, 252, 452, 265) Shapes.AddTriangle(443, 252, 443, 265, 452, 265) Shapes.AddTriangle(465, 250, 475, 250, 475, 265) Shapes.AddTriangle(465, 250, 465, 265, 475, 265) Shapes.AddTriangle(330, 225, 345, 225, 345, 305) Shapes.AddTriangle(330, 225, 330, 305, 345, 305) Shapes.AddTriangle(345, 255, 373, 255, 373, 305) Shapes.AddTriangle(345, 255, 345, 305, 373, 305) Shapes.AddTriangle(330, 225, 362, 225, 375, 255) Shapes.AddTriangle(377, 255, 331, 225, 345, 255) Shapes.AddLine(330, 225, 345, 255) Shapes.AddLine(338, 225, 353, 255) Shapes.AddLine(346, 225, 361, 255) Shapes.AddLine(354, 225, 369, 255) Shapes.AddLine(362, 225, 377, 255) Shapes.AddTriangle(345, 255, 373, 255, 373, 260) Shapes.AddTriangle(353, 265, 365, 265, 365, 295) Shapes.AddTriangle(353, 265, 353, 295, 365, 295) Shapes.AddLine(359, 265, 359, 295) Shapes.AddLine(359, 275, 366, 275) Shapes.AddTriangle(30, 320, 60, 260, 90, 320) Shapes.AddTriangle(60, 260, 90, 320, 100, 315) Shapes.AddTriangle(30, 310, 100, 310, 100, 330) Shapes.AddTriangle(30, 310, 30, 330, 100, 330) 'GraphicsWindow.DrawEllipse(30, 310, 70, 20) Shapes.AddTriangle(32, 312, 100, 312, 100, 330) Shapes.AddTriangle(32, 312, 32, 330, 100, 330) Shapes.AddTriangle(40, 318, 90, 318, 90, 333) Shapes.AddTriangle(40, 318, 40, 333, 90, 333) Shapes.AddTriangle(40, 322, 90, 322, 90, 332) Shapes.AddTriangle(40, 322, 40, 332, 90, 332) Shapes.AddTriangle(40, 322, 90, 322, 90, 332) Shapes.AddTriangle(40, 322, 40, 332, 90, 332) Shapes.AddTriangle(40, 324, 90, 324, 90, 334) Shapes.AddTriangle(40, 324, 40, 334, 90, 334) Shapes.AddTriangle(40, 326, 90, 326, 90, 336) Shapes.AddTriangle(40, 326, 40, 336, 90, 336) Shapes.AddTriangle(40, 328, 90, 328, 90, 338) Shapes.AddTriangle(40, 328, 40, 338, 90, 338) Shapes.AddTriangle(40, 330, 90, 330, 90, 340) Shapes.AddTriangle(40, 330, 40, 340, 90, 340) Shapes.AddTriangle(40, 332, 90, 332, 90, 342) Shapes.AddTriangle(40, 332, 40, 342, 90, 342) Shapes.AddTriangle(40, 334, 90, 334, 90, 344) Shapes.AddTriangle(40, 334, 40, 344, 90, 344) Shapes.AddTriangle(40, 336, 90, 336, 90, 346) Shapes.AddTriangle(40, 336, 40, 346, 90, 346) Shapes.AddTriangle(40, 338, 90, 338, 90, 348) Shapes.AddTriangle(40, 338, 40, 348, 90, 348) Shapes.AddTriangle(40, 340, 90, 340, 90, 350) Shapes.AddTriangle(40, 340, 40, 350, 90, 350) Shapes.AddTriangle(40, 342, 90, 342, 90, 352) Shapes.AddTriangle(40, 342, 40, 352, 90, 352) Shapes.AddTriangle(40, 344, 90, 344, 90, 354) Shapes.AddTriangle(40, 344, 40, 354, 90, 354) Shapes.AddTriangle(40, 346, 90, 346, 90, 356) Shapes.AddTriangle(40, 346, 40, 356, 90, 356) Shapes.AddTriangle(40, 348, 90, 348, 90, 358) Shapes.AddTriangle(40, 348, 40, 358, 90, 358) Shapes.AddTriangle(40, 350, 90, 350, 90, 360) Shapes.AddTriangle(40, 350, 40, 360, 90, 360) Shapes.AddTriangle(40, 352, 90, 352, 90, 362) Shapes.AddTriangle(40, 352, 40, 362, 90, 362) Shapes.AddTriangle(40, 354, 90, 354, 90, 364) Shapes.AddTriangle(40, 354, 40, 364, 90, 364) Shapes.AddTriangle(40, 356, 90, 356, 90, 366) Shapes.AddTriangle(40, 356, 40, 366, 90, 366) Shapes.AddTriangle(40, 358, 90, 358, 90, 368) Shapes.AddTriangle(40, 358, 40, 368, 90, 368) Shapes.AddTriangle(40, 360, 90, 360, 90, 370) Shapes.AddTriangle(40, 360, 40, 370, 90, 370) Shapes.AddTriangle(40, 362, 90, 362, 90, 372) Shapes.AddTriangle(40, 362, 40, 372, 90, 372) Shapes.AddTriangle(40, 364, 90, 364, 90, 374) Shapes.AddTriangle(40, 364, 40, 374, 90, 374) Shapes.AddTriangle(40, 366, 90, 366, 90, 376) Shapes.AddTriangle(40, 366, 40, 376, 90, 376) Shapes.AddTriangle(40, 368, 90, 368, 90, 378) Shapes.AddTriangle(40, 368, 40, 378, 90, 378) Shapes.AddTriangle(40, 370, 90, 370, 90, 380) Shapes.AddTriangle(40, 370, 40, 380, 90, 380) Shapes.AddTriangle(40, 372, 90, 372, 90, 382) Shapes.AddTriangle(40, 372, 40, 382, 90, 382) Shapes.AddTriangle(40, 374, 90, 374, 90, 384) Shapes.AddTriangle(40, 374, 40, 384, 90, 384) Shapes.AddTriangle(40, 376, 90, 376, 90, 386) Shapes.AddTriangle(40, 376, 40, 386, 90, 386) Shapes.AddTriangle(40, 378, 90, 378, 90, 388) Shapes.AddTriangle(40, 378, 40, 388, 90, 388) Shapes.AddTriangle(40, 380, 90, 380, 90, 390) Shapes.AddTriangle(40, 380, 40, 390, 90, 390) 'GraphicsWindow.DrawEllipse(30, 372, 70, 10) Shapes.AddTriangle(32, 374, 102, 374, 102, 384) Shapes.AddTriangle(32, 374, 32, 384, 102, 384) Shapes.AddTriangle(32, 375, 102, 375, 102, 385) Shapes.AddTriangle(32, 375, 32, 385, 102, 385) Shapes.AddTriangle(32, 376, 102, 376, 102, 386) Shapes.AddTriangle(32, 376, 32, 386, 102, 386) Shapes.AddTriangle(32, 377, 102, 377, 102, 387) Shapes.AddTriangle(32, 377, 32, 387, 102, 387) Shapes.AddTriangle(32, 378, 102, 378, 102, 388) Shapes.AddTriangle(32, 378, 32, 388, 102, 388) Shapes.AddTriangle(32, 379, 102, 379, 102, 389) Shapes.AddTriangle(32, 379, 32, 389, 102, 389) Shapes.AddTriangle(32, 380, 102, 380, 102, 390) Shapes.AddTriangle(32, 380, 32, 390, 102, 390) Shapes.AddTriangle(32, 381, 102, 381, 102, 391) Shapes.AddTriangle(32, 381, 32, 391, 102, 391) Shapes.AddTriangle(32, 382, 102, 382, 102, 392) Shapes.AddTriangle(32, 382, 32, 392, 102, 392) Shapes.AddTriangle(32, 383, 102, 383, 102, 393) Shapes.AddTriangle(32, 383, 32, 393, 102, 393) Shapes.AddTriangle(32, 384, 102, 384, 102, 394) Shapes.AddTriangle(32, 384, 32, 394, 102, 394) Shapes.AddTriangle(32, 385, 102, 385, 102, 395) Shapes.AddTriangle(32, 385, 32, 395, 102, 395) Shapes.AddTriangle(40, 390, 90, 390, 90, 400) Shapes.AddTriangle(40, 390, 40, 400, 90, 400) Shapes.AddTriangle(40, 386, 90, 386, 90, 395) Shapes.AddTriangle(40, 386, 40, 395, 90, 395) Shapes.AddTriangle(40, 387, 90, 387, 90, 395) Shapes.AddTriangle(40, 387, 40, 395, 90, 395) Shapes.AddTriangle(40, 388, 90, 388, 90, 395) Shapes.AddTriangle(40, 388, 40, 395, 90, 395) Shapes.AddTriangle(40, 389, 90, 389, 90, 395) Shapes.AddTriangle(40, 389, 40, 395, 90, 395) Shapes.AddTriangle(40, 390, 90, 390, 90, 395) Shapes.AddTriangle(40, 390, 40, 395, 90, 395) Shapes.AddTriangle(40, 391, 90, 391, 90, 395) Shapes.AddTriangle(40, 391, 40, 395, 90, 395) Shapes.AddTriangle(40, 392, 90, 392, 90, 395) Shapes.AddTriangle(40, 392, 40, 395, 90, 395) Shapes.AddTriangle(40, 393, 90, 393, 90, 395) Shapes.AddTriangle(40, 393, 40, 395, 90, 395) Shapes.AddTriangle(40, 394, 90, 394, 90, 395) Shapes.AddTriangle(40, 394, 40, 395, 90, 395) Shapes.AddTriangle(40, 395, 90, 395, 90, 395) Shapes.AddTriangle(40, 395, 40, 395, 90, 395) Shapes.AddTriangle(40, 396, 90, 396, 90, 395) Shapes.AddTriangle(40, 396, 40, 395, 90, 395) Shapes.AddTriangle(40, 397, 90, 397, 90, 395) Shapes.AddTriangle(40, 397, 40, 395, 90, 395) Shapes.AddTriangle(40, 398, 90, 398, 90, 395) Shapes.AddTriangle(40, 398, 40, 395, 90, 395) Shapes.AddTriangle(40, 399, 90, 399, 90, 395) Shapes.AddTriangle(40, 399, 40, 395, 90, 395) Shapes.AddTriangle(40, 400, 90, 400, 90, 395) Shapes.AddTriangle(40, 400, 40, 395, 90, 395) Shapes.AddTriangle(40, 401, 90, 401, 90, 395) Shapes.AddTriangle(40, 401, 40, 395, 90, 395) Shapes.AddTriangle(40, 402, 90, 402, 90, 395) Shapes.AddTriangle(40, 402, 40, 395, 90, 395) Shapes.AddTriangle(40, 403, 90, 403, 90, 395) Shapes.AddTriangle(40, 403, 40, 395, 90, 395) Shapes.AddTriangle(40, 404, 90, 404, 90, 395) Shapes.AddTriangle(40, 404, 40, 395, 90, 395) Shapes.AddTriangle(40, 405, 90, 405, 90, 395) Shapes.AddTriangle(40, 405, 40, 395, 90, 395) Shapes.AddTriangle(90, 335, 200, 335, 200, 375) Shapes.AddTriangle(90, 335, 90, 375, 200, 375) Shapes.AddTriangle(90, 340, 200, 335, 200, 345) Shapes.AddTriangle(90, 340, 120, 340, 90, 375) Shapes.AddTriangle(144, 310, 224, 310, 224, 335) Shapes.AddTriangle(144, 310, 144, 335, 224, 335) Shapes.AddTriangle(144, 330, 110, 340, 210, 335) Shapes.AddTriangle(110, 340, 144, 330, 145, 310) Shapes.AddTriangle(110, 340, 145, 310, 100, 315) Shapes.AddTriangle(101, 315, 110, 340, 76, 345) Shapes.AddTriangle(150, 348, 169, 348, 169, 376) Shapes.AddTriangle(150, 348, 150, 376, 169, 376) Shapes.AddTriangle(150, 365, 165, 365, 165, 375) Shapes.AddTriangle(150, 365, 150, 375, 165, 375) Shapes.AddTriangle(115, 345, 125, 345, 125, 360) Shapes.AddTriangle(115, 345, 115, 360, 125, 360) Shapes.AddTriangle(155, 350, 168, 350, 168, 375) Shapes.AddTriangle(155, 350, 155, 375, 168, 375) Shapes.AddTriangle(155, 360, 168, 360, 168, 375) Shapes.AddTriangle(155, 360, 155, 375, 168, 375) Shapes.AddTriangle(119, 346, 129, 346, 129, 356) Shapes.AddTriangle(119, 346, 119, 356, 129, 356) Shapes.AddTriangle(119, 349, 129, 349, 129, 359) Shapes.AddTriangle(119, 349, 119, 359, 129, 359) Shapes.AddTriangle(119, 359, 129, 359, 119, 360) Shapes.AddTriangle(85, 408, 75, 412, 85, 448) Shapes.AddTriangle(85, 448, 75, 452, 75, 412) Shapes.AddTriangle(85, 408, 130, 408, 130, 448) Shapes.AddTriangle(85, 408, 85, 448, 130, 448) Shapes.AddTriangle(85, 408, 130, 408, 130, 402) Shapes.AddTriangle(130, 373, 200, 373, 200, 448) Shapes.AddTriangle(130, 373, 130, 448, 200, 448) Shapes.AddTriangle(200, 358, 200, 373, 130, 373) Shapes.AddTriangle(200, 358, 250, 358, 250, 448) Shapes.AddTriangle(200, 358, 200, 448, 250, 448) Shapes.AddTriangle(85, 448, 75, 452, 80, 460) Shapes.AddTriangle(80, 460, 85, 448, 130, 448) Shapes.AddTriangle(105, 415, 123, 415, 123, 435) Shapes.AddTriangle(105, 415, 105, 435, 123, 435) Shapes.AddTriangle(105, 426, 123, 426, 123, 436) Shapes.AddTriangle(105, 426, 105, 436, 123, 436) Shapes.AddTriangle(160, 395, 190, 395, 190, 440) Shapes.AddTriangle(160, 395, 160, 440, 190, 440) Shapes.AddTriangle(160, 395, 190, 395, 190, 385) Shapes.AddTriangle(190, 430, 160, 440, 190, 440) Shapes.AddTriangle(145, 395, 160, 395, 160, 440) Shapes.AddTriangle(145, 395, 145, 440, 160, 440) Shapes.AddTriangle(190, 385, 195, 375, 190, 430) Shapes.AddTriangle(195, 375, 190, 430, 195, 420) Shapes.AddTriangle(130, 448, 200, 448, 130, 458) Shapes.AddTriangle(90, 376, 90, 390, 60, 400) Shapes.AddTriangle(60, 400, 90, 376, 60, 386) Shapes.AddTriangle(90, 376, 130, 376, 130, 403) Shapes.AddTriangle(90, 376, 90, 403, 130, 403) Shapes.AddTriangle(85, 408, 130, 402, 90, 390) Shapes.AddTriangle(85, 408, 90, 390, 60, 400) Shapes.AddTriangle(210, 280, 310, 280, 310, 340) Shapes.AddTriangle(210, 280, 210, 340, 310, 340) Shapes.AddTriangle(295, 280, 305, 280, 305, 310) Shapes.AddTriangle(295, 280, 295, 310, 305, 310) Shapes.AddTriangle(247.5, 280, 257.5, 280, 257.5, 325) Shapes.AddTriangle(247.5, 280, 247.5, 325, 257.5, 325) Shapes.AddTriangle(302, 280, 305, 280, 305, 310) Shapes.AddTriangle(302, 280, 302, 310, 305, 310) Shapes.AddTriangle(254.5, 280, 257.5, 280, 257.5, 325) Shapes.AddTriangle(254.5, 280, 254.5, 325, 257.5, 325) Shapes.AddTriangle(330, 220, 220, 260, 305, 280) Shapes.AddTriangle(220, 260, 305, 280, 190, 300) Shapes.AddTriangle(330, 220, 330, 240, 305, 280) Shapes.AddTriangle(330, 240, 305, 280, 330, 250) Shapes.AddTriangle(305, 280, 330, 250, 330, 280) Shapes.AddTriangle(305, 280, 330, 280, 330, 340) Shapes.AddTriangle(305, 280, 305, 340, 330, 340) Shapes.AddTriangle(280, 310, 305, 310, 305, 340) Shapes.AddTriangle(280, 310, 280, 340, 305, 340) Shapes.AddTriangle(225, 230, 232, 236, 210, 255) Shapes.AddTriangle(210, 290, 247.5, 290, 247.5, 340) Shapes.AddTriangle(210, 290, 210, 340, 247.5, 340) Shapes.AddTriangle(251.5, 280, 247.5, 290, 190, 295) Shapes.AddTriangle(220, 235, 245, 235, 245, 265) Shapes.AddTriangle(220, 235, 220, 265, 245, 265) Shapes.AddTriangle(220, 245, 244, 245, 244, 265) Shapes.AddTriangle(220, 245, 220, 265, 244, 265) Shapes.AddTriangle(220, 265, 244, 265, 220, 270) Shapes.AddTriangle(225, 245, 240, 245, 240, 255) Shapes.AddTriangle(225, 245, 225, 255, 240, 255) Shapes.AddTriangle(225, 250, 239, 250, 239, 265) Shapes.AddTriangle(225, 250, 225, 265, 239, 265) Shapes.AddTriangle(225, 265, 239, 265, 225, 270) Shapes.AddTriangle(243, 245, 265, 245, 243, 265) Shapes.AddTriangle(265, 245, 245, 250, 225, 230) Shapes.AddTriangle(230, 245, 240, 245, 240, 265) Shapes.AddTriangle(230, 245, 230, 265, 240, 265) Shapes.AddTriangle(230, 253, 240, 253, 240, 265) Shapes.AddTriangle(230, 253, 230, 265, 240, 265) Shapes.AddTriangle(230, 265, 240, 265, 230, 268) Shapes.AddTriangle(200, 262, 244, 262, 244, 265) Shapes.AddTriangle(200, 262, 200, 265, 244, 265) Shapes.AddTriangle(207, 262, 210, 262, 210, 265) Shapes.AddTriangle(207, 262, 207, 265, 210, 265) Shapes.AddTriangle(224, 262, 227, 262, 227, 265) Shapes.AddTriangle(224, 262, 224, 265, 227, 265) Shapes.AddTriangle(210, 280, 207, 268, 205, 285) Shapes.AddTriangle(205, 285, 207, 268, 190, 270) Shapes.AddTriangle(207, 268, 224, 268, 210, 280) Shapes.AddTriangle(212, 300, 224, 300, 224, 325) Shapes.AddTriangle(212, 300, 212, 325, 224, 325) Shapes.AddTriangle(230, 295, 242, 295, 242, 320) Shapes.AddTriangle(230, 295, 230, 320, 242, 320) Shapes.AddTriangle(278, 293, 288, 293, 288, 310) Shapes.AddTriangle(278, 293, 278, 310, 288, 310) Shapes.AddTriangle(278, 293, 288, 293, 288, 291) Shapes.AddTriangle(216, 300, 228, 300, 228, 325) Shapes.AddTriangle(216, 300, 216, 325, 228, 325) Shapes.AddTriangle(234, 295, 246, 295, 246, 320) Shapes.AddTriangle(234, 295, 234, 320, 246, 320) Shapes.AddTriangle(263, 293, 271, 293, 271, 301) Shapes.AddTriangle(263, 293, 263, 301, 271, 301) Shapes.AddTriangle(271, 301, 263, 301, 263, 302) Shapes.AddTriangle(263, 293, 271, 293, 271, 291) Shapes.AddTriangle(315, 270, 330, 270, 330, 305) Shapes.AddTriangle(315, 270, 315, 305, 330, 305) Shapes.AddTriangle(280, 310, 280, 340, 195, 325) Shapes.AddTriangle(195, 325, 280, 340, 195, 355) Shapes.AddTriangle(280, 340, 330, 340, 330, 370) Shapes.AddTriangle(195, 355, 280, 340, 330, 370) Shapes.AddTriangle(237.5, 355, 275, 395, 295, 365) Shapes.AddTriangle(330, 370, 310, 385, 270, 350) Shapes.AddTriangle(237.5, 355, 222.5, 358, 275, 395) Shapes.AddTriangle(222.5, 358, 275, 395, 265, 395) Shapes.AddTriangle(270, 350, 310, 385, 300, 385) Shapes.AddTriangle(300, 385, 270, 350, 255, 353) Shapes.AddTriangle(420, 390, 460, 365, 430, 340) Shapes.AddTriangle(430, 340, 460, 365, 470, 340) Shapes.AddTriangle(470, 340, 460, 365, 510, 370) Shapes.AddTriangle(470, 340, 430, 340, 490, 320) Shapes.AddTriangle(470, 340, 490, 320, 510, 370) Shapes.AddTriangle(510, 370, 490, 320, 570, 350) Shapes.AddTriangle(570, 350, 625, 410, 595, 340) Shapes.AddTriangle(595, 340, 490, 320, 555, 300) Shapes.AddTriangle(570, 350, 595, 340, 490, 320) Shapes.AddTriangle(445, 335, 555, 300, 478, 300) Shapes.AddTriangle(520, 300, 556, 300, 530, 260) Shapes.AddTriangle(556, 300, 530, 260, 560, 270) Shapes.AddTriangle(340, 318, 430, 318, 430, 408) Shapes.AddTriangle(340, 318, 340, 408, 430, 408) Shapes.AddTriangle(340, 320, 420, 320, 420, 410) Shapes.AddTriangle(340, 320, 340, 410, 420, 410) Shapes.AddTriangle(405, 335, 440, 335, 440, 385) Shapes.AddTriangle(405, 335, 405, 385, 440, 385) Shapes.AddTriangle(408, 340, 436, 340, 436, 388) Shapes.AddTriangle(408, 340, 408, 388, 436, 388) Shapes.AddTriangle(360, 345, 420, 345, 420, 405) Shapes.AddTriangle(360, 345, 360, 405, 420, 405) Shapes.AddTriangle(365, 350, 410, 350, 410, 395) Shapes.AddTriangle(365, 350, 365, 395, 410, 395) Shapes.AddTriangle(370, 355, 405, 355, 405, 390) Shapes.AddTriangle(370, 355, 370, 390, 405, 390) Shapes.AddTriangle(381, 366, 393, 366, 393, 378) Shapes.AddTriangle(381, 366, 381, 378, 393, 378) Shapes.AddTriangle(350, 390, 380, 400, 360, 500) Shapes.AddTriangle(380, 400, 400, 530, 360, 500) Shapes.AddTriangle(400, 400, 400, 530, 380, 400) Shapes.AddTriangle(400, 400, 450, 540, 400, 530) Shapes.AddTriangle(400, 400, 450, 540, 480, 530) Shapes.AddTriangle(400, 400, 480, 540, 520, 530) Shapes.AddTriangle(400, 400, 520, 530, 560, 500) Shapes.AddTriangle(400, 400, 420, 390, 560, 500) Shapes.AddTriangle(420, 390, 565, 505, 585, 475) Shapes.AddTriangle(420, 390, 585, 475, 590, 450) Shapes.AddTriangle(420, 390, 600, 455, 625, 410) Shapes.AddTriangle(420, 390, 625, 410, 540, 415) Shapes.AddTriangle(625, 410, 540, 405, 570, 350) Shapes.AddTriangle(540, 405, 570, 350, 500, 360) Shapes.AddTriangle(500, 360, 540, 405, 520, 400) Shapes.AddTriangle(520, 400, 500, 360, 460, 365) Shapes.AddTriangle(460, 365, 520, 400, 500, 398) Shapes.AddTriangle(500, 398, 475, 395, 460, 365) Shapes.AddTriangle(460, 365, 475, 395, 420, 390) Shapes.AddTriangle(320, 295, 380, 295, 380, 345) Shapes.AddTriangle(320, 295, 320, 345, 380, 345) Shapes.AddTriangle(310, 285, 360, 285, 360, 325) Shapes.AddTriangle(310, 285, 310, 325, 360, 325) Shapes.AddTriangle(320, 305, 365, 305, 365, 335) Shapes.AddTriangle(320, 305, 320, 335, 365, 335) Shapes.AddTriangle(320, 280, 350, 280, 350, 300) Shapes.AddTriangle(320, 280, 320, 300, 350, 300) Shapes.AddTriangle(330, 288, 350, 288, 350, 303) Shapes.AddTriangle(330, 288, 330, 303, 350, 303) Shapes.AddTriangle(300, 320, 350, 320, 350, 360) Shapes.AddTriangle(300, 320, 300, 360, 350, 360) Shapes.AddTriangle(300, 310, 340, 310, 340, 340) Shapes.AddTriangle(300, 310, 300, 340, 340, 340) Shapes.AddTriangle(315, 335, 355, 335, 355, 365) Shapes.AddTriangle(315, 335, 315, 365, 355, 365) Shapes.AddTriangle(250, 370, 300, 370, 300, 410) Shapes.AddTriangle(250, 370, 250, 410, 300, 410) Shapes.AddTriangle(270, 360, 320, 360, 320, 400) Shapes.AddTriangle(270, 360, 270, 400, 320, 400) Shapes.AddTriangle(290, 340, 340, 340, 340, 380) Shapes.AddTriangle(290, 340, 290, 380, 340, 380) Shapes.AddTriangle(280, 350, 320, 350, 320, 375) Shapes.AddTriangle(280, 350, 280, 375, 320, 375) Shapes.AddTriangle(310, 360, 360, 360, 360, 400) Shapes.AddTriangle(310, 360, 310, 400, 360, 400) Shapes.AddTriangle(300, 360, 350, 360, 350, 400) Shapes.AddTriangle(300, 360, 300, 400, 350, 400) Shapes.AddTriangle(280, 380, 330, 380, 330, 390) Shapes.AddTriangle(280, 380, 280, 390, 330, 390) Shapes.AddTriangle(100, 358, 120, 358, 120, 378) Shapes.AddTriangle(100, 358, 100, 378, 120, 378) Shapes.AddTriangle(80, 360, 105, 360, 105, 385) Shapes.AddTriangle(80, 360, 80, 385, 105, 385) Shapes.AddTriangle(65, 365, 90, 365, 90, 385) Shapes.AddTriangle(65, 365, 65, 385, 90, 385) Shapes.AddTriangle(80, 350, 105, 350, 105, 375) Shapes.AddTriangle(80, 350, 80, 375, 105, 375) Shapes.AddTriangle(75, 350, 95, 350, 95, 375) Shapes.AddTriangle(75, 350, 75, 375, 95, 375) Shapes.AddLine(355, 330, 345, 430) Shapes.AddLine(358, 330, 348, 430) Shapes.AddTriangle(355, 330, 346, 410, 320, 360) Shapes.AddTriangle(280, 360, 320, 360, 300, 415) Shapes.AddTriangle(320, 360, 300, 415, 320, 400) Shapes.AddTriangle(320, 360, 346, 410, 320, 400) Shapes.AddLine(305, 440, 280, 360) Shapes.AddLine(308, 440, 283, 360) Shapes.AddTriangle(278, 360, 245, 380, 295, 415) Shapes.AddTriangle(245, 380, 250, 430, 200, 380) Shapes.AddTriangle(245, 380, 250, 430, 265, 410) Shapes.AddTriangle(245, 380, 295, 415, 265, 410) Shapes.AddLine(250, 430, 200, 380) Shapes.AddLine(253, 430, 203, 380) Shapes.AddTriangle(200, 380, 250, 430, 180, 415) Shapes.AddTriangle(180, 415, 230, 460, 130, 430) Shapes.AddTriangle(230, 460, 180, 415, 220, 435) Shapes.AddTriangle(220, 435, 180, 415, 250, 430) Shapes.AddLine(260, 475, 130, 430) Shapes.AddLine(263, 475, 133, 430) Shapes.AddTriangle(225, 465, 130, 431, 125, 460) Shapes.AddTriangle(125, 460, 170, 492, 90, 488) Shapes.AddTriangle(125, 460, 170, 492, 165, 470) Shapes.AddTriangle(125, 460, 165, 470, 225, 465) Shapes.AddLine(170, 495, 90, 490) Shapes.AddLine(170, 492, 90, 488) Shapes.AddTriangle(120, 285, 165, 285, 165, 325) Shapes.AddTriangle(120, 285, 120, 325, 165, 325) Shapes.AddTriangle(170, 285, 210, 285, 210, 320) Shapes.AddTriangle(170, 285, 170, 320, 210, 320) Shapes.AddTriangle(150, 285, 190, 285, 190, 320) Shapes.AddTriangle(150, 285, 150, 320, 190, 320) End>VSS293.sb< Start>VST735-0.sb< 'http://smallbasic.com/program/?VST735-0 'Drop Down Menu System - (under construction) by Jibba Jabba, January 2014 Initialise() While "True" UpdateProgram() UpdateScreen() FrameRate() EndWhile Sub UpdateProgram start = Clock.ElapsedMilliseconds If mouseMove Then mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY nextMenuFocus = 0 If mseY <= menuHeight And mseX < menuWidth * Array.GetItemCount(menu) Then 'Update Next Menu Focus For i = Array.GetItemCount(menu) To 1 Step -1 left = Shapes.GetLeft(menuFocus[i]) If mseX >= left And mseX <= left + menuWidth Then nextMenuFocus = i EndIf EndFor EndIf If nextMenuFocus <> currentMenuFocus Then 'Change Current Menu Focus previousMenuFocus = currentMenuFocus currentMenuFocus = nextMenuFocus EndIf mouseMove = "False" ElseIf mouseDown Then If currentMenuFocus > 0 Then isMenuSelected = -isMenuSelected EndIf mouseDown = "False" EndIf EndSub Sub UpdateScreen Shapes.SetOpacity(menuFocus[previousMenuFocus], 0) Shapes.SetOpacity(menuFocus[currentMenuFocus], menuFocusOpacity[isMenuSelected]) EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then Program.Delay(delay) Else TextWindow.WriteLine("delay = " + delay) EndIf EndSub Sub Initialise 'DEBUG TextWindow.Top = 20 TextWindow.Left = 20 'Main Loop fps = 50 '*6 drags > 300fps 'MENU 'Data Table menu = "1=View;2=Prog;3=Help" subMenu[1] = "1=Home;2=Game;3=The Leaders Board" subMenu[2] = "1=Debug;2=Close" subMenu[3] = "1=How to Play;2=About Match Picture" 'Get Properties gw = GraphicsWindow.Width gh = GraphicsWindow.Height 'Set Parameters menuHeight = 25 menuWidth = 55 menuTextOffset = 8 currentMenuFocus = 0 isMenuSelected = -1 'toggle init OFF menuFocusOpacity = "1=100;-1=30" 'Add Menu Bar - Sub {redraw for new window size} GraphicsWindow.BrushColor = "Peru" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) 'Add Menu GraphicsWindow.FontName = "Segoe Print" GraphicsWindow.FontSize = 13 GraphicsWindow.PenWidth = 0 For i = Array.GetItemCount(menu) To 1 Step -1 GraphicsWindow.BrushColor = "DeepPink" menuFocus[i] = Shapes.AddRectangle(menuWidth, menuHeight) Shapes.SetOpacity(menuFocus[i], 0) GraphicsWindow.BrushColor = "PaleGreen" menuText[i] = Shapes.AddText(menu[i]) Shapes.Move(menuText[i], menuWidth * (i-1) + menuTextOffset, 0) Shapes.Move(menuFocus[i], menuWidth * (i-1), 0) EndFor 'Register Events GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown EndSub Sub OnMouseMove mouseMove = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub End>VST735-0.sb< Start>VST735-1.sb< 'http://smallbasic.com/program/?VST735-1 'Drop Down Menu System - (under construction) by Jibba Jabba, January 2014 Initialise() While "True" UpdateProgram() UpdateScreen() FrameRate() EndWhile Sub UpdateProgram start = Clock.ElapsedMilliseconds If mouseMove Then mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY 'Update Menu Focus menuFocusedOn = 0 menuOpacityIndex = 0 If mseY <= menuHeight And mseX <= totalMenuWidth Then For i = Array.GetItemCount(menu) To 1 Step -1 If mseX >= menuFocusX[i] And mseX <= menuFocusX[i] + menuWidth[i] Then menuOpacityIndex = isMenuSelected menuFocusZoomX = menuWidth[i] / menuFocusWidth menuFocusedOn = i 'determines which SubMenu[i] to open If isMenuSelected = 1. >>>passes to Update subMenu EndIf 'add If currentFocus <> nextFocus Then to Update subMenu ***WIP note EndFor EndIf mouseMove = "False" ElseIf mouseDown Then 'Update Menu Selected Focus If menuFocusedOn <> 0 Then isMenuSelected = -isMenuSelected '>>>>> passes to Update subMenu menuOpacityIndex = isMenuSelected EndIf mouseDown = "False" EndIf 'TextWindow.WriteLine("menuFocusedOn " + menuFocusedOn) EndSub Sub UpdateScreen Shapes.SetOpacity(menuFocus, menuOpacity[menuOpacityIndex]) Shapes.Zoom(menuFocus, menuFocusZoomX, 1) Shapes.Move(menuFocus, menuFocusX[menuFocusedOn] + (menuWidth[menuFocusedOn] - menuFocusWidth) /2, 0) EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then Program.Delay(delay) Else TextWindow.WriteLine("delay = " + delay) EndIf EndSub Sub Initialise 'DEBUG TextWindow.Top = 20 TextWindow.Left = 20 'Main Loop fps = 50 '*6 drags > 300fps 'MENU 'Data Table menu = "1=View Screen;2=Program;3=Help;4=Test This;5=Add Another Menu" '<<<<<<<<VST735-1.sb< Start>VTC414.sb< ' Spiral Animation ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Last update 2016-06-11 ' size = 400 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.PenWidth = 0 xo = size / 2 yo = size / 2 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "Blue" i = 1 w = 400 While 10 < w rect[i] = Shapes.AddRectangle(w, w) Shapes.Move(rect[i], xo - w / 2, yo - w / 2) Shapes.SetOpacity(rect[i], 20) w = w * 0.9 i = i + 1 EndWhile α = 0 n = Array.GetItemCount(rect) While "True" α = θ w = 1 For i = 1 To n Shapes.Rotate(rect[i], α) w = w * 1.01 α = α + θ * w EndFor θ = θ + 0.2 If 360 < θ Then θ = θ - 360 EndIf Program.Delay(50) EndWhile End>VTC414.sb< Start>VTC612.sb< ///WORKSPACE MANAGEMENT **PROCEDURE DEFINITION >>TO procname :input1 :input2 ... (special form) command. Prepares Logo to accept a procedure definition. The procedure will be named "procname" and there must not already be a procedure by that name. The inputs will be called "input1" etc. Any number of inputs are allowed, including none. Names of procedures and inputs are case-insensitive. Unlike every other Logo procedure, TO takes as its inputs the actual words typed in the instruction line, as if they were all quoted, rather than the results of evaluating expressions to provide the inputs. (That's what "special form" means.) This version of Logo allows variable numbers of inputs to a procedure. After the procedure name come four kinds of things, *in this order*: 1. 0 or more REQUIRED inputs :FOO :FROBOZZ 2. 0 or more OPTIONAL inputs [:BAZ 87] [:THINGO 5+9] 3. 0 or 1 REST input [:GARPLY] 4. 0 or 1 DEFAULT number 5 Every procedure has a MINIMUM, DEFAULT, and MAXIMUM number of inputs. (The latter can be infinite.) The MINIMUM number of inputs is the number of required inputs, which must come first. A required input is indicated by the :inputname notation. After all the required inputs can be zero or more optional inputs, each of which is represented by the following notation: [:inputname default.value.expression] When the procedure is invoked, if actual inputs are not supplied for these optional inputs, the default value expressions are evaluated to set values for the corresponding input names. The inputs are processed from left to right, so a default value expression can be based on earlier inputs. Example: to proc :inlist [:startvalue first :inlist] If the procedure is invoked by saying proc [a b c] then the variable INLIST will have the value [A B C] and the variable STARTVALUE will have the value A. If the procedure is invoked by saying (proc [a b c] "x) then INLIST will have the value [A B C] and STARTVALUE will have the value X. After all the required and optional input can come a single "rest" input, represented by the following notation: [:inputname] This is a rest input rather than an optional input because there is no default value expression. There can be at most one rest input. When the procedure is invoked, the value of this inputname will be a list containing all of the actual inputs provided that were not used for required or optional inputs. Example: to proc :in1 [:in2 "foo] [:in3 "baz] [:in4] If this procedure is invoked by saying proc "x then IN1 has the value X, IN2 has the value FOO, IN3 has the value BAZ, and IN4 has the value [] (the empty list). If it's invoked by saying (proc "a "b "c "d "e) then IN1 has the value A, IN2 has the value B, IN3 has the value C, and IN4 has the value [D E]. The MAXIMUM number of inputs for a procedure is infinite if a rest input is given; otherwise, it is the number of required inputs plus the number of optional inputs. The DEFAULT number of inputs for a procedure, which is the number of inputs that it will accept if its invocation is not enclosed in parentheses, is ordinarily equal to the minimum number. If you want a different default number you can indicate that by putting the desired default number as the last thing on the TO line. example: to proc :in1 [:in2 "foo] [:in3] 3 This procedure has a minimum of one input, a default of three inputs, and an infinite maximum. Logo responds to the TO command by entering procedure definition mode. The prompt character changes from "?" to ">" and whatever instructions you type become part of the definition until you type a line containing only the word END. >>DEFINE procname text command. Defines a procedure with name "procname" and text "text". If there is already a procedure with the same name, the new definition replaces the old one. The text input must be a list whose members are lists. The first member is a list of inputs; it looks like a TO line but without the word TO, without the procedure name, and without the colons before input names. In other words, the members of this first sublist are words for the names of required inputs and lists for the names of optional or rest inputs. The remaining sublists of the text input make up the body of the procedure, with one sublist for each instruction line of the body. (There is no END line in the text input.) It is an error to redefine a primitive procedure unless the variable REDEFP has the value TRUE. >>TEXT procname outputs the text of the procedure named "procname" in the form expected by DEFINE: a list of lists, the first of which describes the inputs to the procedure and the rest of which are the lines of its body. The text does not reflect formatting information used when the procedure was defined, such as continuation lines and extra spaces. >>FULLTEXT procname outputs a representation of the procedure "procname" in which formatting information is preserved. If the procedure was defined with TO, EDIT, or LOAD, then the output is a list of words. Each word represents one entire line of the definition in the form output by READWORD, including extra spaces and continuation lines. The last member of the output represents the END line. If the procedure was defined with DEFINE, then the output is a list of lists. If these lists are printed, one per line, the result will look like a definition using TO. Note: the output from FULLTEXT is not suitable for use as input to DEFINE! >>COPYDEF newname oldname command. Makes "newname" a procedure identical to "oldname". The latter may be a primitive. If "newname" was already defined, its previous definition is lost. If "newname" was already a primitive, the redefinition is not permitted unless the variable REDEFP has the value TRUE. Note: dialects of Logo differ as to the order of inputs to COPYDEF. This dialect uses "MAKE order," not "NAME order." **VARIABLE DEFINITION >>MAKE varname value command. Assigns the value "value" to the variable named "varname", which must be a word. Variable names are case-insensitive. If a variable with the same name already exists, the value of that variable is changed. If not, a new global variable is created. >>NAME value varname (library procedure) command. Same as MAKE but with the inputs in reverse order. >>LOCAL varname LOCAL varnamelist (LOCAL varname1 varname2 ...) command. Accepts as inputs one or more words, or a list of words. A variable is created for each of these words, with that word as its name. The variables are local to the currently running procedure. Logo variables follow dynamic scope rules; a variable that is local to a procedure is available to any subprocedure invoked by that procedure. The variables created by LOCAL have no initial value; they must be assigned a value (e.g., with MAKE) before the procedure attempts to read their value. >>LOCALMAKE varname value (library procedure) command. Makes the named variable local, like LOCAL, and assigns it the given value, like MAKE. >>THING varname :quoted.varname outputs the value of the variable whose name is the input. If there is more than one such variable, the innermost local variable of that name is chosen. The colon notation is an abbreviation not for THING but for the combination thing " so that :FOO means THING "FOO. >>GLOBAL varname GLOBAL varnamelist (GLOBAL varname1 varname2 ...) command. Accepts as inputs one or more words, or a list of words. A global variable is created for each of these words, with that word as its name. The only reason this is necessary is that you might want to use the "setter" notation SETXYZ for a variable XYZ that does not already have a value; GLOBAL "XYZ makes that legal. Note: If there is currently a local variable of the same name, this command does *not* make Logo use the global value instead of the local one. **PROPERTY LISTS >>Note: Names of property lists are always case-insensitive. Names of individual properties are case-sensitive or case-insensitive depending on the value of CASEIGNOREDP, which is TRUE by default. In principle, every possible name is the name of a property list, which is initially empty. So Logo never gives a "no such property list" error, as it would for undefined procedure or variable names. But the primitive procedures that deal with "all" property lists (CONTENTS, PLISTS, etc.) list only nonempty ones. To "erase" a property list (see ERASE below) means to make it empty, removing all properties from it. >>PPROP plistname propname value command. Adds a property to the "plistname" property list with name "propname" and value "value". >>GPROP plistname propname outputs the value of the "propname" property in the "plistname" property list, or the empty list if there is no such property. >>REMPROP plistname propname command. Removes the property named "propname" from the property list named "plistname". >>PLIST plistname outputs a list whose odd-numbered members are the names, and whose even-numbered members are the values, of the properties in the property list named "plistname". The output is a copy of the actual property list; changing properties later will not magically change a list output earlier by PLIST. **PREDICATES >>PROCEDUREP name PROCEDURE? name outputs TRUE if the input is the name of a procedure. >>PRIMITIVEP name PRIMITIVE? name outputs TRUE if the input is the name of a primitive procedure (one built into Logo). Note that some of the procedures described in this document are library procedures, not primitives. >>DEFINEDP name DEFINED? name outputs TRUE if the input is the name of a user-defined procedure, including a library procedure. >>NAMEP name NAME? name outputs TRUE if the input is the name of a variable. >>PLISTP name PLIST? name outputs TRUE if the input is the name of a *nonempty* property list. (In principle every word is the name of a property list; if you haven't put any properties in it, PLIST of that name outputs an empty list, rather than giving an error message.) **QUERIES Note: All procedures whose input is indicated as "contentslist" will accept a single word (taken as a procedure name), a list of words (taken as names of procedures), or a list of three lists as described under the CONTENTS command above. >>CONTENTS outputs a "contents list," i.e., a list of three lists containing names of defined procedures, variables, and property lists respectively. This list includes all unburied named items in the workspace. >>BURIED outputs a contents list including all buried named items in the workspace. >>TRACED outputs a contents list including all traced named items in the workspace. >>STEPPED outputs a contents list including all stepped named items in the workspace. >>PROCEDURES outputs a list of the names of all unburied user-defined procedures in the workspace. Note that this is a list of names, not a contents list. (However, procedures that require a contents list as input will accept this list.) >>PRIMITIVES outputs a list of the names of all primitive procedures in the workspace. Note that this is a list of names, not a contents list. (However, procedures that require a contents list as input will accept this list.) >>NAMES outputs a contents list consisting of an empty list (indicating no procedure names) followed by a list of all unburied variable names in the workspace. >>PLISTS outputs a contents list consisting of two empty lists (indicating no procedures or variables) followed by a list of all unburied nonempty property lists in the workspace. >>NAMELIST varname (library procedure) NAMELIST varnamelist outputs a contents list consisting of an empty list followed by a list of the name or names given as input. This is useful in conjunction with workspace control procedures that require a contents list as input. >>PLLIST plname (library procedure) PLLIST plnamelist outputs a contents list consisting of two empty lists followed by a list of the name or names given as input. This is useful in conjunction with workspace control procedures that require a contents list as input. >>ARITY procedurename outputs a list of three numbers: the minimum, default, and maximum number of inputs for the procedure whose name is the input. It is an error if there is no such procedure. A maximum of -1 means that the number of inputs is unlimited. >>NODES outputs a list of two numbers. The first represents the number of nodes of memory currently in use. The second shows the maximum number of nodes that have been in use at any time since the last invocation of NODES. (A node is a small block of computer memory as used by Logo. Each number uses one node. Each non-numeric word uses one node, plus some non-node memory for the characters in the word. Each array takes one node, plus some non-node memory, as well as the memory required by its elements. Each list requires one node per element, as well as the memory within the elements.) If you want to track the memory use of an algorithm, it is best if you invoke GC at the beginning of each iteration, since otherwise the maximum will include storage that is unused but not yet collected. **INSPECTION >>PRINTOUT/PO contentslist command. Prints to the write stream the definitions of all procedures, variables, and property lists named in the input contents list. >>POALL (library procedure) command. Prints all unburied definitions in the workspace. Abbreviates PO CONTENTS. >>POPS (library procedure) command. Prints the definitions of all unburied procedures in the workspace. Abbreviates PO PROCEDURES. >>PONS (library procedure) command. Prints the definitions of all unburied variables in the workspace. Abbreviates PO NAMES. >>POPLS (library procedure) command. Prints the contents of all unburied nonempty property lists in the workspace. Abbreviates PO PLISTS. >>PON varname (library procedure) PON varnamelist command. Prints the definitions of the named variable(s). Abbreviates PO NAMELIST varname(list). >>POPL plname (library procedure) POPL plnamelist command. Prints the definitions of the named property list(s). Abbreviates PO PLLIST plname(list). >>POT contentslist command. Prints the title lines of the named procedures and the definitions of the named variables and property lists. For property lists, the entire list is shown on one line instead of as a series of PPROP instructions as in PO. >>POTS (library procedure) command. Prints the title lines of all unburied procedures in the workspace. Abbreviates POT PROCEDURES. ///CONTROL STRUCTURES >>Note: in the following descriptions, an "instructionlist" can be a list or a word. In the latter case, the word is parsed into list form before it is run. Thus, RUN READWORD or RUN READLIST will work. The former is slightly preferable because it allows for a continued line (with ~) that includes a comment (with ;) on the first line. A "tf" input must be the word TRUE, the word FALSE, or a list. If it's a list, then it must be a Logo expression, which will be evaluated to produce a value that must be TRUE or FALSE. The comparisons with TRUE and FALSE are always case-insensitive. A runlist can consist of either a single expression (that produces a value) or zero or more instructions (that do something, rather than output a value), depending on the context: PRINT IFELSE :X<0 ["NEGATIVE] ["POSITIVE] ; one value in each case REPEAT 4 [PRINT "A PRINT "B] ; two instructions >>RUN instructionlist command or operation. Runs the Logo instructions in the input list; outputs if the list contains an expression that outputs. >>RUNRESULT instructionlist runs the instructions in the input; outputs an empty list if those instructions produce no output, or a list whose only member is the output from running the input instructionlist. Useful for inventing command-or-operation control structures: local "result make "result runresult [something] if emptyp :result [stop] output first :result >>REPEAT num instructionlist command. Runs the "instructionlist" repeatedly, "num" times. >>FOREVER instructionlist command. Runs the "instructionlist" repeatedly, until something inside the instructionlist (such as STOP or THROW) makes it stop. >>REPCOUNT outputs the repetition count of the innermost current REPEAT or FOREVER, starting from 1. If no REPEAT or FOREVER is active, outputs -1. The abbreviation # can be used for REPCOUNT unless the REPEAT is inside the template input to a higher order procedure such as FOREACH, in which case # has a different meaning. >>IF tf instructionlist (IF tf instructionlist1 instructionlist2) command. If the first input has the value TRUE, then IF runs the second input. If the first input has the value FALSE, then IF does nothing. (If given a third input, IF acts like IFELSE, as described below.) It is an error if the first input is not either TRUE or FALSE. For compatibility with earlier versions of Logo, if an IF instruction is not enclosed in parentheses, but the first thing on the instruction line after the second input expression is a literal list (i.e., a list in square brackets), the IF is treated as if it were IFELSE, but a warning message is given. If this aberrant IF appears in a procedure body, the warning is given only the first time the procedure is invoked in each Logo session. >>IFELSE tf instructionlist1 instructionlist2 command or operation. If the first input has the value TRUE, then IFELSE runs the second input. If the first input has the value FALSE, then IFELSE runs the third input. IFELSE outputs a value if the instructionlist contains an expression that outputs a value. >>TEST tf command. Remembers its input, which must be TRUE or FALSE, for use by later IFTRUE or IFFALSE instructions. The effect of TEST is local to the procedure in which it is used; any corresponding IFTRUE or IFFALSE must be in the same procedure or a subprocedure. >>IFTRUE instructionlist IFT instructionlist command. Runs its input if the most recent TEST instruction had a TRUE input. The TEST must have been in the same procedure or a superprocedure. >>IFFALSE instructionlist IFF instructionlist command. Runs its input if the most recent TEST instruction had a FALSE input. The TEST must have been in the same procedure or a superprocedure. >>STOP command. Ends the running of the procedure in which it appears. Control is returned to the context in which that procedure was invoked. The stopped procedure does not output a value. >>OUTPUT/OP value command. Ends the running of the procedure in which it appears. That procedure outputs the value "value" to the context in which it was invoked. Don't be confused: OUTPUT itself is a command, but the procedure that invokes OUTPUT is an operation. >>CATCH tag instructionlist command or operation. Runs its second input. Outputs if that instructionlist outputs. If, while running the instructionlist, a THROW instruction is executed with a tag equal to the first input (case-insensitive comparison), then the running of the instructionlist is terminated immediately. In this case the CATCH outputs if a value input is given to THROW. The tag must be a word. If the tag is the word ERROR, then any error condition that arises during the running of the instructionlist has the effect of THROW "ERROR instead of printing an error message and returning to toplevel. The CATCH does not output if an error is caught. Also, during the running of the instructionlist, the variable ERRACT is temporarily unbound. (If there is an error while ERRACT has a value, that value is taken as an instructionlist to be run after printing the error message. Typically the value of ERRACT, if any, is the list [PAUSE].) >>THROW tag (THROW tag value) command. Must be used within the scope of a CATCH with an equal tag. Ends the running of the instructionlist of the CATCH. If THROW is used with only one input, the corresponding CATCH does not output a value. If THROW is used with two inputs, the second provides an output for the CATCH. THROW "TOPLEVEL can be used to terminate all running procedures and interactive pauses, and return to the toplevel instruction prompt. Typing the system interrupt character (alt-S for wxWidgets; otherwise normally control-C for Unix, control-Q for DOS, or command-period for Mac) has the same effect. THROW "ERROR can be used to generate an error condition. If the error is not caught, it prints a message (THROW "ERROR) with the usual indication of where the error (in this case the THROW) occurred. If a second input is used along with a tag of ERROR, that second input is used as the text of the error message instead of the standard message. Also, in this case, the location indicated for the error will be, not the location of the THROW, but the location where the procedure containing the THROW was invoked. This allows user-defined procedures to generate error messages as if they were primitives. Note: in this case the corresponding CATCH "ERROR, if any, does not output, since the second input to THROW is not considered a return value. THROW "SYSTEM immediately leaves Logo, returning to the operating system, without printing the usual parting message and without deleting any editor temporary file written by EDIT. >>ERROR outputs a list describing the error just caught, if any. If there was not an error caught since the last use of ERROR, the empty list will be output. The error list contains four members: an integer code corresponding to the type of error, the text of the error message (as a single word including spaces), the name of the procedure in which the error occurred, and the instruction line on which the error occurred. >>PAUSE command or operation. Enters an interactive pause. The user is prompted for instructions, as at toplevel, but with a prompt that includes the name of the procedure in which PAUSE was invoked. Local variables of that procedure are available during the pause. PAUSE outputs if the pause is ended by a CONTINUE with an input. If the variable ERRACT exists, and an error condition occurs, the contents of that variable are run as an instructionlist. Typically ERRACT is given the value [PAUSE] so that an interactive pause will be entered in the event of an error. This allows the user to check values of local variables at the time of the error. Typing the system quit character (alt-S for wxWidgets; otherwise normally control-\ for Unix, control-W for DOS, or command-comma for Mac) will also enter a pause. >>CONTINUE/CO value (CONTINUE/CO) command. Ends the current interactive pause, returning to the context of the PAUSE invocation that began it. If CONTINUE is given an input, that value is used as the output from the PAUSE. If not, the PAUSE does not output. Exceptionally, the CONTINUE command can be used without its default input and without parentheses provided that nothing follows it on the instruction line. >>WAIT time command. Delays further execution for "time" 60ths of a second. Also causes any buffered characters destined for the terminal to be printed immediately. WAIT 0 can be used to achieve this buffer flushing without actually waiting. >>BYE command. Exits from Logo; returns to the operating system. >>.MAYBEOUTPUT value (special form) works like OUTPUT except that the expression that provides the input value might not, in fact, output a value, in which case the effect is like STOP. This is intended for use in control structure definitions, for cases in which you don't know whether or not some expression produces a value. Example: to invoke :function [:inputs] 2 .maybeoutput apply :function :inputs end ? (invoke "print "a "b "c) a b c ? print (invoke "word "a "b "c) abc This is an alternative to RUNRESULT. It's fast and easy to use, at the cost of being an exception to Logo's evaluation rules. (Ordinarily, it should be an error if the expression that's supposed to provide an input to something doesn't have a value.) >>GOTO word command. Looks for a TAG command with the same input in the same procedure, and continues running the procedure from the location of that TAG. It is meaningless to use GOTO outside of a procedure. >>TAG quoted.word command. Does nothing. The input must be a literal word following a quotation mark ("), not the result of a computation. Tags are used by the GOTO command. >>IGNORE value (library procedure) command. Does nothing. Used when an expression is evaluated for a side effect and its actual value is unimportant. >>` list (library procedure) outputs a list equal to its input but with certain substitutions. If a member of the input list is the word "," (comma) then the following member should be an instructionlist that produces an output when run. That output value replaces the comma and the instructionlist. If a member of the input list is the word ",@" (comma atsign) then the following member should be an instructionlist that outputs a list when run. The members of that list replace the ,@ and the instructionlist. Example: show `[foo baz ,[bf [a b c]] garply ,@[bf [a b c]]] will print [foo baz [b c] garply b c] A word starting with , or ,@ is treated as if the rest of the word were a one-word list, e.g., ,:FOO is equivalent to ,[:FOO]. A word starting with ", (quote comma) or :, (colon comma) becomes a word starting with " or : but with the result of running the substitution (or its first word, if the result is a list) replacing what comes after the comma. Backquotes can be nested. Substitution is done only for commas at the same depth as the backquote in which they are found: ? show `[a `[b ,[1+2] ,[foo ,[1+3] d] e] f] [a ` [b , [1+2] , [foo 4 d] e] f] ?make "name1 "x ?make "name2 "y ? show `[a `[b ,:,:name1 ,",:name2 d] e] [a ` [b , [:x] , ["y] d] e] >>FOR forcontrol instructionlist (library procedure) command. The first input must be a list containing three or four members: (1) a word, which will be used as the name of a local variable; (2) a word or list that will be evaluated as by RUN to determine a number, the starting value of the variable; (3) a word or list that will be evaluated to determine a number, the limit value of the variable; (4) an optional word or list that will be evaluated to determine the step size. If the fourth member is missing, the step size will be 1 or -1 depending on whether the limit value is greater than or less than the starting value, respectively. The second input is an instructionlist. The effect of FOR is to run that instructionlist repeatedly, assigning a new value to the control variable (the one named by the first member of the forcontrol list) each time. First the starting value is assigned to the control variable. Then the value is compared to the limit value. FOR is complete when the sign of (current - limit) is the same as the sign of the step size. (If no explicit step size is provided, the instructionlist is always run at least once. An explicit step size can lead to a zero-trip FOR, e.g., FOR [I 1 0 1] ...) Otherwise, the instructionlist is run, then the step is added to the current value of the control variable and FOR returns to the comparison step. ? for [i 2 7 1.5] [print :i] 2 3.5 5 6.5 ? >>DO.WHILE instructionlist tfexpression (library procedure) command. Repeatedly evaluates the "instructionlist" as long as the evaluated "tfexpression" remains TRUE. Evaluates the first input first, so the "instructionlist" is always run at least once. The "tfexpression" must be an expressionlist whose value when evaluated is TRUE or FALSE. >>WHILE tfexpression instructionlist (library procedure) command. Repeatedly evaluates the "instructionlist" as long as the evaluated "tfexpression" remains TRUE. Evaluates the first input first, so the "instructionlist" may never be run at all. The "tfexpression" must be an expressionlist whose value when evaluated is TRUE or FALSE. >>DO.UNTIL instructionlist tfexpression (library procedure) command. Repeatedly evaluates the "instructionlist" as long as the evaluated "tfexpression" remains FALSE. Evaluates the first input first, so the "instructionlist" is always run at least once. The "tfexpression" must be an expressionlist whose value when evaluated is TRUE or FALSE. >>UNTIL tfexpression instructionlist (library procedure) command. Repeatedly evaluates the "instructionlist" as long as the evaluated "tfexpression" remains FALSE. Evaluates the first input first, so the "instructionlist" may never be run at all. The "tfexpression" must be an expressionlist whose value when evaluated is TRUE or FALSE. >>CASE value clauses (library procedure) command or operation. The second input is a list of lists (clauses); each clause is a list whose first element is either a list of values or the word ELSE and whose butfirst is a Logo expression or instruction. CASE examines the clauses in order. If a clause begins with the word ELSE (upper or lower case), then the butfirst of that clause is evaluated and CASE outputs its value, if any. If the first input to CASE is a member of the first element of a clause, then the butfirst of that clause is evaluated and CASE outputs its value, if any. If neither of these conditions is met, then CASE goes on to the next clause. If no clause is satisfied, CASE does nothing. Example: to vowelp :letter output case :letter [ [[a e i o u] "true] [else "false] ] end >>COND clauses (library procedure) command or operation. The input is a list of lists (clauses); each clause is a list whose first element is either an expression whose value is TRUE or FALSE, or the word ELSE, and whose butfirst is a Logo expression or instruction. COND examines the clauses in order. If a clause begins with the word ELSE (upper or lower case), then the butfirst of that clause is evaluated and CASE outputs its value, if any. Otherwise, the first element of the clause is evaluated; the resulting value must be TRUE or FALSE. If it's TRUE, then the butfirst of that clause is evaluated and COND outputs its value, if any. If the value is FALSE, then COND goes on to the next clause. If no clause is satisfied, COND does nothing. Example: to evens :numbers ; select even numbers from a list op cond [ [[emptyp :numbers] []] [[evenp first :numbers] ; assuming EVENP is defined fput first :numbers evens butfirst :numbers] [else evens butfirst :numbers] ] end ///TEMPLATE-BASED ITERATION >>The procedures in this section are iteration tools based on the idea of a "template." This is a generalization of an instruction list or an expression list in which "slots" are provided for the tool to insert varying data. Four different forms of template can be used. The most commonly used form for a template is "explicit-slot" form, or "question mark" form. Example: ? show map [? * ?] [2 3 4 5] [4 9 16 25] ? In this example, the MAP tool evaluated the template [? * ?] repeatedly, with each of the members of the data list [2 3 4 5] substituted in turn for the question marks. The same value was used for every question mark in a given evaluation. Some tools allow for more than one datum to be substituted in parallel; in these cases the slots are indicated by ?1 for the first datum, ?2 for the second, and so on: ? show (map [(word ?1 ?2 ?1)] [a b c] [d e f]) [ada beb cfc] ? If the template wishes to compute the datum number, the form (? 1) is equivalent to ?1, so (? ?1) means the datum whose number is given in datum number 1. Some tools allow additional slot designations, as shown in the individual descriptions. The second form of template is the "named-procedure" form. If the template is a word rather than a list, it is taken as the name of a procedure. That procedure must accept a number of inputs equal to the number of parallel data slots provided by the tool; the procedure is applied to all of the available data in order. That is, if data ?1 through ?3 are available, the template "PROC is equivalent to [PROC ?1 ?2 ?3]. ? show (map "word [a b c] [d e f]) [ad be cf] ? to dotprod :a :b ; vector dot product op apply "sum (map "product :a :b) end The third form of template is "named-slot" or "lambda" form. This form is indicated by a template list containing more than one member, whose first member is itself a list. The first member is taken as a list of names; local variables are created with those names and given the available data in order as their values. The number of names must equal the number of available data. This form is needed primarily when one iteration tool must be used within the template list of another, and the ? notation would be ambiguous in the inner template. Example: to matmul :m1 :m2 [:tm2 transpose :m2] ; multiply two matrices output map [[row] map [[col] dotprod :row :col] :tm2] :m1 end The fourth form is "procedure text" form, a variant of lambda form. In this form, the template list contains at least two members, all of which are lists. This is the form used by the DEFINE and TEXT primitives, and APPLY accepts it so that the text of a defined procedure can be used as a template. Note: The fourth form of template is interpreted differently from the others, in that Logo considers it to be an independent defined procedure for the purposes of OUTPUT and STOP. For example, the following two instructions are identical: ? print apply [[x] :x+3] [5] 8 ? print apply [[x] [output :x+3]] [5] 8 although the first instruction is in named-slot form and the second is in procedure-text form. The named-slot form can be understood as telling Logo to evaluate the expression :x+3 in place of the entire invocation of apply, with the variable x temporarily given the value 5. The procedure-text form can be understood as invoking the procedure to foo :x output :x+3 end with input 5, but without actually giving the procedure a name. If the use of OUTPUT were interchanged in these two examples, we'd get errors: ? print apply [[x] output :x+3] [5] Can only use output inside a procedure ? print apply [[x] [:x+3]] [5] You don't say what to do with 8 The named-slot form can be used with STOP or OUTPUT inside a procedure, to stop the enclosing procedure. The following iteration tools are extended versions of the ones in Appendix B of the book _Computer_Science_Logo_Style,_Volume_3:_Advanced_Topics_ by Brian Harvey [MIT Press, 1987]. The extensions are primarily to allow for variable numbers of inputs. >>APPLY template inputlist command or operation. Runs the "template," filling its slots with the members of "inputlist." The number of members in "inputlist" must be an acceptable number of slots for "template." It is illegal to apply the primitive TO as a template, but anything else is okay. APPLY outputs what "template" outputs, if anything. >>INVOKE template input (library procedure) (INVOKE template input1 input2 ...) command or operation. Exactly like APPLY except that the inputs are provided as separate expressions rather than in a list. >>FOREACH data template (library procedure) (FOREACH data1 data2 ... template) command. Evaluates the template list repeatedly, once for each member of the data list. If more than one data list are given, each of them must be the same length. (The data inputs can be words, in which case the template is evaluated once for each character.) In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. If multiple parallel slots are used, then (?REST 1) goes with ?1, etc. In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2. >>MAP template data (library procedure) (MAP template data1 data2 ...) outputs a word or list, depending on the type of the data input, of the same length as that data input. (If more than one data input are given, the output is of the same type as data1.) Each member of the output is the result of evaluating the template list, filling the slots with the corresponding member(s) of the data input(s). (All data inputs must be the same length.) In the case of a word output, the results of the template evaluation must be words, and they are concatenated with WORD. In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. If multiple parallel slots are used, then (?REST 1) goes with ?1, etc. In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2. >>MAP.SE template data (library procedure) (MAP.SE template data1 data2 ...) outputs a list formed by evaluating the template list repeatedly and concatenating the results using SENTENCE. That is, the members of the output are the members of the results of the evaluations. The output list might, therefore, be of a different length from that of the data input(s). (If the result of an evaluation is the empty list, it contributes nothing to the final output.) The data inputs may be words or lists. In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. If multiple parallel slots are used, then (?REST 1) goes with ?1, etc. In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2. >>FILTER tftemplate data (library procedure) outputs a word or list, depending on the type of the data input, containing a subset of the members (for a list) or characters (for a word) of the input. The template is evaluated once for each member or character of the data, and it must produce a TRUE or FALSE value. If the value is TRUE, then the corresponding input constituent is included in the output. ? print filter "vowelp "elephant eea ? In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2. >>FIND tftemplate data (library procedure) outputs the first constituent of the data input (the first member of a list, or the first character of a word) for which the value produced by evaluating the template with that consituent in its slot is TRUE. If there is no such constituent, the empty list is output. In a template, the symbol ?REST represents the portion of the data input to the right of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then ?REST would be replaced by [C D E]. In a template, the symbol # represents the position in the data input of the member currently being used as the ? slot-filler. That is, if the data input is [A B C D E] and the template is being evaluated with ? replaced by B, then # would be replaced by 2. >>REDUCE template data (library procedure) outputs the result of applying the template to accumulate the members of the data input. The template must be a two-slot function. Typically it is an associative function name like SUM. If the data input has only one constituent (member in a list or character in a word), the output is that consituent. Otherwise, the template is first applied with ?1 filled with the next-to-last consitient and ?2 with the last constituent. Then, if there are more constituents, the template is applied with ?1 filled with the next constituent to the left and ?2 with the result from the previous evaluation. This process continues until all constituents have been used. The data input may not be empty. Note: If the template is, like SUM, the name of a procedure that is capable of accepting arbitrarily many inputs, it is more efficient to use APPLY instead of REDUCE. The latter is good for associative procedures that have been written to accept exactly two inputs: to max :a :b output ifelse :a > :b [:a] [:b] end print reduce "max [...] Alternatively, REDUCE can be used to write MAX as a procedure that accepts any number of inputs, as SUM does: to max [:inputs] 2 if emptyp :inputs ~ [(throw "error [not enough inputs to max])] output reduce [ifelse ?1 > ?2 [?1] [?2]] :inputs end >>CROSSMAP template listlist (library procedure) (CROSSMAP template data1 data2 ...) outputs a list containing the results of template evaluations. Each data list contributes to a slot in the template; the number of slots is equal to the number of data list inputs. As a special case, if only one data list input is given, that list is taken as a list of data lists, and each of its members contributes values to a slot. CROSSMAP differs from MAP in that instead of taking members from the data inputs in parallel, it takes all possible combinations of members of data inputs, which need not be the same length. ? show (crossmap [word ?1 ?2] [a b c] [1 2 3 4]) [a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4] ? For compatibility with the version in the first edition of CSLS, CROSSMAP templates may use the notation :1 instead of ?1 to indicate slots. >>CASCADE endtest template startvalue (library procedure) (CASCADE endtest tmp1 sv1 tmp2 sv2 ...) (CASCADE endtest tmp1 sv1 tmp2 sv2 ... finaltemplate) outputs the result of applying a template (or several templates, as explained below) repeatedly, with a given value filling the slot the first time, and the result of each application filling the slot for the following application. In the simplest case, CASCADE has three inputs. The second input is a one-slot expression template. That template is evaluated some number of times (perhaps zero). On the first evaluation, the slot is filled with the third input; on subsequent evaluations, the slot is filled with the result of the previous evaluation. The number of evaluations is determined by the first input. This can be either a nonnegative integer, in which case the template is evaluated that many times, or a predicate expression template, in which case it is evaluated (with the same slot filler that will be used for the evaluation of the second input) repeatedly, and the CASCADE evaluation continues as long as the predicate value is FALSE. (In other words, the predicate template indicates the condition for stopping.) If the template is evaluated zero times, the output from CASCADE is the third (startvalue) input. Otherwise, the output is the value produced by the last template evaluation. CASCADE templates may include the symbol # to represent the number of times the template has been evaluated. This slot is filled with 1 for the first evaluation, 2 for the second, and so on. ? show cascade 5 [lput # ?] [] [1 2 3 4 5] ? show cascade [vowelp first ?] [bf ?] "spring ing ? show cascade 5 [# * ?] 1 120 ? Several cascaded results can be computed in parallel by providing additional template-startvalue pairs as inputs to CASCADE. In this case, all templates (including the endtest template, if used) are multi-slot, with the number of slots equal to the number of pairs of inputs. In each round of evaluations, ?2, for example, represents the result of evaluating the second template in the previous round. If the total number of inputs (including the first endtest input) is odd, then the output from CASCADE is the final value of the first template. If the total number of inputs is even, then the last input is a template that is evaluated once, after the end test is satisfied, to determine the output from CASCADE. to fibonacci :n output (cascade :n [?1 + ?2] 1 [?1] 0) end to piglatin :word output (cascade [vowelp first ?] ~ [word bf ? first ?] ~ :word ~ [word ? "ay]) end >>CASCADE.2 endtest temp1 startval1 temp2 startval2 (library procedure) outputs the result of invoking CASCADE with the same inputs. The only difference is that the default number of inputs is five instead of three. >>TRANSFER endtest template inbasket (library procedure) outputs the result of repeated evaluation of the template. The template is evaluated once for each member of the list "inbasket." TRANSFER maintains an "outbasket" that is initially the empty list. After each evaluation of the template, the resulting value becomes the new outbasket. In the template, the symbol ?IN represents the current member from the inbasket; the symbol ?OUT represents the entire current outbasket. Other slot symbols should not be used. If the first (endtest) input is an empty list, evaluation continues until all inbasket members have been used. If not, the first input must be a predicate expression template, and evaluation continues until either that template's value is TRUE or the inbasket is used up. ///MACROS >>.MACRO procname :input1 :input2 ... (special form) .DEFMACRO procname text A macro is a special kind of procedure whose output is evaluated as Logo instructions in the context of the macro's caller. .MACRO is exactly like TO except that the new procedure becomes a macro; .DEFMACRO is exactly like DEFINE with the same exception. Macros are useful for inventing new control structures comparable to REPEAT, IF, and so on. Such control structures can almost, but not quite, be duplicated by ordinary Logo procedures. For example, here is an ordinary procedure version of REPEAT: to my.repeat :num :instructions if :num=0 [stop] run :instructions my.repeat :num-1 :instructions end This version works fine for most purposes, e.g., my.repeat 5 [print "hello] But it doesn't work if the instructions to be carried out include OUTPUT, STOP, or LOCAL. For example, consider this procedure: to example print [Guess my secret word. You get three guesses.] repeat 3 [type "|?? | ~ if readword = "secret [pr "Right! stop]] print [Sorry, the word was "secret"!] end This procedure works as written, but if MY.REPEAT is used instead of REPEAT, it won't work because the STOP will stop MY.REPEAT instead of stopping EXAMPLE as desired. The solution is to make MY.REPEAT a macro. Instead of actually carrying out the computation, a macro must return a list containing Logo instructions. The contents of that list are evaluated as if they appeared in place of the call to the macro. Here's a macro version of REPEAT: .macro my.repeat :num :instructions if :num=0 [output []] output sentence :instructions ~ (list "my.repeat :num-1 :instructions) end Every macro is an operation -- it must always output something. Even in the base case, MY.REPEAT outputs an empty instruction list. To show how MY.REPEAT works, let's take the example my.repeat 5 [print "hello] For this example, MY.REPEAT will output the instruction list [print "hello my.repeat 4 [print "hello]] Logo then executes these instructions in place of the original invocation of MY.REPEAT; this prints "hello" once and invokes another repetition. The technique just shown, although fairly easy to understand, has the defect of slowness because each repetition has to construct an instruction list for evaluation. Another approach is to make MY.REPEAT a macro that works just like the non-macro version unless the instructions to be repeated include OUTPUT or STOP: .macro my.repeat :num :instructions catch "repeat.catchtag ~ [op repeat.done runresult [repeat1 :num :instructions]] op [] end to repeat1 :num :instructions if :num=0 [throw "repeat.catchtag] run :instructions .maybeoutput repeat1 :num-1 :instructions end to repeat.done :repeat.result if emptyp :repeat.result [op [stop]] op list "output quoted first :repeat.result end If the instructions do not include STOP or OUTPUT, then REPEAT1 will reach its base case and invoke THROW. As a result, MY.REPEAT's last instruction line will output an empty list, so the evaluation of the macro result by the caller will do nothing. But if a STOP or OUTPUT happens, then REPEAT.DONE will output a STOP or OUTPUT instruction that will be executed in the caller's context. The macro-defining commands have names starting with a dot because macros are an advanced feature of Logo; it's easy to get in trouble by defining a macro that doesn't terminate, or by failing to construct the instruction list properly. Lisp users should note that Logo macros are NOT special forms. That is, the inputs to the macro are evaluated normally, as they would be for any other Logo procedure. It's only the output from the macro that's handled unusually. Here's another example: .macro localmake :name :value output (list "local ~ word "" :name ~ "apply ~ ""make ~ (list :name :value)) end It's used this way: to try localmake "garply "hello print :garply end LOCALMAKE outputs the list [local "garply apply "make [garply hello]] The reason for the use of APPLY is to avoid having to decide whether or not the second input to MAKE requires a quotation mark before it. (In this case it would -- MAKE "GARPLY "HELLO -- but the quotation mark would be wrong if the value were a list.) It's often convenient to use the ` function to construct the instruction list: .macro localmake :name :value op `[local ,[word "" :name] apply "make [,[:name] ,[:value]]] end On the other hand, ` is pretty slow, since it's tree recursive and written in Logo. >>MACROP name MACRO? name outputs TRUE if its input is the name of a macro. >>MACROEXPAND expr (library procedure) takes as its input a Logo expression that invokes a macro (that is, one that begins with the name of a macro) and outputs the the Logo expression into which the macro would translate the input expression. .macro localmake :name :value op `[local ,[word "" :name] apply "make [,[:name] ,[:value]]] end ? show macroexpand [localmake "pi 3.14159] [local "pi apply "make [pi 3.14159]] End>VTC612.sb< Start>VTD423-0.sb< '============================================================== ' PROTOTYPE MARIONETTE PROGRAM FOR SMALL BASIC BIG CHALLENGE ' Original prototype VTD423 coded by litdev ' Turtle version coded by Nonki Takahashi 'Do the initialisation and set up events for user interaction '============================================================== Initialise() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp= OnMouseUp GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp Controls.ButtonClicked = OnButttonClicked 'While(mouseDown <> "True") ' Program.Delay(100) 'EndWhile '============================================================== ' MAIN PROGRAM LOOP 'Keep looping '============================================================== While ("True") start = Clock.ElapsedMilliseconds If (mouseDown) Then Movement() EndIf If (keyDown) Then KeyChange() Rotation() EndIf If (buttonPressed) Then ButtonChange() EndIf Update() Draw() delay = 10-(Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile '============================================================== ' INITIALISATION 'Do the main setup and additionally create the marionette geometry (GetPuppet) '============================================================== ' Create all the strings and limbs - nodes are initiated from these Sub Initialise 'Basic window and main variables gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Marionette Prototype / Turtle" GraphicsWindow.BackgroundColor = "SkyBlue" GraphicsWindow.PenWidth = 0 'Stroke hinders rotation visualisation due to Z ordering GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(5,5,"Select string with number key or keypad, then move with mouse button down") GraphicsWindow.DrawText(5,20,"Select and move plan view of strings with mouse") GraphicsWindow.DrawText(5,35,"Rotate using Left and Right keys or compass with mouse") GraphicsWindow.DrawText(5,50,"F1 to reset, Space to toggle show strings, Esc to exit") nNode = 0 'Number of nodes nLimb = 0 'Number of limbs (and strings) nString = 0 'Number of strings rotate = 0 'Rotation showString = 1 'Show strings 0-false 1-true cos = Math.Cos(rotate) sin = Math.Sin(rotate) Xcen = gw/2 'Center of viewing deg = " "+Text.GetCharacter(176) label = Shapes.AddText(rotate+deg) 'Report current angle of rotation Shapes.Move(label,gw-47,22) GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawEllipse(gw-50,10,40,40) GraphicsWindow.DrawRectangle(gw-100,gh-100,100,100) 'For bottom right box GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" compass = Shapes.AddEllipse(6,6) 'Each limb links 2 nodes and has a shape or image with a width and height - strings are width <=2 rectangles 'Coded for 3D , rotation is about Y axis at X=Z=0, then offset for viewing + Xcen '*** It is sufficient to define a model completely by creating a limbs array so this could be loaded from a file *** GetPuppet() 'Set the limbs array 'Nodes - static string nodes (only move with user interaction) have one limb with small width (a string) For i = 1 To nLimb limb = limbs[i] For j = 1 To 2 nNode = Math.Max(nNode,limb[j]) 'This allows non-contiguous node numbers connecting the limbs node = nodes[limb[j]] node["Shape"] = "" node["Moving"] = "True" 'Add limb connected to node node["nLimb"] = node["nLimb"]+1 node[node["nLimb"]] = i nodes[limb[j]] = node EndFor EndFor 'Set static user movable nodes GraphicsWindow.BrushColor = "Red" For i = 1 To nNode node = nodes[i] If (node["nLimb"] = 1 And limbs[node[1]]["W"] <= 2) Then nString = nString+1 node["Shape"] = Shapes.AddText(i) 'Only used for string labeling node["Moving"] = "False" strings[i] = Shapes.AddEllipse(6,6) buttonString[i] = Controls.AddButton(i,50+30*i,gh-30) EndIf nodes[i] = node EndFor Reset() 'Initial coordinates 'Buttons GraphicsWindow.BrushColor = "Black" buttonExit = Controls.AddButton("Exit",5,gh-30) buttonReset = Controls.AddButton("Reset",5,gh-60) buttonShowStrings = Controls.AddButton("Toggle Strings",5,gh-90) EndSub 'Set the puppet topology and properties (strings and limbs) Sub GetPuppet GraphicsWindow.BrushColor = "Black" 'Strings - The top string nodes should usually be numbered first from 1 limb[1] = 1 'First node connected to shape limb[2] = 8 'Second node connected to shape limb["L"] = 300 'Length - distance between nodes limb["W"] = 1 'Width limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) 'Can be any shape or control type including images nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 2 limb[2] = 6 limb["L"] = 150 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 3 limb[2] = 10 limb["L"] = 30 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 4 limb[2] = 7 limb["L"] = 150 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 5 limb[2] = 9 limb["L"] = 300 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb GraphicsWindow.BrushColor = "Brown" 'Left Arm limb[1] = 6 limb[2] = 11 limb["L"] = 71 'Not 19 as a test of non-contiguous nodes limb["W"] = 31 url = "http://i1.gallery.technet.s-msft.com/small-basic-deck-another-2f724b78/image/file/125624/1/ftleg.png" limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Arm limb[1] = 7 limb[2] = 11 limb["L"] = 71 limb["W"] = 31 limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Left Leg limb[1] = 8 limb[2] = 12 limb["L"] = 71 limb["W"] = 31 limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Leg limb[1] = 9 limb[2] = 12 limb["L"] = 71 limb["W"] = 31 limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Head limb[1] = 10 limb[2] = 11 limb["L"] = 64 limb["W"] = 86 url = "http://i1.gallery.technet.s-msft.com/small-basic-deck-another-2f724b78/image/file/125632/1/ftheadb.png" limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Tail limb[1] = 12 limb[2] = 13 limb["L"] = 33 limb["W"] = 25 url = "http://i1.gallery.technet.s-msft.com/small-basic-deck-another-2f724b78/image/file/125634/1/fttail.png" limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb 'Body limb[1] = 11 limb[2] = 12 limb["L"] = 117 limb["W"] = 116 url = "http://i1.gallery.technet.s-msft.com/small-basic-deck-another-2f724b78/image/file/125633/1/ftbackb.png" limb["Shape"] = Shapes.AddImage(url) nLimb = nLimb+1 limbs[nLimb] = limb EndSub '============================================================== ' EVENT SUBROUTINES 'Just log an event to be handled syncronously in the main loop '============================================================== Sub OnMouseDown mouseDown = "True" mouseClicked = "True" EndSub Sub OnMouseUp mouseDown = "False" iSelected = 0 iCompass = 0 EndSub Sub OnKeyDown keyDown = "True" key = GraphicsWindow.LastKey EndSub Sub OnKeyUp keyDown = "False" EndSub Sub OnButttonClicked button = Controls.LastClickedButton buttonPressed = "True" EndSub '============================================================== ' INTERACTION SUBROUTINES 'These subroutines are just about user control and not the main engine or marionette properties 'This is actaully where most of the work is '============================================================== ' Move marionette strings Sub Movement If (mouseClicked) Then 'Initial click is over compass dX = gw-30+20*sin - GraphicsWindow.MouseX dY = 30+20*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iCompass = 1 key = "" KeyChange() EndIf For i = 1 To nNode If (nodes[i]["Shape"] <> "") Then 'Initial click is over a string eX = 100*nodes[i]["X"]/gw eY = 100*nodes[i]["Z"]/gh dX = gw-50+eX*cos+eY*sin - GraphicsWindow.MouseX dY = gh-50-eX*sin+eY*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iSelected = i key = "" KeyChange() EndIf EndIf EndFor mouseClicked = "False" 'Dealt with initial click EndIf If (iCompass > 0) Then 'Schematic selected compass dX = (GraphicsWindow.MouseX - (gw-30)) dY = (GraphicsWindow.MouseY - 30) If (dX < -50 Or dY > 50) Then iCompass = 0 'Deselect if out of box Else If (dY = 0) Then rotate = Math.Pi/2 If (dX < 0) Then rotate = rotate+Math.Pi EndIf ElseIf (dY < 0) Then rotate = Math.ArcTan(dX/dY)+Math.Pi Else rotate = Math.ArcTan(dX/dY) EndIf rotate = Math.Round(rotate*180/Math.Pi) sin = Math.Sin(rotate*Math.Pi/180) cos = Math.Cos(rotate*Math.Pi/180) While (rotate < 0) rotate = rotate+360 EndWhile While (rotate >= 360) rotate = rotate-360 EndWhile EndIf EndIf If (iSelected > 0) Then 'Schematic selected string dX = GraphicsWindow.MouseX - (gw-50) dY = GraphicsWindow.MouseY - (gh-50) If (dX < -50 Or dY < -50) Then iSelected = 0 'Deselect if out of box Else nodes[iSelected]["X"] = (dX*cos-dY*sin)*gw/100 nodes[iSelected]["Z"] = (dX*sin+dY*cos)*gh/100 EndIf Else For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then 'Number selected string nodes[i]["X"] = (GraphicsWindow.MouseX-Xcen)*cos nodes[i]["Y"] = GraphicsWindow.MouseY nodes[i]["Z"] = (GraphicsWindow.MouseX-Xcen)*sin EndIf EndFor EndIf EndSub '3D Rotation Sub Rotation If (key = "Left") Then rotate = rotate-1 If (rotate < 0) Then rotate = rotate + 360 EndIf ElseIf (key = "Right") Then rotate = rotate+1 If (rotate >= 360) Then rotate = rotate - 360 EndIf EndIf cos = Math.Cos(rotate*Math.PI/180) sin = Math.Sin(rotate*Math.PI/180) EndSub 'Do anything required when key pressed Sub KeyChange 'Set label to X when active For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then Shapes.SetText(nodes[i]["Shape"],"X") Else Shapes.SetText(nodes[i]["Shape"],i) EndIf EndFor 'Reset If (key = "F1") Then Reset() keyDown = "False" ' One key press only ElseIf (key = "Space") Then showString = 1-showString ShowStrings() keyDown = "False" ' One key press toggle ElseIf (key = "Escape") Then Program.End() EndIf EndSub 'Do anything required when button pressed Sub ButtonChange 'Mimic a key press for these - therefore only one set of code actually doing the actions where there is duplicate control (key or button) If (button = buttonReset) Then keyDown = "True" key = "F1" ElseIf (button = buttonShowStrings) Then keyDown = "True" key = "Space" ElseIf (button = buttonExit) Then keyDown = "True" key = "Escape" Else For i = 1 To nNode If (button = buttonString[i]) Then keyDown = "True" key = "D"+i EndIf EndFor EndIf buttonPressed = "False" 'Button pressed handled EndSub 'Reset positions and rotation Sub Reset rotate = 0 iString = 0 For i = 1 To nNode If (nodes[i]["Moving"]) Then If (nodes[i]["X"] = "") Then nodes[i]["X"] = -Xcen 'left to right (off to the left to break symmetry and fall nicely) nodes[i]["Y"] = 0 'Up to down nodes[i]["Z"] = 0 'Near to far EndIf Else iString = iString+1 nodes[i]["X"] = (1+iString)/(nString+3)*gw - Xcen nodes[i]["Y"] = 100 nodes[i]["Z"] = 0 EndIf EndFor showString = 1 ShowStrings() EndSub 'Update string hide or show (use opacity) Sub ShowStrings For i = 1 To nLimb If (limbs[i]["W"] <= 2) Then If (showString = 1) Then Shapes.SetOpacity(limbs[i]["Shape"],100) 'Use SetOpacity rather than HideShape as the latter can mess up moving and rotating when made visible again Else Shapes.SetOpacity(limbs[i]["Shape"],0) EndIf EndIf EndFor EndSub '============================================================== ' PHYSICS AND UPDATE SUBROUTINES 'These are called repeatedly and try to be quite efficient '============================================================== 'Do the physics - basically create forces of all connected limbs to a node - including gravity - then move towards a static (zero force) position for each node Sub Update maxTension = 1 'Don't want a possible division by zero For i = 1 To nNode 'Backwards difference to help stability - we could keep track of velocity and momentum , but this is reasonably effective nodes[i]["FX"] = 0.5*nodes[i]["FX"] nodes[i]["FY"] = 0.5*nodes[i]["FY"] nodes[i]["FZ"] = 0.5*nodes[i]["FZ"] EndFor For i = 1 To nLimb limb = limbs[i] 'Node at each end of the limb node1 = nodes[limb[1]] node2 = nodes[limb[2]] '(dX,dY,dZ) is vector from node1 to node2 dX = node2["X"]-node1["X"] dY = node2["Y"]-node1["Y"] dZ = node2["Z"]-node1["Z"] length = Math.SquareRoot(dX*dX+dY*dY+dZ*dZ) tension = (length-limb["L"]) 'Each connected limb provides a force in its direction (either tension or compression depending on separation relative to limb length) 'If (limb["W"] <= 2) Then tension = Math.Max(0,tension) 'Only allow tension - strings don't push - do this for all limbs 'EndIf maxTension = Math.Max(maxTension,Math.Abs(tension)) 'Check each mode is a moving node If (node1["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node1["FX"] = node1["FX"]+tension*dX/length 'Note the + for node1 node1["FY"] = node1["FY"]+tension*dY/length node1["FZ"] = node1["FZ"]+tension*dZ/length 'scale gravity for stability node1["FY"] = node1["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[1]] = node1 'Copy the working copy of node back to the array EndIf If (node2["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node2["FX"] = node2["FX"]-tension*dX/length 'Note the - for node2 node2["FY"] = node2["FY"]-tension*dY/length node2["FZ"] = node2["FZ"]-tension*dZ/length 'scale gravity for stability node2["FY"] = node2["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[2]] = node2 'Copy the working copy of node back to the array EndIf EndFor elasticity = 0.5 'Math.Min(0.5,10/maxTension) 'Limit node movement for stability For i = 1 To nNode node = nodes[i] 'Use this technique in many places - get the sub array (node), work with it, then copy it back at the end of this loop node["X"] = node["X"]+node["FX"]*elasticity node["Y"] = node["Y"]+node["FY"]*elasticity node["Z"] = node["Z"]+node["FZ"]*elasticity nodes[i] = node EndFor EndSub 'Update all graphics based on new positions Sub Draw 'Move limbs - added complexity due to possible rotation For i = 1 To nLimb limb = limbs[i] node1 = nodes[limb[1]] node2 = nodes[limb[2]] centerX = ((node1["X"]+node2["X"])*cos+(node1["Z"]+node2["Z"])*sin)/2 centerY = (node1["Y"]+node2["Y"])/2 dX = (node2["X"]-node1["X"])*cos+(node2["Z"]-node1["Z"])*sin dY = node2["Y"]-node1["Y"] length = Math.SquareRoot(dX*dX+dY*dY) If (dX = 0) Then angle = 90 If (dY < 0) Then angle = angle+180 EndIf ElseIf (dX > 0) Then angle = 180/Math.PI*Math.ArcTan(dY/dX) Else angle = 180 + 180/Math.PI*Math.ArcTan(dY/dX) EndIf Shapes.Move(limb["Shape"],Xcen+centerX-limb["L"]/2,centerY-limb["W"]/2) If (limb["W"] <= 2) then 'Only compress strings - stretch strings or limbs Shapes.Zoom(limb["Shape"],length/limb["L"],1) 'Do zoom before rotation - just stretch in direction of Length Else Shapes.Zoom(limb["Shape"],Math.Max(1,length/limb["L"]),1) EndIf Shapes.Rotate(limb["Shape"],angle) EndFor 'Move string identifier text shapes For i = 1 To nNode node = nodes[i] If (node["Shape"] <> "") Then Shapes.Move(node["Shape"],Xcen+node["X"]*cos+node["Z"]*sin-4,node["Y"]-16) dX = 100*node["X"]/gw dY = 100*node["Z"]/gh Shapes.Move(strings[i],gw-50+dX*cos+dY*sin-3,gh-50-dX*sin+dY*cos-3) EndIf EndFor Shapes.SetText(label,rotate+deg) Shapes.Move(compass,gw-30+20*sin-3,30+20*cos-3) EndSub End>VTD423-0.sb< Start>VTD423-1.sb< '============================================================== ' PROTOTYPE MARIONETTE PROGRAM FOR SMALL BASIC BIG CHALLENGE 'Do the initialisation and set up events for user interaction '============================================================== Initialise() InitialiseRain() 'JibbaJabba GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp= OnMouseUp GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp Controls.ButtonClicked = OnButttonClicked 'While(mouseDown <> "True") ' Program.Delay(100) 'EndWhile '============================================================== ' MAIN PROGRAM LOOP 'Keep looping '============================================================== While ("True") start = Clock.ElapsedMilliseconds If (mouseDown) Then Movement() EndIf If (keyDown) Then KeyChange() Rotation() EndIf If (buttonPressed) Then ButtonChange() EndIf Update() UpdateRain() 'JibbaJabba Draw() DrawRain() 'JibbaJabba delay = 10-(Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile '============================================================== ' INITIALISATION 'Do the main setup and additionally create the marionette geometry (GetPuppet) '============================================================== ' Create all the strings and limbs - nodes are initiated from these Sub Initialise 'Basic window and main variables gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Marionette Prototype" GraphicsWindow.BackgroundColor = "lightYellow" GraphicsWindow.PenWidth = 0 'Stroke hinders rotation visualisation due to Z ordering GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(5,5,"Select string with number key or keypad, then move with mouse button down") GraphicsWindow.DrawText(5,20,"Select and move plan view of strings with mouse") GraphicsWindow.DrawText(5,35,"Rotate using Left and Right keys or compass with mouse") GraphicsWindow.DrawText(5,50,"F1 to reset, Space to toggle show strings, Esc to exit") nNode = 0 'Number of nodes nLimb = 0 'Number of limbs (and strings) nString = 0 'Number of strings rotate = 0 'Rotation showString = 1 'Show strings 0-false 1-true cos = Math.Cos(rotate) sin = Math.Sin(rotate) Xcen = gw/2 'Center of viewing deg = " "+Text.GetCharacter(176) label = Shapes.AddText(rotate+deg) 'Report current angle of rotation Shapes.Move(label,gw-47,22) GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawEllipse(gw-50,10,40,40) GraphicsWindow.DrawRectangle(gw-100,gh-100,100,100) 'For bottom right box GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" compass = Shapes.AddEllipse(6,6) 'Each limb links 2 nodes and has a shape or image with a width and height - strings are width <=2 rectangles 'Coded for 3D , rotation is about Y axis at X=Z=0, then offset for viewing + Xcen '*** It is sufficient to define a model completely by creating a limbs array so this could be loaded from a file *** GetPuppet() 'Set the limbs array 'Nodes - static string nodes (only move with user interaction) have one limb with small width (a string) For i = 1 To nLimb limb = limbs[i] For j = 1 To 2 nNode = Math.Max(nNode,limb[j]) 'This allows non-contiguous node numbers connecting the limbs node = nodes[limb[j]] node["Shape"] = "" node["Moving"] = "True" 'Add limb connected to node node["nLimb"] = node["nLimb"]+1 node[node["nLimb"]] = i nodes[limb[j]] = node EndFor EndFor 'Set static user movable nodes GraphicsWindow.BrushColor = "Red" For i = 1 To nNode node = nodes[i] If (node["nLimb"] = 1 And limbs[node[1]]["W"] <= 2) Then nString = nString+1 node["Shape"] = Shapes.AddText(i) 'Only used for string labeling node["Moving"] = "False" strings[i] = Shapes.AddEllipse(6,6) buttonString[i] = Controls.AddButton(i,50+30*i,gh-30) EndIf nodes[i] = node EndFor Reset() 'Initial coordinates 'Buttons GraphicsWindow.BrushColor = "Black" buttonExit = Controls.AddButton("Exit",5,gh-30) buttonReset = Controls.AddButton("Reset",5,gh-60) buttonShowStrings = Controls.AddButton("Toggle Strings",5,gh-90) EndSub 'Set the puppet topology and properties (strings and limbs) Sub GetPuppet GraphicsWindow.BrushColor = "Black" 'Strings - The top string nodes should usually be numbered first from 1 limb[1] = 1 'First node connected to shape limb[2] = 6 'Second node connected to shape limb["L"] = 75 'Length - distance between nodes limb["W"] = 1 'Width limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) 'Can be any shape or control type including images nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 2 limb[2] = 8 limb["L"] = 250 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 3 limb[2] = 10 limb["L"] = 30 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 4 limb[2] = 9 limb["L"] = 250 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 5 limb[2] = 7 limb["L"] = 75 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb GraphicsWindow.BrushColor = "Brown" 'Left Arm limb[1] = 6 limb[2] = 11 limb["L"] = 30 'Not 19 as a test of non-contiguous nodes limb["W"] = 25 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 11 limb[2] = 30 limb["L"] = 50 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 30 limb[2] = 13 limb["L"] = 70 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Arm limb[1] = 7 limb[2] = 12 limb["L"] = 30 limb["W"] = 25 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 12 limb[2] = 20 limb["L"] = 50 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 20 limb[2] = 13 limb["L"] = 70 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Left Leg limb[1] = 8 limb[2] = 14 limb["L"] = 100 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 14 limb[2] = 15 limb["L"] = 30 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Leg limb[1] = 9 limb[2] = 16 limb["L"] = 100 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 16 limb[2] = 17 limb["L"] = 30 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Head limb[1] = 10 limb[2] = 13 limb["L"] = 50 limb["W"] = 50 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb ''Body limb[1] = 13 limb[2] = 18 limb["L"] = 75 limb["W"] = 40 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb ''Upper Legs limb[1] = 18 limb[2] = 8 limb["L"] = 75 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 18 limb[2] = 9 limb["L"] = 75 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb EndSub '============================================================== ' EVENT SUBROUTINES 'Just log an event to be handled syncronously in the main loop '============================================================== Sub OnMouseDown mouseDown = "True" mouseClicked = "True" EndSub Sub OnMouseUp mouseDown = "False" iSelected = 0 iCompass = 0 EndSub Sub OnKeyDown keyDown = "True" key = GraphicsWindow.LastKey EndSub Sub OnKeyUp keyDown = "False" EndSub Sub OnButttonClicked button = Controls.LastClickedButton buttonPressed = "True" EndSub '============================================================== ' INTERACTION SUBROUTINES 'These subroutines are just about user control and not the main engine or marionette properties 'This is actaully where most of the work is '============================================================== ' Move marionette strings Sub Movement If (mouseClicked) Then 'Initial click is over compass dX = gw-30+20*sin - GraphicsWindow.MouseX dY = 30+20*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iCompass = 1 key = "" KeyChange() EndIf For i = 1 To nNode If (nodes[i]["Shape"] <> "") Then 'Initial click is over a string eX = 100*nodes[i]["X"]/gw eY = 100*nodes[i]["Z"]/gh dX = gw-50+eX*cos+eY*sin - GraphicsWindow.MouseX dY = gh-50-eX*sin+eY*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iSelected = i key = "" KeyChange() EndIf EndIf EndFor mouseClicked = "False" 'Dealt with initial click EndIf If (iCompass > 0) Then 'Schematic selected compass dX = (GraphicsWindow.MouseX - (gw-30)) dY = (GraphicsWindow.MouseY - 30) If (dX < -50 Or dY > 50) Then iCompass = 0 'Deselect if out of box Else If (dY = 0) Then rotate = Math.Pi/2 If (dX < 0) Then rotate = rotate+Math.Pi EndIf ElseIf (dY < 0) Then rotate = Math.ArcTan(dX/dY)+Math.Pi Else rotate = Math.ArcTan(dX/dY) EndIf rotate = Math.Round(rotate*180/Math.Pi) sin = Math.Sin(rotate*Math.Pi/180) cos = Math.Cos(rotate*Math.Pi/180) While (rotate < 0) rotate = rotate+360 EndWhile While (rotate >= 360) rotate = rotate-360 EndWhile EndIf EndIf If (iSelected > 0) Then 'Schematic selected string dX = GraphicsWindow.MouseX - (gw-50) dY = GraphicsWindow.MouseY - (gh-50) If (dX < -50 Or dY < -50) Then iSelected = 0 'Deselect if out of box Else nodes[iSelected]["X"] = (dX*cos-dY*sin)*gw/100 nodes[iSelected]["Z"] = (dX*sin+dY*cos)*gh/100 EndIf Else For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then 'Number selected string nodes[i]["X"] = (GraphicsWindow.MouseX-Xcen)*cos nodes[i]["Y"] = GraphicsWindow.MouseY nodes[i]["Z"] = (GraphicsWindow.MouseX-Xcen)*sin EndIf EndFor EndIf EndSub '3D Rotation Sub Rotation If (key = "Left") Then rotate = rotate-1 If (rotate < 0) Then rotate = rotate + 360 EndIf ElseIf (key = "Right") Then rotate = rotate+1 If (rotate >= 360) Then rotate = rotate - 360 EndIf EndIf cos = Math.Cos(rotate*Math.PI/180) sin = Math.Sin(rotate*Math.PI/180) EndSub 'Do anything required when key pressed Sub KeyChange 'Set label to X when active For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then Shapes.SetText(nodes[i]["Shape"],"X") Else Shapes.SetText(nodes[i]["Shape"],i) EndIf EndFor 'Reset If (key = "F1") Then Reset() keyDown = "False" ' One key press only ElseIf (key = "Space") Then showString = 1-showString ShowStrings() keyDown = "False" ' One key press toggle ElseIf (key = "Escape") Then Program.End() EndIf EndSub 'Do anything required when button pressed Sub ButtonChange 'Mimic a key press for these - therefore only one set of code actually doing the actions where there is duplicate control (key or button) If (button = buttonReset) Then keyDown = "True" key = "F1" ElseIf (button = buttonShowStrings) Then keyDown = "True" key = "Space" ElseIf (button = buttonExit) Then keyDown = "True" key = "Escape" Else For i = 1 To nNode If (button = buttonString[i]) Then keyDown = "True" key = "D"+i EndIf EndFor EndIf buttonPressed = "False" 'Button pressed handled EndSub 'Reset positions and rotation Sub Reset rotate = 0 iString = 0 For i = 1 To nNode If (nodes[i]["Moving"]) Then If (nodes[i]["X"] = "") Then nodes[i]["X"] = -Xcen 'left to right (off to the left to break symmetry and fall nicely) nodes[i]["Y"] = 0 'Up to down nodes[i]["Z"] = 0 'Near to far EndIf Else iString = iString+1 nodes[i]["X"] = (1+iString)/(nString+3)*gw - Xcen nodes[i]["Y"] = 100 nodes[i]["Z"] = 0 EndIf EndFor showString = 1 ShowStrings() EndSub 'Update string hide or show (use opacity) Sub ShowStrings For i = 1 To nLimb If (limbs[i]["W"] <= 2) Then If (showString = 1) Then Shapes.SetOpacity(limbs[i]["Shape"],100) 'Use SetOpacity rather than HideShape as the latter can mess up moving and rotating when made visible again Else Shapes.SetOpacity(limbs[i]["Shape"],0) EndIf EndIf EndFor EndSub '============================================================== ' PHYSICS AND UPDATE SUBROUTINES 'These are called repeatedly and try to be quite efficient '============================================================== 'Do the physics - basically create forces of all connected limbs to a node - including gravity - then move towards a static (zero force) position for each node Sub Update maxTension = 1 'Don't want a possible division by zero For i = 1 To nNode 'Backwards difference to help stability - we could keep track of velocity and momentum , but this is reasonably effective nodes[i]["FX"] = 0.5*nodes[i]["FX"] nodes[i]["FY"] = 0.5*nodes[i]["FY"] nodes[i]["FZ"] = 0.5*nodes[i]["FZ"] EndFor For i = 1 To nLimb limb = limbs[i] 'Node at each end of the limb node1 = nodes[limb[1]] node2 = nodes[limb[2]] '(dX,dY,dZ) is vector from node1 to node2 dX = node2["X"]-node1["X"] dY = node2["Y"]-node1["Y"] dZ = node2["Z"]-node1["Z"] length = Math.SquareRoot(dX*dX+dY*dY+dZ*dZ) tension = (length-limb["L"]) 'Each connected limb provides a force in its direction (either tension or compression depending on separation relative to limb length) 'If (limb["W"] <= 2) Then tension = Math.Max(0,tension) 'Only allow tension - strings don't push - do this for all limbs 'EndIf maxTension = Math.Max(maxTension,Math.Abs(tension)) 'Check each mode is a moving node If (node1["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node1["FX"] = node1["FX"]+tension*dX/length 'Note the + for node1 node1["FY"] = node1["FY"]+tension*dY/length node1["FZ"] = node1["FZ"]+tension*dZ/length 'scale gravity for stability node1["FY"] = node1["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[1]] = node1 'Copy the working copy of node back to the array EndIf If (node2["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node2["FX"] = node2["FX"]-tension*dX/length 'Note the - for node2 node2["FY"] = node2["FY"]-tension*dY/length node2["FZ"] = node2["FZ"]-tension*dZ/length 'scale gravity for stability node2["FY"] = node2["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[2]] = node2 'Copy the working copy of node back to the array EndIf EndFor elasticity = 0.5 'Math.Min(0.5,10/maxTension) 'Limit node movement for stability For i = 1 To nNode node = nodes[i] 'Use this technique in many places - get the sub array (node), work with it, then copy it back at the end of this loop node["X"] = node["X"]+node["FX"]*elasticity node["Y"] = node["Y"]+node["FY"]*elasticity node["Z"] = node["Z"]+node["FZ"]*elasticity nodes[i] = node EndFor EndSub 'Update all graphics based on new positions Sub Draw 'Move limbs - added complexity due to possible rotation For i = 1 To nLimb limb = limbs[i] node1 = nodes[limb[1]] node2 = nodes[limb[2]] centerX = ((node1["X"]+node2["X"])*cos+(node1["Z"]+node2["Z"])*sin)/2 centerY = (node1["Y"]+node2["Y"])/2 dX = (node2["X"]-node1["X"])*cos+(node2["Z"]-node1["Z"])*sin dY = node2["Y"]-node1["Y"] length = Math.SquareRoot(dX*dX+dY*dY) If (dX = 0) Then angle = 90 If (dY < 0) Then angle = angle+180 EndIf ElseIf (dX > 0) Then angle = 180/Math.PI*Math.ArcTan(dY/dX) Else angle = 180 + 180/Math.PI*Math.ArcTan(dY/dX) EndIf Shapes.Move(limb["Shape"],Xcen+centerX-limb["L"]/2,centerY-limb["W"]/2) If (limb["W"] <= 2) then 'Only compress strings - stretch strings or limbs Shapes.Zoom(limb["Shape"],length/limb["L"],1) 'Do zoom before rotation - just stretch in direction of Length Else Shapes.Zoom(limb["Shape"],Math.Max(1,length/limb["L"]),1) EndIf Shapes.Rotate(limb["Shape"],angle) EndFor 'Move string identifier text shapes For i = 1 To nNode node = nodes[i] If (node["Shape"] <> "") Then Shapes.Move(node["Shape"],Xcen+node["X"]*cos+node["Z"]*sin-4,node["Y"]-16) dX = 100*node["X"]/gw dY = 100*node["Z"]/gh Shapes.Move(strings[i],gw-50+dX*cos+dY*sin-3,gh-50-dX*sin+dY*cos-3) EndIf EndFor Shapes.SetText(label,rotate+deg) Shapes.Move(compass,gw-30+20*sin-3,30+20*cos-3) EndSub '************************************************************************************************************* '================================================================================ 'Jibba Jabba ADDS RAIN SUBROUTINES '================================================================================ Sub InitialiseRain GraphicsWindow.BackgroundColor = "Gainsboro" GraphicsWindow.PenColor = "Ivory" GraphicsWindow.BrushColor = "LightCyan" hGap = 30 vGap = 30 dropLength = 45 columns = GraphicsWindow.Width / hGap rows = GraphicsWindow.Height / (dropLength + vGap) For r = 1 To rows For c = 1 To columns dCount = dCount + 1 X = c * hGap Y = (r-1) * (vGap + dropLength) + Math.GetRandomNumber(60) drop[dCount] = Shapes.AddEllipse(5, dropLength- Math.GetRandomNumber(dropLength/2)) Shapes.Rotate(drop[dCount] 10) Shapes.Move(drop[dCount], X, Y) EndFor EndFor EndSub Sub UpdateRain For i = 1 To dCount If Shapes.GetTop(drop[i]) > GraphicsWindow.Height Then Shapes.Move(drop[i], Shapes.GetLeft(drop[i]), 0) EndIf If Shapes.GetLeft(drop[i]) < 1 Then Shapes.Move(drop[i], GraphicsWindow.Width - Math.GetRandomNumber(10), Shapes.GetTop(drop[i])) EndIf EndFor EndSub Sub DrawRain For i = 1 To dCount Shapes.Move(drop[i] Shapes.GetLeft(drop[i])-1, Shapes.GetTop(drop[i]) + Math.GetRandomNumber(50)+10) EndFor EndSub '************************************************************************************************************************ 'END RAIN SUBROUTINES JibbaJabba '************************************************************************************************************************ End>VTD423-1.sb< Start>VTD423.sb< '============================================================== ' PROTOTYPE MARIONETTE PROGRAM FOR SMALL BASIC BIG CHALLENGE 'Do the initialisation and set up events for user interaction '============================================================== Initialise() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp= OnMouseUp GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp Controls.ButtonClicked = OnButttonClicked 'While(mouseDown <> "True") ' Program.Delay(100) 'EndWhile '============================================================== ' MAIN PROGRAM LOOP 'Keep looping '============================================================== While ("True") start = Clock.ElapsedMilliseconds If (mouseDown) Then Movement() EndIf If (keyDown) Then KeyChange() Rotation() EndIf If (buttonPressed) Then ButtonChange() EndIf Update() Draw() delay = 10-(Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile '============================================================== ' INITIALISATION 'Do the main setup and additionally create the marionette geometry (GetPuppet) '============================================================== ' Create all the strings and limbs - nodes are initiated from these Sub Initialise 'Basic window and main variables gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Marionette Prototype" GraphicsWindow.BackgroundColor = "lightYellow" GraphicsWindow.PenWidth = 0 'Stroke hinders rotation visualisation due to Z ordering GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(5,5,"Select string with number key or keypad, then move with mouse button down") GraphicsWindow.DrawText(5,20,"Select and move plan view of strings with mouse") GraphicsWindow.DrawText(5,35,"Rotate using Left and Right keys or compass with mouse") GraphicsWindow.DrawText(5,50,"F1 to reset, Space to toggle show strings, Esc to exit") nNode = 0 'Number of nodes nLimb = 0 'Number of limbs (and strings) nString = 0 'Number of strings rotate = 0 'Rotation showString = 1 'Show strings 0-false 1-true cos = Math.Cos(rotate) sin = Math.Sin(rotate) Xcen = gw/2 'Center of viewing deg = " "+Text.GetCharacter(176) label = Shapes.AddText(rotate+deg) 'Report current angle of rotation Shapes.Move(label,gw-47,22) GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawEllipse(gw-50,10,40,40) GraphicsWindow.DrawRectangle(gw-100,gh-100,100,100) 'For bottom right box GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" compass = Shapes.AddEllipse(6,6) 'Each limb links 2 nodes and has a shape or image with a width and height - strings are width <=2 rectangles 'Coded for 3D , rotation is about Y axis at X=Z=0, then offset for viewing + Xcen '*** It is sufficient to define a model completely by creating a limbs array so this could be loaded from a file *** GetPuppet() 'Set the limbs array 'Nodes - static string nodes (only move with user interaction) have one limb with small width (a string) For i = 1 To nLimb limb = limbs[i] For j = 1 To 2 nNode = Math.Max(nNode,limb[j]) 'This allows non-contiguous node numbers connecting the limbs node = nodes[limb[j]] node["Shape"] = "" node["Moving"] = "True" 'Add limb connected to node node["nLimb"] = node["nLimb"]+1 node[node["nLimb"]] = i nodes[limb[j]] = node EndFor EndFor 'Set static user movable nodes GraphicsWindow.BrushColor = "Red" For i = 1 To nNode node = nodes[i] If (node["nLimb"] = 1 And limbs[node[1]]["W"] <= 2) Then nString = nString+1 node["Shape"] = Shapes.AddText(i) 'Only used for string labeling node["Moving"] = "False" strings[i] = Shapes.AddEllipse(6,6) buttonString[i] = Controls.AddButton(i,50+30*i,gh-30) EndIf nodes[i] = node EndFor Reset() 'Initial coordinates 'Buttons GraphicsWindow.BrushColor = "Black" buttonExit = Controls.AddButton("Exit",5,gh-30) buttonReset = Controls.AddButton("Reset",5,gh-60) buttonShowStrings = Controls.AddButton("Toggle Strings",5,gh-90) EndSub 'Set the puppet topology and properties (strings and limbs) Sub GetPuppet GraphicsWindow.BrushColor = "Black" 'Strings - The top string nodes should usually be numbered first from 1 limb[1] = 1 'First node connected to shape limb[2] = 6 'Second node connected to shape limb["L"] = 75 'Length - distance between nodes limb["W"] = 1 'Width limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) 'Can be any shape or control type including images nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 2 limb[2] = 8 limb["L"] = 250 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 3 limb[2] = 10 limb["L"] = 30 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 4 limb[2] = 9 limb["L"] = 250 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 5 limb[2] = 7 limb["L"] = 75 limb["W"] = 1 limb["Shape"] = Shapes.AddRectangle(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb GraphicsWindow.BrushColor = "Brown" 'Left Arm limb[1] = 6 limb[2] = 11 limb["L"] = 30 'Not 19 as a test of non-contiguous nodes limb["W"] = 25 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 11 limb[2] = 30 limb["L"] = 50 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 30 limb[2] = 13 limb["L"] = 70 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Arm limb[1] = 7 limb[2] = 12 limb["L"] = 30 limb["W"] = 25 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 12 limb[2] = 20 limb["L"] = 50 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 20 limb[2] = 13 limb["L"] = 70 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Left Leg limb[1] = 8 limb[2] = 14 limb["L"] = 100 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 14 limb[2] = 15 limb["L"] = 30 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Right Leg limb[1] = 9 limb[2] = 16 limb["L"] = 100 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 16 limb[2] = 17 limb["L"] = 30 limb["W"] = 15 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb 'Head limb[1] = 10 limb[2] = 13 limb["L"] = 50 limb["W"] = 50 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb ''Body limb[1] = 13 limb[2] = 18 limb["L"] = 75 limb["W"] = 40 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb ''Upper Legs limb[1] = 18 limb[2] = 8 limb["L"] = 75 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb limb[1] = 18 limb[2] = 9 limb["L"] = 75 limb["W"] = 20 limb["Shape"] = Shapes.AddEllipse(limb["L"],limb["W"]) nLimb = nLimb+1 limbs[nLimb] = limb EndSub '============================================================== ' EVENT SUBROUTINES 'Just log an event to be handled syncronously in the main loop '============================================================== Sub OnMouseDown mouseDown = "True" mouseClicked = "True" EndSub Sub OnMouseUp mouseDown = "False" iSelected = 0 iCompass = 0 EndSub Sub OnKeyDown keyDown = "True" key = GraphicsWindow.LastKey EndSub Sub OnKeyUp keyDown = "False" EndSub Sub OnButttonClicked button = Controls.LastClickedButton buttonPressed = "True" EndSub '============================================================== ' INTERACTION SUBROUTINES 'These subroutines are just about user control and not the main engine or marionette properties 'This is actaully where most of the work is '============================================================== ' Move marionette strings Sub Movement If (mouseClicked) Then 'Initial click is over compass dX = gw-30+20*sin - GraphicsWindow.MouseX dY = 30+20*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iCompass = 1 key = "" KeyChange() EndIf For i = 1 To nNode If (nodes[i]["Shape"] <> "") Then 'Initial click is over a string eX = 100*nodes[i]["X"]/gw eY = 100*nodes[i]["Z"]/gh dX = gw-50+eX*cos+eY*sin - GraphicsWindow.MouseX dY = gh-50-eX*sin+eY*cos - GraphicsWindow.MouseY dist = Math.SquareRoot(dX*dX+dY*dY) If (dist <= 3) Then iSelected = i key = "" KeyChange() EndIf EndIf EndFor mouseClicked = "False" 'Dealt with initial click EndIf If (iCompass > 0) Then 'Schematic selected compass dX = (GraphicsWindow.MouseX - (gw-30)) dY = (GraphicsWindow.MouseY - 30) If (dX < -50 Or dY > 50) Then iCompass = 0 'Deselect if out of box Else If (dY = 0) Then rotate = Math.Pi/2 If (dX < 0) Then rotate = rotate+Math.Pi EndIf ElseIf (dY < 0) Then rotate = Math.ArcTan(dX/dY)+Math.Pi Else rotate = Math.ArcTan(dX/dY) EndIf rotate = Math.Round(rotate*180/Math.Pi) sin = Math.Sin(rotate*Math.Pi/180) cos = Math.Cos(rotate*Math.Pi/180) While (rotate < 0) rotate = rotate+360 EndWhile While (rotate >= 360) rotate = rotate-360 EndWhile EndIf EndIf If (iSelected > 0) Then 'Schematic selected string dX = GraphicsWindow.MouseX - (gw-50) dY = GraphicsWindow.MouseY - (gh-50) If (dX < -50 Or dY < -50) Then iSelected = 0 'Deselect if out of box Else nodes[iSelected]["X"] = (dX*cos-dY*sin)*gw/100 nodes[iSelected]["Z"] = (dX*sin+dY*cos)*gh/100 EndIf Else For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then 'Number selected string nodes[i]["X"] = (GraphicsWindow.MouseX-Xcen)*cos nodes[i]["Y"] = GraphicsWindow.MouseY nodes[i]["Z"] = (GraphicsWindow.MouseX-Xcen)*sin EndIf EndFor EndIf EndSub '3D Rotation Sub Rotation If (key = "Left") Then rotate = rotate-1 If (rotate < 0) Then rotate = rotate + 360 EndIf ElseIf (key = "Right") Then rotate = rotate+1 If (rotate >= 360) Then rotate = rotate - 360 EndIf EndIf cos = Math.Cos(rotate*Math.PI/180) sin = Math.Sin(rotate*Math.PI/180) EndSub 'Do anything required when key pressed Sub KeyChange 'Set label to X when active For i = 1 To nNode If (key = "D"+i Or key = "NumPad"+i) Then Shapes.SetText(nodes[i]["Shape"],"X") Else Shapes.SetText(nodes[i]["Shape"],i) EndIf EndFor 'Reset If (key = "F1") Then Reset() keyDown = "False" ' One key press only ElseIf (key = "Space") Then showString = 1-showString ShowStrings() keyDown = "False" ' One key press toggle ElseIf (key = "Escape") Then Program.End() EndIf EndSub 'Do anything required when button pressed Sub ButtonChange 'Mimic a key press for these - therefore only one set of code actually doing the actions where there is duplicate control (key or button) If (button = buttonReset) Then keyDown = "True" key = "F1" ElseIf (button = buttonShowStrings) Then keyDown = "True" key = "Space" ElseIf (button = buttonExit) Then keyDown = "True" key = "Escape" Else For i = 1 To nNode If (button = buttonString[i]) Then keyDown = "True" key = "D"+i EndIf EndFor EndIf buttonPressed = "False" 'Button pressed handled EndSub 'Reset positions and rotation Sub Reset rotate = 0 iString = 0 For i = 1 To nNode If (nodes[i]["Moving"]) Then If (nodes[i]["X"] = "") Then nodes[i]["X"] = -Xcen 'left to right (off to the left to break symmetry and fall nicely) nodes[i]["Y"] = 0 'Up to down nodes[i]["Z"] = 0 'Near to far EndIf Else iString = iString+1 nodes[i]["X"] = (1+iString)/(nString+3)*gw - Xcen nodes[i]["Y"] = 100 nodes[i]["Z"] = 0 EndIf EndFor showString = 1 ShowStrings() EndSub 'Update string hide or show (use opacity) Sub ShowStrings For i = 1 To nLimb If (limbs[i]["W"] <= 2) Then If (showString = 1) Then Shapes.SetOpacity(limbs[i]["Shape"],100) 'Use SetOpacity rather than HideShape as the latter can mess up moving and rotating when made visible again Else Shapes.SetOpacity(limbs[i]["Shape"],0) EndIf EndIf EndFor EndSub '============================================================== ' PHYSICS AND UPDATE SUBROUTINES 'These are called repeatedly and try to be quite efficient '============================================================== 'Do the physics - basically create forces of all connected limbs to a node - including gravity - then move towards a static (zero force) position for each node Sub Update maxTension = 1 'Don't want a possible division by zero For i = 1 To nNode 'Backwards difference to help stability - we could keep track of velocity and momentum , but this is reasonably effective nodes[i]["FX"] = 0.5*nodes[i]["FX"] nodes[i]["FY"] = 0.5*nodes[i]["FY"] nodes[i]["FZ"] = 0.5*nodes[i]["FZ"] EndFor For i = 1 To nLimb limb = limbs[i] 'Node at each end of the limb node1 = nodes[limb[1]] node2 = nodes[limb[2]] '(dX,dY,dZ) is vector from node1 to node2 dX = node2["X"]-node1["X"] dY = node2["Y"]-node1["Y"] dZ = node2["Z"]-node1["Z"] length = Math.SquareRoot(dX*dX+dY*dY+dZ*dZ) tension = (length-limb["L"]) 'Each connected limb provides a force in its direction (either tension or compression depending on separation relative to limb length) 'If (limb["W"] <= 2) Then tension = Math.Max(0,tension) 'Only allow tension - strings don't push - do this for all limbs 'EndIf maxTension = Math.Max(maxTension,Math.Abs(tension)) 'Check each mode is a moving node If (node1["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node1["FX"] = node1["FX"]+tension*dX/length 'Note the + for node1 node1["FY"] = node1["FY"]+tension*dY/length node1["FZ"] = node1["FZ"]+tension*dZ/length 'scale gravity for stability node1["FY"] = node1["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[1]] = node1 'Copy the working copy of node back to the array EndIf If (node2["Moving"]) Then 'Move nodes in direction of totatl force on the node - at static equilibrium the net force on the node is zero in all directions node2["FX"] = node2["FX"]-tension*dX/length 'Note the - for node2 node2["FY"] = node2["FY"]-tension*dY/length node2["FZ"] = node2["FZ"]-tension*dZ/length 'scale gravity for stability node2["FY"] = node2["FY"]+limb["L"]*limb["W"]/1000 nodes[limb[2]] = node2 'Copy the working copy of node back to the array EndIf EndFor elasticity = 0.5 'Math.Min(0.5,10/maxTension) 'Limit node movement for stability For i = 1 To nNode node = nodes[i] 'Use this technique in many places - get the sub array (node), work with it, then copy it back at the end of this loop node["X"] = node["X"]+node["FX"]*elasticity node["Y"] = node["Y"]+node["FY"]*elasticity node["Z"] = node["Z"]+node["FZ"]*elasticity nodes[i] = node EndFor EndSub 'Update all graphics based on new positions Sub Draw 'Move limbs - added complexity due to possible rotation For i = 1 To nLimb limb = limbs[i] node1 = nodes[limb[1]] node2 = nodes[limb[2]] centerX = ((node1["X"]+node2["X"])*cos+(node1["Z"]+node2["Z"])*sin)/2 centerY = (node1["Y"]+node2["Y"])/2 dX = (node2["X"]-node1["X"])*cos+(node2["Z"]-node1["Z"])*sin dY = node2["Y"]-node1["Y"] length = Math.SquareRoot(dX*dX+dY*dY) If (dX = 0) Then angle = 90 If (dY < 0) Then angle = angle+180 EndIf ElseIf (dX > 0) Then angle = 180/Math.PI*Math.ArcTan(dY/dX) Else angle = 180 + 180/Math.PI*Math.ArcTan(dY/dX) EndIf Shapes.Move(limb["Shape"],Xcen+centerX-limb["L"]/2,centerY-limb["W"]/2) If (limb["W"] <= 2) then 'Only compress strings - stretch strings or limbs Shapes.Zoom(limb["Shape"],length/limb["L"],1) 'Do zoom before rotation - just stretch in direction of Length Else Shapes.Zoom(limb["Shape"],Math.Max(1,length/limb["L"]),1) EndIf Shapes.Rotate(limb["Shape"],angle) EndFor 'Move string identifier text shapes For i = 1 To nNode node = nodes[i] If (node["Shape"] <> "") Then Shapes.Move(node["Shape"],Xcen+node["X"]*cos+node["Z"]*sin-4,node["Y"]-16) dX = 100*node["X"]/gw dY = 100*node["Z"]/gh Shapes.Move(strings[i],gw-50+dX*cos+dY*sin-3,gh-50-dX*sin+dY*cos-3) EndIf EndFor Shapes.SetText(label,rotate+deg) Shapes.Move(compass,gw-30+20*sin-3,30+20*cos-3) EndSub End>VTD423.sb< Start>VTF373.sb< 'Just for fun 'leftclick to change pattern and color 'rightclick to change just color GraphicsWindow.Title = "Smoke" GraphicsWindow.Height = 600 GraphicsWindow.Width = 600 GraphicsWindow.CanResize="false" GraphicsWindow.BackgroundColor = "black" GraphicsWindow.Show() color="tomato" init() GraphicsWindow.MouseDown = onmousedown While (1=1) x = math.Sin (a[1]*a[6]) - math.Cos (a[2]*a[5]) y = math.Sin (a[3]*a[5]) - math.Cos (a[4]*a[6]) GraphicsWindow.SetPixel(300+x*100,300+y*100,color) a[5] = x a[6] = y EndWhile Sub init For i = 1 to 6 a[i] = Math.Pi * (1-2*Math.GetRandomNumber(1000)/1000) Endfor Endsub Sub onmousedown color=GraphicsWindow.GetRandomColor() If (Mouse.IsLeftButtonDown="true") Then GraphicsWindow.Clear() init() EndIf EndSub End>VTF373.sb< Start>VTL654.sb< 'go to line 1300 'High score: lvl 10 in 46 days TextWindow.WriteLine("What is your First name?") ddd=TextWIndow.Read() TextWindow.WriteLine("What is your Last name?") yyy=TextWIndow.Read() 'make a sell feature' 'levels and xp' While (1000000<>x) TextWindow.ForegroundColor="cyan" 'You can use a subroutine to change the value of a variable you declared early in the program to a specific or random variable under certain conditions. mainmenu: TextWindow.ForegroundColor="green" p=1 d=d+p TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Day:"+d) TextWindow.WriteLine("Today is: " + Clock.Date + ".") TextWindow.WriteLine("The current time is: " + Clock.Time + ".") TextWindow.WriteLine("The current day of the week is: " + Clock.Weekday + ".") TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" This is a Card Fighting RPG") TextWindow.WriteLine("you will choose a card and then fight other cards of other elements") TextWindow.WriteLine("This is the MainMenu") TextWindow.WriteLine(" P.S answer without Capitals User:"+ddd+" "+ yyy ) TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" Options") TextWindow.WriteLine("Plz Read This (Help)") TextWindow.WriteLine("(Battle) Wins "+ win) TextWindow.WriteLine("(Cards) Loses "+ lose) TextWindow.WriteLine("(Leader boards) Jobs "+ jobs) TextWindow.WriteLine("(player stats)") TextWindow.ForegroundColor="green" TextWindow.WriteLine(" Money:"+m) TextWindow.WriteLine("exp:"+exp2+"/"+eexp) TextWindow.WriteLine("LvL:"+a) TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(Get a Job)") TextWindow.WriteLine("(trophies)") TextWindow.WriteLine("(special store items)") TextWindow.WriteLine("(store)") TextWindow.WriteLine("(Special store)") TextWindow.WriteLine("(travel)") TextWindow.WriteLine("(sell)") x=TextWindow.Read() If(x="cards")then Goto cards ElseIf(x="bank")then Goto bank ElseIf(x="battle")then Goto battle2 ElseIf(x="job")then Goto job ElseIf(x="store")then Goto store ElseIf(x="trophies")then Goto trophies ElseIf(x="cheat")then Goto cheat ElseIf(x="cheat2")then Goto cheat2 ElseIf(x="exp")then Goto exp13 ElseIf(x="travel")then Goto travel ElseIf(x="help")then Goto help ElseIf(x="leader boards")then Goto leaderboards ElseIf(x="special store")then Goto specialstore ElseIf(x="special store items")then Goto specialstoreitems ElseIf(x="sell")then Goto sell 'ElseIf(x="player stats" or x="playerstats")then ' Goto stats TextWindow.WriteLine("") bank: TextWindow.WriteLine("Your Total balence is:"+m) TextWindow.WriteLine("(Mainmenu)") x=TextWIndow.Read() If(x="mainmenu")then Goto exp13 startz: v=Math.GetRandomNumber (250) exp=Math.GetRandomNumber(100) avf=1 lose=0 lose=lose+avf m=m+v TextWindow.WriteLine("You received $"+ v) exp2=exp2+exp TextWindow.WriteLine("You received "+exp+" exp") TextWindow.WriteLine(" ") TextWindow.WriteLine("Press (Exit) to exit battle") x=TextWindow.Read() TextWindow.WriteLine("Wow what a battle!") TextWindow.WriteLine("Press (enter)") x=TextWindow.Read() If(x="")then Goto exp13 startzz: v=Math.GetRandomNumber (250) exp=Math.GetRandomNumber(100) fva=1 win=0 win=win+fva m=m+v TextWindow.WriteLine("You received $"+ v) exp2=exp2+exp TextWindow.WriteLine("You received "+exp+" exp") TextWindow.WriteLine(" ") TextWindow.WriteLine("Press (Exit) to exit battle") x=TextWindow.Read() TextWindow.WriteLine("Wow what a battle!") TextWindow.WriteLine("Press (enter)") x=TextWindow.Read() If(x="")then Goto exp13 battle2: TextWindow.WriteLine("The three starting cards are the (fire) (Ice) and (earth)") TextWindow.WriteLine("Which Card would you like to choose?") x=TextWindow.Read() If(x="fire") Then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You have chosen Fire") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") ElseIf(x="ice") then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You have chosen Ice") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") ElseIf(x="earth") then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You have chosen Earth") TextWindow.WriteLine("what would you like to do?") TextWindow.WriteLine("fight") EndIf TextWindow.ForegroundColor="cyan" x=TextWindow.Read() If(x="fight") Then TextWindow.WriteLine("(start when ready)") EndIf x=TextWindow.Read() If(x="start")then y=Math.GetRandomNumber (300) If(y>0 And y<100)then TextWindow.ForegroundColor="red" TextWindow.WriteLine("You will be fighting a (Fire) card") Goto starta ElseIf(y>101 And y<200)then TextWindow.ForegroundColor="blue" TextWindow.WriteLine("You will be fighting an (Ice) card") Goto startb ElseIf(y>201 And y<300)then TextWindow.ForegroundColor="green" TextWindow.WriteLine("You will be fighting an (earth) card") Goto startc 'Fire card' starta: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaa startaa: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaaa startaaa: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaab startaab: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startabb startabb: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaac startaac: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startacc startacc: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaad startaad: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startadd startadd: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startaae startaae: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startaee startaee: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz 'Ice Card' startb: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startggg startggg: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startggh startggh: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto starthhh starthhh: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto starthhi starthhi: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto starthii starthii: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startiii startiii: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startiij startiij: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startijj startijj: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startjjj startjjj: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startjjk startjjk: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz 'Earth Card' startc: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then h=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+z) l=h-z If (l=h-z) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startm startm: u=100 z=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+z) p=u-z If (p=u-z) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startmm startmm: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startmmm startmmm: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startmmn startmmn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startmnn startmnn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startnnn startnnn: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startnno startnno: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startnoo startnoo: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) l=w-r If (l=w-r) then TextWindow.WriteLine("The opponents card now has:"+l) Goto startooo startooo: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) p=q-r If (p=q-r) then TextWindow.WriteLine("Your card now has:"+p) If(p<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(l<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(l<0 And p<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz EndIf TextWindow.WriteLine("(vb) to Attack") x=TextWindow.Read() If(x="vb") then r=Math.GetRandomNumber (30) TextWindow.WriteLine("You did:"+r) w=l-r If (w=l-r) then TextWindow.WriteLine("The opponents card now has:"+w) Goto startoop startoop: r=Math.GetRandomNumber (30) TextWindow.WriteLine("Your opponent did:"+r) q=p-r If (q=p-r) then TextWindow.WriteLine("Your card now has:"+q) If(q<0)then TextWindow.WriteLine("You Lose") Goto startz ElseIf(w<0)then TextWindow.WriteLine("You Win") Goto startzz ElseIf(w<0 And q<0)then TextWindow.WriteLine("It was a Tie!, both cards died") Goto startz cards: TextWindow.WriteLine("1(Fire) 2(Ice) 3(Earth)") x=TextWindow.Read() If(x=1) Then Goto gh ElseIf(x=2) then Goto hg ElseIf(x=3) then Goto hhg gh: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:80") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:5 KP/H") TextWindow.WriteLine("Evade 12%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:100") TextWindow.WriteLine("MP:70") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:7 KP/H") TextWindow.WriteLine("Evade 10%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu hhg: TextWindow.WriteLine(" Stats") TextWindow.WriteLine("HP:110") TextWindow.WriteLine("MP:50") TextWindow.WriteLine("Damage: 1-30") TextWindow.WriteLine("Movment:4 KP/H") TextWindow.WriteLine("Evade 9%") TextWindow.WriteLine("(MainMenu)") x=TextWindow.Read() If(x="mainmenu") then Goto mainmenu job: TextWindow.WriteLine("What job would you like to take") TextWindow.WriteLine(" Options") TextWindow.WriteLine("Miner") TextWindow.WriteLine("Worker") TextWindow.WriteLine("Teacher") x=TextWindow.Read() If(x="miner")then Goto miner ElseIf(x="worker")then Goto worker ElseIf(x="teacher")then Goto teacher miner: TextWindow.WriteLine("You chose to be a miner") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("---mine") x=TextWindow.Read() If(x="mine")then TextWindow.WriteLine("You just made $125") j=125 If(j=125)then vas=Math.GetRandomNumber(100) exp2=exp2+vas m=m+j jobs4=1 jobs=jobs+jobs4 TextWindow.WriteLine("You got "+vas+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 worker: TextWindow.WriteLine("You chose to be a Office Worker") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("---work") x=TextWindow.Read() If(x="work")then TextWindow.WriteLine("You just made $140") i=140 If(i=140)then fgr=Math.GetRandomNumber(100) exp2=exp2+fgr m=m+i jobs3=1 jobs=jobs+jobs3 TextWindow.WriteLine("You got "+fgr+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 teacher: TextWindow.WriteLine("You chose to be a Teacher") TextWindow.WriteLine("repeat after me to do your job") TextWindow.WriteLine("Press (go) to start") x=TextWindow.Read() If(x="go")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("---teach") x=TextWindow.Read() If(x="teach")then TextWindow.WriteLine("You just made $150") o=150 If(o=150) then vfg=Math.GetRandomNumber(100) exp2=exp2+vfg m=m+o jobs2=1 jobs=jobs+jobs2 TextWindow.WriteLine("You got "+vfg+" exp") TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 store: TextWindow.WriteLine("Welcome to the General store") TextWindow.WriteLine("what would you like to buy?") TextWindow.WriteLine(" Options") TextWindow.WriteLine("(1) Golden trophy $1000") TextWindow.WriteLine("(2) Silver trophy $800") TextWindow.WriteLine("(3) Bronze trophy $500") x=TextWindow.Read() If(x=1 And m>=1000)then Goto golden ElseIf(x=1 And m<1000)then Goto goldena ElseIf(x=2 And m>=800)then Goto silver ElseIf(x=2 And m<800)then Goto silvera ElseIf(x=3 And m>=500)then Goto bronze ElseIf(x=3 And m<500)then Goto bronzea goldena: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silvera: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronzea: TextWindow.WriteLine("Error, you only have $:"+m) TextWindow.WriteLine("If there is no number it means you dont have any money") TextWindow.WriteLine(" main menu") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu golden: TextWindow.WriteLine("You bought the Golden trophy") b=1 j2=j2+b m=m-1000 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu silver: TextWindow.WriteLine("You bought the Silver trophy") p=1 a2=a2+p m=m-800 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu bronze: TextWindow.WriteLine("You bought the Bronze trophy") l=1 r2=r2+l m=m-500 TextWindow.WriteLine("You currently have $:"+m) TextWindow.WriteLine("Press (mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu trophies: TextWindow.WriteLine("Golden trophies:"+j2) TextWindow.WriteLine("") TextWindow.WriteLine("Silver trophies:"+a2) TextWindow.WriteLine("") TextWindow.WriteLine("Bronze trophies:"+r2) TextWindow.WriteLine("(Mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu exp13: If(exp2>0 And exp2<=80)then Goto exp100 ElseIf(exp2>80 And exp2<=150)then Goto exp200 ElseIf(exp2>150 And exp2<=280)then Goto exp300 ElseIf(exp2>280 And exp2<=400)then Goto exp400 ElseIf(exp2>400 And exp2<=540)then Goto exp500 ElseIf(exp2>540 And exp2<=700)then Goto exp600 ElseIf(exp2>700 And exp2<=900)then Goto exp700 ElseIf(exp2>900 And exp2<=1150)then Goto exp800 ElseIf(exp2>1150 And exp2<=1400)then Goto exp900 ElseIf(exp2>1400 And exp2<=1700)then Goto exp000 ElseIf(exp2>1700 And exp2<=2000)then Goto exp010 exp100: TextWindow.ForegroundColor="cyan" a=0 eexp=80 Goto mainmenu exp200: TextWindow.ForegroundColor="cyan" a=1 eexp=150 Goto mainmenu exp300: TextWindow.ForegroundColor="DeepPink" a=2 eexp=280 goto mainmenu exp400: TextWindow.ForegroundColor="DeepPink" a=3 eexp=400 Goto mainmenu exp500: TextWindow.ForegroundColor="DeepPink" a=4 eexp=540 Goto mainmenu exp600: TextWindow.ForegroundColor="yellow" a=5 eexp=700 Goto mainmenu exp700: TextWindow.ForegroundColor="yellow" a=6 eexp=900 Goto mainmenu exp800: TextWindow.ForegroundColor="yellow" a=7 eexp=1150 Goto mainmenu exp900: TextWindow.ForegroundColor="blue" a=8 eexp=1400 Goto mainmenu exp000: TextWindow.ForegroundColor="blue" a=9 eexp=1700 Goto mainmenu exp010: TextWindow.ForegroundColor="purple" a=10 eexp=2000 Goto mainmenu cheat: m=m+10000 Goto mainmenu cheat2: exp2=exp2+200 Goto exp13 help: TextWindow.WriteLine("This is a multi purpose program") TextWindow.WriteLine("it is mainly about money and fighting") TextWindow.WriteLine(" Here are all the features") TextWindow.WriteLine("fighting for money and exp") TextWindow.WriteLine("an exp system, you can lvl up") TextWindow.WriteLine("a money system, you can gain money") TextWindow.WriteLine("you can spend money on different types of trophies") TextWindow.WriteLine(" there is a clock at the top of the main menu") TextWindow.WriteLine("their is also a day counter") TextWindow.WriteLine("you can check you cards starts in the cards section") TextWindow.WriteLine("you can get a job and you will be paid for you efforts") TextWindow.WriteLine("Their is a special store where you buy new items with trophies") TextWindow.WriteLine("(mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto exp13 Goto exp13 'stats: ' TextWindow.WriteLine("Welcome to Your Stats") 'TextWindow.WriteLine("You will receive (5) skill points every lvl") 'TextWindow.WriteLine(" Skills ") 'TextWindow.WriteLine("Strength:"+aaa) 'TextWindow.WriteLine("Stamina:"+bbb) 'TextWindow.WriteLine("Health:"+ccc) 'TextWindow.WriteLine("Mana:"+ddd) 'TextWindow.WriteLine("Agility:"+eee) gg=0 ff=0 leaderboards: TextWindow.WriteLine(" Leader Boards") TextWindow.WriteLine("Money: "+m) TextWindow.WriteLine("Exp: "+exp2) TextWindow.WriteLine("(mainmenu)") x=TextWindow.Read() If(x="mainmenu")then Goto mainmenu specialstore: TextWindow.WriteLine("Special Store") TextWindow.WriteLine("You can Buy special items with trophies") TextWindow.WriteLine(" You currently have ") TextWindow.WriteLine("Golden trophies:"+j2) TextWindow.WriteLine("") TextWindow.WriteLine("Silver trophies:"+a2) TextWindow.WriteLine("") TextWindow.WriteLine("Bronze trophies:"+r2) TextWindow.WriteLine("") TextWindow.WriteLine("Would you like to buy somthing from the special shop?") TextWindow.WriteLine("(yes) (No)") x=TextWindow.Read() If(x="yes")then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Special shop") TextWindow.WriteLine("Which one would you like to buy?") TextWindow.WriteLine("") TextWindow.WriteLine("(1) Golden necklace $2 Gold") TextWindow.WriteLine("(2) Hammer of Wrath $3 Silver") TextWindow.WriteLine("(3) Ak-47 $1 Gold, $ 1 Silver, $ 1 Bronze") TextWindow.WriteLine("(4) Mini-UZi $2 Silver, $1 Bronze") TextWindow.WriteLine("(5) Diamond $5 Bronze") x=TextWindow.Read() If(x=1 And j2>=2) then Goto gold Elseif(x=1 And j2<2)then Goto golda ElseIf(x=2 And a2>=3)then Goto hammer ElseIf(x=2 And a2<3)then Goto hammera ElseIf(x=3 And j2>=1 And a2>=1 And r2>=1)then Goto ak ElseIf(x=3 And j2<1 And a2<1 And r2<1)then Goto aka ElseIf(x=4 And a2>=2 And r2>=1)then Goto mini ElseIf(x=4 And a2<2 And r2<1)then Goto minia ElseIf(x=5 And r2>=5)then Goto diamond ElseIf(x=5 And r2<5)then Goto diamonda gold: vvvv=1 gg2=gg2+vvvv ccc=2 j2=j2-ccc TextWindow.WriteLine("You Bought a Gold Necklace") x=TextWindow.Read() Goto mainmenu golda: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu hammer: aaaa=1 hhh2=hhh2+aaaa ccc=3 a2=a2-ccc TextWindow.WriteLine("You Bought a Hammer of Wrath") x=TextWindow.Read() Goto mainmenu hammera: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu ak: kkkk=1 lll2=lll2+kkkk ccc=1 kkk=1 ppp=1 a2=a2-ccc j2=j2-kkk r2=r2-ppp TextWindow.WriteLine("You Bought an AK-47") x=TextWindow.Read() Goto mainmenu aka: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu mini: uuuu=1 pppp2=pppp2+uuuu zzz=2 yyy=1 a2=a2-zzz r2=r2-yyy TextWindow.WriteLine("You Bought a Mini-UZi") x=TextWindow.Read() Goto mainmenu minia: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu Goto mainmenu diamond: qqqq=1 rrrr2=rrrr2+qqqq eee=5 r2=r2-eee TextWindow.WriteLine("You Bought a Diamond") x=TextWindow.Read() Goto mainmenu diamonda: TextWindow.WriteLine("ERROR, not enough money") x=TextWindow.Read() Goto mainmenu specialstoreitems: TextWindow.WriteLine(" Your special store items ") TextWindow.WriteLine(" Gold necklace: "+gg2) TextWindow.WriteLine(" Hammer of Wrath: "+hhh2) TextWindow.WriteLine(" AK-47: "+lll2) TextWindow.WriteLine(" Mini-UZI: "+pppp2) TextWindow.WriteLine(" Diamond: "+rrrr2) x=TextWindow.Read() Goto mainmenu If(items>0 And items<=500)then Goto itemsa ElseIf(items>500 And items<=700)then Goto itemsb ElseIf(items>700 And items<=1000)then Goto itemsc itemsa: itemsaa=itemsaa+items sell: items=1 travel: itemsb: itemsc: EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndWhile End>VTL654.sb< Start>VTN252.sb< GraphicsWindow.BackgroundColor="teal GraphicsWindow.BrushColor="lime rrr: GraphicsWindow.Title="Sorting ... GraphicsWindow.PenWidth=0 GraphicsWindow.Clear() For x=1 To 20 ww[x]=Math.GetRandomNumber(60)*5+10 rr[x]=Shapes.AddRectangle(ww[x] 15) Shapes.Move(rr[x] 20 10+x*20) EndFor args=0 p20=33 sww="true For m=0 To 2 For n=20 To 2 Step -1 For s1= 1 To n-1 If ww[s1]>ww[n] Then For qq=s1 To n-1 LDCall.Function2("swpp" qq qq+1) EndFor EndIf EndFor EndFor EndFor GraphicsWindow.Title="Done :) GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="white for x=2 to 20 GraphicsWindow.DrawLine(ww[x]+50 x*20+17 ww[x-1]+50 (x-1)*20+17) EndFor Program.Delay(3333) Goto rrr Sub swpp ff=args[1] tt=args[2] c=ww[ff] ww[ff]=ww[tt] ww[tt]=c ft=Shapes.GetTop(rr[ff]) tp=Shapes.GetTop(rr[tt]) Shapes.Animate(rr[ff] 20 tp p20) Shapes.Animate(rr[tt] 20 ft p20) Program.Delay(p20) c=rr[ff] rr[ff]=rr[tt] rr[tt]=c EndSub End>VTN252.sb< Start>VTP343.sb< '***************************************** '** Personal Information Manager v3.0 ** '***************************************** '********************* '** Main Program ** '********************* init() Program.Delay(8000) finish() '********************************* ' ** End of Main Program Loop ** '********************************* '****************** '** Subroutines ** '****************** Sub finish GraphicsWindow.Clear() LDGraphicsWindow.BackgroundImage(Program.Directory + "\resources\fini.jpg") GraphicsWindow.ShowMessage("All done!","Bye") Program.End() EndSub Sub init 'Screen Init GraphicsWindow.Show() GraphicsWindow.Height = Desktop.Height - 100 GraphicsWindow.Width = Desktop.Width - 100 GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height)/2 GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width)/2 GraphicsWindow.CanResize = "false" GraphicsWindow.Title = "P I M" GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(55,0,85) LDGraphicsWindow.Style = 0 LDGraphicsWindow.Icon = Program.Directory + "\resources\EyeOfGod.ico" 'Logo logo = Program.Directory + "\resources\Logo.jpg" GraphicsWindow.DrawResizedImage(logo,0,0,300,200) pbx = Shapes.AddImage(logo) Shapes.Move(pbx,0,0) LDGraphicsWindow.SetFontFromFile(Program.Directory + "\resources\LearningCurve.otf") GraphicsWindow.FontBold = "true" msg = "Personal Information Manager" GraphicsWindow.BrushColor = LDColours.Gold GraphicsWindow.FontSize = 72 GraphicsWindow.DrawText(325,0,msg) GraphicsWindow.FontName = "Consolas" GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 10 GraphicsWindow.DrawText(325,180,"2016 Avdiel Data Solutions") Timer.Interval = 1000 Timer.Tick = OnTick msg = "Messaging line...." ShowMsg() FCControls.RegisterMouseEnterEvent(pbx,OnEnterLogo) EndSub Sub ShowMsg GraphicsWindow.FontName = "Consolas" GraphicsWindow.FontBold = "true" GraphicsWindow.FontItalic = "true" GraphicsWindow.FontSize = 18 GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(10,GraphicsWindow.Height - 30,msg) EndSub '************************ '** End of Subroutines ** '************************ '********************* '** Event Handlers ** '********************* Sub OnEnterLogo msg = "If you want something done right, you muct do it yourself~" ShowMsg() EndSub Sub OnTick GraphicsWindow.FontSize = 16 'Shapes.Remove(day) Shapes.HideShape(day) 'Shapes.Remove(date) Shapes.HideShape(date) 'Shapes.Remove(time) Shapes.HideShape(time) day = Shapes.AddText(Clock.WeekDay) Shapes.Move(day, GraphicsWindow.Width - 100,10) date = Shapes.AddText(Clock.Date) Shapes.Move(date, GraphicsWindow.Width - 100,30) time = Shapes.AddText(Clock.Time) Shapes.Move(time,GraphicsWindow.Width - 100,50) Shapes.ShowShape(day) Shapes.ShowShape(date) Shapes.ShowShape(time) EndSub '**************************** '** End of Event Handlers ** '**************************** '********************* '** End of Program ** '********************* End>VTP343.sb< Start>VTQ957.sb< ' this program uses sb-logger for logging (but you don't need it to run the program) ' http://gallery.technet.microsoft.com/sb-logger-A-Small-Basic-afcc91ad ' can have any value but -1, 0 and 1 NOT_DEFINED = 123 ' create an ascii table for fast character to number translation For i = 0 To 255 ascii[Text.GetCharacter(i)] = i EndFor '-------------------------------------------------------------- ' TEST '-------------------------------------------------------------- N = 1000 ' number of comparisions SHOW_OUTPUT = "False" ' show output (slows down) ' this is done before the clock starts to run, because the test ' should only measure the speed of the TextComparision routine ' and not how fast you can read from a file LoadWords() TextWindow.WriteLine("start test...") start = Clock.ElapsedMilliseconds For i = 1 To N*2 Step 2 text_a = words[i] text_b = words[i+1] 'LOG "" 'LOG "compare " + text_a + " and " + text_b TextCompare() EndFor end = Clock.ElapsedMilliseconds TextWindow.WriteLine(N + " comparisions of two words took " + (end-start) + " ms") '-------------------------------------------------------------- Sub TextCompare index = 1 length = Math.Min(Text.GetLength(text_a), Text.GetLength(text_b)) relation = NOT_DEFINED While (relation = NOT_DEFINED And index <= length) a = ascii[Text.GetSubText(text_a, index, 1)] b = ascii[Text.GetSubText(text_b, index, 1)] 'LOG " index = " + index + ", " + Text.GetSubText(text_a, index, 1) + " = " + a + ", " + Text.GetSubText(text_b, index, 1) + " = " + b If a < b Then 'LOG " " + Text.GetSubText(text_a, index, 1) + " < " + Text.GetSubText(text_b, index, 1) relation = -1 ElseIf a > b Then 'LOG " " + Text.GetSubText(text_a, index, 1) + " > " + Text.GetSubText(text_b, index, 1) relation = 1 Else 'LOG " " + Text.GetSubText(text_a, index, 1) + " = " + Text.GetSubText(text_b, index, 1) EndIf index = index + 1 EndWhile ' if the two words are the same but one is shorter than the other ' [shorter word] < [longer word] If index > length And relation = NOT_DEFINED then If Text.GetLength(text_a) < Text.GetLength(text_b) Then relation = -1 ElseIf Text.GetLength(text_b) < Text.GetLength(text_a) Then relation = 1 Else relation = 0 EndIf EndIf ' output result If SHOW_OUTPUT then If relation = -1 Then TextWindow.WriteLine(text_a + " < " + text_b) ElseIf relation = 1 Then TextWindow.WriteLine(text_b + " < " + text_a) Else TextWindow.WriteLine(text_a + " = " + text_b) EndIf EndIf EndSub ' load the needed words from a file Sub LoadWords TextWindow.WriteLine("load words...") For i = 1 To N*2 Step 2 ' The following line could be harmful and has been automatically commented. ' words[i] = File.ReadLine(Program.Directory + "\words.ard", Math.GetRandomNumber(N)) ' The following line could be harmful and has been automatically commented. ' words[i+1] = File.ReadLine(Program.Directory + "\words.ard", Math.GetRandomNumber(N)) EndFor EndSub End>VTQ957.sb< Start>VTS576.sb< GraphicsWindow.BackgroundColor ="black GraphicsWindow.BrushColor ="white GraphicsWindow .Width=1150 GraphicsWindow.Height =650 GraphicsWindow.PenWidth=0 GraphicsWindow.Title="Optical illusions a8=10 tt ="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 0 0 0 6 c 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 0 6 6 6 c 9 9 9 0 0 0 0 0 0 0 0 0 0 0 0 0 tt=tt+"0 0 6 6 6 6 c 9 9 9 9 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 6 6 6 6 c 9 9 9 9 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 6 6 6 6 6 c 9 9 9 9 9 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 a a a a a 0 5 5 5 5 5 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 9 9 9 9 9 3 6 6 6 6 6 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 9 9 9 9 3 6 6 6 6 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 9 9 9 9 3 6 6 6 6 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 0 9 9 9 3 6 6 6 0 0 0 0 0 0 0 0 0 0 0 0 0 " tt=tt+"0 0 0 0 0 9 3 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " qww=ldtext.Split (tt " ") For x=1 to Array.GetItemCount (qww) step 23 For t=1 To 11 qww[x+t+11]=qww[x+t] EndFor endfor While "true i=0 rr=rr+1 For y=0 To 12 For x=0 To 22 i=i+1 If Math.Remainder (rr 2)=0 then nn=qww[i] Else nn=math.GetRandomNumber (16)-1 endif If nn="" Then bb=0 else bb=LDMath.Base2Decimal ( nn 16) endif If Math.Remainder (i 2)=0 Then GraphicsWindow.BrushColor ="white GraphicsWindow.FillRectangle (x*50 y*50 50 50) GraphicsWindow.BrushColor ="black fll() Else GraphicsWindow.BrushColor ="white fll() endif EndFor endfor Program.Delay (3333) ss=LDShapes.GetAllShapes() For x=1 To Array.GetItemCount(ss) Shapes.Remove (ss[x]) EndFor Program.Delay (1333) endwhile Sub fll If bb>0 and LDBits.AndBits(bb,1)=1 then shapes.Move(Shapes.AddRectangle (a8 a8) x*50+2 y*50+2 ) EndIf If bb>0 and LDBits.AndBits(bb,4)=4 then shapes.Move(Shapes.AddRectangle (a8 a8) x*50+2 y*50+50-a8-2) EndIf If bb>0 and LDBits.AndBits(bb,2)=2 then shapes.Move(Shapes.AddRectangle (a8 a8) x*50+50-a8-2 y*50+2 ) EndIf If bb>0 and LDBits.AndBits(bb,8)=8 then shapes.Move(Shapes.AddRectangle (a8 a8) x*50+50-a8-2 y*50+50-a8-2) EndIf EndSub End>VTS576.sb< Start>VTW600.sb< gh = 600 gw = 600 GraphicsWindow.Height = gh GraphicsWindow.Width = gw TextWindow.Left = GraphicsWindow.Left + 615 TextWindow.Top = GraphicsWindow.Top Mouse.HideCursor() radius = 25 circle = Shapes.AddEllipse(2*radius,2*radius) circleX = gw/2 circleY = gh/2 Shapes.Move(circle,circleX-radius,circleY-radius) Steam_Skin=ImageList.LoadImage("http://public.bay.livefilestore.com/y1pSDvsXajbdg0-y3xRxTA_W7gio52NarIE4aiSvo3pk3QhqsV72UwBk7HWeBd5i6PlZ2W5CtYZzegxsrkfsbLAxA/smoke1.png") 'Steam_Skin = ImageList.LoadImage(Program.Directory + "\smoke1.png") Pi = Math.Pi Smoke_EmitAngle = Pi*(Emitter_Angle/180-0.5) GraphicsWindow.BrushColor = "Black" Emitter = Shapes.AddTriangle(0,0,70,0,35,70) GraphicsWindow.PenWidth=1 While "True" TimeStart = Clock.ElapsedMilliseconds Mouse_X=GraphicsWindow.mouseX Mouse_Y=GraphicsWindow.mouseY Shapes.Move(Emitter,Mouse_X-35,Mouse_Y-35) If Mouse.IsRightButtonDown Then Emitter_Angle = Emitter_Angle+5 Smoke_EmitAngle = Pi*(Emitter_Angle/180-0.5) Shapes.Rotate(Emitter,Emitter_Angle) EndIF If Mouse.IsLeftButtonDown Then Steam_EmitDelay = Steam_EmitDelay + 1 If Steam_EmitDelay = 2 Then SteamEmitter() Steam_EmitDelay = 0 endif endif SteamCode() TextWindow.Clear() TextWindow.WriteLine("Steam Sprites: " + (Steam_New-Steam_Old)) TextWindow.WriteLine("Steam_New: " + Steam_New) TextWindow.WriteLine("Steam_Old: " + Steam_Old) TimeEnd = Clock.ElapsedMilliseconds PassedTime = TimeEnd - TimeStart TextWindow.WriteLine("PassedTime: " + PassedTime) PerfectDelay = 30-PassedTime If PerfectDelay > 0 Then Program.Delay(PerfectDelay) endif endwhile Sub SteamEmitter Steam_New = Steam_New + 1 Steam[Steam_New] = Shapes.AddImage(Steam_Skin) Shapes.Move(Steam[Steam_New],-1000,-1000) Smoke_Velocity = 10+Math.GetRandomNumber(20) Steam_X[Steam_New] = Mouse_X+35*Math.Cos(Smoke_EmitAngle) Steam_Y[Steam_New] = Mouse_Y+35*Math.Sin(Smoke_EmitAngle) Steam_WX[Steam_New] = Math.Cos(Smoke_EmitAngle + (Math.GetRandomNumber(11)-6)*0.03) * Smoke_Velocity Steam_WY[Steam_New] = Math.Sin(Smoke_EmitAngle + (Math.GetRandomNumber(11)-6)*0.03) * Smoke_Velocity Steam_Opacity[Steam_New] = 100 Steam_Angle[Steam_New] = Math.GetRandomNumber(360)-180 Steam_Zoom[Steam_New] = Math.GetRandomNumber(5) * 0.1 + 0.8 endsub Sub SteamCode For s = Steam_Old+1 To Steam_New Steam_WX[s] = Steam_WX[s] * 0.95 Steam_WY[s] = Steam_WY[s] * 0.95 Steam_X[s] = Steam_X[s] + Steam_WX[s] Steam_Y[s] = Steam_Y[s] + Steam_WY[s] Steam_Angle[s] = Steam_Angle[s] + Steam_Angle[s] * 0.006 Steam_Distance[s] = math.SquareRoot((CircleX-Steam_X[s])*(CircleX-Steam_X[s])+(CircleY-Steam_Y[s])*(CircleY-Steam_Y[s])) If Steam_Distance[s] <= radius Then Collision() endif Steam_Zoom[s] = Steam_Zoom[s] + 0.1 Steam_Opacity[s] = Steam_Opacity[s] - 2 If Steam_Opacity[s] <= 0 And s = Steam_Old+1 Then RemoveSteam() endif Shapes.SetOpacity(Steam[s],Steam_Opacity[s]) Shapes.Zoom(Steam[s],Steam_Zoom[s],Steam_Zoom[s]) Shapes.Rotate(Steam[s],Steam_Angle[s]) Shapes.Move(Steam[s],Steam_X[s]-35,Steam_Y[s]-35) endfor endsub Sub RemoveSteam Shapes.Remove(Steam[s]) Steam[s] = "" Steam_X[s] = "" Steam_Y[s] = "" Steam_WX[s] = "" Steam_WY[s] = "" Steam_Opacity[s] = "" Steam_Angle[s] = "" Steam_Zoom[s] = "" Steam_Old = Steam_Old + 1 endsub sub Collision 'Make sure the starting point is outside the circle xP = Steam_X[s]-100*Steam_WX[s] yP = Steam_Y[s]-100*Steam_WY[s] 'get incedence angle (theta) from veolcity If (Steam_WX[s] = 0) Then theta = Math.Pi/2 Else theta = Math.ArcTan(Steam_WY[s]/Steam_WX[s]) EndIf If (Steam_WX[s] < 0) Then theta = theta + Math.Pi EndIf 'Get point of contact and reflection angle A = 1 B = 2*(xP-circleX)*Math.Cos(theta) + 2*(yP-circleY)*Math.Sin(theta) C = (xP-circleX)*(xP-circleX)+(yP-circleY)*(yP-circleY)-radius*radius root = B*B-4*A*C dist2 = (xP-circleX)*(xP-circleX)+(yP-circleY)*(yP-circleY)-radius*radius If (root > 0 And dist2 > 0) Then r1 = (-B+Math.SquareRoot(root))/(2*A) r2 = (-B-Math.SquareRoot(root))/(2*A) If (Math.Abs(r1) < Math.Abs(r2)) Then r = r1 Else r = r2 EndIf If (r > 0) Then ' Only do collision if moving towards circle (-r is moving away) xC = xP+r*Math.Cos(theta) yC = yP+r*Math.Sin(theta) dx = circleX-xC dy = circleY-yC If (dx = 0) Then phi = pi/2 Else phi = Math.ArcTan(dy/dx) EndIf If (dx < 0) Then phi = phi+pi EndIf psi = 2*phi-theta 'The angle psi is already correct in radians emergentangle = psi 'Don't plot the direction lines 'xR = xC-1000*Math.Cos(psi) 'yR = yC-1000*Math.Sin(psi) 'GraphicsWindow.DrawLine(xP,yP,xC,yC) 'GraphicsWindow.DrawLine(xC,yC,xR,yR) 'Reverse smoke direction using current velocity Smoke_Velocity = Math.SquareRoot(Steam_WX[s]*Steam_WX[s]+Steam_WY[s]*Steam_WY[s]) Steam_WX[s] = -Math.Cos(emergentangle) * Smoke_Velocity Steam_WY[s] = -Math.Sin(emergentangle) * Smoke_Velocity EndIf EndIf endsub End>VTW600.sb< Start>VTZ685.sb< ' SmallBasic Version 1.2 ' Program: BaseConverterGUI ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/dc6ef888-5d4c-4806-a58b-51248d6c4ee4/convert-between-decimal-and-hexatrigesimal-numbers-base10-and-base36 ' ImportURL: http://smallbasic.com/program/? (MJF819) ' Extension: LitDev ' Comment: https://stackoverflow.com/questions/34574203/c-sharp-base-converter ' https://stackoverflow.com/questions/923771/quickest-way-to-convert-a-base-10-number-to-any-base-in-net ' Variables: ' ToDo: add tb's & cb's as [] in loops ' gw, gh relativ controlPos ' ================================================================================ upperCase = "True" bOnTop = "True" For n = 2 To 36 arrBase[n] = n EndFor BuildGUI() Controls.ButtonClicked = OnButtonClick GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown ' ////////// SUBs \\\\\\\\\\ Sub BuildGUI GraphicsWindow.CanResize = "" GraphicsWindow.Width = 175 GraphicsWindow.Height = 110 GraphicsWindow.BackgroundColor = "LightCyan" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 11 GraphicsWindow.FontBold = "" GraphicsWindow.Title = "BaseConverter" 'LDGraphicsWindow.Icon = Program.Directory +"\img\BaseConverter.png" LDGraphicsWindow.TopMost = bOnTop tbIn = Controls.AddTextBox(5,5) Controls.SetSize(tbIn, 165,21) tbOut = Controls.AddTextBox(5,80) LDControls.TextBoxReadOnly(tbOut, "True") LDShapes.BrushColour(tbOut, "LightSalmon") Controls.SetSize(tbOut, 165,21) GraphicsWindow.DrawText(5,33, "Base From") cbFrom = LDControls.AddComboBox(arrBase, 40,65) LDControls.ComboBoxSelect(cbFrom, 10) Controls.Move(cbFrom, 65,30) GraphicsWindow.DrawText(115,33, "To") cbTo = LDControls.AddComboBox(arrBase, 40,65) LDControls.ComboBoxSelect(cbTo, 10) Controls.Move(cbTo, 130,30) btn = Controls.AddButton("Convert", 5,50) btnW = LDShapes.Width(btn) btnClr = Controls.AddButton("Clear", 170-btnW,50) Controls.SetSize(btnClr, btnW,25) '' http://www.fileformat.info/info/unicode/char/1f4cc/index.htm 'pin = "📌" ' PUSHPIN, U+1F4CC, 128204, UTF-16 (hex) 0xD83D 0xDCCC (d83ddccc) shpPin = Shapes.AddText("📌") Shapes.Move(shpPin, 85,55) LDShapes.PenColour(shpPin, LDLogic.Switch(LDGraphicsWindow.TopMost, "Gray", "Transparent")) EndSub Sub ConvertDecToBase ' (val, base) -> res chars = "0123456789abcdefghijklmnopqrstuvwxyz" If upperCase Then chars = Text.ConvertToUpperCase(chars) EndIf If val < base Then res = Text.GetSubText(chars, val+1,1) Else While val <> 0 id = Math.Remainder(val, base) res = Text.Append(Text.GetSubText(chars, id+1,1), res) val = Math.Floor(val / base) EndWhile EndIf EndSub Sub ConvertBaseToDec ' (val, base) -> res chars = "0123456789abcdefghijklmnopqrstuvwxyz" ' val AND chars, SAME upper-/lowerCase val = Text.ConvertToLowerCase(val) res = 0 len = Text.GetLength(val) For pow = len-1 To 0 Step -1 ch = Text.GetSubText(val, len-pow,1) GetCharIndex() ' (chars, ch) -> id [0,35] res = res + id * Math.Power(base, pow) EndFor EndSub Sub GetCharIndex ' (chars, ch) -> id [0,35] id = 0 While Text.GetSubText(chars, id+1,1) <> ch id = id + 1 EndWhile EndSub Sub Reset val = "" res = "" LDControls.ComboBoxSelect(cbFrom, 10) LDControls.ComboBoxSelect(cbTo, 10) Controls.SetTextBoxText(tbIn, "") Controls.SetTextBoxText(tbOut, "") EndSub ' ////////// EVENTs \\\\\\\\\\ Sub OnButtonClick lastBtn = Controls.LastClickedButton If lastBtn = btnClr Then Reset() Else val = Controls.GetTextBoxText(tbIn) If val <> "" Then baseFrom = LDControls.ComboBoxGetSelected(cbFrom) baseTo = LDControls.ComboBoxGetSelected(cbTo) If baseFrom <> 10 Then base = baseFrom ConvertBaseToDec() ' (val, base) -> res val = res res = "" EndIf base = baseTo ConvertDecToBase() ' (val, base) -> res Controls.SetTextBoxText(tbOut, res) res = "" EndIf EndIf EndSub Sub OnMouseDown If Mouse.IsRightButtonDown Then LDGraphicsWindow.TopMost = LDLogic.Not(LDGraphicsWindow.TopMost) LDShapes.PenColour(shpPin, LDLogic.Switch(LDGraphicsWindow.TopMost, "Gray", "Transparent")) EndIf EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub End>VTZ685.sb< Start>VVC400.sb< 'Community Challenge Dec 2013. Multi Select 'Round' Buttons 'TODO fix inside btn line to redraw & refactor ctrlBtn name Initialise() While isAnEDP loopStartTime = Clock.ElapsedMilliseconds EventHandlers() RefreshScreen() Delay() EndWhile '============================================================= '1st Order Subroutines '============================================================= Sub EventHandlers If mouseIsDown Then mouseX = GraphicsWindow.MouseX mouseY = GraphicsWindow.MouseY CheckForCtrlBtnSelection() mouseIsDown = "False" EndIf EndSub Sub RefreshScreen If updateCtrlBtn Then X = ctrlBtnOrginX - fillBtnRadius Y = ctrlBtnOrginY[ctrlBtnSelected] - fillBtnRadius If ctrlBtnToggle[ctrlBtnSelected] > 0 Then GraphicsWindow.BrushColor = "black" GraphicsWindow.FillEllipse(X, Y, fillBtnRadius * 2, fillBtnRadius * 2) ElseIf ctrlBtnToggle[ctrlBtnSelected] < 0 Then GraphicsWindow.BrushColor = "white" GraphicsWindow.FillEllipse(X, Y, fillBtnRadius * 2, fillBtnRadius * 2) EndIf updateCtrlBtn = "False" EndIf EndSub Sub Delay loopDelay = 1000/fps - (Clock.ElapsedMilliseconds - loopStartTime) If loopDelay > 0 Then Program.Delay(loopDelay) Else TextWindow.WriteLine("Program lagging by: " + loopDelay * -1 + " ms") EndIf EndSub '============================================================= '2nd Order Subroutines '============================================================= Sub CheckForCtrlBtnSelection For k = 1 To getCtrlBtnCount 'no of ctrl btns (k) For j = 1 To 4 'quadrants (j) For i = (j-1) * 90 To j * 90 '90 degrees / quadrant (i) radians = Math.GetRadians(i) X = Math.Cos(radians) * ctrlBtnRadius + ctrlBtnOrginX Y[k] = Math.Sin(radians) * ctrlBtnRadius + ctrlBtnOrginY[k] If j = 1 And mouseX < X And mouseY < Y[k] Then isSelected[k][1] = "True" EndIf If j = 2 And mouseX > X And mouseY < Y[k] Then isSelected[k][2] = "True" EndIf If j = 3 And mouseX > X And mouseY > Y[k] Then isSelected[k][3] = "True" EndIf If j = 4 And mouseX < X And mouseY > Y[k] Then isSelected[k][4] = "True" EndIf EndFor EndFor If isSelected[k][1] And isSelected[k][2] And isSelected[k][3] And isSelected[k][4] Then ctrlBtnSelected = k ctrlBtnToggle[ctrlBtnSelected] = ctrlBtnToggle[ctrlBtnSelected] * -1 'toggle updateCtrlBtn = "True" 'switch after Screen Updated EndIf EndFor isSelected = "False" EndSub 'Screen Setup/s Sub DrawControlButtons GraphicsWindow.PenWidth = 0 For i = 1 To 360 radians = Math.GetRadians(i) X = Math.Cos(radians) * ctrlBtnRadius + ctrlBtnOrginX X2 = Math.Cos(radians) * (ctrlBtnRadius-4) + ctrlBtnOrginX For j = 1 To 2 Y = Math.Sin(radians) * ctrlBtnRadius + ctrlBtnOrginY[j] Y2 = Math.Sin(radians) * (ctrlBtnRadius-4) + ctrlBtnOrginY[j] GraphicsWindow.FillEllipse(X, Y, ctrlBtnBrushWidth, ctrlBtnBrushWidth) GraphicsWindow.FillEllipse(X2, Y2, ctrlBtnBrushWidth, ctrlBtnBrushWidth) EndFor EndFor EndSub '============================================================== 'Initialise Program - followed by Event Subroutines '============================================================== Sub Initialise GraphicsWindow.Hide() TextWindow.Hide() InitialiseCtrlBtns() InitialiseTheRest() 'has a w/around for GW position when GW hidden TextWindow.Show() GraphicsWindow.Show() Program.Delay(500) 'DrawOpeningScreen DrawControlButtons() 'Register Events GraphicsWindow.MouseDown = OnMouseDown EndSub Sub InitialiseCtrlBtns 'Btn Properties ctrlBtnBrushWidth = 2 ctrlBtnRadius = 20 ctrlBtnOrginX = 100 ctrlBtnOrginY = "1=150;2=200" fillBtnRadius = 15 ctrlBtnToggle = "1=-1;2=-1" 'set toggle property to -1 for Off 'BtnCountMethod getCtrlBtnCount = Array.GetItemCount(ctrlBtnOrginY) * 1 'times columns. EndSub Sub InitialiseTheRest isAnEDP = "True" fps = 50 GraphicsWindow.Title = "" gw = 624 'to centre the GW while hidden, must use/ref default GW width gh = 400 GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = 10 TextWindow.Title = "" TextWindow.Left = 50 TextWindow.Top = 20 EndSub '============================================================ 'Event Subroutines '============================================================ Sub OnMouseDown mouseIsDown = "True" EndSub End>VVC400.sb< Start>VVF658-0.sb< eng="1=1\=1\\\=0\\\;2\\\=0\\\;\;2\=1\\\=0\\\;2\\\=34\\\;\;3\=1\\\=133\\\;2\\\=100\\\;\;4\=1\\\=0\\\;2\\\=100\\\;\;5\=1\\\=0\\\;2\\\=200\\\;\;6\=1\\\=133\\\;2\\\=200\\\;\;7\=1\\\=0\\\;2\\\=266\\\;\;8\=1\\\=0\\\;2\\\=300\\\;\;9\=1\\\=67\\\;2\\\=300\\\;\;10\=1\\\=250\\\;2\\\=209\\\;\;11\=1\\\=250\\\;2\\\=300\\\;\;12\=1\\\=350\\\;2\\\=300\\\;\;13\=1\\\=350\\\;2\\\=209\\\;\;14\=1\\\=533\\\;2\\\=300\\\;\;15\=1\\\=600\\\;2\\\=300\\\;\;16\=1\\\=600\\\;2\\\=266\\\;\;17\=1\\\=467\\\;2\\\=200\\\;\;18\=1\\\=600\\\;2\\\=200\\\;\;19\=1\\\=600\\\;2\\\=100\\\;\;20\=1\\\=467\\\;2\\\=100\\\;\;21\=1\\\=600\\\;2\\\=34\\\;\;22\=1\\\=600\\\;2\\\=0\\\;\;23\=1\\\=533\\\;2\\\=0\\\;\;24\=1\\\=350\\\;2\\\=91\\\;\;25\=1\\\=350\\\;2\\\=0\\\;\;26\=1\\\=250\\\;2\\\=0\\\;\;27\=1\\\=250\\\;2\\\=91\\\;\;28\=1\\\=67\\\;2\\\=0\\\;\;;2=1\=1\\\=270\\\;2\\\=0\\\;\;2\=1\\\=270\\\;2\\\=120\\\;\;3\=1\\\=0\\\;2\\\=120\\\;\;4\=1\\\=0\\\;2\\\=180\\\;\;5\=1\\\=270\\\;2\\\=180\\\;\;6\=1\\\=270\\\;2\\\=300\\\;\;7\=1\\\=330\\\;2\\\=300\\\;\;8\=1\\\=330\\\;2\\\=180\\\;\;9\=1\\\=600\\\;2\\\=180\\\;\;10\=1\\\=600\\\;2\\\=120\\\;\;11\=1\\\=330\\\;2\\\=120\\\;\;12\=1\\\=330\\\;2\\\=0\\\;\;;3=1\=1\\\=0\\\;2\\\=0\\\;\;2\=1\\\=0\\\;2\\\=22\\\;\;3\=1\\\=155\\\;2\\\=100\\\;\;4\=1\\\=245\\\;2\\\=100\\\;\;5\=1\\\=45\\\;2\\\=0\\\;\;;4=1\=1\\\=555\\\;2\\\=0\\\;\;2\=1\\\=355\\\;2\\\=100\\\;\;3\=1\\\=445\\\;2\\\=100\\\;\;4\=1\\\=600\\\;2\\\=22\\\;\;5\=1\\\=600\\\;2\\\=0\\\;\;;5=1\=1\\\=155\\\;2\\\=200\\\;\;2\=1\\\=0\\\;2\\\=278\\\;\;3\=1\\\=0\\\;2\\\=300\\\;\;4\=1\\\=45\\\;2\\\=300\\\;\;5\=1\\\=245\\\;2\\\=200\\\;\;;6=1\=1\\\=355\\\;2\\\=200\\\;\;2\=1\\\=555\\\;2\\\=300\\\;\;3\=1\\\=600\\\;2\\\=300\\\;\;4\=1\\\=600\\\;2\\\=278\\\;\;5\=1\\\=445\\\;2\\\=200\\\;\;; g22=LDColours.GetHue("gold") g2=LDColours.HSLtoRGB(g22 1 .44) bbb=LDShapes.BrushGradient("1=gold;2="+g2 "DD") GraphicsWindow.PenWidth=0 GraphicsWindow.Title="Niue Flag GraphicsWindow.Width=1200 GraphicsWindow.Height=600 LDGraphicsWindow.BackgroundBrush(bbb) For f=1 To 6 GraphicsWindow.BrushColor="white If f>=2 Then GraphicsWindow.BrushColor="red EndIf pp=LDShapes.AddPolygon(eng[f]) If f=1 Then LDEffect.DropShadow(pp "direction=135") EndIf EndFor sss="127 150 480 150 300 41 300 245 300 145 dd=-45 GraphicsWindow.BrushColor="darkblue ee=Shapes.AddRectangle(600 300) LDShapes.ZIndex(ee, -1) ee = Shapes.AddEllipse(95 95) LDShapes.Centre(ee 300 150) ps=LDText.Split(sss " ") For x=1 To 5 GraphicsWindow.BrushColor="gold GraphicsWindow.PenWidth=0 ss=ldShapes.AddStar(5 20 50) Shapes.Zoom(ss .7 .7) mx=(x-1)*2+1 Shapes.move(ss ps[mx]+dd ps[mx+1]+dd) EndFor Shapes.Zoom(ss 1 1) End>VVF658-0.sb< Start>VVG922.sb< Sub InitStarsaq ' Initialize stars in Aquarius star[22]="ra=21 31 33.52;d=-05 34 16.2;m=2.90 star[34]="ra=22 05 47.03;d=-00 19 11.4;m=2.95 star[76]="ra=22 54 39.04;d=-15 49 14.7;m=3.27 star[55]="ra=22 28 49.80;d=-00 01 12.2;m=3.65 star[88]="ra=23 09 26.76;d=-21 10 20.9;m=3.68 star[73]="ra=22 52 36.86;d=-07 34 46.8;m=3.73 star[2] ="ra=20 47 40.53;d=-09 29 44.5;m=3.78 star[48]="ra=22 21 39.30;d=-01 23 14.5;m=3.86 star[98]="ra=23 22 58.30;d=-20 06 01.2;m=3.96 star[62]="ra=22 35 21.33;d=-00 07 02.5;m=4.04 star[71]="ra=22 49 35.51;d=-13 35 33.1;m=4.05 star[43]="ra=22 16 49.97;d=-07 46 59.7;m=4.17 star[90]="ra=23 14 19.33;d=-06 02 54.7;m=4.22 star[91]="ra=23 15 53.28;d=-09 05 15.7;m=4.24 star[33]="ra=22 06 26.21;d=-13 52 10.3;m=4.29 star[99]="ra=23 26 02.82;d=-20 38 30.7;m=4.38 star[93]="ra=23 17 54.20;d=-09 10 57.0;m=4.41 star[55]="ra=22 28 50.10;d=-00 01 12.0;m=4.42 star[3] ="ra=20 47 44.24;d=-05 01 39.4;m=4.43 star[86]="ra=23 06 40.81;d=-23 44 35.2;m=4.48 star[105]="ra=23 42 43.28;d=-14 32 41.1;m=4.49 star[13]="ra=21 09 35.59;d=-11 22 18.0;m=4.50 star[23]="ra=21 37 45.04;d=-07 51 14.9;m=4.68 star[66]="ra=22 43 35.25;d=-18 49 49.1;m=4.68 star[101]="ra=23 33 16.63;d=-20 54 52.3;m=4.70 star[89]="ra=23 09 54.88;d=-22 27 27.3;m=4.71 star[6] ="ra=20 52 39.21;d=-08 58 59.7;m=4.73 star[31]="ra=22 03 18.83;d=-02 09 19.2;m=4.74 star[52]="ra=22 25 16.61;d=+01 22 38.6;m=4.80 star[57]="ra=22 30 38.82;d=-10 40 40.4;m=4.82 star[104]="ra=23 41 45.80;d=-17 48 59.5;m=4.82 star[92]="ra=23 16 50.95;d=-07 43 35.3;m=4.93 star[102]="ra=23 39 47.04;d=-14 13 19.4;m=4.97 star[95]="ra=23 18 57.65;d=-09 36 38.6;m=4.99 star[63]="ra=22 37 45.42;d=-04 13 39.9;m=5.04 star[25]="ra=21 39 33.28;d=+02 14 37.5;m=5.10 star[47]="ra=22 21 35.58;d=-21 35 52.9;m=5.12 star[1] ="ra=20 39 24.83;d=+00 29 11.4;m=5.15 star[108]="ra=23 51 21.32;d=-18 54 33.0;m=5.17 star[94]="ra=23 19 06.37;d=-13 27 17.0;m=5.19 star[97]="ra=23 22 39.10;d=-15 02 21.8;m=5.19 star[94]="ra=23 19 06.51;d=-13 27 30.4;m=5.20 star[59]="ra=22 34 41.50;d=-20 42 28.3;m=5.21 star[68]="ra=22 47 33.19;d=-19 36 46.3;m=5.24 star[106]="ra=23 44 12.06;d=-18 16 36.9;m=5.24 star[107]="ra=23 46 00.84;d=-18 40 42.1;m=5.28 star[32]="ra=22 04 47.43;d=-00 54 22.5;m=5.29 star[41]="ra=22 14 18.02;d=-21 04 28.9;m=5.33 star[42]="ra=22 16 48.04;d=-12 49 53.2;m=5.34 edge = "1=2-6;2=6-22;3=22-34;4=22-33;5=33-43;6=34-43;7=43-57; edge = edge + "8=57-71;9=71-76;10=34-48;11=48-55;12=55-62; edge = edge + "13=62-73;14=73-88;15=62-90;16=90-91;17=91-102; edge = edge + "18=102-98;19=98-104 EndSub Sub InitStars wrap="true For g=1 To 113 star[g]=" " EndFor star[99]="ra=01 31 28.99;d=+15 20 45.0;m=3.62 star[6] ="ra=23 17 09.49;d=+03 16 56.1;m=3.70 star[28]="ra=23 59 18.60;d=+06 51 48.9;m=4.03 star[17]="ra=23 39 56.82;d=+05 37 38.5;m=4.13 star[110]="ra=01 45 23.59;d=+09 09 27.5;m=4.26 star[71]="ra=01 02 56.66;d=+07 53 24.3;m=4.27 star[10]="ra=23 27 58.17;d=+06 22 44.8;m=4.27 star[113]="ra=02 02 02.80;d=+02 45 49.5;m=4.33 star[30]="ra=00 01 57.59;d=−06 00 50.3;m=4.37 star[63]="ra=00 48 40.90;d=+07 35 06.7;m=4.44 star[106]="ra=01 41 25.91;d=+05 29 15.4;m=4.45 star[4] ="ra=23 03 52.61;d=+03 49 12.3;m=4.48 star[18]="ra=23 42 02.88;d=+01 46 49.5;m=4.49 star[83]="ra=01 11 39.59;d=+30 05 23.0;m=4.51 star[33]="ra=00 05 20.15;d=−05 42 28.2;m=4.61 star[111]="ra=01 53 33.34;d=+03 11 14.9;m=4.61 star[84]="ra=01 11 27.19;d=+21 02 04.8;m=4.66 star[85]="ra=01 13 44.94;d=+24 35 01.6;m=4.67 star[90]="ra=01 19 27.98;d=+27 15 50.7;m=4.74 star[98]="ra=01 30 10.94;d=+06 08 38.2;m=4.84 star[27]="ra=23 58 40.41;d=−03 33 20.9;m=4.88 star[8] ="ra=23 26 55.91;d=+01 15 21.0;m=4.95 star[19]="ra=23 46 23.54;d=+03 29 12.7;m=4.95 star[47]="ra=00 28 02.84;d=+17 53 35.1;m=5.01 star[7] ="ra=23 20 20.54;d=+05 22 53.2;m=5.05 star[64]="ra=00 48 58.71;d=+16 56 28.1;m=5.07 star[29]="ra=00 01 49.44;d=−03 01 38.9;m=5.13 star[89]="ra=01 17 47.98;d=+03 36 52.3;m=5.13 star[82]="ra=01 11 06.77;d=+31 25 29.2;m=5.15 star[86]="ra=01 13 43.80;d=+07 34 31.8;m=5.21 star[113]="ra=02 02 02.80;d=+02 45 49.0;m=5.23 star[91]="ra=01 21 07.35;d=+28 44 18.2;m=5.23 star[107]="ra=01 42 29.95;d=+20 16 12.5;m=5.24 star[93]="ra=01 26 15.28;d=+19 10 20.4;m=5.35 star[55]="ra=00 39 55.55;d=+21 26 18.8;m=5.36 star[57]="ra=00 46 32.98;d=+15 28 32.2;m=5.36 star[41]="ra=00 20 35.86;d=+08 11 24.9;m=5.38 star[52]="ra=00 32 35.40;d=+20 17 40.0;m=5.38 star[5] ="ra=23 08 40.84;d=+02 07 39.4;m=5.42 star[2] ="ra=22 59 27.40;d=+00 57 47.1;m=5.43 star[68]="ra=00 57 50.15;d=+28 59 32.0;m=5.44 star[20]="ra=23 47 56.49;d=−02 45 41.8;m=5.49 star[69]="ra=01 02 49.09;d=+31 48 15.6;m=5.50 star[94]="ra=01 26 41.65;d=+19 14 26.0;m=5.50 star[58]="ra=00 47 01.43;d=+11 58 26.2;m=5.51 star[80]="ra=01 08 22.34;d=+05 39 00.8;m=5.51 star[34]="ra=00 10 02.18;d=+11 08 44.9;m=5.54 star[102]="ra=01 37 05.96;d=+12 08 29.4;m=5.54 star[74]="ra=01 05 41.68;d=+21 27 55.7;m=5.55 star[79]="ra=01 07 57.11;d=+20 44 21.6;m=5.56 star[81]="ra=01 09 49.20;d=+19 39 30.2;m=5.57 star[22]="ra=23 51 57.83;d=+02 55 49.5;m=5.59 star[72]="ra=01 05 05.35;d=+14 56 45.6;m=5.64 star[16]="ra=23 36 23.35;d=+02 06 07.5;m=5.68 star[51]="ra=00 32 23.75;d=+06 57 19.6;m=5.69 star[32]="ra=00 02 29.76;d=+08 29 08.1;m=5.70 star[44]="ra=00 25 24.22;d=+01 56 23.0;m=5.77 star[21]="ra=23 49 27.48;d=+01 04 34.3;m=5.77 star[66]="ra=00 54 35.22;d=+19 11 18.4;m=5.80 edge = "1=69-83;2=83-90;3=90-85;4=85-74;5=74-84;6=84-99;7=99-110; edge = edge + "8=110-113;9=113-106;10=106-71;11=71-63;12=63-28; edge = edge + "13=28-10;14=10-6;15=6-8;16=8-18 EndSub End>VVG922.sb< Start>VVK362.sb< 'Event Definition Controls.ButtonClicked = OnButtonClicked Controls.TextTyped = OnTextType GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.TextInput = OnTextInput Timer.Tick = OnTimerTick Timer.Interval = 400 'Initialisation Init() 'Main Loop While PE = F start = Clock.ElapsedMilliseconds Eventreaction() delay = 10 - (Clock.ElapsedMilliseconds - start)   If (delay > 0) Then     Program.Delay(delay)   EndIf EndWhile Program.End() 'Subroutines Sub Eventreaction 'By a status (True) from event start a subroutine if OBC = T Then OBC = F ReactionButtonClicked() 'Controls.ButtonClicked = OnButtonClicked ElseIf OTTi = T Then OTTi = F ReactionTimerTicked() 'Timer.Tick = OnTimerTick ElseIf OTI = T Then OTI = F ReactionTextInput() 'GraphicsWindow.TextInput = OnTextInput ElseIf OTT = T Then OTT = F ReactionTextTyped() 'Controls.TextTyped = OnTextType ElseIf OKD = T Then OKD = F ReactionKeyDown() 'GraphicsWindow.KeyDown = OnKeyDown ElseIf OKU = T Then OKU = F ReactionKeyUp() 'GraphicsWindow.KeyUp = OnKeyUp ElseIf OMU = T Then OMU = F ReactionMouseUp() 'GraphicsWindow.MouseUp = OnMouseUp ElseIf OMD = T Then OMD = F ReactionMouseDown() 'GraphicsWindow.MouseDown = OnMouseDown ElseIf OMM = T Then OMM = F ReactionMouseMove() 'GraphicsWindow.MouseMove = OnMouseMove EndIf EndSub Sub ReactionButtonClicked ''Controls.ButtonClicked = OnButtonClicked LCB = Controls.LastClickedButton ShTe = Text.Append(LCB, " was clicked") Shapes.SetText(S[18], ShTe) If LCB = Button[4] Then PE = T ElseIf LCB = Button[1] Then Controls.HideControl(Button[1]) Controls.ShowControl(Button[2]) ElseiF LCB = Button[2] Then Controls.HideControl(Button[2]) Controls.ShowControl(Button[3]) ElseIf LCB = Button[3] Then Controls.HideControl(Button[3]) Controls.ShowControl(Button[1]) EndIf EndSub Sub ReactionTextTyped ''Controls.TextTyped = OnTextType MLTBText = Controls.GetTextBoxText(MLTB) ShTe = Text.Append("MLTB = ", MLTBText) Shapes.SetText(S[18], ShTe) EndSub Sub ReactionKeyDown ''GraphicsWindow.KeyDown = OnKeyDown LKDTC = GraphicsWindow.LastKey Shapes.SetText(S[3], LKDTC) EndSub Sub ReactionKeyUp ''GraphicsWindow.KeyUp = OnKeyUp LKUTC = GraphicsWindow.LastKey Shapes.SetText(S[7], LKUTC) EndSub Sub ReactionMouseDown 'GraphicsWindow.MouseDown = OnMouseDown MD = T Shapes.SetText(S[11], "Down") Shapes.SetText(S[13], " ") EndSub Sub ReactionMouseUp 'GraphicsWindow.MouseUp = OnMouseUp Shapes.SetText(S[11], " ") Shapes.SetText(S[13], "Up") MD = F EndSub Sub ReactionMouseMove ''GraphicsWindow.MouseUp = OnMouseUp mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY Shapes.SetText(S[15], mx+"/"+my) If MD = T Then GraphicsWindow.DrawLine(omx, omy, mx, my) ShTe = Text.Append("Move ", omx) ShTe = Text.Append(omx, " : ") ShTe = Text.Append(ShTe, omy) ShTe = Text.Append(ShTe, " to ") ShTe = Text.Append(ShTe, mx) ShTe = Text.Append(ShTe, " : ") ShTe = Text.Append(ShTe, my) Shapes.SetText(S[18], ShTe) EndIf omx = mx omy = my EndSub Sub ReactionTextInput 'GraphicsWindow.TextInput = OnTextInput LKDT = GraphicsWindow.LastText Shapes.SetText(S[18], "Text Input: " + LKDT) EndSub Sub ReactionTimerTicked 'Timer.Tick = OnTimerTick TCount = Clock.Time Shapes.SetText(S[19], TCount) EndSub Sub Init GraphicsWindow.Show() gww = Desktop.Width - 20 gwh = Desktop.Height - 80 GraphicsWindow.Top = 0 GraphicsWindow.Left = 5 GraphicsWindow.Width = gww GraphicsWindow.Height = gwh T = "True" F = "False" OBC = F OTT = F OKD = F OKU = F OMD = F OMM = F OMU = F OTI = F OTT = F PE = F TCount = "00:00:00" 'Button Defination BT[1] = "Button-1" BT[2] = "Button-2" BT[3] = "Button-3" BT[4] = "Program End" BX = 10 BY = 10 For i = 1 To 4 Button[i] = Controls.AddButton(BT[i], BX, BY) BX = BX + 150 EndFor Controls.HideControl(Button[2]) Controls.HideControl(Button[3]) 'MultiLineTextBox Defination MLTBT = "Multi Line Text Box" S[1] = Shapes.AddText(MLTBT) Shapes.Move(S[1], 10, 60) MLTB = Controls.AddMultiLineTextBox(10, 80) Controls.SetSize(MLTB, gww-20, 100) 'Showing Key-Down S[2] = Shapes.AddText("Key Down Textcode") Shapes.Move(S[2], 10, 200) S[3] = Shapes.AddText(" ") Shapes.Move(S[3], 10, 220) 'Showing Key-Up S[6] = Shapes.AddText("Key Up Textcode") Shapes.Move(S[6], 310, 200) S[7] = Shapes.AddText(" ") Shapes.Move(S[7], 310, 220) 'Showing Mouse Down S[10] = Shapes.AddText("Mouse") Shapes.Move(S[10], 10, 250) S[11] = Shapes.AddText(" ") Shapes.Move(S[11], 10, 270) 'Showing Mouse Up S[12] = Shapes.AddText("Mouse") Shapes.Move(S[12], 160, 250) S[13] = Shapes.AddText("Up") Shapes.Move(S[13], 160, 270) 'Showing Mouse Coordinate mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY omx = mx omy = my S[14] = Shapes.AddText("Mouse X Y") Shapes.Move(S[14], 310, 250) S[15] = Shapes.AddText(" ") Shapes.Move(S[15], 310, 270) 'TextBox Defination TBT = "Text Box" S[16] = Shapes.AddText(TBT) Shapes.Move(S[16], 10, 300) TB = Controls.AddTextBox(10, 330) 'ShowingText S[17] = Shapes.AddText("Show Text:") Shapes.Move(S[17], 10, 360) S[18] = Shapes.AddText(" ") Shapes.Move(S[18], 10, 380) Controls.SetSize(S[18], gww - 20, 200) 'Showing Timer S[19] = Shapes.AddText("0") Shapes.Move(S[19], gww-100, 15) EndSub 'Init 'Subroutines Events Sub OnButtonClicked 'Controls.ButtonClicked = OnButtonClicked OBC = T EndSub Sub OnTextType 'Controls.TextTyped = OnTextType OTT = T EndSub Sub OnKeyDown 'GraphicsWindow.KeyDown = OnKeyDown OKD = T EndSub Sub OnKeyUp 'GraphicsWindow.KeyUp = OnKeyUp OKU = T EndSub Sub OnMouseDown 'GraphicsWindow.MouseDown = OnMouseDown OMD = T EndSub Sub OnMouseMove 'GraphicsWindow.MouseMove = OnMouseMove OMM = T EndSub Sub OnMouseUp 'GraphicsWindow.MouseUp = OnMouseUp OMU = T EndSub Sub OnTextInput 'GraphicsWindow.TextInput = OnTextInput OTI = T EndSub Sub OnTimerTick 'Timer.Tick = OnTimerTick OTTi = T EndSub End>VVK362.sb< Start>VVK587.sb< gw = 600 gh = 450 GraphicsWindow.Width = gw GraphicsWindow.Height = gh X = 200 Y = 100 dX = 1 dY = 1 width = 100 height = 100 GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.FillRectangle(X, Y, width, height) GraphicsWindow.DrawLine(0, 0, X, Y) '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ' Main Loop '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ While 1=1 If flag = "Zoom In" Then ZoomIn() flag = 0 ElseIf flag = "Zoom Out" Then ZoomOut() flag = 0 EndIf Program.Delay(5) EndWhile '================================================= ' Event Handler '================================================= Sub OnKeyDown If GraphicsWindow.LastKey = "I" Then flag = "Zoom In" ElseIf GraphicsWindow.LastKey = "O" Then flag = "Zoom Out" EndIf EndSub '------------------------------------------------------------------------------------- ' Subroutines '------------------------------------------------------------------------------------- Sub ZoomIn WhiteOutLine() 'could use this to fill in the sides c = 1 SetCoordinates() DrawLine() GraphicsWindow.FillRectangle(X, Y, width, height) EndSub Sub ZoomOut GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(X, Y, width, height) WhiteOutLine() c = -1 SetCoordinates() DrawLine() GraphicsWindow.BrushColor = "Blue" GraphicsWindow.FillRectangle(X, Y, width, height) EndSub Sub DrawLine GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine(0, 0, X, Y) EndSub Sub WhiteOutLine GraphicsWindow.PenWidth = 4 'change this to 2 or 4, and see what happens GraphicsWindow.PenColor = "white" GraphicsWindow.DrawLine(0, 0, X, Y) EndSub Sub SetCoordinates X = X - dX * c Y = Y - dY * c width = width + dX * 2 * c height = height + dY * 2 * c EndSub End>VVK587.sb< Start>VVK736.sb< asdd() asda() Sub asda Controls.ButtonClicked = ButtonDown1 EndSub Sub asdd GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 28 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(125, 10, "Дүрсийн периметр ба талбай") GraphicsWindow.FontSize = 12 m1=Controls.AddButton("Дөрвөн өнцөгт"220,70) Controls.SetSize(m1,200,25) m2=Controls.AddButton("Тэгш өнцөгт"220,110) Controls.SetSize(m2,200,25) m3=Controls.AddButton("Гурвалжин"220,150) Controls.SetSize(m3,200,25) m4=Controls.AddButton("Зөв гурвалжин"220,190) Controls.SetSize(m4,200,25) m5=Controls.AddButton("Квадрат"220,230) Controls.SetSize(m5,200,25) m6=Controls.AddButton("Ромбо"220,270) Controls.SetSize(m6,200,25) m7=Controls.AddButton("Параллелограмм"220,310) Controls.SetSize(m7,200,25) m8=Controls.AddButton("Зөв олон өнцөг өнцөгт"220,350) Controls.SetSize(m8,200,25) i20="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг_logo11.jpg" GraphicsWindow.DrawResizedImage(i20, 510,10,100,100) EndSub Sub ButtonDown1 q = Controls.GetButtonCaption(Controls.LastClickedButton) If q = "Дөрвөн өнцөгт" Then GraphicsWindow.Clear() asdasd() CreateGUI() ButtonDown() endif If q = "Тэгш өнцөгт" Then GraphicsWindow.Clear() asdd1() CreateGUI1() ButtonDown11() endif If q = "Гурвалжин" Then GraphicsWindow.Clear() asdd3() CreateGUI3() ButtonDown3() endif If q = "Зөв гурвалжин" Then GraphicsWindow.Clear() asdasd4() CreateGUI4() ButtonDown4() endif If q = "Квадрат" Then GraphicsWindow.Clear() asdasd5() CreateGUI5() ButtonDown5() endif If q = "Ромбо" Then GraphicsWindow.Clear() asdasd6() CreateGUI6() ButtonDown6() endif If q = "Параллелограмм" Then GraphicsWindow.Clear() asdasd7() CreateGUI7() ButtonDown7() endif If q = "Зөв олон өнцөг өнцөгт" Then GraphicsWindow.Clear() asdasd8() CreateGUI8() ButtonDown8() endif EndSub '-----------------------------------------------------1111111111111111111111111111111111 Sub asdasd GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 28 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(200, 10, "Дөрвөн өнцөгт") Turtle.Speed=10 Turtle.x=200 Turtle.y=40 Turtle.Turn(90) Turtle.Move(190) Turtle.Hide() CreateGUI() Controls.ButtonClicked = ButtonDown EndSub sub CreateGUI GraphicsWindow.FontSize = 12 z=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z, 60, 25) o=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o, 60, 25) y=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y, 60, 25) v=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v, 80, 25) GraphicsWindow.BrushColor = "black" textbox2 = Controls.AddTextBox(265, 160) Controls.SetSize(textbox2, 30, 20) GraphicsWindow.DrawText(243, 160, "AB:") GraphicsWindow.BrushColor = "black" textbox3 = Controls.AddTextBox(265, 190) Controls.SetSize(textbox3, 30, 20) GraphicsWindow.DrawText(243, 190, "BC:") GraphicsWindow.BrushColor = "black" textbox4 = Controls.AddTextBox(265, 220) Controls.SetSize(textbox4, 30, 20) GraphicsWindow.DrawText(243, 220, "CD:") GraphicsWindow.BrushColor = "black" textbox5 = Controls.AddTextBox(265, 250) Controls.SetSize(textbox5, 30, 20) GraphicsWindow.DrawText(243, 250, "DA:") h=Controls.AddMultiLineTextBox(285, 285) Controls.SetSize(h, 70, 20) GraphicsWindow.DrawText(285,270, "Хариу P") s=Controls.AddMultiLineTextBox(360, 285) Controls.SetSize(s, 150, 20) GraphicsWindow.DrawText(360,270, "Хариу S") butsah=Controls.AddButton("Буцах"500,400) EndSub '--------------------------------------------------------------------------- Sub ButtonDown T2 = controls.GetTextBoxText(textbox2) T3 = controls.GetTextBoxText(textbox3) T4 = controls.GetTextBoxText(textbox4) T5 = controls.GetTextBoxText(textbox5) operator = Controls.GetButtonCaption(Controls.LastClickedButton) If operator = "Зурах" Then Controls.SetTextBoxText(h, "") zurah() EndIf if operator = "Онол" Then Controls.SetTextBoxText(h, "") onol() EndIf if operator = "Бодох" Then If t2="" And t3="" And t4="" And t5="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum=T2+T3+T4+T5 Controls.SetTextBoxText(h, sum) talbai=(Math.Power((sum/2)*(sum/2-T2)*(sum/2-T3)*(sum/2-T4)*(sum/2-T5),1/2)) Controls.SetTextBoxText(s, talbai) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(100, 270, T2) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(210, 300, T3) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(120, 380, T4) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(8, 350, T5) zurah() EndIf EndIf if operator = "Буцах" Then GraphicsWindow.Clear() asda() asdd() Turtle.Angle=0 ButtonDown1() EndIf If operator = "Цэвэрлэх" Then Controls.SetTextBoxText(h, "") Controls.SetTextBoxText(s, "") Controls.SetTextBoxText(textbox2, "") Controls.SetTextBoxText(textbox3, "") Controls.SetTextBoxText(textbox4, "") Controls.SetTextBoxText(textbox5, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(100,270,80,20) GraphicsWindow.FillRectangle(210,300,80,20) GraphicsWindow.FillRectangle(120,380,80,20) GraphicsWindow.FillRectangle(8,350,80,20) EndIf EndSub sub zurah Turtle.x=30 Turtle.y=400 Turtle.Turn(-90) Turtle.Move(80) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(28, 300, GraphicsWindow.Width, "A") Turtle.Turn(75) Turtle.Move(160) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(100, 270, T2) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(190, 270, GraphicsWindow.Width, "B") Turtle.Turn(75) Turtle.Move(80) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(210, 300, T3) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(225, 340, GraphicsWindow.Width, "C") Turtle.Turn(105) Turtle.Move(200) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(120, 380, T4) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(26, 400, GraphicsWindow.Width, "D") 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(8, 350, T5) EndSub '-------------------------------------------------------------------- Sub onol i111="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг1.1.jpg" GraphicsWindow.DrawImage(i111, 390, 70) i1="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг1.jpg" GraphicsWindow.DrawImage(i1, 50, 70) EndSub '---------------------------------------------------------------------------------- 2222 Sub asdd1 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 28 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(200, 10, "Тэгш өнцөгт") Turtle.Speed=10 Turtle.x=200 Turtle.y=40 Turtle.Turn(90) Turtle.Move(160) Turtle.Hide() CreateGUI1() Controls.ButtonClicked = ButtonDown11 EndSub sub CreateGUI1 GraphicsWindow.FontSize = 12 z1=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z1, 60, 25) o1=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o1, 60, 25) y1=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y1, 60, 25) l1=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(l1, 80, 25) GraphicsWindow.BrushColor = "black" textbox22 = Controls.AddTextBox(333, 160) Controls.SetSize(textbox22, 30, 20) textbox33 = Controls.AddTextBox(333, 190) Controls.SetSize(textbox33, 30, 20) GraphicsWindow.DrawText(290, 165, "өргөн:") GraphicsWindow.DrawText(300, 195, "Урт:") GraphicsWindow.BrushColor = "black" h1=Controls.AddMultiLineTextBox(265, 220) Controls.SetSize(h1, 150, 20) GraphicsWindow.DrawText(210,223, "Хариу P:") s1=Controls.AddMultiLineTextBox(265, 245) Controls.SetSize(s1, 150, 20) GraphicsWindow.DrawText(210,248, "Хариу S:") butsah=Controls.AddButton("Буцах"500,400) EndSub '--------------------------------------------------------------------------- Sub ButtonDown11 T22 = controls.GetTextBoxText(textbox22) T33= controls.GetTextBoxText(textbox33) operator1 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator1 = "Зурах" Then Controls.SetTextBoxText(h1, "") zurah1() EndIf if operator1 = "Онол" Then Controls.SetTextBoxText(h1, "") onol1() EndIf if operator1 = "Бодох" Then If t22="" And t33="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum1=(T22+T33)*2 Controls.SetTextBoxText(h1, sum1) talbai1=T22*T33 Controls.SetTextBoxText(s1, talbai1) GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = "true" GraphicsWindow.BrushColor = "red" GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(10, 350, T22) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(100, 299, T33) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(185, 350, T22) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(100, 400, T33) zurah1() EndIf EndIf if operator1 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf if operator1 = "Цэвэрлэх" Then Controls.SetTextBoxText(h1,"") Controls.SetTextBoxText(s1,"") Controls.SetTextBoxText(textbox22,"") Controls.SetTextBoxText(textbox33,"") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(10,350,80,20) GraphicsWindow.FillRectangle(100,299,80,20) GraphicsWindow.FillRectangle(185,350,80,20) GraphicsWindow.FillRectangle(100,400,80,20) EndIf EndSub sub zurah1 Turtle.Turn(0) Turtle.x=30 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 390, GraphicsWindow.Width, "A") Turtle.Turn(-90) Turtle.Move(80) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(10, 350, T22) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 308, GraphicsWindow.Width, "B") Turtle.Turn(90) Turtle.Move(150) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(100, 299, T33) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(185, 308, GraphicsWindow.Width, "C") Turtle.Turn(90) Turtle.Move(80) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(185, 350, T22) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(185, 390, GraphicsWindow.Width, "D") Turtle.Turn(90) Turtle.Move(150) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(100, 400, T33) GraphicsWindow.BrushColor="red" 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol1 i112="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\зураг2.2.jpg"" GraphicsWindow.DrawImage(i112, 420, 70) i11="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг2.jpg"" GraphicsWindow.DrawImage(i11, 50, 70) EndSub '-----------------------------------------------------------------------3333 Sub asdd3 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 25 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(240, 10, "Гурвалжин") Turtle.Speed=10 Turtle.x=240 Turtle.y=40 Turtle.Turn(90) Turtle.Move(130) Turtle.Hide() CreateGUI3() Controls.ButtonClicked = ButtonDown3 EndSub sub CreateGUI3 GraphicsWindow.FontSize = 12 z3=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z3, 60, 25) o3=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o3, 60, 25) y3=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y3, 60, 25) v3=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v3, 80, 25) GraphicsWindow.BrushColor = "black" textbox23 = Controls.AddTextBox(265, 160) Controls.SetSize(textbox23, 30, 20) GraphicsWindow.DrawText(243, 160, "AB:") GraphicsWindow.BrushColor = "black" textbox333 = Controls.AddTextBox(265, 190) Controls.SetSize(textbox333, 30, 20) GraphicsWindow.DrawText(243, 190, "BC:") GraphicsWindow.BrushColor = "black" textbox43 = Controls.AddTextBox(265, 220) Controls.SetSize(textbox43, 30, 20) GraphicsWindow.DrawText(243, 220, "CA:") GraphicsWindow.BrushColor = "black" h3=Controls.AddMultiLineTextBox(265, 262) Controls.SetSize(h3, 150, 20) GraphicsWindow.DrawText(285,246, "Хариу P") s3=Controls.AddMultiLineTextBox(265, 298) Controls.SetSize(s3, 150, 20) GraphicsWindow.DrawText(285,283, "Хариу S") butsah=Controls.AddButton("Буцах"500,400) EndSub '--------------------------------------------------------------------------- Sub ButtonDown3 T23 = controls.GetTextBoxText(textbox23) T333 = controls.GetTextBoxText(textbox333) T43 = controls.GetTextBoxText(textbox43) operator3 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator3 = "Зурах" Then Controls.SetTextBoxText(h3, "") zurah3() EndIf if operator3 = "Онол" Then Controls.SetTextBoxText(h3, "") onol3() EndIf if operator3 = "Бодох" Then If t23="" And T333="" And t43="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum3=T23+T333+T43 Controls.SetTextBoxText(h3, sum3) talbai3=(Math.Power((sum3/2)*(sum3/2-T23)*(sum3/2-T333)*(sum3/2-T43),1/2)) Controls.SetTextBoxText(s3, talbai3) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(32, 320, T23) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(151, 290, T333) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(120, 370, T43) zurah3() EndIf EndIf If operator3 = "Цэвэрлэх" Then Controls.SetTextBoxText(h3, "") Controls.SetTextBoxText(s3, "") Controls.SetTextBoxText(textbox23, "") Controls.SetTextBoxText(textbox333, "") Controls.SetTextBoxText(textbox43, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(32,320,80,20) GraphicsWindow.FillRectangle(151,290,80,20) GraphicsWindow.FillRectangle(120,370,80,20) EndIf if operator3 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf EndSub sub zurah3 Turtle.Turn(0) Turtle.x=30 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 390, GraphicsWindow.Width, "A") Turtle.Turn(-70) Turtle.Move(130) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(32, 320, T23) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(68, 260, GraphicsWindow.Width, "B") Turtle.Turn(90) Turtle.Move(160) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(151, 290, T333) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(228, 325, GraphicsWindow.Width, "C") Turtle.Turn(141) Turtle.Move(207) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(120, 370, T43) 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol3 i13="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг3.jpg" GraphicsWindow.DrawImage(i13, 50, 70) i133="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг3.3.jpg" GraphicsWindow.DrawImage(i133, 410, 70) EndSub '------------------------------------44444444444444444444444 'GraphicsWindow.BackgroundColor = "Green" 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Sub asdasd4 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 24 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(210, 10, "Зөв гурвалжин") Turtle.Speed=10 Turtle.Turn(90) Turtle.x=210 Turtle.y=40 Turtle.Move(170) Turtle.Hide() CreateGUI4() Controls.ButtonClicked = ButtonDown4 butsah=Controls.AddButton("Буцах"500,400) EndSub sub CreateGUI4 GraphicsWindow.FontSize = 12 z4=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z4, 60, 25) o4=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o4, 60, 25) y4=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y4, 60, 25) v4=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v4, 80, 25) GraphicsWindow.BrushColor = "black" textbox24 = Controls.AddTextBox(265, 160) Controls.SetSize(textbox24, 30, 20) GraphicsWindow.DrawText(243, 160, "AB:") h4=Controls.AddMultiLineTextBox(265, 202) Controls.SetSize(h4, 150, 20) GraphicsWindow.DrawText(285,186, "Хариу P") s4=Controls.AddMultiLineTextBox(265, 238) Controls.SetSize(s4, 150, 20) GraphicsWindow.DrawText(285,223, "Хариу S") EndSub '--------------------------------------------------------------------------- Sub ButtonDown4 T24 = controls.GetTextBoxText(textbox24) operator4 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator4 = "Зурах" Then Controls.SetTextBoxText(h4, "") zurah4() EndIf if operator4 = "Онол" Then Controls.SetTextBoxText(h4, "") onol4() EndIf if operator4 = "Бодох" Then If t24="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum4=T24+T24+T24 Controls.SetTextBoxText(h4, sum4) talbai4=(Math.Power((sum4/2)*(sum4/2-t24)*(sum4/2-t24)*(sum4/2-t24),1/2)) Controls.SetTextBoxText(s4, talbai4) GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(42, 330, T24) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(135, 330, T24) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(85, 400, T24) zurah4() EndIf EndIf If operator4 = "Цэвэрлэх" Then Controls.SetTextBoxText(h4, "") Controls.SetTextBoxText(s4, "") Controls.SetTextBoxText(textbox24, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(42,330,80,20) GraphicsWindow.FillRectangle(135,330,80,20) GraphicsWindow.FillRectangle(85,400,80,20) EndIf if operator4 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf EndSub sub zurah4 Turtle.Turn(0) Turtle.x=30 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="Red" GraphicsWindow.DrawBoundText(15, 390, GraphicsWindow.Width, "A") Turtle.Turn(-60) Turtle.Move(130) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(42, 330, T24) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(90, 268, GraphicsWindow.Width, "B") Turtle.Turn(120) Turtle.Move(130) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(135, 330, T24) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(162, 390, GraphicsWindow.Width, "C") Turtle.Turn(120) Turtle.Move(130) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(85, 400, T24) 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol4 i144="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг4.jpg" GraphicsWindow.DrawImage(i144, 50, 45) i14="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\зураг4.4.jpg" GraphicsWindow.DrawImage(i14, 440, 45) EndSub '-----------------------------55555555555555555555555555555555555555555 'GraphicsWindow.BackgroundColor = "Green" 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Sub asdasd5 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 24 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(240, 10, "Квадрат") Turtle.Speed=10 Turtle.x=238 Turtle.y=40 Turtle.Turn(90) Turtle.Move(100) Turtle.Hide() CreateGUI5() Controls.ButtonClicked = ButtonDown5 butsah=Controls.AddButton("Буцах"500,400) EndSub sub CreateGUI5 GraphicsWindow.FontSize = 12 z5=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z5, 60, 25) o5=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o5, 60, 25) y5=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y5, 60, 25) v5=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v5, 80, 25) GraphicsWindow.BrushColor = "black" textbox25 = Controls.AddTextBox(265, 160) Controls.SetSize(textbox25, 30, 20) GraphicsWindow.DrawText(243, 165, "А:") GraphicsWindow.BrushColor = "black" h5=Controls.AddMultiLineTextBox(265, 202) Controls.SetSize(h5, 150, 20) GraphicsWindow.DrawText(285,186, "Хариу P") s5=Controls.AddMultiLineTextBox(265, 238) Controls.SetSize(s5, 150, 20) GraphicsWindow.DrawText(285,223, "Хариу S") EndSub '--------------------------------------------------------------------------- Sub ButtonDown5 T25 = controls.GetTextBoxText(textbox25) operator5 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator5 = "Зурах" Then Controls.SetTextBoxText(h5, "") zurah5() EndIf if operator5 = "Онол" Then Controls.SetTextBoxText(h5, "") onol5() EndIf if operator5 = "Бодох" Then If t25="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum5=T25*4 Controls.SetTextBoxText(h5, sum5) talbai5=T25*T25 Controls.SetTextBoxText(s5, talbai5) GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(14, 320, T25) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 250, T25) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(165, 320, T25) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 400, T25) zurah5() EndIf EndIf if operator5 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf If operator5 = "Цэвэрлэх" Then Controls.SetTextBoxText(h5, "") Controls.SetTextBoxText(s5, "") Controls.SetTextBoxText(textbox25, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(14,320,80,20) GraphicsWindow.FillRectangle(90,250,80,20) GraphicsWindow.FillRectangle(165,320,80,20) GraphicsWindow.FillRectangle(90,400,80,20) EndIf EndSub sub zurah5 Turtle.x=30 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 390, GraphicsWindow.Width, "A") Turtle.Turn(-90) Turtle.Move(130) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(14, 320, T25) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 260, GraphicsWindow.Width, "B") Turtle.Turn(90) Turtle.Move(130) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 250, T25) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(160, 260, GraphicsWindow.Width, "C") Turtle.Turn(90) Turtle.Move(130) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(165, 320, T25) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(160, 390, GraphicsWindow.Width, "D") Turtle.Turn(90) Turtle.Move(130) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(90, 400, T25) 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol5 i15="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг5.jpg" GraphicsWindow.DrawImage(i15, 50, 60) i155="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг5.5.jpg" GraphicsWindow.DrawImage(i155, 430, 60) EndSub '---------------------------------------------------66666666666666666666666666666 'GraphicsWindow.BackgroundColor = "Green" 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Sub asdasd6 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 24 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(250, 10, "Ромбо") Turtle.Speed=10 Turtle.x=250 Turtle.y=40 Turtle.Turn(90) Turtle.Move(70) Turtle.Hide() CreateGUI6() Controls.ButtonClicked = ButtonDown6 butsah=Controls.AddButton("Буцах"500,400) EndSub sub CreateGUI6 GraphicsWindow.FontSize = 12 z6=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z6, 60, 25) o6=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o6, 60, 25) y6=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y6, 60, 25) v6=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v6, 80, 25) GraphicsWindow.BrushColor = "black" textbox26 = Controls.AddTextBox(265, 160) Controls.SetSize(textbox26, 30, 20) GraphicsWindow.DrawText(243, 165, "А:") textbox267 = Controls.AddTextBox(265, 185) Controls.SetSize(textbox267, 30, 20) GraphicsWindow.DrawText(243, 190, "H:") GraphicsWindow.BrushColor = "black" h6=Controls.AddMultiLineTextBox(265, 230) Controls.SetSize(h6, 150, 20) GraphicsWindow.DrawText(285,212, "Хариу P") s6=Controls.AddMultiLineTextBox(265, 268) Controls.SetSize(s6, 150, 20) GraphicsWindow.DrawText(285,255, "Хариу S") EndSub '--------------------------------------------------------------------------- Sub ButtonDown6 T26 = controls.GetTextBoxText(textbox26) T267 = controls.GetTextBoxText(textbox267) operator6 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator6 = "Зурах" Then Controls.SetTextBoxText(h6, "") zurah6() EndIf if operator6 = "Онол" Then Controls.SetTextBoxText(h6, "") onol6() EndIf if operator6 = "Бодох" Then If t26="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө ��руулна уу!!!", "Алдаа гарлаа") Else sum6=T26*4 Controls.SetTextBoxText(h6, sum6) talbai6=T26*T267 Controls.SetTextBoxText(s6, talbai6) GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = "true" GraphicsWindow.BrushColor = "red" GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(60, 300, T26) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(165, 290, T26) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(180, 360, T26) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(67, 373, T26) zurah6() EndIf EndIf if operator6 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf If operator6 = "Цэвэрлэх" Then Controls.SetTextBoxText(h6, "") Controls.SetTextBoxText(s6, "") Controls.SetTextBoxText(textbox26, "") Controls.SetTextBoxText(textbox267, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(60,300,80,20) GraphicsWindow.FillRectangle(165,290,80,20) GraphicsWindow.FillRectangle(180,360,80,20) GraphicsWindow.FillRectangle(67,373,80,20) EndIf EndSub sub zurah6 Turtle.Turn(0) Turtle.x=30 Turtle.y=350 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(12, 340, GraphicsWindow.Width, "A") Turtle.Turn(-35) Turtle.Move(110) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(60, 300, T26) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(115, 270, GraphicsWindow.Width, "B") Turtle.Turn(60) Turtle.Move(110) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(165, 290, T26) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(222, 323, GraphicsWindow.Width, "C") Turtle.Turn(120) Turtle.Move(110) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(180, 360, T26) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(120, 400, GraphicsWindow.Width, "D") Turtle.Turn(60) Turtle.Move(110) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(67, 373, T26) 'Turtle.Show() Turtle.X=800 Turtle.y=800 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" If t26="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") EndIf EndSub '-------------------------------------------------------------------- Sub onol6 i16="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг6.jpg" GraphicsWindow.DrawImage(i16, 50, 70) i166="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг6.6.jpg" GraphicsWindow.DrawImage(i166, 440, 70) EndSub '--------------------------77777777777777777777777777777777777777777777777 Sub asdasd7 'GraphicsWindow.BackgroundColor = "Green" 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 24 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(200, 10, "Параллелограмм") Turtle.Speed=10 Turtle.x=200 Turtle.y=40 Turtle.Turn(90) Turtle.Move(190) Turtle.Hide() CreateGUI7() Controls.ButtonClicked = ButtonDown7 EndSub sub CreateGUI7 GraphicsWindow.FontSize = 12 z7=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z7, 60, 25) o7=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o7, 60, 25) y7=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y7, 60, 25) v7=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v7, 80, 25) GraphicsWindow.BrushColor = "black" textbox27 = Controls.AddTextBox(333, 160) Controls.SetSize(textbox27, 30, 20) textbox37 = Controls.AddTextBox(333, 190) Controls.SetSize(textbox37, 30, 20) textbox47 = Controls.AddTextBox(333, 220) Controls.SetSize(textbox47, 30, 20) GraphicsWindow.DrawText(290, 165, "Өргөн:") GraphicsWindow.DrawText(300, 195, "Урт:") GraphicsWindow.DrawText(290, 225, "Өндөр:") GraphicsWindow.BrushColor = "black" h7=Controls.AddMultiLineTextBox(265, 260) Controls.SetSize(h7, 150, 20) GraphicsWindow.DrawText(210,263, "Хариу P:") s7=Controls.AddMultiLineTextBox(265, 285) Controls.SetSize(s7, 150, 20) GraphicsWindow.DrawText(210,288, "Хариу S:") butsah=Controls.AddButton("Буцах"500,400) EndSub '--------------------------------------------------------------------------- Sub ButtonDown7 T27 = controls.GetTextBoxText(textbox27) T37= controls.GetTextBoxText(textbox37) T47= controls.GetTextBoxText(textbox47) operator7 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator7 = "Зурах" Then Controls.SetTextBoxText(h7, "") zurah7() EndIf if operator7 = "Онол" Then Controls.SetTextBoxText(h, "") onol7() EndIf if operator7 = "Бодох" Then If t27="" And t37="" And t47="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else sum7=(T27+T37)*2 Controls.SetTextBoxText(h7, sum7) talbai7=T37*T47 Controls.SetTextBoxText(s7, talbai7) GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = "true" GraphicsWindow.BrushColor = "red" GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(32, 350, T27) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(135, 310, T37) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(205, 358, T27) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(100, 400, T37) zurah7() EndIf EndIf if operator7 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf If operator7 = "Цэвэрлэх" Then Controls.SetTextBoxText(h7, "") Controls.SetTextBoxText(s7, "") Controls.SetTextBoxText(textbox27, "") Controls.SetTextBoxText(textbox37, "") Controls.SetTextBoxText(textbox47, "") GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(32,350,80,20) GraphicsWindow.FillRectangle(135,310,80,20) GraphicsWindow.FillRectangle(205,358,80,20) GraphicsWindow.FillRectangle(100,400,80,20) GraphicsWindow.DrawText(32, 350, T27) GraphicsWindow.DrawText(135, 310, T37) GraphicsWindow.DrawText(205, 358, T27) GraphicsWindow.DrawText(100, 400, T37) EndIf EndSub sub zurah7 Turtle.Turn(0) Turtle.x=30 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(15, 385, GraphicsWindow.Width, "A") Turtle.Turn(-60) Turtle.Move(80) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(32, 350, T27) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(55, 315, GraphicsWindow.Width, "B") Turtle.Turn(60) Turtle.Move(150) GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(135, 310, T37) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(220, 325, GraphicsWindow.Width, "C") Turtle.Turn(120) Turtle.Move(80) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(205, 358, T27) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(185, 390, GraphicsWindow.Width, "D") Turtle.Turn(60) Turtle.Move(150) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(100, 400, T37) GraphicsWindow.BrushColor="red" 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol7 i17="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг7.jpg" GraphicsWindow.DrawImage(i17, 50, 70) i177="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг7.7.jpg" GraphicsWindow.DrawImage(i177, 410, 70) EndSub '---------------------------------8888888888888888888888888888888888888888888 'GraphicsWindow.BackgroundColor = "Green" 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Sub asdasd8 GraphicsWindow.BackgroundColor="turquoise" GraphicsWindow.Title = "Дүрсийн периметр ба талбай" GraphicsWindow.FontSize = 27 GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(150, 10, "Зөв олон өнцөг өнцөгт") Turtle.Speed=10 Turtle.x=150 Turtle.y=40 Turtle.Turn(90) Turtle.Move(280) Turtle.Hide() CreateGUI8() Controls.ButtonClicked = ButtonDown8 EndSub sub CreateGUI8 GraphicsWindow.FontSize = 12 z8=Controls.AddButton("Зурах"243, 70) Controls.SetSize(z8, 60, 25) o8=Controls.AddButton("Онол" 243, 100) Controls.SetSize(o8, 60, 25) y8=Controls.AddButton("Бодох"243, 130) Controls.SetSize(y8, 60, 25) v8=Controls.AddButton("Цэвэрлэх"400,400) Controls.SetSize(v8, 80, 25) GraphicsWindow.BrushColor = "black" textbox28 = Controls.AddTextBox(333, 160) Controls.SetSize(textbox28, 30, 20) textbox38 = Controls.AddTextBox(333, 190) Controls.SetSize(textbox38, 30, 20) GraphicsWindow.DrawText(243, 165, "Нэг талын урт:") GraphicsWindow.DrawText(263, 195, "Талын тоо:") GraphicsWindow.BrushColor = "black" h8=Controls.AddMultiLineTextBox(265, 220) Controls.SetSize(h8, 150, 20) GraphicsWindow.DrawText(210,223, "Хариу P:") s8=Controls.AddMultiLineTextBox(265, 245) Controls.SetSize(s8, 150, 20) GraphicsWindow.DrawText(210,248, "Хариу S:") butsah=Controls.AddButton("Буцах"500,400) EndSub '--------------------------------------------------------------------------- Sub ButtonDown8 T28 = controls.GetTextBoxText(textbox28) T38= controls.GetTextBoxText(textbox38) operator8 = Controls.GetButtonCaption(Controls.LastClickedButton) If operator8 = "Зурах" Then If t28="" And t38="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") EndIf If T38=3 Then zurah4() EndIf if T38=4 Then zurah5() EndIf If t38=5 Then zurah8() EndIf If t38=6 Then untsug6() EndIf EndIf if operator8 = "Онол" Then Controls.SetTextBoxText(h8, "") onol8() EndIf if operator8 = "Бодох" Then If t28="" And t38="" then GraphicsWindow.ShowMessage("Та өгөгдөлөө оруулна уу!!!", "Алдаа гарлаа") Else If T38=3 Then sum8=T28+T28+T28 Controls.SetTextBoxText(h8, sum8) talbai4=(Math.Power((sum8/2)*(sum8/2-t28)*(sum8/2-t28)*(sum8/2-t28),1/2)) Controls.SetTextBoxText(s8, talbai4) GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(42, 330, T28) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(135, 330, T28) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(85, 400, T28) zurah4() EndIf if T38=4 Then sum8=T28*4 Controls.SetTextBoxText(h8, sum8) talbai8=T28*T28 Controls.SetTextBoxText(s8, talbai8) GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(14, 320, T28) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 250, T28) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(165, 320, T28) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 400, T28) zurah5() EndIf If t38=5 Then T38= controls.GetTextBoxText(textbox38) sum8=T28*T38 Controls.SetTextBoxText(h8, sum8) talbai8=T28*T28 Controls.SetTextBoxText(s8, " ") GraphicsWindow.FontSize = 15 zurah8() EndIf If t38=6 Then T38= controls.GetTextBoxText(textbox38) sum8=T28*T38 Controls.SetTextBoxText(h8, sum8) talbai8=T28*T28 Controls.SetTextBoxText(s8, "") GraphicsWindow.FontSize = 15 untsug6() EndIf EndIf EndIf if operator8 = "Буцах" Then GraphicsWindow.Clear() asda() asdd() ButtonDown1() Turtle.Angle=0 EndIf If operator8 = "Цэвэрлэх" Then Controls.SetTextBoxText(h8, "") Controls.SetTextBoxText(s8, "") Controls.SetTextBoxText(textbox28, "") Controls.SetTextBoxText(textbox38, "") If T38=3 then GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(42,330,80,20) GraphicsWindow.FillRectangle(135,330,80,20) GraphicsWindow.FillRectangle(85,400,80,20) EndIf If T38=4 then GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(14,320,80,20) GraphicsWindow.FillRectangle(90,250,50,20) GraphicsWindow.FillRectangle(165,320,80,20) GraphicsWindow.FillRectangle(90,400,50,20) EndIf If T38=5 then GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(55,355,80,20) GraphicsWindow.FillRectangle(90,280,80,20) GraphicsWindow.FillRectangle(180,280,80,20) GraphicsWindow.FillRectangle(215,355,50,20) GraphicsWindow.FillRectangle(135,400,50,20) EndIf If T38=6 then GraphicsWindow.BrushColor="turquoise" GraphicsWindow.FillRectangle(55,355,80,20) GraphicsWindow.FillRectangle(90,280,80,20) GraphicsWindow.FillRectangle(180,280,80,20) GraphicsWindow.FillRectangle(220,350,80,20) GraphicsWindow.FillRectangle(138,410,50,20) GraphicsWindow.FillRectangle(80,410,50,20) EndIf EndIf EndSub sub zurah8 Turtle.x=80 Turtle.y=400 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(70, 400, GraphicsWindow.Width, "A") Turtle.Turn(-105) Turtle.Move(85) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(55, 355, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(43, 308, GraphicsWindow.Width, "B") Turtle.Turn(80) Turtle.Move(90) GraphicsWindow.BrushColor="purple" GraphicsWindow.DrawText(90, 280, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(135, 260, GraphicsWindow.Width, "C") Turtle.Turn(50) Turtle.Move(90) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(180, 280, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(227, 310, GraphicsWindow.Width, "D") Turtle.Turn(80) Turtle.Move(85) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(215, 355, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(200, 400, GraphicsWindow.Width, "E") Turtle.Turn(75) Turtle.Move(120) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(135, 400, T28) GraphicsWindow.BrushColor="red" 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub '-------------------------------------------------------------------- Sub onol8 i18="D:\2014-2015 хичээлийн жил\Ажлын төлөвлөгөө\ЭША\SM\zurag\Зураг8.jpg" GraphicsWindow.DrawImage(i18, 20, 50) EndSub Sub untsug6 Turtle.x=80 Turtle.y=400' Turtle.Turn(0) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(70, 400, GraphicsWindow.Width, "A") Turtle.Turn(-105) Turtle.Move(85) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(55, 355, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(43, 308, GraphicsWindow.Width, "B") Turtle.Turn(80) Turtle.Move(90) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(90, 280, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(135, 260, GraphicsWindow.Width, "C") Turtle.Turn(50) Turtle.Move(90) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(180, 280, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(227, 310, GraphicsWindow.Width, "D") Turtle.Turn(80) Turtle.Move(85) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(220, 350, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(200, 400, GraphicsWindow.Width, "E") Turtle.Turn(60) Turtle.Move(60) GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawText(165, 410, T28) GraphicsWindow.BrushColor="red" GraphicsWindow.DrawBoundText(128, 420, GraphicsWindow.Width, "F") Turtle.Turn(30) Turtle.Move(65) GraphicsWindow.BrushColor="Green" GraphicsWindow.DrawText(100, 410, T28) 'Turtle.Show() Turtle.X=100 Turtle.y=200 Turtle.Hide() Turtle.Speed=0 GraphicsWindow.BrushColor="green" EndSub End>VVK736.sb< Start>VVM947.sb< 'Arrow-button Program.Delay Mydir=Program.directory 'TextWindow.WriteLine("Mydir = "+Mydir) 'TextWindow.WriteLine("FirstImage = "+Mydir+"\1.jpg") w = 350 h = 290 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.Top = (Desktop.Height-h) / 2 GraphicsWindow.Left = (Desktop.Width-w) / 2 GraphicsWindow.FontSize = 15 flag=0 ''WhT 'xxxxxxxxxxxxxx MAIN PROGRAM xxxxxxxxxxxxxxx CreateGUI() CreateImageBox() GraphicsWindow.MouseDown=MouseDown ''WhT 'waiting for input and will execute each time the ButtonDown subroutine 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub CreateImageBox GraphicsWindow.DrawRectangle(90,10,100,160) GraphicsWindow.DrawResizedImage(Mydir+"\1.jpg", 90,10, 100,160) Program.Delay(1500) GraphicsWindow.DrawResizedImage(Mydir+"\2.jpg", 90,10, 100,160) Program.Delay(1500) GraphicsWindow.DrawResizedImage(Mydir+"\3.jpg", 90,10, 100,160) GraphicsWindow.DrawText( 40,180, "Hit green arrow to see 4, 5 6") endsub Sub CreateGUI GraphicsWindow.PenColor="black" ''WhT GraphicsWindow.PenWidth=2 ''WhT GraphicsWindow.DrawEllipse(110,210,60,40) ''WhT GraphicsWindow.BrushColor="lightgray" ''WhT GraphicsWindow.FillEllipse(110,210,60,40) ''WhT GraphicsWindow.BrushColor="green" GraphicsWindow.FillTriangle(130,240,150,240,140,220) ''WhT EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub MouseDown ''WhT mx=GraphicsWindow.MouseX my=GraphicsWindow.MouseY If mx>110 and mx<170 and my>210 and my<250 Then If flag=0 Then GraphicsWindow.BrushColor="red" flag=1 Else GraphicsWindow.BrushColor="green" flag=0 EndIf GraphicsWindow.FillTriangle(130,240,150,240,140,220) Sound.PlayClick() ScreensFlow() EndIf EndSub ''WhT Sub ScreensFlow GraphicsWindow.DrawResizedImage(Mydir+"\4.jpg", 90,10, 100,160) Program.Delay(1500) GraphicsWindow.DrawResizedImage(Mydir+"\5.jpg", 90,10, 100,160) Program.Delay(1500) GraphicsWindow.DrawResizedImage(Mydir+"\6.jpg", 90,10, 100,160) endsub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx End>VVM947.sb< Start>VVR931.sb< Sub init clrs=LDText.Split("blue #fe0000 magenta green cyan yellow white SaddleBrown DarkSlateGray teal tan" " ") clrs[0]="black cc[ 1]="..####.. ##### . #### . #### .######. ###### .$#####. #### .#$ @# #### #$ @# $# #### @#### ###### #######. #$ # @# # # #$ #@ .#####...#####...#$ @# .#$ @#.@# $#.#$ #@.##### . ##$ #### #### #### ###### #### #### #### ###### # # # # # # # ## #### ############ ######## ######## cc[ 2]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# $# #$ @# $# #$ $# . #$ ## @# ## ## #$ #@ .#$ @#..#$ @#..#$ @# .#$ @# @# $# #$ #@ # #. # #$ # $# #$ @# #@ $# #$ #$ #@ $# #$ ## # ## # # # # ##### # # # # # # # # # ############ ######## ######## cc[ 3]=".#$ @#. ##### .#$ . #$ @# .##### . ##### . $# . #$ $# .#$ @# #$ ###### $# #### @# $# #$ $# . #$ #$# @# #$##@# ###@ .#$ @#..#$ @#..#$ @# .#$ @# @## #$#@ # ### #. #$ $# #### #@ $# ##### ##### ## #$ #@# # # # # ###### # # # # # # # # # # # # # # ############ ######## ######## cc[ 4]=".######. #$ @# .#$ . #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ ### #$ @# #@ $# $# @# # $# #$ $# . #$ #@$#@# #$ @# #$$# .##### ..##### ..#$ @# .#$ @# $## #$ # # #. #$ #### #$ @# ##### $# #$ @# $# #$# @# # # # # ##### ##### ##### # # # ## ####### ############ ######## ######## cc[ 5]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# #@ $# #$ $# @# #$# #$ $# . #$ #@ $## #$ @# #$ $# .#$ ..#$ @# .. #$@# .#$##@# $# @# #$ # ### #. #$ #$ #$ @# $# #@ $# #$ @# #@ $# ## @# # ###### # ###### # # # # # # # # # # # #### #### ################ #### cc[ 6]=".#$ @#. ##### . #### . #### .######. #$ .$#####. #### . #### #### #$ @# #### #### @#### ###### $# . ###### #@ $# #$ @# #$ $# .#$ ..#$ @#.. ## . # # $# @# #$ # #. #####$. ######. #### @#### #### #### #### #### # # # . # # ##### # # # # # #### #### ################ #### cc[ 7]=".................................................................................................................................................................................................................##### .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. # .. .. # .# .. # .. # .. .. # .. .#### .#### .################ .####. .. .. . # # # # # # cc[ 8]="................................................................................................................................................................................................................. #### #### ################ #### cc[ 9]="................................................................................................................................................................................................................. cc[10]=" ..##. . ### . ## . ### .#### . #### . # . ## .# # ### # # # ### ## #### ##### # # # # # # # . ###. ..###.. # # .# # .# # .# # cc[11]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # # . # ## # ## ## # # . # # ..# #. # # .# # # # # # cc[12]=" .#### . ### .# . # # .### . ### . # . # # .# # # ## #### # ## # # # # . # # ## # # # ## . ### ..### . # # .# # # # cc[13]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # ## # # . # # # # # # # . # ..# # . # # .# # # # # # cc[14]=" .# # . ### . ## . ### .#### . # . # . ## . ## ### # # ## ### # # #### # . #### # # # # # # . # ..# #. # . # # # # # oppc="blue GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor="DarkSlateGray GraphicsWindow.BrushColor="darkblue GraphicsWindow.Width=1460 GraphicsWindow.Height=940 GraphicsWindow.Top=5 GraphicsWindow.Title="ZX Editor LDUtilities.ShowErrors="false not="true=false;false=true ix="ABCDEFIOUGHJSQZTLNMKPRVWXY[1289563074>=+-:,`$/()^?*!@#&% " mcm=LDText.Split("BORDER PAPER INK CLS NEW SAVE LOAD RUN LIST LET PLOT DRAW INPUT PRINT Goto DATA READ RESTORE RANDOMIZE CLEAR For NEXT If Then INKEY$ AT " " ") MHH=LDText.Split("bb pp ii cl nw sv ld rn ls lt pl dr in pr go dd rd rs rz cr ff nx If th ik at " " ") For x=1 To Array.GetItemCount(mhh) mc[mhh[x]]=mcm[x] cmc[mhh[x]]=Text.GetCharacter(170+x) EndFor args=0 shh[0]=LDText.Split("8 7 6 5 4 3 2 1" " ") shh[1]=LDText.Split("1 2 3 4 5 6 7 8" " ") shh[2]=LDText.Split("2 4 1 8 6 7 5 3" " ") shh[3]=LDText.Split("3 8 2 7 1 5 4 6" " ") shh[4]=LDText.Split("5 1 8 2 3 4 6 7" " ") bl="# chm=ldtext.Split("A S D F G H J K L Q W E R T Y U I O P Z X C V B N M 0 1 2 3 4 5 6 7 8 9 + = > - : , ` $ / ( ) ^ ? * ! @ # & % [" " ") ppc="DarkSlateGray chm[57]=" " initt="true mchr() EndSub Sub mchr qdd=0 For h=1 To 57 If h>=51 Then qdd=1 EndIf thh=chm[h] If initt Then LDCall.Function2("gench" thh qdd) LDCall.Function("gencb" thh) If h<27 Then LDCall.Function("gencm" thh) EndIf jj[thh]=LDImage.Copy(ii[thh]) LDImage.ReplaceColour(ii[thh] oppc "black" 5) LDImage.ReplaceColour(ii[thh] "red" "white" 5) LDImage.ReplaceColour(kk[thh] oppc ppc 5) LDImage.ReplaceColour(kk[thh] "red" "lime" 5) EndIf LDImage.ReplaceColour(jj[thh] oppc ppc 5) LDImage.ReplaceColour(jj[thh] "red" "black" 5) LDImage.ReplaceColour(im[thh] oppc ppc 5) LDImage.ReplaceColour(im[thh] "red" "black" 5) EndFor oppc=ppc initt="false EndSub Sub begin init() GraphicsWindow.KeyDown=kkk ss=1 ttw="1=1;2=3;3=4 LDCall.Function5("print2" 1 22 "[1982 SINCLAIR RESEARCH LTD " "teal" "2333322222222224444444444444444444444") Program.Delay(1333) GraphicsWindow.Clear() ppc="teal EndSub bgg: nww="false begin() ppc=clrs[9] mmr[10]=cmc["pr"]+"`HELLO To ZX fans world` 'mmr[20]=cmc["lt"]+"B=2:"+cmc["lt"]+"C=3,14159" 'mmr[30]=cmc["pr"]+"A+B-C/D*a^b lll: GraphicsWindow.BrushColor=ppc GraphicsWindow.FillRectangle(0 0 1700 1100) ql=0 Timer.Tick=tttm Timer.Interval=150 Timer.Pause() For qq=1 To 300 If Text.StartsWith(mmr[qq] ":") Then mmr[qq]=Text.GetSubTextToEnd(mmr[qq] 2) EndIf If Array.ContainsIndex(mmr qq) Then cml=mmr[qq] dcln() clf=text.append(text.GetSubText("2222222222" 1 Text.GetLength(qq)+1) clf) ' TextWindow.WriteLine(clf) LDCall.Function5("print2" 1 ql qq+" "+cln "teal" clf) ql=ql+1 EndIf EndFor kyy="false cml="" While "true LDCall.Function5("print" 1 22 "K" "teal" 1) Program.Delay(455) LDCall.Function5("print" 1 22 "K" "teal" 2) Program.Delay(455) If kyy Then Goto ccf EndIf EndWhile ccf: cml="" LDCall.Function5("print" 1 22 " " ppc 2) fx=fx-1 rw=22 mode=1 '-------------------------------------------main loop------------------------------------------------- Timer.Resume() Sub tttm If kyy Then mmd=Text.GetSubText("KLCEG" mode 1) dcln() LDCall.Function5("print" 1 22 " " ppc 2) fx=1 LDCall.Function5("print" fx rw cln ppc 2) LDCall.Function5("print" fx rw mmd ppc 1) 'kyy="false EndIf EndSub While "true If brk Then Goto xxx EndIf If nww Then GraphicsWindow.Clear() GraphicsWindow.BrushColor="black GraphicsWindow.FillRectangle(50 50 1280 720) Program.Delay(555) GraphicsWindow.Clear() Program.Delay(555) Goto bgg EndIf If lstt Then lstt="false Goto lll EndIf If evv Then evv="false evlcml() LDCall.Function5("print" 1 22 "0 OK 0:1 " ppc 2) fx=1 dcc="true cml="" mode=1 EndIf EndWhile'---------------------------------------------------------------------------------------endmainloop xxx: GraphicsWindow.Clear() brk="false LDCall.Function5("print" 1 22 "D BREAK 0:1" ppc 2) Program.Delay(1377) GraphicsWindow.Clear() LDCall.Function5("print" 1 22 "LIST" ppc 2) LDCall.Function5("print" 6 22 "L" ppc 1) Program.Delay(1377) GraphicsWindow.Clear() Goto lll Sub kkk'--------------------------------*********************--KEYS ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) 'GraphicsWindow.Title=ll kyy="true If ll="right" Then ss=ss+1 ElseIf ll="left" Then ss=ss-1 ElseIf ll="escape" Then brk="true ElseIf TEXT.StartsWith( ll "ret" ) Then If Text.StartsWith(cml ":") Then cml=Text.GetSubTextToEnd(cml 2) EndIf 'TextWindow.WriteLine(">"+cml) li=LDText.Split(cml ":") ln=text.GetSubTextToEnd (ldtext.Trim (li[1]) 2) lnm=LDUtilities.IsNumber(ln) 'TextWindow.WriteLine("?>"+ln) If not[lnm] Then ' tl=FCDialogs.AskForTextLine("To Line:") ' If tl="" Then evv="true ' Else ' mmr[tl]=cml ' cml="" ' lstt="true ' EndIf Else mmr[ln]="" For rr=2 To Array.GetItemCount(li) mmr[ln]=text.append(mmr[ln] ":"+li[rr]) EndFor ' TextWindow.WriteLine(">:"+mmr[ln]) lstt="true cml="" EndIf ElseIf ll="back" Then chp="" cml=Text.GetSubText(cml 1 Text.GetLength(cml)-1) GraphicsWindow.Title=cml If Text.GetLength(cml)<=1 Then mode=1 EndIf ElseIf ll="space" Then cml=cml+" " ElseIf ll="f1" Then mode=1 chp="" ElseIf ll="f2" Then mode=2 chp="" ElseIf ll="f3" Then chp="` cml=text.append(cml chp) ElseIf ll="f4" Then chp="$ cml=text.append(cml chp) ElseIf ll="f5" Then chp="! cml=text.append(cml chp) ElseIf ll="f6" Then chp="^ cml=text.append(cml chp) ElseIf ll="f7" Then chp="; cml=text.append(cml chp) ElseIf ll="f8" Then chp="* cml=text.append(cml chp) ElseIf ll="f9" Then chp="( cml=text.append(cml chp) ElseIf ll="f11" Then chp=") cml=text.append(cml chp) ElseIf ll="oem5" Then chp="? cml=text.append(cml chp) ElseIf ll="oemopenbrackets" Then chp="@ cml=text.append(cml chp) ElseIf ll="oem6" Then chp="% cml=text.append(cml chp) ElseIf ll="oem1" Then chp="& cml=text.append(cml chp) ElseIf ll="oemquotes" Then chp="# cml=text.append(cml chp) ElseIf ll="oemplus" Then chp="= cml=text.append(cml chp) ElseIf Text.GetLength(ll)=2 Then chp=Text.GetSubTextToEnd(ll 2) cml=text.append(cml chp) Else chp="" If mode=1 Then If ll="b" Then ' chp="BORDER " cml=cml+":"+cmc["bb"] mode=2 ElseIf ll="p" Then ' chp="PAPER " cml=cml+":"+cmc["pp"] mode=2 ElseIf ll="i" Then ' chp="INK " cml=cml+":"+cmc["ii"] mode=2 ElseIf ll="c" Then ' chp="CLS" cml=cml+":"+cmc["cl"] mode=2 ElseIf ll="f" Then ' chp="For cml=cml+":"+cmc["ff"] mode=2 ElseIf ll="g" Then ' chp="Goto cml=cml+":"+cmc["go"] mode=2 ElseIf ll="a" Then ' chp="NEW" cml=cml+":"+cmc["nw"] mode=2 ElseIf ll="r" Then ' chp="RUN " cml=cml+":"+cmc["rn"] mode=2 ElseIf ll="k" Then ' chp="Let cml=cml+":"+cmc["lt"] mode=2 ElseIf ll="q" Then ' chp="input cml=cml+":"+cmc["in"] mode=2 ElseIf ll="k" Then ' chp="let cml=cml+":"+cmc["lt"] mode=2 ElseIf ll="w" Then ' chp="print mode=2 cml=cml+":"+cmc["pr"] ElseIf ll="e" Then ' chp="at cml=cml+":"+cmc["at"] mode=2 ElseIf ll="l" Then ' chp="LIST " cml=cml+":"+cmc["ls"] mode=2 ElseIf ll="s" Then ' chp="SAVE " cml=cml+":"+cmc["sv"] mode=2 ElseIf ll="j" Then ' chp="Load cml=cml+":"+cmc["ld"] mode=2 EndIf Else chp=text.GetSubText( ll 1 1) If ll="oem1" Then chp=":" mode=1 EndIf If Text.GetLength(ll)=1 Then cml=cml+chp EndIf EndIf EndIf ' GraphicsWindow.Title=cml EndSub'------------------------------------------------------****** Sub dcln txl=LDText.Split(cml ":") cln="" clf="" For wt=1 To Array.GetItemCount(txl) cs=text.GetCharacterCode( Text.GetSubText(txl[wt] 1 1))-170 s2=Text.GetSubTextToEnd(txl[wt] 2) lls=Text.GetLength(mc[mhh[cs]]) ll1=Text.GetLength(s2) cln=cln+mc[mhh[cs]]+" "+s2+":" clf=text.append(clf Text.GetSubText("333333333333333333333333333333333333333333" 1 lls)) clf=text.append(clf Text.GetSubText("22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" 1 ll1+2)) EndFor cln=Text.GetSubText(cln 1 Text.GetLength(cln)-1) ' TextWindow.WriteLine(clf) EndSub Sub evlcml cx=LDText.Split(cml ":") For lx=1 To Array.GetItemCount(cx) ee=cx[lx] If Text.StartsWith(ee cmc["pp"]) Then tt=Text.GetSubText(ee 2 1) ppc=clrs[ldmath.Base2Decimal( tt 16)] ' GraphicsWindow.Title=ppc mchr() ElseIf Text.StartsWith(ee cmc["nw"]) Then nww="true mmr="" Timer.Pause() ElseIf Text.StartsWith(ee cmc["cl"]) Then GraphicsWindow.Clear() lstt="true ElseIf Text.StartsWith(ee cmc["in"]) Then vv=LDText.Split(ee " ") 'TextWindow.WriteLine(vv) vrr[text.GetSubTextToEnd( vv[1] 2)]=FCDialogs.AskForTextLine(vv[2]) ElseIf Text.StartsWith(ee cmc["sv"]) Then ff=LDDialogs.SaveFile("zx" "e:\") ' The following line could be harmful and has been automatically commented. ' File.WriteContents(ff mmr) ElseIf Text.StartsWith(ee cmc["ld"]) Then ff=LDDialogs.OpenFile ("zx" "e:\") ' The following line could be harmful and has been automatically commented. ' mmr=File.ReadContents(ff) lstt="true ElseIf Text.StartsWith(ee cmc["ls"]) Then lstt="true ElseIf Text.StartsWith(ee cmc["bb"]) Then tt=text.ConvertToLowerCase( Text.GetSubText(ee 2 1)) ' GraphicsWindow.Title=ee tt=ldmath.Base2Decimal( tt 16) bc=clrs[tt] GraphicsWindow.BrushColor=bc GraphicsWindow.FillRectangle(0 0 1600 80) GraphicsWindow.FillRectangle(0 850 1600 500) GraphicsWindow.FillRectangle(0 0 80 1000) GraphicsWindow.FillRectangle(1370 0 800 1000) EndIf EndFor EndSub Sub print2 fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1s=args[5] tu=tt' Text.ConvertToUpperCase(tt) For f=1 To Text.GetLength(tt) qw=text.GetSubText(tu f 1) c1=text.GetSubText(c1s f 1) If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=ii[qw] EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=2 yy=yy+1 EndIf EndFor EndSub Sub print fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1=args[5] tu=tt' Text.ConvertToUpperCase(tt) For f=1 To Text.GetLength(tt) qw=text.GetSubText(tu f 1) If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=ii[qw] EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=2 yy=yy+1 EndIf EndFor EndSub Sub gencm ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y+8] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor im[ch]=FCDrawings.GenerateImage(gg) Shapes.Remove(ss) EndSub Sub gench ch=args[1] qd=args[2] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y+qd] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor ' GraphicsWindow.Title=ch mg=FCDrawings.GenerateImage(gg) ii[ch]=mg thh=ch 'Shapes.AddImage(mg) 'Program.Delay(155) Shapes.Remove(ss) EndSub Sub gencb ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText ("#$@" text.getSubText(cc[y] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor kk[ch]=FCDrawings.GenerateImage(gg) thh=ch Shapes.Remove(ss) EndSub End>VVR931.sb< Start>VVS441.sb< ' simple image INTERNET retrieving program GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 700 GraphicsWindow.Width = 700 ' installationd'une image d arrière plan image1=ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/AAA_SVG_Chessboard_and_chess_pieces_03.svg/500px-AAA_SVG_Chessboard_and_chess_pieces_03.svg.png") GraphicsWindow.DrawresizedImage(image1, 0, 0,250,250) image2=ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Sjakkspillet.jpg/240px-Sjakkspillet.jpg") GraphicsWindow.DrawresizedImage(image2,400,0, 250,250) image3=ImageList.LoadImage("https://openclipart.org/image/800px/svg_to_png/18581/portablejim-2D-Chess-set-Chessboard-1.png") GraphicsWindow.DrawresizedImage(image3,0,400, 250,250) image4=ImageList.LoadImage("http://www.clipartsfree.net/vector/small/chessboard-diagonal-cuts-plain_Clipart_Free.png") GraphicsWindow.DrawresizedImage(image4,400,400, 250,250) ' fin du progrmme End>VVS441.sb< Start>VVS563.sb< color[1] = "blue" color[2] = "red" color[3] = "green" color[4] = "yellow" color[5] = "white" TextWindow.WriteLine("Guess The Number !") Program.Delay(1000) TextWindow.WriteLine("Made By Ashkore Dracson") Program.Delay(500) TextWindow.WriteLine("---------------------------------------------------") begin: tries = 0 TextWindow.WriteLine("Enter the min value :") minvalue = TextWindow.ReadNumber() TextWindow.WriteLine("Enter the max value :") maxvalue = TextWindow.ReadNumber() TextWindow.WriteLine("---------------------------------------------------") numbertoguess = MathPlus.GetRandomNumber(minvalue,maxvalue) 'TextWindow.WriteLine("The number is " + numbertoguess) 'Remove the line above to cheat TextWindow.WriteLine("Enter a number :") guessing: read = TextWindow.ReadNumber() If read < numbertoguess Then TextWindow.WriteLine("No, My number is superior to " + read) tries = tries + 1 Goto guessing ElseIf read > numbertoguess Then TextWindow.WriteLine("No, My number is inferior to " + read) tries = tries + 1 Goto guessing ElseIf read = numbertoguess Then For i2 = 1 To 20 TextWindow.BackgroundColor = color[Math.GetRandomNumber(5)] Clear() Program.Delay(125) EndFor TextWindow.BackgroundColor = "black" TextWindow.Clear() If tries = 0 Then TextWindow.WriteLine("Your Score is : " + maxvalue) Else TextWindow.WriteLine("Your Score is : " + ((maxvalue - minvalue) / tries)) EndIf Program.Delay(1000) TextWindow.WriteLine("Do you want to restart ? y/n") readingyn: yn = TextWindow.Read() If yn = "y" Then TextWindow.Clear() Goto begin ElseIf yn = "n" Then Program.End() Else Goto readingyn EndIf EndIf Sub Clear TextWindow.Clear() TextWindow.WriteLine("Congratulation ! You Win !") EndSub End>VVS563.sb< Start>VVT676.sb< 'WINDOW GraphicsWindow.Hide() GraphicsWindow.Width = 772 GraphicsWindow.Height = 560 width = Desktop.Width GraphicsWindow.Left = (width - 800) / 2 GraphicsWindow.Top = 50 GraphicsWindow.CanResize = "false" GraphicsWindow.Title = "Pattern" GraphicsWindow.PenColor = "gray" GraphicsWindow.PenWidth = 1 'PATTERN GraphicsWindow.BrushColor = "black" For i = 1 To 750 Step 70 rectangle1 = Shapes.AddRectangle(50, 50) Shapes.Move(rectangle1, 35 + i, 0) Shapes.Rotate(rectangle1, 45) rectangle2 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle2, 45) Shapes.Move(rectangle2, 35 + i, 70) rectangle3 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle3, 45) Shapes.Move(rectangle3, 35 + i, 140) rectangle4 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle4, 45) Shapes.Move(rectangle4, 35 + i, 210) rectangle5 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle5, 45) Shapes.Move(rectangle5, 35 + i, 280) rectangle6 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle6, 45) Shapes.Move(rectangle6, 35 + i, 350) rectangle7 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle7, 45) Shapes.Move(rectangle7, 35 + i, 420) rectangle8 = Shapes.AddRectangle(50, 50) Shapes.Rotate(rectangle8, 45) Shapes.Move(rectangle8, 35 + i, 490) GraphicsWindow.BrushColor = "black" EndFor GraphicsWindow.BrushColor = "white" For x = 1 To 750 Step 70 ellipse1 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse1, 11 + x, 11) ellipse2 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse2, 11 + x, 81) ellipse3 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse3, 11 + x, 151) ellipse4 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse4, 11 + x, 221) ellipse5 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse5, 11 + x, 291) ellipse6 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse6, 11 + x, 361) ellipse7 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse7, 11 + x, 431) ellipse8 = Shapes.AddEllipse(49, 49) Shapes.Move(ellipse8, 11 + x, 501) EndFor GraphicsWindow.BrushColor = "black" For y = 1 To 800 Step 70 ellipse10 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse10, -25 + y, -25) ellipse20 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse20, -25 + y, 45) ellipse30 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse30, -25 + y, 115) ellipse40 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse40, -25 + y, -25) ellipse50 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse50, -25 + y, 185) ellipse60 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse60, -25 + y, 255) ellipse70 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse70, -25 + y, 325) ellipse80 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse80, -25 + y, 395) ellipse90 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse90, -25 + y, 465) ellipse100 = Shapes.AddEllipse(50, 50) Shapes.Move(ellipse100, -25 + y, 535) EndFor GraphicsWindow.BrushColor = "white" For z = 1 To 800 Step 70 ellipseA = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseA, -10 + z, -10) ellipseB = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseB, -10 + z, 60) ellipseC = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseC, -10 + z, 130) ellipseD = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseD, -10 + z, 200) ellipseE = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseE, -10 + z, 270) ellipseF = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseF, -10 + z, 340) ellipseG = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseG, -10 + z, 410) ellipseH = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseH, -10 + z, 480) ellipseI = Shapes.AddEllipse(20, 20) Shapes.Move(ellipseI, -10 + z, 550) EndFor GraphicsWindow.BrushColor = "black" For q = 1 To 800 Step 70 bellipse1 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse1, 25 + q, 25) bellipse2 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse2, 25 + q, 95) bellipse3 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse3, 25 + q, 165) bellipse4 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse4, 25 + q, 235) bellipse5 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse5, 25 + q, 305) bellipse6 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse6, 25 + q, 375) bellipse7 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse7, 25 + q, 445) bellipse8 = Shapes.AddEllipse(20, 20) Shapes.Move(bellipse8, 25 + q, 515) EndFor GraphicsWindow.PenColor = "white" For w = 1 To 800 Step 70 wline1 = Shapes.AddLine(0 + w, 0, 0 + w, 800) wline2 = Shapes.AddLine(0, 0 + w, 800, 0 + w) wline3 = Shapes.AddLine(0, 34 + w, 800, 34 + w) wline4 = Shapes.AddLine(35 + w, 0, 35 + w, 600) EndFor 'SHOW_WINDOW GraphicsWindow.Show() End>VVT676.sb< Start>VVW418.sb< ' mahreen miangul FebrUary 2019 ' Smiley Smile GraphicsWindow.Left = 0.1 * (Desktop.Width - GraphicsWindow.Width) GraphicsWindow.Top = 0 * (Desktop.Height - GraphicsWindow.Height) GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor="rosybrown GraphicsWindow.Width = "800 GraphicsWindow.Height = "400" '--------------------Font Animation ----------------------------------------------------------------------------------------- GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 80 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "yellow" ' Text shadow color GraphicsWindow.DrawText(45, 0, "MEWOW!") ' Shadow position/text 'GraphicsWindow.DrawText(555, 85, "mussa-maina!") 'GraphicsWindow.DrawText(25, 545, "haroon rashid!") orangered= GraphicsWindow.getcolorfromrgb(250,80,80) GraphicsWindow.BrushColor=orangered GraphicsWindow.BrushColor = orangered ' Text color GraphicsWindow.DrawText(40, 5, "MEWOW!") ' Position and text 'GraphicsWindow.DrawText(550, 80, "mussa-maina!") 'GraphicsWindow.DrawText(20, 540, "haroon rashid!") '============================== Makesprite() ============================== SPRITE_init() add_shapes() ' ============================== Aircraft Animation ============================== dZ = 0.1 zoom = 1 ddx=0 ddy=0 bdx=0 bdy=0 ANMB="2:1" 'BNMB="9:1" ' <----- Blue car shapes number=6 repeat =1 zm=1 ' <----- ' ============================== Cannon//Car Timer ============================== Timer.Interval=800 'Timer.Tick=CannonCar_up While "True" ' 'inits here, get ready For next click Program.Delay(20) '============================Aircraft Blinking Program======================= zoom = zoom - dZ For i = 1 To Array.GetItemCount(shape[2]) If Array.ContainsValue(shape[2][i], "eye") Then Shapes.Zoom(shp[ANMB][i], 2, zoom) ElseIf Array.ContainsValue(shape[2][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], zoom, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx,shapes.Gettop(shp[ANMB][i])+ddy) EndFor If zoom = 0.1 Or zoom = 1.7 Then dZ = -dZ EndIf ' <----- endwhile '============================Cannon Car Animation================================== 'Sub CannonCar_up 'MM=MM+1 'If MM=23 Then 'MM=0 'EndIf Timer.Pause() 'For k=1 To Array.GetItemCount(s[1]) 'For L=1 To Array.GetItemCount(shape[1])-1 ' <----- 'Shapes.Rotate(SHP["1:"+k][L],Shape[1][L]["angle"]) 'EndFor 'EndFor 'Program.Delay(300) 'For k=1 To Array.GetItemCount(s[1]) 'For L=1 To Array.GetItemCount(shape[1])-1 ' <----- 'Shapes.Rotate(SHP["1:"+K][L], 0) 'EndFor 'EndFor Program.Delay(30) Timer.Resume() 'EndSub ' Add Sprites Sub add_shapes For M=1 To Array.GetItemCount(s) For N=1 To Array.GetItemCount(s[M]) ss=s[M][N] _shx=shx[M][N] _shY=shY[M][N] _shape=shape[M] NMB=M+":"+N For i=1 To Array.GetItemCount(_shape) GraphicsWindow.PenWidth = _shape[i]["pw"] GraphicsWindow.BrushColor = _shape[i]["bc"] GraphicsWindow.penColor = _shape[i]["pc"] If _shape[i]["func"]="ell" Then shp[NMB][i] = Shapes.AddEllipse(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="rect" Then shp[NMB][i] = Shapes.AddRectangle(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="tri" Then shp[NMB][i] = Shapes.Addtriangle(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss, _shape[i]["x3"]*ss, _shape[i]["y3"]*ss) ElseIf _shape[i]["func"]="line" Then shp[NMB][i] = Shapes.Addline(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss) EndIf Shapes.Animate(shp[NMB][i], _shape[i]["x"]*ss+_shX, _shape[i]["y"]*ss+_shY, 500) Shapes.Rotate(shp[NMB][i], _Shape[i]["angle"]) EndFor EndFor EndFor EndSub Sub SPRITE_init ' Aircraft s[1] = "1=0.8" shX[1]= "1=420" shY[1]= "1=80" shape[1][1]="func=rect;X=55;Y=203;width=100;height=150;angle=0;bc=orangered;pc=black;pw=3"' Body--1 shape[1][2]="func=rect;X=120;Y=198;width=100;height=150;angle=-30;bc=orangered;pc=black;pw=2"'Body--1 shape[1][3]="func=rect;X=90;Y=210;width=60;height=120;angle=0;bc=orangered;pc=black;pw=0"' Body--1 shape[1][4]="func=rect;X=6;Y=320;width=230;height=43;angle=0;bc=orangered;pc=black;pw=0"' Body--2 shape[1][5]="func=tri;X=-8;Y=26;x1=30;y1=0;x2=60;y2=-50;x3=90;y3=0;angle=-16;bc=darkslategray;pc=black;pw=0"' EarLeft-1 shape[1][6]="func=tri;X=-9;Y=24;x1=40;y1=-4;x2=60;y2=-40;x3=80;y3=-4;angle=-16;bc=orangered;pc=black;pw=0;" shape[1][7]="func=tri;X=-9;Y=24;x1=50;y1=-8;x2=60;y2=-30;x3=70;y3=-8;angle=-16;bc=yellow;pc=black;pw=0;" shape[1][8]="func=tri;X=85;Y=22;x1=30;y1=0;x2=60;y2=-50;x3=90;y3=0;angle=22;bc=darkslategry;pc=black;pw=0"' EarLeft-1 shape[1][9]="func=tri;X=87;Y=16;x1=40;y1=-4;x2=60;y2=-40;x3=80;y3=-4;angle=22;bc=orangered;pc=black;pw=0;" shape[1][10]="func=tri;X=87;Y=16;x1=50;y1=-8;x2=60;y2=-30;x3=70;y3=-8;angle=22;bc=yellow;pc=black;pw=0;" shape[1][11]="func=ell;X=-35;Y=14;width=250;height=200;bc=orangered;pc=black;pw=2"' Face shape[1][12]="func=ell;X=-5;Y=85;width=190;height=130;bc=yellow;pc=black;pw=0;"'mouth" shape[1][13]="func=ell;X=-10;Y=70;width=20;height=60;angle=-55;bc=yellow;pc=black;pw=0;"'mouth--1" shape[1][14]="func=ell;X=0;Y=55;width=20;height=60;angle=-55;bc=orangered;pc=black;pw=0;"'mouth--1" shape[1][15]="func=ell;X=77;Y=35;width=60;height=85;angle=0;bc=yellow;pc=black;pw=0;"'mouth--2" shape[1][16]="func=ell;X=144;Y=60;width=25;height=60;angle=33;bc=yellow;pc=black;pw=0;"'Check--2" shape[1][17]="func=ell;X=110;Y=84;width=23;height=50;angle=95;bc=yellow;pc=black;pw=0;"'Check--2" shape[1][18]="func=rect;X=100;Y=210;width=70;height=10;angle=-15;bc=black;pc=black;pw=2;"'neck" shape[1][19]="func=rect;X=70;Y=215;width=40;height=10;angle=10;bc=black;pc=black;pw=2;"'neck" shape[1][20]="func=ell;X=100;Y=210;width=30;height=20;angle=0;bc=white;pc=black;pw=2;"'neck" shape[1][21]="func=ell;X=0;Y=25;width=75;height=85;bc=white;pc=black;pw=2;"' Eye--1 shape[1][22]="func=ell;X=35;Y=40;width=35;height=35;bc=black;pc=black;pw=0" shape[1][23]="func=ell;X=40;Y=55;width=10;height=10;bc=white;pc=black;pw=0;" shape[1][24]="func=ell;X=90;Y=25;width=80;height=80;bc=white;pc=black;pw=2;"' Eye--2 shape[1][25]="func=ell;X=120;Y=35;width=35;height=35;bc=black;pc=black;pw=0;" shape[1][26]="func=ell;X=125;Y=50;width=10;height=10;bc=white;pc=black;pw=0;" shape[1][27]="func=tri;X=18;Y=75;x1=45;y1=0;x2=60;y2=20;x3=75;y3=0;angle=0;bc=black;pc=black;pw=0;"' Nose shape[1][28]="func=ell;X=80;Y=77;width=14;height=90;angle=-14;bc=black;pc=black;pw=0;"'--0 shape[1][29]="func=ell;X=92;Y=88;width=14;height=90;angle=-18;bc=yellow;pc=black;pw=0;"'--0 shape[1][30]="func=ell;X=60;Y=135;width=15;height=15;angle=0;bc=black;pc=black;pw=0;"' Left-1 shape[1][31]="func=ell;X=30;Y=122;width=4;height=60;angle=75;bc=black;pc=black;pw=0;" shape[1][32]="func=ell;X=30;Y=121;width=4;height=66;angle=75;bc=yellow;pc=black;pw=0;" shape[1][33]="func=ell;X=63;Y=127;width=5;height=5;angle=0;bc=black;pc=black;pw=0;"' Left-2 shape[1][34]="func=ell;X=33;Y=103;width=2;height=60;angle=83;bc=black;pc=black;pw=0;" shape[1][35]="func=ell;X=60;Y=115;width=10;height=10;angle=0;bc=black;pc=black;pw=0"' Left--3 shape[1][36]="func=rect;X=33;Y=95;width=2;height=50;angle=90;bc=black;pc=black;pw=0" shape[1][37]="func=ell;X=105;Y=135;width=15;height=15;angle=0;bc=black;pc=black;pw=0;"' Right-1 shape[1][38]="func=ell;X=148;Y=113;width=4;height=60;angle=90;bc=black;pc=black;pw=0;" shape[1][39]="func=ell;X=148;Y=112;width=4;height=66;angle=90;bc=yellow;pc=black;pw=0;" shape[1][40]="func=ell;X=103;Y=127;width=5;height=5;angle=0;bc=black;pc=black;pw=0;"' Right-2 shape[1][41]="func=ell;X=133;Y=100;width=2;height=60;angle=90;bc=black;pc=black;pw=0;" shape[1][42]="func=ell;X=95;Y=115;width=10;height=10;angle=0;bc=black;pc=black;pw=0"' Right--3 shape[1][43]="func=rect;X=145;Y=80;width=2;height=80;angle=90;bc=black;pc=black;pw=0" shape[1][44]="func=ell;X=45.5;Y=160;width=50;height=10;angle=0;bc=black;pc=black;pw=0"' Mouth--1 shape[1][45]="func=ell;X=48;Y=155;width=45;height=10;angle=0;bc=yellow;pc=black;pw=0"' Moth--1 shape[1][46]="func=ell;X=100;Y=160;width=50;height=10;angle=0;bc=black;pc=black;pw=0"' Mouth--2 shape[1][47]="func=ell;X=102;Y=155;width=45;height=10;angle=0;bc=yellow;pc=black;pw=0"' Mouth--2 shape[1][48]="func=ell;X=240;Y=323;width=100;height=40;angle=-10;bc=orangered;pc=black;pw=3"' Tail--1 shape[1][49]="func=ell;X=320;Y=290;width=100;height=40;angle=-30;bc=orangered;pc=black;pw=3"' Tail--1 shape[1][50]="func=ell;X=-37;Y=320;width=88;height=48;angle=0;bc=orangered;pc=black;pw="' Foot shape[1][51]="func=ell;X=-39;Y=322;width=30;height=46;angle=0;bc=yellow;pc=black;pw="' Foot shape[1][52]="func=ell;X=-32;Y=322;width=30;height=46;angle=0;bc=orangered;pc=black;pw="' Foot shape[1][53]="func=ell;X=-43;Y=320;width=10;height=10;angle=0;bc=yellow;pc=black;pw="' Foot--1 shape[1][54]="func=ell;X=-48;Y=330;width=10;height=10;angle=0;bc=orangered;pc=black;pw=0"' Foot--1 shape[1][55]="func=ell;X=-49;Y=340;width=10;height=10;angle=0;bc=yellow;pc=black;pw=0"' Foot--1 shape[1][56]="func=ell;X=-47;Y=350;width=10;height=10;angle=0;bc=orangered;pc=black;pw=0"' Foot--1 shape[1][57]="func=ell;X=-43;Y=360;width=10;height=10;angle=0;bc=yellow;pc=black;pw=0"' Foot--1 shape[1][58]="func=ell;X=210;Y=280;width=60;height=80;angle=30;bc=orangered;pc=black;pw=1"' Foot--2 shape[1][59]="func=rect;X=220;Y=340;width=30;height=20;angle=0;bc=yellow;pc=black;pw=2"' Foot--2 shape[1][60]="func=ell;X=6;Y=285;width=60;height=80;angle=10;bc=orangered;pc=black;pw=0"' Toe shape[1][61]="func=rect;X=55;Y=228;width=3;height=135;angle=0;bc=black;pc=black;pw=0"' Line--1 shape[1][62]="func=rect;X=93;Y=228;width=3;height=135;angle=13;bc=black;pc=black;pw=0"' Line--2 shape[1][63]="func=rect;X=127;Y=223;width=3;height=137;angle=13;bc=black;pc=black;pw=0"' Line--2 shape[1][64]="func=ell;X=160;Y=235;width=3;height=130;angle=13;bc=black;pc=black;pw=0"' Line--3 shape[1][65]="func=rect;X=205;Y=293;width=15;height=55;angle=10;bc=orangered;pc=black;pw=0"' Foot--2 shape[1][66]="func=ell;X=210;Y=350;width=3;height=14;angle=10;bc=green;pc=black;pw=2"' Line--4 shape[1][67]="func=ell;X=233;Y=346;width=3;height=10;angle=0;bc=black;pc=black;pw=0"' Cross--1 shape[1][68]="func=ell;X=229;Y=350;width=10;height=2;angle=0;bc=black;pc=black;pw=2"' Cross--2 shape[1][69]="func=rect;X=59;Y=337;width=20;height=25;angle=8;bc=yellow;pc=black;pw=0"' rect--1 shape[1][70]="func=rect;X=120;Y=335;width=30;height=25;angle=12;bc=yellow;pc=black;pw=0"' rect--2 ' Blinking and Rotation s[2]="1=0.8" shX[2]="1=0" shY[2]="1=0 'shape[1][0] = "func=rect;x=200;y=40;width=100;height=50;angle=30;bc=darkcyan;pc=darkslategray;pw=2" 'shape[1][0] = "func=rect;x=200;y=100;width=100;height=50;angle=-30;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=200;y=50;width=44;height=160;angle=15;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=200;y=100;width=100;height=50;angle=-15;bc=Gainsboro;pc=darkslategray;pw=2" 'shape[1][0] = "func=ell;x=300;y=40;width=33;height=22;bc=yellowgreen;pw=0;tag=eye" ' eye 1 ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=235;width=33;height=22;bc=greenyellow;pw=0;tag=eye" ' eye 2 ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=133;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> 'shape[1][0] = "func=ell;x=300;y=153;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> endsub End>VVW418.sb< Start>VVZ054-0.sb< ' program : yvan leduc ' avatar generator ' program no: VVZ054-0 ' July 30th 2016 ' August challenge proposed by Nonki Takahashi ' Small Basic MSDN Forum ' Not = "True=False;False=True;" GraphicsWindow.BackgroundColor="white" GraphicsWindow.Width=400 GraphicsWindow.height=400 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.KeyDown = OnKeyDown While "True" GraphicsWindow.Clear() x=1 y=1 f1=math.GetRandomNumber(60)+10 h1=math.GetRandomNumber(100)+300 h2=math.GetRandomNumber(100)+300 For x= 1 To 400 Step f1 a=math.GetRandomNumber(50) b=math.GetRandomNumber(45) c=math.GetRandomNumber(30) d=math.GetRandomNumber(10) c1=math.GetRandomNumber(255) c2=math.GetRandomNumber(255) c3=math.GetRandomNumber(255) color=GraphicsWindow.GetColorFromRGB(c1,c2,c3) f2=math.GetRandomNumber(60)+10 For y= 400 To 1 Step -f2 ' sommet , cote gauche,coté droit GraphicsWindow.BrushColor=color GraphicsWindow.DrawTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.FillTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.DrawTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.FillTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.DrawTriangle(b+x,a+y,c+x,a+y,b+x,d+y) GraphicsWindow.FillTriangle(b+x,a+y,c+x,a+y,b+x,d+y) GraphicsWindow.DrawTriangle(a+x,d+y,b+x,a+y,a+x,d+y) GraphicsWindow.FillTriangle(a+x,d+y,b+x,a+y,a+x,d+y) EndFor endfor keyDown = "False" While Not[keyDown] Program.Delay(200) EndWhile EndWhile Sub OnKeyDown keyDown = "True" EndSub End>VVZ054-0.sb< Start>VVZ054.sb< ' program : yvan leduc ' avatar generator ' program no: ' July 30th 2016 ' August challenge proposed by Nonki Takahashi ' Small Basic MSDN Forum ' GraphicsWindow.BackgroundColor="white" GraphicsWindow.Width=400 GraphicsWindow.height=400 GraphicsWindow.top=0 GraphicsWindow.left=0 x=1 y=1 f1=math.GetRandomNumber(60)+10 h1=math.GetRandomNumber(100)+300 h2=math.GetRandomNumber(100)+300 For x= 1 To 400 Step f1 a=math.GetRandomNumber(50) b=math.GetRandomNumber(45) c=math.GetRandomNumber(30) d=math.GetRandomNumber(10) c1=math.GetRandomNumber(255) c2=math.GetRandomNumber(255) c3=math.GetRandomNumber(255) color=GraphicsWindow.GetColorFromRGB(c1,c2,c3) f2=math.GetRandomNumber(60)+10 For y= 400 To 1 Step -f2 ' sommet , cote gauche,coté droit GraphicsWindow.BrushColor=color GraphicsWindow.DrawTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.FillTriangle(a+x,b+y,a+x,b+y,d+x,c+y) GraphicsWindow.DrawTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.FillTriangle(c+x,b+y,d+x,c+y,b+x,c+y) GraphicsWindow.DrawTriangle(b+x,a+y,c+x,a+y,b+x,d+y) GraphicsWindow.FillTriangle(b+x,a+y,c+x,a+y,b+x,d+y) GraphicsWindow.DrawTriangle(a+x,d+y,b+x,a+y,a+x,d+y) GraphicsWindow.FillTriangle(a+x,d+y,b+x,a+y,a+x,d+y) EndFor endfor End>VVZ054.sb< Start>VWB076.sb< 'test cache & reverse loop in Small Basic message = "hello world" someText = "1=azd;2=4hg1m;3= ;4=?!l" CreateContainerContent() cache = Array.GetItemCount(testContainer) CompileSomeStuffBeforeTest() 'this produced: Other task is running error @ 1st run Niter=1000 comment = "Empty Reverse loop (GetItemCount)" InitialiseTest() For it=1 to Niter For i = Array.GetItemCount(testContainer) To 1 Step -1 EndFor EndFor CollectResults() comment = "Empty Reverse loop (GetItemCount) [repeated]" InitialiseTest() For it=1 to Niter For i = Array.GetItemCount(testContainer) To 1 Step -1 EndFor EndFor CollectResults() comment = "Empty Forward loop (GetItemCount)" InitialiseTest() For it=1 to Niter For i = 1 To Array.GetItemCount(testContainer) EndFor EndFor CollectResults() comment="Empty loop forward 10000x" InitialiseTest() For it=1 to Niter For i = 1 To 10000 EndFor EndFor CollectResults() comment="Empty loop reverse 10000x" InitialiseTest() For it=1 to Niter For i = 10000 To 1 Step -1 EndFor EndFor CollectResults() TextWindow.WriteLine("Results") For i = 1 To testCounter TextWindow.WriteLine("") TextWindow.Write(i + ": ") TextWindow.Write(indexedComment[i] + ": ") TextWindow.WriteLine(indexedTimeTaken[i]/Niter) EndFor TextWindow.PauseWithoutMessage() '----------------------------------------------------Subroutines--------------------------------------- Sub InitialiseTest testCounter = testCounter + 1 start = Clock.ElapsedMilliseconds EndSub Sub CollectResults indexedComment[testCounter] = comment timeTaken = Clock.ElapsedMilliseconds - start indexedTimeTaken[testCounter] = timeTaken EndSub Sub CreateContainerContent For i = 1 To 10000 If Math.Remainder(i, 2) = 0 Then testContainer[i] = Math.GetRandomNumber(9) Else testContainer[i] = someText[Math.GetRandomNumber(Array.GetItemCount(someText))] EndIf EndFor EndSub Sub CompileSomeStuffBeforeTest TextWindow.WriteLine(message) ''TextWindow.Hide() ''GraphicsWindow.Show() ''GraphicsWindow.DrawBoundText(10, 10, 50, message) ''Program.Delay(2000) ''GraphicsWindow.Hide() ''TextWindow.Clear() EndSub End>VWB076.sb< Start>VWB484.sb< clockXRad = 200 clockYRad = 200 InitClockFace() InitClockHands() While "True" UpdateClockHands() Program.Delay(1000) EndWhile Sub InitClockFace width = GraphicsWindow.Width height = GraphicsWindow.Height GraphicsWindow.BackgroundColor = "Black" For g = 1 To 12 angle = Math.GetRadians(g*360/12-90) x = width/2+clockXRad*Math.Cos(angle) y = height/2+clockYRad*Math.Sin(angle) numer = g denom = 12 If Text.IsSubText(numer/6,".") = "False" Then denom = denom/6 numer = numer/6 EndIf If Text.IsSubText(numer/3,".") = "False" Then denom = denom/3 numer = numer/3 EndIf If Text.IsSubText(numer/2,".") = "False" Then denom = denom/2 numer = numer/2 EndIf If Text.IsSubText(numer/2,".") = "False" Then denom = denom/2 numer = numer/2 EndIf If denom = 1 And numer = 1 Then fraction = "" fontsize = 30 Else fraction = numer+"/"+denom+" " fontsize = 12 EndIf GraphicsWindow.FontSize = fontsize GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() txt = Shapes.AddText(fraction+"π") Shapes.Move(txt,x-(Text.GetLength(fraction)+1)+fontsize/2,y-fontsize) EndFor EndSub Sub InitClockHands GraphicsWindow.PenColor = "Blue" GraphicsWindow.PenWidth = 1 secondAngle = Math.GetRadians(Clock.Second*6-90) secondLength = ((clockXRad+clockYRad)/2)/2 x[1] = width/2+secondLength*Math.Cos(secondAngle+Math.GetRadians(45)) y[1] = height/2+secondLength*Math.Sin(secondAngle+Math.GetRadians(45)) x[2] = x[1]+secondLength*Math.Cos(secondAngle+Math.GetRadians(-45)) y[2] = y[1]+secondLength*Math.Sin(secondAngle+Math.GetRadians(-45)) secondHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) secondHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 2 minuteAngle = Math.GetRadians(Clock.Minute*6-90) minuteLength = ((clockXRad+clockYRad)/2)/3 x[1] = width/2+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(30)) y[1] = height/2+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(30)) x[2] = x[1]+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(-30)) y[2] = y[1]+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(-30)) x[3] = x[2]+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(30)) y[3] = y[2]+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(30)) minuteHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) minuteHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) minuteHand[3] = Shapes.AddLine(x[2],y[2],x[3],y[3]) GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 4 hourAngle = Math.GetRadians(Clock.Hour*30-90) hourLength = ((clockXRad+clockYRad)/2)/4 x[1] = width/2+hourLength*Math.Cos(hourAngle+Math.GetRadians(90/4)) y[1] = height/2+hourLength*Math.Sin(hourAngle+Math.GetRadians(90/4)) x[2] = x[1]+hourLength*Math.Cos(hourAngle+Math.GetRadians(-90/4)) y[2] = y[1]+hourLength*Math.Sin(hourAngle+Math.GetRadians(-90/4)) x[3] = x[2]+hourLength*Math.Cos(hourAngle+Math.GetRadians(90/4)) y[3] = y[2]+hourLength*Math.Sin(hourAngle+Math.GetRadians(90/4)) x[4] = x[3]+hourLength*Math.Cos(hourAngle+Math.GetRadians(-90/4)) y[4] = y[3]+hourLength*Math.Sin(hourAngle+Math.GetRadians(-90/4)) hourHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) hourHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) hourHand[3] = Shapes.AddLine(x[2],y[2],x[3],y[3]) hourHand[4] = Shapes.AddLine(x[3],y[3],x[4],y[4]) EndSub Sub UpdateClockHands GraphicsWindow.PenColor = "Blue" GraphicsWindow.PenWidth = 1 secondAngle = Math.GetRadians(Clock.Second*6-90) x[1] = width/2+secondLength*Math.Cos(secondAngle+Math.GetRadians(45)) y[1] = height/2+secondLength*Math.Sin(secondAngle+Math.GetRadians(45)) x[2] = x[1]+secondLength*Math.Cos(secondAngle+Math.GetRadians(-45)) y[2] = y[1]+secondLength*Math.Sin(secondAngle+Math.GetRadians(-45)) For i = 1 To 2 Shapes.Remove(secondHand[i]) EndFor secondHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) secondHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 2 minuteAngle = Math.GetRadians(Clock.Minute*6-90) x[1] = width/2+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(30)) y[1] = height/2+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(30)) x[2] = x[1]+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(-30)) y[2] = y[1]+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(-30)) x[3] = x[2]+minuteLength*Math.Cos(minuteAngle+Math.GetRadians(30)) y[3] = y[2]+minuteLength*Math.Sin(minuteAngle+Math.GetRadians(30)) For i = 1 To 3 Shapes.Remove(minuteHand[i]) EndFor minuteHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) minuteHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) minuteHand[3] = Shapes.AddLine(x[2],y[2],x[3],y[3]) GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 4 hourAngle = Math.GetRadians(Clock.Hour*30-90) x[1] = width/2+hourLength*Math.Cos(hourAngle+Math.GetRadians(90/4)) y[1] = height/2+hourLength*Math.Sin(hourAngle+Math.GetRadians(90/4)) x[2] = x[1]+hourLength*Math.Cos(hourAngle+Math.GetRadians(-90/4)) y[2] = y[1]+hourLength*Math.Sin(hourAngle+Math.GetRadians(-90/4)) x[3] = x[2]+hourLength*Math.Cos(hourAngle+Math.GetRadians(90/4)) y[3] = y[2]+hourLength*Math.Sin(hourAngle+Math.GetRadians(90/4)) x[4] = x[3]+hourLength*Math.Cos(hourAngle+Math.GetRadians(-90/4)) y[4] = y[3]+hourLength*Math.Sin(hourAngle+Math.GetRadians(-90/4)) For i = 1 To 4 Shapes.Remove(hourHand[i]) EndFor hourHand[1] = Shapes.AddLine(width/2,height/2,x[1],y[1]) hourHand[2] = Shapes.AddLine(x[1],y[1],x[2],y[2]) hourHand[3] = Shapes.AddLine(x[2],y[2],x[3],y[3]) hourHand[4] = Shapes.AddLine(x[3],y[3],x[4],y[4]) EndSub End>VWB484.sb< Start>VWC770.sb< 'Window GraphicsWindow.Hide() GraphicsWindow.Width = 1000 GraphicsWindow.Height = 500 GraphicsWindow.Left = (Desktop.Width - 1000) / 2 GraphicsWindow.Top = (Desktop.Height - 590) / 2 GraphicsWindow.Title = "Dragon Game" GraphicsWindow.CanResize = "False" GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Microsoft Sans Serif" GraphicsWindow.BrushColor = "DodgerBlue" GraphicsWindow.PenColor = "DarkSlateGray" GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(15, 15, 15) GraphicsWindow.Show() AddLoadingScreen() 'Variables CurrentMenu = "" CanPlay = "" FillingBarSize = 0 PlayerLife = 396 EnemyLife = 396 CanClickSpace = "Yes" CurrentFrame = 1 'Sounds SndGameBack = "http://66.90.91.26/ost/dragon-age-origins/yewlscossy/12-darkspawn-in-the-wilds.mp3" SndExplosion = "http://soundbible.com/grab.php?id=538&type=mp3" SndVictory = "http://soundbible.com/grab.php?id=1823&type=mp3" SndDefeat = "http://soundbible.com/grab.php?id=1830&type=mp3" SndDragonAttacks = "http://soundbible.com/grab.php?id=1165&type=mp3" SndPlayerHurts = "http://soundbible.com/grab.php?id=462&type=mp3" 'Images'Images ImgDragonLogo = ImageList.LoadImage("http://www.sacredwiki.org/images/b/b1/Dragonmage_Logo.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgPlayer = ImageList.LoadImage("http://www.fireemblemwiki.org/w/images/a/aa/Bs_fe06_enemy_mage_anima.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgGameBackground = ImageList.LoadImage("http://th09.deviantart.net/fs71/PRE/f/2013/050/0/c/level_background_for_a_mobile_game__by_bvigec-d5vi8b0.jpg") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgEnemy = ImageList.LoadImage("http://cdn2.scratch.mit.edu/get_image/gallery/435997_170x100.png?v=1400465435.23") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgExplosion = ImageList.LoadImage("http://www.imarvintpa.com/Mapping/Overlays/Effects/Fire/Fireball/explosion_4.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgFinalExplosion = ImageList.LoadImage("http://img3.wikia.nocookie.net/__cb20130805183122/clubpenguin/images/d/d0/Explode.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgPlayerFB = ImageList.LoadImage("http://www.sunfireinvestmentproperties.com/wp-content/themes/default/images/fireball.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgEnemyFB = ImageList.LoadImage("https://support.ouat-e.com/media/luckypirate/images/help/tool_fireball.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgVs = ImageList.LoadImage("http://images3.wikia.nocookie.net/__cb20091129200245/pokeespectaculos/es/images/archive/6/64/20100330003313!Vs.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgCursor = ImageList.LoadImage("http://files.softicons.com/download/business-icons/onebit-2-icons-by-icojoy/png/48/onebit_27.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgDefeat = ImageList.LoadImage("http://i.imgur.com/u7vHLuX.png") Controls.SetSize(LSFillingBar, FillingBarSize + 41, 11) FillingBarSize = FillingBarSize + 41 ImgVictory = ImageList.LoadImage("http://i.imgur.com/13jOyOI.png") Controls.SetSize(LSFillingBar, FillingBarSize + 45, 11) 'Main GraphicsWindow.Clear() AddMainMenu() 'SUBROUTINES '*************** 'AddLoadingScreen Sub AddLoadingScreen CurrentMenu = "LoadingScreenMenu" ImgBackLoading = ImageList.LoadImage("http://wallpaperesque.com/wp-content/uploads/plixpapers1502/nintendo_wallpaper_background_49056.jpg") GraphicsWindow.DrawResizedImage(ImgBackLoading, 0, 0, 1000, 500) LSBackReck = Shapes.AddRectangle(200, 40) Shapes.Move(LSBackReck, 400, 315) GraphicsWindow.BrushColor = "White" LSLabel = Shapes.AddText("Loading") Shapes.Move(LSLabel, 470, 326) GraphicsWindow.BrushColor = "Black" LSLBBack = Shapes.AddRectangle(500, 15) Shapes.Move(LSLBBack, 250, 400) GraphicsWindow.BrushColor = "DodgerBlue" GraphicsWindow.PenColor = "DodgerBlue" LSFillingBar = Shapes.AddRectangle(0, 11) Shapes.Move(LSFillingBar, 252, 402) EndSub 'AddMainMenu Sub AddMainMenu GraphicsWindow.PenColor = "DarkSlateGray" MMDragonLogo = Shapes.AddImage(ImgDragonLogo) Shapes.Zoom(MMDragonLogo, 0.7, 0.7) Shapes.Move(MMDragonLogo, 392, -25) CurrentMenu = "MainMenu" GraphicsWindow.DrawResizedImage(ImgBackLoading, 0, 0, 1000, 500) GraphicsWindow.BrushColor = "DodgerBlue" MMBackReck = Shapes.AddRectangle(200, 40) Shapes.Move(MMBackReck, 400, 300) MMBackReck2 = Shapes.AddRectangle(200, 40) Shapes.Move(MMBackReck2, 400, 360) MMBackReck3 = Shapes.AddRectangle(200, 40) Shapes.Move(MMBackReck3, 400, 420) GraphicsWindow.BrushColor = "White" MMLabel = Shapes.AddText("Play") Shapes.Move(MMLabel, 482, 311) MMLabel2 = Shapes.AddText("Tutorial") Shapes.Move(MMLabel2, 472, 371) MMLabel3 = Shapes.AddText("Exit") Shapes.Move(MMLabel3, 485, 431) Cursor = Shapes.AddImage(ImgCursor) Shapes.HideShape(Cursor) EndSub 'AddGame Sub AddGame Sound.Play(SndGameBack) CurrentMenu = "GameMenu" CanPlay = "No" GraphicsWindow.DrawResizedImage(ImgGameBackground, 0, 0, 1000, 500) Player = Shapes.AddImage(ImgPlayer) Shapes.Move(Player, 150, 350) Enemy = Shapes.AddImage(ImgEnemy) Shapes.Move(Enemy, 1100, -50) GraphicsWindow.BrushColor = "DodgerBlue" Balloon = Shapes.AddRectangle(150, 35) Shapes.Move(Balloon, 85, 300) GraphicsWindow.BrushColor = "White" CharacterText = Shapes.AddText("Oh no! A dragon!") Shapes.Move(CharacterText, 100, 310) GraphicsWindow.PenColor = "Green" GraphicsWindow.BrushColor = "Black" TopMenuBack = Shapes.AddRectangle(1000, 70) Shapes.SetOpacity(TopMenuBack, 50) PlayerLBBack = Shapes.AddRectangle(400, 20) Shapes.Move(PlayerLBBack, 50, 25) GraphicsWindow.PenColor = "Lime" GraphicsWindow.BrushColor = "Lime" PlayerLBFill = Shapes.AddRectangle(396, 16) Shapes.Move(PlayerLBFill, 52, 27) GraphicsWindow.PenColor = "Brown" GraphicsWindow.BrushColor = "Black" EnemyLBBack = Shapes.AddRectangle(400, 20) Shapes.Move(EnemyLBBack, 550, 25) GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" EnemyLBFill = Shapes.AddRectangle(396, 16) Shapes.Move(EnemyLBFill, 552, 27) VsLogo = Shapes.AddImage(ImgVs) Shapes.Move(VsLogo, 470, 10) PlayGameIntro() EndSub 'PlayGameIntro Sub PlayGameIntro For MoveX = 0 To 400 Step 0.009 Shapes.Move(Enemy, 1100 - MoveX, (-150) + MoveX) EndFor Shapes.Move(Balloon, 720, 230) Shapes.Move(CharacterText, 738, 238) Shapes.SetText(CharacterText, "Prepare yourself!") For MoveX = 0 To 50 Step 0.003 Shapes.Move(Player, 150 + MoveX, 350 + MoveX) EndFor CurrentMenu = "ClickToPlay" Controls.SetSize(Balloon, 170, 35) Shapes.Move(Balloon, 415, 75) Shapes.Move(CharacterText, 429, 83) Shapes.SetText(CharacterText, "Click anyware to play") EndSub 'EnemyAttacks Sub EnemyAttacks If CanPlay = "Yes" Then Shapes.Remove(PlayerFB) Shapes.Remove(EnemyFB) Shapes.Remove(Border) If PlayerLife <= 0 Or EnemyLife <= 0 Then CanPlay = "No" If PlayerLife > 0 Then Victory() ElseIf EnemyLife > 0 Then Defeat() EndIf Else Sound.Stop(SndDragonAttacks) Sound.Play(SndDragonAttacks) RandomBorderX = Math.GetRandomNumber(650) While RandomBorderX < 250 RandomBorderX = Math.GetRandomNumber(650) EndWhile GraphicsWindow.PenColor = "DarkSlateGray" GraphicsWindow.BrushColor = "DarkSlateGray" Border = Shapes.AddRectangle(100, 100) Shapes.Move(Border, RandomBorderX, 345) Shapes.SetOpacity(Border, 50) EnemyFB = Shapes.AddImage(ImgEnemyFB) Shapes.HideShape(EnemyFB) Shapes.Move(EnemyFB, 700, 370) For ZoomIn = 1 To 1.2 Step 0.0001 Shapes.Zoom(Enemy, ZoomIn, ZoomIn) EndFor Shapes.ShowShape(EnemyFB) For ZoomOut = 1.2 To 1 Step -0.0001 Shapes.Zoom(Enemy, ZoomOut, ZoomOut) EndFor For MoveX = 700 To 200 Step - 0.05 Shapes.Move(EnemyFB, MoveX, 370) EndFor If Shapes.GetLeft(EnemyFB) < 201 Then PlayerHurts() CanClickSpace = "Yes" EnemyAttacks() EndIf EndIf EndIf EndSub 'PlayerAttacks Sub PlayerAttacks If CanPlay = "Yes" Then Shapes.Remove(Border) Shapes.Remove(EnemyFB) Shapes.Remove(PlayerFB) If EnemyLife <= 0 Or PlayerLife <= 0 Then CanPlay = "No" If PlayerLife > 0 Then Victory() ElseIf EnemyLife > 0 Then Defeat() EndIf Else PlayerFB = Shapes.AddImage(ImgPlayerFB) Shapes.HideShape(PlayerFB) Shapes.Move(PlayerFB, 160, 300) For ZoomIn = 1 To 1.2 Step 0.0001 Shapes.Zoom(Player, ZoomIn, ZoomIn) EndFor Shapes.ShowShape(PlayerFB) For ZoomOut = 1.2 To 1 Step -0.0001 Shapes.Zoom(Player, ZoomOut, ZoomOut) EndFor For MoveX = 0 To 540 Step 0.03 Shapes.Move(PlayerFB, 160 + MoveX, 300) EndFor If Shapes.GetLeft(PlayerFB) > 699 Then Shapes.Remove(PlayerFB) EnemyHurts() CanClickSpace = "Yes" EnemyAttacks() EndIf EndIf EndIf EndSub 'PlayerHurts Sub PlayerHurts If CanPlay = "Yes" Then Sound.Stop(SndPlayerHurts) Sound.Play(SndPlayerHurts) PlayerExplosion = Shapes.AddImage(ImgExplosion) Shapes.HideShape(PlayerExplosion) Shapes.Move(PlayerExplosion, 125, 260) Shapes.Zoom(PlayerExplosion, 0.5, 0.5) Shapes.ShowShape(PlayerExplosion) Controls.SetSize(PlayerLBFill, PlayerLife - 66, 16) PlayerLife = PlayerLife - 66 For ZoomIn = 0.5 To 0.6 Step 0.00003 Shapes.Zoom(PlayerExplosion, ZoomIn, ZoomIn) EndFor Shapes.Remove(PlayerExplosion) EndIf EndSub 'EnemyHurts Sub EnemyHurts If CanPlay = "Yes" Then Sound.Stop(SndExplosion) Sound.Play(SndExplosion) EnemyExplosion = Shapes.AddImage(ImgExplosion) Shapes.HideShape(EnemyExplosion) Shapes.Move(EnemyExplosion, 700, 250) Shapes.Zoom(EnemyExplosion, 0.5, 0.5) Shapes.ShowShape(EnemyExplosion) Controls.SetSize(EnemyLBFill, EnemyLife - 66, 16) EnemyLife = EnemyLife - 66 For ZoomIn = 0.5 To 0.7 Step 0.00003 Shapes.Zoom(EnemyExplosion, ZoomIn, ZoomIn) EndFor Shapes.Remove(EnemyExplosion) EndIf EndSub 'Victory Sub Victory CurrentMenu = "Victory" Shapes.Remove(EnemyExplosion) Shapes.Remove(PlayerExplosion) Sound.Stop(SndGameBack) Sound.Play(SndVictory) FinalEplosion = Shapes.AddImage(ImgFinalExplosion) Shapes.Move(FinalEplosion, 400, 100) For Fade = 100 To 0 Step -0.01 Shapes.SetOpacity(FinalEplosion, Fade) EndFor VictoryLogo = Shapes.AddImage(ImgVictory) Shapes.Zoom(VictoryLogo, 0.5, 0.5) VLX = ImageList.GetWidthOfImage(ImgVictory) Shapes.Move(VictoryLogo, (1000 - VLX) / 2, -200) Shapes.SetOpacity(VictoryLogo, 0) GraphicsWindow.BrushColor = "Black" VSBtnContinue = Controls.AddButton("ok", 0, 0) Controls.HideControl(VSBtnContinue) Controls.Move(VSBtnContinue, 450, 350) Controls.SetSize(VSBtnContinue, 100, 30) For GoDown = Shapes.GetTop(Enemy) To 600 Step 0.008 Shapes.Move(Enemy, Shapes.GetLeft(Enemy), GoDown) EndFor For Appear = 0 To 100 Step 0.007 Shapes.SetOpacity(VictoryLogo, Appear) EndFor Controls.ShowControl(VSBtnContinue) EndSub 'Defeat Sub Defeat CurrentMenu = "Defeat" Sound.Stop(SndGameBack) Sound.Play(SndDefeat) DefeatLogo = Shapes.AddImage(ImgDefeat) DLX = ImageList.GetWidthOfImage(ImgDefeat) Shapes.Zoom(DefeatLogo, 0.5, 0.5) Shapes.Move(DefeatLogo, (1000 - DLX) / 2, -50) Shapes.SetOpacity(DefeatLogo, 0) GraphicsWindow.BrushColor = "Black" DSBtnContinue = Controls.AddButton("ok", 0, 0) Controls.HideControl(DSBtnContinue) Controls.Move(DSBtnContinue, 450, 350) Controls.SetSize(DSBtnContinue, 100, 30) For GoDown = Shapes.GetTop(Player) To 600 Step 0.008 Shapes.Move(Player, Shapes.GetLeft(Player), GoDown) EndFor For Appear = 0 To 100 Step 0.007 Shapes.SetOpacity(DefeatLogo, Appear) EndFor Controls.ShowControl(DSBtnContinue) EndSub 'AddTutorial Sub AddTutorial CurrentMenu = "Tutorial" GraphicsWindow.Clear() GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(70, 70, 70) GraphicsWindow.PenColor = "Gray" TMBackReck = Shapes.AddRectangle(600, 400) Shapes.Move(TMBackReck, 200, 50) GraphicsWindow.BrushColor = "Black" TMBtnPrevious = Controls.AddButton("Previous", 250, 410) Controls.SetSize(TMBtnPrevious, 100, 28) TMBtnNext = Controls.AddButton("Next", 355, 410) Controls.SetSize(TMBtnNext, 100, 28) TMBtnClose = Controls.AddButton("Close", 650, 410) Controls.SetSize(TMBtnClose, 100, 28) GraphicsWindow.BrushColor = "Black" TMBackReck2 = Shapes.AddRectangle(500, 300) Shapes.Move(TMBackReck2, 250, 100) GraphicsWindow.BrushColor = "Gainsboro" TMText = Shapes.AddText("") Shapes.Move(TMText, 270, 120) TMCurrentFrame = Shapes.AddText("") Shapes.Move(TMCurrentFrame, 490, 70) ChangeFrame() EndSub 'ChangeFrame Sub ChangeFrame If CurrentFrame = 1 Then Shapes.SetText(TMCurrentFrame, "1/4") Shapes.SetText(TMText, "This is you:") TMPlayer = Shapes.AddImage(ImgPlayer) Shapes.Move(TMPlayer, 485, 230) Controls.HideControl(TMBtnPrevious) ElseIf CurrentFrame = 2 Then Shapes.SetText(TMCurrentFrame, "2/4") Shapes.SetText(TMText, "This is the enemy:") TMEnemy = Shapes.AddImage(ImgEnemy) Shapes.Move(TMEnemy, 380, 140) ElseIf CurrentFrame = 3 Then Shapes.SetText(TMCurrentFrame, "3/4") Shapes.SetText(TMText, "This is the enemy fireball:") TMEnemyFB = Shapes.AddImage(ImgEnemyFB) Shapes.Move(TMEnemyFB, 475, 225) ElseIf CurrentFrame = 4 Then Shapes.SetText(TMCurrentFrame, "4/4") Shapes.SetText(TMText, "Press 'Spacebar' when the enemy fireball is over this rectangle:") TMRectangle = Shapes.AddRectangle(100, 100) Shapes.SetOpacity(TMRectangle, 10) Shapes.Move(TMRectangle, 450, 200) Controls.HideControl(TMBtnNext) EndIf EndSub 'MouseUp GraphicsWindow.MouseUp = MouseUp Sub MouseUp x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If CurrentMenu = "MainMenu" Then If x > 400 And x < 600 And y > 300 And y < 340 Then Sound.PlayClick() GraphicsWindow.Clear() AddGame() ElseIf x > 400 And x < 600 And y > 360 And y < 400 Then Sound.PlayClick() AddTutorial() ElseIf x > 400 And x < 600 And y > 420 And y < 460 Then Sound.PlayClickAndWait() Program.End() EndIf ElseIf CurrentMenu = "ClickToPlay" Then Shapes.HideShape(Balloon) Shapes.HideShape(CharacterText) CurrentMenu = "GameMenu" CanPlay = "Yes" EnemyAttacks() EndIf EndSub 'KeyDown GraphicsWindow.KeyDown = KeyDown Sub KeyDown If CurrentMenu = "GameMenu" Then If CanPlay = "Yes" Then If GraphicsWindow.LastKey = "Space" Then If CanClickSpace = "Yes" Then CanClickSpace = "No" EnemyFBLeft = Shapes.GetLeft(EnemyFB) BorderLeft = Shapes.GetLeft(Border) If EnemyFBLeft > BorderLeft - 20 And EnemyFBLeft < BorderLeft + 80 Then PlayerAttacks() Else PlayerHurts() EndIf EndIf EndIf EndIf EndIf EndSub 'ButtonClicked Controls.ButtonClicked = ButtonClicked Sub ButtonClicked If Controls.LastClickedButton = VSBtnContinue Or Controls.LastClickedButton = DSBtnContinue Then Sound.PlayClickAndWait() Program.End() ElseIf Controls.LastClickedButton = TMBtnNext Then Sound.PlayClick() CurrentFrame = CurrentFrame + 1 GraphicsWindow.Clear() AddTutorial() ChangeFrame() ElseIf Controls.LastClickedButton = TMBtnPrevious Then Sound.PlayClick() CurrentFrame = CurrentFrame - 1 GraphicsWindow.Clear() AddTutorial() ChangeFrame() ElseIf Controls.LastClickedButton = TMBtnClose Then Sound.PlayClick() GraphicsWindow.Clear() AddMainMenu() EndIf EndSub End>VWC770.sb< Start>VWH504.sb< ' SmallBasic Version 1.2 ' Program: RemaindersChall ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/65e3624b-5700-4bc8-9b62-e67c6bb4e62d/challenge-of-the-month-november-2018 ' ImportURL: http://smallbasic.com/program/? ' SBOnline: http://smallbasic-publicwebsite-dev.azurewebsites.net/Program/view.aspx? ' Extension: --- ' Comment: ' ' Variables: ' ToDo: ' ============================================================================== ' 1. What is the smallest number which when divided by 28 leaves 8 as remainder and when divided by 32 leaves 12 as the remainder? While res = "" x = x + 4 ' 1 ; 4 = gcd(8,12) If (Math.Remainder(x,28) = 8) And (Math.Remainder(x,32) = 12) Then res = x EndIf EndWhile TextWindow.WriteLine("x1 = "+ x) ' 204 ' 2. What is the smallest four digit number which when divided by 16 and 18 leaves remainder 8 in each case? x = 992 ' 999 res = "" While res = "" And x < 10000 x = x + 8 ' 1 If (Math.Remainder(x,16) = 8) And (Math.Remainder(x,18) = 8) Then res = x EndIf EndWhile TextWindow.WriteLine("x2 = "+ x) ' 1016 ' 3. What is the smallest number which when divided by 12 and 18 leaves a remainder of 9? x = 0 res = "" While res = "" x = x + 9 ' 1 If (Math.Remainder(x,12) = 9) And (Math.Remainder(x,18) = 9) Then res = x EndIf EndWhile TextWindow.WriteLine("x3 = "+ x) ' 9 ' 4. What is the smallest number that leaves 3 as remainder when divided by 18 and 24? x = 0 res = "" While res = "" x = x + 3 ' 1 If (Math.Remainder(x,18) = 3) And (Math.Remainder(x,24) = 3) Then res = x EndIf EndWhile TextWindow.WriteLine("x4 = "+ x) ' 3 ' 5. What is the smallest number which when divided by 14 and 21 leaves no remainder? x = 0 res = "" While res = "" x = x + 1 If (Math.Remainder(x,14) = 0) And (Math.Remainder(x,21) = 0) Then res = x EndIf EndWhile TextWindow.WriteLine("x5 = "+ x) ' 42 = 3*14 = 2*21 = lcm(14,21) ' 6. What is the smallest number which leaves 3 as a remainder when divided by 9, 12, 18, and 30? x = 0 res = "" While res = "" x = x + 3 ' 1 If (Math.Remainder(x,9) = 3) And (Math.Remainder(x,12) = 3) And (Math.Remainder(x,18) = 3) And (Math.Remainder(x,30) = 3) Then res = x EndIf EndWhile TextWindow.WriteLine("x6 = "+ x) ' 3 'x1 = 204 'x2 = 1016 'x3 = 9 'x4 = 3 'x5 = 42 'x6 = 3 End>VWH504.sb< Start>VWJ159.sb< GraphicsWindow.Title = "Japanese Clovers + Goat rotate = "True GraphicsWindow.BackgroundColor="tan scale = 1 Shapes_Init_Goat1() name = "Goat 1" Group_Add() i = nGroup grp = group[i] x = grp["x"]-30 y = grp["y"] - 20 Group_Move() Shapes_Init_Goat2() name = "Goat 2" Group_Add() i = nGroup angle = 20 Group_Rotate() i = nGroup nGroup=1 group="" mainn() Sub mainn gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh scale = 1 If rotate Then Shapes_Init_Cloud() name = "Cloud" Group_Add() EndIf Shapes_Init_Branch_1() name = "Branch 1" Group_Add() If rotate Then i = nGroup grp = group[i] x = grp["x"] y = grp["y"] + 10 Group_Move() EndIf Shapes_Init_Branch_2() name = "Branch 2" Group_Add() If rotate Then i = nGroup grp = group[i] x = grp["x"] y = grp["y"] + 10 Group_Move() EndIf Shapes_Init_Branch_3() name = "Branch 3" Group_Add() If rotate Then i = nGroup grp = group[i] x = grp["x"] y = grp["y"] + 10 Group_Move() EndIf Shapes_Init_Branch_4() name = "Branch 4" Group_Add() Shapes_Init_Flower() fx = "1=346;2=339;3=358;4=344;5=364;6=350;7=373;" fy = "1=75;2=88;3=86;4=110;5=108;6=130;7=129;" fa = "1=-5;2=-45;3=30;4=-50;5=30;6=-55;7=35;" fx = fx + "8=268;9=265;10=286;11=278;12=298;" fy = fy + "8=91;9=108;10=108;11=129;12=120;" fa = fa + "8=-30;9=-75;10=-10;11=-90;12=0;" fx = fx + "13=230;14=235;15=233;16=260;17=256;18=280;19=274;20=300;" fy = fy + "13=323;14=314;15=331;16=316;17=334;18=319;19=341;20=324;" fa = fa + "13=-85;14=-50;15=-115;16=-40;17=-115;18=-30;19=-115;20=-20;" For j = 1 To Array.GetItemCount(fx) name = "Flower " + j Group_Add() i = nGroup x = fx[j] y = fy[j] If rotate And 1 <= j And j <= 12 Then y = y + 10 EndIf Group_Move() angle = fa[j] Group_Rotate() EndFor Shapes_Init_Leaf() lx = "1=362;2=362;" ly = "1=150;2=165;" la = "1=-50;2=-80;" lx = lx + "3=275;4=279;5=279;6=321;7=334;8=312;9=316;" ly = ly + "3=164;4=151;5=179;6=140;7=140;8=154;9=170;" la = la + "3=-90;4=-45;5=-140;6=-30;7=10;8=-80;9=-130;" lx = lx + "10=328;11=338;" ly = ly + "10=180;11=188;" la = la + "10=-120;11=-160;" lx = lx + "12=328;13=348;14=329;15=365;16=344;17=355;" ly = ly + "12=209;13=210;14=225;15=227;16=244;17=264;" la = la + "12=-50;13=0;14=-80;15=10;16=-90;17=-100;" lx = lx + "18=371;19=351;20=347;21=374;" ly = ly + "18=282;19=293;20=313;21=309;" la = la + "18=15;19=-40;20=-50;21=40;" lx = lx + "22=296;23=321;24=305;25=339;" ly = ly + "22=301;23=310;24=327;25=320;" la = la + "22=-45;23=-10;24=-90;25=0;" For j = 1 To Array.GetItemCount(lx) name = "Leaf " + j Group_Add() i = nGroup x = lx[j] y = ly[j] If rotate And 1 <= j And j <= 17 Then y = y + 10 EndIf Group_Move() angle = la[j] Group_Rotate() EndFor Shapes_Init_Frame() name = "Frame" Group_Add() If rotate Then cx = gw / 2 cy = gh / 2 angle = 25 For i = 1 To nGroup Group_Rotate() EndFor EndIf EndSub Sub Shapes_Init_Goat1 shX = 299 ' x offset shY = 170 ' y offset shape = "" shape[1] = "func=ell;x=95;y=30;width=35;height=12;angle=30;pw=0;bc=#CCCCCC;" shape[2] = "func=rect;x=45;y=50;width=10;height=120;pw=0;bc=#CCCCCC;" shape[3] = "func=rect;x=85;y=50;width=10;height=120;pw=0;bc=#CCCCCC;" shape[4] = "func=rect;x=20;y=80;width=10;height=120;pw=0;bc=#E5E5E5;" shape[5] = "func=rect;x=60;y=80;width=10;height=120;pw=0;bc=#E5E5E5;" shape[6] = "func=ell;x=0;y=0;width=110;height=120;pw=0;bc=#E5E5E5;" EndSub Sub Shapes_Init_Goat2 shX = 211 ' x offset shY = 98.69 ' y offset shape = "" shape[1] = "func=ell;x=75.28;y=34.31;width=14;height=14;pw=0;bc=Peru;" shape[2] = "func=ell;x=75.87;y=30.35;width=13.2;height=13.2;pw=0;bc=Peru;" shape[3] = "func=ell;x=76.83;y=26.42;width=12.4;height=12.4;pw=0;bc=Peru;" shape[4] = "func=ell;x=78.18;y=22.56;width=11.6;height=11.6;pw=0;bc=Peru;" shape[5] = "func=ell;x=79.89;y=18.80;width=10.8;height=10.8;pw=0;bc=Peru;" shape[6] = "func=ell;x=81.96;y=15.17;width=10;height=10;pw=0;bc=Peru;" shape[7] = "func=ell;x=84.37;y=11.71;width=9.2;height=9.2;pw=0;bc=Peru;" shape[8] = "func=ell;x=87.12;y=8.43;width=8.4;height=8.4;pw=0;bc=Peru;" shape[9] = "func=ell;x=90.17;y=5.37;width=7.6;height=7.6;pw=0;bc=Peru;" shape[10] = "func=ell;x=93.52;y=2.55;width=6.8;height=6.8;pw=0;bc=Peru;" shape[11] = "func=ell;x=97.14;y=0.00;width=6;height=6;pw=0;bc=Peru;" shape[12] = "func=ell;x=35.28;y=34.31;width=14;height=14;pw=0;bc=Peru;" shape[13] = "func=ell;x=35.48;y=30.35;width=13.2;height=13.2;pw=0;bc=Peru;" shape[14] = "func=ell;x=35.32;y=26.42;width=12.4;height=12.4;pw=0;bc=Peru;" shape[15] = "func=ell;x=34.77;y=22.56;width=11.6;height=11.6;pw=0;bc=Peru;" shape[16] = "func=ell;x=33.86;y=18.80;width=10.8;height=10.8;pw=0;bc=Peru;" shape[17] = "func=ell;x=32.59;y=15.17;width=10;height=10;pw=0;bc=Peru;" shape[18] = "func=ell;x=30.98;y=11.71;width=9.2;height=9.2;pw=0;bc=Peru;" shape[19] = "func=ell;x=29.03;y=8.43;width=8.4;height=8.4;pw=0;bc=Peru;" shape[20] = "func=ell;x=26.78;y=5.37;width=7.6;height=7.6;pw=0;bc=Peru;" shape[21] = "func=ell;x=24.23;y=2.55;width=6.8;height=6.8;pw=0;bc=Peru;" shape[22] = "func=ell;x=21.41;y=0.00;width=6;height=6;pw=0;bc=Peru;" shape[23] = "func=tri;x=72.28;y=81.31;x1=7.5;y1=0;x2=0;y2=40;x3=15;y3=40;angle=150;pw=0;bc=#F2F2F2;" shape[24] = "func=tri;x=72.28;y=93.31;x1=7.5;y1=0;x2=0;y2=40;x3=15;y3=40;angle=150;pw=0;bc=#F2F2F2;" shape[25] = "func=tri;x=72.28;y=105.31;x1=7.5;y1=0;x2=0;y2=40;x3=15;y3=40;angle=150;pw=0;bc=#F2F2F2;" shape[26] = "func=ell;x=52.28;y=111.31;width=20;height=20;angle=180;pw=0;bc=White;" shape[27] = "func=ell;x=72.27;y=41.30;width=20;height=20;angle=180;pw=0;bc=White;" shape[28] = "func=ell;x=32.27;y=41.31;width=20;height=20;angle=180;pw=0;bc=White;" shape[29] = "func=tri;x=42.28;y=51.31;x1=20;y1=0;x2=0;y2=70;x3=40;y3=70;angle=180;pw=0;bc=White;" shape[30] = "func=line;x=62.28;y=51.30;x1=0;y1=70.01;x2=19.99;y2=0.00;pw=20;pc=White;" shape[31] = "func=line;x=42.27;y=51.30;x1=40.00;y1=0.00;x2=0.00;y2=0.01;pw=20;pc=White;" shape[32] = "func=line;x=42.27;y=51.31;x1=0.00;y1=0;x2=20.01;y2=70;pw=20;pc=White;" shape[33] = "func=ell;x=0.00;y=45.31;width=35;height=12;angle=-10;pw=0;bc=White;" shape[34] = "func=ell;x=89.55;y=45.31;width=35;height=12;angle=10;pw=0;bc=White;" shape[35] = "func=ell;x=38.56;y=63.81;width=15;height=15;pw=1;pc=Black;bc=White;" shape[36] = "func=ell;x=70.99;y=63.81;width=15;height=15;pw=1;pc=Black;bc=White;" shape[37] = "func=line;x=38.56;y=71.31;x1=0;y1=0;x2=15;y2=0;angle=-15;pw=1;pc=Black;" shape[38] = "func=line;x=70.99;y=71.31;x1=0;y1=0;x2=15;y2=0;angle=15;pw=1;pc=Black;" EndSub Sub Group_Add Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["height"] = shHeight s = scale grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Group_Move Stack.PushValue("local", j) grp = group[i] s = grp["scale"] grp["x"] = x grp["y"] = y shape = grp["shape"] n = Array.GetItemCount(shape) For j = 1 To n shp = shape[j] _x = shp["rx"] _y = shp["ry"] _w2 = shp["width"] / 2 _h2 = shp["height"] / 2 Shapes.Move(shp["obj"], grp["x"] + (_x - _w2) * s + _w2, grp["y"] + (_y - _h2) * s + _h2) EndFor group[i] = grp j = Stack.PopValue("local") EndSub Sub Group_Rotate Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", n) grp = group[i] shape = grp["shape"] moved = "False" If cx <> "" Then moved = "True" Else cx = "" ' To avoid syntax error EndIf If cy <> "" Then moved = "True" Else cy = "" ' To avoid syntax error EndIf If moved Then param["x"] = grp["x"] param["y"] = grp["y"] param["cx"] = cx param["cy"] = cy param["width"] = grp["width"] param["height"] = grp["height"] param["scale"] = 1 param["angle"] = angle Shapes_CalcRotateZoomPos() grp["x"] = x grp["y"] = y EndIf param["cx"] = grp["width"] / 2 param["cy"] = grp["height"] / 2 param["scale"] = grp["scale"] grp["angle"] = grp["angle"] + angle param["angle"] = grp["angle"] n = Array.GetItemCount(shape) Stack.PushValue("local", i) For i = 1 To n shp = shape[i] param["x"] = shp["x"] param["y"] = shp["y"] param["width"] = shp["width"] param["height"] = shp["height"] Shapes_CalcRotateZoomPos() shp["rx"] = x shp["ry"] = y Shapes.Move(shp["obj"], grp["x"] + x, grp["y"] + y) Shapes.Rotate(shp["obj"], shp["angle"] + grp["angle"]) shape[i] = shp EndFor i = Stack.PopValue("local") grp["shape"] = shape group[i] = grp n = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") EndSub Sub Math_CartesianToPolar ' Math | convert cartesian coodinate To polar coordinate ' param x, y - cartesian coordinate ' return r, a - polar coordinate r = Math.SquareRoot(x * x + y * y) If x = 0 And y > 0 Then a = 90 ' [degree] ElseIf x = 0 And y < 0 Then a = -90 ElseIf x = 0 Then a = 0 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf If x < 0 Then a = a + 180 ElseIf x > 0 And y < 0 Then a = a + 360 EndIf EndSub Sub Shapes_CalcRotateZoomPos ' Shapes | Calculate position For rotated and zoomed shape ' param["x"], param["y"] - position of a shape ' param["width"], param["height"] - size of a shape ' param ["cx"], param["cy"] - center of rotation ' param ["angle"] - rotate angle ' param ["scale"] - zoom scale ' return x, y - rotated position of a shape _cx = param["x"] + param["width"] / 2 _cy = param["y"] + param["height"] / 2 x = _cx - param["cx"] y = _cy - param["cy"] Math_CartesianToPolar() a = a + param["angle"] x = r * Math.Cos(a * Math.Pi / 180) * param["scale"] y = r * Math.Sin(a * Math.Pi / 180) * param["scale"] _cx = x + param["cx"] _cy = y + param["cy"] x = _cx - param["width"] / 2 y = _cy - param["height"] / 2 EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init_Branch_1 shX = 251.43 ' x offset shY = 104.72 ' y offset shape = "" shape[1] = "func=line;x=125.36;y=65.28;x1=9.37;y1=14.71;x2=0.00;y2=0;pw=1;" shape[2] = "func=line;x=117.30;y=49.80;x1=8.06;y1=15.48;x2=0.00;y2=0.00;pw=1;" shape[3] = "func=line;x=110.63;y=33.68;x1=6.67;y1=16.12;x2=0.00;y2=0.0;pw=1;" shape[4] = "func=line;x=105.38;y=17.04;x1=5.25;y1=16.64;x2=0.00;y2=0.00;pw=1;" shape[5] = "func=line;x=101.60;y=0.00;x1=3.78;y1=17.04;x2=0.00;y2=0.00;pw=1;" EndSub Sub Shapes_Init_Branch_2 shX = 251.43 ' x offset shY = 104.72 ' y offset shape = "" shape[1] = "func=line;x=119.04;y=96.54;x1=16.12;y1=6.67;x2=0.00;y2=0.00;pw=1;" shape[2] = "func=line;x=103.56;y=88.48;x1=15.48;y1=8.06;x2=0.00;y2=0.0;pw=1;" shape[3] = "func=line;x=88.85;y=79.11;x1=14.71;y1=9.37;x2=0.00;y2=0.00;pw=1;" shape[4] = "func=line;x=75.01;y=68.48;x1=13.84;y1=10.63;x2=0.00;y2=0.0;pw=1;" shape[5] = "func=line;x=62.14;y=56.70;x1=12.87;y1=11.78;x2=0.00;y2=0.00;pw=1;" shape[6] = "func=line;x=50.36;y=43.83;x1=11.78;y1=12.87;x2=0.00;y2=0.00;pw=1;" shape[7] = "func=line;x=39.73;y=29.99;x1=10.63;y1=13.84;x2=0.00;y2=0.00;pw=1;" shape[8] = "func=line;x=30.36;y=15.28;x1=9.37;y1=14.71;x2=0.00;y2=0;pw=1;" shape[9] = "func=line;x=66.00;y=75.24;x1=17.29;y1=0.00;x2=0.00;y2=2.27;pw=1;" shape[10] = "func=line;x=48.56;y=77.51;x1=17.44;y1=0.00;x2=0.00;y2=0.77;pw=1;" EndSub Sub Shapes_Init_Branch_3 shX = 251.43 ' x offset shY = 104.72 ' y offset shape = "" shape[1] = "func=line;x=126.77;y=175.28;x1=8.06;y1=15.47;x2=0.0;y2=0;pw=1;" shape[2] = "func=line;x=117.40;y=160.56;x1=9.37;y1=14.72;x2=0.00;y2=0.00;pw=1;" shape[3] = "func=line;x=106.77;y=146.72;x1=10.63;y1=13.84;x2=0.0;y2=0.00;pw=1;" shape[4] = "func=line;x=94.99;y=133.85;x1=11.78;y1=12.87;x2=0.00;y2=0.00;pw=1;" EndSub Sub Shapes_Init_Branch_4 shX = 251.43 ' x offset shY = 104.72 ' y offset shape = "" shape[1] = "func=line;x=113.57;y=247.84;x1=0;y1=17.44;x2=0.76;y2=0.00;pw=1;" shape[2] = "func=line;x=114.33;y=230.55;x1=0.00;y1=17.29;x2=2.27;y2=0.00;pw=1;" shape[3] = "func=line;x=116.60;y=213.51;x1=0.00;y1=17.04;x2=3.78;y2=0.00;pw=1;" shape[4] = "func=line;x=88.85;y=249.11;x1=14.71;y1=9.37;x2=0.00;y2=0.00;pw=1;" shape[5] = "func=line;x=75.01;y=238.48;x1=13.84;y1=10.63;x2=0.00;y2=0.0;pw=1;" shape[6] = "func=line;x=62.14;y=226.70;x1=12.87;y1=11.78;x2=0.00;y2=0.00;pw=1;" shape[7] = "func=line;x=67.09;y=254.01;x1=15.47;y1=8.06;x2=0.00;y2=0.00;pw=1;" shape[8] = "func=line;x=50.97;y=247.34;x1=16.12;y1=6.67;x2=0.0;y2=0.00;pw=1;" shape[9] = "func=line;x=34.33;y=242.09;x1=16.64;y1=5.25;x2=0.00;y2=0.00;pw=1;" shape[10] = "func=line;x=17.29;y=238.31;x1=17.04;y1=3.78;x2=0.00;y2=0.00;pw=1;" shape[11] = "func=line;x=0.00;y=236.04;x1=17.29;y1=2.27;x2=0.00;y2=0.00;pw=1;" EndSub Sub Shapes_Init_Cloud shX = 206.48 ' x offset shY = 62 ' y offset sha = "func=rect;x=3.52;y=0;width=128;height=22;pw=0;bc=Red|func=rect;x=131.52;y=0;width=50;height=12;pw=0;bc=Red|func=rect;x=3.52;y=22;width=57;height=14;pw=0;bc=Red|func=ell;x=21.52;y=24;width=16;height=16;pw=0;bc=Red|func=ell;x=33.52;y=24;width=16;height=16;pw=0;bc=Red|func=ell;x=47.52;y=24;width=16;height=16;pw=0;bc=Red|func=ell;x=57.52;y=18;width=16;height=16;pw=0;bc=Red|func=ell;x=139.52;y=4;width=16;height=16;pw=0;bc=Red|func=ell;x=148.52;y=10;width=16;height=16;pw=0;bc=Red|func=ell;x=159.52;y=4;width=16;height=16;pw=0;bc=Red|func=ell;x=3.52;y=33;width=12;height=12;pw=0;bc=Red|func=ell;x=11.52;y=33;width=13;height=13;pw=0;bc=Red|func=ell;x=72.52;y=15;width=13;height=13;pw=0;bc=Red|func=ell;x=81.52;y=12;width=12;height=12;pw=0;bc=Red|func=ell;x=93.52;y=14;width=12;height=12;pw=0;bc=Red|func=ell;x=97.52;y=20;width=12;height=12;pw=0;bc=Red|func=ell;x=105.52;y=16;width=12;height=12;pw=0;bc=Red|func=ell;x=114.52;y=14;width=12;height=12;pw=0;bc=Red|func=ell;x=122.52;y=14;width=12;height=12;pw=0;bc=Red|func=ell;x=127.52;y=6;width=12;height=12;pw=0;bc=Red|@L;x=31.39;y=23.06;x1=0.63;y1=0;x2=0;y2=0.18;@B|@L;x=30.83;y=23.24;x1=0.56;y1=0;x2=0;y2=0.25;@B|@L;x=30.36;y=23.49;x1=0.47;y1=0;x2=0;y2=0.30;@B|@L;x=29.97;y=23.79;x1=0.39;y1=0;x2=0;y2=0.34;@B|@L;x=29.67;y=24.13;x1=0.30;y1=0;x2=0;y2=0.39;@B|@L;x=29.47;y=24.52;x1=0.20;y1=0;x2=0;y2=0.41;@B|@L;x=29.35;y=24.93;x1=0.12;y1=0;x2=0;y2=0.43;@B|@L;x=29.33;y=25.36;x1=0.02;y1=0;x2=0;y2=0.44;@B|@L;x=29.33;y=25.8;x1=0;y1=0.0;x2=0.06;y2=0.45;@B|@L;x=29.39;y=26.25;x1=0;y1=0;x2=0.14;y2=0.44;@B|@L;x=29.53;y=26.69;x1=0;y1=0;x2=0.21;y2=0.44;@B|@L;x=29.74;y=27.13;x1=0;y1=0;x2=0.28;y2=0.42;@B|@L;x=30.02;y=27.55;x1=0.0;y1=0;x2=0.35;y2=0.39;@B|@L;x=30.37;y=27.94;x1=0;y1=0;x2=0.40;y2=0.38;@B|@L;x=30.77;y=28.32;x1=0;y1=0;x2=0.46;y2=0.34;@B|@L;x=31.23;y=28.66;x1=0;y1=0;x2=0.52;y2=0.30;@B|@L;x=31.75;y=28.96;x1=0;y1=0;x2=0.56;y2=0.26;@B|@L;x=32.31;y=29.22;x1=0;y1=0;x2=0.60;y2=0.21;@B|@L;x=32.91;y=29.43;x1=0;y1=0;x2=0.64;y2=0.16;@B|@L;x=33.55;y=29.59;x1=0;y1=0;x2=0.68;y2=0.11;@B|@L;x=34.23;y=29.7;x1=0;y1=0.0;x2=0.70;y2=0.04;@B|@L;x=34.93;y=29.72;x1=0;y1=0.02;x2=0.73;y2=0;@B|@L;x=35.66;y=29.62;x1=0;y1=0.10;x2=0.75;y2=0;@B|@L;x=36.41;y=29.45;x1=0;y1=0.17;x2=0.76;y2=0;@B|@L;x=37.17;y=29.2;x1=0;y1=0.25;x2=0.76;y2=0.0;@B|@L;x=37.93;y=28.86;x1=0;y1=0.34;x2=0.76;y2=0;@B|@L;x=38.69;y=28.43;x1=0;y1=0.43;x2=0.75;y2=0;@B|@L;x=39.44;y=27.91;x1=0;y1=0.52;x2=0.72;y2=0;@B|@L;x=40.16;y=27.3;x1=0;y1=0.61;x2=0.69;y2=0.0;@B|@L;x=40.85;y=26.59;x1=0;y1=0.71;x2=0.63;y2=0;@B|@L;x=41.48;y=25.79;x1=0;y1=0.80;x2=0.58;y2=0;@B|@L;x=42.06;y=24.9;x1=0;y1=0.89;x2=0.49;y2=0.0;@B|@L;x=42.55;y=23.92;x1=0;y1=0.98;x2=0.40;y2=0;@B|@L;x=42.95;y=22.87;x1=0;y1=1.05;x2=0.29;y2=0;@B|@L;x=43.24;y=21.77;x1=0;y1=1.10;x2=0.16;y2=0;@B|@L;x=43.40;y=20.62;x1=0;y1=1.15;x2=0.01;y2=0;@B|@L;x=43.28;y=19.45;x1=0.13;y1=1.17;x2=0;y2=0;@B|@L;x=42.98;y=18.28;x1=0.30;y1=1.17;x2=0;y2=0;@B|@L;x=42.51;y=17.15;x1=0.47;y1=1.13;x2=0;y2=0;@B|@L;x=41.89;y=16.08;x1=0.62;y1=1.07;x2=0;y2=0;@B|@L;x=41.11;y=15.11;x1=0.78;y1=0.97;x2=0;y2=0;@B|@L;x=40.20;y=14.25;x1=0.91;y1=0.86;x2=0;y2=0;@B|@L;x=39.18;y=13.55;x1=1.02;y1=0.70;x2=0;y2=0;@B|@L;x=38.09;y=13.02;x1=1.09;y1=0.53;x2=0;y2=0;@B|@L;x=36.96;y=12.67;x1=1.13;y1=0.35;x2=0;y2=0;@B|@L;x=35.83;y=12.5;x1=1.13;y1=0.17;x2=0;y2=0.0;@B|@L;x=34.76;y=12.5;x1=1.07;y1=0.0;x2=0;y2=0.0;@B|@L;x=33.77;y=12.5;x1=0.99;y1=0.0;x2=0;y2=0.14;@B|@L;x=32.90;y=12.64;x1=0.87;y1=0;x2=0;y2=0.26;@B|@L;x=32.16;y=12.9;x1=0.74;y1=0.0;x2=0;y2=0.32;@B|@L;x=31.56;y=13.22;x1=0.60;y1=0;x2=0;y2=0.33;@B|@L;x=31.09;y=13.55;x1=0.47;y1=0;x2=0;y2=0.29;@B|@L;x=30.71;y=13.84;x1=0.38;y1=0;x2=0;y2=0.20;@B|@L;x=30.36;y=14.04;x1=0.35;y1=0;x2=0;y2=0.09;@B|@L;x=29.98;y=14.08;x1=0.38;y1=0.05;x2=0;y2=0;@B|@L;x=29.51;y=13.93;x1=0.47;y1=0.15;x2=0;y2=0;@B|@L;x=28.88;y=13.69;x1=0.63;y1=0.24;x2=0;y2=0;@B|@L;x=28.03;y=13.46;x1=0.85;y1=0.23;x2=0;y2=0;@B|@L;x=26.95;y=13.3;x1=1.08;y1=0.16;x2=0;y2=0.0;@B|@L;x=25.66;y=13.3;x1=1.29;y1=0.0;x2=0;y2=0.03;@B|@L;x=24.19;y=13.33;x1=1.47;y1=0;x2=0;y2=0.31;@B|@L;x=22.66;y=13.64;x1=1.53;y1=0;x2=0;y2=0.66;@B|@L;x=21.17;y=14.3;x1=1.49;y1=0.0;x2=0;y2=1.04;@B|@L;x=19.87;y=15.34;x1=1.30;y1=0;x2=0;y2=1.43;@B|@L;x=18.87;y=16.77;x1=1.00;y1=0;x2=0;y2=1.74;@B|@L;x=18.29;y=18.51;x1=0.58;y1=0;x2=0;y2=1.93;@B|@L;x=18.16;y=20.44;x1=0.13;y1=0;x2=0;y2=1.98;@B|@L;x=18.16;y=22.42;x1=0;y1=0;x2=0.31;y2=1.86;@B|@L;x=18.47;y=24.28;x1=0;y1=0;x2=0.66;y2=1.59;@B|@L;x=19.13;y=25.87;x1=0;y1=0;x2=0.86;y2=1.22;@B|@L;x=19.99;y=27.09;x1=0;y1=0;x2=0.88;y2=0.83;@B|@L;x=20.87;y=27.92;x1=0;y1=0;x2=0.73;y2=0.51;@B|@L;x=21.60;y=28.43;x1=0;y1=0;x2=0.44;y2=0.33;@B|@L;x=22.04;y=28.76;x1=0;y1=0;x2=0.10;y2=0.34;@B|@L;x=21.96;y=29.1;x1=0.18;y1=0.0;x2=0;y2=0.55;@B|@L;x=21.66;y=29.65;x1=0.30;y1=0;x2=0;y2=0.93;@B|@L;x=21.44;y=30.58;x1=0.22;y1=0;x2=0;y2=1.37;@B|@L;x=21.44;y=31.95;x1=0;y1=0;x2=0.13;y2=1.77;@B|@L;x=21.57;y=33.72;x1=0;y1=0;x2=0.68;y2=1.98;@B|@L;x=22.25;y=35.7;x1=0;y1=0.0;x2=1.31;y2=1.93;@B|@L;x=23.56;y=37.63;x1=0;y1=0;x2=1.89;y2=1.59;@B|@L;x=25.45;y=39.22;x1=0;y1=0;x2=2.27;y2=1.00;@B|@L;x=27.72;y=40.22;x1=0.0;y1=0;x2=2.36;y2=0.30;@B|@L;x=30.08;y=40.2;x1=0;y1=0.32;x2=2.10;y2=0.0;@B|@L;x=32.18;y=39.48;x1=0;y1=0.72;x2=1.60;y2=0;@B|@L;x=33.78;y=38.7;x1=0;y1=0.78;x2=1.01;y2=0.0;@B|@L;x=34.79;y=38.2;x1=0;y1=0.5;x2=0.54;y2=0.0;@B|@L;x=35.33;y=38.2;x1=0;y1=0.0;x2=0.36;y2=0.01;@B|@L;x=35.69;y=38.21;x1=0;y1=0;x2=0.56;y2=0.53;@B|@L;x=36.25;y=38.74;x1=0;y1=0;x2=1.10;y2=0.84;@B|@L;x=37.35;y=39.58;x1=0;y1=0;x2=1.80;y2=0.75;@B|@L;x=39.15;y=40.33;x1=0;y1=0;x2=2.41;y2=0.25;@B|@L;x=41.56;y=40;x1=0;y1=0.58;x2=2.67;y2=0;@B|@L;x=44.23;y=38.53;x1=0;y1=1.47;x2=2.46;y2=0;@B|@L;x=46.69;y=36.41;x1=0;y1=2.12;x2=1.79;y2=0;@B|@L;x=48.48;y=34.1;x1=0;y1=2.31;x2=0.91;y2=0.0;@B|@L;x=49.39;y=32.13;x1=0;y1=1.97;x2=0.13;y2=0;@B|@L;x=49.27;y=30.85;x1=0.25;y1=1.28;x2=0;y2=0;@B|@L;x=49.18;y=30.28;x1=0.09;y1=0.57;x2=0;y2=0;@B|@L;x=49.18;y=30.1;x1=0;y1=0.18;x2=0.55;y2=0.0;@B|@L;x=49.73;y=29.73;x1=0;y1=0.37;x2=1.31;y2=0;@B|@L;x=51.04;y=28.63;x1=0;y1=1.10;x2=1.82;y2=0;@B|@L;x=52.86;y=26.54;x1=0;y1=2.09;x2=1.73;y2=0;@B|@L;x=54.59;y=23.62;x1=0;y1=2.92;x2=1.02;y2=0;@B|@L;x=55.52;y=20.45;x1=0.09;y1=3.17;x2=0;y2=0;@B|@L;x=54.39;y=17.75;x1=1.13;y1=2.70;x2=0;y2=0;@B|@L;x=52.75;y=16;x1=1.64;y1=1.75;x2=0;y2=0;@B|@L;x=51.35;y=15.22;x1=1.40;y1=0.78;x2=0;y2=0;@B|@L;x=81.62;y=13;x1=0.0;y1=0;x2=0.52;y2=0.05;@B|@L;x=82.14;y=13.05;x1=0;y1=0;x2=0.50;y2=0.11;@B|@L;x=82.64;y=13.16;x1=0;y1=0;x2=0.45;y2=0.15;@B|@L;x=83.09;y=13.31;x1=0;y1=0;x2=0.41;y2=0.20;@B|@L;x=83.50;y=13.51;x1=0;y1=0;x2=0.34;y2=0.25;@B|@L;x=83.84;y=13.76;x1=0;y1=0;x2=0.29;y2=0.28;@B|@L;x=84.13;y=14.04;x1=0;y1=0;x2=0.22;y2=0.30;@B|@L;x=84.35;y=14.34;x1=0;y1=0;x2=0.16;y2=0.33;@B|@L;x=84.51;y=14.67;x1=0;y1=0;x2=0.09;y2=0.35;@B|@L;x=84.60;y=15.02;x1=0;y1=0;x2=0.03;y2=0.36;@B|@L;x=84.60;y=15.38;x1=0.03;y1=0;x2=0;y2=0.36;@B|@L;x=84.51;y=15.74;x1=0.09;y1=0;x2=0;y2=0.37;@B|@L;x=84.36;y=16.11;x1=0.15;y1=0;x2=0;y2=0.36;@B|@L;x=84.15;y=16.47;x1=0.21;y1=0;x2=0;y2=0.36;@B|@L;x=83.89;y=16.83;x1=0.26;y1=0;x2=0;y2=0.34;@B|@L;x=83.58;y=17.17;x1=0.31;y1=0;x2=0;y2=0.31;@B|@L;x=83.22;y=17.48;x1=0.36;y1=0;x2=0.0;y2=0.30;@B|@L;x=82.81;y=17.78;x1=0.41;y1=0;x2=0;y2=0.26;@B|@L;x=82.36;y=18.04;x1=0.45;y1=0;x2=0;y2=0.23;@B|@L;x=81.87;y=18.27;x1=0.49;y1=0;x2=0;y2=0.19;@B|@L;x=81.34;y=18.46;x1=0.53;y1=0;x2=0;y2=0.14;@B|@L;x=80.78;y=18.6;x1=0.56;y1=0.0;x2=0;y2=0.09;@B|@L;x=80.20;y=18.69;x1=0.58;y1=0;x2=0;y2=0.03;@B|@L;x=79.59;y=18.69;x1=0.61;y1=0.03;x2=0;y2=0;@B|@L;x=78.97;y=18.6;x1=0.62;y1=0.09;x2=0;y2=0.0;@B|@L;x=78.35;y=18.43;x1=0.62;y1=0.17;x2=0;y2=0;@B|@L;x=77.72;y=18.2;x1=0.63;y1=0.23;x2=0.0;y2=0.0;@B|@L;x=77.11;y=17.88;x1=0.61;y1=0.32;x2=0;y2=0;@B|@L;x=76.52;y=17.49;x1=0.59;y1=0.39;x2=0;y2=0;@B|@L;x=75.96;y=17.02;x1=0.56;y1=0.47;x2=0;y2=0;@B|@L;x=75.45;y=16.47;x1=0.51;y1=0.55;x2=0;y2=0;@B|@L;x=74.99;y=15.85;x1=0.46;y1=0.62;x2=0;y2=0;@B|@L;x=74.61;y=15.17;x1=0.38;y1=0.68;x2=0;y2=0;@B|@L;x=74.31;y=14.43;x1=0.30;y1=0.74;x2=0;y2=0;@B|@L;x=74.10;y=13.65;x1=0.21;y1=0.78;x2=0;y2=0;@B|@L;x=73.99;y=12.83;x1=0.11;y1=0.82;x2=0;y2=0;@B|@L;x=73.99;y=12.01;x1=0;y1=0.82;x2=0.01;y2=0;@B|@L;x=74.00;y=11.19;x1=0;y1=0.82;x2=0.11;y2=0;@B|@L;x=74.11;y=10.4;x1=0;y1=0.79;x2=0.22;y2=0.0;@B|@L;x=74.33;y=9.65;x1=0;y1=0.75;x2=0.33;y2=0;@B|@L;x=74.66;y=8.97;x1=0;y1=0.68;x2=0.42;y2=0;@B|@L;x=75.08;y=8.38;x1=0;y1=0.59;x2=0.49;y2=0;@B|@L;x=75.57;y=7.87;x1=0;y1=0.51;x2=0.55;y2=0;@B|@L;x=76.12;y=7.48;x1=0.0;y1=0.39;x2=0.58;y2=0;@B|@L;x=76.70;y=7.18;x1=0;y1=0.30;x2=0.59;y2=0;@B|@L;x=77.29;y=6.98;x1=0;y1=0.20;x2=0.56;y2=0;@B|@L;x=77.85;y=6.85;x1=0;y1=0.13;x2=0.51;y2=0;@B|@L;x=78.36;y=6.78;x1=0;y1=0.07;x2=0.46;y2=0;@B|@L;x=78.82;y=6.73;x1=0.0;y1=0.05;x2=0.37;y2=0;@B|@L;x=79.19;y=6.67;x1=0;y1=0.06;x2=0.31;y2=0;@B|@L;x=79.50;y=6.57;x1=0;y1=0.10;x2=0.25;y2=0;@B|@L;x=79.75;y=6.39;x1=0;y1=0.18;x2=0.21;y2=0;@B|@L;x=79.96;y=6.12;x1=0;y1=0.27;x2=0.22;y2=0;@B|@L;x=80.18;y=5.75;x1=0;y1=0.37;x2=0.27;y2=0;@B|@L;x=80.45;y=5.3;x1=0;y1=0.45;x2=0.38;y2=0.0;@B|@L;x=80.83;y=4.79;x1=0;y1=0.51;x2=0.52;y2=0;@B|@L;x=81.35;y=4.28;x1=0;y1=0.51;x2=0.70;y2=0;@B|@L;x=82.05;y=3.84;x1=0;y1=0.44;x2=0.90;y2=0;@B|@L;x=82.95;y=3.53;x1=0;y1=0.31;x2=1.09;y2=0;@B|@L;x=84.04;y=3.43;x1=0;y1=0.10;x2=1.25;y2=0;@B|@L;x=85.29;y=3.43;x1=0;y1=0;x2=1.33;y2=0.17;@B|@L;x=86.62;y=3.6;x1=0.0;y1=0.0;x2=1.34;y2=0.46;@B|@L;x=87.96;y=4.06;x1=0;y1=0;x2=1.25;y2=0.76;@B|@L;x=89.21;y=4.82;x1=0;y1=0;x2=1.05;y2=1.01;@B|@L;x=90.26;y=5.83;x1=0;y1=0;x2=0.79;y2=1.20;@B|@L;x=91.05;y=7.03;x1=0;y1=0;x2=0.48;y2=1.28;@B|@L;x=91.53;y=8.31;x1=0;y1=0;x2=0.18;y2=1.25;@B|@L;x=91.63;y=9.56;x1=0.08;y1=0;x2=0;y2=1.09;@B|@L;x=91.38;y=10.65;x1=0.25;y1=0;x2=0;y2=0.88;@B|@L;x=91.10;y=11.53;x1=0.28;y1=0;x2=0;y2=0.62;@B|@L;x=90.92;y=12.15;x1=0.18;y1=0;x2=0.0;y2=0.40;@B|@L;x=90.92;y=12.55;x1=0.0;y1=0;x2=0.0;y2=0.27;@B|@L;x=90.92;y=12.82;x1=0.0;y1=0;x2=0.26;y2=0.27;@B|@L;x=91.18;y=13.09;x1=0;y1=0;x2=0.47;y2=0.43;@B|@L;x=91.65;y=13.52;x1=0;y1=0;x2=0.61;y2=0.71;@B|@L;x=92.26;y=14.23;x1=0;y1=0;x2=0.58;y2=1.07;@B|@L;x=92.84;y=15.3;x1=0;y1=0.0;x2=0.38;y2=1.41;@B|@L;x=93.22;y=16.71;x1=0.0;y1=0;x2=0.0;y2=1.65;@B|@L;x=92.74;y=18.36;x1=0.48;y1=0;x2=0;y2=1.73;@B|@L;x=91.79;y=20.09;x1=0.95;y1=0;x2=0;y2=1.57;@B|@L;x=90.48;y=21.66;x1=1.31;y1=0;x2=0;y2=1.22;@B|@L;x=88.99;y=22.88;x1=1.49;y1=0;x2=0;y2=0.75;@B|@L;x=87.57;y=23.63;x1=1.42;y1=0;x2=0;y2=0.28;@B|@L;x=86.43;y=23.85;x1=1.14;y1=0.06;x2=0;y2=0;@B|@L;x=85.68;y=23.66;x1=0.75;y1=0.19;x2=0;y2=0;@B|@L;x=85.30;y=23.61;x1=0.38;y1=0.05;x2=0;y2=0;@B|@L;x=85.12;y=23.61;x1=0.18;y1=0;x2=0.0;y2=0.28;@B|@L;x=84.86;y=23.89;x1=0.26;y1=0;x2=0;y2=0.69;@B|@L;x=84.26;y=24.58;x1=0.60;y1=0;x2=0;y2=1.02;@B|@L;x=83.13;y=25.6;x1=1.13;y1=0.0;x2=0;y2=1.09;@B|@L;x=81.46;y=26.69;x1=1.67;y1=0;x2=0;y2=0.84;@B|@L;x=79.41;y=27.53;x1=2.05;y1=0;x2=0;y2=0.32;@B|@L;x=77.33;y=27.49;x1=2.08;y1=0.36;x2=0;y2=0;@B|@L;x=75.55;y=26.54;x1=1.78;y1=0.95;x2=0;y2=0;@B|@L;x=74.34;y=25.26;x1=1.21;y1=1.28;x2=0;y2=0;@B|@L;x=73.74;y=24.04;x1=0.60;y1=1.22;x2=0;y2=0;@B|@L;x=73.55;y=23.21;x1=0.19;y1=0.83;x2=0;y2=0;@B|@L;x=73.39;y=22.91;x1=0.16;y1=0.30;x2=0;y2=0;@B|@L;x=72.88;y=22.91;x1=0.51;y1=0;x2=0;y2=0.11;@B|@L;x=71.78;y=23.02;x1=1.10;y1=0;x2=0;y2=0.16;@B|@L;x=70.14;y=22.94;x1=1.64;y1=0.24;x2=0;y2=0;@B|@L;x=68.31;y=21.99;x1=1.83;y1=0.95;x2=0;y2=0;@B|@L;x=66.75;y=20.28;x1=1.56;y1=1.71;x2=0;y2=0;@B|@L;x=65.89;y=18.1;x1=0.86;y1=2.18;x2=0;y2=0.0;@B|@L;x=65.86;y=15.95;x1=0.03;y1=2.15;x2=0;y2=0;@B|@L;x=65.86;y=14.31;x1=0;y1=1.64;x2=0.57;y2=0;@B|@L;x=66.43;y=13.39;x1=0;y1=0.92;x2=0.68;y2=0;@B|@L;x=67.11;y=13.02;x1=0;y1=0.37;x2=0.27;y2=0;@B|@L;x=100.52;y=20.13;x1=0;y1=0;x2=0.06;y2=0.25;@B|@L;x=100.58;y=20.38;x1=0;y1=0;x2=0.14;y2=0.25;@B|@L;x=100.72;y=20.63;x1=0.0;y1=0;x2=0.2;y2=0.23;@B|@L;x=100.92;y=20.86;x1=0.0;y1=0;x2=0.26;y2=0.20;@B|@L;x=101.18;y=21.06;x1=0;y1=0;x2=0.30;y2=0.17;@B|@L;x=101.48;y=21.23;x1=0;y1=0;x2=0.34;y2=0.14;@B|@L;x=101.82;y=21.37;x1=0.0;y1=0;x2=0.37;y2=0.11;@B|@L;x=102.19;y=21.48;x1=0;y1=0;x2=0.38;y2=0.06;@B|@L;x=102.57;y=21.54;x1=0;y1=0;x2=0.38;y2=0.03;@B|@L;x=102.95;y=21.55;x1=0;y1=0.02;x2=0.39;y2=0;@B|@L;x=103.34;y=21.5;x1=0;y1=0.05;x2=0.37;y2=0.0;@B|@L;x=103.71;y=21.41;x1=0;y1=0.09;x2=0.37;y2=0;@B|@L;x=104.08;y=21.29;x1=0;y1=0.12;x2=0.34;y2=0;@B|@L;x=104.42;y=21.14;x1=0.0;y1=0.15;x2=0.33;y2=0;@B|@L;x=104.75;y=20.95;x1=0;y1=0.19;x2=0.29;y2=0;@B|@L;x=105.04;y=20.74;x1=0;y1=0.21;x2=0.27;y2=0;@B|@L;x=105.31;y=20.5;x1=0;y1=0.24;x2=0.24;y2=0.0;@B|@L;x=105.55;y=20.24;x1=0;y1=0.26;x2=0.20;y2=0;@B|@L;x=105.75;y=19.97;x1=0;y1=0.27;x2=0.17;y2=0;@B|@L;x=105.92;y=19.68;x1=0.0;y1=0.29;x2=0.13;y2=0;@B|@L;x=106.05;y=19.39;x1=0;y1=0.29;x2=0.10;y2=0;@B|@L;x=106.15;y=19.09;x1=0;y1=0.30;x2=0.06;y2=0;@B|@L;x=106.21;y=18.79;x1=0;y1=0.30;x2=0.03;y2=0;@B|@L;x=106.24;y=18.49;x1=0;y1=0.30;x2=0;y2=0;@B|@L;x=106.21;y=18.2;x1=0.03;y1=0.29;x2=0;y2=0.0;@B|@L;x=106.16;y=17.91;x1=0.05;y1=0.29;x2=0;y2=0;@B|@L;x=106.08;y=17.63;x1=0.08;y1=0.28;x2=0;y2=0;@B|@L;x=105.98;y=17.35;x1=0.10;y1=0.28;x2=0;y2=0;@B|@L;x=105.86;y=17.09;x1=0.12;y1=0.26;x2=0;y2=0;@B|@L;x=105.72;y=16.83;x1=0.14;y1=0.26;x2=0.0;y2=0;@B|@L;x=105.58;y=16.57;x1=0.14;y1=0.26;x2=0;y2=0;@B|@L;x=105.41;y=16.31;x1=0.17;y1=0.26;x2=0;y2=0;@B|@L;x=105.23;y=16.05;x1=0.18;y1=0.26;x2=0;y2=0;@B|@L;x=105.03;y=15.79;x1=0.20;y1=0.26;x2=0;y2=0;@B|@L;x=104.81;y=15.51;x1=0.22;y1=0.28;x2=0;y2=0;@B|@L;x=104.56;y=15.22;x1=0.25;y1=0.29;x2=0;y2=0;@B|@L;x=104.26;y=14.93;x1=0.30;y1=0.29;x2=0;y2=0;@B|@L;x=103.92;y=14.62;x1=0.34;y1=0.31;x2=0.0;y2=0;@B|@L;x=103.51;y=14.32;x1=0.41;y1=0.30;x2=0;y2=0;@B|@L;x=103.04;y=14.02;x1=0.47;y1=0.30;x2=0;y2=0;@B|@L;x=102.49;y=13.75;x1=0.55;y1=0.27;x2=0;y2=0;@B|@L;x=101.85;y=13.52;x1=0.64;y1=0.23;x2=0;y2=0;@B|@L;x=101.12;y=13.36;x1=0.73;y1=0.16;x2=0.0;y2=0;@B|@L;x=100.32;y=13.28;x1=0.8;y1=0.08;x2=0.0;y2=0;@B|@L;x=99.45;y=13.28;x1=0.87;y1=0;x2=0;y2=0.05;@B|@L;x=98.52;y=13.33;x1=0.93;y1=0;x2=0;y2=0.18;@B|@L;x=97.58;y=13.51;x1=0.94;y1=0;x2=0;y2=0.34;@B|@L;x=96.65;y=13.85;x1=0.93;y1=0;x2=0;y2=0.52;@B|@L;x=95.78;y=14.37;x1=0.87;y1=0;x2=0;y2=0.69;@B|@L;x=95.01;y=15.06;x1=0.77;y1=0;x2=0;y2=0.86;@B|@L;x=94.38;y=15.92;x1=0.63;y1=0;x2=0;y2=1.02;@B|@L;x=93.93;y=16.94;x1=0.45;y1=0;x2=0;y2=1.12;@B|@L;x=93.70;y=18.06;x1=0.23;y1=0;x2=0;y2=1.19;@B|@L;x=93.68;y=19.25;x1=0.02;y1=0;x2=0;y2=1.20;@B|@L;x=93.68;y=20.45;x1=0;y1=0;x2=0.21;y2=1.15;@B|@L;x=93.89;y=21.6;x1=0;y1=0.0;x2=0.39;y2=1.05;@B|@L;x=94.28;y=22.65;x1=0;y1=0;x2=0.54;y2=0.88;@B|@L;x=94.82;y=23.53;x1=0.0;y1=0;x2=0.62;y2=0.70;@B|@L;x=95.44;y=24.23;x1=0;y1=0;x2=0.63;y2=0.51;@B|@L;x=96.07;y=24.74;x1=0;y1=0;x2=0.58;y2=0.34;@B|@L;x=96.65;y=25.08;x1=0;y1=0;x2=0.46;y2=0.22;@B|@L;x=97.11;y=25.3;x1=0;y1=0.0;x2=0.31;y2=0.18;@B|@L;x=97.42;y=25.48;x1=0.0;y1=0;x2=0.16;y2=0.21;@B|@L;x=97.58;y=25.69;x1=0;y1=0;x2=0.04;y2=0.33;@B|@L;x=97.61;y=26.02;x1=0.01;y1=0;x2=0;y2=0.51;@B|@L;x=97.61;y=26.53;x1=0;y1=0;x2=0.04;y2=0.73;@B|@L;x=97.65;y=27.26;x1=0;y1=0;x2=0.20;y2=0.92;@B|@L;x=97.85;y=28.18;x1=0;y1=0;x2=0.45;y2=1.05;@B|@L;x=98.30;y=29.23;x1=0;y1=0;x2=0.78;y2=1.09;@B|@L;x=99.08;y=30.32;x1=0;y1=0;x2=1.12;y2=0.97;@B|@L;x=100.20;y=31.29;x1=0;y1=0;x2=1.42;y2=0.73;@B|@L;x=101.62;y=32.02;x1=0.0;y1=0;x2=1.62;y2=0.38;@B|@L;x=103.24;y=32.37;x1=0;y1=0.03;x2=1.66;y2=0;@B|@L;x=104.90;y=31.93;x1=0;y1=0.44;x2=1.54;y2=0;@B|@L;x=106.44;y=31.19;x1=0;y1=0.74;x2=1.27;y2=0;@B|@L;x=107.71;y=30.3;x1=0;y1=0.89;x2=0.92;y2=0.0;@B|@L;x=108.63;y=29.43;x1=0;y1=0.87;x2=0.56;y2=0;@B|@L;x=109.19;y=28.76;x1=0;y1=0.67;x2=0.29;y2=0;@B|@L;x=109.48;y=28.38;x1=0;y1=0.38;x2=0.18;y2=0;@B|@L;x=109.66;y=28.3;x1=0;y1=0.08;x2=0.26;y2=0.0;@B|@L;x=109.92;y=28.3;x1=0.0;y1=0.0;x2=0.53;y2=0.11;@B|@L;x=110.45;y=28.41;x1=0;y1=0;x2=0.90;y2=0.13;@B|@L;x=111.35;y=28.43;x1=0;y1=0.11;x2=1.26;y2=0;@B|@L;x=112.61;y=27.9;x1=0;y1=0.53;x2=1.48;y2=0.0;@B|@L;x=114.09;y=26.83;x1=0;y1=1.07;x2=1.46;y2=0;@B|@L;x=115.55;y=25.28;x1=0;y1=1.55;x2=1.18;y2=0;@B|@L;x=121.92;y=13.04;x1=0.47;y1=0;x2=0.0;y2=0.14;@B|@L;x=121.50;y=13.18;x1=0.42;y1=0;x2=0;y2=0.18;@B|@L;x=121.15;y=13.36;x1=0.35;y1=0;x2=0;y2=0.23;@B|@L;x=120.85;y=13.59;x1=0.30;y1=0;x2=0;y2=0.26;@B|@L;x=120.63;y=13.85;x1=0.22;y1=0;x2=0;y2=0.29;@B|@L;x=120.48;y=14.14;x1=0.15;y1=0;x2=0;y2=0.30;@B|@L;x=120.39;y=14.44;x1=0.09;y1=0;x2=0;y2=0.33;@B|@L;x=120.38;y=14.77;x1=0.01;y1=0;x2=0;y2=0.33;@B|@L;x=120.38;y=15.1;x1=0;y1=0.0;x2=0.04;y2=0.33;@B|@L;x=120.42;y=15.43;x1=0.0;y1=0;x2=0.1;y2=0.34;@B|@L;x=120.52;y=15.77;x1=0;y1=0;x2=0.16;y2=0.32;@B|@L;x=120.68;y=16.09;x1=0;y1=0;x2=0.21;y2=0.32;@B|@L;x=120.89;y=16.41;x1=0;y1=0;x2=0.26;y2=0.30;@B|@L;x=121.15;y=16.71;x1=0;y1=0;x2=0.31;y2=0.28;@B|@L;x=121.46;y=16.99;x1=0;y1=0;x2=0.34;y2=0.25;@B|@L;x=121.80;y=17.24;x1=0;y1=0;x2=0.39;y2=0.23;@B|@L;x=122.19;y=17.47;x1=0;y1=0;x2=0.42;y2=0.19;@B|@L;x=122.61;y=17.66;x1=0;y1=0;x2=0.45;y2=0.16;@B|@L;x=123.06;y=17.82;x1=0;y1=0;x2=0.48;y2=0.12;@B|@L;x=123.54;y=17.94;x1=0;y1=0;x2=0.51;y2=0.08;@B|@L;x=124.05;y=18.02;x1=0;y1=0;x2=0.53;y2=0.03;@B|@L;x=124.58;y=18.04;x1=0;y1=0.01;x2=0.54;y2=0;@B|@L;x=125.12;y=17.96;x1=0.0;y1=0.08;x2=0.57;y2=0;@B|@L;x=125.69;y=17.84;x1=0;y1=0.12;x2=0.56;y2=0;@B|@L;x=126.25;y=17.65;x1=0;y1=0.19;x2=0.58;y2=0;@B|@L;x=126.83;y=17.39;x1=0;y1=0.26;x2=0.57;y2=0;@B|@L;x=127.40;y=17.07;x1=0;y1=0.32;x2=0.56;y2=0;@B|@L;x=127.96;y=16.68;x1=0;y1=0.39;x2=0.54;y2=0;@B|@L;x=128.50;y=16.22;x1=0;y1=0.46;x2=0.51;y2=0;@B|@L;x=129.01;y=15.69;x1=0;y1=0.53;x2=0.48;y2=0;@B|@L;x=129.49;y=15.09;x1=0;y1=0.60;x2=0.43;y2=0;@B|@L;x=129.92;y=14.42;x1=0.0;y1=0.67;x2=0.37;y2=0;@B|@L;x=130.29;y=13.69;x1=0;y1=0.73;x2=0.30;y2=0;@B|@L;x=130.59;y=12.9;x1=0;y1=0.79;x2=0.22;y2=0.0;@B|@L;x=130.81;y=12.07;x1=0;y1=0.83;x2=0.12;y2=0;@B|@L;x=130.93;y=11.21;x1=0;y1=0.86;x2=0.01;y2=0;@B|@L;x=130.84;y=10.33;x1=0.10;y1=0.88;x2=0;y2=0;@B|@L;x=130.61;y=9.46;x1=0.23;y1=0.87;x2=0;y2=0;@B|@L;x=130.26;y=8.61;x1=0.35;y1=0.85;x2=0;y2=0;@B|@L;x=129.79;y=7.81;x1=0.47;y1=0.80;x2=0;y2=0;@B|@L;x=129.21;y=7.08;x1=0.58;y1=0.73;x2=0;y2=0;@B|@L;x=128.53;y=6.44;x1=0.68;y1=0.64;x2=0;y2=0;@B|@L;x=127.76;y=5.91;x1=0.77;y1=0.53;x2=0;y2=0;@B|@L;x=126.94;y=5.51;x1=0.82;y1=0.40;x2=0;y2=0;@B|@L;x=126.10;y=5.25;x1=0.84;y1=0.26;x2=0;y2=0;@B|@L;x=125.25;y=5.12;x1=0.85;y1=0.13;x2=0;y2=0;@B|@L;x=124.45;y=5.12;x1=0.80;y1=0;x2=0;y2=0;@B|@L;x=123.70;y=5.12;x1=0.75;y1=0;x2=0;y2=0.11;@B|@L;x=123.05;y=5.23;x1=0.65;y1=0;x2=0;y2=0.19;@B|@L;x=122.50;y=5.42;x1=0.55;y1=0;x2=0;y2=0.24;@B|@L;x=122.05;y=5.66;x1=0.45;y1=0;x2=0;y2=0.25;@B|@L;x=121.70;y=5.91;x1=0.35;y1=0;x2=0;y2=0.22;@B|@L;x=121.41;y=6.13;x1=0.29;y1=0;x2=0;y2=0.15;@B|@L;x=121.15;y=6.28;x1=0.26;y1=0;x2=0;y2=0.06;@B|@L;x=120.87;y=6.31;x1=0.28;y1=0.03;x2=0;y2=0;@B|@L;x=120.51;y=6.19;x1=0.36;y1=0.12;x2=0;y2=0;@B|@L;x=120.04;y=6.02;x1=0.47;y1=0.17;x2=0;y2=0;@B|@L;x=119.40;y=5.84;x1=0.64;y1=0.18;x2=0;y2=0;@B|@L;x=118.59;y=5.73;x1=0.81;y1=0.11;x2=0;y2=0;@B|@L;x=117.62;y=5.73;x1=0.97;y1=0;x2=0.0;y2=0.02;@B|@L;x=116.52;y=5.75;x1=1.1;y1=0;x2=0;y2=0.23;@B|@L;x=115.37;y=5.98;x1=1.15;y1=0;x2=0;y2=0.49;@B|@L;x=114.26;y=6.47;x1=1.11;y1=0;x2=0;y2=0.79;@B|@L;x=113.28;y=7.26;x1=0.98;y1=0;x2=0;y2=1.07;@B|@L;x=112.53;y=8.33;x1=0.75;y1=0;x2=0;y2=1.30;@B|@L;x=112.09;y=9.63;x1=0.44;y1=0;x2=0;y2=1.45;@B|@L;x=112.00;y=11.08;x1=0.09;y1=0;x2=0;y2=1.48;@B|@L;x=112.00;y=12.56;x1=0;y1=0;x2=0.23;y2=1.40;@B|@L;x=112.23;y=13.96;x1=0;y1=0;x2=0.50;y2=1.19;@B|@L;x=112.73;y=15.15;x1=0;y1=0;x2=0.64;y2=0.92;@B|@L;x=113.37;y=16.07;x1=0;y1=0;x2=0.66;y2=0.62;@B|@L;x=114.03;y=16.69;x1=0;y1=0;x2=0.55;y2=0.38;@B|@L;x=114.58;y=17.07;x1=0;y1=0;x2=0.33;y2=0.25;@B|@L;x=114.91;y=17.32;x1=0;y1=0;x2=0.08;y2=0.25;@B|@L;x=114.85;y=17.57;x1=0.14;y1=0;x2=0;y2=0.41;@B|@L;x=114.62;y=17.98;x1=0.23;y1=0;x2=0.0;y2=0.70;@B|@L;x=114.46;y=18.68;x1=0.16;y1=0;x2=0;y2=1.03;@B|@L;x=114.46;y=19.71;x1=0;y1=0;x2=0.10;y2=1.33;@B|@L;x=114.56;y=21.04;x1=0;y1=0;x2=0.50;y2=1.49;@B|@L;x=115.06;y=22.53;x1=0;y1=0;x2=0.99;y2=1.44;@B|@L;x=116.05;y=23.97;x1=0;y1=0;x2=1.42;y2=1.19;@B|@L;x=117.47;y=25.16;x1=0;y1=0;x2=1.70;y2=0.75;@B|@L;x=119.17;y=25.91;x1=0;y1=0;x2=1.77;y2=0.23;@B|@L;x=120.94;y=25.9;x1=0;y1=0.24;x2=1.57;y2=0.0;@B|@L;x=122.51;y=25.36;x1=0;y1=0.54;x2=1.20;y2=0;@B|@L;x=123.71;y=24.77;x1=0;y1=0.59;x2=0.76;y2=0;@B|@L;x=124.47;y=24.4;x1=0;y1=0.37;x2=0.41;y2=0.0;@B|@L;x=124.88;y=24.4;x1=0;y1=0.0;x2=0.27;y2=0.01;@B|@L;x=125.15;y=24.41;x1=0;y1=0;x2=0.41;y2=0.39;@B|@L;x=125.56;y=24.8;x1=0;y1=0.0;x2=0.83;y2=0.63;@B|@L;x=126.39;y=25.43;x1=0;y1=0;x2=1.35;y2=0.57;@B|@L;x=127.74;y=26;x1=0;y1=0;x2=1.81;y2=0.18;@B|@L;x=129.55;y=25.75;x1=0;y1=0.43;x2=2.00;y2=0;@B|@L;x=131.55;y=24.65;x1=0;y1=1.10;x2=1.84;y2=0;@B|@L;x=133.39;y=23.06;x1=0;y1=1.59;x2=1.35;y2=0;@B|@L;x=134.74;y=21.33;x1=0;y1=1.73;x2=0.68;y2=0;@B|@L;x=135.42;y=19.85;x1=0.0;y1=1.48;x2=0.1;y2=0;@B|@L;x=135.33;y=18.88;x1=0.19;y1=0.97;x2=0;y2=0;@B|@L;x=135.27;y=18.46;x1=0.06;y1=0.42;x2=0;y2=0;@B|@L;x=135.27;y=18.32;x1=0;y1=0.14;x2=0.40;y2=0;@B|@L;x=135.67;y=18.05;x1=0;y1=0.27;x2=0.99;y2=0;@B|@L;x=136.66;y=17.22;x1=0;y1=0.83;x2=1.36;y2=0;@B|@L;x=138.02;y=15.65;x1=0.0;y1=1.57;x2=1.3;y2=0;@B|@L;x=139.32;y=13.46;x1=0.0;y1=2.19;x2=0.77;y2=0;@B|@L;x=140.02;y=11.09;x1=0.07;y1=2.37;x2=0.0;y2=0;@B|@L;x=139.17;y=9.06;x1=0.85;y1=2.03;x2=0;y2=0;@B|@L;x=137.94;y=7.75;x1=1.23;y1=1.31;x2=0;y2=0;@B|@L;x=136.89;y=7.16;x1=1.05;y1=0.59;x2=0;y2=0;@B|@L;x=9.92;y=33.04;x1=0.47;y1=0;x2=0.0;y2=0.14;@B|@L;x=9.50;y=33.18;x1=0.42;y1=0;x2=0;y2=0.18;@B|@L;x=9.15;y=33.36;x1=0.35;y1=0;x2=0;y2=0.23;@B|@L;x=8.85;y=33.59;x1=0.30;y1=0;x2=0;y2=0.26;@B|@L;x=8.63;y=33.85;x1=0.22;y1=0;x2=0;y2=0.29;@B|@L;x=8.48;y=34.14;x1=0.15;y1=0;x2=0;y2=0.30;@B|@L;x=8.39;y=34.44;x1=0.09;y1=0;x2=0;y2=0.33;@B|@L;x=8.38;y=34.77;x1=0.01;y1=0;x2=0;y2=0.33;@B|@L;x=8.38;y=35.1;x1=0;y1=0.0;x2=0.04;y2=0.33;@B|@L;x=8.42;y=35.43;x1=0.0;y1=0;x2=0.1;y2=0.34;@B|@L;x=8.52;y=35.77;x1=0;y1=0;x2=0.16;y2=0.32;@B|@L;x=8.68;y=36.09;x1=0;y1=0;x2=0.21;y2=0.32;@B|@L;x=8.89;y=36.41;x1=0;y1=0;x2=0.26;y2=0.30;@B|@L;x=9.15;y=36.71;x1=0;y1=0;x2=0.31;y2=0.28;@B|@L;x=9.46;y=36.99;x1=0;y1=0;x2=0.34;y2=0.25;@B|@L;x=9.80;y=37.24;x1=0;y1=0;x2=0.39;y2=0.23;@B|@L;x=10.19;y=37.47;x1=0;y1=0;x2=0.42;y2=0.19;@B|@L;x=10.61;y=37.66;x1=0;y1=0;x2=0.45;y2=0.16;@B|@L;x=11.06;y=37.82;x1=0;y1=0;x2=0.48;y2=0.12;@B|@L;x=11.54;y=37.94;x1=0;y1=0;x2=0.51;y2=0.08;@B|@L;x=12.05;y=38.02;x1=0;y1=0;x2=0.53;y2=0.03;@B|@L;x=12.58;y=38.04;x1=0;y1=0.01;x2=0.54;y2=0;@B|@L;x=13.12;y=37.96;x1=0.0;y1=0.08;x2=0.57;y2=0;@B|@L;x=13.69;y=37.84;x1=0;y1=0.12;x2=0.56;y2=0;@B|@L;x=14.25;y=37.65;x1=0;y1=0.19;x2=0.58;y2=0;@B|@L;x=14.83;y=37.39;x1=0;y1=0.26;x2=0.57;y2=0;@B|@L;x=15.40;y=37.07;x1=0;y1=0.32;x2=0.56;y2=0;@B|@L;x=15.96;y=36.68;x1=0;y1=0.39;x2=0.54;y2=0;@B|@L;x=16.50;y=36.22;x1=0;y1=0.46;x2=0.51;y2=0;@B|@L;x=17.01;y=35.69;x1=0;y1=0.53;x2=0.48;y2=0;@B|@L;x=17.49;y=35.09;x1=0;y1=0.60;x2=0.43;y2=0;@B|@L;x=17.92;y=34.42;x1=0.0;y1=0.67;x2=0.37;y2=0;@B|@L;x=18.29;y=33.69;x1=0;y1=0.73;x2=0.30;y2=0;@B|@L;x=18.59;y=32.9;x1=0;y1=0.79;x2=0.22;y2=0.0;@B|@L;x=18.81;y=32.07;x1=0;y1=0.83;x2=0.12;y2=0;@B|@L;x=18.93;y=31.21;x1=0;y1=0.86;x2=0.01;y2=0;@B|@L;x=18.84;y=30.33;x1=0.10;y1=0.88;x2=0;y2=0;@B|@L;x=18.61;y=29.46;x1=0.23;y1=0.87;x2=0;y2=0;@B|@L;x=18.26;y=28.61;x1=0.35;y1=0.85;x2=0;y2=0;@B|@L;x=17.79;y=27.81;x1=0.47;y1=0.80;x2=0;y2=0;@B|@L;x=17.21;y=27.08;x1=0.58;y1=0.73;x2=0;y2=0;@B|@L;x=16.53;y=26.44;x1=0.68;y1=0.64;x2=0;y2=0;@B|@L;x=15.76;y=25.91;x1=0.77;y1=0.53;x2=0;y2=0;@B|@L;x=14.94;y=25.51;x1=0.82;y1=0.40;x2=0;y2=0;@B|@L;x=14.10;y=25.25;x1=0.84;y1=0.26;x2=0;y2=0;@B|@L;x=13.25;y=25.12;x1=0.85;y1=0.13;x2=0;y2=0;@B|@L;x=12.45;y=25.12;x1=0.80;y1=0;x2=0;y2=0;@B|@L;x=11.70;y=25.12;x1=0.75;y1=0;x2=0;y2=0.11;@B|@L;x=11.05;y=25.23;x1=0.65;y1=0;x2=0;y2=0.19;@B|@L;x=10.50;y=25.42;x1=0.55;y1=0;x2=0;y2=0.24;@B|@L;x=10.05;y=25.66;x1=0.45;y1=0;x2=0;y2=0.25;@B|@L;x=9.70;y=25.91;x1=0.35;y1=0;x2=0;y2=0.22;@B|@L;x=9.41;y=26.13;x1=0.29;y1=0;x2=0;y2=0.15;@B|@L;x=9.15;y=26.28;x1=0.26;y1=0;x2=0;y2=0.06;@B|@L;x=8.87;y=26.31;x1=0.28;y1=0.03;x2=0;y2=0;@B|@L;x=8.51;y=26.19;x1=0.36;y1=0.12;x2=0;y2=0;@B|@L;x=8.04;y=26.02;x1=0.47;y1=0.17;x2=0;y2=0;@B|@L;x=7.40;y=25.84;x1=0.64;y1=0.18;x2=0;y2=0;@B|@L;x=6.59;y=25.73;x1=0.81;y1=0.11;x2=0;y2=0;@B|@L;x=5.62;y=25.73;x1=0.97;y1=0;x2=0.0;y2=0.02;@B|@L;x=4.52;y=25.75;x1=1.1;y1=0;x2=0;y2=0.23;@B|@L;x=3.37;y=25.98;x1=1.15;y1=0;x2=0;y2=0.49;@B|@L;x=2.26;y=26.47;x1=1.11;y1=0;x2=0;y2=0.79;@B|@L;x=1.28;y=27.26;x1=0.98;y1=0;x2=0;y2=1.07;@B|@L;x=0.53;y=28.33;x1=0.75;y1=0;x2=0;y2=1.30;@B|@L;x=0.09;y=29.63;x1=0.44;y1=0;x2=0;y2=1.45;@B|@L;x=0;y=31.08;x1=0.09;y1=0;x2=0;y2=1.48;@B|@L;x=0;y=32.56;x1=0;y1=0;x2=0.23;y2=1.40;@B|@L;x=0.23;y=33.96;x1=0;y1=0;x2=0.50;y2=1.19;@B|@L;x=0.73;y=35.15;x1=0;y1=0;x2=0.64;y2=0.92;@B|@L;x=1.37;y=36.07;x1=0;y1=0;x2=0.66;y2=0.62;@B|@L;x=2.03;y=36.69;x1=0;y1=0;x2=0.55;y2=0.38;@B|@L;x=2.58;y=37.07;x1=0;y1=0;x2=0.33;y2=0.25;@B|@L;x=2.91;y=37.32;x1=0;y1=0;x2=0.08;y2=0.25;@B|@L;x=2.85;y=37.57;x1=0.14;y1=0;x2=0;y2=0.41;@B|@L;x=2.62;y=37.98;x1=0.23;y1=0;x2=0.0;y2=0.70;@B|@L;x=2.46;y=38.68;x1=0.16;y1=0;x2=0;y2=1.03;@B|@L;x=2.46;y=39.71;x1=0;y1=0;x2=0.10;y2=1.33;@B|@L;x=2.56;y=41.04;x1=0;y1=0;x2=0.50;y2=1.49;@B|@L;x=3.06;y=42.53;x1=0;y1=0;x2=0.99;y2=1.44;@B|@L;x=4.05;y=43.97;x1=0;y1=0;x2=1.42;y2=1.19;@B|@L;x=5.47;y=45.16;x1=0;y1=0;x2=1.70;y2=0.75;@B|@L;x=7.17;y=45.91;x1=0;y1=0;x2=1.77;y2=0.23;@B|@L;x=8.94;y=45.9;x1=0;y1=0.24;x2=1.57;y2=0.0;@B|@L;x=10.51;y=45.36;x1=0;y1=0.54;x2=1.20;y2=0;@B|@L;x=11.71;y=44.77;x1=0;y1=0.59;x2=0.76;y2=0;@B|@L;x=12.47;y=44.4;x1=0;y1=0.37;x2=0.41;y2=0.0;@B|@L;x=12.88;y=44.4;x1=0;y1=0.0;x2=0.27;y2=0.01;@B|@L;x=13.15;y=44.41;x1=0;y1=0;x2=0.41;y2=0.39;@B|@L;x=13.56;y=44.8;x1=0;y1=0.0;x2=0.83;y2=0.63;@B|@L;x=14.39;y=45.43;x1=0;y1=0;x2=1.35;y2=0.57;@B|@L;x=15.74;y=46;x1=0;y1=0;x2=1.81;y2=0.18;@B|@L;x=17.55;y=45.75;x1=0;y1=0.43;x2=2.00;y2=0;@B|@L;x=19.55;y=44.65;x1=0;y1=1.10;x2=1.84;y2=0;@B|@L;x=21.39;y=43.06;x1=0;y1=1.59;x2=1.35;y2=0;@B|@L;x=22.74;y=41.33;x1=0;y1=1.73;x2=0.68;y2=0;@B|@L;x=23.42;y=39.85;x1=0.0;y1=1.48;x2=0.1;y2=0;@B|@L;x=23.33;y=38.88;x1=0.19;y1=0.97;x2=0;y2=0;@B|@L;x=23.27;y=38.46;x1=0.06;y1=0.42;x2=0;y2=0;@B|@L;x=23.27;y=38.32;x1=0;y1=0.14;x2=0.40;y2=0;@B|@L;x=47.75;y=36.17;x1=0;y1=0;x2=1.00;y2=1.48;@B|@L;x=48.75;y=37.65;x1=0;y1=0;x2=1.61;y2=1.39;@B|@L;x=50.36;y=39.04;x1=0;y1=0;x2=2.17;y2=1.01;@B|@L;x=52.53;y=40.05;x1=0;y1=0;x2=2.50;y2=0.39;@B|@L;x=55.03;y=40.08;x1=0;y1=0.36;x2=2.52;y2=0;@B|@L;x=57.55;y=39.07;x1=0;y1=1.01;x2=2.20;y2=0;@B|@L;x=59.75;y=37.66;x1=0;y1=1.41;x2=1.61;y2=0;@B|@L;x=61.36;y=36.21;x1=0;y1=1.45;x2=0.94;y2=0;@B|@L;x=62.30;y=35.07;x1=0;y1=1.14;x2=0.42;y2=0;@B|@L;x=62.72;y=34.47;x1=0.0;y1=0.60;x2=0.2;y2=0;@B|@L;x=62.92;y=34.41;x1=0.0;y1=0.06;x2=0.39;y2=0;@B|@L;x=63.31;y=34.41;x1=0;y1=0;x2=0.92;y2=0.23;@B|@L;x=64.23;y=34.64;x1=0;y1=0;x2=1.58;y2=0.11;@B|@L;x=65.81;y=34.3;x1=0;y1=0.45;x2=2.12;y2=0.0;@B|@L;x=67.93;y=33.01;x1=0;y1=1.29;x2=2.25;y2=0;@B|@L;x=70.18;y=30.88;x1=0;y1=2.13;x2=1.90;y2=0;@B|@L;x=72.08;y=28.19;x1=0;y1=2.69;x2=1.11;y2=0;@B|@L;x=73.19;y=25.47;x1=0;y1=2.72;x2=0.16;y2=0;@B|@L;x=140.28;y=13.41;x1=0;y1=0;x2=0.88;y2=2.05;@B|@L;x=141.16;y=15.46;x1=0;y1=0;x2=1.33;y2=1.73;@B|@L;x=142.49;y=17.19;x1=0;y1=0;x2=1.61;y2=1.25;@B|@L;x=144.10;y=18.44;x1=0;y1=0;x2=1.65;y2=0.72;@B|@L;x=145.75;y=19.16;x1=0;y1=0;x2=1.47;y2=0.26;@B|@L;x=147.22;y=19.4;x1=0.0;y1=0.02;x2=1.11;y2=0.0;@B|@L;x=148.33;y=19.34;x1=0;y1=0.06;x2=0.68;y2=0;@B|@L;x=149.01;y=19.34;x1=0;y1=0;x2=0.32;y2=0.16;@B|@L;x=149.33;y=19.5;x1=0;y1=0.0;x2=0.17;y2=0.57;@B|@L;x=149.50;y=20.07;x1=0;y1=0;x2=0.30;y2=1.03;@B|@L;x=149.80;y=21.1;x1=0;y1=0.0;x2=0.72;y2=1.39;@B|@L;x=150.52;y=22.49;x1=0;y1=0;x2=1.33;y2=1.49;@B|@L;x=151.85;y=23.98;x1=0;y1=0;x2=1.99;y2=1.24;@B|@L;x=153.84;y=25.22;x1=0;y1=0;x2=2.48;y2=0.68;@B|@L;x=156.32;y=25.81;x1=0.0;y1=0.09;x2=2.65;y2=0;@B|@L;x=158.97;y=24.96;x1=0;y1=0.85;x2=2.44;y2=0;@B|@L;x=161.41;y=23.57;x1=0;y1=1.39;x2=1.87;y2=0;@B|@L;x=163.28;y=22.01;x1=0;y1=1.56;x2=1.16;y2=0;@B|@L;x=164.44;y=20.72;x1=0;y1=1.29;x2=0.52;y2=0;@B|@L;x=164.96;y=19.97;x1=0;y1=0.75;x2=0.21;y2=0;@B|@L;x=165.17;y=19.83;x1=0;y1=0.14;x2=0.33;y2=0;@B|@L;x=165.50;y=19.83;x1=0;y1=0;x2=0.86;y2=0.23;@B|@L;x=166.36;y=20.06;x1=0;y1=0;x2=1.58;y2=0.16;@B|@L;x=167.94;y=19.82;x1=0;y1=0.40;x2=2.16;y2=0;@B|@L;x=170.10;y=18.53;x1=0;y1=1.29;x2=2.34;y2=0;@B|@L;x=172.44;y=16.34;x1=0;y1=2.19;x2=1.97;y2=0;@B|@L;x=174.41;y=13.58;x1=0;y1=2.76;x2=1.13;y2=0;@B|@L;x=175.54;y=10.82;x1=0;y1=2.76;x2=0.11;y2=0;@B sha=LDText.Replace(sha "@L" "func=line") sha=LDText.Replace(sha "@B" "pw=1;pc=black") shape=LDText.Split(sha "|") EndSub Sub Shapes_Init_Flower shX = 94 ' x offset shY = 92.5 ' y offset shape = "" shape[1] = "func=ell;x=0;y=0.0;width=12;height=15;pw=1;pc=Black;bc=Red;" shape[2] = "func=tri;x=1.75;y=12.8;x1=4.24;y1=0;x2=0;y2=5.3;x3=8.48;y3=5.3;angle=180;pw=0;bc=Red;" shape[3] = "func=line;x=2.06;y=12.4;x1=3.93;y1=4.92;x2=0.00;y2=0.0;pw=1;pc=Black;" shape[4] = "func=line;x=5.99;y=12.4;x1=0.00;y1=4.92;x2=3.93;y2=0.0;pw=1;pc=Black;" shape[5] = "func=tri;x=5.37;y=17.32;x1=0.62;y1=0;x2=0;y2=0.78;x3=1.24;y3=0.78;angle=180;pw=0;bc=Black;" shape[6] = "func=line;x=6;y=17.32;x1=0;y1=0;x2=0;y2=15;pw=1;pc=Black;" EndSub Sub Shapes_Init_Frame shX = 203 ' x offset shY = 55 ' y offset shape = "" shape[1] = "func=rect;x=0;y=0;width=192;height=318;pw=14;pc=#660000;bc=Transparent;" If rotate Then shape[1]["pc"] = "Black" EndIf EndSub Sub Shapes_Init_Leaf shX = 94 + 250 ' x offset shY = 85.85 ' y offset shape = "" shape[1] = "func=ell;x=0;y=4.15;width=12;height=20;pw=1;pc=Black;bc=#333333;" shape[2] = "func=tri;x=1.75;y=0.00;x1=4.24;y1=0;x2=0;y2=7.07;x3=8.48;y3=7.07;pw=0;bc=#333333;" shape[3] = "func=line;x=2.00;y=0.85;x1=3.99;y1=0.00;x2=0.00;y2=6.64;pw=1;pc=Black;" shape[4] = "func=line;x=5.99;y=0.85;x1=0.00;y1=0.00;x2=3.98;y2=6.64;pw=1;pc=Black;" shape[5] = "func=tri;x=5.48;y=0.00;x1=0.51;y1=0;x2=0;y2=0.85;x3=1.02;y3=0.85;pw=0;bc=Black;" shape[6] = "func=tri;x=1.75;y=21.22;x1=4.24;y1=0;x2=0;y2=7.07;x3=8.48;y3=7.07;angle=180;pw=0;bc=#333333;" shape[7] = "func=line;x=2.00;y=20.79;x1=3.99;y1=6.64;x2=0.00;y2=0.00;pw=1;pc=Black;" shape[8] = "func=line;x=5.99;y=20.79;x1=0.00;y1=6.64;x2=3.98;y2=0.00;pw=1;pc=Black;" shape[9] = "func=tri;x=5.48;y=27.43;x1=0.51;y1=0;x2=0;y2=0.85;x3=1.02;y3=0.85;angle=180;pw=0;bc=Black;" shape[10] = "func=line;x=6;y=0.86;x1=0;y1=0;x2=0;y2=36.56;pw=1;pc=Black;" EndSub End>VWJ159.sb< Start>VWN481.sb< ' Pont du Gard ' Copyright © 2018 Nonki Takahashi. The MIT License. ' Lastupdate 2018-02-02 GraphicsWindow.Title = "Pont du Gard" Init() GraphicsWindow.BrushColor = bc GraphicsWindow.FillRectangle(0, 175, gw, 35) GraphicsWindow.BrushColor = sc For x = -10 To gw Step 30 GraphicsWindow.FillEllipse(x, 190, 20, 20) GraphicsWindow.FillRectangle(x, 200, 20, 20) EndFor GraphicsWindow.BrushColor = bc GraphicsWindow.FillRectangle(0, 210, gw, 80) GraphicsWindow.BrushColor = sc For x = -5 To gw Step 90 GraphicsWindow.FillEllipse(x, 220, 70, 70) GraphicsWindow.FillRectangle(x, 255, 70, 70) EndFor GraphicsWindow.BrushColor = bc GraphicsWindow.FillRectangle(0, 290, gw, 60) GraphicsWindow.BrushColor = sc For x = -5 To gw Step 90 GraphicsWindow.FillEllipse(x, 300, 70, 70) GraphicsWindow.FillRectangle(x, 335, 70, 50) EndFor GraphicsWindow.BrushColor = wc GraphicsWindow.FillRectangle(0, 350, gw, gh - 350) Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh sc = "DeepSkyBlue" bc = "PeachPuff" wc = "SteelBlue" GraphicsWindow.BackgroundColor = sc EndSub End>VWN481.sb< Start>VWN806.sb< GraphicsWindow.BackgroundColor ="#808080" ' Init.sb For NaochanON's shapes Editor STD116 GraphicsWindow.Width=1150 GraphicsWindow.Height=650 init() add_shapes() Sub add_shapes s=1 ' <----- change this value x0=0 ' <----- change this value y0=-80 ' <----- change this value For i = 1 To Array.GetItemCount(shape) GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.PenColor = shape[i]["pc"] GraphicsWindow.PenWidth = shape[i]["pw"]*s GraphicsWindow.FontSize=shape[i]["fsz"]*s If shape[i]["fn"] = "Pol" Then _pt= LDText.Split(shape[i]["pts"]," ") points="" For j=1 To Array.GetItemCount(_pt) points[j]= LDText.Split(_pt[j],",") EndFor _shp[i] = Ldshapes.AddPolygon(points) LDShapes.BrushColour(_shp[i] , shape[i]["bc"]) LDShapes.PenColour(_shp[i] , shape[i]["pc"]) LDShapes.Penwidth(_shp[i] , shape[i]["pw"]) elseIf shape[i]["fn"] = "Tex" Then _shp[i] = Shapes.Addtext( shape[i]["msg"]) Shapes.Zoom(_shp[i],shape[i]["zmw"]*s,shape[i]["zmh"]*s) ElseIf shape[i]["fn"] = "Img" Then _shp[i] = Shapes.AddImage(imagelist.LoadImage( shape[i]["Src"] )) Shapes.Zoom(_shp[i],shape[i]["zmw"]*s,shape[i]["zmh"]*s) EndIf Shapes.SetOpacity(_shp[i],shape[i]["op"]) Shapes.Move(_shp[i], x0 + shape[i]["x"]*s, y0 + shape[i]["y"]*s) Shapes.Rotate(_shp[i], shape[i]["ang"]) EndFor EndSub Sub init shape[1]="fn=Pol;x=560;y=183;pts=4,156 15,132 23,104 36,88 45,55 51,36 68,16 81,12 103,10 116,16 133,27 154,38 171,31 186,13 196,4 218,4 241,7 276,32 299,71 302,93 302,129 302,164 300,193 300,216 294,220 271,217 261,214 259,185 253,154 254,172 254,204 255,227 253,258 244,259 233,251 236,301 233,325 231,356 230,370 209,376 193,375 171,360 180,343 181,302 177,264 171,243 156,244 153,259 148,298 142,326 141,351 138,370 122,374 98,372 83,365 86,336 85,307 91,251 93,224 85,224 67,220 74,201 80,178 80,142 84,112 71,136 61,150 45,165 40,175 22,174;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#000080;pw=2;" shape[2]="fn=Pol;x=140;y=186;pts=67,19 40,22 19,33 14,45 8,74 4,131 4,173 8,198 23,199 45,196 50,180 49,159 52,131 53,145 56,200 50,226 62,230 75,229 78,232 75,261 73,293 69,317 71,337 78,341 98,343 113,339 120,312 124,263 127,222 134,220 136,237 138,271 139,302 143,324 140,341 145,350 163,350 184,349 190,341 193,325 195,279 196,239 196,212 204,212 216,212 219,193 219,159 215,119 215,86 212,54 221,84 232,117 242,146 254,155 262,170 274,173 292,160 298,155 289,126 273,87 264,55 259,40 245,22 216,8 198,4 166,9 146,21 126,33 110,27 96,11 78,11;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#000080;pw=2;" shape[3]="fn=Pol;x=242;y=278;pts=4,8 5.04,7.86 6,7.46 6.83,6.83 7.46,6 7.86,5.04 8,4 7.86,2.96 7.46,2 6.83,1.17 6,0.54 5.04,0.14 4,0 2.96,0.14 2,0.54 1.17,1.17 0.54,2 0.14,2.96 0,4 0.14,5.04 0.54,6 1.17,6.83 2,7.46 2.96,7.86;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[4]="fn=Pol;x=243;y=315;pts=4,8 5,7.9 6,7.5 6.8,6.8 7.5,6 7.9,5 8,4 7.9,3 7.5,2 6.8,1.2 6,0.5 5,0.1 4,0 3,0.1 2,0.5 1.2,1.2 0.5,2 0.1,3 0,4 0.1,5 0.5,6 1.2,6.8 2,7.5 3,7.9;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[5]="fn=Pol;x=281;y=280;pts=4,8 5,7.9 6,7.5 6.8,6.8 7.5,6 7.9,5 8,4 7.9,3 7.5,2 6.8,1.2 6,0.5 5,0.1 4,0 3,0.1 2,0.5 1.2,1.2 0.5,2 0.1,3 0,4 0.1,5 0.5,6 1.2,6.8 2,7.5 3,7.9;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[6]="fn=Pol;x=281;y=314;pts=4,8 5,7.9 6,7.5 6.8,6.8 7.5,6 7.9,5 8,4 7.9,3 7.5,2 6.8,1.2 6,0.5 5,0.1 4,0 3,0.1 2,0.5 1.2,1.2 0.5,2 0.1,3 0,4 0.1,5 0.5,6 1.2,6.8 2,7.5 3,7.9;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[7]="fn=Pol;x=231;y=149;pts=36,56 45.36,55.02 54,52.22 61.47,47.81 67.14,42 70.74,35.28 72,28 70.74,20.72 67.14,14 61.47,8.19 54,3.78 45.36,0.98 36,0 26.64,0.98 18,3.78 10.53,8.19 4.86,14 1.26,20.72 0,28 1.26,35.28 4.86,42 10.53,47.81 18,52.22 26.64,55.02;zmw=1;zmh=1;ang=0;op=100;bc=#FFCCCC;pc=#1E50A2;pw=0.7;" shape[8]="fn=Pol;x=178;y=101;pts=2.8,62 14.0,50 23.8,45 44.1,40 60.9,37 64.4,8 83.3,4 114.8,5 123.2,29 126.0,41 143.5,43 164.5,54 172.9,62 176.4,73 165.9,74 134.4,69 100.1,64 56.7,62 18.9,70 7.0,71;zmw=1;zmh=1;ang=0;op=100;bc=#BED3CA;pc=#000080;pw=2;" shape[9]="fn=Pol;x=677;y=156;pts=36,56 45,55 54,52 61,48 67,42 71,35 72,28 71,21 67,14 61,8 54,4 45,1 36,0 27,1 18,4 11,8 5,14 1,21 0,28 1,35 5,42 11,48 18,52 27,55;zmw=1;zmh=1;ang=0;op=100;bc=#FFCCCC;pc=#1E50A2;pw=0.7;" shape[10]="fn=Pol;x=628;y=105;pts=0.0,58 11.2,46 21.0,41 41.3,36 58.1,33 61.6,4 80.5,0 112.0,1 120.4,25 123.2,37 140.7,39 161.7,50 170.1,58 173.6,69 163.1,70 131.6,65 97.3,60 53.9,58 16.1,66 4.2,67;zmw=1;zmh=1;ang=-4;op=100;bc=#BED3CA;pc=#000080;pw=2;" shape[11]="fn=Pol;x=475;y=337;pts=28.0,72.0 35.28,70.74 42.0,67.14 47.81,61.47 52.22,54.0 55.02,45.36 56.0,36.0 55.02,26.64 52.22,18.0 47.81,10.53 42.0,4.86 35.28,1.26 28.0,0.0 20.72,1.26 14.0,4.86 8.19,10.53 3.78,18.0 0.98,26.64 0.0,36.0 0.98,45.36 3.78,54.0 8.19,61.47 14.0,67.14 20.72,70.74;zmw=1;zmh=1;ang=0;op=100;bc=#008040;pc=#1E50A2;pw=0.9;" shape[12]="fn=Pol;x=479;y=368;pts=12.0,8.0 15.12,7.86 18.0,7.46 20.49,6.83 22.38,6.0 23.58,5.04 24.0,4.0 23.58,2.96 22.38,2.0 20.49,1.17 18.0,0.54 15.12,0.14 12.0,0.0 8.88,0.14 6.0,0.54 3.51,1.17 1.62,2.0 0.42,2.96 0.0,4.0 0.42,5.04 1.62,6.0 3.51,6.83 6.0,7.46 8.88,7.86;zmw=1;zmh=1;ang=32;op=100;bc=#0000FF;pc=#1E50A2;pw=0.1;" shape[13]="fn=Pol;x=502;y=367;pts=12.0,8.0 15.0,7.9 18.0,7.5 20.4,6.8 22.5,6.0 23.7,5.0 24.0,4.0 23.7,3.0 22.5,2.0 20.4,1.2 18.0,0.5 15.0,0.1 12.0,0.0 9.0,0.1 6.0,0.5 3.6,1.2 1.5,2.0 0.3,3.0 0.0,4.0 0.3,5.0 1.5,6.0 3.6,6.8 6.0,7.5 9.0,7.9;zmw=1;zmh=1;ang=-42;op=100;bc=#0000FF;pc=#1E50A2;pw=0.1;" shape[14]="fn=Pol;x=412;y=341;pts=7,12 17,10 29,14 36,26 41,40 51,55 65,67 91,73 111,69 124,58 140,40 149,21 155,12 161,5 172,4 186,10 180,25 167,40 149,66 138,83 126,102 122,110 121,135 121,162 119,178 116,195 120,221 119,241 117,259 113,276 98,277 100,258 98,227 97,208 88,194 80,198 76,218 73,236 70,259 70,276 65,282 51,276 47,255 50,221 54,194 54,165 52,149 51,133 46,115 43,95 30,78 21,61 14,47 5,36 4,23;zmw=1;zmh=1;ang=0;op=100;bc=#008040;pc=#000080;pw=2;" shape[15]="fn=Pol;x=695;y=279;pts=4,8 5,8 6,7 7,7 7,6 8,5 8,4 8,3 7,2 7,1 6,1 5,0 4,0 3,0 2,1 1,1 1,2 0,3 0,4 0,5 1,6 1,7 2,7 3,8;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[16]="fn=Pol;x=745;y=277;pts=4,8 5,8 6,7 7,7 7,6 8,5 8,4 8,3 7,2 7,1 6,1 5,0 4,0 3,0 2,1 1,1 1,2 0,3 0,4 0,5 1,6 1,7 2,7 3,8;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[17]="fn=Pol;x=696;y=313;pts=4,8 5,8 6,7 7,7 7,6 8,5 8,4 8,3 7,2 7,1 6,1 5,0 4,0 3,0 2,1 1,1 1,2 0,3 0,4 0,5 1,6 1,7 2,7 3,8;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" shape[18]="fn=Pol;x=745;y=313;pts=4,8 5,8 6,7 7,7 7,6 8,5 8,4 8,3 7,2 7,1 6,1 5,0 4,0 3,0 2,1 1,1 1,2 0,3 0,4 0,5 1,6 1,7 2,7 3,8;zmw=1;zmh=1;ang=0;op=100;bc=#FF0080;pc=#1E50A2;pw=0.1;" EndSub End>VWN806.sb< Start>VWP619.sb< GW=800 GH=600 N=80 ' number M=30 ' size DL=2000 ' delay GraphicsWindow.Width=GW GraphicsWindow.Height=GH For i = 1 To N TWH=math.GetRandomNumber(M)+5 TL=math.GetRandomNumber(200)+50 TAG=math.GetRandomNumber(360) GRC=GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor=GRC GraphicsWindow.PenColor=GRC Tri[i] = Shapes.AddTriangle(0,0,TWH,0,TWH/2,TL) Shapes.Move(Tri[i],Math.GetRandomNumber(GW),Math.GetRandomNumber(GH)) Shapes.Rotate(Tri[i],TAG) EndFor While "True" For i = 1 To N x = Math.GetRandomNumber(GW) y = Math.GetRandomNumber(GH) TAG=math.GetRandomNumber(360) Shapes.Animate(Tri[i], x, y, DL) Shapes.Rotate(Tri[i],TAG) EndFor Program.Delay(DL) EndWhile End>VWP619.sb< Start>VWT316.sb< 'LDUtilities.transparentgw() i=1 bx=20 by=350 inn=0 dodrw=0 aclr=0 GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width =800 LDUtilities.ShowNoShapeErrors="False LDUtilities.ShowErrors="False mmat=LDText.Split ("Draw *Shadows ---------- *Autoclr _Red _Green _Blue _Black _White _Yellow _Cyan _Magenta _Orange _Brown _DarkGray //--------- Demo Save Load Clear"," ") cmn=Array.GetItemCount (mmat) LDDialogs.AddRightClickMenu(mmat,"") LDDialogs.RightClickMenu=rmnn LDShapes.ShapeEvent=shhp GraphicsWindow.Title ="Wait... for x=1 To 50 for y=1 to 15 oo[i]=Shapes.AddEllipse (22,22) ss[oo[i]]=oo[i] Shapes.Move (ss[oo[i]],x*15,y*15) Shapes.SetOpacity (ss[oo[i]],30) LDShapes.PenWidth(oo[i],0) LDShapes.BrushColour (oo[i], LDColours.HSLtoRGB(x*7,0.9,0.2+y*0.7/15)) LDShapes.SetShapeEvent (oo[i]) If Math.Remainder (i 2)=0 then LDEffect.DropShaddow (oo[i] "") endif i=i+1 EndFor EndFor 'LDFastShapes.Update () GraphicsWindow.Title ="OK ft=1 While 1=1'------------------------------------------------mainloop if dodrw=1 And inn=0 then inn=1 dodrw=0 clmat() 'LDFastShapes.Update () plmat() GraphicsWindow.Title="Play" ft=1 inn=0 endif Program.Delay(1) endwhile Sub rmnn'-----------------------------------------------popumenu handling di= LDDialogs.LastRightClickMenuItem os=mmat[di] If di>3 and di<16 then For r=4 To 15 mmat[r]="_"+Text.GetSubTextToEnd(mmat[r],2) endfor mmat[di]="*"+Text.GetSubTextToEnd(mmat[di],2) LDDialogs.AddRightClickMenu(mmat,"") aclr=di-4 elseIf Text.StartsWith (os,"*") Then lopt=1 mmat[di]="_"+Text.GetSubTextToEnd(mmat[di],2) LDDialogs.AddRightClickMenu(mmat,"") elseIf Text.StartsWith (os,"_") Then lopt=0 mmat[di]="*"+Text.GetSubTextToEnd(mmat[di],2) LDDialogs.AddRightClickMenu(mmat,"") elseIf di=1 Then dodrw=1 elseif di=cmn-2 then ff=LDDialogs.SaveFile ("txt","i:\") If ff="" then Else st=six st=ldtext.Replace (st,"=Ellipse","#") ' The following line could be harmful and has been automatically commented. ' File.WriteContents(ff,st) EndIf elseif di=cmn-3 then demm() six=ldtext.Replace(six,"#","=Ellipse") dodrw=1 elseif di=cmn-1 then ff=LDDialogs.OpenFile("txt","i:\") ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists (ff) then ' The following line could be harmful and has been automatically commented. ' six=File.ReadContents (ff) If Text.IsSubText (six,"#") then six=ldtext.Replace(six,"#","=Ellipse") endif dodrw=1 endif elseif di=cmn then bx=20 by=350 GraphicsWindow.BrushColor="teal GraphicsWindow.FillRectangle(0,300,660,550) clmat() 'LDFastShapes.Update () endif EndSub Sub shhp ls=ldshapes.LastEventShape lt= LDShapes.LastEventType ' GraphicsWindow.Title=lt If lt="MouseUp" then Timer.Pause () GraphicsWindow.Title="Stop:"+ttc pm=0 elseIf lt="MouseEnter" then if Mouse.IsLeftButtonDown then If ft=1 then ft=0 ttc=1 six=0 ols=-1 clmat() endif penn[ttc]=pm pm=1 six[ttc]=ls If ls<>ols then ttc=ttc+1 GraphicsWindow.Title="Run..."+ttc Shapes.SetOpacity(ss[ls], Shapes.GetOpacity (ss[ls])*2.7) 'LDFastShapes.Update () endif ols=ls endif endif EndSub Sub clmat i=1 for x=1 To 50 for y=1 to 15 Shapes.SetOpacity(oo[i],30) i=i+1 EndFor EndFor endsub Sub plmat bx=bx+130 GraphicsWindow.PenColor="DarkBlue GraphicsWindow.PenWidth=3 sx=bx For t=1+lopt To 2 If t=2 Then bx=sx-3 by0=by by=by-3 GraphicsWindow.PenColor="Yellow endif for i=1 to Array.GetItemCount (six) Shapes.SetOpacity(ss[six[i]],Shapes.getOpacity(ss[six[i]])*2.7) 'LDFastShapes.Update () ex=(Shapes.GetLeft(ss[six[i]])-15)/6 ey=(Shapes.GetTop(ss[six[i]])-15)/6 if i>1 then if aclr=0 then if t>1 then GraphicsWindow.PenColor=LDColours.HSLtoRGB(Math.Remainder (i*5,360),0.8,0.7) endif Elseif t>1 then GraphicsWindow.PenColor=Text.GetSubTextToEnd(mmat[aclr+4],2) endif if penn[i]=1 then GraphicsWindow.DrawLine (ox,oy,ex+bx,ey+by) endif EndIf ox=ex+bx oy=ey+by Program.Delay(20) EndFor EndFor by=by0 endsub Sub demm six="1#31;2#46;3#47;4#62;5#63;6#78;7#79;8#94;9#95;10#110;11#125;12#140;13#155;14#169;15#168;16#153; six=six+"17#154;18#139;19#140;20#126;21#127;22#112;23#113;24#114;25#100;26#101;27#86;28#87;29#73;30#59; six=six+"31#44;32#29;33#28;34#27;35#26;36#25;37#40;38#54;39#55;40#54;41#55;42#54;43#69;44#70;45#85;46#100;47#115;48#130;49#131; six=six+"50#146;51#161;52#176;53#190;54#205;55#219;56#233;57#248;58#247;59#261;60#260;61#274;62#273;63#259;64#245;65#231;66#232; six=six+"67#218;68#219;69#205;70#206;71#191;72#192;73#193;74#179;75#180;76#195;77#209;78#224;79#239;80#253;81#268;82#267;83#282; six=six+"84#297;85#296;86#311;87#310;88#325;89#324;90#339;91#324;92#338;93#323;94#309;95#295;96#281;97#282;98#268;99#269;100#270; six=six+"101#285;102#300;103#314;104#329;105#344;106#343;107#358;108#373;109#372;110#387;111#401;112#400;113#415;114#414;115#429; six=six+"116#428;117#442;118#441;119#456;120#455;121#469;122#455;123#441;124#442;125#428;126#429;127#414;128#415;129#401;130#402; six=six+"131#403;132#404;133#405;134#420;135#434;136#449;137#463;138#478;139#492;140#506;141#521;142#520;143#535;144#534;145#549; six=six+"146#548;147#562;148#561;149#576;150#575;151#589;152#575;153#561;154#547;155#533;156#534;157#520;158#521;159#522;160#523; six=six+"161#524;162#523;163#538;164#539;165#553;166#568;167#582;168#596;169#595;170#610;171#596;172#597;173#583;174#598;175#599; six=six+"176#614;177#629;178#643;179#644;180#658;181#673;182#687;183#686;184#701;185#700;186#699;187#684;188#683;189#668;190#653; six=six+"191#639;192#638;193#624;194#639;195#653;196#668;197#683;198#698;199#713;200#727;201#728;202#743; endsub End>VWT316.sb< Start>VXF713.sb< ' ' Game Controller Sample 1 ' V: 0.9.1.3.0 ' Created for Data Extension 0.9.1.3 and Small Basic 0.9.5 ' Created by Oskariok, http://dataextension.webatu.com ' Sample to get input from controller using TextWindow and while loop. ' 'Init TextWindow TextWindowPlus.Height = 44 TextWindowPlus.TopMost = "True" TextWindow.Title = "Game Controller Sample 1" start: While GameController.IsConnected = "False" 'GameController.IsConnected gets is controller connected. This property doesn't need updating. If Aero.IsVistaOrNewer Then 'If operating system is vista or seven use newer TaskDialog. Aero.ShowTaskDialog("Unaible to connect to controller", "ERROR", "Error", "OK", "Warning") Else 'Otherwise fallback to old MessageBox. Dialogs.ShowMessageBox("Unaible to connect to controller", "Error","OK","Warning") EndIf EndWhile If Aero.IsVistaOrNewer Then Aero.ShowTaskDialog("Connected to controller", "SUCCESS", "OK", "OK", "Information") Else Dialogs.ShowMessageBox("Connected to controller", "OK","OK","Information") EndIf 'Because Xinput Api GameController does not have events. To update values use while loop or timer (while loop is better) and GameController.UpdateValues() 'or GameController.ValuesChanged. GameController.ValuesChanged also gets are values changed since last values. While GameController.IsConnected If GameController.ValuesChanged = "True" Then 'GameController.ValuesChanged checks are values changed. If they are it updates them. UpdateValues() EndIf EndWhile TextWindow.Clear() TextWindow.WriteLine("Lost connection to controller") TextWindow.Pause() Goto start Sub UpdateValues TextWindow.Clear() TextWindow.WriteLine("Controller Input Information") TextWindow.WriteLine("Battery Level = " + GameController.BatteryLevel) TextWindow.WriteLine("Battery Type = " + GameController.BatteryType) TextWindow.WriteLine("") TextWindow.WriteLine("Left Stick:") TextWindow.WriteLine("X = " + GameController.LeftStickX) TextWindow.WriteLine("Y = " + GameController.LeftStickY) TextWindow.WriteLine("Angle = " + MathPlus.GetDegrees(MathPlus.ATan2(GameController.LeftStickX, GameController.LeftStickY))) 'To get is button down or up use GameController.IsButtonDown() . TextWindow.WriteLine("LB = " + GameController.IsButtonDown("LB")) TextWindow.WriteLine("LS = " + GameController.IsButtonDown("LS")) TextWindow.WriteLine("LS Down = " + GameController.IsButtonDown("LeftStickDown")) TextWindow.WriteLine("LS Left = " + GameController.IsButtonDown("LeftStickLeft")) TextWindow.WriteLine("LS Right = " + GameController.IsButtonDown("LeftStickRight")) TextWindow.WriteLine("LS Up = " + GameController.IsButtonDown("LeftStickUp")) TextWindow.WriteLine("LT = " + GameController.IsButtonDown("LT")) TextWindow.WriteLine("") TextWindow.WriteLine("Right Stick:") TextWindow.WriteLine("X = " + GameController.RightStickX) TextWindow.WriteLine("Y = " + GameController.RightStickY) TextWindow.WriteLine("Angle = " + MathPlus.GetDegrees(MathPlus.ATan2(GameController.RightStickX, GameController.RightStickY))) TextWindow.WriteLine("RB = " + GameController.IsButtonDown("RB")) TextWindow.WriteLine("RS = " + GameController.IsButtonDown("RS")) TextWindow.WriteLine("RS Down = " + GameController.IsButtonDown("RightStickDown")) TextWindow.WriteLine("RS Left = " + GameController.IsButtonDown("RightStickLeft")) TextWindow.WriteLine("RS Right = " + GameController.IsButtonDown("RightStickRight")) TextWindow.WriteLine("RS Up = " + GameController.IsButtonDown("RightStickUp")) TextWindow.WriteLine("RT = " + GameController.IsButtonDown("RT")) TextWindow.WriteLine("") TextWindow.WriteLine("Buttons:") TextWindow.WriteLine("A = " + GameController.IsButtonDown("A")) TextWindow.WriteLine("B = " + GameController.IsButtonDown("B")) TextWindow.WriteLine("Y = " + GameController.IsButtonDown("Y")) TextWindow.WriteLine("X = " + GameController.IsButtonDown("X")) TextWindow.WriteLine("Start = " + GameController.IsButtonDown("Start")) TextWindow.WriteLine("Back = " + GameController.IsButtonDown("Back")) TextWindow.WriteLine("") TextWindow.WriteLine("D-Pad") TextWindow.WriteLine("D-Pad Down = " + GameController.IsButtonDown("DPADDOWN")) TextWindow.WriteLine("D-Pad Left = " + GameController.IsButtonDown("DPADLEFT")) TextWindow.WriteLine("D-Pad Right = " + GameController.IsButtonDown("DPADRIGHT")) TextWindow.WriteLine("D-Pad Up = " + GameController.IsButtonDown("DPADUP")) EndSub End>VXF713.sb< Start>VXJ389.sb< GraphicsWindow.FillEllipse(200,200,10,10) GraphicsWindow.DrawText(10,10,"Arrow keys to move, Space to fire") Arrow = Shapes.AddImage("http://kniferound.net/w/images/4/41/Arrow.png") power = 100 Gravity = 0 '<--- Change this to 1500 to use it well BallCount = 10 Delta = 1 While 1 = 1 Program.Delay(5) Shapes.Move(Arrow,x,y) Shapes.Rotate(Arrow,ShapeAngle) TextWindow.Clear() For i = 1 To BallCount Time[i] = (Clock.ElapsedMilliseconds / 1000) - TimeStart[i] Velocity = Power / 10 Velocityhorizontal[i] = Math.GetDegrees(Math.Cos(Math.GetRadians(Angle[i]))) * Velocity Velocityvertical[i] = Math.GetDegrees(Math.Sin(Math.GetRadians(Angle[i]))) * Velocity xyArray["x"] = Velocityhorizontal[i] * Time[i] + Startx[i] xyArray["y"] = Velocityvertical[i] * Time[i] + Starty[i] Shapes.Move(Ball[i],xyArray["x"],xyArray["y"]) Xrot = 200 - xyArray["x"] Yrot = 200 - xyArray["y"] If Xrot < 0 Then TempAngle = Math.GetDegrees(Math.ArcTan(Yrot/Xrot)) - 180 Else TempAngle = Math.GetDegrees(Math.ArcTan(Yrot/Xrot)) EndIf AngleChange=Math.Round((Angle[i] -TempAngle) - 90) If AngleChange > 0 Then Angle[i] = Angle[i] - 1 EndIf If AngleChange < 0 Then Angle[i] = Angle[i] + 1 EndIf TextWindow.WriteLine(AngleChange) EndFor If LDUtilities.KeyDown("Space") Then If Clock.ElapsedMilliseconds - LastFire > 300 Then Fire() LastFire = Clock.ElapsedMilliseconds EndIf EndIf If LDUtilities.KeyDown("Right") Then x = x + 1 ShapeAngle = 0 EndIf If LDUtilities.KeyDown("Left") Then x = x - 1 ShapeAngle = 180 EndIf If LDUtilities.KeyDown("Up") Then y = y - 1 ShapeAngle = 270 EndIf If LDUtilities.KeyDown("Down") Then y = y + 1 ShapeAngle = 90 EndIf EndWhile Sub Fire ShotsFired = ShotsFired + Delta If Ball[ShotsFired] = "" Then '<--- If it has not already spawned, then add it Ball[ShotsFired] = Shapes.AddEllipse(10,10) EndIf If ShotsFired > BallCount Then '<--- If the number of shots fired is more than the number of balls that can possible be on the screen, Then set it to One ShotsFired = 1 EndIf Angle[ShotsFired] = ShapeAngle '<--- Get a random angle (Temp) TimeStart[ShotsFired] = Clock.ElapsedMilliseconds / 1000 Startx[ShotsFired] = x + 90 Starty[ShotsFired] = y + 60 EndSub End>VXJ389.sb< Start>VXJ773-0.sb< 'Product by Thaelmann-Pioniere' GraphicsWindow.Title="The State Banner of Indonesia" GraphicsWindow.Width=300 GraphicsWindow.Height=200 GraphicsWindow.BrushColor="#ff0000" GraphicsWindow.FillRectangle(0,0,300,100) GraphicsWindow.BackgroundColor="white" End>VXJ773-0.sb< Start>VXJ773.sb< 'Product by Thaelmann-Pioniere' GraphicsWindow.Title="The State Banner of Ukraine" GraphicsWindow.Width=300 GraphicsWindow.Height=200 GraphicsWindow.BrushColor="#005BBC" GraphicsWindow.FillRectangle(0,0,300,100) GraphicsWindow.BrushColor="#FFD600" GraphicsWindow.FillRectangle(0,100,300,100) End>VXJ773.sb< Start>VXK727.sb< ' 30-second Animation ' gw = GraphicsWindow.Width gh = GraphicsWindow.Height dx = gw / 6 dy = gh / 3 fs = 60 x0 = dx - fs / 2 y0 = dy - fs GraphicsWindow.FontSize = fs GraphicsWindow.BrushColor = "Orange" t0 = Clock.ElapsedMilliseconds For i = 1 To 10 obj[i] = Shapes.AddText(i) x[i] = x0 + dx * Math.Remainder(i - 1, 5) y[i] = y0 + dy * Math.Floor((i - 1) / 5) Shapes.Move(obj[i], gw + fs, y[i]) EndFor song1 = "O4C4C8C8C4C8C8E4G8G8E4C4D4D8D8D4D8D8O3B4O4D8D8O3B4G4" song2 = "O4C4C8C8C4C8C8E4G8G8E4C4G4F4E4D4C1" int = 770 Timer.Interval = int f = 0 Timer.Tick = OnTick Sound.PlayMusic(song1) Sound.PlayMusic(song2) Sound.PlayMusic(song1) Sound.PlayMusic(song2) Sub OnTick t1 = Clock.ElapsedMilliseconds f = f + 1 sec = Math.Floor((t1 - t0) / 1000) GraphicsWindow.Title = sec + "[sec]" MoveObj() EndSub Sub MoveObj If f <= 3 Then ' 1, 2, 3 Shapes.Animate(obj[f], x[f], y[f], int) ElseIf f = 4 Then ElseIf f <= 7 Then ' 4, 5, 6 Shapes.Animate(obj[f - 1], x[f - 1], y[f - 1], int) ElseIf f = 8 Then ElseIf f <= 11 Then ' 7, 8, 9 Shapes.Animate(obj[f - 2], x[f - 2], y[f - 2], int) ElseIf f = 12 Then ElseIf f = 13 Then ' 10 Shapes.Animate(obj[f - 3], x[f - 3], y[f - 3], int) ElseIf f <= 17 Then ElseIf f <= 19 Then ' 10, 9 Shapes.Animate(obj[28 - f], -fs * 2, y[27 - f], int) ElseIf f = 20 Then ElseIf f <= 23 Then ' 8, 7, 6 Shapes.Animate(obj[29 - f], -fs * 2, y[29 - f], int) ElseIf f = 24 Then ElseIf f <= 27 Then ' 5, 4, 3 Shapes.Animate(obj[30 - f], -fs * 2, y[30 - f], int) ElseIf f = 28 Then ElseIf f = 29 Then ' 2 Shapes.Animate(obj[2], -fs * 2, y[2], int) ElseIf f <= 37 Then ElseIf f = 38 Then ' 1 Shapes.Animate(obj[1], -fs * 2, y[1], int) Else Timer.Pause() GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.DrawText(gw / 2 - fs ,gh / 2 - fs, "End") EndIf EndSub End>VXK727.sb< Start>VXL763.sb< n=1 GraphicsWindow.Height=805 GraphicsWindow.Width=805 For a=0 To 90 Step 5 b[n][1]=LDMath.cos(a)*30 b[n][2]=LDMath.Sin(a)*30 n=n+1 EndFor For a=90 To 0 Step -5 b[n][1]=LDMath.cos(a)*25 b[n][2]=LDMath.Sin(a)*25 n=n+1 EndFor GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor="tan For f=1 To 8 For g=1 To 8 For m=1 To 4 p=LDShapes.AddPolygon(b) LDShapes.SetShapeEvent(p) LDShapes.Move(p f*55+66 g*55+66) LDShapes.RotateAbout(p f*55+66 66+g*55 m*90) EndFor EndFor EndFor aa=LDShapes.GetAllShapes() For f=1 To 64 f1=Text.Append(f1 "1 0 1 0 1 0 ") EndFor f1="1110001011100010111000101110101110001010101010101010101010100010111010101010101010101010101010111000101010101010101010101010001011101010101010101010101010101011100010101010101010101010101000101110101010101010101010101010101110111000101110001011100010110000 For r=1 To 256 ff1[r]=Text.GetSubText(f1 r 1) EndFor f1="0000111000101110001011100010111111101010101010101010101010100010100010101010101010101010101010111110101010101010101010101010001010001010101010101010101010101011111010101010101010101010101000101000101010101010101010101010101111111000101110001011100010110000 For r=1 To 256 ff[r]=Text.GetSubText(f1 r 1) EndFor LDShapes.ShapeEvent=mmm GraphicsWindow.KeyDown=kkk LDEvents.MouseWheel=mww While 1=1 For f=1 To Array.GetItemCount(aa) If ff[f]="1" Then Shapes.SetOpacity(aa[f] 95) Else Shapes.SetOpacity(aa[f] 5) EndIf EndFor Program.Delay(550) For f=1 To Array.GetItemCount(aa) If ff1[f]="1" Then Shapes.SetOpacity(aa[f] 95) Else Shapes.SetOpacity(aa[f] 5) EndIf EndFor Program.Delay(550) EndWhile Sub mww an=an+3*LDEvents.LastMouseWheelDelta LDGraphicsWindow.Reposition(1 1 100 0 an) EndSub Sub kkk If GraphicsWindow.LastKey="Space" Then TextWindow.Clear() For r=1 To 256 TextWindow.Write(ff[r]) EndFor EndIf EndSub Sub mmm lt=LDShapes.LastEventType ll=LDShapes.LastEventShape ' GraphicsWindow.Title=ll li=Text.GetSubTextToEnd(ll 8) If lt="MouseDown" Then If Mouse.IsRightButtonDown Then Shapes.SetOpacity(ll 5) ff[li]=0 Else Shapes.SetOpacity(ll 95) ff[li]=1 EndIf EndIf EndSub End>VXL763.sb< Start>VXM884.sb< ' Setup Game Window GraphicsWindow.BackgroundColor = "SteelBlue" GraphicsWindow.Title = "Big Guns" GraphicsWindow.Width = 600 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FillRectangle(0, 0, GraphicsWindow.Width, GraphicsWindow.Height) GraphicsWindow.BrushColor = "Black" GraphicsWindow.CanResize = 0 GraphicsWindow.KeyDown = HandleKey ' Game Details turnNumber = 0 ' Even turn numbers are player 1, Odd are player 2 gravity = .005 ' Increasing this will increase the gravity in the game firelock = 0 ' When this is set to 1 then the only keyboard command looked at will be quit game (ESC) gameover = 0 ' When this is set to 1 then the game is over and you can only exit the game (ESC) lowestElevation = 345 ' This is the lowest elevation in the game groundLevel = lowestElevation - 5 ' The ground level is slightly above the lowest level player1Position = 20 ' Player 1 X coordinates player2Position = 540 ' Player 2 X coordinates playerElevation = groundLevel ' Players start at Ground Level maxAngle = 90 ' The Maximum Angle a gun can have minAngle = 0 ' The Minimum Angle a gun can have maxPower = 250 ' The Maximum Power a gun can have minPower = 5 ' The Minimum Power a gun can have player1Angle = 45 ' Player 1 starting angle player1Power = 50 ' Player 1 starting power player2Angle = 45 ' Player 2 starting angle player2Power = 50 ' Player 2 starting power windPower = Math.GetRandomNumber(20) ' The power of the Wind windDirection = Math.GetRandomNumber(2) 'One is left, Two is right ' Draw Ground DrawGround() ' Draw Players DrawPlayers() DrawInstructions() UpdateDetails() ' Draws the ground with a Random Mountain Sub DrawGround ' the groundElevation Array keeps track of the elevation of the ground for each X coordinate ' Set the elevation to groundlevel For a = 1 to 600 groundElevation[a] = groundLevel EndFor ' From left to right randomly assign the elevation of the mountain rising lastElevation = 0 For a = 100 to 270 lastElevation = 2 - Math.GetRandomNumber(5) + lastElevation groundElevation[a] = groundLevel + lastElevation EndFor ' From left to right randomly assign the elevation of the mountain going back to ground level For a = 270 to 500 If lastElevation = 0 Then groundElevation[a] = groundLevel Else lastElevation = lastElevation - (2 - Math.GetRandomNumber(5)) If lastElevation + groundLevel > groundLevel Then lastElevation = 0 EndIf groundElevation[a] = groundLevel + lastElevation EndIf EndFor ' Draw the entire ground level with mountain GraphicsWindow.BrushColor = "Brown" For a = 1 to 600 GraphicsWindow.FillRectangle(a, groundElevation[a], 1, lowestElevation - groundElevation[a]) EndFor GraphicsWindow.BrushColor = "Black" EndSub ' Draw the player guns and turrets Sub DrawPlayers ' Draw Player 1 player1 = Shapes.AddTriangle(player1Position, playerElevation, player1Position +5, playerElevation -5, player1Position +10, playerElevation) player1Turret = Shapes.AddLine(0, 0, -15, 0) Shapes.Move(player1Turret, player1Position +5, groundLevel - 5) Shapes.Rotate(player1Turret, Math.Abs(player1Angle - 180)) ' We have to adjust the angle to point to the right instead of the left ' Draw Player 2 player2 = Shapes.AddTriangle(player2Position, playerElevation, player2Position +5, playerElevation -5, player2Position +10, playerElevation) player2Turret = Shapes.AddLine(0, 0, -15, 0) Shapes.Move(player2Turret, player2Position +5, groundLevel - 5) Shapes.Rotate(player2Turret, player2Angle) EndSub Sub DrawInstructions GraphicsWindow.PenWidth = 4 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "Black" GraphicsWindow.FillRectangle(140, 350, 115, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawRectangle(140, 350, 115, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(145, 355, "Wind") GraphicsWindow.DrawText(145, 367, "Direction:") If windDirection = 1 Then windText = "Left" Else windText = "Right" EndIf GraphicsWindow.DrawText(210, 367, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( windText ) ), windText)) GraphicsWindow.DrawText(145, 379, "Power:") GraphicsWindow.DrawText(210, 379, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( windPower ) ), windPower)) GraphicsWindow.PenWidth = 4 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "Black" GraphicsWindow.FillRectangle(280, 350, 170, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawRectangle(280, 350, 170, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(285, 355, "Adjust Angle: LEFT/RIGHT") GraphicsWindow.DrawText(285, 367, "Adjust Power: UP/DOWN") GraphicsWindow.DrawText(285, 379, "Fire: ENTER") EndSub ' Draw the player details boxes Sub UpdateDetails GraphicsWindow.PenWidth = 4 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "Black" GraphicsWindow.FillRectangle(10, 350, 70, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawRectangle(10, 350, 70, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(15, 355, "Player 1") GraphicsWindow.DrawText(15, 367, "Angle:") GraphicsWindow.DrawText(55, 367, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( player1Angle ) ), player1Angle)) GraphicsWindow.DrawText(15, 379, "Power:") GraphicsWindow.DrawText(55, 379, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( player1Power ) ), player1Power)) GraphicsWindow.BrushColor = "Green" GraphicsWindow.FillRectangle(510, 350, 70, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawRectangle(510, 350, 70, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(515, 355, "Player 2") GraphicsWindow.DrawText(515, 367, "Angle:") GraphicsWindow.DrawText(555, 367, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( player2Angle ) ), player2Angle)) GraphicsWindow.DrawText(515, 379, "Power:") GraphicsWindow.DrawText(555, 379, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( player2Power ) ), player2Power)) GraphicsWindow.PenWidth = 1 EndSub ' This gets called when a uers presses a key Sub HandleKey ' Stop game If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf ' Only continue if the game is not over If gameover = 0 Then ' Only continue if no fires are currently being processed If firelock = 0 Then ' Execute the player command ExecutePlayerCommand() EndIf EndIf EndSub Sub ExecutePlayerCommand ' Detemine which player's turn we on (Even Numbers are player 1, Odd Numbers are player 2) playerTurn = Math.Remainder(turnNumber, 2) If GraphicsWindow.LastKey = "Left" Then MoveTurretLeft() ElseIf GraphicsWindow.LastKey = "Right" Then MoveTurretRight() ElseIf GraphicsWindow.LastKey = "Up" Then MoveTurretUp() ElseIf GraphicsWindow.LastKey = "Down" Then MoveTurretDown() ElseIf GraphicsWindow.LastKey = "Return" Then FireTurret() EndIf UpdateDetails() EndSub Sub MoveTurretLeft If playerTurn = 0 Then If player1Angle < maxAngle Then player1Angle = player1Angle + 1 Shapes.Rotate(player1Turret, Math.Abs(player1Angle - 180)) ' We have to adjust the angle to point to the right instead of the left Endif Else If player2Angle > minAngle Then player2Angle = player2Angle - 1 Shapes.Rotate(player2Turret, player2Angle) Endif EndIf EndSub Sub MoveTurretRight If playerTurn = 0 Then If player1Angle > minAngle Then player1Angle = player1Angle - 1 Shapes.Rotate(player1Turret, Math.Abs(player1Angle - 180)) ' We have to adjust the angle to point to the right instead of the left Endif EndIf Else If player2Angle < maxAngle Then player2Angle = player2Angle + 1 Shapes.Rotate(player2Turret, player2Angle) Endif EndIf EndSub Sub MoveTurretUp If playerTurn = 0 Then If player1Power < maxPower Then player1Power = player1Power + 1 Endif Else If player2Power < maxPower Then player2Power = player2Power + 1 Endif EndIf EndSub Sub MoveTurretDown If playerTurn = 0 Then If player1Power > minPower Then player1Power = player1Power - 1 Endif Else If player2Power > minPower Then player2Power = player2Power - 1 Endif EndIf EndSub Sub FireTurret ' Stop the player from firing until this is done firelock = 1 ' Adjust the power to to a reasonable level & get starting postition/Angle for bullet If playerTurn = 0 Then x = player1Position + 5 gunRadian = Math.GetRadians(player1Angle) finalPower = player1Power / 5 Else x = player2Position + 5 gunRadian = Math.GetRadians(player2Angle) finalPower = player2Power / 5 EndIf y = playerElevation - 5 finalWindPower = windPower / 10000 If windDirection = 1 Then finalWindPower = finalWindPower * -1 EndIf ' Calculate Trajectory upVelocity = finalPower * Math.Sin(gunRadian) verticleSpeed = Math.SquareRoot(Math.Power(finalPower, 2) - Math.Power(upVelocity, 2)) If playerTurn = 1 Then verticleSpeed = verticleSpeed * -1 EndIf ' Draw Bullet GraphicsWindow.BrushColor = "Pink" bullet = Shapes.AddEllipse(5, 5) Shapes.Move(bullet, x, y) ' Move bullet until it hits something fireInProcess = 0 While fireInProcess = 0 x = x + (verticleSpeed / 100) y = y - (upVelocity / 100) Shapes.Move(bullet, x, y) Program.Delay(2) ' Apply Wind verticleSpeed = verticleSpeed + finalWindPower ' Apply Gravity upVelocity = upVelocity - gravity PerformCollisionDetection() EndWhile ' Remove Bullet Shapes.Remove(bullet) ' Update Turn Number and allow another fire turnNumber = turnNumber + 1 firelock = 0 EndSub ' Detect if the bullet hit anything Sub PerformCollisionDetection DetectOverTheEdgeOfTheMap() DetectPlayerHit() DetectMountainHit() EndSub ' Detect if the bullet is over the edge of the map Sub DetectOverTheEdgeOfTheMap If x < 5 Then fireInProcess = 1 ElseIf x > GraphicsWindow.Width - 15 Then fireInProcess = 1 ElseIf y > lowestElevation - 1 Then fireInProcess = 1 EndIf EndSub ' Detect if one of the players got hit Sub DetectPlayerHit If fireInProcess = 0 Then If playerTurn = 0 Then If x > player2Position Then If x < player2Position + 10 then If y < playerElevation then If y > playerElevation - 10 then DrawExplosion() GraphicsWindow.ShowMessage("Player 1 Wins!", "Game Over") gameover = 1 fireInProcess = 1 EndIf EndIf Endif EndIf Else If x > player1Position Then If x < player1Position + 10 then If y < playerElevation then If y > playerElevation - 10 then DrawExplosion() GraphicsWindow.ShowMessage("Player 2 Wins!", "Game Over") gameover = 1 fireInProcess = 1 EndIf EndIf Endif EndIf EndIf EndIf EndSub ' Determine if we hit a mountain Sub DetectMountainHit ' Only continue if we didn't hit anything else If fireInProcess = 0 Then ' find the nearest x cordinate to where the bullet is now nearestX = Math.Round(x) ' See if wehit the ground If groundElevation[nearestX] < y Then ' Erase the ground near where we hit GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FillRectangle(nearestX - 10, 0, 20, lowestElevation) ' Lower the elevation near where we hit For a = nearestX - 10 to nearestX + 10 If groundElevation[a] < y Then groundElevation[a] = groundElevation[a] + 10 If lowestElevation - groundElevation[a] < 0 Then groundElevation[a] = lowestElevation EndIf Endif ' Draw the new terrain GraphicsWindow.BrushColor = "Brown" GraphicsWindow.FillRectangle(a, groundElevation[a], 1, Math.Max(lowestElevation - groundElevation[a], 1)) EndFor ' Mark that the firing is over fireInProcess = 1 EndIf Endif EndSub Sub DrawExplosion If playerTurn = 0 Then Shapes.Remove(player2) Shapes.Remove(player2Turret) explosionPosition = player2Position Else Shapes.Remove(player1) Shapes.Remove(player1Turret) explosionPosition = player1Position EndIf Shapes.Remove(bullet) For i = 1 to 140 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() explodeShape[i] = Shapes.AddTriangle(explosionPosition + 4, playerElevation, explosionPosition + 6, playerElevation - 2, explosionPosition + 8, playerElevation) Shapes.Animate(explodeShape[i], Math.GetRandomNumber(100) - 20, -500, 4000) Program.Delay(15) EndFor EndSub End>VXM884.sb< Start>VXQ678-0.sb< args=0 GraphicsWindow.Height=770 GraphicsWindow.Width=1500 GraphicsWindow.backgroundcolor="darkblue GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.PenWidth=20 GraphicsWindow.Title="Turtle pattern pnn="true T_x=10 t_y=400 While y <6 FOR x = -100 To 100 Step 0.5 If x<-95 Then pnn="false ElseIf x>=-2 and x<=1 then pnn="false else pnn="true endif cc=math.Remainder ((x+100+y*30)*5 360) GraphicsWindow.PenColor=LDColours.HSLtoRGB (cc 1 .5) ldcall.Function ("T_Move" x+y) T_Angle=Math.power(x,2) ENDFOR y=y+1 EndWhile sub t_Move ds=args[1] mm=LDMath.Convert2Cartesian (t_x,t_y,ds, t_Angle-90 ) If pnn then GraphicsWindow.DrawLine (t_x t_y mm[1] mm[2]) endif t_x= (mm[1]) t_y= (mm[2]) EndSub End>VXQ678-0.sb< Start>VXQ678.sb< ' Random circle Art, by Y led, July 2, 2016 ' SB July Challende of the month 'program no: y=1 rainbow() GraphicsWindow.Height=768 GraphicsWindow.Width=1366 GraphicsWindow.backgroundcolor=bgcolours[Math.GetRandomNumber(4)] GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.PenWidth=20 Turtle.PenDown() Turtle.Speed=10 Turtle.MoveTo(10,400) While y <> 6 FOR x = -100 To 100 Step 0.5 GraphicsWindow.PenColor=colours[Math.GetRandomNumber(27)] Turtle.Move(x+y) Turtle.Angle=Math.power(x,2) ENDFOR y=y+1 GraphicsWindow.backgroundcolor=bgcolours[Math.GetRandomNumber(4)] EndWhile Sub rainbow colours[1]=GraphicsWindow.GetColorFromRGB (255,13,13) colours[2]=GraphicsWindow.GetColorFromRGB (255,91,13) colours[3]=GraphicsWindow.GetColorFromRGB (254,70,14) colours[4]=GraphicsWindow.GetColorFromRGB (255,201,13) colours[5]=GraphicsWindow.GetColorFromRGB (255,249,13) colours[6]=GraphicsWindow.GetColorFromRGB (200,254,14) colours[7]=GraphicsWindow.GetColorFromRGB (140,253,15) colours[8]=GraphicsWindow.GetColorFromRGB (44,254,14) colours[9]=GraphicsWindow.GetColorFromRGB (14,254,98) colours[10]=GraphicsWindow.GetColorFromRGB (14,254,164) colours[11]=GraphicsWindow.GetColorFromRGB (16,252,228) colours[12]=GraphicsWindow.GetColorFromRGB (14,200,254) colours[13]=GraphicsWindow.GetColorFromRGB (14,128,253) colours[14]=GraphicsWindow.GetColorFromRGB (14,100,254) colours[15]=GraphicsWindow.GetColorFromRGB (14,44,254) colours[16]=GraphicsWindow.GetColorFromRGB (63,15,253) colours[17]=GraphicsWindow.GetColorFromRGB (128,15,253) colours[18]=GraphicsWindow.GetColorFromRGB (170,13,254) colours[19]=GraphicsWindow.GetColorFromRGB (237,13,254) colours[20]=GraphicsWindow.GetColorFromRGB (255,13,252) colours[21]=GraphicsWindow.GetColorFromRGB (254,14,219) colours[22]=GraphicsWindow.GetColorFromRGB (254,14,104) colours[23]=GraphicsWindow.GetColorFromRGB (254,14,50) colours[24]=GraphicsWindow.GetColorFromRGB (254,255,255) colours[26]=GraphicsWindow.GetColorFromRGB (254,155,255) colours[27]=GraphicsWindow.GetColorFromRGB (254,255,155) bgcolours[1]=GraphicsWindow.GetColorFromRGB (0,0,75) bgcolours[2]=GraphicsWindow.GetColorFromRGB (0,0,25) bgcolours[3]=GraphicsWindow.GetColorFromRGB (0,0,100) bgcolours[4]=GraphicsWindow.GetColorFromRGB (0,0,50) Endsub End>VXQ678.sb< Start>VXS640.sb< 'Taylor polynom COS analysis fc[1]=1 For f=2 To 26 fc[f]=fc[f-1]*f EndFor For x=.3 To 3 Step .3 cx=1-x*x/2 For n=2 To 13 cx=cx+Math.Power(-1 n)*Math.Power(x n*2)/fc[2*n] 'TextWindow.WriteLine(cx) EndFor cx1=LDMath.FixDecimal(cx 16) TextWindow.WriteLine(x+":") TextWindow.WriteLine("Tay: "+cx) TextWindow.WriteLine("TyF: "+cx1) TextWindow.WriteLine("Cos: "+LDMath.FixDecimal(Math.Cos(x) 16)) TextWindow.WriteLine("Err: "+(cx-Math.Cos(x))) TextWindow.WriteLine("") EndFor End>VXS640.sb< Start>VXT021-0.sb< ' SmallBasic Version 1.2 ' Program: AutoComplete from Array ' Changelog: 16.6 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/089278d8-ca55-42fb-8c9c-f04be2554045/showing-results-as-they-are-showing-up-similar-to-suggested-searches-when-you-type-into-a-search ' ImportURL: http://smallbasic.com/program/?VXT021-0 ' Extension: ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ ' supposed 'arr' read from eg. database file as eg. "1=firstNameA lastNameA;2=firstNameB lastNameB;3=...," ' The following line could be harmful and has been automatically commented. ' '' like arr = File.ReadContents(path) arr = "1=abcd;2=Hello World;3=small basic;4=1234 5;5=bla Bla;6=hello dolly;7=John doe;8=jane Doe;9=123456;10=John Toe;" arrLow = Text.ConvertToLowerCase(arr) nArr = Array.GetItemCount(arr) crlf = Text.GetCharacter(13) + Text.GetCharacter(10) GraphicsWindow.Title = "AutoComplete TextBox" GraphicsWindow.BackgroundColor = "Gainsboro" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontBold = "" tb = Controls.AddTextBox(10,10) GraphicsWindow.DrawText(10,35, "Found:") GraphicsWindow.BrushColor = "Red" mltb = Controls.AddMultiLineTextBox(10,35 + GraphicsWindow.FontSize +5) Controls.SetSize(mltb, 160,80) Controls.TextTyped = OnTextTyped ' ////////// EVENT \\\\\\\\\\ Sub OnTextTyped txt = Text.ConvertToLowerCase(Controls.GetTextBoxText(tb)) matchTxt = "" For n = 1 To nArr If Text.StartsWith(arrLow[n], txt) Then matchTxt = matchTxt + arr[n] + crlf EndIf EndFor Controls.SetTextBoxText(mltb, matchTxt) EndSub End>VXT021-0.sb< Start>VXT021.sb< ' SmallBasic Version 1.2 ' Program: AutoComplete from Array ' Changelog: 16.6 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/089278d8-ca55-42fb-8c9c-f04be2554045/showing-results-as-they-are-showing-up-similar-to-suggested-searches-when-you-type-into-a-search ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ arr = "0= ;1=abcd;2=Hello World;3=small basic;4=1234;5=bla Bla;" ' "0=..;" is for empty ComboBox arrLow = Text.ConvertToLowerCase(arr) nArr = Array.GetItemCount(arr) GraphicsWindow.Title = "AutoComplete TextBox [choose by 'Return']" GraphicsWindow.BackgroundColor = "Gainsboro" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontBold = "" tb = Controls.AddTextBox(10,10) GraphicsWindow.BrushColor = "Red" AddShape() '' I. Choose AddShape() OR AddCBox() 'AddCBox() '' I. Choose AddShape() OR AddCBox() Controls.TextTyped = OnTextTyped_Shape ''II. Choose %_Shape OR %_CBox LDTextWindow.KeyDown = OnKeyDown_Shape ''II. Choose %_Shape OR %_CBox ' ////////// EVENTs \\\\\\\\\\ Sub OnTextTyped_Shape txt = Text.ConvertToLowerCase(Controls.GetTextBoxText(tb)) len = Text.GetLength(txt) If len < 1 Then shpTxt = "" Else For n = 1 To nArr If Text.StartsWith(arrLow[n], txt) Then shpTxt = arr[n] n = nArr '' exit For loop on 1st match Else shpTxt = "" EndIf EndFor EndIf Shapes.SetText(shp, shpTxt) EndSub Sub OnTextTyped_CBox txt = Text.ConvertToLowerCase(Controls.GetTextBoxText(tb)) len = Text.GetLength(txt) If len < 1 Then LDControls.ComboBoxSelect(cb, 0) Else For n = 1 To nArr If Text.StartsWith(arrLow[n], txt) Then LDControls.ComboBoxSelect(cb, n) n = nArr '' exit For loop on 1st match Else LDControls.ComboBoxSelect(cb, 0) EndIf EndFor EndIf EndSub ' ------------------------------------------------------------------------------------------ Sub OnKeyDown_Shape If LDTextWindow.LastKey = "Return" And shpTxt <> "" Then selection = shpTxt 'GraphicsWindow.ShowMessage(selection +" selected.", "Selection") GraphicsWindow.Title = "Selection: "+ selection EndIf EndSub Sub OnKeyDown_CBox If LDTextWindow.LastKey = "Return" And LDControls.ComboBoxGetSelected(cb) > 0 Then selection = arr[LDControls.ComboBoxGetSelected(cb)] 'GraphicsWindow.ShowMessage(selection +" selected.", "Selection") GraphicsWindow.Title = "Selection: "+ selection EndIf EndSub ' ////////// SUBs \\\\\\\\\\ Sub AddShape shp = Shapes.AddText("") LDShapes.BrushColour(shp, "LightBlue") Shapes.Move(shp, 10,32) EndSub Sub AddCBox cb = LDControls.AddComboBox(arr, 160,100) Controls.Move(cb, 10,32) EndSub End>VXT021.sb< Start>VXW127.sb< GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Black" GraphicsWindow.BackgroundColor = "Gray" textBoxCount = 4 currentTextBox = 1 For i = 1 to textBoxCount GraphicsWindow.DrawRectangle(10, (i - 1) * 30 + 10, 400, 20) textBoxText[i] = "" EndFor GraphicsWindow.TextInput = OnTextInput GraphicsWindow.FontName = "Consolas" DrawText() Sub DrawText y = (currentTextBox - 1) * 30 + 11 GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(11, y, 398, 18) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(11, y, 398, textBoxText[currentTextBox]) EndSub Sub Deactivate y = (currentTextBox - 1) * 30 + 11 GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FillRectangle(11, y, 398, 18) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(11, y, 398, textBoxText[currentTextBox]) EndSub Sub OnTextInput content = textBoxText[currentTextBox] If GraphicsWindow.LastKey = "Back" Then content = Text.GetSubText(content, 1, Text.GetLength(content) - 1) ElseIf GraphicsWindow.LastKey = "Tab" Or GraphicsWindow.LastKey = "Return" Then Deactivate() currentTextBox = currentTextBox + 1 If currentTextBox = 5 then currentTextBox = 1 EndIf content = textBoxText[currentTextBox] Else content = Text.Append(content, GraphicsWindow.LastText) EndIf textBoxText[currentTextBox] = content DrawText() EndSub End>VXW127.sb< Start>VXW977.sb< For x=1 To 30 tt[x][1]=1 tt[1][x]=1 EndFor For y=2 To 30 For x=2 To 30 tt[x][y]=tt[x-1][y]+tt[x][y-1] EndFor EndFor GraphicsWindow.Title="Pascal's Triangle Lines GraphicsWindow.FontName="Geometr706 BlkCn BT" GraphicsWindow.FontSize=7 'TextWindow.WriteLine(tt) f20=14 x830=770 y830=650 GraphicsWindow.BackgroundColor="tan GraphicsWindow.Width=x830 GraphicsWindow.Height=y830 GraphicsWindow.Top=1 GraphicsWindow.penColor="darkred GraphicsWindow.PenWidth=1 For y=2 To 7 For x=2 To 25 ll=math.SquareRoot( tt[x][y]) ol=math.SquareRoot( tt[x-1][y]) hh=math.SquareRoot( tt[x][y-1]) oh=math.SquareRoot( tt[x-1][y-1]) f10=math.abs(LDMath.Sin(hh/ll)*5) GraphicsWindow.DrawLine(ll/f10 hh/f10 ol/f10 oh/f10) GraphicsWindow.DrawLine(x830-ll/f10 hh/f10 x830-ol/f10 oh/f10) GraphicsWindow.DrawLine(ll/f10 y830-hh/f10 ol/f10 y830-oh/f10) GraphicsWindow.DrawLine(x830-ll/f10 y830-hh/f10 x830-ol/f10 y830-oh/f10) EndFor EndFor End>VXW977.sb< Start>VZC916.sb< ' Add Game 0.1 - text version ' Copyright (c) 2013 Nonki Takahashi ' ' History: ' 02/05/2013 Created. ' nQuestions = 20 continue = "True" ' main loop While continue StartTimer() ' ask 20 questions correct = 0 For i = 1 To nQuestions AskQuestion() EndFor StopTimer() ' show # of correct answer ShowNumCorrect() ' show mesured time ShowTime() AskContinue() EndWhile Sub StartTimer t1 = Clock.ElapsedMilliseconds EndSub Sub AskQuestion a = Math.GetRandomNumber(9) b = Math.GetRandomNumber(9) TextWindow.Write(a + "+" + b + "=") c = TextWindow.ReadNumber() If a + b = c Then correct = correct + 1 EndIf EndSub Sub StopTimer t2 = Clock.ElapsedMilliseconds EndSub Sub ShowNumCorrect TextWindow.WriteLine("Correct:" + correct + "/" + nQuestions) EndSub Sub ShowTime TextWindow.WriteLine("Time=" + ((t2 - t1) / 1000) + "[sec]") EndSub Sub AskContinue ans = "" While ans <> "y" And ans <> "n" TextWindow.Write("Continue? ") ans = Text.ConvertToLowerCase(Text.GetSubText(TextWindow.Read(), 1, 1)) EndWhile If ans = "n" Then continue = "False" EndIf EndSub End>VZC916.sb< Start>VZF378.sb< TextWindow.Write("cuantos lados tiene el polígono ") lados = TextWindow.ReadNumber() TextWindow.Write("cuanto mide cada lado? ") largo = TextWindow.ReadNumber() perímetro = lados * largo TextWindow.WriteLine("el perimetro es: " + perímetro) GraphicsWindow.BackgroundColor= "Yellow" GraphicsWindow.PenColor = "Black" angulo = 360 / lados For i = 1 To lados Turtle.Move(largo) Turtle.Turn(angulo) EndFor End>VZF378.sb< Start>VZM386.sb< 'JJ Gun Sights Routine. 'Aug 2013 '***Key: scopeVariableName scopeRadius = 20 scopeLensOpacity = 20 'allows the target to be seen GraphicsWindow.MouseMove = OnMouseMove SetGW() '==========================Main Program/Start Routine (for scope)================ Mouse.HideCursor() CreateScopeShapes() GetMouseCentre() OnMouseMove() 'manually call On Mouse Move to update scope position ShowScope() '-----------------------------------------------Event Response----------------------------------------------- Sub OnMouseMove UpdateScopePosition() MoveScope() ' may combine these 2 subroutines EndSub '------------------------------------------------Subroutines--------------------------------------------------- Sub CreateScopeShapes scopeLens = Shapes.AddEllipse(scopeRadius*2, scopeRadius*2) Shapes.HideShape(scopeLens) 'add then hide (on next line to minimise screen flash) scopeHorzLine = Shapes.AddRectangle(scopeRadius*2, 1) Shapes.HideShape(scopeHorzLine) 'using rectangle so i don't need x & y coord yet scopeVertLine = Shapes.AddRectangle(1, scopeRadius*2) Shapes.HideShape(scopeVertLine) Shapes.SetOpacity(scopeLens, scopeLensOpacity) EndSub Sub GetMouseCentre Mouse.MouseX = GraphicsWindow.Left + GraphicsWindow.Width/2 Mouse.MouseY = GraphicsWindow.Top + GraphicsWindow.Height/2 EndSub Sub ShowScope Shapes.ShowShape(scopeVertLine) 'pos 1st then show in centre of GW Shapes.ShowShape(scopeHorzLine) Shapes.ShowShape(scopeLens) EndSub Sub UpdateScopePosition scopeX = GraphicsWindow.MouseX scopeY = GraphicsWindow.MouseY EndSub Sub MoveScope Shapes.Move(scopeLens, scopeX - scopeRadius, scopeY - scopeRadius) Shapes.Move(scopeHorzLine, scopeX - scopeRadius, scopeY) Shapes.Move(scopeVertLine, scopeX, scopeY - scopeRadius) EndSub Sub SetGW gw = 1100 gh = 580 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = (Desktop.Height - gh) / 3 EndSub End>VZM386.sb< Start>VZM929.sb< ' reverse All to white by NaochanON init() GraphicsWindow.Mousemove=onmove GraphicsWindow.MouseDown=ondown Sub ondown Shapes.SetText(sXY," X= "+NX+ " ; Y= "+NY+Text.GetCharacter(10)+"clicked") For i=1 To row For j=1 To clm If i=NY And j=NX Then OnOffcheck() EndIf If j=NX and math.Abs(i-ny)=1 Then OnOffcheck() EndIf If i=NY and math.Abs(j-nx)=1 Then OnOffcheck() EndIf EndFor EndFor wincheck() EndSub Sub OnOffcheck If BOnOFF[i][j]=1 Then BOnOFF[i][j]=0 Shapes.SetOpacity(B[i][j],0) Elseif BOnOFF[i][j]=0 then BOnOFF[i][j]=1 Shapes.SetOpacity(B[i][j],100) EndIf EndSub Sub onmove MX= GraphicsWindow.MouseX MY= GraphicsWindow.MouseY If x0VZM929.sb< Start>VZR142-0.sb< sir=Math.GetRandomNumber(220) options=0 bosslevelkvyhre=1 prohra=0 deltavys=601 vys=1 vyskameteoru=321 bosslevel=0 sirkameteoru=Math.GetRandomNumber(280) x=130 rychlpad=3 scorre=0 uplnyzacatek: dinastart=0 start=0 GraphicsWindow.FontSize =14 GraphicsWindow.PenColor="Black" GraphicsWindow.BrushColor="Black" score=Controls.AddTextBox(3,4) Controls.SetSize(score,80,20) Controls.SetTextBoxText(score,"SCORE:0") GraphicsWindow.Title="Universe 1 GraphicsWindow.BrushColor="SlateGray" lod=Shapes.AddRectangle(40,30) GraphicsWindow.Top="50" GraphicsWindow.CanResize="False" GraphicsWindow.Width="300" GraphicsWindow.Height="600" ldGraphicsWindow.BackgroundBrush (LDShapes.BrushGradient ("1=Darkblue;2=black" "DD")) For i=1 To 500 GraphicsWindow.BrushColor="Ivory" a=Math.GetRandomNumber(400) b=Math.GetRandomNumber(600) ee=shapes.AddEllipse (2 2) LDShapes.PenWidth (ee 0) LDShapes.BrushColour (ee "yellow") Shapes.Move (ee a b) LDShapes.AnimateOpacity (ee 500+Math.GetRandomNumber (10)*200 0) 'GraphicsWindow.FillEllipse(a,b,2,2) EndFor 'Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\akta x soundtrack.mp3") mesic=Shapes.AddEllipse(60,60) Shapes.Move(mesic,227,100) GraphicsWindow.BrushColor="WhiteSmoke" krater1=Shapes.AddEllipse(10,10) Shapes.Move(krater1,231,130) krater2=Shapes.AddEllipse(10,10) Shapes.Move(krater2,250,142) krater3=Shapes.AddEllipse(10,10) Shapes.Move(krater3,259,115) GraphicsWindow.KeyDown=zvuklodi Shapes.Move(lod,x,GraphicsWindow.Height-30) 'Goto level8 novyufo: GraphicsWindow.BrushColor="SpringGreen" kopule0=Shapes.AddEllipse(30,30) GraphicsWindow.BrushColor="SlateGray" ufo0=Shapes.AddEllipse(80,30) nahoru: vys=vys+1 Shapes.Move(ufo0,sir,vys) Shapes.Move(kopule0,sir+25,vys-15) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If (scorre=5) Then Shapes.Remove(kopule0) Shapes.Remove(ufo0) Goto novylevel EndIf If (vys>GraphicsWindow.Height-61 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) 'Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) Shapes.Remove(ufo0) Shapes.Remove(kopule0) Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) Shapes.Remove(kopule0) Shapes.Remove(ufo0) Goto novyufo EndIf novylevel: levelup=shapes.AddText("LEVEL UP") LDShapes.AnimateOpacity (levelup 400 0) LDShapes.Font (levelup "ARIAL" 44 "true" "false") LDShapes.PenColour (levelup "orange") Program.Delay (22) LDShapes.Centre (levelup GraphicsWindow.Width/2 GraphicsWindow.Height/2) Sound.PlayChimesAndWait() Shapes.HideShape (levelup) Shapes.Move(lod,x,GraphicsWindow.Height-30) GraphicsWindow.Title="Universe 2 novyufo2: GraphicsWindow.BrushColor="SpringGreen" kopule=Shapes.AddEllipse(80,40) motor2=Shapes.AddEllipse(80,20) GraphicsWindow.BrushColor="SlateGray" motor1=Shapes.AddRectangle(80,20) ufo=Shapes.AddRectangle(40,80) ufo2=Shapes.AddRectangle(80,20) nahoru2: vys=vys+1 Shapes.Move(ufo,sir,vys) Shapes.Move(kopule,sir-20,vys+55) Shapes.Move(motor1,sir-20,vys-20) Shapes.Move(motor2,sir-20,vys-30) Shapes.Move(ufo2,sir-20,vys+60) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=10) Then Goto level3 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) rss() Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru2 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Goto novyufo2 EndIf level3: uuu="true rss() Shapes.ShowShape (levelup) Sound.PlayChimesAndWait() Shapes.HideShape (levelup) GraphicsWindow.Title="Universe 3 Shapes.Move(lod,x,GraphicsWindow.Height-30) novyufo3: GraphicsWindow.BrushColor="Crimson" motor2=Shapes.AddEllipse(20,20) motor1=Shapes.AddEllipse(20,20) GraphicsWindow.BrushColor="SlateGray" ufo2=Shapes.AddRectangle(82,15) GraphicsWindow.BrushColor="SpringGreen" kopule=Shapes.AddEllipse(40,40) nahoru3: vys=vys+1 Shapes.Move(motor1,sir+10,vys+42.1410161) Shapes.Move(motor2,sir+51,vys+42.1410161) Shapes.Move(ufo2,sir,vys+42.1410161) Shapes.Move(kopule,sir+21,vys+34.1410161) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=15) Then Goto level4 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) Shapes.Remove(kopule) Shapes.Remove(motor1) Shapes.Remove(motor2) Shapes.Remove(ufo2) Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru3 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Goto novyufo3 EndIf level4: uuu="true rss() GraphicsWindow.Title="Universe 4 Shapes.Move(lod,x,GraphicsWindow.Height-30) novyufo4: GraphicsWindow.BrushColor="Crimson" motor2=Shapes.AddEllipse(20,20) motor1=Shapes.AddEllipse(20,20) GraphicsWindow.BrushColor="SlateGray" ufo2=Shapes.AddEllipse(84,50) ufo=Shapes.AddEllipse(50,80) GraphicsWindow.BrushColor="SpringGreen" kopule=Shapes.AddRectangle(30,45) nahoru4: vys=vys+1 Shapes.Move(motor1,sir+7,vys+80) Shapes.Move(motor2,sir+58,vys+80) Shapes.Move(ufo2,sir,vys) Shapes.Move(ufo,sir+17,vys+25) Shapes.Move(kopule,sir+27,vys+42.5) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=20) Then Goto level5 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) rss() Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru4 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Goto novyufo4 EndIf level5: uuu="true rss() GraphicsWindow.Title="Universe 5 Shapes.Move(lod,x,GraphicsWindow.Height-30) novyufo5: GraphicsWindow.PenColor="WhiteSmoke" GraphicsWindow.BrushColor="PaleTurquoise" záření=Shapes.AddEllipse(97,49) Shapes.SetOpacity(záření,69) GraphicsWindow.PenColor="Black" GraphicsWindow.BrushColor="SlateGray" motor2=Shapes.AddRectangle(5,20) motor1=Shapes.AddRectangle(45,16) ufo=Shapes.AddEllipse(40,30) GraphicsWindow.BrushColor="SpringGreen" kopule=Shapes.AddEllipse(30,20) nahoru5: vys=vys+1 Shapes.Move(záření,sir-5,vys-4) Shapes.Move(motor1,sir+5,vys+15) Shapes.Move(motor2,sir,vys+13) Shapes.Move(ufo,sir+45,vys) Shapes.Move(kopule,sir+50,vys+5) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=25) Then Goto level6 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) rss() Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru5 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Goto novyufo5 EndIf level6: uuu="true rss() Shapes.Move(lod,x,GraphicsWindow.Height-30) GraphicsWindow.Title="Universe 6 novyufo6: GraphicsWindow.BrushColor="SlateGray" motor3=Shapes.AddRectangle(86,15) motor2=Shapes.AddRectangle(10,30) motor1=Shapes.AddRectangle(10,30) GraphicsWindow.BrushColor="Cyan" kopule=Shapes.AddEllipse(70,60) GraphicsWindow.BrushColor="SlateGray" ufo=Shapes.AddRectangle(20,20) nahoru6: vys=vys+1 Shapes.Move(kopule,sir+8,vys) Shapes.Move(motor1,sir+8,vys+35) Shapes.Move(motor2,sir+68,vys+35) Shapes.Move(motor3,sir,vys+65) Shapes.Move(ufo,sir+33,vys+20) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=30) Then Goto level7 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) rss() Shapes.Remove(motor3) Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru6 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Shapes.Remove(motor3) Goto novyufo6 EndIf level7: uuu="true Shapes.Remove(motor3) rss() GraphicsWindow.Title="Universe 7 Shapes.Move(lod,x,GraphicsWindow.Height-30) novyufo7: GraphicsWindow.BrushColor="SpringGreen" ufo2=Shapes.AddEllipse(7,7) motor3=Shapes.AddEllipse(7,7) motor2=Shapes.AddEllipse(7,7) motor1=Shapes.AddEllipse(7,7) GraphicsWindow.BrushColor="SlateGray" ufo=Shapes.AddRectangle(80,80) GraphicsWindow.BrushColor="Cyan" kopule=Shapes.AddEllipse(70,70) nahoru7: vys=vys+1 Shapes.Move(kopule,sir+9.5,vys+9.5) Shapes.Move(ufo2,sir+40,vys) Shapes.Move(motor1,sir,vys+40) Shapes.Move(motor2,sir+40,vys+80) Shapes.Move(motor3,sir+80,vys+40) Shapes.Move(ufo,sir+4.5,vys+4.5) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If(scorre=35) Then Goto level8 EndIf If (vys>GraphicsWindow.Height-81 And sir>=dotek-80 And sir<=dotek+40) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) rss() Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vys<601) Then Goto nahoru7 EndIf If(vys=601) Then vys=0 sir=Math.GetRandomNumber(220) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) rss() Shapes.Remove(motor3) Goto novyufo7 EndIf level8: uuu="true Shapes.Remove(motor3) rss() GraphicsWindow.Title="Universe 8 'Sound.Pause("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\akta x soundtrack.mp3") bosswarning=Controls.AddTextBox(145,3) Controls.SetTextBoxText(bosswarning,"!!WARNING BOSS!!") GraphicsWindow.BackgroundColor="LightCoral" 'Speech.SpeakAndWait("Warning, Boss!") Program.Delay(2000) Controls.Remove(bosswarning) 'Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\akta x soundtrack.mp3") Shapes.Move(lod,x,GraphicsWindow.Height-30) novyufo8: GraphicsWindow.BrushColor="SpringGreen" roh1=Shapes.AddRectangle(30,30) roh2=Shapes.AddRectangle(30,30) GraphicsWindow.BrushColor="SlateGray" ufo=Shapes.AddEllipse(160,160) GraphicsWindow.BrushColor="SpringGreen" oko=Shapes.AddEllipse(30,15) oko2=Shapes.AddEllipse(30,15) motor3=Shapes.AddEllipse(15,15) motor2=Shapes.AddEllipse(15,15) motor1=Shapes.AddEllipse(15,15) GraphicsWindow.BrushColor="Cyan" hlaven=Shapes.AddRectangle(10,120) hlaven2=Shapes.AddRectangle(10,120) GraphicsWindow.BrushColor="SlateGray" delo=Shapes.AddRectangle(40,120) delo2=Shapes.AddRectangle(40,120) nahoru8: vys=vys+1 sir=70 Shapes.Move(ufo,sir,vys) Shapes.Move(roh2,sir+40,vys) Shapes.Move(roh1,sir+90,vys) Shapes.Move(motor1,sir+36,vys+32.5) Shapes.Move(motor2,sir+72.5,vys+32.5) Shapes.Move(motor3,sir+108.5,vys+32.5) Shapes.Move(oko,sir+40,vys+80) Shapes.Move(oko2,sir+90,vys+80) Shapes.Move(hlaven,sir+20,vys+80) Shapes.Move(hlaven2,sir+130,vys+80) Shapes.Move(delo,sir+10, vys+50) Shapes.Move(delo2,sir+110,vys+50) Program.Delay(rychlpad) dotek=Shapes.GetLeft(lod) If (vys<121) Then Goto nahoru8 EndIf If (vys=121) Then Goto level9 EndIf level9: GraphicsWindow.BrushColor="Yellow" Program.Delay(250) hlaven11=Shapes.AddRectangle(10,30) hlaven21=Shapes.AddRectangle(10,30) Program.Delay(250) cervidira=Shapes.AddEllipse(300,7) Shapes.Move(hlaven11,sir+20,vys+170) Shapes.Move(hlaven21,sir+130,vys+170) Shapes.Move(cervidira,0,vys+200) GraphicsWindow.Title="Universe 9 novastrela: GraphicsWindow.BrushColor="SlateGray" meteor=Shapes.AddEllipse(30,30) nahoru10: vyskameteoru=vyskameteoru+1 Shapes.Move(meteor,sirkameteoru,vyskameteoru) Program.Delay(3) If (vyskameteoru>GraphicsWindow.Height-21 And sirkameteoru>=dotek-30 And sirkameteoru<=dotek+20) Then GraphicsWindow.PenColor="Silver" GraphicsWindow.BrushColor="Yellow" lod3=Shapes.AddEllipse(60,60) GraphicsWindow.PenColor="Gold" GraphicsWindow.BrushColor="OrangeRed" lod2=Shapes.AddEllipse(50,50) Shapes.Move(lod3,x-5,GraphicsWindow.Height-45) Shapes.Move(lod2,x,GraphicsWindow.Height-40) Shapes.Remove(lod) ' Sound.Play("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Program.Delay(700) Shapes.Remove(meteor) Program.Delay(200) Shapes.Remove(lod2) Program.Delay(200) Shapes.Remove(lod3) scc() Goto gameover EndIf If (vyskameteoru<601) Then Goto nahoru10 EndIf If (bosslevel=bosslevelkvyhre) Then Goto zachrana EndIf If (vyskameteoru=601) Then Shapes.Remove(meteor) vyskameteoru=321 sirkameteoru=Math.GetRandomNumber(280) scorre=scorre+1 Controls.SetTextBoxText(score,"SCORE:"+scorre) bosslevel=bosslevel+1 Goto novastrela EndIf zachrana: vyskameteoru=321 atombomb=Shapes.AddEllipse(30,60) nahoru12: vyskameteoru=vyskameteoru+1 Shapes.Move(atombomb,sirkameteoru,vyskameteoru) Program.Delay(4) If (vyskameteoru<500) Then Goto nahoru12 EndIf kamikadze=Shapes.AddRectangle(30,60) nahoru11: deltavys=deltavys-1 Shapes.Move(kamikadze,sirkameteoru,deltavys) Program.Delay(2) If (deltavys>500) Then Goto nahoru11 EndIf GraphicsWindow.PenColor="SlateGray" Shapes.Remove(kamikadze) Shapes.Remove(atombomb) GraphicsWindow.PenColor="MediumOrchid" GraphicsWindow.BrushColor="Fuchsia" vyboj=Shapes.AddEllipse(10,340) kamikadze2=Shapes.AddEllipse(50,50) Shapes.Move(kamikadze2,sirkameteoru-10,deltavys-10) Shapes.Move(vyboj,sirkameteoru+10,vyskameteoru-310) Program.Delay(250) Shapes.Remove(ufo) Shapes.Remove(roh2) Shapes.Remove(roh1) Shapes.Remove(motor1) Shapes.Remove(motor2) Shapes.Remove(motor3) Shapes.Remove(oko) Shapes.Remove(oko2) Shapes.Remove(hlaven) Shapes.Remove(hlaven2) Shapes.Remove(delo) Shapes.Remove(delo2) Shapes.Remove(hlaven11) Shapes.Remove(hlaven21) Shapes.Remove(cervidira) lastvybuch=Shapes.AddEllipse(220,220) Shapes.Move(lastvybuch,sir-30,vys) 'Sound.PlayAndWait("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\sound_explosion_sharp.MP3") Shapes.Remove(lastvybuch) Shapes.Remove(kamikadze2) Shapes.Remove(vyboj) Program.Delay(250) Goto vyhralsi gameover: Program.End () Goto uplnyzacatek vyhralsi: GraphicsWindow.Clear() 'Sound.Stop("C:\Documents and Settings\Pavel\My Documents\Dropbox\Vesmír\akta x soundtrack.mp3") GraphicsWindow.BackgroundColor="MidnightBlue" GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=20 youwin=Shapes.AddText("YOU WIN!") LDShapes.BrushColour (youwin "magenta") Shapes.Move(youwin,100,200) 'Speech.SpeakAndWait("You win!") Sound.PlayChimeAndWait() Shapes.Remove(youwin) vyskameteoru=321 vys=0 sir=Math.GetRandomNumber(240) sirkameteoru=Math.GetRandomNumber(260) deltavys=601 bosslevel=0 scorre=0 Goto uplnyzacatek Sub zvuklodi If (GraphicsWindow.LastKey="Left") Then x=x-13 Shapes.Move(lod,x,GraphicsWindow.Height-30) EndIf If (GraphicsWindow.LastKey="Right") Then x=x+13 Shapes.Move(lod,x,GraphicsWindow.Height-30) EndIf If (x>250) Then x=250 EndIf If (x<1) Then x=10 EndIf EndSub Sub scc GraphicsWindow.ShowMessage("GAME OVER, score: "+scorre,"Universe") EndSub Sub rss Shapes.Remove(ufo) Shapes.Remove(kopule) Shapes.Remove(motor1) Shapes.Remove(motor2) Shapes.Remove(ufo2) Shapes.Remove(záření) If uuu then Shapes.ShowShape (levelup) Sound.PlayChimesAndWait() Shapes.HideShape (levelup) uuu="false" EndIf EndSub End>VZR142-0.sb< Start>VZR859.sb< ' ============================================================================ ' ============================= KEYPAD LIBRARY =============================== ' ============================================================================ pKeyPadPort = 1 KEYPAD_ADDRESS = 90 ' Ported from MINDSENSORS NumericPad NXC Library 'KEY_MAP = "0=0;1=1;2=2;3=3;4=4;5=5;6=6;7=7;8=8;9=9;10=*;11=#" 'KEY_ORDER = "0=4;1=1;2=7;3=10;4=5;5=2;6=8;7=0;8=3;9=6;10=9;11=11" KEY_ORDER[0] = 4 KEY_ORDER[1] = 1 KEY_ORDER[2] = 7 KEY_ORDER[3] = 10 KEY_ORDER[4] = 5 KEY_ORDER[5] = 2 KEY_ORDER[6] = 8 KEY_ORDER[7] = 0 KEY_ORDER[8] = 3 KEY_ORDER[9] = 6 KEY_ORDER[10] = 9 KEY_ORDER[11] = 11 Sub InitKeyPad 'Do not change the contents of these Group variables or the order ' These messages configure the keypad capacitive sensing chip MPR121 cfg0[0] = 123 cfg0[1] = 11 cfg1[0] = 43 cfg1[1] = 1 cfg1[2] = 1 cfg1[3] = 0 cfg1[4] = 0 cfg1[5] = 1 cfg1[6] = 1 cfg1[7] = 255 cfg1[8] = 2 cfg2[0] = 65 cfg2[1] = 15 cfg2[2] = 10 cfg2[3] = 15 cfg2[4] = 10 cfg2[5] = 15 cfg2[6] = 10 cfg2[7] = 15 cfg2[8] = 10 cfg2[9] = 15 cfg3[0] = 74 cfg3[1] = 10 cfg3[2] = 15 cfg3[3] = 10 cfg3[4] = 15 cfg3[5] = 10 cfg3[6] = 15 cfg3[7] = 10 cfg3[8] = 15 cfg4[0] = 82 cfg4[1] = 10 cfg4[2] = 15 cfg4[3] = 10 cfg4[4] = 15 cfg4[5] = 10 cfg4[6] = 15 cfg4[7] = 10 cfg4[8] = 15 cfg5[0] = 92 cfg5[1] = 11 cfg5[2] = 32 cfg5[3] = 12 cfg6[0] = 125 cfg6[1] = 156 cfg6[2] = 101 cfg6[3] = 140 _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 10 , 0 ,cfg2) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 9 , 0 ,cfg3) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 9 , 0 ,cfg4) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 4 , 0 ,cfg5) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 9 , 0 ,cfg1) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 2 , 0 ,cfg0) _ret = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 4 , 0 ,cfg6) EndSub Sub ReadKeyPad cmd = Vector.Init(1,0) cmd[0] = 0 result = Sensor.CommunicateI2C(pKeyPadPort, KEYPAD_ADDRESS, 1, 2, cmd) rRawKeys = result[1]*256+result[0] DecodeKeys() EndSub Sub DecodeKeys rPressedKeys = 0 rKeys = Vector.Init(12,0) bit = 11 While bit>=0 And rRawKeys>0 pow = Math.Round(Math.Power(2,bit)) if rRawKeys>=pow Then rRawKeys = rRawKeys - pow rPressedKeys = rPressedKeys + 1 _index = KEY_ORDER[11-bit] rKeys[_index] = 1 Endif bit = bit - 1 EndWhile EndSub Sub ShowPressedKeys If (rPressedKeys>0) Then i = 0 _sk = "" While i<12 If (rKeys[i]>0) Then Speaker.Note(100,300,10) _sk = Text.Append(_sk, " ") '_sk = Text.Append(_sk, KEY_MAP[i]) _sk = Text.Append(_sk,i ) EndIf i = i + 1 EndWhile LCD.Text(1, 5, 60, 1, "key pressed: "+_sk+" ") Else LCD.Text(1, 5, 60, 1, "key pressed: none ") EndIf EndSub ' ============================================================================ ' ============================ SENSOR MUX LIBRARY ============================ ' ============================================================================ MUX_SENSOR1 = 80 MUX_SENSOR2 = 81 MUX_SENSOR3 = 82 MUX_MODE_REG = 82 MUX_DATA_REG = 84 MUX_READY_REG = 116 COLOR_MODE = 2 ' color returned by color sensor COLOR_NONE_CODE = 0 COLOR_BLACK_CODE = 1 COLOR_BLUE_CODE = 2 COLOR_GREEN_CODE = 3 COLOR_YELLOW_CODE = 4 COLOR_RED_CODE = 5 COLOR_WHITE_CODE = 6 COLOR_BROWN_CODE = 7 pMuxPort = 1 pSensorID = 1 pSensorMode = 1 rMuxData = 0 Sub SetMuxSensorMode cmd = Vector.Init(2,0) cmd[0] = MUX_MODE_REG cmd[1] = pSensorMode ret = Sensor.CommunicateI2C(pMuxPort, pSensorID, 2, 1, cmd) 'LCD.Text(1, 5 ,20, 1, "ret = "+ret[0]) EndSub Sub ReadMuxColorSensor cmd = Vector.Init(1,0) cmd[0] = MUX_DATA_REG ret = Sensor.CommunicateI2C(pMuxPort, pSensorID, 1, 1, cmd) rMuxData = ret[0] EndSub Sub CheckPresence rBlueOK = 0 rWhiteOK = 0 rRedOK = 0 pSensorID = MUX_SENSOR1 ReadMuxColorSensor() If rMuxData=5 Then 'RED is 5 rRedOK = 1 EndIf pSensorID = MUX_SENSOR2 ReadMuxColorSensor() If rMuxData=6 Then 'WHITE is 6 rWhiteOK = 1 EndIf pSensorID = MUX_SENSOR3 ReadMuxColorSensor() If rMuxData=2 Then 'BLUE is 2 rBlueOK = 1 EndIf EndSub Sub InitMuxAllColor pSensorMode = COLOR_MODE pSensorID = MUX_SENSOR1 SetMuxSensorMode() pSensorID = MUX_SENSOR2 SetMuxSensorMode() pSensorID = MUX_SENSOR3 SetMuxSensorMode() EndSub ' ============================================================================ ' ============================ NXTSERVO LIBRARY =============================== ' ============================================================================ NXTServo_POWER_PORT = "A" NXTServo_PORT = 1 NXTServo_VBATT = 65 NXTServo_SPEED = 82 NXTServo_POS = 89 NXTServo_ADDRESS = 88 ' --------- CONSTANTS RED_LIGHT_ID = 6 YELLOW_LIGHT_ID = 7 GREEN_LIGHT_ID = 8 pServoID = 1 pSpeed = 0 pPos = 1500 pLightID = RED_LIGHT_ID pLightStatus = 0 rServo = 0 ' result of SetServoSpeed(), if 0 is OK rPos = 0 ' result of SetServoPos(), if 0 is OK Sub SetServoPosition ok = 0 attempts = 0 While ok = 0 AND attempts < 2 n = NXTServo_POS + pServoID cmd = Vector.Init(2,0) cmd[0] = n cmd[1] = pPos/10 result = Sensor.CommunicateI2C(NXTServo_PORT, NXTServo_ADDRESS, 2, 1, cmd) rPos = result[0] If result[0] = 0 Then 'LCD.Text(1,0,115,0,"S"+pServoID+" Pos: "+pPos+"R:"+result[0]) ok = 1 Else attempts = attempts + 1 EndIf EndWhile EndSub Sub SetServoSpeed ok = 0 attempts = 0 While ok = 0 AND attempts < 3 n = NXTServo_SPEED + pServoID - 1 cmd = Vector.Init(2,0) cmd[0] = n cmd[1] = pSpeed result = Sensor.CommunicateI2C(NXTServo_PORT, NXTServo_ADDRESS, 2, 1, cmd) 'LCD.Text(1, 0, 100, 1, "res="+result[0]+","+result[1]+","+result[2]+","+result[3]+","+result[4]) rSpeed = result[0] If result[0] = 0 Then 'LCD.Text(1,0,100,1,"Set Servo "+pServoID+" Speed: "+pSpeed) ok = 1 Else attempts = attempts + 1 EndIf EndWhile EndSub Sub GetServoBattery cmd = Vector.Init(1,0) cmd[0] = NXTServo_VBATT result = Sensor.CommunicateI2C(NXTServo_PORT, NXTServo_ADDRESS, 1, 1, cmd) 'LCD.Text(1, 0, 100, 1, "res="+result[0]+","+result[1]+","+result[2]+","+result[3]+","+result[4]) rBattery = result[0]*37 EndSub Sub FloatServos i = 1 While i<6 pPos = 0 pServoID = i SetServoPosition() i = i + 1 EndWhile EndSub Sub SetStatusLights pServoID = pLightID If pLightStatus >0 Then pPos = 2500 Else pPos = 0 EndIf SetServoPosition() EndSub Sub NoLights pLightStatus = 0 pLightID = RED_LIGHT_ID SetStatusLights() pLightID = YELLOW_LIGHT_ID SetStatusLights() pLightID = GREEN_LIGHT_ID SetStatusLights() EndSub Sub RedLight NoLights() pLightID = RED_LIGHT_ID pLightStatus = 1 EV3.SetLEDColor("RED","NORMAL") SetStatusLights() EndSub Sub YellowLight NoLights() pLightID = YELLOW_LIGHT_ID pLightStatus = 1 EV3.SetLEDColor("ORANGE","NORMAL") SetStatusLights() EndSub Sub GreenLight NoLights() pLightID = GREEN_LIGHT_ID pLightStatus = 1 EV3.SetLEDColor("GREEN","PULSE") SetStatusLights() EndSub Sub PowerOnServo Motor.StartPower(NXTServo_POWER_PORT,80) EndSub Sub PowerOffServo Motor.Stop(NXTServo_POWER_PORT,"False") EndSub ' ============================================================================ ' ============================ MOTOR MANAGEMENT ============================= ' ============================================================================ pPort1 = "" pAng1 = 0 pSpeed1 = 75 pAccPercent1 = 0 pBrake1 = "True" pWait1 = "True" Sub MoveAbs1 _ang1 = pAng1 - Motor.GetCount(pPort1) _acc1 = Math.Round(Math.Abs(_ang1)*pAccPercent1/200) _sgn = 1 _speed1 = pSpeed1 If (_ang1 < 0) Then _sgn = -1 EndIf _ang1 = _ang1 - 2*_acc1*_sgn _speed1 = pSpeed1 * _sgn Motor.Schedule(pPort1, _speed1, _acc1, _ang1, _acc1, pBrake1) While ( pWait1 AND Motor.IsBusy(pPort1) ) Program.Delay(10) EndWhile EndSub ' ============================================================================ ' ======================= CAR CONFIGURATION USER INTERFACE ===================== ' ============================================================================ KEY_FRONT_RED = 1 KEY_FRONT_WHITE = 4 KEY_FRONT_BLUE = 7 KEY_ROOF_RED = 2 KEY_ROOF_WHITE = 5 KEY_ROOF_BLUE = 8 KEY_ROOF_NONE = 0 KEY_BACK_RED = 3 KEY_BACK_WHITE = 6 KEY_BACK_BLUE = 9 KEY_ENTER = 11 KEY_CANCEL = 10 COLOR_NONE = 0 COLOR_RED = 1 COLOR_WHITE = 2 COLOR_BLUE = 3 MEDIA_PATH = "Factory/" 'COLOR_ARRAY = "0=0;1=1;2=1;3=1;4=2;5=2;6=2;7=3;8=3;9=3;10=0;11=0" COLOR_ARRAY[0] = 0 COLOR_ARRAY[1] = 1 COLOR_ARRAY[2] = 1 COLOR_ARRAY[3] = 1 COLOR_ARRAY[4] = 2 COLOR_ARRAY[5] = 2 COLOR_ARRAY[6] = 2 COLOR_ARRAY[7] = 3 COLOR_ARRAY[8] = 3 COLOR_ARRAY[9] = 3 COLOR_ARRAY[10] = 0 COLOR_ARRAY[11] = 0 'COLOR_NAMES = "0=None;1=Red;2=White;3=Blue" COLOR_NAMES[0] = "None" COLOR_NAMES[1] = "Red" COLOR_NAMES[2] = "White" COLOR_NAMES[3] = "Blue" 'PARTS_SOUND_FILES = "0=NoneRoof;1=RedFront;2=RedRoof;3=RedBack;4=WhiteFront;5=WhiteRoof;6=WhiteBack;7=BlueFront;8=BlueRoof;9=BlueBack;10=;11=" PARTS_SOUND_FILES[0] = COLOR_NAMES[0]+"Roof" PARTS_SOUND_FILES[1] = COLOR_NAMES[1]+"Front" PARTS_SOUND_FILES[2] = COLOR_NAMES[1]+"Roof" PARTS_SOUND_FILES[3] = COLOR_NAMES[1]+"Back" PARTS_SOUND_FILES[4] = COLOR_NAMES[2]+"Front" PARTS_SOUND_FILES[5] = COLOR_NAMES[2]+"Roof" PARTS_SOUND_FILES[6] = COLOR_NAMES[2]+"Back" PARTS_SOUND_FILES[7] = COLOR_NAMES[3]+"Front" PARTS_SOUND_FILES[8] = COLOR_NAMES[3]+"Roof" PARTS_SOUND_FILES[9] = COLOR_NAMES[3]+"Back" PARTS_SOUND_FILES[10] = "" PARTS_SOUND_FILES[11] = "" Sub ParseKeys If (rPressedKeys = 1) Then ' filter out multiple keys pressed together by mistake i = 0 _sk = "" While i<12 If (rKeys[i]>0) Then _fileName = PARTS_SOUND_FILES[i] Speaker.Play(100,(MEDIA_PATH + _fileName)) _sk = Text.Append(_sk, " ") _sk = Text.Append(_sk, _fileName) If Text.IsSubText(_fileName,"Front") Then pCarFront = COLOR_ARRAY[i] ElseIf Text.IsSubText(_fileName,"Back") Then pCarBack = COLOR_ARRAY[i] ElseIf Text.IsSubText(_fileName,"Roof") Then pCarRoof = COLOR_ARRAY[i] EndIf EndIf i = i + 1 EndWhile ShowCarConfiguration() EndIf EndSub Sub ShowCarConfiguration LCD.Clear() LCD.BmpFile(1,0,0,MEDIA_PATH + "CarSide") LCD.Text(1,100,7,1,COLOR_NAMES[pCarRoof]) LCD.Text(1,45,72,2,COLOR_NAMES[pCarFront]) LCD.Text(1,130,75,1,COLOR_NAMES[pCarBack]) EndSub Sub TellCarConfiguration Speaker.Play(100,MEDIA_PATH + COLOR_NAMES[pCarFront] + "Front") Speaker.Wait() Speaker.Play(100,MEDIA_PATH + COLOR_NAMES[pCarBack] + "Back") Speaker.Wait() Speaker.Play(100,MEDIA_PATH + COLOR_NAMES[pCarRoof] + "Roof") Speaker.Wait() EndSub pCarFront = COLOR_NONE pCarRoof = COLOR_NONE pCarBack = COLOR_NONE Sub WaitKeyPadRelease ReadKeyPad() While (rPressedKeys>0) ' wait for key release ReadKeyPad() EndWhile EndSub rColorChosen = "False" Sub ChooseColors ShowCarConfiguration() rColorChosen = "False" ReadKeyPad() ParseKeys() If (rPressedKeys = 1 AND rKeys[KEY_ENTER]>0) Then WaitKeyPadRelease() If (pCarFront <> COLOR_NONE And pCarBack <> COLOR_NONE) Then ' show configuration and ask for confirmation Speaker.Tone(100,300,50) Program.Delay(60) Speaker.Tone(100,600,50) '_confirm = 0 pPopUpStr = "OK?" pPopUpFont = 2 ShowPopUpMessage() While (rKeys[KEY_ENTER]=0 AND rKeys[KEY_CANCEL] = 0 ) ' wait for user to press ENTER OR CANCEL ReadKeyPad() EndWhile If (rPressedKeys = 1 AND rKeys[KEY_ENTER]>0) Then ' user accepted configuration, show it and proceed '_ok = 1 rColorChosen = "True" Else ' user cancelled to continue editing Speaker.Tone(100,600,50) Program.Delay(60) Speaker.Tone(100,300,50) ShowCarConfiguration() EndIf Else ' car configuration is not complete LCD.FillRect(1,0,30,178,50) LCD.Text(0,40,35,2,"Setup") LCD.Text(0,5,55,2,"incomplete") 'RedLight() Speaker.Play(100,MEDIA_PATH + "Error alarm") 'Program.Delay(2000) ShowCarConfiguration() 'YellowLight() EndIf EndIf WaitKeyPadRelease() EndSub ' ============================================================================ ' ============================ SERVO SEQUENCES ================================ ' ============================================================================ ' The sequences are saved as unidimensional arrays but are actually two-dimensional arrays; ' each frame of a sequence is made by [duration, pos1, pos2, pos3, pos4], its size being FS = 5 ' In a N-frame sequence seq, access the elements of frame F (o...N-1) with ' duration = seq[F*FS+0] ' pos1 = seq[F*FS+1] ' pos2 = seq[F*FS+2] ' pos3 = seq[F*FS+3] ' pos4 = seq[F*FS+4] CLAW_OPEN = 1000 CLAW_CLOSED = 1600 BASE_PICK = 1820 BASE_DROP = 920 ' 0 rest seqChassis1[0] = 300 seqChassis1[1] = BASE_PICK seqChassis1[2] = 1540 seqChassis1[3] = 1900 seqChassis1[4] = CLAW_OPEN ' 1 presupply seqChassis1[5] = 400 seqChassis1[6] = BASE_PICK seqChassis1[7] = 1160 seqChassis1[8] = 2190 seqChassis1[9] = CLAW_OPEN ' 2 supply seqChassis1[10] = 500 seqChassis1[11] = 1610 seqChassis1[12] = 1160 seqChassis1[13] = 2190 seqChassis1[14] = CLAW_OPEN ' 3 post supply seqChassis1[15] = 200 seqChassis1[16] = BASE_PICK seqChassis1[17] = 1160 seqChassis1[18] = 2190 seqChassis1[19] = CLAW_OPEN ' 4 prepick 1 seqChassis1[20] = 300 seqChassis1[21] = BASE_PICK seqChassis1[22] = 1040 seqChassis1[23] = 2280 seqChassis1[24] = CLAW_OPEN ' 5 prepick 2 seqChassis1[25] = 300 seqChassis1[26] = BASE_PICK seqChassis1[27] = 980 seqChassis1[28] = 2320 seqChassis1[29] = CLAW_OPEN ' 6 grab seqChassis1[30] = 500 seqChassis1[31] = BASE_PICK seqChassis1[32] = 980 seqChassis1[33] = 2320 seqChassis1[34] = CLAW_CLOSED ' 7 lift1 seqChassis1[35] = 200 seqChassis1[36] = BASE_PICK-10 seqChassis1[37] = 1070 seqChassis1[38] = 2230 seqChassis1[39] = CLAW_CLOSED ' lift2 seqChassis1[40] = 300 seqChassis1[41] = 1780 seqChassis1[42] = 1390 seqChassis1[43] = 1890 seqChassis1[44] = CLAW_CLOSED ' rotate seqChassis1[45] = 900 seqChassis1[46] = 930 seqChassis1[47] = 1390 seqChassis1[48] = 1890 seqChassis1[49] = CLAW_CLOSED ' predrop1 seqChassis1[50] = 300 ' seqChassis1[51] = BASE_DROP seqChassis1[52] = 1020 seqChassis1[53] = 2180 seqChassis1[54] = CLAW_CLOSED ' predrop2 seqChassis1[55] = 300 seqChassis1[56] = BASE_DROP seqChassis1[57] = 1000 seqChassis1[58] = 2210 seqChassis1[59] = CLAW_CLOSED ' release seqChassis1[60] = 400 seqChassis1[61] = BASE_DROP seqChassis1[62] = 1020 seqChassis1[63] = 2210 seqChassis1[64] = CLAW_OPEN ' up seqChassis1[65] = 400 seqChassis1[66] = BASE_DROP seqChassis1[67] = 1260 seqChassis1[68] = 2210 seqChassis1[69] = CLAW_OPEN seqChassis1Len = 14 ' 5 elements each frame ' 0 rest seqChassis2[0] = 300 seqChassis2[1] = BASE_PICK seqChassis2[2] = 1540 seqChassis2[3] = 1900 seqChassis2[4] = CLAW_OPEN ' 1 presupply seqChassis2[5] = 600 seqChassis2[6] = BASE_PICK seqChassis2[7] = 1060 seqChassis2[8] = 1880 seqChassis2[9] = CLAW_OPEN ' 2 supply seqChassis2[10] = 500 seqChassis2[11] = 1600 seqChassis2[12] = 1060 seqChassis2[13] = 1860'1880 seqChassis2[14] = CLAW_OPEN ' 3 post supply seqChassis2[15] = 300 '400 seqChassis2[16] = BASE_PICK seqChassis2[17] = 1060 seqChassis2[18] = 1880 seqChassis2[19] = CLAW_OPEN ' 4 prepick1 seqChassis2[20] = 200 seqChassis2[21] = BASE_PICK seqChassis2[22] = 990 seqChassis2[23] = 1900 seqChassis2[24] = CLAW_OPEN ' 5 prepick2 seqChassis2[25] = 300 seqChassis2[26] = BASE_PICK seqChassis2[27] = 930 '940 seqChassis2[28] = 1940'1930 seqChassis2[29] = CLAW_OPEN ' 6 grab seqChassis2[30] = 500 seqChassis2[31] = BASE_PICK seqChassis2[32] = 930 '940 seqChassis2[33] = 1940'1930 seqChassis2[34] = CLAW_CLOSED ' 7 lift1 seqChassis2[35] = 200 seqChassis2[36] = BASE_PICK-40 seqChassis2[37] = 1020 seqChassis2[38] = 1880 seqChassis2[39] = CLAW_CLOSED ' 8 lift2 seqChassis2[40] = 300 '400 seqChassis2[41] = BASE_PICK-40 seqChassis2[42] = 1440 seqChassis2[43] = 1890 seqChassis2[44] = CLAW_CLOSED ' 9 rotate seqChassis2[45] = 900 '1000 seqChassis2[46] = BASE_DROP seqChassis2[47] = 1440 seqChassis2[48] = 1890 seqChassis2[49] = CLAW_CLOSED ' 10 predrop1 seqChassis2[50] = 400 seqChassis2[51] = BASE_DROP seqChassis2[52] = 1050 seqChassis2[53] = 2160 seqChassis2[54] = CLAW_CLOSED ' 11 predrop2 seqChassis2[55] = 300 seqChassis2[56] = BASE_DROP seqChassis2[57] = 990 seqChassis2[58] = 2180 seqChassis2[59] = CLAW_CLOSED ' 12 release seqChassis2[60] = 400 seqChassis2[61] = BASE_DROP seqChassis2[62] = 1000 seqChassis2[63] = 2210 seqChassis2[64] = CLAW_OPEN ' 13 up seqChassis2[65] = 400 seqChassis2[66] = BASE_DROP seqChassis2[67] = 1260 seqChassis2[68] = 2210 seqChassis2[69] = CLAW_OPEN seqChassis2Len = 14 ' 5 elements each frame seqInit = seqChassis1 seqInitLen = seqChassis1Len ' playvback debug variables stepByStep = 0 resetBelt = 0 pauseAtFrame = 0 ' ============================================================================ ' ============================ SERVO PLAYBACK ================================= ' ============================================================================ ' debug STOP_BUTTON_PORT = 4 BASE_SPEED = 30 JOINT1_SPEED = 30 JOINT2_SPEED = 36 CLAW_SPEED = 50 FRAME_SIZE = 5 BASE_ID = 1 JOINT1_ID = 2 JOINT2_ID = 3 CLAW_ID = 4 NXTServoID[0] = BASE_ID NXTServoID[1] = JOINT1_ID NXTServoID[2] = JOINT2_ID NXTServoID[3] = CLAW_ID stopPressed = "False" pSequenceToPlay = seqChassis1 seqLen = 0 pSequenceLength = 0 pFrameToPlay = 0 pWaitFrameCompletion = "False" pFrameToEdit = 0 'tweaksFile = Program.Directory+"\_tweaks-"+Clock.Month+"-"+Clock.Day+"-"+Clock.Hour+Clock.Minute+Clock.Second+".txt" tweaksFile = "" tweaks = "" tweakingSeqName = "" Sub ManualEdit ' Wait for ENTER to continue, manually move the arm using KEYS j1p = pSequenceToPlay[pFrameToEdit*FRAME_SIZE+JOINT1_ID] j2p = pSequenceToPlay[pFrameToEdit*FRAME_SIZE+JOINT2_ID] inc = 10 LCD.Clear() LCD.Text(1, 0, 5, 1, "Frame:"+pFrameToEdit+"/"+pSequenceLength+" ") _s1c = "False" _s2c = "False" _done = "False" While _done = "False" K = Buttons.Current If Text.IsSubText(K, "R") then Speaker.Tone(50,1000,10) _s2c = "True" j2p = j2p - inc pServoID = JOINT2_ID pPos = j2p SetServoPosition() elseif Text.IsSubText(K, "L") then _s2c = "True" Speaker.Tone(50,1000,10) j2p = j2p + inc pServoID = JOINT2_ID pPos = j2p SetServoPosition() elseif Text.IsSubText(K, "D") then _s1c = "True" Speaker.Tone(50,1000,10) j1p = j1p - inc pServoID = JOINT1_ID pPos = j1p SetServoPosition() elseif Text.IsSubText(K, "U") then _s1c = "True" Speaker.Tone(50,1000,10) j1p = j1p + inc pServoID = JOINT1_ID pPos = j1p SetServoPosition() elseIf Text.IsSubText(Buttons.Current, "E") Then _done = "True" EndIf If Sensor.ReadPercent(STOP_BUTTON_PORT)>50 Then stepByStep = 0 _done = "True" Speaker.Tone(100,1000,50) LCD.Text(1, 0, 60, 1, "continuous execution ") While Sensor.ReadPercent(STOP_BUTTON_PORT)>50 Program.Delay(100) EndWhile EndIf LCD.Text(1, 0, 20+15*pServoID, 0, "S"+pServoID+": "+pPos+" ") Program.Delay(100) EndWhile '===================================== TWEAKS 'If _s1c Then ' _tmp = tweakingSeqName + "["+(pFrameToEdit*FRAME_SIZE+JOINT1_ID)+"] = "+j1p'+Text.GetCharacter(13)+Text.GetCharacter(10) ' The following line could be harmful and has been automatically commented. ' ' _r = File.AppendContents(tweaksFile,_tmp) ' If _r="FAILED" Then ' 'TextWindow.WriteLine("Append to file failed!") ' EndIf 'EndIf 'If _s2c Then ' _tmp = tweakingSeqName + "["+(pFrameToEdit*FRAME_SIZE+JOINT2_ID)+"] = "+j2p'+Text.GetCharacter(13)+Text.GetCharacter(10) ' The following line could be harmful and has been automatically commented. ' ' _r = File.AppendContents(tweaksFile,_tmp) ' If _r="FAILED" Then ' 'TextWindow.WriteLine("Append to file failed!") ' EndIf 'EndIf 'Speaker.Tone(100,3000,100) '===================================== TWEAKS EndSub Sub ExecuteFrame 'LCD.Text(1, 0, 5, 1, "Frame:"+pFrameToPlay+"/"+pSequenceLength+" ") For i = 0 to 3 pServoID = NXTServoID[i] pPos = pSequenceToPlay[pFrameToPlay*FRAME_SIZE+i+1] LCD.Text(1, 0, 20+15*i, 0, "S"+(i+1)+": "+pPos+" ") SetServoPosition() EndFor If pWaitFrameCompletion Then Program.Delay(pSequenceToPlay[pFrameToPlay*FRAME_SIZE]) EndIf EndSub Sub InitServos FloatServos() RedLight() Program.Delay(200) pServoID = BASE_ID pSpeed = BASE_SPEED SetServoSpeed() pServoID = JOINT1_ID pSpeed = JOINT1_SPEED SetServoSpeed() pServoID = JOINT2_ID pSpeed = JOINT2_SPEED SetServoSpeed() pServoID = CLAW_ID pSpeed = CLAW_SPEED SetServoSpeed() Program.Delay(200) PowerOnServo() pFrameToPlay = 0 pSequenceToPlay = seqInit pWaitFrameCompletion = "False" ExecuteFrame() EndSub rSequenceCompleted = "False" 'PARAMETERS: pSequenceToPlay, pSequenceLength Sub ExecuteSequence tweaksFile = Program.Directory+"\_tweaks"+EV3.Time+".txt" pWaitFrameCompletion = "True" rSequenceCompleted = "False" f = 0 stopReq = "False" While f50 Then ' tweaksFile = Program.Directory+"\_tweaks "+EV3.Time+".txt" ' stepByStep = 1 ' Speaker.Tone(100,2000,50) ' LCD.Text(1, 0, 60, 1, "step by step execution ") ' While Sensor.ReadPercent(STOP_BUTTON_PORT)>50 ' Program.Delay(100) ' EndWhile 'EndIf 'If pauseAtFrame<>0 And pFrameToPlay>=pauseAtFrame Then ' stepByStep = 1 'EndIf 'if (stepByStep>0) Then ' YellowLight() ' pFrameToEdit = f ' ManualEdit() ' Buttons.Flush() ' GreenLight() 'EndIf ' ============================================ END TWEAK SEQUENCE stopReq = stopPressed ' user interrupt f = f + 1 EndWhile If f = pSequenceLength Then ' go back to zero pFrameToPlay = 0 pWaitFrameCompletion = "False" ExecuteFrame() rSequenceCompleted = "True" 'TextWindow.WriteLine(" sequence completed!") EndIf EndSub ' ============================================================================ ' ============================= COMMUNICATION ============================== ' ============================================================================ ' ------------------------------------------------ MASTER COMMANDS ----------------------------------------- CMD_PREPARE_CONVEYOR = "PC" ' move conveyor to the very beginning to receive car CMD_LOAD_CAR = "LC" ' move conveyor fordward to load car CMD_ASSEMBLE = "CX" ' pick and place, check, press CMD_DELIVER = "DL" ' deliver car to next module CMD_RESET = "RS" CMD_STOP = "ST" CMD_GET_STATUS = "GS" ' this requires a special ack from slave CMD_GET_RACKS = "RK" ' the reply is in the format "RK=" each field being "1" if ok or "0" if rack is empty CMD_PING = "PG" CMD_CANCEL = "KK" ' cancel order CMD_ASSEMBLE_COLOR[0] = "N" ' None (valid only for roof) CMD_ASSEMBLE_COLOR[1] = "R" 'Red CMD_ASSEMBLE_COLOR[2] = "W" 'White CMD_ASSEMBLE_COLOR[3] = "B" ' Blue ' ------------------------------------------------ SLAVE REPLIES ----------------------------------------------- RESULT_UNKNOWN = -2 RESULT_TIMEOUT = -1 RESULT_OK = 0 ' ack when command is received RESULT_READY = 1 ' status when module is ready to execute commands RESULT_BUSY = 2 ' status when module is busy RESULT_STOP = 3 ' status when module is stopped RESULT_ERROR = 4 ' status if part was misplaced RESULT_EMPTY = 5 ' status if selected color rack is empty RESULT_NN = 6 ' number of possible results REPLY_DATA[RESULT_OK] = "OK" REPLY_DATA[RESULT_READY] = "READY" REPLY_DATA[RESULT_STOP] = "STOP" REPLY_DATA[RESULT_BUSY] = "BUSY" REPLY_DATA[RESULT_ERROR] = "ERR" REPLY_DATA[RESULT_EMPTY] = "EMPTY" ' ------------------------------------------------------------------------------------------------------------------------- MODULE_FRONT = 0 MODULE_BACK = 1 MODULE_ROOF = 2 MODULE_CHASSIS = 3 SLAVE_INBOX_NAME = "inbox" MASTER_INBOX[MODULE_FRONT] = "replyFront" MASTER_INBOX[MODULE_BACK] = "replyBack" MASTER_INBOX[MODULE_ROOF] = "replyRoof" replyInboxID = Vector.Init(3,0) useModule[MODULE_FRONT] = "True" useModule[MODULE_BACK] = "True" useModule[MODULE_ROOF] = "True" rBrickName = "" autoSlaveID = 0 slaveInboxID = 0 COMM_TIMEOUT = 500 'ms ' ------------------------------------------------ SLAVE BRICK NAMES --------------------------------------------- ' these must be indentical to actual brick names MASTER_BRICK_NAME = "CEA_master" BRICK_NAME[MODULE_FRONT] = "CEA_front" BRICK_NAME[MODULE_BACK] = "CEA_back" BRICK_NAME[MODULE_ROOF] = "CEA_roof" BRICK_NAME[MODULE_CHASSIS] = MASTER_BRICK_NAME ' -------------------------------------------------------------------------------------------------------------------------- Sub GetBrickName ' The following line could be harmful and has been automatically commented. ' fid = EV3File.OpenRead("/home/root/lms2012/sys/settings/BrickName") ' EV3 filesystem tree ' The following line could be harmful and has been automatically commented. ' rBrickName = EV3File.ReadLine(fid) autoSlaveID = -1 For i = 0 To 2 If Text.IsSubText(rBrickName,BRICK_NAME[i]) Then autoSlaveID = i EndIf EndFor EndSub ' ------------------------------------------------- MASTER ------------------------------------------------- ' NOTE: slaves should be already connected to master before starting the program Sub InitMasterCommunication GetBrickName() For i = 0 To 2 If (useModule[i]) Then Mailbox.Connect(BRICK_NAME[i]) EndIf replyInboxID[i] = Mailbox.Create(MASTER_INBOX[i]) EndFor EndSub pSlaveID = 0 pRemoteCommand = "" pWaitReply = "True" rResult = RESULT_OK rInData = "" Sub ParseReply rResult = RESULT_UNKNOWN For i = 0 To RESULT_NN If rInData = REPLY_DATA[i] Then rResult = i EndIf EndFor EndSub Sub WaitReply _start = EV3.Time _reply = "False" rInData = "" rResult = RESULT_TIMEOUT LCD.Text(1,0,70,1,"wait reply ") While (EV3.Time - _start) MODULE_CHASSIS Then ' remote module Mailbox.Send(BRICK_NAME[pSlaveID], SLAVE_INBOX_NAME, CMD_GET_RACKS) WaitReply() ParseRackStatus() Else ' local racks have no color rSlaveRackOK[0] = 1 rSlaveRackOK[1] = 1 rSlaveRackOK[2] = 1 EndIf EndSub Sub GetAllSlavesRackInfo pSlaveID = MODULE_FRONT GetRackStatus() If (rRackParseResult>0) Then rackFrontOK = rSlaveRackOK EndIf pSlaveID = MODULE_BACK GetRackStatus() If (rRackParseResult>0) Then rackBackOK = rSlaveRackOK EndIf pSlaveID = MODULE_ROOF GetRackStatus() If (rRackParseResult>0) Then rackRoofOK = rSlaveRackOK EndIf EndSub Sub WaitNextModule _wait = "True" While _wait GetSlaveStatus() If rResult <> RESULT_BUSY Then _wait = "False" EndIf EndWhile EndSub ' ============================================================================ ' ============================ MAIN PROGRAM ================================== ' ============================================================================ ' ----------------------------------------------- STATE MACHINE CONSTANTS -------------------------------------------- S_MISPLACED = -3 S_EMPTY_RACKS = -2 S_COMM_ERR = -1 S_IDLE = 0 S_INIT = 1 S_INPUT = 2 S_STOP = 3 S_PICKPLACE = 4 S_PREPARE_CONV = 5 S_DELIVER_CAR = 6 S_LOAD_CAR = 7 ' --------------------------------------------------------- INPUT/OUTPUT----------------------------------------------------- KEYPAD_PORT = 1 MUX_PORT = 2 SERVO_PORT = 3 STOP_BUTTON_PORT = 4 SERVO_POWER_PORT = "B" CONVEYOR = "C" MUX_PRESENCE_CHASSIS1 = MUX_SENSOR3 MUX_PRESENCE_CHASSIS2 = MUX_SENSOR2 MUX_PRESENCE_PLACED = MUX_SENSOR1 ' ----------------------------------------------- POSITIONING PARAMETERS ----------------------------------------------- CONVEYOR_OFFSET = 22'22 CONVEYOR_WAIT_CHASSIS = -515 + CONVEYOR_OFFSET CONVEYOR_DELIVER_CAR = -1500 + CONVEYOR_OFFSET CONVEYOR_SCAN_LIMIT = -1050 + CONVEYOR_OFFSET CONVEYOR_WAIT_CAR = -230 + CONVEYOR_OFFSET ' ----------------------------------------------------------- VARIABLES --------------------------------------------------------- moduleSequence[0] = MODULE_CHASSIS moduleSequence[1] = MODULE_FRONT moduleSequence[2] = MODULE_BACK moduleSequence[3] = MODULE_ROOF lastModule = 3 status = S_INIT lastStatus = S_INIT statusBeforeError = S_INIT LCD_LINE_STATUS = 20 LCD_LINE_DEBUG = 80 ' --------------------------------------------------------- SUB ROUTINES ------------------------------------------------------ Sub WaitEnterBump While Text.IsSubText(Buttons.Current, "E") = "True" Program.Delay(10) EndWhile While Text.IsSubText(Buttons.Current, "E") = "False" Program.Delay(10) EndWhile EndSub Sub PlayAlarm Speaker.Play(100,MEDIA_PATH + "Error alarm") EndSub rChassisCheck = 0 Sub CheckChassisPlacement pPort1 = CONVEYOR pAng1 = CONVEYOR_SCAN_LIMIT pWait1 = "False" pSpeed1 = 30 pAccPercent1 = 10 if stopPressed = "False" Then Motor.Move(pPort1, pSpeed1, 60, "True") MoveAbs1() ' return at once EndIf rChassisCheck = 0 wheelN = 0 While rChassisCheck = 0 If (Math.Abs(Motor.GetCount(CONVEYOR)) >= Math.Abs(CONVEYOR_SCAN_LIMIT)) Then ' conveyor moved the part all the way through the sensor but no part was detected Motor.Stop(CONVEYOR,"True") rChassisCheck = -1 EndIf ' wait for white - black- white sequence pSensorID = MUX_PRESENCE_PLACED ReadMuxColorSensor() 'TextWindow.WriteLine("check: "+ rMuxData) LCD.Text(1,0,LCD_LINE_DEBUG,1,"check:" + rMuxData+" ") If wheelN = 0 AND (rMuxData = COLOR_WHITE_CODE) Then ' first white wheel rim detected Speaker.Tone(100, 2000, 100) wheelN = 1 Elseif wheelN = 1 AND (rMuxData < COLOR_BLUE_CODE) Then ' wait dark chassis wheelN = 2 Speaker.Tone(100, 1500, 100) Elseif wheelN = 2 AND (rMuxData = COLOR_WHITE_CODE) Then ' second white wheel rim detected Motor.Stop(CONVEYOR,"True") Speaker.Tone(100, 2500, 100) rChassisCheck = 1 EndIf If stopPressed Then rChassisCheck = -2 EndIf EndWhile Motor.Stop(CONVEYOR,"True") 'If rChassisCheck = -1 Then ' pPort1 = CONVEYOR ' pAng1 = CONVEYOR_WAIT_CHASSIS ' pWait1 = "True" ' pSpeed1 = 50 ' pAccPercent1 = 30 ' YellowLight() ' PlayAlarm() ' MoveAbs1() 'EndIf EndSub rCommOK = "True" rOfflineBrickNames = "" Sub CheckComm ' check if slave is connected and program is running rCommOK = "True" For s = 0 To 2 If useModule[s] Then ' don't check comm with modules that are not used pSlaveID = s Ping() If rPing = "False" Then rCommOK = "False" rOfflineBrickNames = rOfflineBrickNames + BRICK_NAME[s] + " " 's = 3 ' works like break EndIf EndIf EndFor EndSub Sub ResetMovingParts NXTServo_PORT = SERVO_PORT NXTServo_POWER_PORT = SERVO_POWER_PORT InitServos() 'If Sensor.ReadPercent(STOP_BUTTON_PORT)<50 Then ' skippable with STOP button for DEBUG ' Reset the conveyors to the zero position pResetConvMotorID1 = CONVEYOR 'Thread.Run = ResetConveyor1 ResetConveyor1() ' conveyor motor parameters pPort1 = CONVEYOR pAng1 = CONVEYOR_WAIT_CHASSIS pAccPercent1 = 30 pWait1 = "False" pBrake1= "True" pSpeed1 = 50 MoveAbs1() 'EndIf EndSub Sub Initialize LCD.Clear() ' COMMUNICATION IS CRUCIAL InitMasterCommunication() CheckComm() If rCommOK = "False" Then ' try again LCD.Text(1,0,LCD_LINE_STATUS+20,1,"trying again in 3s ") Program.Delay(3000) CheckComm() 'LCD.Text(1,5,45,1," ") EndIf 'rCommOK = "True" ' uncomment to skip comm check If rCommOK = "False" Then PlayAlarm() LCD.Text(1,5,LCD_LINE_STATUS,2,"COMM ERROR! ") LCD.Text(1,5,LCD_LINE_STATUS+20,1,rOfflineBrickNames) EV3.SetLEDColor("RED","NORMAL") Program.Delay(2000) Program.End() EndIf pMuxPort = MUX_PORT InitMuxAllColor() pKeyPadPort = KEYPAD_PORT InitKeyPad() EndSub rEmptyRacks = "False" Sub PickAndPlace rEmptyRacks = "False" ' pick and place chassis from ramp1 pSensorID = MUX_PRESENCE_CHASSIS1 ReadMuxColorSensor() If (rMuxData>0) Then ' there's a chassis in ramp 1 pSequenceToPlay = seqChassis1 pSequenceLength = seqChassis1Len tweakingSeqName = "seqChassis1" ExecuteSequence() Else pSensorID = MUX_PRESENCE_CHASSIS2 ReadMuxColorSensor() If (rMuxData>0) Then ' there's a chassis in ramp 2 pSequenceToPlay = seqChassis2 pSequenceLength = seqChassis2Len tweakingSeqName = "seqChassis2" ExecuteSequence() Else rEmptyRacks = "True" EndIf EndIf EndSub Sub DeliverCar pPort1 = CONVEYOR pAng1 = CONVEYOR_DELIVER_CAR pAccPercent1 = 30 pWait1 = "True" pSpeed1 = 50 If stopPressed = "False" Then MoveAbs1() Thread.Run = RewindConveyor EndIf EndSub Sub RewindConveyor Program.Delay(1500) pPort1 = CONVEYOR pAng1 = CONVEYOR_WAIT_CHASSIS pAccPercent1 = 30 pBrake1= "True" pWait1 = "False" pSpeed1 = 90 If stopPressed = "False" Then MoveAbs1() EndIf EndSub Sub LoadCar pPort1 = CONVEYOR pAng1 = CONVEYOR_WAIT_CHASSIS pAccPercent1 = 30 pBrake1= "True" pSpeed1 = 50 MoveAbs1() EndSub pCmd = "" pCmdColor = COLOR_NONE rCmdResult = RESULT_OK pModuleID = MODULE_CHASSIS Sub ManageCommandResult If rCmdResult = RESULT_EMPTY Then ' a rack was empty statusBeforeError = status lastStatus = status status = S_EMPTY_RACKS ElseIf rCmdResult = RESULT_ERROR Then ' part was placed bad or color check failed statusBeforeError = status lastStatus = status status = S_MISPLACED 'TextWindow.WriteLine("ManageCommandResult set status = S_MISPLACED") ElseIf rCmdResult = RESULT_TIMEOUT Then ' comm error statusBeforeError = status lastStatus = status status = S_COMM_ERR ElseIf rCmdResult = RESULT_STOP Then statusBeforeError = status lastStatus = status 'TextWindow.WriteLine("switch to STOP; last status = "+lastStatus) status = S_STOP ElseIf rCmdResult = RESULT_OK Then ' all went good ' do not change status EndIf 'TextWindow.WriteLine("ManageCommandResult: "+REPLY_DATA[rCmdResult]) EndSub ' this represents an abstraction layer so that slave and master can share the same API. ' this sub should wait for module to be ready, and then wait for command completion Sub ExecuteCommand If pModuleID <> MODULE_CHASSIS Then 'remote modules pSlaveID = pModuleID WaitNextModule() pRemoteCommand = pCmd SendCommand() Program.Delay(100) WaitNextModule() rCmdResult = rResult Else ' local (master) module If Text.IsSubText(pCmd, CMD_PREPARE_CONVEYOR) Then ' nothing to do rCmdResult = RESULT_READY ElseIf Text.IsSubText(pCmd, CMD_LOAD_CAR) Then pWait1 = "True" LoadCar() rCmdResult = RESULT_READY ElseIf Text.IsSubText(pCmd, CMD_DELIVER) Then DeliverCar() ElseIf Text.IsSubText(pCmd, CMD_ASSEMBLE) Then ' check parts, pick-and-place, check placement, assemble, return to zero PickAndPlace() If rEmptyRacks Then rCmdResult = RESULT_EMPTY ElseIf rSequenceCompleted Then CheckChassisPlacement() FloatServos() ' save battery If rChassisCheck > 0 Then rCmdResult = RESULT_READY ElseIf rChassisCheck = -1 Then pWait1 = "False" LoadCar() rCmdResult = RESULT_ERROR ElseIf rChassisCheck = -2 Then rCmdResult = RESULT_STOP EndIf Else ' user interrupted pick and place rCmdResult = RESULT_STOP EndIf EndIf ' pCmd switch If stopPressed Then rCmdResult = RESULT_STOP EndIf EndIf ' remote or local module EndSub Sub SetOrderFrontBack moduleSequence[1] = MODULE_FRONT moduleSequence[2] = MODULE_BACK EndSub Sub SetOrderBackFront moduleSequence[1] = MODULE_BACK moduleSequence[2] = MODULE_FRONT EndSub isBackFrontSet = "False" Sub ShowModuleSwappingMenu LCD.Clear() Speaker.Play(100,MEDIA_PATH + "Confirm") LCD.Text(1,0,10,2," Select") LCD.Text(1,0,30,2," order:") LCD.Text(1,0,80,1,"Back->Front ") LCD.Text(1,0,95,1," Front->Back ") While isBackFrontSet = "False" If Buttons.Current = "L" Then SetOrderBackFront() pPopUpStr = "Back>Front" pPopUpFont = 2 ShowPopUpMessage() isBackFrontSet = "True" ElseIf Buttons.Current ="R" Then SetOrderFrontBack() pPopUpStr = "Front>Back" pPopUpFont = 2 ShowPopUpMessage() isBackFrontSet = "True" EndIf EndWhile Program.Delay(1000) EndSub Sub ShowEmptyRackGUI PlayAlarm() YellowLight() LCD.Clear() _cet = "" If rSlaveRackOK[COLOR_RED-1] = 0 Then _cet = _cet + "RED " EndIf If rSlaveRackOK[COLOR_WHITE-1] = 0 Then _cet = _cet + "WHITE " EndIf If rSlaveRackOK[COLOR_BLUE-1] = 0 Then _cet = _cet + "BLUE " EndIf LCD.Text(1,0,LCD_LINE_STATUS,2,"EMPTY RACK! ") LCD.Text(1,0,LCD_LINE_STATUS+20,1,"( "+_cet+") ") LCD.Text(1,5,LCD_LINE_STATUS+35,1,"Refill & press Enter ") EndSub Sub ShowMisplacedPartGUI PlayAlarm() YellowLight() LCD.Clear() LCD.Text(1,5,10,2,"PLACEMENT ") LCD.Text(1,5,30,2,"ERROR! ") LCD.Text(1,5,50,1,"Press Enter ") LCD.Text(1,5,65,1,"when ready ") EndSub Sub ShowStopGUI PlayAlarm() RedLight() LCD.Clear() LCD.Text(1,5,LCD_LINE_STATUS,2,"STOPPED ") If pModuleID = MODULE_CHASSIS Then LCD.Text(1,5,LCD_LINE_STATUS+20,1,"Press Enter ") LCD.Text(1,5,LCD_LINE_STATUS+35,1,"when ready ") Else LCD.Text(1,5,LCD_LINE_STATUS+20,1,BRICK_NAME[pModuleID]) EndIf EndSub pPopUpStr = "" pPopUpFont = 1 Sub ShowPopUpMessage LCD_W = 178 LCD_H = 128 _fw = 8 _fh = 9 If pPopUpFont = 0 Or pPopUpFont = 1 Then _fw = 8 _fh = 9 _OS = 4 Else ' large font _fw = 16 _fh = 16 _OS = 6 EndIf strw = Text.GetLength(pPopUpStr)*_fw _xt = (LCD_W-strw)/2 _yt = (LCD_H-_fh)/2 _xf = (LCD_W-strw-_OS)/2 _yf = (LCD_H-_fh-_OS)/2 LCD.FillRect(1,_xf+_OS,_yf+_OS,strw+_OS,_fh+_OS) LCD.FillRect(0,_xf,_yf,strw+_OS,_fh+_OS) LCD.Rect(1,_xf,_yf,strw+_OS,_fh+_OS) LCD.Text(1,_xt,_yt,pPopUpFont,pPopUpStr) EndSub Sub ComputeOffsetForDifferentPusherSize While "True" pPort1 = CONVEYOR pAng1 = CONVEYOR_SCAN_LIMIT pWait1 = "False" pSpeed1 = 10 pAccPercent1 = 0 MoveAbs1() ' return at once found = "False" While found = "False" pSensorID = MUX_PRESENCE_PLACED ReadMuxColorSensor() if rMuxData = 7 Then Motor.Stop(CONVEYOR,"True") Motor.ResetCount(CONVEYOR) found = "True" EndIf EndWhile Program.Delay(500) pResetConvMotorID1 = CONVEYOR 'Thread.Run = ResetConveyor1 ResetConveyor1() Buttons.Wait() Buttons.Flush() EndWhile EndSub Sub StandAloneServoTest useModule[MODULE_FRONT] = "False" useModule[MODULE_BACK] = "False" useModule[MODULE_ROOF] = "False" Initialize() If Buttons.Current = "E" Then ResetMovingParts() Else NXTServo_PORT = SERVO_PORT NXTServo_POWER_PORT = SERVO_POWER_PORT InitServos() Motor.ResetCount(CONVEYOR) EndIf While "True" LCD.Clear() LCD.Text(1,0,100,2,"CH1 CH2") Buttons.Wait() If Buttons.Current = "L" Then 'LoadCar() pSequenceToPlay = seqChassis1 pSequenceLength = seqChassis1Len tweakingSeqName = "seqChassis1" EndIf If Buttons.Current = "R" Then 'LoadCar() pSequenceToPlay = seqChassis2 pSequenceLength = seqChassis2Len tweakingSeqName = "seqChassis2" EndIf ExecuteSequence() Buttons.Flush() EndWhile EndSub ' --------------------------------------------------------- STATE MACHINE --------------------------------------------------------- status = S_INIT lastStatus = S_INIT statusBeforeError = S_INIT stopPressed = "False" currentModule = 0 pCarColors = Vector.Init(4,COLOR_NONE) nbCar=10 'configure 10 cars 'COLOR_NAMES[0] = "None" 'COLOR_NAMES[1] = "Red" 'COLOR_NAMES[2] = "White" 'COLOR_NAMES[3] = "Blue" NONE = 0 RED = 1 WHITE = 2 BLUE = 3 ROOF[1]=WHITE ROOF[2]=BLUE ROOF[3]=BLUE ROOF[4]=BLUE ROOF[5]=WHITE ROOF[6]=RED ROOF[7]=RED ROOF[8]=WHITE ROOF[9]=RED ROOF[10]=BLUE BACK[1]=BLUE BACK[2]=WHITE BACK[3]=RED BACK[4]=RED BACK[5]=WHITE BACK[6]=BLUE BACK[7]=WHITE BACK[8]=WHITE BACK[9]=RED BACK[10]=WHITE FRONT[1]=RED FRONT[2]=RED FRONT[3]=WHITE FRONT[4]=BLUE FRONT[5]=RED FRONT[6]=RED FRONT[7]=BLUE FRONT[8]=WHITE FRONT[9]=RED FRONT[10]=BLUE CMD_ASSEMBLE_COLOR[0] = "N" ' None (valid only for roof) CMD_ASSEMBLE_COLOR[1] = "R" 'Red CMD_ASSEMBLE_COLOR[2] = "W" 'White CMD_ASSEMBLE_COLOR[3] = "B" ' Blue '=================================DEBUG 'StandAloneServoTest() '=================================DEBUG Initialize() ' this also checks communication, and stops the program if remote modules are not responding ShowModuleSwappingMenu() Thread.Run = CheckStopButton While "True" If nbCar=0 Then Program.End() ElseIf status = S_INIT Then LCD.Clear() LCD.Text(1,0,LCD_LINE_STATUS,2,"Init... ") ResetMovingParts() GreenLight() FloatServos() lastStatus = status status = S_INPUT ElseIf status = S_INPUT Then ' test routines or option menus can be activated from here If status <> lastStatus Then ' execute once FloatServos() YellowLight() lastStatus = status ' reset car configuration (comment to save last input) 'pCarFront = COLOR_NONE 'pCarRoof = COLOR_NONE 'pCarBack = COLOR_NONE EndIf rColorChosen = "True" pCarBack=BACK[nbCar] pCarFront=FRONT[nbCar] pCarRoof=ROOF[nbCar] nbCar=nbCar-1 'ChooseColors() If Buttons.Current = "L" Then 'Speaker.Play(100, MEDIA_PATH + "Click") Speaker.Tone(100,2000,100) moduleSequence[1] = MODULE_BACK moduleSequence[2] = MODULE_FRONT pPopUpStr = "Back>Front" pPopUpFont = 2 ShowPopUpMessage() Program.Delay(1000) ElseIf Buttons.Current ="R" Then 'Speaker.Play(100, MEDIA_PATH + "Click") Speaker.Tone(100,2500,100) moduleSequence[1] = MODULE_FRONT moduleSequence[2] = MODULE_BACK pPopUpStr = "Front>Back" pPopUpFont = 2 ShowPopUpMessage() Program.Delay(1000) EndIf Program.Delay(100) If rColorChosen Then status = S_PICKPLACE currentModule = 0 ' start building from first module (chassis) Speaker.Play(100, MEDIA_PATH + "Confirm") LCD.Clear() pCarColors[MODULE_FRONT] = pCarFront pCarColors[MODULE_BACK] = pCarBack pCarColors[MODULE_ROOF] = pCarRoof pCarColors[MODULE_CHASSIS] = COLOR_NONE EndIf ' currentModule counter determines which module is working (could be this one or a slave) ' ExecuteCommand() provides an abstraction layer, and a common API for local functions and remote functions ElseIf status = S_PICKPLACE Then GreenLight() pModuleID = moduleSequence[currentModule] _color = pCarColors[pModuleID] pCmd = CMD_ASSEMBLE + CMD_ASSEMBLE_COLOR[_color] LCD.Clear() LCD.Text(1,0,LCD_LINE_STATUS,2,"Pick place... ") LCD.Text(1,0,LCD_LINE_STATUS+20,1,BRICK_NAME[pModuleID]+ " ") ExecuteCommand() ManageCommandResult()' if there was an error, this also changes state machine status 'TextWindow.WriteLine("Pick and Place, module "+BRICK_NAME[pModuleID]) 'TextWindow.WriteLine("status= "+status) If rCmdResult = RESULT_READY Then lastStatus = status If (currentModule = lastModule) Then ' next status status = S_DELIVER_CAR Else status = S_PREPARE_CONV EndIf EndIf ElseIf status = S_PREPARE_CONV Then LCD.Clear() LCD.Text(1,0,LCD_LINE_STATUS,2,"Prepare Conveyor... ") LCD.Text(1,0,LCD_LINE_STATUS+20,1,BRICK_NAME[pModuleID]+ " ") pModuleID = moduleSequence[currentModule+1] pCmd = CMD_PREPARE_CONVEYOR 'TextWindow.WriteLine("PREPARE NEXT CONVEYOR, module "+BRICK_NAME[pModuleID]) ExecuteCommand() lastStatus = status status = S_DELIVER_CAR ManageCommandResult()' if there was an error, this also changes state machine status ElseIf status = S_DELIVER_CAR Then LCD.Clear() LCD.Text(1,0,LCD_LINE_STATUS,2,"Deliver car... ") LCD.Text(1,0,LCD_LINE_STATUS+20,1,BRICK_NAME[pModuleID]+ " ") pModuleID = moduleSequence[currentModule] pCmd = CMD_DELIVER 'TextWindow.WriteLine("DELIVER CAR, module "+BRICK_NAME[pModuleID]) ExecuteCommand() ManageCommandResult()' if there was an error, this also changes state machine status If rCmdResult = RESULT_READY Then lastStatus = status If (currentModule = lastModule) Then ' next status status = S_INPUT ' on last module, restart after delivery Else status = S_LOAD_CAR EndIf EndIf ElseIf status = S_LOAD_CAR Then LCD.Clear() LCD.Text(1,0,LCD_LINE_STATUS,2,"Load car... ") LCD.Text(1,0,LCD_LINE_STATUS+20,1,BRICK_NAME[pModuleID]+ " ") pModuleID = moduleSequence[currentModule+1] pCmd = CMD_LOAD_CAR ExecuteCommand() lastStatus = status 'TextWindow.WriteLine("LOAD CAR, module "+BRICK_NAME[pModuleID]) ManageCommandResult()' if there was an error, this also changes state machine status If rCmdResult = RESULT_READY Then status = S_PICKPLACE currentModule = currentModule + 1 ' loop restarts ' ============================================ DEBUG 'LCD.Text(1,0,LCD_LINE_DEBUG,2,"DBG PAUSE ") 'dWaitEnterBump() EndIf ElseIf status = S_IDLE Then Program.Delay(200) ElseIf status = S_STOP Then If status <> lastStatus Then ShowStopGUI() lastStatus = status EndIf ' recover from error If pModuleID = MODULE_CHASSIS Then ' if error is local, press ENTER on master If Text.IsSubText(Buttons.Current, "E") = "True" Then stopPressed = "False" ' rearm stop button status = S_INIT ' reset from unknown status EndIf Else ' if slave stopped, poll slave for status READY pSlaveID = pModuleID ' module that was stopped GetSlaveStatus() If rResult = RESULT_TIMEOUT Then status = S_COMM_ERR ElseIf rResult = RESULT_READY Then ' error recovered on slave status = S_INPUT EndIf EndIf ElseIf status = S_EMPTY_RACKS Then If status <> lastStatus Then pSlaveID = pModuleID GetRackStatus() ShowEmptyRackGUI() lastStatus = status EndIf ' recover from error If pModuleID = MODULE_CHASSIS Then ' if error is local, press ENTER on master If Text.IsSubText(Buttons.Current, "E") = "True" Then status = statusBeforeError EndIf Else ' if error is on slave, poll slave for status READY pSlaveID = pModuleID ' module that caused the error GetSlaveStatus() If rResult = RESULT_TIMEOUT Then status = S_COMM_ERR ElseIf rResult <> RESULT_EMPTY Then ' error recovered on slave status = statusBeforeError EndIf EndIf ElseIf status = S_MISPLACED Then If status <> lastStatus Then ShowMisplacedPartGUI() lastStatus = status EndIf ' recover from error If pModuleID = MODULE_CHASSIS Then ' if error is local, press ENTER on master If Text.IsSubText(Buttons.Current, "E") = "True" Then status = statusBeforeError EndIf Else ' if error is on slave, poll slave for status READY pSlaveID = pModuleID ' module that caused the error GetSlaveStatus() If rResult = RESULT_TIMEOUT Then status = S_COMM_ERR ElseIf rResult = RESULT_STOP Then ' error recovered on slave status = S_STOP ElseIf rResult = RESULT_READY Then status = statusBeforeError EndIf EndIf ElseIf status = S_COMM_ERR Then If status <> lastStatus Then YellowLight() LCD.Clear() LCD.Text(1,5,LCD_LINE_STATUS,2,"COMM ERROR ") LCD.Text(1,5,LCD_LINE_STATUS+20,1,BRICK_NAME[pSlaveID]) LCD.Text(1,5,LCD_LINE_STATUS+40,1,"Press Enter ") LCD.Text(1,5,LCD_LINE_STATUS+60,1,"when ready ") lastStatus = status EndIf If Text.IsSubText(Buttons.Current, "E") = "True" Then status = S_INPUT EndIf EndIf ' end state machine switch EndWhile ' ============================================================================ ' ================================ OTHER TASKS ================================ ' ============================================================================ Sub ResetConveyor1 rResetConveyorBusy1 = "True" Motor.StartPower(pResetConvMotorID1,-40) Program.Delay(500) Motor.StartPower(pResetConvMotorID1,30) Program.Delay(200) While Motor.GetSpeed(pResetConvMotorID1)>0 ' LCD.Text(1,10,5,2, "spd "+Motor.GetSpeed(pResetConvMotorID)) Program.Delay(30) EndWhile Motor.Stop(pResetConvMotorID1,"True") Motor.Move(pResetConvMotorID1,-20,20,"True") Program.Delay(100) 'LCD.Text(1,5,20,2,Motor.GetCount(pResetConvMotorID1)) Motor.ResetCount(pResetConvMotorID1) Motor.Stop(pResetConvMotorID1,"False") 'Speaker.Tone(100,2000,100) rResetConveyorBusy1 = "False" EndSub Sub CheckStopButton While "True" If Sensor.ReadPercent(STOP_BUTTON_PORT)>50 Then stopPressed = "True" FloatServos() Motor.Stop(CONVEYOR,"False") EndIf Program.Delay(50) EndWhile EndSub End>VZR859.sb< Start>VZS962.sb< 'Efficient methods to calculate all of the factors of large numbers '1] All factors of an integer number are prime numbers '2] A number is prime if it has no factors, other than itself and 1 '3] To check if a number is prime we only need to check factors up to its square root 'Since if a factor is greater than the square root it must be mutiplied by a number less than the square root and we would have found this factor first. 'Store a list of previously found primes usually only speeds things if the maximum number we are trying to factor is constant ' The following line could be harmful and has been automatically commented. ' 'primes = File.ReadContents(Program.Directory+"\primes.txt") ' doesn't really speed it up to store the last primes because SB is slow if this list is too big (big arrays are slow) numPrimes = Array.GetItemCount(primes) TextWindow.WriteLine("Calculating...") TextWindow.WriteLine("") Start: numberInput = Math.GetRandomNumber(1000000000) 'Random numbers up to 1 billion number = numberInput factors = "" numFactors = 0 getFactors() ' Use current primes list to get all the factors we can, number is the remaining unfactored value maxPrime = Math.Ceiling(Math.SquareRoot(number)) If (number > 1 And maxPrime > primes[numPrimes]) Then 'We need more primes getPrimes() 'More primes up to sqrt(number) getFactors() 'Any possible factors using the new primes EndIf If (number > 1) Then 'Remainder must be a prime if there are no divisors less than its sqrt numFactors = numFactors+1 factors[numFactors] = number EndIf TextWindow.WriteLine(numberInput+" has "+numFactors+" factors") For i = 1 To numFactors TextWindow.WriteLine(factors[i]) EndFor TextWindow.WriteLine("") 'Program.Delay(1000) 'Its too fast! Goto start Sub getPrimes If (numPrimes = 0) Then 'If we have no primes so far set the first 2 numPrimes = 2 primes[1] = 2 primes[2] = 3 'First odd prime EndIf For num = primes[numPrimes]+2 To maxPrime Step 2 'Only check the odd numbers, to do this the last prime in the list must be odd For j = 1 To numPrimes If (Math.Remainder(num,primes[j]) = 0) Then Goto nextNum 'We found a divisor, this number is not prime EndIf EndFor 'We found a new prime - add it to the list numPrimes = numPrimes+1 primes[numPrimes] = num nextNum: EndFor ' The following line could be harmful and has been automatically commented. ' 'File.WriteContents(Program.Directory+"\primes.txt",primes) EndSub Sub getFactors If (numFactors = 0) Then ' First time start from the beginning of the list of primes, otherwise just check the new primes starting from iPrime iPrime = 1 EndIf For i = iPrime To numPrimes prime = primes[i] While (Math.Remainder(number,prime) = 0) 'Check if we have a factor, if we do add it and set the new unfactored value for number numFactors = numFactors+1 factors[numFactors] = prime number = number/prime EndWhile If (number = 1) Then Goto allFactors 'We have all the factors so stop EndIf EndFor iPrime = numPrimes+1 ' Next call start where we left off if we need more primes. 'The next number to be factored will start with numFactors = 0 and thus iPrime = 1 set at start of this sub allFactors: EndSub End>VZS962.sb< Start>VZT837.sb< 'Written by Thaelmann-Pioniere GraphicsWindow.Title="Molecular Challenge-Ammonia Water(NH4OH)" GraphicsWindow.BackgroundColor="#dabc72" GraphicsWindow.PenWidth=40 Turtle.PenUp() Turtle.Speed=10 Turtle.MoveTo(100,400) r=40 d=r*2 direction=30'init GraphicsWindow.FontBold="false" GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor="White" GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(300,20,"NH") GraphicsWindow.FontSize=24 GraphicsWindow.DrawText(380,50,"4") GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(400,20,"OH")'write name For i = 1 To 3 Turtle.Angle=direction GraphicsWindow.PenColor="White" drawatom() Turtle.PenUp() Turtle.Move(r+200+r) direction=direction+120 Turtle.PenDown() color1="White" color2="Blue" Turtle.Turn(150) EndFor GraphicsWindow.PenWidth=40 Turtle.PenDown() drawbond() Turtle.Turn(60) Turtle.PenUp() drawbond() Turtle.Turn(180) GraphicsWindow.PenWidth=40 Turtle.PenDown() drawbond() Turtle.Turn(60) Turtle.PenUp() drawbond() Turtle.Turn(180) GraphicsWindow.PenWidth=40 Turtle.PenDown() drawbond() Turtle.Turn(60) Turtle.PenUp() drawbond() Turtle.Turn(180) Turtle.PenUp() drawbond() drawatom2() Turtle.Angle=90 Turtle.PenUp() Turtle.Move(200) GraphicsWindow.PenWidth=40 Turtle.Angle=60 Turtle.PenDown() GraphicsWindow.PenColor="White" drawatom() color1="White" color2="Red" drawbond2() drawatom() Turtle.Hide() Sub drawatom GraphicsWindow.BrushColor=GraphicsWindow.PenColor GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawatom2 GraphicsWindow.BrushColor=GraphicsWindow.PenColor GraphicsWindow.FillEllipse(Turtle.X-30,Turtle.Y-30,d-25,d-25) EndSub Sub drawbond For i = 1 To 40 GraphicsWindow.PenColor="White" Turtle.Move(2) GraphicsWindow.PenWidth=GraphicsWindow.PenWidth-0.25 EndFor GraphicsWindow.PenColor="Blue" For i = 1 To 40 Turtle.Move(2) GraphicsWindow.PenWidth=GraphicsWindow.PenWidth-0.25 EndFor EndSub Sub drawbond2 GraphicsWindow.PenColor=color1 Turtle.Move(r+20) GraphicsWindow.PenColor=color2 Turtle.Move(20+r) EndSub End>VZT837.sb<