SB_Fileset> Start>RBB339.sb< ' Fractale view data() 'Input numbers&marks for controls init_View() Controls.ButtonClicked = OnButtonClicked Sub Show_Fractal ' Base Base_Triangle() for k=Real_No[4] To 1 Step -1 GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="white" GraphicsWindow.BrushColor= GraphicsWindow.GetRandomColor() ' "white" PowerK=Math.Power(0.5,k) For i=1 To (Math.Power(2,k)-1) Step 2 ' Y direction For j=1 To (Math.Power(2,k)-1-(i-1)) Step 2 ' X direction BaseY[i][j]=ACY*PowerK +(i-1)*ACY*Powerk BaseX[i][j]=ACX*PowerK +(j-1)*ABX*PowerK +(i-1)*ACX*powerk gas[i][j]=Shapes.AddTriangle(0,0,PowerK*Lc,0,PowerK*(Lc-MCX),PowerK*YH) Shapes.Animate(gas[i][J],SX+BaseX[i][j],SY+AY-BaseY[i][j],1000/k) EndFor EndFor EndFor EndSub Sub Base_Triangle La=Real_No[1] ' Length a Lb=Real_No[2] ' Length b Lc=Real_No[3] ' Length c MCX=(La*La+Lc*Lc-Lb*Lb)/2/Lc ' MCX YH=math.SquareRoot(La*La-MCX*MCX) ' Hight AX=0 ' Point-A X C AY=YH ' Point-A Y . . . BX=Lc ' Point-B X . . YH . BY=YH ' Point-B Y A . . . . . B CX=MCX CY=0 ABX=(AX+BX) ABY=(AY+BY) ACX=(AX+CX) ACY=(AY+CY) ' GraphicsWindow.PenColor="#FF0000" '"Red" GraphicsWindow.BrushColor="#FF0000" '"Red" Base=Shapes.AddTriangle(AX,AY,BX,BY,CX,CY) SX=50 ' shift X SY=170 ' shift Y Shapes.Animate(Base,SX,SY,100) Program.Delay(500) EndSub Sub OnButtonClicked GraphicsWindow.BrushColor = "Red" name=controls.LastClickedButton 'Last button nm=controls.GetButtonCaption(name) ' Button's caption Xloc=50+2*BW*(count) ' Angle number / length showing position If nm="Del" Then Del_word() elseIf nm="AC" Then Reset() elseIf nm="Exe" Then Execute() else Make_word() endif EndSub Sub Fractale If Real_No[1]+Real_No[2] <= Real_No[3] Then Sound.PlayBellRing() ' Check ( a+ b > C) Reset() endif For i= 1 To 4 Shapes.Remove(T[i]) ' initial triangle and a b c EndFor Show_Fractal() ' fractale showing EndSub Sub Sample_Triangle GraphicsWindow.PenColor="Yellow" GraphicsWindow.BrushColor="Yellow" AX=0 AY=400 BX=600 BY=400 CX=450 CY=0 MX=50 MY=150 T[1]=Shapes.AddTriangle(AX,AY,BX,BY,CX,CY) Shapes.SetOpacity(T[1],30) Shapes.Animate(T[1],MX,MY,600) T[2]=shapes.AddText(" a ") Shapes.Animate(T[2],MX+CX/2-50,MY+AY/2,800) T[3]=shapes.AddText(" b ") Shapes.Animate(T[3],MX+10+CX+(BX-CX)/2,MY+CY+(BY-CY)/2,1000) T[4]=shapes.AddText(" c ") Shapes.Animate(T[4],MX+BX/2,MY+BY,1200) EndSub Sub Button_Set GraphicsWindow.BrushColor = "Blue" nn=0 dm=s[1] Loop2: end_P=Text.GetIndexOf(dm," ") msg=text.GetSubText(dm,1,end_P-1) ' word nn=nn+1 btn[nn][1] =Controls.AddButton(msg, 10+BW*(nn-1), BH+50) Controls.SetSize(btn[nn][1] ,BW-2,BH-2) 'Set 13 Control buttons If nn=WN Then Goto end1 EndIf dm=text.GetSubTextToEnd(dm,end_p+1) 'gets number value or mark's name Goto loop2 end1: add_num="" count=0 EndSub Sub Reset GraphicsWindow.Clear() GraphicsWindow.Show() init_View() Button_Set() EndSub Sub init_View WN=13 ' 13 words BW=70 BH=45 GW=BW*WN GH=BH*15+20 GraphicsWindow.Hide() GraphicsWindow.top=0 GraphicsWindow.Width = GW+2*10 GraphicsWindow.Height = GH GraphicsWindow.Title = "Fractale graph" GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Teal" GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(10+BW*0, 45, BW*3/2, BH-10) GraphicsWindow.FillRectangle(10+BW*2, 45, BW*3/2, BH-10) GraphicsWindow.FillRectangle(10+BW*4, 45, BW*3/2, BH-10) GraphicsWindow.FillRectangle(10+BW*6, 45, BW*3/2, BH-10) GraphicsWindow.BrushColor ="Yellow" GraphicsWindow.FontSize = 20 GraphicsWindow.FontName = "Coorie new" GraphicsWindow.FontItalic="True" GraphicsWindow.DrawText(15,5,"Input a b c values (300-800 may be better)") GraphicsWindow.DrawText(10+BW*9,5,"Note!: Must be ( a + b > c ) ") GraphicsWindow.DrawText(10+BW*6,23,"Steps: Under 7 ") GraphicsWindow.DrawText(10+BW*9,40,"AC=All Clear") GraphicsWindow.DrawText(10+BW*9,60,"Exe=Enter Value or Run") Button_Set() GraphicsWindow.FontSize = 23 GraphicsWindow.DrawText(20,45,"a: ") GraphicsWindow.DrawText(20+BW*2,45,"b: ") GraphicsWindow.DrawText(20+BW*4,45,"c: ") GraphicsWindow.DrawText(20+BW*6,45,"S: ") Sample_Triangle() ' show sample triangle EndSub Sub data ' 13 words s[1]="1 2 3 4 5 6 7 8 9 0 Del AC Exe " EndSub Sub Del_word Shapes.Remove(numbers[count]) add_num=Text.GetSubText(add_num,1,Text.GetLength(add_num)-1) numbers[count] = Shapes.AddText(add_num) ' 1 word delete Shapes.Move(numbers[count] , Xloc, 45) EndSub Sub Execute count=count+1 Real_No[count]=add_num add_num="" If count=4 then Fractale() endif EndSub Sub Make_word Shapes.Remove(numbers[count]) add_num=text.Append(add_num,nm) ' Add 1 word numbers[count] = Shapes.AddText(add_num) Shapes.Move(numbers[count], Xloc, 45) EndSub End>RBB339.sb< Start>RBF204.sb< lgg=0 'language 1-french; 2-spanish; other eng. lsl=1 cll=5 LDTextWindow.KeyDown=kkk if lgg=1 or lgg=2 then st[2]="sol Else st[2]="sun EndIf rdr="true While 1=1 If rdr Then rdr="false if lgg=1 Then sq=LDDictionary.GetDefinitionInFrench(st[lsl+1]) elseif lgg=2 Then sq=LDDictionary.GetDefinitionInSpanish(st[lsl+1]) else sq=LDDictionary.GetDefinition(st[lsl+1]) EndIf ss="" For f=1 To Text.GetLength(sq) cc=Text.GetSubText(sq f 1) dd=Text.GetCharacterCode(cc) If dd>=32 and dd<127 Then ss=ss+cc ElseIf dd=13 or dd=10 Then ss=ss+" " Else ss=ss+"@" EndIf EndFor ss=LDText.Replace(ss "," "_") ss=LDText.Replace(ss ".@" " ") ss=LDText.Replace(ss "@" "") ct=text.GetSubText( ss 1 990) While Text.GetIndexOf(ct "[")>0 p=Text.GetIndexOf(ct "[") If p>0 Then q=Text.GetIndexOf(ct "]") ct=Text.GetSubText(ct 1 p-1)+Text.GetSubTextToEnd(ct q+1) EndIf EndWhile st=LDText.Split(ct " ") ii=1 mk=Array.GetItemCount(st)-1 jj=38 lsl=1 cll=5 TextWindow.Clear() drww() ii=39 jj=76 lsl=-1 cll=35 drww() ii=77 jj=ii+37 lsl=-1 cll=70 drww() ii=1 jj=38 lsl=1 cll=5 EndIf EndWhile Sub kkk lk= LDTextWindow.LastKey If lk="Up" Then lsl=lsl-1 If lsl<1 Then lsl=1 EndIf ElseIf lk="Return" Then rdr="true ElseIf lk="Down" Then lsl=lsl+1 If lsl>mk Then lsl=mk EndIf EndIf drww() EndSub Sub drww TextWindow.CursorLeft=cll TextWindow.CursorTop=3 For f=ii To jj mm=Math.Max(mm Text.GetLength(st[f])) EndFor TextWindow.ForegroundColor="cyan" ln=Text.GetSubText("╔════════════════════════════════════════════════" 1 mm+3) TextWindow.CursorLeft=cll TextWindow.BackgroundColor="blue" TextWindow.WriteLine(ln+"╗") TextWindow.CursorLeft=cll ln=Text.GetSubText(text.ConvertToUpperCase (st[1])+" " 1 mm)+" ║" TextWindow.Write("║ "+ln) TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") TextWindow.BackgroundColor="blue" ln=Text.GetSubText("╟────────────────────────────────────────────────" 1 mm+3) TextWindow.CursorLeft=cll TextWindow.Write(ln+"╢") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") For f=ii To jj TextWindow.CursorLeft=cll TextWindow.BackgroundColor="blue" TextWindow.Write("║ ") If f-ii=lsl Then TextWindow.BackgroundColor="yellow" textWindow.ForegroundColor="black" Else TextWindow.ForegroundColor="cyan" EndIf TextWindow.Write(Text.GetSubText(ldtext.Replace( st[f] "_" " ")+" " 1 mm)) TextWindow.BackgroundColor="blue" TextWindow.ForegroundColor="cyan" TextWindow.Write(" ║") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") EndFor ln=Text.GetSubText("╚════════════════════════════════════════════════" 1 mm+3) TextWindow.CursorLeft=cll TextWindow.BackgroundColor="blue" TextWindow.Write(ln+"╝") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") ln=Text.GetSubText("▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" 1 mm+3) TextWindow.CursorLeft=cll TextWindow.WriteLine(" "+ln) EndSub End>RBF204.sb< Start>RBF730.sb< Initialisation() Main() Program.End() Sub Main SkipEnd = F 'SkipEnd change to True to end program While SkipEnd = F 'Loop by SkipEnd equal False If Skip_OBC = T Then Skip_OBC = F 'Button wasl clicked LastClickedButton = Controls.LastClickedButton If LastClickedButton = BT_End Then SkipEnd = T 'EndButton was clicked so change SkipEnd to True ElseIf LastClickedButton = BT_Word Then MakeWordArray() 'Put the words into the array and show it EndIf EndIf EndWhile EndSub 'Main Sub MakeWordArray Word = "" Sentence = Controls.GetTextBoxText(MLTB_sentence) 'Read the Text from TextBox Length_Sentence = Text.GetLength (Sentence) Index = 1 Skip_Delimiter = F For I = 1 To Length_Sentence Char = Text.GetSubText(Sentence, I, 1) 'The aktuel character from sentence If Array.ContainsValue(Delimiter, Char) = T Then If Skip_Delimiter = F Then 'By first Delimeter set next Index Index = Index + 1 EndIf Skip_Delimiter = T Else Skip_Delimiter = F 'Add Char to the array Word Word[Index] = Text.Append(Word[Index], Char) EndIf EndFor 'Write all entry of word into the Textwindow For I = 1 To Array.GetItemCount(Word) TextWindow.WriteLine(Word[I]) EndFor EndSub 'MakeWordArray Sub Initialisation 'Subroutine by Event Controls.ButtonClicked = OnButtonClicked 'Windows 'Max Width and Height from Desktop DW = Desktop.Width DH = Desktop.Height 'Create Textwindow TextWindow.Top = 0 TextWindow.Left = DW / 2 'Create GraphicWindow GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 'Constante T = "True" F = "False" 'Variables Skip_OBC = F 'Delimater by new word Delimiter[1] = " " Delimiter[2] = "." Delimiter[3] = "," Delimiter[4] = ";" Delimiter[5] = ":" Delimiter[6] = "!" Delimiter[6] = "?" 'Create controls and shapes SH_sentence = Shapes.AddText("Sentence:") Shapes.Move(SH_sentence, 10,0) MLTB_sentence = Controls.AddMultiLineTextBox(10,20) Controls.SetSize(MLTB_sentence, GraphicsWindow.Width - 20, 200) BT_Word = Controls.AddButton("Word", 10, GraphicsWindow.Height -30) BT_End = Controls.AddButton("End", 200, GraphicsWindow.Height -30) EndSub 'Initialisation Sub OnButtonClicked Skip_OBC = T EndSub 'OnButtonClicked End>RBF730.sb< Start>RBG750.sb< GraphicsWindow.BackgroundColor ="teal GraphicsWindow.PenWidth =1 GraphicsWindow.Top=5 GraphicsWindow.Height =900 GraphicsWindow.Width=750 LDScrollBars .Add(700 2000) f100=55 GraphicsWindow.Title="Color Picker GraphicsWindow.MouseMove=mmm For h=0 to 1 hh=h/2 zz=0 For z =1 To .05 Step -.05 y=0 zz=zz+1 For yy=1-hh To .5-hh Step -.05 If Math.Remainder (zz 2)=1-h then zzz=y*5+(zz-1)*f100 Else zzz=zz*f100-y*5-5 endif y=y+1 For x=0 To 359 cc= LDColours.HSLtoRGB (x z yy) GraphicsWindow.PenColor=cc GraphicsWindow.DrawLine (10+x+h*360 31+zzz 10+x+h*360 36+zzz) EndFor endfor EndFor endfor Sub mmm cc= GraphicsWindow.GetPixel (GraphicsWindow.MouseX GraphicsWindow.MouseY ) GraphicsWindow.BackgroundColor=cc GraphicsWindow.Title=cc EndSub End>RBG750.sb< Start>RBH700.sb< 'Author Matthew L. Parets 'Euler Project 28 - Diagonal sums of a spiral. 'Build a 1001x1001 spiral in the fashion of 5x5 example below. 'Goal: Find the sum of the diagonals of the square. 'This solution tracks the sums as the code follows the sprial 'This eliminates the need for an array, and the code takes 'half as long to find the solution '11 12 13 14 15 21 22 23 24 25 '21 22 23 24 25 20 7 8 9 10 '31 32 33 34 35 = 19 6 1 2 11 = 101 '41 42 43 44 45 18 5 4 3 12 '51 52 53 54 55 17 16 15 14 13 'Positions 1 and 2 are special cases. Otherwise we count the value at the start 'and end of every horizontal line. No storage is neccessary 'Size of the spiral grid MaxRow = 1001 MaxCol = 1001 'Initialize - Set the Center Row = Math.Ceiling(MaxRow / 2) Col = Math.Ceiling(MaxCol / 2) val = 1 'Track the direction and distance to move through grid hdir = 1 hdist = 1 vdir = 1 vdist = 1 sum = 0 top: 'The first position of each line is always added sum = sum + val 'Horizaontal distance For i = 1 to hdist val = val + 1 Col = Col + hdir If Math.Remainder(val,1000) = 0 Then TextWindow.Write(".") EndIf EndFor 'Last postion is always counted ' (First postion is special cased to simplify algorithm) If hdist <> 1 Then If vdir > 0 then 'Moving right, value is current postion sum = sum + val Else 'Moving left, value at previous postion sum = sum + (val - 1) EndIf EndIf 'The spiral will always end at the end of the top row If Row > MaxRow or Col > MaxCol then Goto end endif 'The next row will go in the opposite direction and be one index larger hdir = hdir * -1 hdist = hdist + 1 'Vertical distance For i = 1 to vdist val = val + 1 Row = Row + vdir EndFor 'The next column will go in the opposite direction and be one index larger vdir = vdir * -1 vdist = vdist + 1 Goto top end: TextWindow.WriteLine(" ") TextWindow.WriteLine("The Answer: " + sum) End>RBH700.sb< Start>RBK749.sb< 'did this program using gif GraphicsWindow.BackgroundColor = "Yellow" LDGraphicsWindow.PauseUpdates() LDShapes.AnimationInterval = 0 gif = LDShapes.AddAnimatedGif(Program.Directory+"\gif.gif","True") Shapes.Move(gif,200,200) LDShapes.AnimationInterval = 75 LDGraphicsWindow.ResumeUpdates() End>RBK749.sb< Start>RBL234.sb< Game_Width = 600 Game_Height = 600 GraphicsWindow.Width = Game_Width GraphicsWindow.Height = Game_Height Spring = Shapes.AddRectangle(20,100) Spring_X = 200 Spring_Y = 50 Shapes.Move(Spring,Spring_X,Spring_Y) Axis = Shapes.AddEllipse(20,20) Axis_X = 300 Axis_Y = 300 Shapes.Move(Axis,Axis_X-10,Axis_Y-10) While "True" Spring_Distance_To_Axis = math.SquareRoot((Axis_X-Spring_X)*(Axis_X-Spring_X)+(Axis_Y-Spring_Y)*(Axis_Y-Spring_Y)) Spring_Speed = (Spring_Speed*0.8)-(200 - Spring_Distance_To_Axis)*0.2 u = Axis_X-Spring_X v = Axis_Y-Spring_Y If u = 0 Then theta = Math.Pi/2 Else theta = Math.ArcTan(v/u) EndIf If (u < 0) Then theta = Math.Pi+theta EndIf Spring_X = Spring_X + Spring_Speed*Math.Cos(theta) Spring_Y = Spring_Y + Spring_Speed*Math.Sin(theta) If Mouse.IsLeftButtonDown Then Spring_Speed = -50 endif If Mouse.IsRightButtonDown Then Spring_X = GraphicsWindow.MouseX Spring_Y = GraphicsWindow.MouseY endif Spring_Angle = theta*180/Math.Pi-90 Shapes.Rotate(Spring,Spring_Angle) Shapes.Move(Spring, Spring_X-10, Spring_Y-50) Program.Delay(25) endwhile End>RBL234.sb< Start>RBM143.sb< GraphicsWindow.Width = 714 GraphicsWindow.Height = 650 GraphicsWindow.CanResize = "False" GraphicsWindow.FillEllipse(200,175,100,100) GraphicsWindow.FillEllipse(400,175,100,100) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(225,100,250,300) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(275,200,30,30) GraphicsWindow.FillEllipse(400,200,30,30) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(290,210,5,5) GraphicsWindow.FillEllipse(415,210,5,5) GraphicsWindow.BrushColor = "Red" GraphicsWindow.FillEllipse(275,300,150,50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(275,240,150,100) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillTriangle(357,210,370,275,344,275) GraphicsWindow.BrushColor = "Red" GraphicsWindow.FillEllipse(225,100,250,100) End>RBM143.sb< Start>RBM261.sb< GraphicsWindow.Title = "Calculator" GraphicsWindow.Show() GraphicsWindow.Height = "200" GraphicsWindow.Width = "265" GraphicsWindow.DrawBoundText(1,1,100,"Answer: ") Answer = Controls.AddTextBox(100,1) Minus = Controls.AddButton(" - ",120,90) Plus = Controls.AddButton(" + ",120,60) Equals = Controls.AddButton(" = ",95,120) Zero = Controls.AddButton(" 0 ", 30,120) Point = Controls.AddButton(" . ", 62,120) Clear = Controls.AddButton(" C ", 120,30) For i = 1 to 9 x = 30*(1+Math.Remainder(i-1,3)) y = 30*(1+Math.Floor((i-1)/3)) button[i] = Controls.AddButton(i,x,y) buttonvalue[i] = i EndFor buttonvalue[1] = "1" buttonvalue[2] = "2" buttonvalue[3] = "3" buttonvalue[4] = "4" buttonvalue[5] = "5" buttonvalue[6] = "6" buttonvalue[7] = "7" buttonvalue[8] = "8" buttonvalue[9] = "9" buttonvalue[0] = "0" buttonValue[10] = "=" buttonValue[11] = "+" buttonValue[12] = "-" Controls.ButtonClicked = OnButtonClicked valueCurrent = "" operator = "" Sub OnButtonClicked buttonClicked = Controls.LastClickedButton For i = 1 To Array.GetItemCount(button) If (button[i] = buttonClicked) Then valueCurrent = Text.Append(valueCurrent,buttonValue[i]) CheckValueCurrent() '<<<< Controls.SetTextBoxText(Answer,valueCurrent) EndIf EndFor If buttonClicked = Plus Then CheckValueCurrent() '<<<<<<<< value1 = valueCurrent valueCurrent = "" operator = "+" Controls.SetTextBoxText(Answer,valueCurrent) ElseIf buttonClicked = Minus Then CheckValueCurrent() '<<<<<<<<<< value1 = valueCurrent valueCurrent = "" operator = "-" Controls.SetTextBoxText(Answer,valueCurrent) ElseIf buttonClicked = Equals Then CheckValueCurrent() '<<<<< value2 = valueCurrent If (operator = "+") Then valueCurrent = value1+value2 CheckValueCurrent() '<<<<< ElseIf (operator = "-") Then valueCurrent = value1-value2 CheckValueCurrent() '<<<< EndIf CheckValueCurrent() '<<<< Controls.SetTextBoxText(Answer,valueCurrent) ElseIf Controls.LastClickedButton = Clear Then 'added this valueCurrent = "" Controls.SetTextBoxText(Answer,valueCurrent) EndIf EndSub Sub CheckValueCurrent If valueCurrent < 0 Or valueCurrent > 999 Then valueCurrent = "" Controls.SetTextBoxText(Answer,valueCurrent) GraphicsWindow.ShowMessage("An error has occurred. valueCurrent > 999", "Check valueCurrent") EndIf EndSub End>RBM261.sb< Start>RBN002-0.sb< ' Turtle Flash - RBN002-0 ' Copyright (c) 2014 Nonki Takahashi. MIT License. ' GraphicsWindow.Title = "Turtle Flash" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh dw = Desktop.Width dh = Desktop.Height GraphicsWindow.Left = (dw - gw) / 2 GraphicsWindow.Top = (dh - gh) / 2 Turtle.Show() Turtle.PenUp() x1 = gw / 2 y1 = gh / 2 Turtle.MoveTo(x1, y1) For i = 1 To 10 Turtle.Angle = Turtle.Angle / 2 Program.Delay(100) EndFor bg = "Gray" GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 0 rect = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(rect, 0) corner = "1= 0, 0;2= 0,428;3=598,428;4=598, 0;" GraphicsWindow.BackgroundColor = bg GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = bg While "True" For i = 1 To 100 For j = 1 To 5 DrawLine() EndFor Shapes.SetOpacity(rect, i) Program.Delay(10) EndFor Program.Delay(1000) GraphicsWindow.FillRectangle(0, 0, gw, gh) For i = 100 To 0 Step -1 Shapes.SetOpacity(rect, i) Program.Delay(10) EndFor Program.Delay(4000) EndWhile Sub DrawLine r = 128 g = Math.GetRandomNumber(127) + 128 b = Math.GetRandomNumber(127) + 128 GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) i3 = Math.GetRandomNumber(4) i4 = i3 + (Math.GetRandomNumber(2) * 2 - 3) If i4 < 1 Then i4 = 4 ElseIf 4 RBN002-0.sb< Start>RBN002-1.sb< ' Turtle Flash 0.3 - RBN002-1 ' Copyright (c) 2014 Nonki Takahashi. MIT License. ' GraphicsWindow.Title = "Turtle Flash 0.3" dw = Desktop.Width dh = Desktop.Height GraphicsWindow.Width = dw GraphicsWindow.Height = dh gw = GraphicsWindow.Width gh = GraphicsWindow.Height bw = (dw - gw) / 2 ' border width th = (dh - gh) - bw ' title bar height gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (dw - (gw + bw * 2)) / 2 GraphicsWindow.Top = (dh - (gh + th + bw)) / 2 Turtle.Show() Turtle.PenUp() x1 = gw / 2 y1 = gh / 2 Turtle.MoveTo(x1, y1) For i = 1 To 10 Turtle.Angle = Turtle.Angle / 2 Program.Delay(100) EndFor bg = "Gray" GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 0 rect = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(rect, 0) corner = "1= 0, 0;2= 0,428;3=598,428;4=598, 0;" GraphicsWindow.BackgroundColor = bg GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = bg While "True" For i = 1 To 100 For j = 1 To 5 DrawLine() EndFor Shapes.SetOpacity(rect, i) Program.Delay(10) EndFor Program.Delay(1000) GraphicsWindow.FillRectangle(0, 0, gw, gh) For i = 100 To 0 Step -1 Shapes.SetOpacity(rect, i) Program.Delay(10) EndFor Program.Delay(4000) EndWhile Sub DrawLine r = 128 g = Math.GetRandomNumber(127) + 128 b = Math.GetRandomNumber(127) + 128 GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(r, g, b) i3 = Math.GetRandomNumber(4) i4 = i3 + (Math.GetRandomNumber(2) * 2 - 3) If i4 < 1 Then i4 = 4 ElseIf 4 RBN002-1.sb< Start>RBQ131.sb< 'Challenge of the Month - September 2018 by NaochanON ' Graphics Challenges 2 -- Snail shell -- GraphicsWindow.BackgroundColor="#AACF53" '#69B076" GraphicsWindow.Show() GraphicsWindow.Width=800 GraphicsWindow.Height=600 GraphicsWindow.Left=5 GraphicsWindow.Top=5 pw=10 GraphicsWindow.PenWidth=PW While "True" draw() Program.Delay(1000) GraphicsWindow.Clear() endwhile Sub draw rnd= 1+Math.GetRandomNumber(5) a=5*rnd stp=0.05 X0=300+(6-rnd)*80 Y0=250+(6-rnd)*30 GraphicsWindow.BrushColor="#E9E4D4" r= Math.SquareRoot(a*a*22) GraphicsWindow.FillTriangle(x0,y0,x0-2*r,y0+r/2,x0,y0+r*0.7) GraphicsWindow.FillTriangle(x0,y0,x0+1.5*r,y0+r*0.7,x0,y0+r*0.7) GraphicsWindow.BrushColor="Brown" GraphicsWindow.PenWidth=PW*rnd/6 GraphicsWindow.DrawLine(X0-1.2*r,y0+r/3,x0-1.5*r,y0-0.2*r) GraphicsWindow.FillEllipse(x0-1.5*r-r/10,y0-0.2*r-r/10,r/5,r/5) GraphicsWindow.DrawLine(X0-1.1*r,y0+r/3,x0-1.3*r,y0-0.2*r) GraphicsWindow.FillEllipse(x0-1.3*r-r/10,y0-0.2*r-r/10,r/5,r/5) GraphicsWindow.PenWidth=PW For s=22.3 To 0 Step -stp r= Math.SquareRoot(a*a*s)*(s)/22 X=X0+r*math.Cos(-s) Y=Y0+r*math.Sin(-s) GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(25*rnd,s*10+34,-s*4+100) GraphicsWindow.DrawLine(x0,y0,X,Y) EndFor EndSub End>RBQ131.sb< Start>RBR726.sb< ' mahreen miangul ' Donkey MaY 2019 GraphicsWindow.Title = "mahreen miangul GraphicsWindow.Width = 1080 GraphicsWindow.Height = 420 GraphicsWindow.FontSize = 88 'haroon 1 'write Alphabets and Set brush color GraphicsWindow.Clear() GraphicsWindow.BrushColor = "greenyellow shapeD = Shapes.AddText("D") Shapes.Move(shapeD,420,330) GraphicsWindow.BrushColor = "yellowgreen shapeO = Shapes.AddText("O") Shapes.Move(shapeO,1010,0) GraphicsWindow.BrushColor = "DarkSlateGray shapeN = Shapes.AddText("N") Shapes.Move(shapeN,0,200) GraphicsWindow.BrushColor = "MediumSlateBlue shapeK = Shapes.AddText("K") Shapes.Move(shapeK,1000,250) GraphicsWindow.BrushColor = "navy shapeE = Shapes.AddText("E") Shapes.Move(shapeE,200,100) GraphicsWindow.BrushColor = "teal shapeY = Shapes.AddText("Y") Shapes.Move(shapeY,400,-20) 'haroon rashid 2 'Drag&Drop Alphabets on GraphicsWindow GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp mouseMoving = 0 GraphicsWindow.brushColor = GraphicsWindow.GetColorFromRGB(100, 200, 150) GraphicsWindow.FontSize = 55 miangul = Shapes.Addtext("M O U S E") Shapes.Move(miangul, 0, 0) Shapes.Animate(miangul, 600, 10, 2000) GraphicsWindow.brushColor = GraphicsWindow.GetColorFromRGB(500, 100, 150) miangul = Shapes.Addtext("D R A G and D R O P") Shapes.Move(miangul, 0, 0) Shapes.Animate(miangul, 450, 70, 2000) ' Donkey GraphicsWindow.PenWidth = 4 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(620, 200, 100, 100) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(620, 200, 50, 45) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(620, 200, 50, 75) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(630, 300, 10, 24) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(640, 300, 20, 30) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(690, 300, 10, 25) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawRectangle(700, 300, 20, 30) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.Drawline(590, 200, 600, 220) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(620, 200, 600, 220) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(590, 200, 620, 200) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.Drawline(700, 200, 680, 220) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(672,200, 680, 220) ' eyes GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawEllipse(630, 215, 5, 5) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawEllipse(650, 215, 5, 5) ' hair GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.fillEllipse(620, 185, 50, 15) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.Fillrectangle(620, 195, 50, 7) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawTriangle(620,190, 630, 190, 590, 160) ' miangul GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(640, 330, 635, 340) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(660, 330, 660, 340) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(634, 340, 660, 340) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() graphicswindow.DrawLine(630, 324, 620, 334) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(635, 334, 620, 335) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(690, 340, 700, 330) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(720, 340, 720, 330) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(690, 340, 720, 340) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(688, 325, 678, 335) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(678, 335, 693, 335) ' Tail GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(705, 275, 705, 215) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(705, 255, 720, 255) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawLine(705, 275, 720, 275) ' Nose GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawEllipse(630, 255, 1, 10) GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawEllipse(650, 255, 1, 10) While ("True") If (shapeDMoving = 1) Then Shapes.Move(shapeD,GraphicsWindow.MouseX-shapeD_X,GraphicsWindow.MouseY-shapeD_Y) EndIf If (shapeOMoving = 1) Then Shapes.Move(ShapeO,GraphicsWindow.MouseX-ShapeO_X,GraphicsWindow.MouseY-ShapeO_Y) EndIF If (shapeNMoving = 1) Then Shapes.Move(shapeN,GraphicsWindow.MouseX-shapeN_X,GraphicsWindow.MouseY-shapeN_Y) EndIf If (shapeKMoving = 1) Then Shapes.Move(ShapeK,GraphicsWindow.MouseX-ShapeK_X,GraphicsWindow.MouseY-ShapeK_Y) EndIf If (shapeEMoving = 1) Then Shapes.Move(shapeE,GraphicsWindow.MouseX-shapeE_X,GraphicsWindow.MouseY-shapeE_Y) EndIf If (shapeYMoving = 1) Then Shapes.Move(ShapeY,GraphicsWindow.MouseX-ShapeY_X,GraphicsWindow.MouseY-ShapeY_Y) EndIf Program.Delay(20) 'Don't mash cpu in game loop EndWhile Sub OnMouseDown mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY 'Relative coordinates of mouse to shape - we use these in the drag movement so the shape doesn't recenter, but just drag from current mouse position shapeD_X = mx-Shapes.GetLeft(shapeD) shapeD_Y = my-Shapes.GetTop(shapeD) If (shapeD_X >= 0 And shapeD_X <= 40 And shapeD_Y >= 0 And shapeD_Y <= 100) Then shapeDMoving = 1 EndIf ShapeO_X = mx-Shapes.GetLeft(ShapeO) ShapeO_Y = my-Shapes.GetTop(ShapeO) If (ShapeO_X >= 0 And ShapeO_X <= 40 And ShapeO_Y >= 0 And ShapeO_Y <= 100) Then shapeOMoving = 1 EndIf shapeN_X = mx-Shapes.GetLeft(shapeN) shapeN_Y = my-Shapes.GetTop(shapeN) If (shapeN_X >= 0 And shapeN_X <= 40 And shapeN_Y >= 0 And shapeN_Y <= 100) Then shapeNMoving = 1 EndIf ShapeK_X = mx-Shapes.GetLeft(ShapeK) ShapeK_Y = my-Shapes.GetTop(ShapeK) If (ShapeK_X >= 0 And ShapeK_X <= 40 And ShapeK_Y >= 0 And ShapeK_Y <= 100) Then shapeKMoving = 1 EndIf shapeE_X = mx-Shapes.GetLeft(shapeE) shapeE_Y = my-Shapes.GetTop(shapeE) If (shapeE_X >= 0 And shapeE_X <= 40 And shapeE_Y >= 0 And shapeE_Y <= 100) Then shapeEMoving = 1 EndIf ShapeY_X = mx-Shapes.GetLeft(ShapeY) ShapeY_Y = my-Shapes.GetTop(ShapeY) If (ShapeY_X >= 0 And ShapeY_X <= 40 And ShapeY_Y >= 0 And ShapeY_Y <= 100) Then shapeYMoving = 1 EndIf endsub Sub OnMouseUp shapeDMoving = 0 shapeOMoving = 0 shapeNMoving = 0 shapeKMoving = 0 shapeEMoving = 0 shapeYMoving = 0 EndSub End>RBR726.sb< Start>RBS690.sb< TextWindow.WriteLine(LDClient.Connect("192.168.1.140:100")) TextWindow.Write("Enter client number (Number of clients connected plus 1): ") UserNum = TextWindow.Read() LDClient.ServerMessage = MessageRecieved GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 NumClients = 4 For i = 1 To NumClients Ship[i] = Shapes.AddRectangle(50,100) Shipx[i] = 100+(i*100) Shipy[i] = 200 Shapes.Move(Ship[i],Shipx[i],Shipy[i]) EndFor While 1 = 1 Program.Delay(5) For i = 1 To NumClients Shipx[i] = Shipx[i] + ShipXdisplacement[i] Shipy[i] = Shipy[i] + ShipYdisplacement[i] Shapes.Move(Ship[i],Shipx[i],Shipy[i]) EndFor OldYDis[UserNum] = ShipYdisplacement[UserNum] OldXDis[UserNum] = ShipXdisplacement[UserNum] ShipXdisplacement[UserNum] = 0 ShipYdisplacement[UserNum] = 0 If LDUtilities.KeyDown("Up") Then ShipYdisplacement[UserNum] = -1 EndIf If LDUtilities.KeyDown("Down") Then ShipYdisplacement[UserNum] = 1 EndIf If LDUtilities.KeyDown("Left") Then ShipXdisplacement[UserNum] = -1 EndIf If LDUtilities.KeyDown("Right") Then ShipXdisplacement[UserNum] = 1 EndIf If OldYDis[UserNum] <> ShipYdisplacement[UserNum] Or OldXDis[UserNum] <> ShipXdisplacement[UserNum] Then SendMessage() EndIf EndWhile '======================================================================== '======================================================================== '===========================SUBROUTINES================================== '======================================================================== '======================================================================== Sub SendMessage Info["UserNum"] = UserNum Info["DisX"] = ShipXdisplacement[UserNum] Info["DisY"] = ShipYdisplacement[UserNum] Info["Shipx"] = Shipx[UserNum] Info["Shipy"] = Shipy[UserNum] LDClient.SendMessage(Info) EndSub Sub MessageRecieved ReceivedInfo = LDClient.LastServerMessage ReceivedMessageNum = ReceivedInfo["UserNum"] If ReceivedMessageNum <> UserNum Then ShipXdisplacement[ReceivedMessageNum] = ReceivedInfo["Disx"] ShipYdisplacement[ReceivedMessageNum] = ReceivedInfo["Disy"] Shipx[ReceivedMessageNum] = ReceivedInfo["Shipx"] Shipy[ReceivedMessageNum] = ReceivedInfo["Shipy"] EndIf EndSub End>RBS690.sb< Start>RBT198.sb< ss="211,359,215,220,311,219,311,228,360,198,315,170,314,163,331,164,332,172,370,198,354,219,557,218,649,220,772,232,845,234,877,242,893,249,912,268,1004,317,1004,329,982,338,985,351,902,354,893,336,874,335,760,335,746,353,398,357,388,337,253,334,242,355, sh=LDText.Split (ss "|") vv="248,770,242,745,191,743,183,724,179,653,636,653,679,638,723,634,951,629,952,639,959,638,960,761,952,759,949,768,925,767,917,740,778,743,771,763,262,771, vg=LDText.Split (vv "|") GraphicsWindow.Title="Trains GraphicsWindow.Width=1400 GraphicsWindow.Height=900 GraphicsWindow.Left=5 GraphicsWindow.Top=5 GraphicsWindow.BackgroundColor ="teal GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor ="darkgray GraphicsWindow.DrawLine (0 425 1400 425) GraphicsWindow.PenColor ="black GraphicsWindow.DrawLine (0 545 1400 545) GraphicsWindow.PenWidth=0 m[1]="1=0;2=0" m[2]="1=0;2=2" m[3]="1=5;2=0" s=LDShapes.AddPolygon (m) Shapes.Remove (s) GraphicsWindow.MouseMove =mww GraphicsWindow.BrushColor="black For o=0 to 1 e=Shapes.AddEllipse (66 66) Shapes.Move (e, 1350+o*70 430) endfor GraphicsWindow.BrushColor="gold For x=1 To 1 shh=LDText.Split (sh[x] ",") m=0 For r=1 To Array.GetItemCount (shh) Step 2 m[i][1]=shh[r] m[i][2]=shh[r+1] i=i+1 EndFor If x=1 Then oc=1 EndIf For o=0 to oc-1 p= LDShapes.AddPolygon (m) LDShapes.ZIndex (p, 1-x) If x=1 Then LDShapes.BrushColour (p "blue") LDShapes.Move (p 800+o*64 290) elseif x>=3 then LDShapes.BrushColour (p "black") endif endfor EndFor vf=788 For v=-1 to 10 If v>=0 then For x=1 To 1 shh=LDText.Split (vg[x] ",") m=0 For r=1 To Array.GetItemCount (shh) Step 2 If Math.Remainder (v 2)=1 Then m[i][1]=900-shh[r] Else m[i][1]=shh[r] endif m[i][2]=shh[r+1] i=i+1 EndFor p= LDShapes.AddPolygon (m) LDShapes.BrushColour (p "gold") LDShapes.Move (p 15-v*vf 350) EndFor endif GraphicsWindow.BrushColor="black o400=320 For o=0 to 1 e=Shapes.AddEllipse (66 66) If Math.Remainder (v 2)=0 then Shapes.Move (e 15-v*vf-o*66 430) If v=10 and o=1 then Shapes.Remove (e) Goto ttt endif Else Shapes.Move (e 15-v*vf-o*66-120 430) e=Shapes.AddEllipse (66 66) Shapes.Move (e 15-v*vf-o*66+120 430) endif LDShapes.ZIndex (e, -55) ttt: endfor endfor GraphicsWindow.PenWidth =15 GraphicsWindow.PenColor ="brown tx=" *** TGV *** train à grande vitesse *** TGV *** train à grande vitesse tt=Shapes.AddText (tx+tx+tx+tx) LDShapes.Font (tt "Engraversgothic BT" 55 "true" "True") Shapes.Move (tt, -7500 400) LDShapes.PenColour (tt "black") While "true For x=-2100 to 9800 step 4 LDGraphicsWindow.Reposition (.6 .6 x, -50 0) Program.Delay (2) an=an-5 endfor Program.Delay (2222) endwhile Sub mww GraphicsWindow.Title="TGV running... 'math.Floor (GraphicsWindow.MouseX) +" : "+math.Floor (GraphicsWindow.MouseY) EndSub End>RBT198.sb< Start>RBT673.sb< ' Calculation by the formula by NaochanON gui() Controls.ButtonClicked=Onbutton Sub Onbutton 'cal="1234.556*98-876/56+(766/87-67/34)*85-654" ' = 120897.7359 'cal="(23.54-98/(-27*36+51)*265-15)+1356/(23-25*32)/3 +65.32" ' =101.4759..... cal= Controls.GetTextBoxText(box1) CNT=0 For i=1 To Text.GetLength(cal) If Text.GetSubText(cal,i,1)=")" Then CNT=CNT+1 EndIf EndFor For kk=1 To CNT rP= Text.GetIndexOf(cal,")") ' right ")" point rightcal=Text.GetSubTextToEnd(cal,rP+1) ' *265-15)+1356/(23-25*32)/3 +65.32 leftcal= Text.GetSubText(cal,1,rP-1) ' (23.54-98/(-27*36+51 For i=Text.GetLength(leftcal) To 0 step -1 If Text.GetSubText(leftcal,i,1)="(" Then lP=i ' Left "(" point i=0 EndIf EndFor midcal= Text.GetSubText(cal,lp+1,rP-lP-1) ' formula in the ( ) ChartoVal() Multidevide() TWresult() Plusminus() Markchange() cal= leftcal+rightcal EndFor midcal=cal ChartoVal() Multidevide() TWresult() Plusminus() controls.SetTextBoxText(box2,"= "+res) ' show Result endsub Sub Markchange leftcal=text.Append(Text.GetSubText(leftcal,1,lP),res) For j= lP To 0 Step -1 If res<0 And Text.GetSubText(leftcal,j,1)="-" Then ' -/(- or -*(- leftcal= Text.Append(Text.GetSubText(leftcal,1,j-1)+"+",Text.GetSubTextToEnd(leftcal,j+1)) leftcal= Text.Append(Text.GetSubText(leftcal,1,lP-1),Text.GetSubTextToEnd(leftcal,lP+2)) j=0 ElseIf res<0 And Text.GetSubText(leftcal,j,1)="+" Then ' +/(- or +*(- leftcal= Text.Append(Text.GetSubText(leftcal,1,j-1)+"-",Text.GetSubTextToEnd(leftcal,j+1)) leftcal= Text.Append(Text.GetSubText(leftcal,1,lP-1),Text.GetSubTextToEnd(leftcal,lP+2)) j=0 ElseIf (res>0 And Text.GetSubText(leftcal,j,1)="-") or (res>0 And Text.GetSubText(leftcal,j,1)="+") Then leftcal= Text.Append(Text.GetSubText(leftcal,1,lP-1),Text.GetSubTextToEnd(leftcal,lP+1)) ' -/(+ or +*(+ j=0 endif EndFor If lP=1 Then leftcal=Text.GetSubTextToEnd(leftcal,lP+1) EndIf EndSub Sub ChartoVal NN=0 MM=0 VL="" Mark="+-*/" Len= Text.GetLength(midcal) For i=1 To Len V= Text.GetSubText(midcal,i,1) If Text.IsSubText(Mark,V)="False" And V<>" " Then Vl=text.Append(Vl,V) ElseIf Text.IsSubText(Mark,V)="True" then NN=NN+1 Val[NN]=VL VL="" MM=MM+1 Function[MM]=V endif EndFor NN=NN+1 Val[NN]=VL ' last value EndSub Sub Multidevide For k=1 To MM If Function[k]="/" Then res=Val[K]/Val[K+1] ' A / B Val[K+1]=res Val[K]="" Function[k]="" ElseIf Function[k]="*" Then res=Val[K]*Val[K+1] ' C*D Val[K+1]=res Val[K]="" Function[k]="" endif EndFor endsub Sub TWresult Newmidcal="" For L=1 To NN Newmidcal=Newmidcal+Val[L]+Function[L] EndFor endsub Sub Plusminus Len= Text.GetLength(Newmidcal) NN=0 MM=0 VL="" For i=1 To Len V= Text.GetSubText(Newmidcal,i,1) If Text.IsSubText("+-",V)="False" Then Vl=text.Append(Vl,V) ElseIf Text.IsSubText("+-",V)="True" then NN=NN+1 NewVal[NN]=VL ' if start mark is "-" then NewVal[1]="" , NewFunction[1]="-" VL="" MM=MM+1 NewFunction[MM]=V endif EndFor NN=NN+1 NewVal[NN]=VL ' last value '---------------------------------------------------------------------------------------- res=0 NewFunction[0]="+" ' if start function is NULL For j=MM To 0 Step -1 If NewFunction[j]="+" Then res=res+newval[j+1] ElseIf NewFunction[j]="-" Then res=res-newval[j+1] EndIf EndFor EndSub Sub gui GraphicsWindow.BackgroundColor="DarkGreen" GraphicsWindow.Width=800 GraphicsWindow.Height=200 GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawText(10,40,"Formula") GraphicsWindow.DrawText(10,120,"Result") GraphicsWindow.BrushColor="Navy" box1= Controls.AddMultiLineTextBox(100,20) Controls.SetSize(box1,675,50) GraphicsWindow.BrushColor="Red" box2= Controls.AddMultiLineTextBox(100,100) Controls.SetSize(box2,675,50) btn= Controls.AddButton("Calc",100,160) EndSub End>RBT673.sb< Start>RBT709.sb< 'Alien chase game for SmallBasic by oldgrandadjoe Jan 2010 'Use the direction keys to move the target site over the alien then shoot using the spacebar. 'x key will pause the site movement. The lazer takes a second or two to recharge between shots. '40 aliens will appear with increasing difficulty, shooting them quickly scores high points. 'Failing to shoot an alien after about 30 secs allows it to escape and you don't score. 'Have fun ! GraphicsWindow.Width = 1000 GraphicsWindow.Height = 600 GraphicsWindow.BackgroundColor = "black" ' Center it on desktop GraphicsWindow.Left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.Top = Desktop.Height / 2 - GraphicsWindow.Height / 2 score = 0 lazer = 100 alienhits = 0 alienesc = 0 rhstext () newscreen () 'load images and sounds alien = ImageList.LoadImage("http://www.iconarchive.com/icons/etherbrian/robot-menace/32/Electroid-icon.png") al = Shapes.AddImage (alien) site = ImageList.LoadImage("http://www.iconarchive.com/icons/calle/smith-and-wesson/32/Target-icon.png") site = Shapes.AddImage (site) Sound.Play ("http://www.a1freesoundeffects.com/popular12008/explosion.mp3") Sound.Stop ("http://www.a1freesoundeffects.com/popular12008/explosion.mp3") Sound.Play ("http://www.a1freesoundeffects.com/popular12008/luger.mp3") Sound.Stop ("http://www.a1freesoundeffects.com/popular12008/luger.mp3") Sound.Play ("http://www.a1freesoundeffects.com/popular12008/fart4.mp3") Sound.Stop ("http://www.a1freesoundeffects.com/popular12008/fart4.mp3") 'Start new alien .............................................................. For runs = 1 To 40 ra = Math.GetRandomNumber(360) 'alien start position x = 500 + (Math.cos (ra) * 280) y = 300 + (Math.Sin (ra) * 280) Shapes.SetOpacity (al, 100) Shapes.SetOpacity (site, 75) xsite = 500 ' site x and y and drawsite ysite = 300 Shapes.Move(site, xsite, ysite) targetw = 32 ' set screen and target targeth = 32 'target width and height Shapes.Move(al, x, y) deltaX = 1 'randomise target direction c = Math.GetRandomNumber(100) If ( c > 50) Then deltaX = - deltaX EndIf deltaY = 1 c = Math.GetRandomNumber(100) If ( c > 50) Then deltaY = - deltaY EndIf maxw = 800 ' max screen for target maxh = 600 For i = 1 To 1000 'move target...................................................main loop. If lazer<100 and num <> 83 then 'charge lazer lazer = lazer + 1 If lazer=100 then GraphicsWindow.BrushColor = "palegreen" GraphicsWindow.FillRectangle(850,340,100,10) endif endif rand = Math.GetRandomNumber(100) ' for random target change direction x = x + deltaX y = y + deltaY If (x + targetw > maxw Or rand = 1) Then ' keep target in bounds or random change deltaX = -1 EndIf If ( x <= 0 Or rand =2) Then deltaX = 1 EndIf If (y + targeth > maxh Or rand =3) Then deltaY = -1 EndIf If ( y <= 0 Or rand = 4) Then deltaY = 1 EndIf targeth = 32+(20-runs) 'set new target size and draw target targetw = 32+(20-runs) Program.Delay(20) Shapes.animate(al, x + (targetw - 32)/2, y + (targeth - 32)/2,1) Shapes.Zoom(al,((32/(12+runs))),((32/(12+runs)))) dxsite = 0 'move site dysite = 0 char = GraphicsWindow.LastKey num = text.GetCharacterCode(char) if num = 82 and xsite < 800 Then dxsite = 2 dysite = 0 EndIf if num = 76 Then dxsite = -2 dysite = 0 EndIf if num = 85 Then dxsite = 0 dysite = -2 EndIf if num = 68 Then dxsite = 0 dysite = 2 EndIf Shapes.animate(site,xsite-12, ysite-12,1) xsite = xsite + dxsite ysite = ysite + dysite 'check for hit and spacebar fire ......................................... char = GraphicsWindow.LastKey 'fire!!!! num = text.GetCharacterCode(char) If num = 83 and lazer = 100 then 'char spacebar = 83 Sound.stop ("http://www.a1freesoundeffects.com/popular12008/luger.mp3") Sound.play ("http://www.a1freesoundeffects.com/popular12008/luger.mp3") Program.Delay (20) lazer=80 GraphicsWindow.BrushColor = "red" GraphicsWindow.FillRectangle(850,340,100,10) if num = 83 Then 'check for hit If xsite + 5 > x And xsite +5 < x + targetw Then If ysite + 5 > y And ysite +5 < y + targeth Then Sound.Stop ("http://www.a1freesoundeffects.com/popular12008/explosion.mp3") Sound.Play ("http://www.a1freesoundeffects.com/popular12008/explosion.mp3") Shapes.SetOpacity (al, 50) Shapes.SetOpacity (site, 25) hitalien = hitalien +1 rhstext () 'circular explosion rad = targeth/80 drad = targeth/2 For exi = 1 To 25 For j = 1 To 100 ra = Math.GetRandomNumber(360) 'angle rd = Math.GetRandomNumber(rad) 'radius ry = (Math.cos (ra) * rd) rx = (Math.Sin (ra) * rd) GraphicsWindow.SetPixel( rx + x+drad, ry + y+drad, "red") GraphicsWindow.SetPixel( rx/2 +x+drad,ry/2 + y+drad, "yellow") endfor rad = rad + drad/4 'sets growth of explosion endfor dscore = 1000 - i score = score + dscore rhstext () Goto bot endif endif EndIf EndIf Program.Delay(5) If i = 1000 then Sound.stop ("http://www.a1freesoundeffects.com/popular12008/fart4.mp3") Sound.play ("http://www.a1freesoundeffects.com/popular12008/fart4.mp3") Program.Delay (100) endif endfor bot: rhstext () EndFor Shapes.SetOpacity (al,0) Shapes.SetOpacity (site,0) Sub rhstext GraphicsWindow.BrushColor = "darkslategray" GraphicsWindow.FillRectangle(800,0,1000,600) GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = 24 GraphicsWindow.DrawText(860,100,"score") GraphicsWindow.DrawText(855,130,score) GraphicsWindow.DrawText(840,200,"alien hits") GraphicsWindow.DrawText(885,230,hitalien) alienesc = runs - hitalien GraphicsWindow.DrawText(820,400,"alien escapes") GraphicsWindow.DrawText(885,430,alienesc) GraphicsWindow.DrawText(870,300,"lazer") if lazer =100 then GraphicsWindow.BrushColor = "palegreen" else GraphicsWindow.BrushColor = "red" endif GraphicsWindow.FillRectangle(850,340,100,10) EndSub Sub newscreen GraphicsWindow.BrushColor = "white" For i = 1 To 100 xstar = Math.GetRandomNumber(800) ystar = Math.GetRandomNumber(600) GraphicsWindow.FillEllipse(xstar,ystar,2,2) EndFor dbig = Math.GetRandomNumber(100)+100 xbig = Math.GetRandomNumber(200)+100 ybig = Math.GetRandomNumber(200) GraphicsWindow.BrushColor = "gray" GraphicsWindow.penColor = "gray" GraphicsWindow.FillEllipse(xbig,ybig,dbig,dbig) GraphicsWindow.drawEllipse(xbig-dbig/2,ybig+dbig/2.4,dbig*2,dbig*.2) EndSub GraphicsWindow.DrawText(830,500,"GAME OVER") End>RBT709.sb< Start>RBV160.sb< 'HexDump Revision 1 'Added scroll capability because a larger file would exceed the buffer 'capacity in the textwindow 'Get file path and read data to string TextWindow.Write("Enter full path of file to dump: ") Filepath=textwindow.Read() ' The following line could be harmful and has been automatically commented. ' Data=File.ReadContents(Filepath) TotalFileLength=text.GetLength(Data) TextWindow.WriteLine("File length is "+TotalFileLength+" characters") 'Make Data copy without line feeds, carriage returns and bells for text side printing For Position=0 to TotalFileLength-1 if Text.GetSubText(Data,Position,1)=Text.GetCharacter(10) or text.getsubtext(Data,Position,1)=text.getcharacter(13) or text.getsubtext(Data,Position,1)=text.getcharacter(7)then DataCopy=Text.Append(DataCopy,Text.GetCharacter(46)) 'Replaces with "." else DataCopy=Text.Append(DataCopy,Text.GetSubText(Data,Position,1)) endif endfor For FilePosition=0 to TotalFileLength-1 Step 16 If (TotalFileLength-1)-FilePosition > 15 then LineLength=15 'Actually 16 because 0 is a position Else LineLength=TotalFileLength-FilePosition-1 endif TextWindow.WriteLine("") 'Every other line on the screen is blank Separator=0 For z = FilePosition To FilePosition+LineLength Separator=Separator+1 If Separator=9 Then TextWindow.Write("- ") endif charactercode=text.GetCharacterCode(Text.GetSubText(Data,z,1)) 'Gets rid of FFFD character code If charactercode = 65533 then charactercode=0 endif 'Start breaking characters into hex UpperHalf=math.Floor(Charactercode/16) UpperHalfCopy=UpperHalf 'Does upper half byte ConvertHexHigher() 'Does lower half byte UpperDecimal=UpperHalfCopy*16 LowerHalf=charactercode-UpperDecimal ConvertHexLower() 'Write full byte + space TextWindow.Write(text.Append(UpperHalf ,LowerHalf+" ")) endfor 'Separates the Hex side from the Decimal spaces=" " If Separator < 9 then spaces=spaces + " " 'Adds 2 spaces for missing separator endif For padding =0 to 16-LineLength spaces=spaces+" " endfor TextWindow.Writeline(spaces+text.GetSubText(DataCopy,FilePosition,LineLength+1)) Buffercount=Buffercount+1 If Buffercount=150 Then TextWindow.WriteLine("Review Buffer. Hit Enter to Continue") TextWindow.Read() Buffercount=0 endif endfor TextWindow.WriteLine("") TextWindow.writeline("Text Window will close by pressing Enter") TextWindow.Read() Program.End() Sub ConvertHexHigher 'Converts upper half byte to hex format If UpperHalf=10 Then UpperHalf="A" ElseIf UpperHalf=11 then UppereHalf="B" elseif UpperHalf=12 then UpperHalf="C" elseif UpperHalf=13 then UpperHalf="D" Elseif UpperHalf=14 then UpperHalf="E" elseif UpperHalf=15 then UpperHalf="F" EndIf EndSub Sub ConvertHexLower 'Converts lower half byte to hex format If LowerHalf=10 Then LowerHalf="A" ElseIf LowerHalf=11 then LowerHalf="B" elseif LowerHalf=12 then LowerHalf="C" elseif LowerHalf=13 then LowerHalf="D" Elseif LowerHalf=14 then LowerHalf="E" elseif LowerHalf=15 then LowerHalf="F" EndIf EndSub End>RBV160.sb< Start>RBV666-0.sb< 'Interface GraphicsWindow.Width = 700 GraphicsWindow.Height = 500 GraphicsWindow.CanResize = "False" GraphicsWindow.DrawRectangle(5,5,700,369) GraphicsWindow.DrawRectangle(5,380,150,120) GraphicsWindow.DrawRectangle(160,380,400,120) GraphicsWindow.DrawRectangle(565,380,140,120) Controls.ButtonClicked = mouseaction GUI() Sub GUI rectangle = Controls.AddButton("Rectangle",25,385) Controls.SetSize(rectangle,100,28) circle = Controls.AddButton("Circle",25,420) Controls.SetSize(circle,100,28) triangle = Controls.AddButton("Triangle",25,455) Controls.SetSize(triangle,100,28) zoom = Controls.AddButton("Zoom",230,420) Controls.SetSize(zoom,70,50) rotate = Controls.AddButton("Rotate",315,420) Controls.SetSize(rotate,70,50) draw = Controls.AddButton("Draw",400,420) Controls.SetSize(draw,70,50) exit = Controls.AddButton("Exit",600,420) Controls.SetSize(exit,70,50) EndSub Sub mouseaction x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY GraphicsWindow.Title=X+" : "+Y ' <---- added to know where mouse is. GraphicsWindow.PenWidth = 5 ' <--- changed If x > 25 And x < 125 Then ' 25+100=125 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.PenColor=GraphicsWindow.BrushColor ' <---- added If y > 455 And y < 483 Then ' 455+28=483 Triangle button draw = 0 j = 0 z = 1 tri = Shapes.AddTriangle(20,20,100,100,150,20) Shapes.Move(tri,80,100) EndIf If y>385 And y<413 Then ' 385+28=413 Rectangle button draw = 0 j = 0 z = 2 rect = Shapes.AddRectangle(100,100) Shapes.Move(rect,250,250) EndIf If y>420 And y<448 Then ' 420+28=448 Circle button draw = 0 j = 0 z = 3 circ = Shapes.AddEllipse(100,100) Shapes.Move(circ,400,150) EndIf EndIf If y>420 And y<470 Then ' 420+50=470 If x>315 And x<385 Then ' 315+70=385 Rotate button draw = 0 If z=1 Then Shapes.Rotate(tri,30 + m) Else If z = 2 Then Shapes.Rotate(rect,30+m) Else If z=3 Then Shapes.Rotate(circ,30+m) EndIf EndIf EndIf m = m+30 EndIf If x>230 And x<300 Then ' 230+70=300 Zoom button draw = 0 i = 0.1 +j If i<0.4 Then If z = 1 Then Shapes.Zoom(tri,1+i,1+i) Else If z = 2 Then Shapes.Zoom(rect,1+i,1+i) Else If z = 3 Then Shapes.Zoom(circ,1+i,1+i) EndIf EndIf EndIf j =j+0.1 EndIf EndIf If x>400 And x<470 Then ' 400+70=470 Draw button draw=1 Paint() EndIf If x>600 And x<670 Then ' 600+70=670 Exit button ' draw=0 ' j=0 ' GraphicsWindow.Clear() ' GraphicsWindow.BrushColor = "Blue" ' unnecessary ' GUI() ' draw = 0 Program.End() EndIf EndIf EndSub Sub Paint If draw = 1 Then GraphicsWindow.MouseMove = Mousedrag Else If Mouse.IsLeftButtonDown Then mouseaction() EndIf EndIf EndSub Sub Mousedrag If draw = 1 Then x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If x>10 And x<600 And y>10 And y<320 Then If Mouse.IsLeftButtonDown Then GraphicsWindow.DrawLine(orgx,orgy,x,y) EndIf EndIf orgx = x orgy = y EndIf EndSub End>RBV666-0.sb< Start>RBV666.sb< 'Interface GraphicsWindow.Width = 700 GraphicsWindow.Height = 500 GraphicsWindow.CanResize = "False" GraphicsWindow.DrawRectangle(5,5,700,369) GraphicsWindow.DrawRectangle(5,380,150,120) GraphicsWindow.DrawRectangle(160,380,400,120) GraphicsWindow.DrawRectangle(565,380,140,120) GUI() Sub GUI rectangle = Controls.AddButton("Rectangle",25,385) Controls.SetSize(rectangle,100,28) circle = Controls.AddButton("Circle",25,420) Controls.SetSize(circle,100,28) triangle = Controls.AddButton("Triangle",25,455) Controls.SetSize(triangle,100,28) zoom = Controls.AddButton("Zoom",230,420) Controls.SetSize(zoom,70,50) rotate = Controls.AddButton("Rotate",315,420) Controls.SetSize(rotate,70,50) draw = Controls.AddButton("Draw",400,420) Controls.SetSize(draw,70,50) exit = Controls.AddButton("Exit",600,420) Controls.SetSize(exit,70,50) EndSub Controls.ButtonClicked = mouseaction Sub mouseaction x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY GraphicsWindow.PenWidth = 1 If x > 40 And x < 160 Then GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() If y > 345 And y < 375 Then draw = 0 j = 0 z = 1 tri = Shapes.AddTriangle(20,20,100,100,150,20) Shapes.Move(tri,80,100) EndIf If y>375 And y<405 Then draw = 0 j = 0 z = 2 rect = Shapes.AddRectangle(100,100) Shapes.Move(rect,250,250) EndIf If y>405 And y<435 Then draw = 0 j = 0 z = 3 circ = Shapes.AddEllipse(100,100) Shapes.Move(circ,400,150) EndIf EndIf If y>360 And y<420 Then If x>230 And x<290 Then draw = 0 If z=1 Then Shapes.Rotate(tri,30 + m) Else If z = 2 Then Shapes.Rotate(rect,30+m) Else If z=3 Then Shapes.Rotate(circ,30+m) EndIf EndIf EndIf m = m+30 EndIf If x>290 And x<390 Then draw = 0 i = 0.1 +j If i<0.4 Then If z = 1 Then Shapes.Zoom(tri,1+i,1+i) Else If z = 2 Then Shapes.Zoom(rect,1+i,1+i) Else If z = 3 Then Shapes.Zoom(circ,1+i,1+i) EndIf EndIf EndIf j =j+0.1 EndIf EndIf If x>390 And x<450 Then draw=1 Paint() EndIf If x>450 And x<510 Then draw=0 j=0 GraphicsWindow.Clear() GraphicsWindow.BrushColor = "Blue" GUI() draw = 0 Program.End() EndIf EndIf EndSub Sub Paint If draw = 1 Then GraphicsWindow.MouseMove = Mousedrag Else If Mouse.IsLeftButtonDown Then mouseaction() EndIf EndIf EndSub Sub Mousedrag If draw = 1 Then x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If x>10 And x<600 And y>10 And y<320 Then If Mouse.IsLeftButtonDown Then GraphicsWindow.DrawLine(orgx,orgy,x,y) EndIf EndIf orgx = x orgy = y EndIf EndSub End>RBV666.sb< Start>RCB976.sb< 'Analogue Clock Created by moorem34, modified to use Shapes by Stendec, 1/3/09 'Later shapes are on top. 'Create hour hand GraphicsWindow.PenWidth = 3 GraphicsWindow.PenColor = "Blue" hourhand = Shapes.AddLine(40,40,80,80) 'Move hour hand into position Shapes.Move(hourhand,120,120) 'Create minute hand GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "Red" minutehand = Shapes.AddLine(51,51,102,102) 'Move minute hand into position Shapes.Move(minutehand,109,109) 'Create second hand GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "White" secondhand = Shapes.AddLine(56,56,112,112) 'Move second hand into position Shapes.Move(secondhand,104,104) 'Fill in centre GraphicsWindow.BrushColor = "White" centre = Shapes.AddEllipse(15,15) Shapes.Move(centre, 153,153) init() drawclockface() 'Run clock until key "q" is hit and endprogram is set to "yes" While (EndProgram <> "yes") sec = Clock.Second min = Clock.Minute 'system clock is military time -adjust hours for 12-hour format If Clock.Hour >= 0 And Clock.Hour <=12 Then hr = Clock.Hour Else hr = Clock.hour-12 EndIf 'only go to subroutines when a new second is present If oldsec <> sec Then seconds() minutes() hours() EndIf oldsec = sec If GraphicsWindow.LastKey = "Q" Then EndProgram = "yes" EndIf EndWhile Program.End() Sub init GraphicsWindow.BackgroundColor="DarkBlue" GraphicsWindow.Width=320 GraphicsWindow.Height=320 GraphicsWindow.Title = "Press 'q' to quit" endsub Sub drawclockface 'Draw the numerals on the face of the clock GraphicsWindow.DrawText(152,60,12) GraphicsWindow.DrawText(204,76,1) GraphicsWindow.DrawText(235,105,2) GraphicsWindow.DrawText(248,151,3) GraphicsWindow.DrawText(232,197,4) GraphicsWindow.DrawText(203,229,5) GraphicsWindow.DrawText(155,245,6) GraphicsWindow.DrawText(112,229,7) GraphicsWindow.DrawText(79,199,8) GraphicsWindow.DrawText(64,153,9) GraphicsWindow.DrawText(72,105,10) GraphicsWindow.DrawText(106,74,11) endsub Sub seconds Shapes.Rotate(secondhand, sec * 6 - 135) Sound.PlayClickAndWait() Endsub Sub minutes Shapes.Rotate(minutehand, (min * 6) + (sec / 10) - 135) Endsub Sub hours Shapes.Rotate(hourhand, (hr * 30) + (min / 2) + (sec / 120) - 135) EndSub End>RCB976.sb< Start>RCH738.sb< ' Floating-point viewer with segment LED ' Copyright (c) 2012 Nonki Takahashi. All right reserved. ' ' History : ' 0.1 2012/07/16 Created. ' GraphicsWindow.Title = "Floating-point viewer 0.1" GraphicsWindow.BackgroundColor = "Silver" nFrac = 6 ' number of fractional digits nExp = 2 ' number of exponential digits x = 10 ' left position for segment LED y = 10 ' top position for segment LED w = 30 ' width of one segment LED h = 60 ' height of segment LED nDigits = nFrac + nExp + 4 ' 3 for a decimal point, E and two signs GraphicsWindow.Width = 2 * x + nDigits * w GraphicsWindow.Height = 3 * y + h + 20 ' 20 means height of textbox GraphicsWindow.BrushColor = "Black" oNum = Controls.AddTextBox(x, 2 * y + h) InitLED() digits = Array.GetAllIndices(seg) Stack.PushValue("local", x) For i = 1 To nDigits n = digits[i] DrawLED() x = x + w EndFor x = Stack.PopValue("local") typed = "False" Controls.TextTyped = OnTextTyped While "True" If typed Then typed = "False" num = Controls.GetTextBoxText(oNum) If Text.GetLength(num) > nDigits Then Num2FP() DrawFP() Else DrawNum() EndIf EndIf EndWhile Sub OnTextTyped typed = "True" EndSub Sub InitLED ' return clrLED - colors for LED ' return seg - table for number to segments ' return segPos - each (relative) position of segment ' return segNames - array of segment names ' return nSegs - number of segments clrLED = "Base=Black;On=Red;Off=#333333;" seg[0] = "a=True;b=True;c=True;d=True;e=True;f=True;" seg[1] = "b=True;c=True;" seg[2] = "a=True;b=True;d=True;e=True;g=True;" seg[3] = "a=True;b=True;c=True;d=True;g=True;" seg[4] = "b=True;c=True;f=True;g=True;" seg[5] = "a=True;c=True;d=True;f=True;g=True;" seg[6] = "a=True;c=True;d=True;e=True;f=True;g=True;" seg[7] = "a=True;b=True;c=True;f=True;" seg[8] = "a=True;b=True;c=True;d=True;e=True;f=True;g=True;" seg[9] = "a=True;b=True;c=True;d=True;f=True;g=True;" seg["A"] = "a=True;b=True;c=True;e=True;f=True;g=True;" seg["B"] = "c=True;d=True;e=True;f=True;g=True;" seg["C"] = "a=True;d=True;e=True;f=True;" seg["D"] = "b=True;c=True;d=True;e=True;g=True;" seg["E"] = "a=True;d=True;e=True;f=True;g=True;" seg["F"] = "a=True;e=True;f=True;g=True;" seg["G"] = "a=True;c=True;d=True;e=True;f=True;" seg["H"] = "b=True;c=True;e=True;f=True;g=True;" seg["I"] = "c=True;" seg["J"] = "b=True;c=True;d=True;" seg["K"] = "a=True;c=True;e=True;f=True;g=True;" seg["L"] = "d=True;e=True;f=True;" seg["M"] = "a=True;b=True;c=True;e=True;f=True;h=True;" seg["N"] = "a=True;b=True;c=True;e=True;f=True;" seg["O"] = "c=True;d=True;e=True;g=True;" seg["P"] = "a=True;b=True;e=True;f=True;g=True;" seg["Q"] = "a=True;b=True;c=True;d=True;e=True;f=True;h=True;" seg["R"] = "e=True;g=True;" seg["S"] = "a=True;c=True;d=True;f=True;g=True;h=True;" seg["T"] = "d=True;e=True;f=True;g=True;" seg["U"] = "b=True;c=True;d=True;e=True;f=True;" seg["V"] = "b=True;f=True;g=True;h=True;" seg["W"] = "b=True;c=True;d=True;e=True;f=True;h=True" seg["X"] = "b=True;c=True;e=True;f=True;g=True;h=True" seg["Y"] = "b=True;c=True;d=True;f=True;g=True;" seg["Z"] = "a=True;b=True;d=True;e=True;g=True;h=True" seg["~"] = "a=True;" seg["-"] = "g=True;" seg["_"] = "d=True;" seg["?"] = "a=True;b=True;g=True;h=True;" seg["."] = "h=True;" seg["!"] = "b=True;h=True;" seg["/"] = "b=True;e=True;g=True;" segPos["a"] = "x=0.2;y=0.05;w=0.6;h=0.05;" segPos["b"] = "x=0.8;y=0.1;w=0.1;h=0.375;" segPos["c"] = "x=0.8;y=0.525;w=0.1;h=0.375;" segPos["d"] = "x=0.2;y=0.9;w=0.6;h=0.05;" segPos["e"] = "x=0.1;y=0.525;w=0.1;h=0.375;" segPos["f"] = "x=0.1;y=0.1;w=0.1;h=0.375;" segPos["g"] = "x=0.2;y=0.475;w=0.6;h=0.05;" segPos["h"] = "x=0.45;y=0.8;w=0.1;h=0.05;" segNames = Array.GetAllIndices(segPos) nSegs = Array.GetItemCount(segPos) EndSub Sub DrawLED ' param x, y - position ' param w, h - size ' param n - number 0..9 Stack.PushValue("local", i) GraphicsWindow.BrushColor = clrLED["Base"] GraphicsWindow.FillRectangle(x, y, w, h) GraphicsWindow.BrushColor = clrLED["Off"] For i = 1 To nSegs If seg[n][segNames[i]] Then GraphicsWindow.BrushColor = clrLED["On"] Else GraphicsWindow.BrushColor = clrLED["Off"] EndIf xs = x + segPos[segNames[i]]["x"] * w ys = y + segPos[segNames[i]]["y"] * h ws = w * segPos[segNames[i]]["w"] hs = h * segPos[segNames[i]]["h"] GraphicsWindow.FillRectangle(xs, ys, ws, hs) EndFor i = Stack.PopValue("local") EndSub Sub DrawNum ' param num len = Text.GetLength(num) If len > nDigits Then num = "ERR1" ' Error 1 : overflow TextWindow.WriteLine("ERR2:len=" + len) len = 4 EndIf Stack.PushValue("local", x) For i = 1 To len n = Text.GetSubText(num, i, 1) DrawLED() x = x + w EndFor For i = len + 1 To nDigits n = "" DrawLED() x = x + w EndFor x = Stack.PopValue("local") EndSub Sub DrawFP ' param fp - floating point number Stack.PushValue("local", num) num = fp DrawNum() num = Stack.PopValue("local") EndSub Sub Num2FP ' param num ' param nFrac ' param nExp ' return fp numAbs = Math.Abs(num) sign = num / numAbs exp = Math.Floor(Math.Log(numAbs)) If Text.GetLength(Math.Abs(exp)) > nExp Then fp = "ERR2" ' Error 2 : exponential part overflow TextWindow.WriteLine("ERR2:exp=" + exp) Goto exit EndIf frac = Math.Floor(numAbs * Math.Power(10, nFrac - 1 - exp)) frac = frac / Math.Power(10, nFrac - 1) fp = (sign * frac) + "E" + exp exit: EndSub End>RCH738.sb< Start>RCL646.sb< ''''' countdown and timer ' idea: absolu upgraded: WhTurner 2013-03-11 GraphicsWindow.Width = 1000 GraphicsWindow.Height = 300 GraphicsWindow.Left =(Desktop.Width / 2) - (GraphicsWindow.Width / 2) GraphicsWindow.Top =(Desktop.Height / 2) - (GraphicsWindow.Height / 2) GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "COUNTDOWN" GraphicsWindow.BackgroundColor = "black" GraphicsWindow.FontName = "DS-Digital" Std() strt=0 GraphicsWindow.DrawText(160,20,"Input startingtime / clocktime") GraphicsWindow.DrawText(180,45,"h:") GraphicsWindow.DrawText(245,45,"m:") GraphicsWindow.DrawText(320,45,"s:") BX1=Controls.AddTextBox(200,45) Controls.SetSize(BX1,40,30) BX2=Controls.AddTextBox(270,45) Controls.SetSize(BX2,40,30) BX3=Controls.AddTextBox(340,45) Controls.SetSize(BX3,40,30) B01=Controls.AddButton("Start countdown",10,10) B02=Controls.AddButton("Run to clocktime",10,45) B03=Controls.AddButton("Run Timer from start",10,80) Controls.ButtonClicked=Btn While strt=0 endwhile '' now running deltah=Controls.GetTextBoxText(BX1) deltam=Controls.GetTextBoxText(BX2) deltas=Controls.GetTextBoxText(BX3) GraphicsWindow.Clear() If strt=1 then ''countdown B1=Controls.AddButton("Pause",100,0) B9=Controls.AddButton("Reset",200,0) elseif strt=2 then ''countdown to clock deltah=deltah-Clock.Hour If deltah<0 then deltah=deltah+24 endif deltam=deltam-Clock.Minute If deltah=0 and deltam<0 then deltah=deltah+23 deltam=deltam+60 endif deltas=deltas-Clock.Second strt=1 elseif strt=-1 then ''timer GraphicsWindow.Title = " T I M E R" B1=Controls.AddButton("Pause",100,0) B9=Controls.AddButton("Reset",200,0) endif Bexit=Controls.AddButton("Exit",300,0) Big() deltat=3600*deltah+60*deltam+deltas update() Timer.Interval=1000 Timer.Tick=update Sub Btn If Controls.LastClickedButton=B01 Then strt=1 ElseIf Controls.LastClickedButton=B02 then strt=2 ElseIf Controls.LastClickedButton=B03 then strt=-1 elseif controls.LastClickedButton=B1 Then Timer.Pause() Std() B2= Controls.AddButton(" Cont ",100,0) ElseIf Controls.LastClickedButton=B2 then Timer.Resume() Std() B1=controls.AddButton("Pause",100,0) Big() elseif Controls.LastClickedButton=B9 then deltat=3600*deltah+60*deltam+deltas+strt Big() update() elseif Controls.LastClickedButton=Bexit then Program.End() endif Timer.Tick=Update EndSub Sub update GraphicsWindow.BrushColor="Black" GraphicsWindow.FillRectangle(20,50,960,200) GraphicsWindow.BrushColor="Red" deltat=deltat-strt If deltat>=0 then h="x "+math.Floor(deltat/3600) h=text.GetSubTextToEnd(h,text.GetLength(h)-1) m=Text.GetSubTextToEnd(100+Math.Floor(deltat/60)-60*h,2) s= Text.GetSubTextToEnd(100+deltat-3600*h-60*m,2) GraphicsWindow.DrawText (40,20, h+":"+m+":"+s) Else ala=0 Timer.Tick=Alarm endif EndSub Sub Big '' set big red characters GraphicsWindow.BrushColor = "red" GraphicsWindow.FontSize = 200 EndSub Sub Std '' set standard characters GraphicsWindow.BrushColor = "Green" GraphicsWindow.FontSize = 15 EndSub Sub Alarm If Ala=0 Then ala=1 GraphicsWindow.DrawText(80,20,"ALARM") Sound.PlayMusic("C8 F4 C8") Else ala=0 GraphicsWindow.BrushColor="Black" GraphicsWindow.FillRectangle(20,10,960,200) GraphicsWindow.BrushColor="Red" EndIf EndSub End>RCL646.sb< Start>RCP237.sb< ' SmallBasic Version 1.1 ' Program: WavelengthRGB (380 - 700 nm), Frequ [THz] (Energie [eV], Temp [K] von E therm. QuMe) ' Changelog: 15.08 ' Author: Pappa Lapub ' Website: ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: 380 - 700 nm (delta 320 nm) ' http://www.miguelmoreno.net/wavelength-to-colors-in-silverlight/ (01-2010) ' https://web.archive.org/web/20130228010145/http://miguelmoreno.net/sandbox/wavelengthtoRGB/default.aspx (C#, 09-2004) ' https://web.archive.org/web/*/http://miguelmoreno.net/sandbox/wavelengthToRGB/wavelengthToRGB.zip (C#) ' http://www.expertcore.org/viewtopic.php?f=12&t=3072 (C#, 02-2012, wavelengthToRGB.zip) ' ' http://www.midnightkite.com/color.html ' http://www.physics.sfasu.edu/astro/color/spectra.html ' Variables: ' ToDo: ' ================================================================================ self = "WavelengthRGB" icoPath = "" ' Program.Directory +"\Icons\SpectrumLR.ico" 'DSOTM.ico" gw = 220 gh = 170 lf = Text.GetCharacter(10) args = "" ' LDCall preset BuildGUI() OnSliderChange() LDControls.SliderChanged = OnSliderChange GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown LDEvents.MouseWheel = OnWheelChange ' ////////// EVENTs \\\\\\\\\\ Sub OnSliderChange value = LDControls.LastSliderValue waveLen = Math.Round(380 + 3.2 * value) ' [nm] EE-9 freq = Math.Round(299792.458 / waveLen) ' f = c/λ [THz] EE12, c = 299792258 [m/s] 'egy = Math.Round(0.4135667516 * freq)/100 ' E = hf, h = 4.135 667 516EE−15 [eV*s] , in QuMech ! 'tmp = Math.Round(100000 * egy / 8.6173324) ' T = E/kB, kB = 8.6173324EE−5 [eV/K] , in QuMech ! Shapes.SetText(shpWL, waveLen +" [nm] "+ freq +" [THz]") 'Shapes.SetText(shpEgyTmp, egy +" [eV] " + tmp +" [K]") GetColor() LDShapes.BrushColour(rect, hCol) Shapes.SetText("Text"+1, "R: " + r) Shapes.SetText("Text"+2, "G: " + g) Shapes.SetText("Text"+3, "B: " + b) Shapes.SetText("Text"+4, "C: " + hCol) EndSub Sub OnWheelChange dir = LDEvents.LastMouseWheelDelta If value+dir > 100 Or value+dir < 0 Then Else value = value + dir LDControls.SliderValue(slider, value) EndIf EndSub Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "C" Then clip["nm"] = waveLen clip["rgb"] = r +","+ g +"," +b clip["hex"] = hCol If LDClipboard.SetText(clip) = "SUCCESS" Then ClipInfo() EndIf ElseIf lastKey = "I" Then imgCol = LDGraphicsWindow.Capture("","") LDImage.Crop(imgCol, 110,60, 100,100) If LDClipboard.SetImage(imgCol) = "SUCCESS" Then ClipInfo() EndIf EndIf EndSub Sub OnMouseDown If Mouse.IsRightButtonDown Then tab = Text.GetCharacter(9) qu = Text.GetCharacter(34) hlpTxt = "Determine RGB Color for wavelengths from 380 to 700 nm." +lf+lf hlpTxt = hlpTxt+ "Keys:" +lf hlpTxt = hlpTxt+ "" +tab+ "Copy values to clipboard as array:" +lf hlpTxt = hlpTxt+tab +" "+ qu+"nm=waveLen;rgb=R,G,B;hex=#color;"+qu +"."+lf hlpTxt = hlpTxt+ "" +tab+ "Copy color pattern to clipboard (100x100 Image)." +lf hlpTxt = hlpTxt+ "" +tab+ "Exit" +lf+lf hlpTxt = hlpTxt+ "L-Click" +tab+ "(Un)Dock window." +lf hlpTxt = hlpTxt+ "R-Click" +tab+ "This help." +lf hlpTxt = hlpTxt+ "Wheel" +tab+ "Slider ↔." GraphicsWindow.ShowMessage(hlpTxt, self) ElseIf Mouse.IsLeftButtonDown Then If docked Then GraphicsWindow.Left = gwX Shapes.HideShape(shpDock) LDGraphicsWindow.ExitButtonMode(self,"Enabled") LDGraphicsWindow.TopMost = "" docked = "" Else ' oder GW.Left > 0 gwX = GraphicsWindow.Left GraphicsWindow.Left = 20-gw LDGraphicsWindow.TopMost = "True" LDGraphicsWindow.ExitButtonMode(self,"Disabled") Shapes.ShowShape(shpDock) docked = "True" EndIf 'Else '' middle Button unused ' ?? empty Option EndIf EndSub ' ////////// SUBs \\\\\\\\\\ Sub BuildGUI GraphicsWindow.Hide() GraphicsWindow.CanResize = "" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Gainsboro" GraphicsWindow.Title = self ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(icoPath) Then LDGraphicsWindow.Icon = icoPath EndIf LDGraphicsWindow.TopMost = "True" slider = LDControls.AddSlider(200,22, "H") Controls.Move(slider, 10,10) gradCols = "1=DarkViolet;2=Indigo;3=Blue;4=Lime;5=Yellow;6=Orange;7=Red;" '"1=Violet; LDShapes.BrushShape(slider, LDShapes.BrushGradient(gradCols, "H")) GraphicsWindow.PenWidth = 0 rect = Shapes.AddRectangle(100,100) Shapes.Move(rect, 110, 60) GraphicsWindow.BrushColor = "Black" For n = 1 To 4 Shapes.AddText("") Shapes.Move("Text"+n, 10, 70 + 22*(n-1)) EndFor GraphicsWindow.FontSize = 10 shpWL = Shapes.AddText("") Shapes.Move(shpWL, 110,47) shpEgyTmp = Shapes.AddText("") Shapes.Move(shpEgyTmp, 110,147) GraphicsWindow.BrushColor = "Red" shpClip = Shapes.AddText("Copied") LDShapes.BrushColour(shpClip, "Yellow") Shapes.Move(shpClip, 10,155) Shapes.SetOpacity(shpClip, 0) GraphicsWindow.FontSize = 8 GraphicsWindow.DrawText(200,34, "IR→") GraphicsWindow.BrushColor = "DarkViolet" GraphicsWindow.DrawText(3,34, "←UV") '' Docking shape For n = 1 To Text.GetLength(self) dockTxt = Text.Append(dockTxt, " "+Text.GetSubText(self,n,1)+" "+lf) EndFor GraphicsWindow.BrushColor = "Black" '"Yellow" GraphicsWindow.FontSize = 11 shpDock = Shapes.AddText(dockTxt) LDShapes.BrushColour(shpDock, "Fuchsia") '"Black") Shapes.Move(shpDock, gw-23,0) Shapes.HideShape(shpDock) GraphicsWindow.Show() EndSub Sub GetColor gamma = 1 intensityMax = 255 If (waveLen >= 350 And waveLen <= 439) Then red = -(waveLen - 440) / 90 '(440 - 350) green = 0 blue = 1 ElseIf (waveLen >= 440 And waveLen <= 489) Then red = 0 green = (waveLen - 440) / 50 '(490 - 440) blue = 1 ElseIf (waveLen >= 490 And waveLen <= 509) Then red = 0 green = 1 blue = -(waveLen - 510) / 20 ' (510 - 490) ElseIf (waveLen >= 510 And waveLen <= 579) Then red = (waveLen - 510) / 70 ' (580 - 510) green = 1 blue = 0 ElseIf (waveLen >= 580 And waveLen <= 644) Then red = 1 green = -(waveLen - 645) / 65 ' (645 - 580) blue = 0 ElseIf (waveLen >= 645 And waveLen <= 780) Then red = 1 green = 0 blue = 0 Else red = 0 green = 0 blue = 0 EndIf If (waveLen >= 350 And waveLen <= 419) Then factor = 0.3 + 0.7*(waveLen - 350) / 70 ' (420 - 350) ElseIf (waveLen >= 420 And waveLen <= 700) Then factor = 1 ElseIf (waveLen >= 701 And waveLen <= 780) Then factor = 0.3 + 0.7*(780 - waveLen) / 80 ' (780 - 700) Else factor = 0 EndIf r = LDCall.Function4("FactorAdjust", red, factor, intensityMax, gamma) g = LDCall.Function4("FactorAdjust", green, factor, intensityMax, gamma) b = LDCall.Function4("FactorAdjust", blue, factor, intensityMax, gamma) hCol = GraphicsWindow.GetColorFromRGB(r, g, b) EndSub Sub FactorAdjust If args[1] = 0 Then return = 0 Else return = Math.Round(args[3] * Math.Power(args[1] * args[2], args[4])) EndIf EndSub Sub ClipInfo For opac = 0 To 100 Step 10 Shapes.SetOpacity(shpClip, opac) Program.Delay(100) EndFor For opac = 100 To 0 Step -10 Shapes.SetOpacity(shpClip, opac) Program.Delay(100) EndFor EndSub End>RCP237.sb< Start>RCP391.sb< TextWindow.WriteLine("Hello. I will count your money.") TextWindow.WriteLine("How many dollar coins do you have?") dollarcoins = TextWindow.Read() TextWindow.WriteLine("How many half dollars do you have?") halfdollars = TextWindow.Read() TextWindow.WriteLine("How many quarters do you have?") quarters = TextWindow.Read() TextWindow.WriteLine("How many dimes do you have?") dimes = TextWindow.Read() TextWindow.WriteLine("How many nickels do you have?") nickels = TextWindow.Read() TextWindow.WriteLine("How many pennies do you have?") pennies = TextWindow.Read() cents = (dollarcoins * 100) + (halfdollars * 50) + (qaurters * 25) + (dimes * 10) + (nickels * 5) + pennies TextWindow.WriteLine("You have " + cents + "¢ in coins according to the amounts you entered.") End>RCP391.sb< Start>RCQ916-0.sb< ' mahreen miangul GraphicsWindow.Width = 1080 GraphicsWindow.Height = 420 GraphicsWindow.BackgroundColor = "BurlyWood" shape[1] = "func=rect;x=497;y=113;width=22;height=66;bc=red;pc=yellow;" shape[2] = "func=ell;x=478;y=55;width=60;height=60;bc=yellow;pc=red;" ' <------ shape[3] = "func=ell;x=481;y=70;width=16;height=32;bc=blue;pc=green;" ' <------ shape[4] = "func=ell;x=519;y=70;width=16;height=32;bc=green;pc=blue;" ' <------ shape[5] = "func=line;x1=496;y1=179;x2=480;y2=198;pc=yellowgreen;" ' <------ shape[6] = "func=line;x1=518;y1=177;x2=533;y2=199;pc=greenyellow;" ' <------ s=1 GraphicsWindow.Width=1000 for i=1 To 6 ' <------ GraphicsWindow.BrushColor = shape[i]["bc"] ' brushcolor GraphicsWindow.penColor = shape[i]["pc"] ' pencolor ' <------ If shape[i]["func"]="ell" Then shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s) ' ellipse ElseIf shape[i]["func"]="rect" Then shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s) ' rectangle ElseIf shape[i]["func"]="line" Then ' <---------line shp[i] = Shapes.Addline(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s) ' <---------line EndIf Shapes.Rotate(shp[i], Shape[i]["angle"]) ' <-------- rotating angle Shapes.Animate(shp[i], shape[i]["x"]*s, shape[i]["y"]*s, 500) EndFor End>RCQ916-0.sb< Start>RCQ916.sb< ' mahreen miangul GraphicsWindow.Width = 1080 GraphicsWindow.Height = 420 GraphicsWindow.BackgroundColor = "BurlyWood" shape[1] = "func=rect;x=497;y=113;width=22;height=66;bc=red;pc=yellow;" shape[2] = "func=ell;x=478;y=55;width=60;height=60;bc=yellow;pc=red;" shape[3] = "func=ell;x=481;y=70width=16;height=32'bc=blue;pc=green;" shape[4] = "func=ell;x=519;y=70width=16;height=32;bc=green;pc=blue;" shape[5] = "func=line;x=496;y=179;width=480;height=198;pc=yellowgreen;" shape[6] = "func=line;x=518;y=177;width=533;height=199;pc=greenyellow;" s=1 GraphicsWindow.Width=1000 for i=78 To 112 GraphicsWindow.BrushColor = shape[i]["bc"] ' brushcolor GraphicsWindow.penColor = shape[i]["pw"] ' pencolor If shape[i]["func"]="ell" Then shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s) ' ellipse ElseIf shape[i]["func"]="rect" Then shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s) ' rectangle EndIf Shapes.Rotate(shp[i], Shape[i]["angle"]) ' <-------- rotating angle Shapes.Animate(shp[i], shape[i]["x"]*s, shape[i]["y"]*s, 500) EndFor End>RCQ916.sb< Start>RCR541.sb< sides = 100 ' must be greater than 50 for circle length = 400 Turtle.Speed = 10 For x = 1 to 1000 if length = 0 Then Goto break endif For i = 1 To sides Turtle.Move(length / sides) Turtle.Turn(360 / sides) EndFor length = length - 10 EndFor break: End>RCR541.sb< Start>RCS876.sb< '3D WireFrame Maze 'by David R. Crutchfield (a.k.a. Pathdrc) 'Version: 1.0 'Date: 1/16/2010 GraphicsWindow.BackgroundColor="Black" GraphicsWindow.Height = 600 GraphicsWindow.Width = 800 GraphicsWindow.Show() GraphicsWindow.KeyDown = ReadKey 'Information frame on left GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.FillRectangle(0,0,200,600) '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,"Turn left = Left Arrow") GraphicsWindow.DrawText(5,280,"Turn right = Right Arrow") GraphicsWindow.DrawText(5,320,"To start over = Back Space") GraphicsWindow.DrawText(5,340,"End program = Esc") 'draw box around Maze-View window on the right GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawRectangle(200,0,600,600) 'Map data ' In advanced version there will be a MapWidth and MapHeight variable ' to know how much to read from map data file. ' (Map data file will be created by a Map Maker program. That program ' will allow users to create their own maps - future versions will allow for ' placement of RPG type components like monsters and treasure.) StartX = 5 StartY = 10 StartFacing = 1 Array.SetValue("mapdata",1,"00011100000000") Array.SetValue("mapdata",2,"00010100000000") Array.SetValue("mapdata",3,"00010111111111") Array.SetValue("mapdata",4,"00010100000001") Array.SetValue("mapdata",5,"0001011111110111111111111111") Array.SetValue("mapdata",6,"0001000000000000000000000001") Array.SetValue("mapdata",7,"0111011111110111111111111111") Array.SetValue("mapdata",8,"01000100000001") Array.SetValue("mapdata",9,"01110101111101") Array.SetValue("mapdata",10,"00010100000001") Array.SetValue("mapdata",11,"00011111111111") 'Setup variables CurrentX = StartX CurrentY = StartY Facing = StartFacing '1 = north/up, 2 = east/right, 3 = south/down, 4 = west/left Main = "True" 'Start main program While (Main) DrawWalls() DisplayCurrentXY() 'show coordinates in information frame. loop = "True" keyisupdated = "False" WaitForKeyDownAndProcess() EndWhile Program.End() Sub WaitForKeyDownAndProcess While (loop) If (keyisupdated = "True") Then If (key = "Up") Then 'test if wall is blocking forward movement If NoForward = "True" Then HitWall() keyisupdated = "False" Else loop = "False" 'find facing and update current position based on forward movement. If Facing = 1 Then CurrentY = CurrentY - 2 ElseIf Facing = 2 Then CurrentX = CurrentX + 2 ElseIf Facing = 3 Then CurrentY = CurrentY + 2 ElseIf Facing = 4 Then CurrentX = CurrentX - 2 EndIf EndIf EndIf If key = "Left" Then NoForward = "False" loop = "False" Facing = Facing - 1 If Facing < 1 Then Facing = 4 Endif EndIf If key = "Right" Then NoForward = "False" loop = "False" Facing = Facing + 1 If Facing > 4 Then Facing = 1 EndIf EndIf If key = "Down" Then loop = "False" 'Make sure no wall behind you and then move back one. If Facing = 1 and Text.GetSubText(Array.GetValue("mapdata",CurrentY + 1),CurrentX,1) = 0 Then CurrentY = CurrentY + 2 ElseIf Facing = 2 and Text.GetSubText(Array.GetValue("mapdata",CurrentY),CurrentX - 1,1) = 0 Then CurrentX = CurrentX - 2 ElseIf Facing = 3 and Text.GetSubText(Array.GetValue("mapdata",CurrentY - 1),CurrentX,1) = 0 Then CurrentY = CurrentY - 2 ElseIf Facing = 4 and Text.GetSubText(Array.GetValue("mapdata",CurrentY),CurrentX + 1,1) = 0 Then CurrentX = CurrentX + 2 Else HitWall() EndIf keyisupdated = "False" EndIf If key = "Back" Then loop = "False" keyisupdated = "False" RestartMazeQuestion() EndIf If (key = "Escape") Then Main = "False" loop = "False" EndIf EndIf EndWhile keyisupdated = "False" Sound.PlayClickAndWait() EndSub Sub DrawWalls EraseMazeWalls() 'determine walls For fm = 0 to 4 WallSection1 = 0 WallSection2 = 0 WallSection3 = 0 ' facing north/south If Facing = 1 Or Facing = 3 Then If Facing = 1 then wd = 1 Else wd = -1 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY - (fm * 2 * wd)),CurrentX - wd,1) = 1 Then WallSection1 = 1 ElseIf Text.GetSubText(Array.GetValue("mapdata",CurrentY - (fm * 2 * wd + wd)),CurrentX - (2 * wd),1) = 1 Then WallSection1 = 2 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY - (fm * 2 * wd + wd)),CurrentX,1) = 1 Then WallSection2 = 1 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY - (fm * 2 * wd)),CurrentX + wd,1) = 1 Then WallSection3 = 1 ElseIf Text.GetSubText(Array.GetValue("mapdata",CurrentY-(fm * 2 * wd + (1 * wd))),CurrentX + (2 * wd),1) = 1 Then WallSection3 = 2 EndIf EndIf ' facing east/west If Facing = 2 Or Facing = 4 Then If Facing = 2 then wd = 1 Else wd = -1 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY - (1 * wd)),CurrentX + (fm * 2 * wd),1) = 1 Then WallSection1 = 1 ElseIf Text.GetSubText(Array.GetValue("mapdata",CurrentY - (2 * wd)),CurrentX + (fm * 2 * wd + (1 * wd)),1) = 1 Then WallSection1 = 2 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY),CurrentX + (fm * 2 * wd + (1 * wd)),1) = 1 Then WallSection2 = 1 EndIf If Text.GetSubText(Array.GetValue("mapdata",CurrentY + (1 * wd)),CurrentX + (fm * 2 * wd),1) = 1 Then WallSection3 = 1 ElseIf Text.GetSubText(Array.GetValue("mapdata",CurrentY + (2 * wd)),CurrentX + (fm * 2 * wd + (1 * wd)),1) = 1 Then WallSection3 = 2 EndIf EndIf 'draw the walls GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 2 If fm = 0 Then ' immediate If WallSection1 = 1 Then GraphicsWindow.DrawLine(200,0,240,40) GraphicsWindow.DrawLine(240,40,240,560) GraphicsWindow.DrawLine(240,560,200,600) EndIf If WallSection1 = 2 Then GraphicsWindow.DrawLine(200,40,240,40) GraphicsWindow.DrawLine(240,40,240,560) GraphicsWindow.DrawLine(240,560,200,560) EndIf If WallSection2 = 1 Then GraphicsWindow.DrawLine(240,40,240,560) GraphicsWindow.DrawLine(240,560,760,560) GraphicsWindow.DrawLine(760,560,760,40) GraphicsWindow.DrawLine(760,40,240,40) fm = 4 'end wall drawing because you can't see any further NoForward = "true" EndIf If WallSection3 = 1 Then GraphicsWindow.DrawLine(800,0,760,40) GraphicsWindow.DrawLine(760,40,760,560) GraphicsWindow.DrawLine(760,560,800,600) EndIf If WallSection3 = 2 Then GraphicsWindow.DrawLine(800,40,760,40) GraphicsWindow.DrawLine(760,40,760,560) GraphicsWindow.DrawLine(760,560,800,560) EndIf Else ' greater than immediate WallSize = 80 WallPositionLeftX = 240 WallPositionRightX = 760 WallPositionTopY = 40 WallPositionBottomY =560 If fm > 1 Then For count = 1 To fm-1 WallPositionLeftX = WallPositionLeftX + WallSize WallPositionRightX = WallPositionRightX - WallSize WallPositionTopY = WallPositionTopY + WallSize WallPositionBottomY = WallPositionBottomY - WallSize WallSize = WallSize - Math.Round(WallSize / 4) EndFor EndIf If WallSection1 = 1 Then GraphicsWindow.DrawLine(WallPositionLeftX,WallPositionTopY,WallPositionLeftX + WallSize,WallPositionTopY + WallSize) GraphicsWindow.DrawLine(WallPositionLeftX + WallSize,WallPositionTopY + WallSize,WallPositionLeftX + WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallpositionLeftX + WallSize,WallPositionBottomY - WallSize,WallPositionLeftX,WallPositionBottomY) GraphicsWindow.DrawLine(WallPositionLeftX,WallPositionBottomY,WallPositionLeftX,WallPositionTopY) EndIf If WallSection1 = 2 Then GraphicsWindow.DrawLine(WallPositionLeftX,WallPositionTopY + WallSize,WallPositionLeftX + WallSize,WallPositionTopY + WallSize) GraphicsWindow.DrawLine(WallPositionLeftX + WallSize,WallPositionTopY + WallSize,WallPositionLeftX + WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallpositionLeftX + WallSize,WallPositionBottomY - WallSize,WallPositionLeftX,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallPositionLeftX,WallPositionBottomY - WallSize,WallPositionLeftX,WallPositionTopY + WallSize) EndIf If WallSection2 = 1 Then GraphicsWindow.DrawLine(WallPositionLeftX + WallSize,WallPositionTopY + WallSize,WallPositionRightX - WallSize,WallPositionTopY + WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionTopY + WallSize,WallPositionRightX - WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionBottomY - WallSize,WallpositionLeftX + WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallpositionLeftX + WallSize,WallPositionBottomY - WallSize,WallPositionLeftX + WallSize,WallPositionTopY + WallSize) fm = 4 'end wall drawing because you can't see any further EndIf If WallSection3 = 1 Then GraphicsWindow.DrawLine(WallPositionRightX,WallPositionTopY,WallPositionRightX - WallSize,WallPositionTopY + WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionTopY + WallSize,WallPositionRightX - WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionBottomY - WallSize,WallPositionRightX,WallPositionBottomY) GraphicsWindow.DrawLine(WallPositionRightX,WallPositionBottomY,WallPositionRightX,WallPositionTopY) EndIf If WallSection3 = 2 Then GraphicsWindow.DrawLine(WallPositionRightX,WallPositionTopY + WallSize,WallPositionRightX - WallSize,WallPositionTopY + WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionTopY + WallSize,WallPositionRightX - WallSize,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallPositionRightX - WallSize,WallPositionBottomY - WallSize,WallPositionRightX,WallPositionBottomY - WallSize) GraphicsWindow.DrawLine(WallPositionRightX,WallPositionBottomY - WallSize,WallPositionRightX,WallPositionTopY + WallSize) EndIf EndIf EndFor EndSub Sub HitWall GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(483,295,"Ouch!") 'play sound to indicate hit wall Sound.PlayAndWait("C:\WINDOWS\Media\Windows XP Battery Low.wav") Sound.Stop("C:\WINDOWS\Media\Windows XP Battery Low.wav") '[TODO]'s 'maybe put "OUCH" in maze view 'put message in information frame that you ran into a wall '(IDEA: when secret walls are implemented, make some sound like magic or "swush" like sound when walking through secret wall) 'Note: be sure to clear both messages once a succesful Forward, left, right, or back move has been made. EndSub Sub ReadKey key = GraphicsWindow.LastKey keyisupdated = "True" EndSub Sub EraseMazeWalls 'erase walls from maze-view window GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenWidth = 2 GraphicsWindow.FillRectangle(202,2,596,596) 'draw box around Maze-View window on the right GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawRectangle(200,0,600,600) EndSub Sub DisplayCurrentXY 'erase old coordinates GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.FillRectangle(48,95,110,45) 'display new coordinates GraphicsWindow.BrushColor = "Black" tempX = (CurrentX - 1) / 2 tempY = (CurrentY) / 2 CoordinatesText = "X = " + tempX + " Y = " + tempY DirectionText = "Facing: " If Facing = 1 Then DirectionText = DirectionText + "North" ElseIf Facing = 2 Then DirectionText = DirectionText + "East" ElseIf Facing = 3 Then DirectionText = DirectionText + "South" Else DirectionText = DirectionText + "West" EndIf GraphicsWindow.DrawText(48,95,CoordinatesText) GraphicsWindow.DrawText(48,110,DirectionText) EndSub Sub RestartMazeQuestion RestartMazeQuestionAnswered = "False" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(5,400,"You pressed the Backspace key.") GraphicsWindow.DrawText(5,415,"Do you really wish to restart") GraphicsWindow.DrawText(5,430,"the maze?") While (RestartMazeQuestionAnswered = "False") If text.ConvertToLowerCase(key) = "y" Then CurrentX = StartX CurrentY = StartY Facing = StartFacing RestartMazeQuestionAnswered = "True" ElseIf text.ConvertToLowerCase(key) = "n" Then RestartMazeQuestionAnswered = "True" EndIf EndWhile 'erase Restart Maze message GraphicsWindow.BrushColor = "Gainsboro" GraphicsWindow.FillRectangle(5,400,195,595) EndSub End>RCS876.sb< Start>RCV502.sb< GraphicsWindow.BackgroundColor="teal GraphicsWindow.BrushColor="orange GraphicsWindow.Title ="Brickout GraphicsWindow.Width =950 hp[1][1]=0 hp[1][2]=0 hp[2][1]=40 hp[2][2]=0 hp[3][1]=55 hp[3][2]=-10 hp[4][1]=15 hp[4][2]=-10 vp[1][1]=0 vp[1][2]=0 vp[2][1]=0 vp[2][2]=20 vp[3][1]=15 vp[3][2]=10 vp[4][1]=15 vp[4][2]=-10 For y=1 To 8 x=1 GraphicsWindow.PenWidth =0 rr=math.Remainder (y 2)*20 For f=1 To 20 h[y][f]=LDShapes.AddPolygon (hp) v[y][f]=LDShapes.AddPolygon (vp) LDShapes.BrushColour ( h[y][f] "brown") LDShapes.BrushColour ( v[y][f] "black") s[y][f]=Shapes.AddRectangle (40 20) Shapes.Move (s[y][f] x*42+rr 300-y*22) Shapes.Move (h[y][f] x*42+rr 300-y*22) Shapes.Move (v[y][f] x*42+40+rr 300-y*22) x=x+1 EndFor EndFor for y=8 to 1 Step -1 For r=1 To 20 ww[r]=1 EndFor For f=1 To 20 Program.Delay (30+Math.GetRandomNumber (220)) tt: fi=math.GetRandomNumber (20) If ww[fi]=0 Then Goto tt Endif LDEffect.DropShaddow (s[y][fi] "direction=45") Shapes.Animate (s[y][fi] 300 600 2000) Shapes.Remove (v[y][fi]) Shapes.Remove (h[y][fi]) ww[fi]=ww[fi]-1 EndFor If Shapes.GetTop (s[y][fi])>590 Then EndIf EndFor End>RCV502.sb< Start>RCV695.sb< ' Copyright (c) Microsoft Corporation. All rights reserved. GraphicsWindow.Hide() gw = 350 gh = 350 gridX = 25 gridY = 25 cellSize = 100 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Top = (Desktop.Height - gh) / 2 GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Title = "Tic-Tac-Toe" GraphicsWindow.Show() playerTurn = "True" allDiagonals = "True" logWindow = "False" GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown SetupBoard() gameLoop: CheckGameOver() If gameOver = "True" Then Goto endGame EndIf If playerTurn = "True" Then Program.Delay(1000) Goto gameLoop EndIf TryWin() If logWindow = "True" Then TextWindow.WriteLine("TryWin: compRow = "+compRow + " compCol = "+compCol) Endif If compRow <> -1 And compCol <> -1 Then PlayComputerTurn() Goto gameCheck EndIf TryBlock() If logWindow = "True" Then TextWindow.WriteLine("TryBlock: compRow = "+compRow + " compCol = "+compCol) Endif If compRow <> -1 And compCol <> -1 Then PlayComputerTurn() Goto gameCheck EndIf ' Play Center If cells[1][1] = "" Then compRow = 1 compCol = 1 PlayComputerTurn() Goto gameCheck EndIf ' Pick a corner PickCorner() If logWindow = "True" Then TextWindow.WriteLine("PickCorn: compRow = "+compRow + " compCol = "+compCol) Endif If compRow <> -1 And compCol <> -1 Then PlayComputerTurn() Goto gameCheck EndIf ' Pick any empty cell PickAny() If logWindow = "True" Then TextWindow.WriteLine("PickAny: compRow = "+compRow + " compCol = "+compCol) Endif If compRow <> -1 And compCol <> -1 Then PlayComputerTurn() Goto gameCheck EndIf gameCheck: CheckGameOver() If gameOver <> "True" Then Goto gameLoop EndIf endGame: If playerWins = "True" Then GraphicsWindow.ShowMessage("You win! Nice work.", "Game Over") Program.End() ElseIf computerWins = "True" Then GraphicsWindow.ShowMessage("Computer wins! Better luck next time.", "Game Over") Program.End() Else GraphicsWindow.ShowMessage("Tie game!", "Game Over") Program.End() EndIf Sub TryWin compRow = -1 compCol = -1 For i = 0 to 2 If cells[i][0] = "O" And cells[i][1] = "O" And cells[i][2] = "" Then compRow = i compCol = 2 ElseIf cells[i][0] = "O" And cells[i][1] = "" And cells[i][2] = "O" Then compRow = i compCol = 1 ElseIf cells[i][0] = "" And cells[i][1] = "O" And cells[i][2] = "O" Then compRow = i compCol = 0 ElseIf cells[0][i] = "O" And cells[1][i] = "O" And cells[2][i] = "" Then compCol = i compRow = 2 ElseIf cells[0][i] = "O" And cells[1][i] = "" And cells[2][i] = "O" Then compCol = i compRow = 1 ElseIf cells[0][i] = "" And cells[1][i] = "O" And cells[2][i] = "O" Then compCol = i compRow = 0 EndIf EndFor If cells[0][0] = "O" And cells[1][1] = "O" And cells[2][2] = "" Then compCol = 2 compRow = 2 ElseIf cells[0][0] = "O" And cells[1][1] = "" And cells[2][2] = "O" Then compCol = 1 compRow = 1 ElseIf cells[0][0] = "" And cells[1][1] = "O" And cells[2][2] = "O" Then compCol = 0 compRow = 0 Endif '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If allDiagonals = "True" Then If cells[2][0] = "O" And cells[1][1] = "O" And cells[0][2] = "" Then compCol = 2 compRow = 0 ElseIf cells[2][0] = "O" And cells[1][1] = "" And cells[0][2] = "O" Then compCol = 1 compRow = 1 ElseIf cells[2][0] = "" And cells[1][1] = "O" And cells[0][2] = "O" Then compCol = 0 compRow = 2 EndIf EndIf '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EndSub Sub TryBlock compRow = -1 compCol = -1 For i = 0 to 2 If cells[i][0] = "X" And cells[i][1] = "X" And cells[i][2] = "" Then compRow = i compCol = 2 ElseIf cells[i][0] = "X" And cells[i][1] = "" And cells[i][2] = "X" Then compRow = i compCol = 1 ElseIf cells[i][0] = "" And cells[i][1] = "X" And cells[i][2] = "X" Then compRow = i compCol = 0 ElseIf cells[0][i] = "X" And cells[1][i] = "X" And cells[2][i] = "" Then compCol = i compRow = 2 ElseIf cells[0][i] = "X" And cells[1][i] = "" And cells[2][i] = "X" Then compCol = i compRow = 1 ElseIf cells[0][i] = "" And cells[1][i] = "X" And cells[2][i] = "X" Then compCol = i compRow = 0 EndIf EndFor If cells[0][0] = "X" And cells[1][1] = "X" And cells[2][2] = "" Then compCol = 2 compRow = 2 ElseIf cells[0][0] = "X" And cells[1][1] = "" And cells[2][2] = "X" Then compCol = 1 compRow = 1 ElseIf cells[0][0] = "" And cells[1][1] = "X" And cells[2][2] = "X" Then compCol = 0 compRow = 0 EndIf '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If allDiagonals = "True" Then If cells[2][0] = "X" And cells[1][1] = "X" And cells[0][2] = "" Then compCol = 2 compRow = 0 ElseIf cells[2][0] = "X" And cells[1][1] = "" And cells[0][2] = "X" Then compCol = 1 compRow = 1 ElseIf cells[2][0] = "" And cells[1][1] = "X" And cells[0][2] = "X" Then compCol = 0 compRow = 2 EndIf EndIf '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EndSub Sub CheckGameOver For i = 0 to 2 If cells[i][0] = "X" And cells[i][1] = "X" And cells[i][2] = "X" Then playerWins = "True" gameOver = "True" ElseIf cells[i][0] = "O" And cells[i][1] = "O" And cells[i][2] = "O" Then computerWins = "True" gameOver = "True" ElseIf cells[0][i] = "X" And cells[1][i] = "X" And cells[2][i] = "X" Then playerWins = "True" gameOver = "True" ElseIf cells[0][i] = "O" And cells[1][i] = "O" And cells[2][i] = "O" Then computerWins = "True" gameOver = "True" EndIf EndFor If cells[0][0] = "X" And cells[1][1] = "X" And cells[2][2] = "X" Then playerWins = "True" gameOver = "True" ElseIf cells[0][0] = "O" And cells[1][1] = "O" And cells[2][2] = "O" Then computerWins = "True" gameOver = "True" ElseIf cells[0][2] = "O" And cells[1][1] = "O" And cells[2][0] = "O" Then computerWins = "True" gameOver = "True" ElseIf cells[0][2] = "X" And cells[1][1] = "X" And cells[2][0] = "X" Then playerWins = "True" gameOver = "True" EndIf If gameOver <> "True" Then gameOver = "True" For i = 0 to 2 For j = 0 To 2 If cells[i][j] = "" Then gameOver = "False" EndIf EndFor EndFor EndIf EndSub Sub PickCorner If cells[0][0] = "X" And cells[2][2] = "" Then compRow = 2 compCol = 2 ElseIf cells[0][2] = "X" And cells[2][0] = "" Then compRow = 2 compCol = 0 ElseIf cells[2][0] = "X" And cells[0][2] = "" Then compRow = 0 compCol = 2 ElseIf cells[2][2] = "X" And cells[0][0] = "" Then ' compRow = 2 ' compCol = 2 compRow = 0 compCol = 0 ElseIf cells[0][0] = "" Then compRow = 0 compCol = 0 ElseIf cells[0][2] = "" Then compRow = 0 compCol = 2 ElseIf cells[2][0] = "" Then compRow = 2 compCol = 0 ElseIf cells[2][2] = "" Then compRow = 2 compCol = 2 EndIf EndSub Sub PickAny For i = 0 to 2 For j = 0 To 2 If cells[i][j] = "" Then compRow = i compCol = j Goto endPickAny EndIf EndFor EndFor endPickAny: EndSub Sub PlayComputerTurn r = compRow c = compCol cells[r][c] = "O" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 40 GraphicsWindow.FontBold = "False" cellText = Shapes.AddText("O") Shapes.Move(cellText, c * cellSize + gridX + 40, r * cellSize + gridY + 26) playerTurn = "True" EndSub Sub OnMouseDown If playerTurn = "True" Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY If mx > gridX And my > gridY And mx < (gridX + 3 * cellSize) And my < (gridY + 3 * cellSize) Then c = Math.Floor((mx - gridX) / cellSize) r = Math.Floor((my - gridY) / cellSize) If cells[r][c] = "" Then cells[r][c] = "X" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 40 GraphicsWindow.FontBold = "False" cellText = Shapes.AddText("X") Shapes.Move(cellText, c * cellSize + gridX + 40, r * cellSize + gridY + 26) playerTurn = "False" EndIf EndIf EndIf EndSub Sub OnMouseMove If playerTurn = "True" Then hover = "False" DrawCell() mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY If mx > gridX And my > gridY And mx < (gridX + 3 * cellSize) And my < (gridY + 3 * cellSize) Then col = Math.Floor((mx - gridX) / cellSize) row = Math.Floor((my - gridY) / cellSize) hover = "True" DrawCell() EndIf EndIf EndSub Sub SetupBoard hover = "False" For col = 0 to 2 For row = 0 To 2 DrawCell() EndFor EndFor row = -1 col = -1 EndSub Sub DrawCell If row >= 0 And col >= 0 And row <= 2 And col <=2 Then x = col * cellSize + gridX y = row * cellSize + gridY If hover = "True" Then GraphicsWindow.BrushColor = "Azure" Else GraphicsWindow.BrushColor = "White" EndIf GraphicsWindow.FillRectangle(x, y, cellSize, cellSize) GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(x, y, cellSize, cellSize) EndIf EndSub End>RCV695.sb< Start>RCX329.sb< GraphicsWindow.Title="RectDrw GraphicsWindow.MouseDown=mUp GraphicsWindow.MouseMove=mmm GraphicsWindow.BrushColor="transparent" GraphicsWindow.BackgroundColor="tan ddd="true GraphicsWindow.KeyDown=kkk GraphicsWindow.KeyUp=kuu sub kkk qq=text.ConvertToLowerCase( GraphicsWindow.LastKey) if qq="q" Then lkk="true" ElseIf qq="w" Then rkk="true ElseIf qq="e" Then mkk="true EndIf EndSub sub kuu lkk="false mkk="false rkk="false EndSub Sub mmm If num=1 and ddd Then mx1=GraphicsWindow.MouseX my1=GraphicsWindow.MouseY If ox+oy+ox*oy<>mx1+my1+mx1*my1 Then ddd="false For t=1 To 4 Shapes.Remove(ss[t]) EndFor GraphicsWindow.PenColor="red ss[1]=Shapes.AddLine(mx my mx,my1) ss[2]=Shapes.AddLine(mx my mx1 my) ss[3]=Shapes.AddLine(mx1 my mx1 my1) ss[4]=Shapes.AddLine(mx my1 mx1 my1) For t=1 To 4 LDShapes.PenStyle(ss[t] 2 2) EndFor ox=mx1 oy=my1 ddd="true EndIf EndIf EndSub Sub mUp num=Math.Remainder(num+1,2) If num=1 Then mx=GraphicsWindow.MouseX my=GraphicsWindow.MouseY ElseIf Mouse.IsRightButtonDown Then Goto rrr Else GraphicsWindow.PenColor="darkblue mx1=GraphicsWindow.MouseX my1=GraphicsWindow.MouseY If mx1RCX329.sb< Start>RCX796.sb< GraphicsWindow.Hide() GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "DimGray" GraphicsWindow.FontName = "Courier New" GraphicsWindow.FontBold = "False" GraphicsWindow.Show() GraphicsWindow.BrushColor = "Black" char34 = Text.GetCharacter(34) textarray[1]="a" textarray[2]="b" textarray[3]="c" textarray[4]="d" textarray[5]="e" textarray[6]="f" textarray[7]="g" textarray[8]="h" textarray[9]="i" textarray[10]="j" textarray[11]="k" textarray[12]="l" textarray[13]="m" textarray[14]="n" textarray[15]="o" textarray[16]="p" textarray[17]="q" textarray[18]="r" textarray[19]="s" textarray[20]="t" textarray[21]="u" textarray[22]="v" textarray[23]="w" textarray[24]="x" textarray[25]="y" textarray[26]="z" numberarray[1]=0 numberarray[2]=1 numberarray[3]=2 numberarray[4]=3 numberarray[5]=4 numberarray[6]=5 numberarray[7]=6 numberarray[8]=7 numberarray[9]=8 numberarray[10]=9 textbox=Controls.AddMultiLineTextBox(5, 5) Controls.SetSize(textbox, GraphicsWindow.Width-10, GraphicsWindow.Height-45) passwordbox=Controls.AddTextBox(((GraphicsWindow.Width-90)/2), GraphicsWindow.Height-30) Controls.SetSize(passwordbox, ((GraphicsWindow.Width-90)/2)-10, 25) Controls.SetTextBoxText(passwordbox, "Password") Controls.SetTextBoxText(textbox, "Text to encrypt") encryptbutton=Controls.AddButton("Encrypt", GraphicsWindow.Width - 85, GraphicsWindow.Height-35) Controls.SetSize(encryptbutton, 80, 30) GraphicsWindow.Height=GraphicsWindow.Height + 35 decryptbutton=Controls.AddButton("Decrypt", GraphicsWindow.Width - 85, GraphicsWindow.Height-35) Controls.SetSize(decryptbutton, 80, 30) passwordbox2=Controls.AddTextBox(((GraphicsWindow.Width-90)/2), GraphicsWindow.Height-30) Controls.SetSize(passwordbox2, ((GraphicsWindow.Width-90)/2)-10, 25) Controls.SetTextBoxText(passwordbox2, "Password(8 characters)") filepathbox=Controls.AddTextBox(5, GraphicsWindow.Height - 30) Controls.SetSize(filepathbox, GraphicsWindow.Width-110, 25) Controls.SetTextBoxText(filepathbox, "Filepath of File to decrypt or encrypt. (must be " + char34 + "*.txt" + char34 + ")") Controls.ButtonClicked = ButtonClick Sub ButtonClick If Controls.LastClickedButton = encryptbutton Then e() Else d() EndIf EndSub Sub e filepath=Controls.GetTextBoxText(filepathbox) textboxtext=Controls.GetTextBoxText(textbox) password=Controls.GetTextBoxText(textbox) newtext = "" loop1: e_numhelp1=Math.GetRandomNumber(300) If e_numhelp1 < 100 Then Goto loop1 EndIf For i = 1 To Text.GetLength(textboxtext) character=Text.GetSubText(textboxtext, i, 1) For j=1 To Array.GetItemCount(textarray) If character=textarray[j] Then newcharnum=j j=Array.GetItemCount(textarray) EndIf EndFor newtext=Text.Append(newtext, Text.GetCharacter(newcharnum*e_numhelp1)) EndFor For i = 1 To 8 character=Text.GetSubText(password, i, 1) For j=1 To Array.GetItemCount(textarray) If character=textarray[j] Then newcharnum2=j j=Array.GetItemCount(textarray) EndIf EndFor newtext2=Text.Append(newtext2, Text.GetCharacter(newcharnum2*e_numhelp1)) EndFor newtext=Text.Append(newtext, e_numhelp1) newtext=Text.Append(newtext, newtext2) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(filepath, newtext) EndSub Sub d ' The following line could be harmful and has been automatically commented. ' textfromfile = File.ReadContents(filepath) e_numhelp2 = Text.GetSubText(textfromfile, Text.GetLength(textfromfile)-11, 1) password = Text.GetSubText(textfromfile, Text.GetLength(textfromfile)-8, 8) textfromfile = Text.GetSubText(textfromfile, 1, Text.GetLength(textfromfile)-11) password2 = "" For i = 1 To 8 character = Text.GetSubText(password, i, 1) character = Text.GetCharacterCode(character) character = Text.GetCharacter(character/e_numhelp2) password2 = Text.Append(password2, character) EndFor If Controls.GetTextBoxText(passwordbox2) = password2 Then textboxtext = "" For i = 1 To Text.GetLength(textfromfile) character = Text.GetSubText(textfromfile, i, 1) character = Text.GetCharacterCode(character) character = Text.GetCharacter(character/e_numhelp2) textboxtext = Text.Append(textboxtext, character) EndFor FCControls.SetText(textbox, textboxtext) Else GraphicsWindow.ShowMessage("Your password is incorrect", "ERROR!!! NOOO!!!!") EndIf EndSub End>RCX796.sb< Start>RDH047.sb< GraphicsWindow.BackgroundColor="darkblue" spheres=2 gh=GraphicsWindow.Height GraphicsWindow.BrushColor="white GraphicsWindow.Title="Raytracing 3D Graphics" GraphicsWindow.Width=510 c[1][1]=-0.3 c[1][2]=-0.8 c[1][3]=3 rr=0.6 r[1]=rr q[1]=rr*rr c[2][1]=.9 c[2][2]=-1.1 c[2][3]=2 rr=0.2 r[2]=rr q[2]=rr*rr For i=0 To 175 step .5 For j=0 To 255 step .5 x=0.3 y=-0.5 z=0 dx=j-128 dy=88-i dz=300 dd=dx*dx+dy*dy+dz*dz s100() EndFor ' j EndFor ' i Sub s100 r100: n=0 If (y>=0 OR dy<=0) Then n=-1 Else s=-y/dy EndIf For k=1 To spheres px=c[k][1]-x py=c[k][2]-y pz=c[k][3]-z pp=px*px+py*py+pz*pz sc=px*dx+py*dy+pz*dz If sc<=0 Then Goto s200 EndIf bb=sc*sc/dd aa=q[k]-pp+bb If aa<=0 Then Goto s200 EndIf sc=(math.SquareRoot(bb)-math.SquareRoot(aa))/math.SquareRoot(dd) If sc.5 Then q1="true" Else q1="false" EndIf If (z-Math.Floor(z))>.5 Then q11="true" Else q11="false" EndIf If q1<>q11 Then GraphicsWindow.BrushColor=LDColours.HSLtoRGB(z*70-90 1 .6) GraphicsWindow.FillRectangle( j*2,gh-i*2,1 1) EndIf RETURN: EndSub End>RDH047.sb< Start>RDH377.sb< GraphicsWindow.FontSize=22 GraphicsWindow.FontName="Calibri GraphicsWindow.FontBold="TRue GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkblue GraphicsWindow.Title="Binero Game GraphicsWindow.Width=410 GraphicsWindow.Height=380 ss[0]=LDText.Split(". 1 . . . . . . . . _" " ") ss[1]=LDText.Split("0 . . . . 0 . 1 . . _" " ") ss[2]=LDText.Split(". . . 0 . . . . . . _" " ") ss[3]=LDText.Split(". . . 0 . . . . . . _" " ") ss[4]=LDText.Split(". . . . 1 . . . . . _" " ") ss[5]=LDText.Split("1 . . . . . . . . . _" " ") ss[6]=LDText.Split(". . . . . 0 . 0 . . _" " ") ss[7]=LDText.Split(". . 0 . 0 0 . . . . _" " ") ss[8]=LDText.Split(". . 0 . . . . . . . _" " ") ss[9]=LDText.Split(". 1 . . 0 . 0 . . . _" " ") ss[10]=LDText.Split("_ _ _ _ _ _ _ _ _ _ " " ") s1=ss For y=0 To 10 For x=0 To 10 If ss[y][x+1]="." Then GraphicsWindow.FontBold="false Else GraphicsWindow.FontBold="true EndIf s[x][y]=Shapes.AddText(ss[y][x+1]) Shapes.Move(s[x][y] 30+x*33 30+y*33) EndFor EndFor count() px=0 py=0 GraphicsWindow.KeyDown=kkk Timer.Tick=ttt Timer.Interval=255 Sub ttt i=i+1 For x=0 To 9 For y=0 To 9 LDShapes.BrushColour(s[x][y] "tan") EndFor EndFor If Math.Remainder(i 2)=0 Then LDShapes.BrushColour(s[px][py] "red") EndIf EndSub Sub kkk ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) If ll="left" Then px=px-1 ElseIf ll="right" Then px=px+1 ElseIf ll="up" Then py=py-1 ElseIf ll="down" Then py=py+1 ElseIf ll="d1" or ll="d0" or ll="space" Then tt=0 If Text.EndsWith(ll "1") Then tt=1 ElseIf ll="space" Then tt="_" EndIf If ss[py][px+1]="." Then Shapes.SetText(s[px][py] tt) s1[py][px+1]=tt count() EndIf EndIf If px<0 Then px=0 ElseIf px>9 Then px=9 EndIf If py<0 Then py=0 ElseIf py>9 Then py=9 EndIf EndSub Sub count For r=0 To 9 c1=0 c2=0 For c=1 To 10 If s1[r][c]="1" Then c1=c1+1 ElseIf s1[r][c]="0" Then c2=c2+1 EndIf EndFor Shapes.SetText(s[10][r] c1+":"+c2) EndFor For c=1 To 10 c1=0 c2=0 For r=0 To 9 If s1[r][c]="1" Then c1=c1+1 ElseIf s1[r][c]="0" Then c2=c2+1 EndIf EndFor ff="false LDShapes.Font(s[c-1][10] "calibri" 12 "true" ff) Shapes.SetText(s[c-1][10] c1+":"+c2) EndFor EndSub End>RDH377.sb< Start>RDH996.sb< 'Problem Analysis Model version 2 ' Copyright (C) 2010, Robert W. Jones ' gw = 0.8*1198 gh = 0.8*556 'TextWindow.WriteLine(gh) GraphicsWindow.Width = gw GraphicsWindow.Height = gh ' Basic Parameters ModelWidth = gw ModelHeight = gh background = "blue" ModelTitle = "Problem Analysis Model Version 2" ' Main Program Init() 'DrawTerminal() Play() 'End of Mainprogram '====================================== ' Program Setup Sub Init GraphicsWindow.Hide() GraphicsWindow.Title = ModelTitle GraphicsWindow.CanResize = "False" GraphicsWindow.Width = ModelWidth GraphicsWindow.Height = ModelHeight GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Blue" GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(20,405,"One Moment Please, Loading Model") Program.Delay(100) ImageName1 = ImageList.LoadImage("http://24.207.27.16/BCFerriesNew/web.site/logs/Graphics001.jpg") Program.Delay(100) ImageName1Height = ModelHeight ImageName1Width = ModelWidth GraphicsWindow.DrawResizedImage(ImageName1,0,0,ModelWidth,ModelHeight) Program.Delay(100) GraphicsWindow.FontSize = 14 GraphicsWindow.PenColor = "Gold" GraphicsWindow.BrushColor = "Gold" GraphicsWindow.PenWidth = 10 GraphicsWindow.DrawRectangle(0,0,ImageName1Width,ImageName1Height) GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(20, 405, "Height = " + ImageName1Height + " Width = " + ImageName1Width) EndSub Sub Berth1RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp1 = Shapes.AddLine(395,140,495,140) EndSub Sub Berth1Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor ="Lime" Loading1 = Shapes.AddLine(395,140,530,140) EndSub Sub Berth2RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp2 = Shapes.AddLine(435,200,530,200) endsub Sub Berth2Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Lime" Loading2 = Shapes.AddLine(435,200,575,200) endsub Sub Berth3RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp3 = Shapes.AddLine(475,260,570,260) endsub Sub Berth3Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor ="Lime" Loading3 = Shapes.AddLine(475,260,615,260) endsub Sub Play GraphicsWindow.PenColor = "white" GraphicsWindow.BrushColor = "white" Vessel1 = Shapes.AddEllipse(0.8*200,0.8*40) Vessel2 = Shapes.AddEllipse(0.8*200,0.8*40) Vessel3 = Shapes.AddEllipse(0.8*200,0.8*40) Shapes.Move(Vessel1, 0.8*200,0.8*120) Shapes.Move(Vessel2, 0.8*240, 0.8*180) Shapes.Move(Vessel3, 0.8*280, 0.8*240) GraphicsWindow.Show() Vessel1Departure() EndSub Sub Vessel1Departure Sound.PlayChimes() Shapes.Animate(Vessel1, 0.8*50, 0.8*120, 4000) Program.Delay(4000) Shapes.Rotate(Vessel1, -5) Shapes.Animate(Vessel1,0.8*45, 0.8*125, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -10) Shapes.Animate(Vessel1,0.8*40, 0.8*130, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -15) Shapes.Animate(Vessel1,0.8*35, 0.8*135, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -20) Shapes.Animate(Vessel1,0.8*30, 0.8*140, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -25) Shapes.Animate(Vessel1,0.8*25, 0.8*145, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -30) Shapes.Animate(Vessel1,0.8*20, 0.8*150, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -35) Shapes.Animate(Vessel1,0.8*15, 0.8*155, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -40) Shapes.Animate(Vessel1,0.8*10, 0.8*160, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -45) Shapes.Animate(Vessel1,0.8*5, 0.8*170, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -50) Shapes.Animate(Vessel1,0.8*0, 0.8*175, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -60) Shapes.Animate(Vessel1,-0.8*5, 0.8*180, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -70) Shapes.Animate(Vessel1,-0.8*10, 0.8*190, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-80) Shapes.Animate(Vessel1,-0.8*15, 0.8*200, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-90) Shapes.Animate(Vessel1,-0.8*15, 0.8*220, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-90) Shapes.Animate(Vessel1,-0.8*15, 0.8*250, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*290, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*340, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*400, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*470, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*540, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-0.8*15, 0.8*620, 1000) Program.Delay(1000) EndSub End>RDH996.sb< Start>RDJ113.sb< ''By using the Array object, write a flight-reservation program that you can use to perform the following actions: 'Reserve seats for 10 passengers. 'Display each passenger’s name and seat number. 'Show how many seats are still available. 'declaring the variables num_seats = 3 num_customers = 3 booked_seats = "empty" counter = 0 remaining_seats = num_seats 'the main program - calling subroutines to greet the customer, 'collect and display booking data plus free seats remaining. for i = 1 to num_seats seat_number[i] = ("Seat Number "+ i) customer_greeting() collect_name() TextWindow.WriteLine("") TextWindow.WriteLine("Thank You "+Pass_Title[i]+" "+passenger_surname[i]+".") TextWindow.WriteLine("") TextWindow.WriteLine(seat_number[i] + " has been reserved for you.") TextWindow.WriteLine("") counter = counter + 1 remaining_seats = num_seats-counter endfor 'check and display the number of free seats. If remaining_seats = 0 Then TextWindow.WriteLine("There are no free seats.") else TextWindow.WriteLine(greet+", There are "+remaining_seats+" free seats remaining.") EndIf 'call subroutine to display the full bookings schedule bookings() '_____________________________________________________________________________ 'subroutine to greet the customer and display the number of free seats remaining. Sub customer_greeting morn = "Good Morning" Anoon = "Good Afternoon" evening = "Good Evening" If Clock.Hour<12 then greet = morn elseif Clock.Hour<18 then greet = Anoon else greet = evening endif EndSub '_____________________________________________________________________________ 'subroutine to collect names sub collect_name startname: textwindow.WriteLine("Please enter your Title: Mr, Mrs or Miss") Pass_Title[i] = TextWindow.Read() textwindow.writeline("Please enter your Surname: ") passenger_surname[i] = TextWindow.Read() TextWindow.WriteLine("Please enter you forename(s): ") pass_forname[i] = TextWindow.Read() fullname[i] = (Pass_Title[i] + " " + pass_forname[i]+ " " + passenger_surname[i]) TextWindow.Write("Thank you. Your Full name is: " + fullname[i]+"? Y/N: ") confirmname = TextWindow.Read() If confirmname = "N" Or confirmname ="n" Then Goto startname Else EndIf EndSub '_____________________________________________________________________________ ''subroutine to display the full bookings schedule Sub bookings TextWindow.WriteLine("The completed booking schedule is:") TextWindow.WriteLine("") For i = 1 To Array.GetItemCount(fullname) TextWindow.WriteLine("Passenger " + fullname[i]+" : " + seat_number[i]) EndFor EndSub End>RDJ113.sb< Start>RDJ626-0.sb< ' Arrows ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Challenge 2017-06 ' Last update 2017-06-26 ' Program ID RDJ626-0 GraphicsWindow.Title = "Arrows" Init() While "True" If mouseMove Then For i = 1 To nArrow arw = arrow[i] x = mx - arw["x"] y = my - arw["y"] Math_CartesianToPolar() Shapes.Rotate(arw["tail"], a + 135) Shapes.Rotate(arw["head"], a + 135) EndFor mouseMove = "False" Else Program.Delay(100) EndIf EndWhile Sub AddArrow ' param x, y - point GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "Black" tail = Shapes.AddLine(-20, -20, 0, 0) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Black" head = Shapes.AddTriangle(-25, -25, -20, -10, -10, -20) Shapes.Move(tail, x, y) Shapes.Move(head, x, y) arw["tail"] = tail arw["head"] = head arw["x"] = x arw["y"] = y nArrow = nArrow + 1 arrow[nArrow] = arw EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh cx = gw / 2 cy = gh / 2 For y = cy - 160 To cy + 160 Step 80 For x = cx - 240 To cx + 240 Step 80 AddArrow() EndFor EndFor GraphicsWindow.MouseMove = OnMouseMove EndSub Sub OnMouseMove mouseMove = "True" mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY EndSub Sub Math_CartesianToPolar ' Math | convert Cartesian coodinate to polar coordinate ' param x, y - Cartesian coordinate ' return r, a - polar Coordinate (0<=a<360) 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 And y = 0 Then a = 0 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf ' at this point -90<=a<=90 If x < 0 Then a = a + 180 ElseIf x >= 0 And y < 0 Then a = a + 360 EndIf ' at this point 0<=a<360 EndSub End>RDJ626-0.sb< Start>RDJ626-1.sb< GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Title = "Arrows" Init() a45=90 LDEvents.MouseWheel=mww Sub mww'----------------------------------mswheel management a45=a45+ LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title =a45 dorr() EndSub Sub dorr ' ------------------------------rotates arrows For i = 1 To nArrow arw = arrow[i] x = mx - arw["x"] y = my - arw["y"] aa=LDMath.Convert2Radial (mx my arw["x"] arw["y"]) ldShapes.RotateAbout (arw["head"],arw["x"] arw["y"] aa[2]+a45 ) EndFor EndSub Sub AddArrow ' --------------------param x, y - point GraphicsWindow.PenColor =LDColours .HSLtoRGB (nArrow *5 1 .6) GraphicsWindow.PenWidth =3 arw["head"] = LDFigures.AddLineArrow (5 30 5 0 "Oval" "Arrow" "TopRight") arw["x"] = x arw["y"] = y ldShapes.move ( arw["head"] x y) nArrow = nArrow + 1 arrow[nArrow] = arw EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh cx = gw / 2 cy = gh / 2 For y = cy - 160 To cy + 160 Step 80 For x = cx - 240 To cx + 240 Step 80 AddArrow() EndFor EndFor GraphicsWindow.MouseMove = OnMouseMove EndSub Sub OnMouseMove mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY dorr() EndSub End>RDJ626-1.sb< Start>RDL842.sb< imm= "afg;000009352.jpg aus;000009001.gif cro;000010418.gif cyp;000010379.gif fin;000010715.gif gre;000010395.gif ice;000010136.gif isr;000009415.gif kaz;000010348.gif kos;000010449.gif mld;000011417.gif mzb;000008849.gif imm=imm+" grn;000009738.gif gmb;000008295.gif gtm;000009718.gif mdg;000008805.gif jam;000009684.gif mrs;000009217.gif nzl;000009173.gif pak;000011223.gif per;000010056.gif sin;000011109.gif svg;000009726.gif spn;000010470.gif usa;000007302.gif uae;000009289.gif vnz;000009997.gif urg;000009640.gif sey;000008499.gif tkm;000010634.gif slk;000011147.gif thl;000011170.gif imm=imm+" ids;000011057.gif pol;000010783.gif ttb;000009801.gif scn;000009733.gif stp;000008410.gif png;000009211.gif qat;000009367.gif mex;000010051.gif mlw;000008828.gif imm=imm+" alb;000010196.gif but;000011346.gif bru;000011292.gif chn;000010767.gif chl;000009808.gif csr;000009759.gif ecd;000009625.gif geo;000010429.gif den;000010575.gif ind;000011037.gif fmc;000010860.gif mne;000010907.jpg mic;000009242.gif mng;000011431.gif nep;000011196.gif imm=imm+" ukk;000010295.gif nor;000010661.gif swe;000010512.gif ser;000010622.gif pan;000009880.gif mlt;000010865.gif swi;000010484.gif vat;000010646.gif por;000010828.gif lat;000010919.gif est;000010339.gif slk;000010553.gif slv;000010569.gif czk;000010539.gif snm;000010463.gif and;000010155.gif im=ldtext.Split (imm " ") im1= "xxx;000010175.gif xxx;000010845.gif xxx;000010810.gif xxx;000010930.gif xxx;000010895.gif xxx;000010886.gif xxx;000010231.gif xxx;000010266.gif xxx;000010526.gif xxx;000008300.gif xxx;000008799.gif xxx;000008476.gif xxx;000008642.gif xxx;000008668.gif xxx;000008542.gif xxx;000008786.gif xxx;000008589.gif xxx;000008404.gif xxx;000008376.gif xxx;000008773.gif xxx;000008335.gif im1=im1+" bra;000009959.gif bol;000010084.gif blz;000009953.gif bbd;000009916.gif cub;000009700.gif bhr;000009554.gif bhm;000009894.gif dmr;000009847.gif esl;000009658.gif roc;000011183.gif mls;000011384.gif lst;000008948.gif prg;000009926.gif phl;000011322.gif sng;000008571.gif tky;000009513.gif syr;000009485.gif rwa;000008913.gif slm;000009110.gif imi=ldtext.Split (im1 " ") stt="Afganistan;Australia;Croatia;Cyprus;Finland;Greece;Iceland;Israel;Kazakhistan;Kosovo;Maldives;Mozambique;Grenada;Gambia;Guatemala; stt=stt+"Madagascar;Jamaica;Marshall;New Zealand;Pakistan;Peru;Singapore;Saint Vincent and the Grenadines;Spain;USA;UAE;Venezuela;Urugvay; stt=stt+"Seychelles;Turkmenistan;Sri Lanka;Thailand;Indonesia;Poland;Trinidad&Tobago;St Christopher&Nevis;Sao Tome&Principe;Papua New Guinea; stt=stt+"Qatar;Mexico;Malawi;Albania;Bhutan;Brunei;China;Chile;Costa Rica;Ecuador;Georgia;Denmark;India;FYR Macedonia;Montenegro;Micronesia;Mongolia;Nepal; stt=stt+"UK;Norway;Sweden;Serbia;Panama;Malta;Switzerland;Vatican;Portugal;Latvia;Estonia;Slovakia;Slovenia;Chech Rep.;San Marino;Andorra; stt=stt+"Austria;Belgium;France;Germany;Hungary;Italy;The Netherlands;Japan;Bangladesh;Palau;Luxembourg;Romania;Bulgaria;Ireland;Lithuania;Ivory Coast; stt=stt+"Nigeria;Armenia;Russia;Gabon;Sierra Leone;Yemen;Azerbaijan;Belarus;B&H;Liechtenstein;Moldova;Monaco;Ucraine;Uzbekistan;Tajikistan;Egypt;Benin;Djibouti;Togo;Tanzania;Sudan;Burundi;CAR;DR Kongo;R.of Kongo;Botswana;Comoros; stt=stt+"Brazil;Bolivia;Belize;Barbados;Cuba;Bahrain;Bahamas;Dominican Rep.;El Salvador;Rep.of Korea;Malaysia;Lesotho;Paraguay;Philippines;Senegal;Turkey;Syria;Rwanda;Solomon cnt=ldtext.Split (stt ";") TextWindow.WriteLine (cnt) eu=ldtext.Split ("83 84 85 86 87 3 4 5 6 73 74 75 76 77 78 79 65 66 67 68 69 70 57 59 62 24 34 50" " ") 'TLF895 GraphicsWindow.Title="World of Flags br="1=blue;2=midnightblue;3=black LDGraphicsWindow.BackgroundBrush (LDShapes.BrushGradient (br "DD")) GraphicsWindow.Width=900 GraphicsWindow.Height =850 sf=Array.GetItemCount (im) sf1=Array.GetItemCount (imi) mf=sf fw=112 fh=75 bw=fw/3 lh=fh/3 itt=ldtext.Split ("All;EU;Europe;Asia;Africa;S.America;Islands" ";") LDDialogs.AddRightClickMenu (itt "") LDDialogs.RightClickMenu =rmm For i=1 To sf ii=ImageList.LoadImage ("http://www.mofa.go.jp/files/"+Text.GetSubTextToEnd (im[i] 5)) ss[i]=Shapes.AddImage (ii ) Shapes.Zoom (ss[i] .8 .8) LDEffect.DropShadow (ss[i] "color=skyblue") Shapes.Move (ss[i] math.Remainder (i-1 8)*95+50 55+Math.Floor ((i-1)/8)*65) if i=56 Then Shapes.Move(ss[i] math.Remainder (i-1 8)*95+90 55+Math.Floor ((i-1)/8)*65) endif LDDialogs.ToolTip (ss[i] cnt[i]) EndFor LDShapes.AnimateZoom (ss[sf] 750 0 1.3 1.3) LDEvents.MouseWheel=mww GraphicsWindow.KeyDown=kkk mm=1000 zz=1 cr=9 args=0 LDCall.Function4("hflg" "white" "red" "red" 1) LDCall.Function4("vflg" "yellow" "black" "red" 2) LDCall.Function4("vflg" "white" "blue" "red" 3) LDCall.Function4("hflg" "red" "black" "yellow" 4) LDCall.Function4("hflg" "white" "red" "green" 5) LDCall.Function4("vflg" "white" "green" "red" 6) LDCall.Function4("hflg" "white" "red" "blue" 7) LDCall.Function4("vflg" "white" "c" "red" 8) cr=10 dd=-10 LDCall.Function4("vflg" "green" "c" "red" 1) LDCall.Function4("vflg" "lightblue" "c" "yellow" 2) LDCall.Function4("hflg" "white" "red" "lightblue" 3) LDCall.Function4("vflg" "yellow" "blue" "red" 4) LDCall.Function4("hflg" "green" "white" "red" 5) LDCall.Function4("vflg" "white" "green" "orange" 6) LDCall.Function4("hflg" "green" "yellow" "red" 7) LDCall.Function4("vflg" "white" "orange" "green" 8) cr=11 cyn= LDColours.HSLtoRGB (210 1 .55) LDCall.Function4("vflg" "white" "darkgreen" "darkgreen" 1) LDCall.Function4("hflg" "blue" "red" "Orange" 2) LDCall.Function4("hflg" "blue" "white" "red" 3) LDCall.Function4("hflg" "yellow" "green" cyn 4) LDCall.Function4("hflg" "white" "green" cyn 5) LDCall.Function4("hflg" "white" "red" "black" 6) For j=1 To sf1 ii=ImageList.LoadImage ("http://www.mofa.go.jp/files/"+Text.GetSubTextToEnd (imi[j] 5)) ss[i]=Shapes.AddImage (ii ) Shapes.Zoom (ss[i] .8 .8) LDEffect.DropShadow (ss[i] "color=skyblue") Shapes.Move (ss[i] math.Remainder (j-1 8)*95+870 55+Math.Floor ((j-1)/8)*65) LDDialogs.ToolTip (ss[i] cnt[i]) i=i+1 mf=i-1 EndFor Sub rmm di=LDDialogs.LastRightClickMenuItem If di=1 Then For x=1 to mf Shapes.ShowShape (ss[x]) EndFor ElseIf di=2 then For x=1 to mf If Array.ContainsValue (eu x) then Shapes.ShowShape (ss[x]) Else Shapes.hideShape (ss[x]) EndIf EndFor EndIf EndSub Sub hflg gg=FCDrawings.CreateGraphics(fw fh) FCDrawings.FillRectangle (gg args[1] 0 0 fw fh) FCDrawings.FillRectangle (gg args[2] 0 0 fw lh) FCDrawings.FillRectangle (gg args[3] 0 lh*2 fw lh) If i=102 Then po[0]["X"]=0 po[0]["Y"]=0 po[1]["X"]=0 po[1]["Y"]=fh po[2]["X"]=fh*.666 po[2]["Y"]=fh/2 FCDrawings.FillPolygon (gg "green" po) endif im=FCDrawings.GenerateImage(gg) s0=Shapes.AddImage (im ) Shapes.Zoom (s0 .8 .8) shapes.Move (s0 50+95*(args[4]-1) 55+cr*65) LDEffect.DropShadow (s0 "color=skyblue") ss[i]=s0 LDDialogs.ToolTip (ss[i] cnt[i]) mf=mf+1 i=i+1 EndSub Sub vflg gg=FCDrawings.CreateGraphics(fw fh) FCDrawings.FillRectangle (gg args[1] 0 0 fw fh) If args[2]="c" Then FCDrawings.FillEllipse (gg args[3] bw+dd lh-5 bw bw) else FCDrawings.FillRectangle (gg args[2] 0 0 bw fh) FCDrawings.FillRectangle (gg args[3] bw*2 0 bw fh) EndIf im=FCDrawings.GenerateImage(gg) s0=Shapes.AddImage (im ) Shapes.Zoom (s0 .8 .8) shapes.Move (s0 50+95*(args[4]-1) 55+cr*65) LDEffect.DropShadow (s0 "color=skyblue") ss[i]=s0 LDDialogs.ToolTip (ss[i] cnt[i]) i=i+1 mf=mf+1 EndSub Sub mww If Mouse.IsRightButtonDown Then aa=aa+ LDEvents.LastMouseWheelDelta *3 Else zz=zz+ LDEvents.LastMouseWheelDelta/15 EndIf ldGraphicsWindow.Reposition (zz zz xx yy aa) EndSub Sub kkk LDShapes.AnimateZoom (ss[sf] 0 0 0 0) Shapes.Zoom(ss[sf] .8 .8) ls=text.ConvertToLowerCase (GraphicsWindow.LastKey) If ls="space" Then sf=sf+1 ElseIf ls="back" then sf=sf-1 ElseIf ls="left" then xx=xx-5 ElseIf ls="right" then xx=xx+5 ElseIf ls="up" then yy=yy-5 ElseIf ls="down" then yy=yy+5 EndIf If sf<1 Then sf=mf ElseIf sf>mf then sf=1 EndIf GraphicsWindow.Title="State of "+cnt[sf] mm=mm+1 LDShapes.ZIndex (ss[sf] mm) LDShapes.AnimateZoom (ss[sf] 750 0 1.3 1.3) ldGraphicsWindow.Reposition (zz zz xx yy aa) EndSub End>RDL842.sb< Start>RDM692.sb< ' CHALLENGE for February 2017 ' Small Basic ' growing ballons ' with litdev extension ' program by yled ' Feb 12th 2017 ' program: GraphicsWindow.TOP=0 GraphicsWindow.LEFT=0 GraphicsWindow.Width=1366 GraphicsWindow.Height=768 GraphicsWindow.Title ="Sky" gradient[1] = "#005588" gradient[2] = "steelblue" gradient[3] = "skyblue" gradient[4] = "skyblue" gradient[5] = "skyblue" gradient[6] = "burlywood" gradient[7] = "SaddleBrown" sky = LDShapes.BrushGradient(gradient,"v") LDShapes.BrushGradientBackground(sky) For x=1 To 8 ball[x] = LD3DView.AddView(1366,768,"true") A=Math.GetRandomNumber(200)+100 COL=LDColours.HSLtoRGB(A,0.8,0.4) B=Math.GetRandomNumber(360)+100 COL1=LDColours.HSLtoRGB(B,0.8,0.7) LD3DView.AddDirectionalLight ( ball[x],COL1,180,-90,-155) LD3DView.AddspotLight( ball[x],COL,-111,-10,-1 ,-1 ,-1 ,-1, 1000, 800) r=(math.GetRandomNumber(18)/10)+0.4 balloon[x]=LD3DView.AddSphere ( ball[x],r ,100,COL1,"D") LD3DView.TranslateGeometry ( ball[x],balloon[x], -5, -1, -2) EndFor t=10 While "true" t=t-0.04 s=s+0.1 LD3DView.ResetCamera(ball[1],-20,12.4+s,t*2.6,1,0,-1,15,-400,180) LD3DView.ResetCamera(ball[2],-25,2.1+s,t*2.1,1,0,-1,255,-200,160) LD3DView.ResetCamera(ball[3],-28,-1.9+s,t*2.3,1,0,-1,15,-160,140) LD3DView.ResetCamera(ball[4],-29,1.9+s,t*2.3,1,0,-1,185,-300,120) LD3DView.ResetCamera(ball[5],-21,1.9+s,t*2.3,1,0,-1,685,-100,220) LD3DView.ResetCamera(ball[6],-31,1.7+s,t*2.3,1,0,-1,185,-100,110) LD3DView.ResetCamera(ball[7],-18,2.9+s,t*2.3,1,0,-1,85,-20,110) LD3DView.ResetCamera(ball[8],-8,2.9+s,t*2.3,1,0,-1,5,-20,410) Program.Delay(100) EndWhile End>RDM692.sb< Start>RDS967.sb< '======= make random file =========== ' WhTurner 141209 'Challenge october 2014; community suggestion 1 by Pappa Lapub '=============================== FO=Program.Directory+"\Ranfile2.txt" ''FO="" ' uncomment for no file-output TextWindow.WriteLine("") TextWindow.WriteLine("GENERATION OF A FILE WITH RANDOM CONTENTS") TextWindow.WriteLine("") TextWindow.WriteLine("Choise of format") TextWindow.WriteLine("1 - Continuous stream of characters") TextWindow.WriteLine("2 - Lines with continouous stream of characters") TextWindow.WriteLine("3 - Lines with random 'words' separated by space") TextWindow.Write(" Give number of choice ") C1=TextWindow.ReadNumber() TextWindow.WriteLine("") TextWindow.WriteLine("Choice of characters") TextWindow.WriteLine("1 - lower case alphabetical") TextWindow.WriteLine("10 - UPPER CASE alphabetical") TextWindow.WriteLine("100 - numerical") TextWindow.Write(" Give number, or sum for combinations e.g. 101 : ") C2=TextWindow.ReadNumber() cho="" If Math.Remainder(C2,10)=1 Then cho=cho+"abcdefghijklmnopqrstuvwxyz" EndIf If Math.Remainder(C2,100)=10 Or Math.Remainder(C2,100)=11 Then cho=cho+"ABCDEFGHIJKLMNOPQRSTUVWXYZ" EndIf If C2>99 Then cho=cho+"1234567890" EndIf choL=Text.GetLength(cho) If C1=1 Then TextWindow.Write("Give number of characters ") N1=TextWindow.ReadNumber() ElseIf C1=2 then TextWindow.Write("Give number of lines ") N2= TextWindow.ReadNumber() TextWindow.Write("Give length of line, range for random e.g. 40-60 : ") N3= TextWindow.Read() elseif C1=3 then TextWindow.Write("Give number of lines ") N2= TextWindow.ReadNumber() TextWindow.Write("Give number of words, range for random e.g. 6-9 : ") N4= TextWindow.Read() TextWindow.Write("Give length of words, range for random e.g. 5-12 : ") N5= TextWindow.Read() Else EndIf out="" If C1=1 Then For i=1 To N1 out=Text.Append(out,Text.GetSubText(cho,Math.GetRandomNumber(choL),1)) EndFor TextWindow.WriteLine(out) Output() ElseIf C1=2 then If Text.IsSubText(n3,"-") then posmin=Text.GetIndexOf(N3,"-") n31=0+Text.GetSubText(N3,1,posmin-1) n32=Text.GetSubTextToEnd(N3,posmin+1) Else n31=n3 n32=n3 EndIf For i=1 to N2 ''length N3=N31+Math.GetRandomNumber(1+n32-n31)-1 For j=1 to N3 out=Text.Append(out,Text.GetSubText(cho,Math.GetRandomNumber(choL),1)) endfor TextWindow.WriteLine(out) Output() out="" endfor ElseIf C1=3 then If Text.IsSubText(n4,"-") then posmin=Text.GetIndexOf(N4,"-") n41=0+Text.GetSubText(N4,1,posmin-1) n42=Text.GetSubTextToEnd(N4,posmin+1) Else n41=n4 n42=n4 EndIf If Text.IsSubText(n5,"-") then posmin=Text.GetIndexOf(N5,"-") n51=0+Text.GetSubText(N5,1,posmin-1) n52=Text.GetSubTextToEnd(N5,posmin+1) Else n51=n5 n52=n5 EndIf For i=1 to N2 'lines N4=N41+Math.GetRandomNumber(1+n42-n41)-1 For j=1 to N4 'words N5=N51+Math.GetRandomNumber(1+n52-n51)-1 For k=1 to N5 'chars out=Text.Append(out,Text.GetSubText(cho,Math.GetRandomNumber(choL),1)) endfor If j"" then If C1=1 then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(FO,out) Else ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,out) EndIf endif EndSub End>RDS967.sb< Start>RDT140-0.sb< '' Factorial 2012-04-20 WhTurner (RDT140-0) ''======================================================================== '' Adjustable parameters: First= 190 '' first factorial in output (make equal to Last for only one factorial) Last= 200 '' last factorial in output Sdigit= 10 '' number of significant digits in scientific notation (1..12) - use 0(zero) for string output Ts= " " ''Thousands separator ( " " space ; "," comma or "" nothing ) Ds= "." ''Decimal separator ''======================================================================== '' Var Init: m[1]= 1 Mmax= 1 Empty= " " ''======================================================================== For i= 1 To Last Multiply() If i >= First Then ''output Tout= m[Mmax] For j= Mmax-1 To 1 Step -1 out= "x00000000"+m[j] Lout= Text.GetLength(out) out= Text.GetSubTextToEnd(out,Lout-5) Tout= Text.Append(Tout,out) EndFor Lout= Text.GetLength(Tout) L= Text.GetLength(i) TextWindow.Write(Text.GetSubText(Empty,1,4-L)+i+"! = ") If Sdigit = 0 Then ''print string L= Math.Ceiling(Lout/3)*3-Lout Tout= Text.Append(Text.GetSubText(Empty,1,L),Tout) Lout= Lout+L For j= 1 To Lout-3 Step 3 TextWindow.Write(Text.GetSubText(Tout,j,3)+Ts) EndFor TextWindow.WriteLine(Text.GetSubTextToEnd(Tout,Lout-2)) ElseIf Lout < Sdigit+1 Then ''scientific notation with Sdigit significant digits TextWindow.WriteLine(Tout) Else Temp= Text.GetSubText(Tout,1,1+Sdigit) Temp= Math.Round(Temp/10) TextWindow.Write(Text.GetSubText(Tout,1,1)+Ds) TextWindow.Write(Text.GetSubTextToEnd(Temp,2)) TextWindow.WriteLine(" * 10^"+(Lout-1)) EndIf EndIf ''output EndFor ''======================================================================== Sub Multiply ''in/output vars: m[1..Mmax] array for 6-digit parts '' Mmax: maximum index of array; mult: multiplier ''local vars: M_i M_carry For M_i= 1 To Mmax m[M_i]= m[M_i]*i EndFor For M_i= 1 To Mmax M_carry= Math.Floor(m[M_i]/1000000) m[M_i]= Math.Remainder(m[M_i],1000000) m[1+M_i]= M_carry+m[1+M_i] EndFor If m[Mmax+1] > 0 Then Mmax= Mmax+1 EndIf EndSub ''======================================================================== End>RDT140-0.sb< Start>RDT140.sb< '' Factorial 2012-04-20 WhTurner '''========================== '' Adjustable parameters: First=52 '' first factorial in output (make equal to Last for only one factorial) Last=52 '' last factorial in output Sdigit=6 '' number of significant digits in scientific notation (1 .. 12) '' use 0(zero) for string output Ts="" ''Thousends separator ( " " space ; "," komma or "" nothing ) Ds="," ''Decimal separator '' ========================== m[1]=1 Mmax=1 Empty=" " For i=1 to Last mult=i multiply() If i>=First Then ''output Tout=m[Mmax] For j=Mmax-1 To 1 Step -1 out="x00000000"+m[j] Lout= Text.GetLength(out) out=Text.GetSubTextToEnd(out,Lout-5) Tout= Text.Append(Tout,out) endfor Lout= Text.GetLength(Tout) L= Text.GetLength(i) TextWindow.Write(Text.GetSubText(Empty,1,4-L)+i+"! = ") If Sdigit=0 then '''print string L= Math.Ceiling(Lout/3)*3-Lout Tout= Text.Append(Text.GetSubText(Empty,1,L),Tout) Lout=Lout+L For j=1 To Lout-3 Step 3 TextWindow.Write(Text.GetSubText(Tout,j,3)+Ts) endfor TextWindow.WriteLine(Text.GetSubTextToEnd(Tout,Lout-2)) Else ''scientific notation with Sdigit significant digits If Lout0 Then Mmax=Mmax+1 EndIf EndSub End>RDT140.sb< Start>RFC885.sb< Start: total=0 total2=0 total3=0 TextWindow.WriteLine( " Enter Your Number ") User_Number = TextWindow.Read() Length=Text.GetLength(User_Number) TextWindow.WriteLine(" User Number lenght is " + Length) For i= 1 To Length Disp= Text.GetSubText(User_Number,i,1) TextWindow.WriteLine (" your sub number is "+ Disp) Helper= Disp total = total+Helper EndFor TextWindow.ForegroundColor = "yellow TextWindow.WriteLine (" your First sum is " + total) TextWindow.ForegroundColor = "white Length2= Text.GetLength(total) TextWindow.WriteLine(" User Number lenght is " + Length2) for j=1 to Length2 Disp2=Text.GetSubText(total ,j ,1) TextWindow.WriteLine (" your sub number "+ Disp2) helper2=Disp2 total2=total2+helper2 EndFor TextWindow.ForegroundColor = "yellow TextWindow.WriteLine ("your Second sum is " + total2) TextWindow.ForegroundColor = "white Length3= Text.GetLength(total2) TextWindow.WriteLine(" User Number lenght is " + Length3) If Length3 = 1 then Goto end Else for x=1 to Length3 Disp3=Text.GetSubText(total2 ,x,1) TextWindow.WriteLine (" your sub number "+ Disp3) helper3=disp3 total3=total3+helper3 EndFor TextWindow.ForegroundColor = "yellow TextWindow.WriteLine ("your Last sum is " + total3) TextWindow.ForegroundColor = "white EndIf end: Goto Start End>RFC885.sb< Start>RFG379.sb< ' アクションゲーム No.1 ' ' 岡山科学技術専門学校 情報システム学科 教材 ' 各種定数の定義 ss=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 = "#000000" ' 背景の色 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] = "101111101111011111111111" 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] = "111111011110111111111001" 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] = "100111111111111111110111" 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] = "101010111110000000011111" WALLS [15] = "100000111111000000010001" WALLS [16] = "101010111111100111110001" 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 = 18 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 * 4 exd[2] = 0 eyd[2] = 1 ex[3] = UNIT_SIZE * 2 ey[3] = UNIT_SIZE * 9 exd[3] = 0 eyd[3] = 1 ex[4] = UNIT_SIZE * 3 ey[4] = UNIT_SIZE * 6 exd[4] = 0 eyd[4] = 1 ex[5] = UNIT_SIZE * 18 ey[5] = UNIT_SIZE * 7 exd[5] = 0 eyd[5] = 1 ex[6] = UNIT_SIZE * 6 ey[6] = UNIT_SIZE * 1 exd[6] = 0 eyd[6] = 1 ex[7] = UNIT_SIZE * 7 ey[7] = UNIT_SIZE * 1 exd[7] = 0 eyd[7] = 1 ex[8] = UNIT_SIZE * 7 ey[8] = UNIT_SIZE * 7 exd[8] = 0 eyd[8] = 1 ex[9] = UNIT_SIZE * 8 ey[9] = UNIT_SIZE * 2 exd[9] = 0 eyd[9] = 1 ex[10] = UNIT_SIZE * 8 ey[10] = UNIT_SIZE * 10 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 * 11 ey[12] = UNIT_SIZE * 8 exd[12] = 0 eyd[12] = 1 ex[13] = UNIT_SIZE * 12 ey[13] = UNIT_SIZE * 1 exd[13] = 0 eyd[13] = 1 ex[14] = UNIT_SIZE * 12 ey[14] = UNIT_SIZE * 5 exd[14] = 0 eyd[14] = 1 ex[15] = UNIT_SIZE * 13 ey[15] = UNIT_SIZE * 1 exd[15] = 0 eyd[15] = 1 ex[16] = UNIT_SIZE * 16 ey[16] = UNIT_SIZE * 1 exd[16] = 0 eyd[16] = 1 ex[17] = UNIT_SIZE * 16 ey[17] = UNIT_SIZE * 9 exd[17] = 0 eyd[17] = 1 ex[18] = UNIT_SIZE * 17 ey[18] = UNIT_SIZE * 1 exd[18] = 0 eyd[18] = 1 Endif If ss=4 then ENEMY_NUM = 14 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000000000000000001" WALLS [3] = "111111111111111111111001" WALLS [4] = "100000011000100001110001" WALLS [5] = "100000000000000000000001" WALLS [6] = "100100100001111000100011" WALLS [7] = "100011111111111111111111" WALLS [8] = "110011111111111111111111" WALLS [9] = "100011111111111111111111" WALLS [10] = "100011111111111111111111" WALLS [11] = "100111111111111111111111" WALLS [12] = "100011111111111111111111" WALLS [13] = "100011000010011100000001" WALLS [14] = "100000000000000000000001" WALLS [15] = "110000001110001000111001" 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 = 35 ENEMY_SPEED = 8 WALLS [1] = "111111111111111111111111" WALLS [2] = "100001100001100001100001" WALLS [3] = "111100001100001100001101" WALLS [4] = "111101101101101101101101" WALLS [5] = "100001100001100001100001" WALLS [6] = "101100001100001100001111" WALLS [7] = "101101101101101101101111" WALLS [8] = "100001100001100001100001" WALLS [9] = "111100001100001100001101" WALLS [10] = "111101101101101101101101" WALLS [11] = "100001100001100001100001" WALLS [12] = "101100001100001100001111" WALLS [13] = "101111111111111111111111" WALLS [14] = "100100000000000000010001" WALLS [15] = "100000000000000010000101" WALLS [16] = "100000000100000000000101" WALLS [17] = "100100000000000000000101" WALLS [18] = "111111111111111111111111" ex[1] = UNIT_SIZE * 4 ey[1] = UNIT_SIZE * 3 exd[1] = 0 eyd[1] = 0 ex[2] = UNIT_SIZE * 7 ey[2] = UNIT_SIZE * 3 exd[2] = 0 eyd[2] = 0 ex[3] = UNIT_SIZE * 10 ey[3] = UNIT_SIZE * 3 exd[3] = 0 eyd[3] = 0 ex[4] = UNIT_SIZE * 13 ey[4] = UNIT_SIZE * 3 exd[4] = 0 eyd[4] = 0 ex[5] = UNIT_SIZE * 16 ey[5] = UNIT_SIZE * 3 exd[5] = 0 eyd[5] = 0 ex[6] = UNIT_SIZE * 19 ey[6] = UNIT_SIZE * 3 exd[6] = 0 eyd[6] = 0 ex[7] = UNIT_SIZE * 4 ey[7] = UNIT_SIZE * 6 exd[7] = 0 eyd[7] = 0 ex[8] = UNIT_SIZE * 7 ey[8] = UNIT_SIZE * 6 exd[8] = 0 eyd[8] = 0 ex[9] = UNIT_SIZE * 10 ey[9] = UNIT_SIZE * 6 exd[9] = 0 eyd[9] = 0 ex[10] = UNIT_SIZE * 13 ey[10] = UNIT_SIZE * 6 exd[10] = 0 eyd[10] = 0 ex[11] = UNIT_SIZE * 16 ey[11] = UNIT_SIZE * 6 exd[11] = 0 eyd[11] = 0 ex[12] = UNIT_SIZE * 19 ey[12] = UNIT_SIZE * 6 exd[12] = 0 eyd[12] = 0 ex[13] = UNIT_SIZE * 4 ey[13] = UNIT_SIZE * 9 exd[13] = 0 eyd[13] = 0 ex[14] = UNIT_SIZE * 7 ey[14] = UNIT_SIZE * 9 exd[14] = 0 eyd[14] = 0 ex[15] = UNIT_SIZE * 10 ey[15] = UNIT_SIZE * 9 exd[15] = 0 eyd[15] = 0 ex[16] = UNIT_SIZE * 13 ey[16] = UNIT_SIZE * 9 exd[16] = 0 eyd[16] = 0 ex[17] = UNIT_SIZE * 16 ey[17] = UNIT_SIZE * 9 exd[17] = 0 eyd[17] = 0 ex[18] = UNIT_SIZE * 19 ey[18] = UNIT_SIZE * 9 exd[18] = 0 eyd[18] = 0 ex[19] = UNIT_SIZE * 4 ey[19] = UNIT_SIZE * 7 exd[19] = 0 eyd[19] = 1 ex[20] = UNIT_SIZE * 4 ey[20] = UNIT_SIZE * 3 exd[20] = 0 eyd[20] = -1 ex[21] = UNIT_SIZE * 7 ey[21] = UNIT_SIZE * 2 exd[21] = 0 eyd[21] = 1 ex[22] = UNIT_SIZE * 7 ey[22] = UNIT_SIZE * 8 exd[22] = 0 eyd[22] = 1 ex[23] = UNIT_SIZE * 10 ey[23] = UNIT_SIZE * 9 exd[23] = 0 eyd[23] = -1 ex[24] = UNIT_SIZE * 10 ey[24] = UNIT_SIZE * 4 exd[24] = 0 eyd[24] = 1 ex[25] = UNIT_SIZE * 13 ey[25] = UNIT_SIZE * 11 exd[25] = 0 eyd[25] = -1 ex[26] = UNIT_SIZE * 13 ey[26] = UNIT_SIZE * 4 exd[26] = 0 eyd[26] = 1 ex[27] = UNIT_SIZE * 16 ey[27] = UNIT_SIZE * 2 exd[27] = 0 eyd[27] = -1 ex[28] = UNIT_SIZE * 16 ey[28] = UNIT_SIZE * 7 exd[28] = 0 eyd[28] = 1 ex[29] = UNIT_SIZE * 19 ey[29] = UNIT_SIZE * 10 exd[29] = 0 eyd[29] = -1 ex[30] = UNIT_SIZE * 19 ey[30] = UNIT_SIZE * 5 exd[30] = 0 eyd[30] = 1 ex[31] = UNIT_SIZE * 6 ey[31] = UNIT_SIZE * 13 exd[31] = 1 eyd[31] = 0 ex[32] = UNIT_SIZE * 5 ey[32] = UNIT_SIZE * 14 exd[32] = 1 eyd[32] = 0 ex[33] = UNIT_SIZE * 7 ey[33] = UNIT_SIZE * 15 exd[33] = 1 eyd[33] = 0 ex[34] = UNIT_SIZE * 16 ey[34] = UNIT_SIZE * 15 exd[34] = 1 eyd[34] = 0 ex[35] = UNIT_SIZE * 11 ey[35] = UNIT_SIZE * 16 exd[35] = 1 eyd[35] = 0 Endif If ss=6 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=7 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=8 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=9 then ENEMY_NUM = 8 ENEMY_SPEED = 11 WALLS [1] = "111111111111111111111111" WALLS [2] = "100000000100011111111111" WALLS [3] = "100000000000011111011111" WALLS [4] = "100000011100011111011111" 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] = "110101011100000000000001" 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=10 then GraphicsWindow.ShowMessage("次のステージ、現在作成中", "今はここまで") ss=0 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"だったら ' 壁を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:下) キーボード受付用 ' Enemy Position ' ロボット初期描画 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 ' キーボードイベントの設定 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 = BACK_COLOR GraphicsWindow.PenColor = BACK_COLOR GraphicsWindow.FillEllipse(x - 135, y - 135, 300, 300) GraphicsWindow.ShowMessage("ギャーーー!!", "OUT") Goto st EndIf EndFor ' 速度調整のための待機 Program.Delay(DELAY) EndWhile If status = "GOAL" then GraphicsWindow.ShowMessage("次のステージへ", "ゴール") ss=ss+1 goto st EndIf ' サブルーチン (キーが押されたときに呼ばれる) 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)に EndIf EndSub End>RFG379.sb< Start>RFH217.sb< Microsoft Small Basic Program Listing: Get Microsoft Silverlight Embed this in your website '*************************************************** ' Small Basic Chomper (SBC) v 1.0 ' Pacman-style game (BETA) 'Version 1.3.7.13 (online version) ' ' Software designed & written in BASIC by Anthony Yarrell (QBasicLover in the SB forums) ' Designed for Microsoft Small Basic 1.0 ' March 2013 ' 'Sprites created using Microsoft Paint 'Maze designed using Microsoft Excel ' '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 Copyright (c) Microsoft Corporation. All rights reserved. End>RFH217.sb< Start>RFH485.sb< '************************************************************************** 'Initialise '************************************************************************* GraphicsWindow.Hide() GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp movingBullet = "false" 'bullet fires when it's off screen InitGW() background = ImageList.LoadImage("http://s23.postimg.org/qhdyatkzv/My_Image_jpg.jpg") gun = ImageList.LoadImage("http://s22.postimg.org/n4mh54o4h/Character_finished.gif") 'draw b/ground GraphicsWindow.DrawResizedImage(background, 0, 0, gw, gh) 'to change b/ground try redrawing 'add and centre the Gun Man (sprite) gunWidth = ImageList.GetWidthOfImage(gun) gunHeight = ImageList.GetHeightOfImage(gun) gun = Shapes.AddImage(gun) gunX = gw/2 - gunWidth/2 gunY = gh - gunHeight Shapes.Move(gun, gunX, gunY) 'add and hide the bullet. Will show when fired bulletRadius = 10 bullet = Shapes.AddEllipse(bulletRadius * 2, bulletRadius * 2) Shapes.HideShape(bullet) 'once Initial setup is complete, show the GW GraphicsWindow.Show() '********************************************************************************* 'Game Loop - all position changes and corresponding Shape.Moves are done here. 'no Shape.Moves are done in the Event subs '********************************************************************************* While "true" UpdateGamePlay() UpdateFrame() Program.Delay(20) EndWhile '******************************************************************************** 'Subroutines '******************************************************************************** Sub UpdateGamePlay If keyRight Then gunX = gunX + 5 EndIf If keyLeft Then gunX = gunX - 5 EndIf If movingBullet = "true" Then bulletY = bulletY - 20 EndIf If bulletY < 0 Then Shapes.HideShape(bullet) movingBullet = "false" EndIf If spaceKey Then movingBullet = "true" bulletX = Shapes.GetLeft(gun) + 5 bulletY = Shapes.GetTop(gun) - 5 Shapes.ShowShape(bullet) spaceKey = "false" EndIf EndSub Sub UpdateFrame Shapes.Move(gun, gunX, gunY) Shapes.Move(bullet, bulletX, bulletY) EndSub Sub InitGW 'you can put all the Initial Setup here GraphicsWindow.Title = "Zombie Adventure" gw = 1000 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.CanResize = "false" GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = 10 EndSub '***************************************************************************** 'Event Subroutines - don't Shapes.Move here, just flag that an event happened '**************************************************************************** Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Right" Then keyRight = "true" ElseIf lastKey = "Left" Then keyLeft = "true" ElseIf lastKey = "Space" And movingBullet = "false" Then 'TextWindow.WriteLine("on space down") 'debug - see what's happening spaceKey = "true" EndIf EndSub Sub OnKeyUp lastKey = GraphicsWindow.LastKey If lastKey = "Right" Then keyRight = "false" ElseIf lastKey = "Left" Then keyLeft = "false" EndIf EndSub End>RFH485.sb< Start>RFL372.sb< colors="0=Black;1=Blue;2=Red;3=Magenta;4=Purple;5=Green;6=Cyan;7=Yellow" ' Colors displayed in the color palette, use array initializer syntax For i=0 To Array.GetItemCount(colors)-1 ' Render color palette on left side of the Graphics window GraphicsWindow.BrushColor=colors[i] GraphicsWindow.FillRectangle(0, i*15, 15, 15) EndFor GraphicsWindow.PenColor=colors[0] 'Initialize to first color in color palette mouseDrawing = 0 ' Used to determine if we are starting a new line (mouseDrawing = 0) or drawing a line segment (mouseDrawing = 1) While 1=1 ' Loop forever If Mouse.IsLeftButtonDown Then ' If the mouse is down If mouseDrawing=0 And GraphicsWindow.MouseX < 15 And GraphicsWindow.MouseY < (Array.GetItemCount(colors)) * 15 Then ' Test if the mouse click is in the palette and we are not already drawing GraphicsWindow.PenColor=colors[Math.Floor(GraphicsWindow.MouseY / 15)] ' Select color from palette based on the mouse position at the time of the click Else newX = GraphicsWindow.MouseX newY = GraphicsWindow.MouseY If mouseDrawing=1 And (lastX <> newX Or lastY <> newY) Then ' If we are drawing and the mouse position has changed GraphicsWindow.DrawLine(lastX, lastY, newX, newY) ' we can draw the new line segment from the last postion to the new position EndIf lastX = newX lastY = newY mouseDrawing = 1 ' Set the flag indicating that we have started drawing EndIf Else mouseDrawing = 0 ' The mouse button is no longer pressed so we can reset the drawing flag EndIf EndWhile End>RFL372.sb< Start>RFL427.sb< GraphicsWindow.Width=1024 GraphicsWindow.Height=768 GraphicsWindow.Left=0 GraphicsWindow.top=0 GraphicsWindow.CanResize=0 GraphicsWindow.Title="MusicMaker Plus+" logo1=program.Directory+"\images\firemonkeylogo.png" logo2=program.Directory+"\images\musicmakerlogo.png" violin=program.Directory+"\images\violin.png" beta=program.Directory+"\images\beta.png" GraphicsWindow.DrawResizedImage(logo1,0,0,1024,768) GraphicsWindow.BrushColor="Black" GraphicsWindow.DrawText(440,20,"F") Program.Delay(100) GraphicsWindow.DrawText(450,20,"i") Program.Delay(100) GraphicsWindow.DrawText(460,20,"r") Program.Delay(100) GraphicsWindow.DrawText(470,20,"e") Program.Delay(100) GraphicsWindow.DrawText(480,20,"M") Program.Delay(100) GraphicsWindow.DrawText(490,20,"o") Program.Delay(100) GraphicsWindow.DrawText(500,20,"n") Program.Delay(100) GraphicsWindow.DrawText(510,20,"k") Program.Delay(100) GraphicsWindow.DrawText(520,20,"e") Program.Delay(100) GraphicsWindow.DrawText(530,20,"y") Program.Delay(100) GraphicsWindow.DrawText(540,20,"M") Program.Delay(100) GraphicsWindow.DrawText(550,20,"o") Program.Delay(100) GraphicsWindow.DrawText(560,20,"v") Program.Delay(100) GraphicsWindow.DrawText(570,20,"e") Program.Delay(200) GraphicsWindow.FontSize=50 GraphicsWindow.DrawText(380,60,"PRESENTS") Program.Delay(2000) GraphicsWindow.Clear() GraphicsWindow.BackgroundColor="Black" GraphicsWindow.BrushColor="Red" GraphicsWindow.FontSize=50 GraphicsWindow.DrawResizedImage(logo2,150,10,700,90) GraphicsWindow.DrawResizedImage(violin,0,90,900,500) GraphicsWindow.DrawResizedImage(beta,150,80,300,90) GraphicsWindow.DrawText(120,670,"A") GraphicsWindow.DrawText(240,670,"S") GraphicsWindow.DrawText(360,670,"D") GraphicsWindow.DrawText(480,670,"F") GraphicsWindow.DrawText(600,670,"G") GraphicsWindow.DrawText(720,670,"H") GraphicsWindow.DrawText(840,670,"J") GraphicsWindow.DrawText(960,670,"K") GraphicsWindow.KeyDown=down Sub down If GraphicsWindow.LastKey="A" Then Sound.PlayMusic("O4 C") endif If GraphicsWindow.LastKey="S" Then Sound.PlayMusic("O4 D") endif If GraphicsWindow.LastKey="D" Then Sound.PlayMusic("O4 E") endif If GraphicsWindow.LastKey="F" Then Sound.PlayMusic("O4 F") endif If GraphicsWindow.LastKey="G" Then Sound.PlayMusic("O4 G") endif If GraphicsWindow.LastKey="H" Then Sound.PlayMusic("O4 A") endif If GraphicsWindow.LastKey="J" Then Sound.PlayMusic("O4 B") EndIf If GraphicsWindow.LastKey="K" Then Sound.PlayMusic("O5 C8") EndIf If GraphicsWindow.LastKey="Space" Then Sound.PlayMusic("O5 C8 C8 G8 G8 A8 A8 G4 F8 F8 E8 E8 D8 D8 C4") endif endsub End>RFL427.sb< Start>RFL575.sb< GraphicsWindow.CanResize = "False" '<------------ GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor= "green"'"#e6e6f6" GraphicsWindow.Width = "1080" GraphicsWindow.Height = "555" Coyote() For j=1 to Array.GetItemCount(dat) GraphicsWindow.PenWidth = dat[j]["pw"] GraphicsWindow.PenColor = dat[j]["pc"] line_shapes() endfor Sub line_shapes RD=pos[j] cpx= Text.GetIndexOf(RD,",") ' next comma position x While cpx>0 NN=NN+1 x1= Text.GetSubText(RD,1,cpx-1) ' x1 point RD= text.GetSubTextToEnd(RD,cpx+1) cpy= Text.GetIndexOf(RD,",") y1= Text.GetSubText(RD,1,cpy-1) ' y1 point RD= text.GetSubTextToEnd(RD,cpy+1) cpx= Text.GetIndexOf(RD,",") x2= Text.GetSubText(RD,1,cpx-1) ' x2 point RD= text.GetSubTextToEnd(RD,cpx+1) cpy= Text.GetIndexOf(RD,",") y2= Text.GetSubText(RD,1,cpy-1) ' y2 point lshp[NN]=shapes.AddLine(x1,y1,x2,y2)' add shape line '--------------------------------------------------------------------------- RD= text.GetSubTextToEnd(RD,cpy+1) ' remained data cpx= Text.GetIndexOf(RD,",") ' next comma position x EndWhile EndSub Sub Coyote '------------------------------Wile E Coyote---------------------------------------------------------------------------------- dat[1]="pw=4;pc=darkred;tag=face" dat[2]="pw=4;pc=yellow;tag=nosy" dat[3]="pw=4;pc=darkslateblue;tag=mouth" dat[4]="pw=4;pc=blue;tag=ears" dat[5]="pw=4;pc=darkslategray;tag=eyes" dat[6]="pw=11;pc=snow;tag=eyes" pos[1]="380,440,520,440,380,440,250,290,252,148,252,292,520,440,620,290,620,148,620,292," pos[1]=pos[1]+"250,150,310,30,310,30,360,150,360,150,380,100,380,100,400,150,400,150,400,70," pos[1]=pos[1]+"400,70,420,150,420,150,440,70,440,70,450,150,450,150,480,100,480,100,510,150," pos[1]=pos[1]+"510,150,540,30,540,30,620,150,330,240,420,300,330,270,420,300,330,310,420,300," pos[1]=pos[1]+"330,330,420,300,540,240,470,300,540,270,470,300,540,300,470,300,540,330,470,300," pos[2]="420,250,420,320,420,250,470,250,470,250,470,320,420,320,470,320," pos[3]="400,350,500,350,420,390,480,390,400,350,420,390,500,350,480,390," pos[4]="280,150,295,115,295,115,315,150,280,150,315,150,540,150,555,115,555,115,570,150,540,150,575,150," pos[5]="290,240,330,240,290,240,290,210,290,210,330,210,330,210,330,240,540,240,580,240," pos[5]=pos[5]+"540,240,540,210,580,210,580,240,540,210,580,210," pos[6]="300,225,315,225,550,225,565,225," endsub End>RFL575.sb< Start>RFM518-0.sb< GraphicsWindow.Height = 100 GraphicsWindow.Width = 300 GraphicsWindow.Title = "Enter key..." GraphicsWindow.FontSize = 30 'Define not allowed key as sample F1, F2, F3 and F4 NotAlowed[1] = "F1" NotAlowed[2] = "F2" NotAlowed[3] = "F3" NotAlowed[4] = "F4" label = Controls.AddTextBox(25, 25) Controls.SetSize(label, 250, 50) GraphicsWindow.KeyDown = OnKeyDown Sub OnKeyDown Value = GraphicsWindow.LastKey if Array.ContainsValue(NotAlowed, Value) = "False" Then Controls.SetTextBoxText(label, Value) EndIf EndSub End>RFM518-0.sb< Start>RFM518.sb< GraphicsWindow.Height = 100 GraphicsWindow.Width = 300 GraphicsWindow.Title = "Enter key..." GraphicsWindow.FontSize = 30 label = Controls.AddTextBox(25, 25) Controls.SetSize(label, 250, 50) GraphicsWindow.KeyDown = OnKeyDown Sub OnKeyDown Controls.SetTextBoxText(label, GraphicsWindow.LastKey) EndSub End>RFM518.sb< Start>RFN007.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_OldX[i] = Drop_X[i] + 1 Drop_OldY[i] = Drop_Y[i] + 1 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_X[i] <> Drop_OldX[i] or Drop_Y[i] <> Drop_OldY[i] And Drop_X[i] > -500 Then Shapes.Zoom(Drop[i],Drop_Radius[i]/12,Drop_Radius[i]/12) '/15 Shapes.Move(Drop[i],Drop_X[i],Drop_Y[i]) CheckDistance() endif Drop_OldX[i] = Drop_X[i] Drop_OldY[i] = Drop_Y[i] 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]) and Distance < GW Then Drop_X[b] = Drop_X[b] + (Drop_X[i] - Drop_X[b]) / Distance / Distance * 50 Drop_Y[b] = Drop_Y[b] + (Drop_Y[i] - Drop_Y[b]) / Distance / Distance * 50 endif endif endfor endsub End>RFN007.sb< Start>RFN037.sb< ' Pictionary - Russian ' Copyright © 2017 Nonki Takahashi. The MIT License. GraphicsWindow.Title = "Pictionary" SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" ' initialize shapes Shapes_Init() angle = 0 ' dummy ' add shapes scale = 1 iMin = 1 iMax = 4 Shapes_Add() Sub Shapes_Init ' 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] = "pw=0;bc=#FFF;func=rect;width=360;height=80;x=119;y=94;" shape[2] = "pw=0;bc=#D52B1E;func=rect;width=360;height=80;x=119;y=174;" shape[3] = "pw=0;bc=#0039A6;func=rect;width=360;height=80;x=119;y=254;" shape[4] = "pw=0;bc=Black;fs=50;fn=Trebuchet MS;fb=False;fi=False;func=text;text=Russian;x=398;y=354;" 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 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_CalcRotatePos ' Shapes | Calculate position for rotated 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 ' 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) 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 ' 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 Sub Shapes_Move ' Shapes | Move shapes ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - to zoom ' param x, y - position to move ' return shX, shY - new position of shapes Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax shp = shape[i] If silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove ' Shapes | Remove shapes ' param iMin, iMax - shapes indices to remove ' param shape - array of shapes 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 ' Shapes | Rotate shapes ' param iMin, iMax - shapes indices to rotate ' param shape - array of shapes ' param cx, cy - rotation center ' param scale - to zoom ' param angle - to rotate Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) 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 If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(angle + shp["angle"]) SB_RotateWorkAround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shp["obj"], angle + shp["angle"]) shape[i] = shp EndFor y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>RFN037.sb< Start>RFQ073.sb< width = 1000 'meters height = 700'meters GraphicsWindow.Height=height GraphicsWindow.Width=width GraphicsWindow.Top=0 GraphicsWindow.BackgroundColor="darkblue" GraphicsWindow.brushcolor="white" t=0'time g = -9.8 x=0 y=700 for h_1 = 0 To height Step 100 GraphicsWindow.DrawText(0, height-h_1, h_1) endfor For w_1 = 0 To width Step 100 GraphicsWindow.DrawText(w_1,height - 30, w_1) endfor GraphicsWindow.DrawText(width-350, 20, "Horizontal Velocity") GraphicsWindow.DrawText(width-350, 60, "Vertical Velocity") GraphicsWindow.brushcolor="red" hvelocity=Controls.AddTextBox(width-200, 20) vvelocity=Controls.AddTextBox(width-200, 60) launch = Controls.AddButton("Launch",width-200, 100) GraphicsWindow.brushcolor="red" projectile =Shapes.AddEllipse(20, 20) Shapes.Move(projectile, 0,790) Controls.ButtonClicked=launching notanswer = "True" While notanswer If clicked = launch Then vvelocity=Controls.GetTextBoxText(vvelocity) hvelocity=Controls.GetTextBoxText(hvelocity) While objectheight>=0 proceed() 'TextWindow.WriteLine("Luach proceeded") endwhile notanswer="False" clicked="" Else 'TextWindow.WriteLine("nothing lciked") EndIf Program.Delay(250) endwhile TextWindow.WriteLine("ended") Sub launching clicked= Controls.LastClickedButton 'TextWindow.WriteLine("Clicked") 'TextWindow.WriteLine("Button clicked was " + clicked) EndSub sub proceed t= t +0.1 objectheight = (vvelocity*t)+0.5*g*(t*t) objectdis = (hvelocity*t) 'TextWindow.WriteLine(objectdis + " , " + objectheight + "at time " + t) GraphicsWindow.DrawLine(x,y, objectdis, height-objectheight) x= objectdis y = height - objectheight Shapes.Move(projectile,objectdis, height - objectheight) Program.Delay(100) 'TextWindow.WriteLine("Shot ball") endsub Sub equation If vvelocity <> "" And hvelocity <>"" then objectheight = (vvelocity*t)+0.5*g*(t*t) objectdis = (hvelocity*t) launch = "True" Else launch="False" EndIf endsub End>RFQ073.sb< Start>RFS623.sb< dw=900 dh=dw GraphicsWindow.BackgroundColor ="Darkblue GraphicsWindow.Width = dw GraphicsWindow.Height = dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 GraphicsWindow.Title ="3d stars T_x=0 T_y=-40 T_Angle=180 deg=44/7/360 view3D = LD3DView.AddView(dw,dh,"True") InitStars () 'Some different light types LD3DView.AddDirectionalLight(view3D,"Pink",-1,-1,-1) LD3DView.AddDirectionalLight(view3D,"DarkBlue",1,1,1) LD3DView.AddAmbientLight(view3D,"#50111111") 'Initial camera position and direction and view angle LD3DView.ResetCamera(view3D,0,0,170, 0,0,-1,"","","") num = Array.GetItemCount(star) r9=7 For i = 1 To num ra = star[i]["RA"]'azim dec = star[i]["Dec"]'elev RADec2XY () mag = star[i]["Mag"] d = 0.2 / mag ss=LD3DView.AddSphere (view3D d 10 "white" "E") LD3DView.TranslateGeometry (view3D ss LDMath.Cos(x/3)*r9*ldmath.Sin(y) LDMath.cos(y)*r9 LDMath.sin(y)* LDMath.sin(x/3)*r9) EndFor r51=7 For x=0 to 360-15 step 15 tt="" For y=90 to 270 step 5 px=LDMath.Cos(x)*r51*ldmath.Sin(y-90) pz=LDMath.cos(y-90)*r51 py=LDMath.sin(y-90)*LDMath.sin(x)*r51 tt=tt+px+":"+pz+":"+py+":" endfor LD3DView.AddTube (view3D tt .05 12 LDColours.HSLtoRGB (x 1 .5) "E") endfor For y=0 to 180 step 10 tt="" For x=0 to 360 step 2 px=LDMath.Cos(x)*r51*ldmath.Sin(y) pz=LDMath.cos(y)*r51 py=LDMath.sin(y)*LDMath.sin(x)*r51 tt=tt+px+":"+pz+":"+py+":" endfor LD3DView.AddTube (view3D tt .05 12 LDColours.HSLtoRGB (180 1 .4) "E") endfor pn=LD3DView.AddSphere (view3D 7 14 "blue" "D") LD3DView.TranslateGeometry (view3D pn 0 0 0) LD3DView.AutoControl("true" "true", -1 3) fk=1 GraphicsWindow.KeyDown=kdd rott="true Sub kdd If GraphicsWindow.LastKey ="Space" Then rott="true Else rott="false EndIf EndSub While 1=1 For n=0 To 360 Step .2 deg=deg-1 x=ldMath.Sin(n)*17*fk z=ldmath.Cos(n)*17*fk If rott then LD3DView.ResetCamera(view3D,x,0,z,-x*5,40,-z*5,"","","") 'LD3DView.SetBillBoard (view3D pn) endif Program.Delay(10) EndFor EndWhile Sub InitStars st= "ra=03 24 19.35;dec=+49 51 40.5;mag=1.79;fd=33|ra=03 08 10.13;dec=+40 57 20.3;mag=2.09;fd=26|ra=03 54 07.92;dec=+31 53 01.2;mag=2.84;fd=44|ra=03 57 51.22;dec=+40 00 37.0;mag=2.90;fd=45|ra=03 04 47.79;dec=+53 30 23.2;mag=2.91;fd=23|ra=03 04 44.10;dec=+53 31 10.0;mag=3.00;fd=23|ra=03 42 55.48;dec=+47 47 15.6;mag=3.01;fd=39|ra=03 05 10.50;dec=+38 50 25.9;mag=3.32;fd=25|ra=02 50 41.79;dec=+55 53 43.9;mag=3.77;fd=15|ra=03 45 11.64;dec=+42 34 42.8;mag=3.77;fd=41|ra=03 09 29.63;dec=+44 51 28.4;mag=3.79;fd=27|ra=03 44 19.13;dec=+32 17 17.8;mag=3.84;fd=38|ra=02 54 15.46;dec=+52 45 45.0;mag=3.93;fd=18|ra=04 08 39.67;dec=+47 42 45.3;mag=3.96;fd=48|ra=03 58 57.90;dec=+35 47 27.7;mag=3.98;fd=46|ra=02 54 20.80;dec=+52 45 30.0;mag=4.00;fd=18|ra=01 43 39.62;dec=+50 41 19.6;mag=4.01|ra=03 09 02.88;dec=+49 36 48.6;mag=4.05|ra=02 44 11.69;dec=+49 13 43.2;mag=4.10;fd=13|ra=04 14 53.86;dec=+48 24 33.7;mag=4.12;fd=51|ra=02 50 34.91;dec=+38 19 08.1;mag=4.22;fd=16|ra=04 06 35.06;dec=+50 21 04.9;mag=4.25;fd=47|ra=04 36 41.43;dec=+41 15 53.5;mag=4.25;fd=58|ra=03 36 29.36;dec=+48 11 33.7;mag=4.32;fd=37|ra=03 30 34.48;dec=+47 59 42.6;mag=4.36;fd=35|ra=02 51 30.83;dec=+35 03 35.6;mag=4.56;fd=17|ra=04 18 14.58;dec=+50 17 44.3;mag=4.60|ra=03 11 17.40;dec=+39 36 41.7;mag=4.61;fd=28|ra=03 29 22.03;dec=+49 30 32.5;mag=4.67;fd=34|ra=04 14 53.31;dec=+40 29 01.4;mag=4.67;fd=52|ra=02 58 45.65;dec=+39 39 46.2;mag=4.68;fd=22|ra=03 05 32.43;dec=+56 42 20.0;mag=4.77|ra=04 21 33.15;dec=+46 29 56.3;mag=4.80;fd=53|ra=03 18 43.82;dec=+34 13 21.6;mag=4.85|ra=04 49 54.67;dec=+37 29 17.5;mag=4.89;fd=(1)|ra=02 42 14.93;dec=+40 11 39.8;mag=4.91;fd=12|ra=04 20 24.66;dec=+34 34 00.3;mag=4.93;fd=54|ra=02 59 03.71;dec=+35 10 59.2;mag=4.94;fd=24|ra=03 21 26.61;dec=+43 19 46.7;mag=4.96;fd=32|ra=03 42 22.64;dec=+33 57 54.1;mag=4.97;fd=40|ra=02 02 18.07;dec=+54 29 15.2;mag=4.99;fd=4|ra=03 28 03.05;dec=+49 03 46.6;mag=4.99|ra=03 19 07.62;dec=+50 05 42.1;mag=5.05;fd=31|ra=02 57 17.28;dec=+31 56 03.5;mag=5.10;fd=21|ra=03 49 32.70;dec=+33 05 29.0;mag=5.14;fd=42|ra=02 22 21.43;dec=+55 50 44.4;mag=5.16;fd=9|ra=03 18 37.72;dec=+50 13 20.0;mag=5.16;fd=29|ra=03 56 36.44;dec=+50 41 44.5;mag=5.28;fd=43|ra=03 32 26.30;dec=+46 03 25.4;mag=5.30;fd=36|ra=04 42 54.30;dec=+43 21 55.0;mag=5.30;fd=59|ra=03 23 13.18;dec=+49 12 48.0;mag=5.32|ra=02 53 42.58;dec=+38 20 15.6;mag=5.34;fd=20|ra=02 44 05.16;dec=+44 17 49.4;mag=5.43;fd=14|ra=03 32 08.58;dec=+48 01 24.7;mag=5.47|ra=03 17 47.33;dec=+44 01 30.3;mag=5.49;fd=30|ra=04 08 36.49;dec=+38 02 24.8;mag=5.52;fd=50|ra=01 51 59.31;dec=+55 08 50.7;mag=5.53;fd=1|ra=04 20 11.51;dec=+50 55 15.4;mag=5.55|ra=02 08 40.58;dec=+58 25 25.0;mag=5.66|ra=01 52 09.35;dec=+50 47 34.3;mag=5.70;fd=2|ra=01 58 33.50;dec=+49 12 15.3;mag=5.70;fd=3|ra=04 24 29.14;dec=+34 07 51.0;mag=5.73;fd=55|ra=02 17 59.82;dec=+57 53 59.3;mag=5.75;fd=8|ra=02 43 02.80;dec=+55 06 21.9;mag=5.76;fd=11|ra=04 24 37.42;dec=+33 57 35.6;mag=5.77;fd=56|ra=03 33 35.02;dec=+39 53 58.5;mag=5.79|ra=03 49 08.12;dec=+43 57 46.9;mag=5.95|ra=03 16 35.19;dec=+32 11 03.2;mag=5.98|ra=02 18 04.60;dec=+57 30 58.8;mag=5.99;fd=7|ra=04 08 15.46;dec=+37 43 40.7;mag=6.07;fd=49|ra=03 25 57.36;dec=+49 07 15.0;mag=6.09|ra=04 33 24.90;dec=+43 03 50.0;mag=6.09;fd=57|ra=04 18 08.09;dec=+42 08 28.5;mag=6.22|ra=02 25 16.03;dec=+56 36 35.4;mag=6.25;fd=10|ra=02 49 30.74;dec=+57 05 03.6;mag=6.25|ra=02 23 51.75;dec=+55 21 53.5;mag=6.29|ra=02 11 29.19;dec=+57 38 44.0;mag=6.38;fd=5|ra=03 07 47.34;dec=+47 18 31.3;mag=6.38|ra=03 32 38.98;dec=+44 51 20.8;mag=6.42|ra=03 15 48.65;dec=+50 57 21.5;mag=6.46|ra=03 03 56.75;dec=+47 50 54.6;mag=6.48|ra=02 19 04.45;dec=+57 08 07.8;mag=6.55;fd=(61)|ra=03 55 23.08;dec=+31 02 45.1;mag=6.79| st=st+"ra=16 29 24.47;dec=-26 25 55.0;mag=0.91|ra=17 33 36.53;dec=-37 06 13.5;mag=1.62|ra=17 37 19.13;dec=-42 59 52.2;mag=1.86|ra=16 00 20.01;dec=-22 37 17.8;mag=2.29|ra=16 50 10.24;dec=-34 17 33.4;mag=2.29|ra=17 42 29.28;dec=-39 01 47.7;mag=2.39|ra=16 05 26.23;dec=-19 48 19.4;mag=2.62|ra=17 30 45.84;dec=-37 17 44.7;mag=2.70|ra=16 35 52.96;dec=-28 12 57.5;mag=2.82|ra=15 58 51.12;dec=-26 06 50.6;mag=2.89|ra=16 21 11.32;dec=-25 35 33.9;mag=2.90|ra=17 47 35.08;dec=-40 07 37.1;mag=2.99|ra=16 51 52.24;dec=-38 02 50.4;mag=3.00|ra=17 49 51.45;dec=-37 02 36.1;mag=3.19|ra=17 12 09.18;dec=-43 14 18.6;mag=3.32|ra=16 52 20.15;dec=-38 01 02.9;mag=3.56|ra=16 54 35.11;dec=-42 21 38.7;mag=3.62|ra=15 56 53.09;dec=-29 12 50.4;mag=3.87|ra=16 06 48.43;dec=-20 40 08.9;mag=3.93|ra=16 11 59.74;dec=-19 27 38.3;mag=4.00|ra=16 36 22.46;dec=-35 15 19.3;mag=4.18|ra=16 31 22.94;dec=-34 42 15.6;mag=4.24|ra=17 36 32.85;dec=-38 38 05.5;mag=4.26|ra=16 07 24.30;dec=-20 52 07.2;mag=4.31|ra=16 20 38.18;dec=-24 10 09.4;mag=4.55|ra=16 12 18.21;dec=-27 55 34.7;mag=4.58|ra=15 53 36.73;dec=-25 19 37.5;mag=4.59|ra=15 50 58.75;dec=-25 45 04.4;mag=4.63|ra=16 53 59.73;dec=-42 21 43.3;mag=4.70|ra=16 04 22.10;dec=-11 22 23.0;mag=4.77|ra=17 50 11.11;dec=-40 05 25.5;mag=4.78|ra=16 30 12.48;dec=-25 06 54.6;mag=4.79|ra=17 49 10.47;dec=-31 42 11.5;mag=4.79|ra=16 18 17.92;dec=-28 36 49.6;mag=4.80|ra=17 04 49.35;dec=-34 07 22.5;mag=4.83|ra=17 56 47.43;dec=-44 20 31.9;mag=4.85|ra=17 57 47.81;dec=-41 42 58.5;mag=4.88|ra=16 05 26.58;dec=-19 48 06.6;mag=4.90|ra=16 12 00.00;dec=-10 03 51.1;mag=4.93|ra=16 03 20.67;dec=-25 51 54.5;mag=4.96|ra=17 01 52.65;dec=-32 08 36.2;mag=5.03|ra=17 10 42.35;dec=-44 33 27.2;mag=5.06|ra=16 04 22.3s;dec=-11 22 18.0;mag=5.07|ra=16 11 02.13;dec=-29 24 57.6;mag=5.09|ra=17 24 13.09;dec=-44 09 45.0;mag=5.10|ra=16 29 24.2s;dec=-26 25 51.0;mag=5.2|ra=16 51 33.72;dec=-41 13 49.9;mag=5.23|ra=16 13 50.91;dec=-11 50 15.8;mag=5.24|ra=16 31 41.77;dec=-41 49 01.7;mag=5.31|ra=16 08 07.52;dec=-26 19 36.0;mag=5.35|ra=16 24 01.24;dec=-39 11 34.8;mag=5.37|ra=15 53 53.92;dec=-24 31 59.1;mag=5.38|ra=15 53 55.87;dec=-23 58 40.9;mag=5.41|ra=16 24 31.77;dec=-37 33 57.5;mag=5.42|ra=15 58 34.87;dec=-24 49 53.1;mag=5.43|ra=16 12 07.29;dec=-08 32 51.3;mag=5.43|ra=16 36 22.57;dec=-42 51 31.9;mag=5.46|ra=16 54 01.84;dec=-41 48 23.0;mag=5.46|ra=16 46 47.97;dec=-39 22 36.8;mag=5.48|ra=16 57 11.17;dec=-33 15 34.1;mag=5.48|ra=16 15 37.13;dec=-08 22 05.7;mag=5.49|ra=16 09 52.61;dec=-33 32 44.5;mag=5.50|ra=16 19 32.68;dec=-30 54 24.4;mag=5.53|ra=17 17 03.71;dec=-32 39 45.7;mag=5.53|ra=17 42 51.09;dec=-36 56 43.8;mag=5.53|ra=17 15 19.25;dec=-33 32 54.3;mag=5.53|ra=17 53 23.47;dec=-34 53 42.4;mag=5.58|ra=15 55 30.10;dec=-26 15 57.3;mag=5.63|ra=16 44 42.60;dec=-40 50 22.6;mag=5.64|ra=17 12 16.22;dec=-39 30 24.4;mag=5.66|ra=16 12 16.05;dec=-28 25 01.9;mag=5.67|ra=17 34 42.49;dec=-32 34 54.0;mag=5.69|ra=16 07 36.44;dec=-12 44 43.2;mag=5.75|ra=17 18 47.84;dec=-44 07 46.9;mag=5.76|ra=16 54 58.51;dec=-41 09 03.1;mag=5.78|ra=16 28 14.46;dec=-37 10 47.3;mag=5.79|ra=16 38 26.30;dec=-43 23 54.2;mag=5.83|ra=15 57 40.47;dec=-20 58 58.9;mag=5.84|ra=16 41 45.50;dec=-33 08 44.2;mag=5.84|ra=16 54 26.94;dec=-42 28 44.0;mag=5.84|ra=17 33 07.39;dec=-41 10 23.0;mag=5.84|ra=17 52 19.76;dec=-34 25 00.6;mag=5.84|ra=16 24 39.73;dec=-29 42 16.1;mag=5.84|ra=16 11 17.77;dec=-41 07 10.2;mag=5.86|ra=16 08 43.73;dec=-23 41 07.3;mag=5.87|ra=15 54 39.54;dec=-25 14 37.2;mag=5.87|ra=17 44 42.01;dec=-42 43 45.5;mag=5.87|ra=17 52 13.66;dec=-34 47 57.1;mag=5.87|ra=16 06 06.38;dec=-23 36 22.5;mag=5.90|ra=16 14 22.37;dec=-33 00 39.8;mag=5.91|ra=17 03 50.87;dec=-38 09 09.0;mag=5.91|ra=17 18 56.36;dec=-34 59 22.5;mag=5.91|ra=17 22 54.73;dec=-37 13 14.5;mag=5.91|ra=16 39 05.24;dec=-37 13 02.1;mag=5.93|ra=17 08 47.55;dec=-30 24 12.8;mag=5.93|ra=17 51 32.57;dec=-40 46 20.4;mag=5.94|ra=16 53 42.44;dec=-43 03 03.2;mag=5.95|ra=17 00 36.99;dec=-35 56 02.3;mag=5.95|ra=17 12 58.56;dec=-32 26 18.0;mag=5.95|ra=17 15 36.08;dec=-38 35 34.6;mag=5.95|ra=16 19 00.43;dec=-14 52 22.2;mag=5.97|ra=17 06 20.20;dec=-37 13 39.1;mag=5.98|ra=17 28 56.09;dec=-36 46 41.8;mag=5.98|ra=16 45 00.21;dec=-28 30 34.8;mag=5.99|ra=13 25 11.60;dec=-11 09 40.5;mag=0.98|ra=12 41 40.00;dec=-01 26 58.3;mag=2.74|ra=13 02 10.76;dec=+10 57 32.8;mag=2.85|ra=13 34 41.75;dec=-00 35 45.4;mag=3.38|ra=12 55 36.48;dec=+03 23 51.4;mag=3.39|ra=11 50 41.29;dec=+01 45 55.4;mag=3.59|ra=12 41 39.60;dec=-01 26 58.0;mag=3.68|ra=14 46 14.99;dec=+01 53 34.6;mag=3.73|ra=14 43 03.56;dec=-05 39 26.7;mag=3.87|ra=12 19 54.39;dec=-00 40 00.3;mag=3.89|ra=11 45 51.57;dec=+06 31 47.3;mag=4.04|ra=14 16 00.88;dec=-05 59 58.3;mag=4.07|ra=12 05 12.67;dec=+08 43 58.2;mag=4.12|ra=14 12 53.74;dec=-10 16 26.6;mag=4.18|ra=14 01 38.78;dec=+01 32 40.5;mag=4.23|ra=13 09 57.01;dec=-05 32 20.1;mag=4.38|ra=15 02 54.07;dec=+02 05 28.6;mag=4.39|ra=14 19 06.60;dec=-13 22 16.2;mag=4.52|ra=12 00 52.39;dec=+06 36 51.8;mag=4.65|ra=12 39 14.81;dec=-07 59 43.8;mag=4.66|ra=13 31 57.95;dec=-06 15 20.6;mag=4.68|ra=13 18 24.97;dec=-18 18 31.0;mag=4.74|ra=13 27 27.24;dec=-15 58 25.1;mag=4.76|ra=12 54 21.17;dec=-09 32 20.2;mag=4.77|ra=13 17 36.29;dec=+05 28 11.4;mag=4.78|ra=14 28 12.22;dec=-02 13 40.6;mag=4.81|ra=11 45 17.00;dec=+08 15 29.4;mag=4.84|ra=12 41 53.01;dec=+10 14 09.0;mag=4.88|ra=13 34 07.91;dec=+03 39 32.5;mag=4.92|ra=14 10 50.48;dec=-16 18 07.2;mag=4.93|ra=13 49 52.34;dec=-18 08 02.7;mag=4.96|ra=12 20 21.15;dec=+03 18 45.8;mag=4.97|ra=13 28 25.95;dec=+13 46 48.7;mag=4.97|ra=14 12 15.83;dec=+02 24 34.2;mag=4.99|ra=13 41 36.83;dec=-08 42 11.1;mag=5.03|ra=13 12 03.48;dec=-16 11 52.5;mag=5.04|ra=14 24 11.39;dec=+05 49 12.4;mag=5.10|ra=14 19 32.55;dec=-02 15 55.2;mag=5.14|ra=13 07 53.80;dec=-10 44 25.4;mag=5.15|ra=13 54 42.20;dec=-01 30 11.1;mag=5.16|ra=13 16 46.71;dec=+09 25 25.3;mag=5.19|ra=13 15 58.58;dec=-19 56 34.2;mag=5.21|ra=13 32 58.09;dec=-10 09 53.7;mag=5.21|ra=12 45 37.12;dec=+07 40 23.9;mag=5.22|ra=11 38 27.61;dec=+08 08 03.4;mag=5.24|ra=13 26 43.24;dec=-12 42 27.4;mag=5.27|ra=11 47 54.93;dec=+08 14 45.1;mag=5.31|ra=13 14 10.97;dec=-19 55 52.8;mag=5.31|ra=13 43 03.88;dec=+03 32 17.1;mag=5.35|ra=11 59 56.92;dec=+03 39 18.8;mag=5.36|ra=13 23 01.15;dec=-17 44 06.7;mag=5.36|ra=13 47 25.35;dec=-17 51 35.1;mag=5.41|ra=14 28 41.73;dec=-06 54 01.5;mag=5.42|ra=14 06 42.91;dec=-09 18 48.7;mag=5.46|ra=12 33 46.80;dec=-09 27 07.5;mag=5.48|ra=13 45 56.33;dec=-12 25 35.6;mag=5.50|ra=14 57 33.22;dec=-00 10 03.2;mag=5.51|ra=13 32 51.69;dec=-15 21 46.8;mag=5.52|ra=14 15 24.11;dec=-18 12 02.4;mag=5.53|ra=12 00 44.37;dec=-10 26 41.4;mag=5.54|ra=13 44 29.82;dec=-16 10 44.6;mag=5.55|ra=12 41 57.16;dec=+06 48 23.9;mag=5.57|ra=13 08 32.49;dec=-08 59 03.2;mag=5.57|ra=11 55 03.15;dec=+08 26 38.1;mag=5.58|ra=13 03 46.03;dec=-20 35 00.6;mag=5.58|ra=11 51 02.23;dec=-05 20 00.0;mag=5.62|ra=13 14 31.24;dec=+11 19 54.4;mag=5.64|ra=12 46 22.38;dec=+09 32 26.8;mag=5.65|ra=13 29 13.04;dec=+10 49 06.2;mag=5.65|ra=12 38 22.45;dec=+01 51 16.9;mag=5.68|ra=14 45 30.23;dec=+00 43 02.2;mag=5.68|ra=13 21 41.68;dec=+02 05 14.5;mag=5.69|ra=13 35 31.29;dec=-05 23 47.0;mag=5.70|ra=15 01 48.92;dec=-00 08 24.9;mag=5.71|ra=12 10 03.51;dec=+05 48 25.1;mag=5.72|ra=13 24 33.14;dec=-05 09 50.1;mag=5.76|ra=12 59 39.55;dec=-03 48 43.0;mag=5.79|ra=12 13 25.99;dec=+10 15 44.5;mag=5.85|ra=14 18 38.30;dec=-18 42 57.2;mag=5.86|ra=12 36 47.37;dec=-05 49 54.7;mag=5.88|ra=13 23 18.91;dec=-04 55 27.8;mag=5.88|ra=13 22 09.73;dec=+05 09 17.5;mag=5.89|ra=14 13 40.67;dec=-00 50 42.4;mag=5.89|ra=12 18 40.30;dec=-00 47 13.7;mag=5.90|ra=13 56 27.89;dec=+01 03 02.0;mag=5.90|ra=12 43 38.02;dec=-01 34 36.5;mag=5.91|ra=14 59 23.11;dec=+04 34 04.0;mag=5.91|ra=13 34 40.48;dec=-13 12 51.5;mag=5.92|ra=12 09 41.29;dec=+01 53 54.0;mag=5.95|ra=12 25 11.80;dec=-11 36 37.8;mag=5.95|ra=13 09 45.29;dec=-10 19 45.5;mag=5.95|ra=14 29 50.51;dec=+00 49 44.1;mag=5.96|ra=13 26 11.48;dec=-01 11 32.9;mag=5.97|ra=13 00 35.96;dec=-03 22 07.0;mag=5.99|ra=12 47 43.32;dec=-59 41 19.4;mag=1.25|ra=12 26 35.94;dec=-63 05 56.6;mag=1.4|ra=12 31 09.93;dec=-57 06 45.2;mag=1.60|ra=12 26 36.50;dec=-63 05 58.0;mag=2.09|ra=12 15 08.76;dec=-58 44 56.0;mag=2.79|ra=12 21 21.81;dec=-60 24 04.9;mag=3.59|ra=12 54 35.66;dec=-57 10 40.4;mag=4.03|ra=12 18 26.29;dec=-64 00 11.0;mag=4.06|ra=12 06 52.85;dec=-64 36 49.1;mag=4.14|ra=12 03 01.70;dec=-63 18 46.6;mag=4.32|ra=12 46 22.75;dec=-56 29 19.6;mag=4.62|ra=12 54 39.22;dec=-59 08 48.0;mag=4.62|ra=12 45 37.92;dec=-60 58 52.2;mag=4.69|ra=12 04 19.24;dec=-63 09 56.6;mag=4.72|ra=12 26 30.90;dec=-63 07 21.0;mag=4.86|ra=12 41 56.60;dec=-59 41 08.9;mag=4.91|ra=12 54 36.92;dec=-57 10 07.1;mag=5.08|ra=12 42 50.28;dec=-63 03 31.0;mag=5.27|ra=12 55 57.14;dec=-56 50 08.9;mag=5.34|ra=12 22 49.47;dec=-57 40 34.0;mag=5.38|ra=12 27 28.88;dec=-58 59 30.4;mag=5.38|ra=11 58 15.25;dec=-56 19 02.3;mag=5.44|ra=12 31 40.34;dec=-59 25 26.1;mag=5.49|ra=11 57 40.04;dec=-62 26 55.4;mag=5.59|ra=11 58 47.67;dec=-64 20 22.4;mag=5.59|ra=12 51 17.98;dec=-60 19 47.2;mag=5.71|ra=12 53 21.90;dec=-60 19 42.6;mag=5.75|ra=12 29 54.19;dec=-56 31 29.9;mag=5.78|ra=12 12 21.99;dec=-62 57 02.8;mag=5.91|ra=12 21 57.44;dec=-56 22 27.8;mag=5.91|ra=12 04 57.25;dec=-60 58 05.7;mag=5.95|ra=12 31 56.15;dec=-63 30 21.2;mag=5.96|ra=12 53 48.92;dec=-60 22 34.5;mag=5.98|ra=12 43 09.21;dec=-56 10 34.3;mag=5.99|ra=16 48 39.87;dec=-69 01 39.5;mag=1.91|ra=15 55 08.81;dec=-63 25 47.1;mag=2.83|ra=15 18 54.69;dec=-68 40 46.1;mag=2.87|ra=16 15 26.27;dec=-63 41 08.3;mag=3.86|ra=15 36 43.19;dec=-66 19 00.9;mag=4.11|ra=16 28 27.80;dec=-70 05 04.8;mag=4.90|ra=16 46 40.01;dec=-67 06 34.8;mag=5.10|ra=15 55 29.61;dec=-68 36 10.8;mag=5.11|ra=16 30 49.37;dec=-61 38 00.5;mag=5.19|ra=16 27 57.27;dec=-64 03 28.8;mag=5.28|ra=16 35 44.77;dec=-65 29 43.2;mag=5.50|ra=15 47 53.10;dec=-65 26 31.9;mag=5.54|ra=15 27 33.10;dec=-64 31 53.2;mag=5.71|ra=15 58 58.16;dec=-65 02 15.2;mag=5.74|ra=15 14 19.17;dec=-70 04 46.0;mag=5.75|ra=15 09 29.92;dec=-67 05 02.9;mag=5.76|ra=15 56 05.96;dec=-60 28 56.3;mag=5.76|ra=16 59 33.98;dec=-69 16 05.3;mag=5.79|ra=15 26 14.53;dec=-68 18 33.1;mag=5.89|ra=16 41 23.13;dec=-68 17 45.9;mag=5.89|ra=16 17 05.48;dec=-67 56 27.9;mag=5.95|ra=06 23 57.09;dec=-52 41 44.6;mag=1.1|ra=09 13 12.24;dec=-69 43 02.9;mag=1.67|ra=08 22 30.86;dec=-59 30 34.3;mag=1.86|ra=09 17 05.43;dec=-59 16 30.9;mag=2.23|ra=10 42 57.43;dec=-64 23 40.1;mag=2.74|ra=09 47 06.14;dec=-65 04 19.3;mag=2.92|ra=10 13 44.28;dec=-70 02 16.5;mag=3.29|ra=10 32 01.48;dec=-61 41 07.3;mag=3.30|ra=10 17 05.01;dec=-61 19 56.4;mag=3.39|ra=09 10 58.11;dec=-58 58 00.9;mag=3.43|ra=07 56 46.74;dec=-52 58 56.6;mag=3.46|ra=09 45 14.83;dec=-62 30 28.5;mag=3.69|ra=10 53 29.57;dec=-58 51 11.8;mag=3.78|ra=10 27 52.75;dec=-58 44 21.9;mag=3.81|ra=08 55 02.86;dec=-60 38 41.0;mag=3.84|ra=11 08 35.40;dec=-58 58 30.2;mag=3.93|ra=09 11 16.77;dec=-62 19 01.3;mag=3.96|ra=10 24 23.74;dec=-74 01 53.6;mag=3.99|ra=09 34 26.66;dec=-59 13 47.2;mag=4.08|ra=08 40 37.04;dec=-59 45 39.7;mag=4.31|ra=09 16 12.10;dec=-57 32 29.2;mag=4.34|ra=06 34 58.59;dec=-52 58 32.3;mag=4.35|ra=06 49 51.32;dec=-53 37 21.0;mag=4.39|ra=10 35 35.31;dec=-57 33 27.5;mag=4.45|ra=10 45 03.60;dec=-59 41 03.0;mag=4.47|ra=09 05 08.83;dec=-72 36 09.7;mag=4.47|ra=08 46 42.56;dec=-56 46 11.3;mag=4.50|ra=09 39 21.04;dec=-61 19 41.2;mag=4.51|ra=10 43 32.31;dec=-60 33 59.9;mag=4.58|ra=11 12 36.02;dec=-60 19 03.5;mag=4.59|ra=11 06 32.47;dec=-62 25 26.9;mag=4.62|ra=10 27 24.48;dec=-57 38 19.7;mag=4.65|ra=09 05 38.38;dec=-70 32 18.7;mag=4.67|ra=10 38 45.01;dec=-59 10 58.8;mag=4.69|ra=10 30 20.08;dec=-71 59 33.8;mag=4.72|ra=08 09 00.86;dec=-61 18 06.1;mag=4.74|ra=10 42 14.14;dec=-64 27 59.2;mag=4.76|ra=09 20 56.83;dec=-62 24 16.7;mag=4.79|ra=10 44 06.94;dec=-63 57 40.0;mag=4.80|ra=08 00 19.97;dec=-63 34 03.0;mag=4.81|ra=08 35 19.65;dec=-58 00 33.5;mag=4.84|ra=10 46 51.24;dec=-64 23 00.6;mag=4.87|ra=07 35 39.70;dec=-52 32 01.7;mag=4.93|ra=08 56 58.43;dec=-59 13 45.7;mag=4.93|ra=10 31 02.07;dec=-73 13 17.4;mag=4.94|ra=10 22 58.18;dec=-66 54 05.5;mag=4.97|ra=10 36 20.56;dec=-59 33 51.5;mag=5.08|ra=07 26 21.86;dec=-51 01 06.6;mag=5.09|ra=11 08 34.01;dec=-61 56 49.8;mag=5.12|ra=07 00 51.51;dec=-51 24 09.5;mag=5.14|ra=07 04 18.32;dec=-56 44 59.0;mag=5.14|ra=10 13 30.68;dec=-66 22 22.2;mag=5.15|ra=08 15 15.95;dec=-62 54 56.2;mag=5.16|ra=08 59 24.38;dec=-59 05 03.8;mag=5.17|ra=07 59 37.55;dec=-60 35 13.5;mag=5.19|ra=11 12 45.27;dec=-64 10 11.2;mag=5.22|ra=10 46 29.61;dec=-64 15 47.7;mag=5.23|ra=10 08 42.84;dec=-65 48 55.9;mag=5.26|ra=10 52 30.85;dec=-57 14 25.5;mag=5.26|ra=08 35 15.58;dec=-58 13 29.1;mag=5.27|ra=10 28 52.60;dec=-64 10 20.2;mag=5.27|ra=09 17 25.21;dec=-74 53 39.8;mag=5.28|ra=09 40 42.60;dec=-57 59 00.9;mag=5.30|ra=10 46 16.58;dec=-64 30 52.5;mag=5.33|ra=10 42 40.57;dec=-59 12 56.8;mag=5.36|ra=07 20 38.81;dec=-52 05 09.3;mag=5.38|ra=09 17 17.40;dec=-68 41 22.5;mag=5.38|ra=06 46 52.69;dec=-51 15 55.6;mag=5.39|ra=08 37 18.85;dec=-62 51 12.3;mag=5.45|ra=09 27 06.50;dec=-71 36 07.5;mag=5.46|ra=09 31 36.32;dec=-73 04 51.3;mag=5.46|ra=10 37 27.08;dec=-58 44 00.0;mag=5.47|ra=07 03 15.11;dec=-59 10 41.3;mag=5.50|ra=10 40 11.46;dec=-65 06 00.9;mag=5.51|ra=08 05 03.71;dec=-53 06 28.5;mag=5.52|ra=09 12 55.62;dec=-59 24 50.3;mag=5.54|ra=09 50 55.60;dec=-62 44 42.5;mag=5.56|ra=07 49 06.72;dec=-56 24 37.4;mag=5.57|ra=06 31 18.22;dec=-51 49 34.3;mag=5.58|ra=11 06 49.93;dec=-70 52 40.6;mag=5.58|ra=07 57 46.30;dec=-60 18 12.1;mag=5.59|ra=08 51 36.53;dec=-57 38 01.0;mag=5.59|ra=06 47 18.71;dec=-55 32 24.2;mag=5.60|ra=07 54 53.39;dec=-57 18 10.4;mag=5.62|ra=08 09 33.63;dec=-56 05 07.7;mag=5.66|ra=10 19 05.12;dec=-64 40 34.6;mag=5.66|ra=07 52 29.75;dec=-54 22 01.9;mag=5.69|ra=10 11 46.47;dec=-58 03 38.0;mag=5.70|ra=10 09 22.01;dec=-61 32 57.1;mag=5.71|ra=11 13 30.79;dec=-59 37 09.5;mag=5.73|ra=07 56 18.65;dec=-60 31 35.3;mag=5.74|ra=10 43 51.21;dec=-64 14 56.6;mag=5.75| st=st+"ra=07 58 50.56;dec=-60 49 28.2;mag=5.77|ra=09 25 27.38;dec=-61 57 02.2;mag=5.77|ra=07 49 12.95;dec=-60 17 02.5;mag=5.78|ra=08 53 48.67;dec=-60 21 14.2;mag=5.78|ra=09 51 12.03;dec=-59 25 32.4;mag=5.79|ra=09 00 45.75;dec=-60 57 49.8;mag=5.80|ra=09 41 02.10;dec=-57 15 34.0;mag=5.80|ra=10 09 30.20;dec=-68 40 58.2;mag=5.80|ra=06 45 53.72;dec=-52 24 35.0;mag=5.81|ra=10 49 24.46;dec=-59 19 25.6;mag=5.85|ra=09 17 27.63;dec=-74 44 04.8;mag=5.86|ra=07 29 59.74;dec=-52 39 04.6;mag=5.87|ra=08 00 49.96;dec=-54 09 04.7;mag=5.87|ra=09 30 23.45;dec=-58 21 42.9;mag=5.88|ra=10 38 02.66;dec=-57 15 22.7;mag=5.89|ra=09 28 30.60;dec=-66 42 07.2;mag=5.90|ra=09 28 47.19;dec=-62 16 23.5;mag=5.91|ra=10 02 00.11;dec=-60 25 15.2;mag=5.93|ra=10 24 59.50;dec=-58 34 34.7;mag=5.93|ra=10 55 17.26;dec=-60 31 01.9;mag=5.93|ra=07 30 30.91;dec=-54 23 58.0;mag=5.95|ra=10 54 29.60;dec=-61 49 35.8;mag=5.95|ra=07 07 13.30;dec=-51 58 06.2;mag=5.96|ra=07 15 21.27;dec=-52 29 58.3;mag=5.96|ra=08 21 12.10;dec=-57 58 23.6;mag=5.96|ra=10 38 59.70;dec=-58 49 00.8;mag=5.96|ra=10 32 47.82;dec=-58 40 00.3;mag=5.98|ra=10 48 05.42;dec=-59 55 09.0;mag=5.98|ra=09 24 05.50;dec=-61 38 55.6;mag=5.99|ra=10 53 42.13;dec=-70 43 13.2;mag=5.99|ra=11 19 16.84;dec=-64 34 57.4;mag=5.99|ra=21 41 28.47;dec=-77 23 22.1;mag=3.76|ra=22 46 03.72;dec=-81 22 53.8;mag=4.13|ra=14 26 55.74;dec=-83 40 04.3;mag=4.31|ra=00 01 35.85;dec=-77 03 55.1;mag=4.78|ra=22 20 01.48;dec=-80 26 22.7;mag=5.09|ra=23 52 06.69;dec=-82 01 07.6;mag=5.10|ra=21 04 43.03;dec=-77 01 22.3;mag=5.13|ra=21 50 54.25;dec=-82 43 07.8;mag=5.27|ra=00 10 02.27;dec=-82 13 26.4;mag=5.29|ra=18 54 47.65;dec=-87 36 19.9;mag=5.29|ra=22 50 22.75;dec=-80 07 25.7;mag=5.32|ra=08 56 41.88;dec=-85 39 47.6;mag=5.43|ra=12 54 58.35;dec=-85 07 24.3;mag=5.45|ra=21 08 46.01;dec=-88 57 23.4;mag=5.45|ra=18 23 36.44;dec=-75 02 39.6;mag=5.47|ra=22 17 50.70;dec=-77 30 41.7;mag=5.49|ra=23 28 03.57;dec=-87 28 56.1;mag=5.50|ra=13 40 56.18;dec=-85 47 09.6;mag=5.56|ra=15 43 16.10;dec=-84 27 55.8;mag=5.57|ra=15 01 50.70;dec=-83 13 40.0;mag=5.65|ra=15 04 46.96;dec=-83 02 17.8;mag=5.65|ra=01 37 27.78;dec=-84 46 10.7;mag=5.66|ra=23 57 32.99;dec=-82 10 11.1;mag=5.72|ra=23 44 40.68;dec=-78 47 29.2;mag=5.74|ra=20 33 17.61;dec=-80 57 53.4;mag=5.76|ra=22 31 37.83;dec=-85 58 02.6;mag=5.76|ra=00 13 19.55;dec=-84 59 38.5;mag=5.78|ra=23 33 19.55;dec=-77 23 07.2;mag=5.82|ra=01 37 54.98;dec=-82 58 31.0;mag=5.88|ra=15 11 08.79;dec=-84 47 16.2;mag=5.88|ra=20 38 18.60;dec=-81 17 20.3;mag=5.89|ra=22 03 03.74;dec=-76 07 05.8;mag=5.94|ra=18 29 20.02;dec=-80 13 57.2;mag=5.95|ra=20 42 02.52;dec=-76 10 50.0;mag=5.99|ra=23 38 23.69;dec=-76 52 10.2;mag=5.99|ra=09 27 35.25;dec=-08 39 31.3;mag=1.99|ra=13 18 55.25;dec=-23 10 17.1;mag=2.99|ra=08 55 23.68;dec=+05 56 43.9;mag=3.11|ra=10 49 37.43;dec=-16 11 38.9;mag=3.11|ra=14 06 22.27;dec=-26 40 55.3;mag=3.25|ra=08 46 46.65;dec=+06 25 08.1;mag=3.38|ra=11 33 00.26;dec=-31 51 27.1;mag=3.54|ra=10 10 35.40;dec=-12 21 13.8;mag=3.61|ra=10 26 05.51;dec=-16 50 09.9;mag=3.83|ra=09 14 21.79;dec=+02 18 54.1;mag=3.89|ra=09 39 51.33;dec=-01 08 33.6;mag=3.90|ra=08 25 39.67;dec=-03 54 22.9;mag=3.91|ra=09 51 28.68;dec=-14 50 47.6;mag=4.11|ra=08 37 39.41;dec=+05 42 13.7;mag=4.14|ra=11 52 54.56;dec=-33 54 29.3;mag=4.29|ra=08 43 13.49;dec=+03 23 55.2;mag=4.30|ra=08 46 22.53;dec=-13 32 51.7;mag=4.32|ra=08 48 25.98;dec=+05 50 16.4;mag=4.35|ra=14 50 17.47;dec=-27 57 36.8;mag=4.42|ra=08 38 45.45;dec=+03 20 29.3;mag=4.45|ra=09 31 58.93;dec=-01 11 04.8;mag=4.54|ra=09 29 08.84;dec=-02 46 08.2;mag=4.59|ra=10 05 07.49;dec=-13 03 52.8;mag=4.60|ra=08 43 40.38;dec=-07 14 01.4;mag=4.63|ra=09 38 27.39;dec=+04 38 57.9;mag=4.68|ra=11 40 12.82;dec=-34 44 40.8;mag=4.70|ra=09 27 18.30;dec=-22 20 36.3;mag=4.72|ra=09 41 17.03;dec=-23 35 29.5;mag=4.76|ra=09 19 46.40;dec=-11 58 29.6;mag=4.77|ra=14 23 05.91;dec=-27 45 13.4;mag=4.78|ra=09 20 29.03;dec=-09 33 20.3;mag=4.80|ra=08 41 43.33;dec=-15 56 35.3;mag=4.87|ra=09 54 12.44;dec=-25 55 56.9;mag=4.87|ra=10 37 13.80;dec=-27 24 45.7;mag=4.87|ra=10 37 33.25;dec=-13 23 04.0;mag=4.89|ra=10 38 35.01;dec=-16 52 35.9;mag=4.91|ra=11 05 20.03;dec=-27 17 36.9;mag=4.92|ra=09 42 14.67;dec=-23 54 58.4;mag=4.93|ra=11 32 16.42;dec=-29 15 40.9;mag=4.93|ra=09 54 52.24;dec=-19 00 33.4;mag=4.94|ra=13 09 03.28;dec=-23 07 04.7;mag=4.94|ra=14 28 10.44;dec=-29 29 29.7;mag=4.97|ra=08 40 01.52;dec=-12 28 31.3;mag=4.98|ra=09 05 58.38;dec=+05 05 32.4;mag=4.99|ra=09 33 12.47;dec=-21 06 56.7;mag=5.02|ra=09 40 18.38;dec=-14 19 56.1;mag=5.07|ra=14 12 46.03;dec=-27 15 40.0;mag=5.07|ra=10 34 00.89;dec=-23 44 42.8;mag=5.08|ra=11 48 45.11;dec=-26 44 59.1;mag=5.10|ra=11 32 54.15;dec=-31 05 14.0;mag=5.13|ra=14 46 00.18;dec=-25 26 34.5;mag=5.15|ra=11 41 43.95;dec=-32 29 57.6;mag=5.20|ra=13 58 31.18;dec=-24 58 19.8;mag=5.20|ra=10 53 29.48;dec=-20 08 17.3;mag=5.23|ra=14 47 44.78;dec=-26 05 14.9;mag=5.23|ra=09 16 41.72;dec=-06 21 11.4;mag=5.24|ra=11 54 42.51;dec=-25 42 50.6;mag=5.26|ra=08 47 15.01;dec=-01 53 49.4;mag=5.28|ra=08 49 21.74;dec=-03 26 34.7;mag=5.30|ra=10 10 05.96;dec=-12 48 56.4;mag=5.30|ra=08 11 33.03;dec=-07 46 20.9;mag=5.36|ra=09 27 46.92;dec=-06 04 15.7;mag=5.38|ra=12 37 42.23;dec=-27 08 19.2;mag=5.41|ra=11 08 44.05;dec=-28 04 50.2;mag=5.43|ra=10 46 52.06;dec=-17 17 48.6;mag=5.44|ra=12 44 00.55;dec=-28 19 25.9;mag=5.46|ra=09 09 35.58;dec=-08 47 15.5;mag=5.47|ra=14 02 22.80;dec=-27 25 47.1;mag=5.47|ra=09 16 41.38;dec=-08 44 41.1;mag=5.49|ra=08 51 34.44;dec=-07 10 38.0;mag=5.55|ra=09 34 32.64;dec=-05 54 53.3;mag=5.56|ra=12 26 51.69;dec=-32 49 48.2;mag=5.56|ra=10 29 29.01;dec=-29 39 49.9;mag=5.58|ra=10 07 09.49;dec=-17 08 29.7;mag=5.59|ra=10 30 59.86;dec=-13 35 18.5;mag=5.59|ra=08 26 27.23;dec=-03 59 14.3;mag=5.60|ra=09 08 42.19;dec=-08 35 22.2;mag=5.60|ra=09 25 24.04;dec=-05 07 02.6;mag=5.60|ra=08 24 35.14;dec=-03 45 04.2;mag=5.61|ra=14 47 22.56;dec=-25 37 27.2;mag=5.61|ra=09 01 58.02;dec=-00 28 58.2;mag=5.64|ra=12 48 26.36;dec=-27 35 50.0;mag=5.65|ra=14 58 39.29;dec=-27 39 26.3;mag=5.65|ra=09 29 12.65;dec=-20 44 56.9;mag=5.66|ra=11 05 57.55;dec=-27 17 16.1;mag=5.69|ra=13 32 35.96;dec=-28 41 33.8;mag=5.69|ra=08 46 02.45;dec=-02 02 55.6;mag=5.70|ra=10 04 21.02;dec=-24 17 08.1;mag=5.70|ra=10 59 13.74;dec=-33 44 14.8;mag=5.70|ra=10 36 32.22;dec=-12 13 42.6;mag=5.71|ra=11 36 34.92;dec=-33 34 11.9;mag=5.71|ra=08 35 28.21;dec=-07 58 56.4;mag=5.72|ra=09 11 58.77;dec=-19 44 51.9;mag=5.72|ra=09 09 04.25;dec=-18 19 43.0;mag=5.73|ra=13 36 48.51;dec=-26 29 42.8;mag=5.73|ra=08 25 35.55;dec=+02 06 08.1;mag=5.74|ra=09 32 20.43;dec=-19 24 01.2;mag=5.74|ra=08 55 12.42;dec=-18 14 28.3;mag=5.75|ra=09 09 11.50;dec=-12 21 27.7;mag=5.76|ra=14 47 57.56;dec=-26 38 46.1;mag=5.76|ra=14 00 00.25;dec=-25 00 36.6;mag=5.77|ra=09 19 33.11;dec=-15 50 04.3;mag=5.79|ra=11 09 53.38;dec=-32 22 02.8;mag=5.79|ra=08 34 01.64;dec=-02 09 05.8;mag=5.80|ra=08 58 43.78;dec=-16 07 59.7;mag=5.80|ra=13 38 42.13;dec=-29 33 38.4;mag=5.81|ra=13 45 36.94;dec=-26 06 57.5;mag=5.81|ra=09 17 07.73;dec=-14 34 26.6;mag=5.83|ra=15 02 06.38;dec=-28 03 37.9;mag=5.83|ra=11 51 41.62;dec=-30 50 02.7;mag=5.85|ra=09 30 22.54;dec=-15 34 37.9;mag=5.86|ra=12 39 03.48;dec=-30 25 20.5;mag=5.86|ra=10 48 14.13;dec=-31 41 16.3;mag=5.87|ra=14 19 01.13;dec=-25 48 58.7;mag=5.87|ra=08 33 43.49;dec=+04 45 25.3;mag=5.89|ra=08 22 54.10;dec=-07 32 35.3;mag=5.92|ra=09 33 26.10;dec=-22 51 50.5;mag=5.92|ra=11 55 40.13;dec=-28 28 37.3;mag=5.93|ra=08 56 34.13;dec=-16 42 31.3;mag=5.95|ra=09 32 55.78;dec=-13 31 00.5;mag=5.95|ra=11 34 29.95;dec=-32 50 00.0;mag=5.96|ra=07 39 18.54;dec=+05 13 39.0;mag=0.34|ra=07 27 09.07;dec=+08 17 21.9;mag=2.89|ra=07 28 09.83;dec=+08 55 31.8;mag=4.33|ra=08 02 15.95;dec=+02 20 03.5;mag=4.39|ra=07 29 47.78;dec=+12 00 23.8;mag=4.55|ra=07 25 38.90;dec=+09 16 34.0;mag=4.99|ra=07 51 42.00;dec=+01 46 00.8;mag=5.12|ra=07 28 02.08;dec=+06 56 31.5;mag=5.22|ra=07 32 05.95;dec=+01 54 52.1;mag=5.24|ra=07 46 16.22;dec=+10 46 05.9;mag=5.25|ra=07 58 20.75;dec=+02 13 28.3;mag=5.30|ra=07 14 20.07;dec=+03 06 41.1;mag=5.36|ra=07 24 58.19;dec=+11 40 10.4;mag=5.37|ra=07 33 11.68;dec=+03 17 25.0;mag=5.59|ra=08 01 13.91;dec=+04 52 47.2;mag=5.65|ra=07 14 32.65;dec=+12 06 57.1;mag=5.71|ra=07 07 49.48;dec=+07 28 16.7;mag=5.74|ra=07 15 39.42;dec=+07 58 39.9;mag=5.78|ra=07 34 15.89;dec=+03 22 18.3;mag=5.83|ra=07 55 31.44;dec=+08 51 47.0;mag=5.86|ra=07 36 34.77;dec=+05 51 43.6;mag=5.89|ra=07 19 22.37;dec=+02 44 26.6;mag=5.90|ra=07 19 47.61;dec=+07 08 35.1;mag=5.91|ra=07 41 35.16;dec=+03 37 29.4;mag=5.95|ra=07 22 03.48;dec=+00 10 37.7;mag=5.99|ra=06 45 09.25;dec=-16 42 47.3;mag=-1.46|ra=06 58 37.55;dec=-28 58 19.5;mag=1.50|ra=07 08 23.49;dec=-26 23 35.5;mag=1.83|ra=06 22 41.99;dec=-17 57 21.3;mag=1.98|ra=07 24 05.71;dec=-29 18 11.2;mag=2.45|ra=06 20 18.79;dec=-30 03 48.2;mag=3.02|ra=07 03 01.47;dec=-23 49 59.9;mag=3.02|ra=07 01 43.15;dec=-27 56 05.4;mag=3.49|ra=06 49 50.47;dec=-32 30 30.6;mag=3.50|ra=06 54 07.95;dec=-24 11 03.2;mag=3.89|ra=06 36 41.00;dec=-19 15 20.6;mag=3.95|ra=07 14 48.66;dec=-26 46 21.7;mag=4.01|ra=06 54 11.48;dec=-12 02 18.9;mag=4.08|ra=07 03 45.49;dec=-15 37 59.7;mag=4.12|ra=06 31 51.37;dec=-23 25 06.4;mag=4.34|ra=06 56 08.23;dec=-17 03 15.3;mag=4.36|ra=07 18 42.49;dec=-24 57 15.8;mag=4.37|ra=06 37 53.43;dec=-18 14 14.8;mag=4.42|ra=07 14 15.22;dec=-26 21 09.1;mag=4.42|ra=06 28 10.22;dec=-32 34 48.5;mag=4.47|ra=06 35 03.38;dec=-22 57 53.4;mag=4.54|ra=06 55 37.40;dec=-20 08 11.7;mag=4.66|ra=07 16 35.00;dec=-27 52 52.6;mag=4.66|ra=06 39 16.72;dec=-14 08 44.7;mag=4.82|ra=06 53 32.91;dec=-20 13 27.3;mag=4.82|ra=07 16 36.84;dec=-23 18 56.2;mag=4.83|ra=07 18 40.38;dec=-24 33 31.3;mag=4.88|ra=07 22 13.53;dec=-19 00 59.7;mag=4.94|ra=06 15 44.88;dec=-13 43 06.2;mag=5.00|ra=06 56 06.65;dec=-14 02 36.4;mag=5.00|ra=06 17 41.73;dec=-16 48 57.3;mag=5.15|ra=06 31 23.02;dec=-12 23 30.9;mag=5.16|ra=07 24 40.19;dec=-16 12 05.1;mag=5.18|ra=06 24 10.35;dec=-11 31 48.0;mag=5.21|ra=06 44 28.47;dec=-31 04 13.9;mag=5.23|ra=06 37 47.54;dec=-32 20 23.6;mag=5.25|ra=06 46 51.09;dec=-14 25 33.6;mag=5.28|ra=06 55 46.93;dec=-22 56 29.2;mag=5.28|ra=07 18 51.28;dec=-26 35 09.1;mag=5.29|ra=06 45 59.40;dec=-14 47 45.9;mag=5.30|ra=07 24 43.87;dec=-31 48 32.1;mag=5.35|ra=07 15 21.08;dec=-30 41 11.3;mag=5.36|ra=07 23 28.97;dec=-27 50 03.4;mag=5.37|ra=06 48 57.74;dec=-15 08 41.0;mag=5.39|ra=07 23 00.70;dec=-31 55 25.6;mag=5.40|ra=07 06 40.77;dec=-11 17 38.5;mag=5.41|ra=07 23 31.90;dec=-32 12 07.5;mag=5.41|ra=06 57 33.97;dec=-24 37 51.8;mag=5.45|ra=07 10 19.33;dec=-27 29 29.5;mag=5.46|ra=07 16 14.58;dec=-15 35 08.4;mag=5.46|ra=06 21 24.72;dec=-11 46 23.7;mag=5.48|ra=06 18 13.73;dec=-19 58 01.2;mag=5.51|ra=07 14 51.19;dec=-27 02 16.5;mag=5.58|ra=06 58 35.90;dec=-25 24 51.0;mag=5.59|ra=07 20 58.29;dec=-14 21 37.8;mag=5.59|ra=07 27 07.99;dec=-17 51 53.5;mag=5.60|ra=06 23 55.91;dec=-25 34 39.1;mag=5.61|ra=06 34 35.33;dec=-32 42 58.5;mag=5.62|ra=06 45 31.19;dec=-30 56 56.4;mag=5.62|ra=07 01 05.95;dec=-25 12 56.3;mag=5.64|ra=06 53 18.84;dec=-19 01 58.0;mag=5.65|ra=07 26 59.49;dec=-23 05 09.7;mag=5.65|ra=07 09 43.03;dec=-25 13 51.8;mag=5.69|ra=06 39 42.67;dec=-30 28 12.1;mag=5.70|ra=07 19 28.08;dec=-16 23 41.7;mag=5.70|ra=06 36 22.86;dec=-18 39 35.8;mag=5.71|ra=06 32 38.98;dec=-32 01 49.6;mag=5.73|ra=06 28 39.24;dec=-32 22 16.7;mag=5.74|ra=06 50 23.35;dec=-31 42 21.9;mag=5.74|ra=07 07 22.59;dec=-23 50 26.6;mag=5.75|ra=06 28 37.41;dec=-17 27 57.7;mag=5.76|ra=06 50 21.77;dec=-17 05 04.4;mag=5.77|ra=07 13 07.20;dec=-11 15 04.9;mag=5.77|ra=06 18 58.98;dec=-20 55 32.2;mag=5.79|ra=07 25 08.44;dec=-13 45 07.1;mag=5.79|ra=07 25 25.27;dec=-25 13 04.0;mag=5.79|ra=07 27 51.66;dec=-11 33 24.7;mag=5.79|ra=06 55 02.74;dec=-20 24 17.5;mag=5.80|ra=07 11 41.61;dec=-20 52 59.2;mag=5.84|ra=07 21 04.34;dec=-25 53 30.0;mag=5.87|ra=06 15 08.40;dec=-20 16 20.1;mag=5.88|ra=07 12 12.22;dec=-25 56 33.4;mag=5.91|ra=06 30 46.29;dec=-27 46 10.5;mag=5.92|ra=06 45 23.08;dec=-31 47 34.5;mag=5.92|ra=06 36 46.60;dec=-13 19 15.5;mag=5.95|ra=07 13 24.01;dec=-22 40 26.9;mag=5.96|ra=06 16 07.70;dec=-16 37 04.8;mag=5.97|ra=06 15 17.71;dec=-18 28 37.2;mag=5.99 star=ldtext.Split (st "|") 'GraphicsWindow.ShowMessage (Array.GetItemCount (st),"") EndSub Sub RADec2XY x = Text.GetSubText(ra, 1, 2) x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = x * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") EndSub End>RFS623.sb< Start>RFT686-1.sb< ' 16x16 Plain PPM Icon Editor ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Version 0.3a ' Last update 2015-02-17 ' Program ID RFT686-1 ' Repository https://iconeditorsb.codeplex.com/ ' ' set graphics window title title = "Icon Editor 0.3a" GraphicsWindow.Title = "Untitled - " + title ' define variables as constants or functions debug = "False" If debug Then TextWindow.Title = "Debug - " + title EndIf CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) TAB = Text.GetCharacter(19) Not = "False=True;True=False;" ' width/height [%] of each character in Trebuchet MS font ratio = "32=30;48=58;49=58;50=58;51=58;52=58;53=58;54=58;55=58;56=58;57=58;97=53;98=58;99=51;100=58;101=57;102=37;103=50;104=59;105=30;106=37;107=55;108=29;109=86;110=59;111=56;112=58;113=58;114=43;115=43;116=39;117=59;118=53;119=78;120=55;121=53;122=53;65=63;66=59;67=61;68=64;69=57;70=58;71=67;72=68;73=28;74=53;75=62;76=55;77=74;78=67;79=70;80=59;81=71;82=61;83=51;84=61;85=68;86=62;87=88;88=60;89=61;90=56;" ' initialize mouse and keyboard events Mouse_Init() KB_Init() ' show menu, white icon, and edit field in graphics window Form() Msg_Init() color = "Black" Color_SetPenColor() For y = 0 To iconHeight - 1 For x = 0 To iconWidth - 1 Icon_GetPixel() Icon_SetPixel() EndFor EndFor While "True" If clicked Then ' find clicked object - menu item or pixel of the icon Mouse_DetectObject() ' create message (command) for the object if found If name = "pen color" Then param = "cmd=color;" Msg_Set() ElseIf name <> "" Then param = "cmd=" + name + ";" Msg_Set() EndIf clicked = "False" EndIf While keyOut < keyIn KB_InKey() ' create message (command) for the shortcut if found If c = "^N" Then param = "cmd=new;" Msg_Set() c = "" ElseIf c = "^O" Then param = "cmd=open;" Msg_Set() c = "" ElseIf c = "^S" Then param = "cmd=save;" Msg_Set() c = "" ElseIf c = "^Z" Then param = "cmd=undo;" Msg_Set() c = "" ElseIf c = "^Y" Then param = "cmd=redo;" Msg_Set() c = "" ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown = '" + c + "'") TextWindow.ForegroundColor = "Gray" c = "" EndIf EndWhile If msgOut < msgIn Then ' do action for the message (command) msgOut = msgOut + 1 msg = message[msgOut] GraphicsWindow.Title = msg["cmd"] + " - " + title EndIf If debug Then Debug_StateChanged() If changed Then Debug_Dump() EndIf EndIf EndWhile Sub Debug_StateChanged ' Debug | Check state changed ' return changed - "True" if state changed changed = "False" If keyIn <> lastKeyIn Then lastKeyIn = keyIn changed = "True" EndIf If keyOut <> lastKeyOut Then lastKeyOut = keyOut changed = "True" EndIf If msgIn <> lastMsgIn Then lastMsgIn = msgIn changed = "True" EndIf If msgOut <> lastMsgOut Then lastMsgOut = msgOut changed = "True" EndIf EndSub Sub Debug_Dump ' Debug | Dump state TextWindow.WriteLine("fifo = " + fifo) TextWindow.WriteLine("keyIn = " + keyIn) TextWindow.WriteLine("keyOut = " + keyOut) TextWindow.WriteLine("message = " + message) TextWindow.WriteLine("msgIn = " + msgIn) TextWindow.WriteLine("msgOut = " + msgOut) EndSub Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "DimGray" iconWidth = 16 '40 iconHeight = 16 '40 itemSize = 40 itemGap = 10 menuHeight = 60 size = 16 '6 gap = 2 Menu_Draw() xEdit = Math.Floor((gw - (size + gap + 1) * iconWidth) / 2) + iconWidth yEdit = Math.Floor((gh - menuHeight - (size + gap) * iconHeight) / 2) + menuHeight xIcon = Math.Floor((xEdit - iconWidth) / 2) yIcon = yEdit add = "True" Icon_Clear() add = "False" EndSub Sub Array_GetIndexOfValue ' param arry - array ' param value - value to get index ' return index - index if found or "" if not found nValue = Array.GetItemCount(arry) indices = Array.GetAllIndices(arry) index = "" For iArry = 1 To nValue If value = arry[indices[iArry]] Then index = indices[iArry] iArry = nValue + 1 ' break EndIf EndFor EndSub Sub Color_SetPenColor ' param color GraphicsWindow.BrushColor = color padding = 4 arry = item value = "Pen Color" Array_GetIndexOfValue() y = Math.Floor((menuHeight - itemSize - 10) / 2) + padding x = (index - 1) * (itemSize + itemGap) + itemGap + padding GraphicsWindow.FillRectangle(x, y, itemSize - 2 * padding, itemSize - 2 * padding) EndSub Sub Icon_Clear ' param add - "True" to add menu to mouse object GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(xIcon, yIcon, iconWidth, iconHeight) For row = 0 To iconHeight - 1 y = yEdit + row * (size + gap) For col = 0 To iconWidth - 1 x = xEdit + col * (size + gap) GraphicsWindow.FillRectangle(x, y, size, size) EndFor EndFor If add Then param = "" param["name"] = "icon" param["xLeft"] = xEdit param["xRight"] = xEdit + iconWidth * (size + gap) - gap param["yTop"] = yEdit param["yBottom"] = yEdit + iconHeight * (size + gap) - gap Mouse_AddObject() EndIf EndSub Sub Icon_GetPixel ' param x, y - position in icon ' return color - got color color = GraphicsWindow.GetPixel(xIcon + x, yIcon + y) EndSub Sub Icon_SetPixel ' param x, y - position in icon ' param color - set color GraphicsWindow.SetPixel(xIcon + x, yIcon + y, color) GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(xEdit + x * (size + gap), yEdit + y * (size + gap), size, size) EndSub Sub KB_Init ' Keyboard | Initialization (use only ^n, ^o, ^s, ^z, ^y) shift = "" ctrl = "" keyIn = 0 keyOut = 0 GraphicsWindow.KeyDown = KB_OnKeyDown GraphicsWindow.KeyUp = KB_OnKeyUp EndSub Sub KB_InKey ' Keyboard | In key ' return c - input key If keyOut < keyIn Then keyOut = keyOut + 1 Program.Delay(1) ' workaround 29976 c = fifo[keyOut] 'fifo[keyOut] = "" EndIf EndSub Sub KB_OnKeyDown ' Keyboard | Key down event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "+" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "^" Else keyIn = keyIn + 1 fifo[keyIn] = shift + ctrl + key EndIf EndSub Sub KB_OnKeyUp ' Keyboard | Key up event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "" EndIf EndSub Sub Menu_Draw GraphicsWindow.BrushColor = "#EEEEEE" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) item = "1=New;2=Open;3=Save;4=Undo;5=Redo;6=Pen Color;" nItem = Array.GetItemCount(item) add = "True" For i = 1 To nItem Menu_DrawItem() EndFor add = "False" EndSub Sub Menu_DrawItem ' param i - index number of the menu item ' param add - "True" to add menu to mouse object y = Math.Floor((menuHeight - itemSize - 10) / 2) x = (i - 1) * (itemSize + itemGap) + itemGap url = "http://www.nonkit.com/smallbasic.files/" + Text.ConvertToLowerCase(item[i]) + ".png" GraphicsWindow.DrawImage(url, x, y) If add Then param = "" param["name"] = Text.ConvertToLowerCase(item[i]) param["xLeft"] = x param["xRight"] = x + itemSize param["yTop"] = y param["yBottom"] = y + itemSize Mouse_AddObject() EndIf fs = 10 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" txt = item[i] Text_GetWidthInPx() dx = Math.Floor((itemSize - px) / 2) GraphicsWindow.DrawText(x + dx, y + itemSize, item[i]) EndSub Sub Mouse_AddObject ' Mouse | Add object to click ' param["name"] - name of the object to add ' param["xLeft"] - left x coordinate of the object ' param["xRight"] - right x coordinate of the object ' param["yTop"] - top y coordinate of the object ' param["yBottom"] - bottom y coordinate of the object ' return object ' return nObject nObject = nObject + 1 object[nObject] = param EndSub Sub Mouse_DetectObject ' param mxD, myD - mouse clicked coordinate ' return name - clicked object name if found, "" if not found name = "" ' not found For iObject = 1 To nObject obj = object[iObject] If obj["xLeft"] <= mxD And mxD <= obj["xRight"] And obj["yTop"] <= myD And myD <= obj["yBottom"] Then name = obj["name"] ' found iObject = nObject ' break EndIf EndFor EndSub Sub Mouse_Init ' Mouse | Initialize for common event handler clicked = "False" object = "" nObject = 0 GraphicsWindow.MouseDown = Mouse_OnDown EndSub Sub Mouse_OnDown ' Mouse | Common event handler on mouse down ' return mxD, myD - position on mouse down mxD = Math.Floor(GraphicsWindow.MouseX) myD = Math.Floor(GraphicsWindow.MouseY) clicked = "True" EndSub Sub Msg_Init ' Message | Initialize msgIn = 0 msgOut = 0 EndSub Sub Msg_Set ' Message | Set message to fifo ' param["cmd"] - massage command ' param["*"].. - message operands msgIn = msgIn + 1 message[msgIn] = param EndSub Sub Text_GetWidthInPx ' param txt - text to get width in px ' param ratio - character width/height in a font ' param fs - font size (height) ' return px - width in px (pixels) len = Text.GetLength(txt) px = 0 For p = 1 To len px = px + ratio[Text.GetCharacterCode(Text.GetSubText(txt, p, 1))] EndFor px = Math.Floor(px * fs / 100) EndSub End>RFT686-1.sb< Start>RFT686-2.sb< ' 16x16 Plain PPM Icon Editor ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Version 0.4a ' Last update 2015-02-19 ' Program ID RFT686-2 ' Repository https://iconeditorsb.codeplex.com/ ' ' TODO: ' [ ] #9 Workaround for Silverlight ' [ ] #8 Add unit test feature ' [ ] #7 Add new command ' [✓] #6 Add color command ' [ ] #5 Add redo command ' [ ] #4 Add undo command ' [ ] #3 Add save command ' [ ] #2 Add open command ' [✓] #1 Add pixel command ' ' set graphics window title title = "Icon Editor 0.4a" GraphicsWindow.Title = "Untitled - " + title ' define variables as constants or functions debug = "False" If debug Then TextWindow.Title = "Debug - " + title Timer.Interval = 500 Timer.Tick = Mouse_OnTick EndIf CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) TAB = Text.GetCharacter(9) Not = "False=True;True=False;" ' width/height [%] of each character in Trebuchet MS font ratio = "32=30;48=58;49=58;50=58;51=58;52=58;53=58;54=58;55=58;56=58;57=58;97=53;98=58;99=51;100=58;101=57;102=37;103=50;104=59;105=30;106=37;107=55;108=29;109=86;110=59;111=56;112=58;113=58;114=43;115=43;116=39;117=59;118=53;119=78;120=55;121=53;122=53;65=63;66=59;67=61;68=64;69=57;70=58;71=67;72=68;73=28;74=53;75=62;76=55;77=74;78=67;79=70;80=59;81=71;82=61;83=51;84=61;85=68;86=62;87=88;88=60;89=61;90=56;" ' initialize mouse and keyboard events Mouse_Init() KB_Init() ' show menu, white icon, and edit field in graphics window pcolor = GraphicsWindow.PenColor Form() Color_Init() Msg_Init() For y = 0 To iconHeight - 1 For x = 0 To iconWidth - 1 Icon_GetPixel() Icon_SetPixel() EndFor EndFor While "True" If clicked Then ' find clicked object - menu item or pixel of the icon Mouse_DetectObject() ' create message (command) for the object if found If name = "pen color" Then param = "cmd=color;" Msg_Set() ElseIf name = "icon" Then Icon_MouseToXY() If 0 <= x And 0 <= y Then param = "cmd=pixel;x=" + x + ";y=" + y + ";" Msg_Set() EndIf ElseIf name <> "" Then param = "cmd=" + name + ";" Msg_Set() EndIf clicked = "False" EndIf While keyOut < keyIn KB_InKey() ' create message (command) for the shortcut if found If c = "^N" Then param = "cmd=new;" Msg_Set() c = "" ElseIf c = "^O" Then param = "cmd=open;" Msg_Set() c = "" ElseIf c = "^S" Then param = "cmd=save;" Msg_Set() c = "" ElseIf c = "^Z" Then param = "cmd=undo;" Msg_Set() c = "" ElseIf c = "^Y" Then param = "cmd=redo;" Msg_Set() c = "" ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown = '" + c + "'") TextWindow.ForegroundColor = "Gray" c = "" EndIf EndWhile If msgOut < msgIn Then ' do action for the message (command) msgOut = msgOut + 1 msg = message[msgOut] If msg["cmd"] = "pixel" Then color = pcolor x = msg["x"] y = msg["y"] Icon_SetPixel() ElseIf msg["cmd"] = "color" Then color = pcolor CS_ShowPopup() pcolor = color Color_SetPenColor() Else GraphicsWindow.Title = msg["cmd"] + " - " + title EndIf EndIf If debug Then Debug_StateChanged() If changed Then Debug_Dump() EndIf EndIf EndWhile Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "DimGray" iconWidth = 16 '40 iconHeight = 16 '40 itemSize = 40 itemGap = 10 menuHeight = 60 size = 16 '6 gap = 2 Menu_Draw() xEdit = Math.Floor((gw - (size + gap + 1) * iconWidth) / 2) + iconWidth yEdit = Math.Floor((gh - menuHeight - (size + gap) * iconHeight) / 2) + menuHeight xIcon = Math.Floor((xEdit - iconWidth) / 2) yIcon = yEdit add = "True" Icon_Clear() add = "False" EndSub Sub Array_GetIndexOfValue ' param arry - array ' param value - value to get index ' return index - index if found or "" if not found nValue = Array.GetItemCount(arry) indices = Array.GetAllIndices(arry) index = "" For iArry = 1 To nValue If value = arry[indices[iArry]] Then index = indices[iArry] iArry = nValue + 1 ' break EndIf EndFor EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param sColor - "#rrggbb" ' return iR, iG, iB - [0, 255] sR = Text.GetSubText(sColor, 2, 2) sG = Text.GetSubText(sColor, 4, 2) sB = Text.GetSubText(sColor, 6, 2) sHex = sR Math_Hex2Dec() iR = iDec sHex = sG Math_Hex2Dec() iG = iDec sHex = sB Math_Hex2Dec() iB = iDec EndSub Sub Color_HSLtoRGB ' Color | Convert HSL to RGB ' param rHue - [0, 360) or UNDEFINED ' param rLightness - [0, 1] ' param rSaturation - [0, 1] ' return iR, iG, iB - RGB color ' return sColor - "#rrggbb" If rLightness <= 0.5 Then rN2 = rLightness * (1 + rSaturation) Else rN2 = rLightness + rSaturation - rLightness * rSaturation EndIf rN1 = 2 * rLightness - rN2 If rSaturation = 0 Then iR = Math.Round(rLightness * 255) iG = Math.Round(rLightness * 255) iB = Math.Round(rLightness * 255) Else rH = rHue + 120 Color_Value() iR = iValue rH = rHue Color_Value() iG = iValue rH = rHue - 120 Color_Value() iB = iValue EndIf sColor = GraphicsWindow.GetColorFromRGB(iR, iG, iB) EndSub Sub Color_Init Popup_Init() Color_SetPenColor() CS_InitPalette() ' initialize palette for color slider EndSub Sub Color_RGBtoHSL ' Color | Convert RGB to HSL ' param sColor - "#rrggbb" ' return rHue - [0, 360) or UNDEFINED ' return rLightness - (0, 1) ' return rSaturation - (0, 1) Color_ColorToRGB() ' rR = iR / 255 ' occurs Math.Max() bug rR = Math.Round(iR / 255 * 10000) / 10000 ' rG = iG / 255 ' occurs Math.Max() bug rG = Math.Round(iG / 255 * 10000) / 10000 ' rB = iB / 255 ' occurs Math.Max() bug rB = Math.Round(iB / 255 * 10000) / 10000 rMax = Math.Max(rR, rG) rMax = Math.Max(rMax, rB) rMin = Math.Min(rR, rG) rMin = Math.Min(rMin, rB) rLightness = (rMax + rMin) / 2 If rMax = rMin Then ' rR = rG = rB rSaturation = 0 rHue = UNDEFINED Else If rLightness <= 0.5 Then rSaturation = (rMax - rMin) / (rMax + rMin) Else rSaturation = (rMax - rMin) / (2 - rMax - rMin) EndIf rRC = (rMax - rR) / (rMax - rMin) rGC = (rMax - rG) / (rMax - rMin) rBC = (rMax - rB) / (rMax - rMin) If rR = rMax Then ' between Yellow and Magenta rHue = rBC - rGC ElseIf rG = rMax Then ' between Cyan and Yellow rHue = 2 + rRC - rBC ElseIf rB = rMax Then ' between Magenta and Cyan rHue = 4 + rGC - rRC Else TextWindow.WriteLine("Error:") TextWindow.WriteLine("rMax=" + rMax) TextWindow.WriteLine("rR=" + rR + ",sR=" + sR) TextWindow.WriteLine("rG=" + rG + ",sG=" + sG) TextWindow.WriteLine("rB=" + rB + ",sB=" + sB) EndIf rHue = rHue * 60 If rHue < 0 Then rHue = rHue + 360 EndIf EndIf EndSub Sub Color_Value ' Color | Function value ' param rN1, rN2 ' param rH - [-120, 480) ' return iValue - 0..255 If rH >= 360 Then rH = rH - 360 EndIF If rH < 0 Then rH = rH + 360 EndIF If rH < 60 Then rV = rN1 + (rN2 - rN1) * rH / 60 ElseIf rH < 180 Then rV = rN2 ElseIf rH < 240 Then rV = rN1 + (rN2 - rN1) * (240 - rH) / 60 Else rV = rN1 EndIf iValue = Math.Round(rV * 255) EndSub Sub CS_AddColorToPalette ' Color Selector | Add color to palette ' param color - color to set ' param maxPalette ' param nPalette ' param palette ' param tPalette - target palette Stack.PushValue("local", i) For i = 1 To nPalette pltt = palette[i] If color = pltt["color"] Then Goto csactp_not_new_color EndIf EndFor pltt = palette[tPalette] pltt["color"] = color palette[tPalette] = pltt If nPalette < maxPalette Then nPalette = nPalette + 1 EndIf tPalette = tPalette + 1 If maxPalette < tPalette Then tPalette = 1 EndIf csactp_not_new_color: i = Stack.PopValue("local") EndSub Sub CS_AdjustSlider ' Color Selector | Adjust slider ' param iSlider - moved slider Stack.PushValue("local", iSlider) If iSlider = iHue Or iSlider = iLightness Or iSlider = iSaturation Then If iSlider = iHue Then Slider_GetLevel() rHue = level ElseIf iSlider = iLightness Then Slider_GetLevel() rLightness = level / 100 Else Slider_GetLevel() rSaturation = level / 100 EndIf Color_HSLtoRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() Else CS_GetColorFromSlider() sColor = GraphicsWindow.GetColorFromRGB(red, green, blue) Color_RGBtoHSL() If rHue = UNDEFINED Then rHue = 0 EndIf iSlider = iHue level = Math.Floor(rHue) Slider_SetLevel() iSlider = iSaturation level = Math.Floor(rSaturation * 100) Slider_SetLevel() iSlider = iLightness level = Math.Floor(rLightness * 100) Slider_SetLevel() EndIf iSlider = Stack.PopValue("local") EndSub Sub CS_DoObject ' Color Selector | Do object ' param - obj While obj <> "" CS_DoSlider() If obj <> "" Then CS_DoPalette() EndIf EndWhile EndSub Sub CS_DoPalette ' Color Selector | Do palette ' param obj - clicked object If Text.StartsWith(obj, "palette") Then iPalette = Text.GetSubTextToEnd(obj, 8) pltt = palette[iPalette] color = pltt["color"] CS_SetColorToSlider() ' set color to slider CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DoSlider ' Color Selector | Do slider ' param obj - clicked object ' param iSlider - index of slider If Text.StartsWith(obj, "slider") Then Slider_WaitToRelease() obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DrawColorRect ' Color Selector | Draw color rectangle ' param color - color of rectangle ' param x, y, width, height - position and size of rectangle ' return oRect - rectangle object GraphicsWindow.BrushColor = color GraphicsWindow.PenColor = BORDERCOLOR If oRect <> "" Then Shapes.Remove(oRect) EndIf oRect = Shapes.AddRectangle(width, height) Shapes.Move(oRect, x, y) EndSub Sub CS_DrawPalette ' Color Selector | Draw palette ' param palette[] - color palette ' param nPalette - number of color in palette ' param x, y, width, height - position and size of rectangle ' return oPalette[] - palette object array Stack.PushValue("local", i) GraphicsWindow.PenColor = BORDERCOLOR For i = 1 To nPalette pltt = palette[i] GraphicsWindow.BrushColor = pltt["color"] pltt["oCell"] = Shapes.AddRectangle(width, height) dx = Math.Remainder((i - 1), (maxPalette / 2)) * (width + 4) dy = Math.Floor((i - 1) / (maxPalette / 2)) * (height + 4) Shapes.Move(pltt["oCell"], x + dx, y + dy) pltt["x"] = x + dx pltt["y"] = y + dy pltt["width"] = width pltt["height"] = height palette[i] = pltt EndFor i = Stack.PopValue("local") EndSub Sub CS_GetColorFromSlider ' Color Selector | get color from slider ' return color Stack.PushValue("local", iSlider) iSlider = iRed ' slider index Slider_GetLevel() red = level iSlider = iGreen ' slider index Slider_GetLevel() green = level iSlider = iBlue ' slider index Slider_GetLevel() blue = level color = GraphicsWindow.GetColorFromRGB(red, green, blue) iSlider = Stack.PopValue("local") EndSub Sub CS_Init ' Color Selector | Initialize sliders width = 256 min = 0 max = 255 left = 190 ' add red slider top = TOPY caption = "R" Slider_Add() iRed = iSlider ' index of slider ' add green slider top = top + DELTAY caption = "G" Slider_Add() iGreen = iSlider ' index of slider ' add blue slider top = top + DELTAY caption = "B" Slider_Add() iBlue = iSlider ' index of slider ' add hue slider width = 360 top = top + DELTAY max = 360 caption = "H" Slider_Add() iHue = iSlider ' index of slider ' add saturation slider width = 100 top = top + DELTAY max = 100 caption = "S" Slider_Add() iSaturation = iSlider ' index of slider ' add lightness slider width = 100 top = top + DELTAY max = 100 caption = "L" Slider_Add() iLightness = iSlider ' index of slider ' draw color rectangle CS_GetColorFromSlider() CS_ShowNewColor() x = LEFTX y = TOPY + DELTAY * 4 width = 100 height = 100 CS_DrawColorRect() ' add text box GraphicsWindow.BrushColor = CAPTIONCOLOR top = y + height + 4 oNewColor = Shapes.AddText("") Shapes.Move(oNewColor, LEFTX, top) EndSub Sub CS_DumpSlider ' Color Selector | Dump slider for debug For i = 1 To numSlider TextWindow.WriteLine("slider" + i) TextWindow.WriteLine(slider[i]) EndFor EndSub Sub CS_InitPalette ' Color Selector | Initialize palette ' This subroutine should be called before CS_ShowPopup(). pcolor = GraphicsWindow.PenColor If Text.GetLength(pcolor) = 9 Then ' for Silverlight pcolor = "#" + Text.GetSubText(pcolor, 4, 6) EndIf maxPalette = 24 ' max cell number of palette nPalette = 1 ' number of palette in use tPalette = 2 ' index of update target cell pltt = palette[1] pltt["color"] = pcolor palette[1] = pltt EndSub Sub CS_RemovePalette ' Color Selector | Remove palette ' param nPalette - number of color in palette ' return oPalette[] - palette object array Stack.PushValue("local", i) For i = 1 To nPalette oPalette = "Palette" + i pltt = palette[i] Shapes.Remove(pltt["oCell"]) EndFor i = Stack.PopValue("local") EndSub Sub CS_RemoveSliders ' Color Selector | Remove sliders For iSlider = 1 To numSlider Slider_Remove() EndFor numSlider = 0 EndSub Sub CS_SearchClickedObject ' Color Selector | Check slider clicked ' param mxD, myD - clicked point ' return obj - clicked slider or palette ' return iSlider - index if obj is slider ' return iPalette - index if obj is palette Stack.PushValue("local", i) For iSlider = 1 To numSlider obj = "slider" + iSlider sldr = slider[iSlider] x2 = sldr["x2"] y2 = sldr["y2"] x3 = sldr["x3"] y3 = sldr["y3"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor For iPalette = 1 To nPalette obj = "palette" + iPalette pltt = palette[iPalette] x2 = pltt["x"] y2 = pltt["y"] x3 = pltt["x"] + pltt["width"] y3 = pltt["y"] + pltt["height"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor obj = "" scco_obj_found: i = Stack.PopValue("local") EndSub Sub CS_SetColorToSlider ' Color Selector | Set color to slider ' param color Stack.PushValue("local", iSlider) sColor = color Color_ColorToRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() CS_AdjustSlider() iSlider = Stack.PopValue("local") EndSub Sub CS_ShowNewColor ' Color Selector | Show new color ' param oColor ' param color Shapes.SetText(oNewColor, color) EndSub Sub CS_ShowPopup ' Color Selector | Show popup ' param color - current color ' return color - new color ' define constant Stack.PushValue("local", cont) fs = 12 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = "Black" colorInit = color ' initial color GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = POPUPCOLOR GraphicsWindow.BrushColor = POPUPCOLOR oPopup = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oPopup, 64) Shapes.Move(oPopup, LEFTX - 10, TOPY - 10) GraphicsWindow.BrushColor = CAPTIONCOLOR oOK = Controls.AddButton("OK", gw - 100, gh - 34) oCancel = Controls.AddButton("Cancel", gw - 60, gh - 34) Controls.ButtonClicked = CS_OnButtonClicked CS_Init() Stack.PushValue("local", y) y = TOPY color = colorInit CS_DrawColorRect() ' original color oRectCurrent = oRect oRect = "" ' keep current color If Text.GetLength(color) = 9 Then ' for Silverlight color = "#" + Text.GetSubText(color, 4, 6) EndIf GraphicsWindow.BrushColor = CAPTIONCOLOR oColor = Shapes.AddText(colorInit) Shapes.Move(oColor, x, y + height + 2) y = Stack.PopValue("local") CS_SetColorToSlider() CS_DrawColorRect() ' draw new color rectangle CS_ShowNewColor() ' show new color name Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", width) Stack.PushValue("local", height) x = x + width + 30 y = TOPY + height * 2 + 24 width = 30 height = 30 CS_DrawPalette() height = Stack.PopValue("local") width = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") cont = "True" ' continue param = "down=True;move=False;up=False;" ' wait click Mouse_SetHandler() While cont If clicked Then CS_SearchClickedObject() CS_DoObject() clicked = "False" Else Program.Delay(100) EndIf EndWhile If cancel Then color = colorInit Else CS_AddColorToPalette() EndIf CS_RemovePalette() CS_RemoveSliders() Shapes.Remove(oColor) Shapes.Remove(oNewColor) Shapes.Remove(oRectCurrent) Shapes.Remove(oRect) Controls.Remove(oOK) Controls.Remove(oCancel) Shapes.Remove(oPopup) cont = Stack.PopValue("local") EndSub Sub CS_OnButtonClicked ' Color Selector | Event handler on button clicked cont = "False" If Controls.LastClickedButton = oCancel Then cancel = "True" Else cancel = "False" EndIf EndSub Sub Color_SetPenColor ' param pcolor GraphicsWindow.BrushColor = pcolor padding = 4 arry = item value = "Pen Color" Array_GetIndexOfValue() y = Math.Floor((menuHeight - itemSize - 10) / 2) + padding x = (index - 1) * (itemSize + itemGap) + itemGap + padding GraphicsWindow.FillRectangle(x, y, itemSize - 2 * padding, itemSize - 2 * padding) EndSub Sub Debug_StateChanged ' Debug | Check state changed ' return changed - "True" if state changed changed = "False" If keyIn <> lastKeyIn Then lastKeyIn = keyIn changed = "True" EndIf If keyOut <> lastKeyOut Then lastKeyOut = keyOut changed = "True" EndIf If msgIn <> lastMsgIn Then lastMsgIn = msgIn changed = "True" EndIf If msgOut <> lastMsgOut Then lastMsgOut = msgOut changed = "True" EndIf EndSub Sub Debug_Dump ' Debug | Dump state TextWindow.WriteLine("fifo = " + fifo) TextWindow.WriteLine("keyIn = " + keyIn) TextWindow.WriteLine("keyOut = " + keyOut) TextWindow.WriteLine("message = " + message) TextWindow.WriteLine("msgIn = " + msgIn) TextWindow.WriteLine("msgOut = " + msgOut) EndSub Sub Icon_Clear ' param add - "True" to add menu to mouse object GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(xIcon, yIcon, iconWidth, iconHeight) For row = 0 To iconHeight - 1 y = yEdit + row * (size + gap) For col = 0 To iconWidth - 1 x = xEdit + col * (size + gap) GraphicsWindow.FillRectangle(x, y, size, size) EndFor EndFor If add Then param = "" param["name"] = "icon" param["xLeft"] = xEdit param["xRight"] = xEdit + iconWidth * (size + gap) - gap param["yTop"] = yEdit param["yBottom"] = yEdit + iconHeight * (size + gap) - gap Mouse_AddObject() EndIf EndSub Sub Icon_GetPixel ' param x, y - position in icon ' return color - got color color = GraphicsWindow.GetPixel(xIcon + x, yIcon + y) EndSub Sub Icon_MouseToXY ' param xRel, yRel - position in icon edit field ' return x, y - pixel of the icon or (-1, -1) if on the grid x = Math.Floor(xRel / (size + gap)) y = Math.Floor(yRel / (size + gap)) If (iconWidth - 1 < x) Or (iconHeight - 1 < y) Then x = -1 y = -1 Else xMod = Math.Remainder(xRel, (size + gap)) yMod = Math.Remainder(yRel, (size + gap)) If (size - 1 < xMod) Or (size - 1 < yMod) Then x = -1 y = -1 EndIf EndIf EndSub Sub Icon_SetPixel ' param x, y - position in icon ' param color - set color GraphicsWindow.SetPixel(xIcon + x, yIcon + y, color) GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(xEdit + x * (size + gap), yEdit + y * (size + gap), size, size) EndSub Sub KB_Init ' Keyboard | Initialization (use only ^n, ^o, ^s, ^z, ^y) shift = "" ctrl = "" keyIn = 0 keyOut = 0 GraphicsWindow.KeyDown = KB_OnKeyDown GraphicsWindow.KeyUp = KB_OnKeyUp EndSub Sub KB_InKey ' Keyboard | In key ' return c - input key If keyOut < keyIn Then keyOut = keyOut + 1 Program.Delay(1) ' workaround 29976 c = fifo[keyOut] 'fifo[keyOut] = "" EndIf EndSub Sub KB_OnKeyDown ' Keyboard | Key down event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "+" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "^" Else keyIn = keyIn + 1 fifo[keyIn] = shift + ctrl + key EndIf EndSub Sub KB_OnKeyUp ' Keyboard | Key up event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "" EndIf 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 Sub Menu_Draw GraphicsWindow.BrushColor = "#EEEEEE" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) item = "1=New;2=Open;3=Save;4=Undo;5=Redo;6=Pen Color;" nItem = Array.GetItemCount(item) add = "True" For i = 1 To nItem Menu_DrawItem() EndFor add = "False" EndSub Sub Menu_DrawItem ' param i - index number of the menu item ' param add - "True" to add menu to mouse object y = Math.Floor((menuHeight - itemSize - 10) / 2) x = (i - 1) * (itemSize + itemGap) + itemGap url = "http://www.nonkit.com/smallbasic.files/" + Text.ConvertToLowerCase(item[i]) + ".png" GraphicsWindow.DrawImage(url, x, y) If add Then param = "" param["name"] = Text.ConvertToLowerCase(item[i]) param["xLeft"] = x param["xRight"] = x + itemSize param["yTop"] = y param["yBottom"] = y + itemSize Mouse_AddObject() EndIf fs = 10 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" txt = item[i] Text_GetWidthInPx() dx = Math.Floor((itemSize - px) / 2) GraphicsWindow.DrawText(x + dx, y + itemSize, item[i]) EndSub Sub Mouse_AddObject ' Mouse | Add object to click ' param["name"] - name of the object to add ' param["xLeft"] - left x coordinate of the object ' param["xRight"] - right x coordinate of the object ' param["yTop"] - top y coordinate of the object ' param["yBottom"] - bottom y coordinate of the object ' return object ' return nObject nObject = nObject + 1 object[nObject] = param EndSub Sub Mouse_DetectObject ' param mxD, myD - mouse clicked coordinate ' return name - clicked object name if found, "" if not found ' return xRel - relative x coordinate from left x of the object ' return yRel - relative y coordinate from top y of the object name = "" ' not found For iObject = 1 To nObject obj = object[iObject] If obj["xLeft"] <= mxD And mxD <= obj["xRight"] And obj["yTop"] <= myD And myD <= obj["yBottom"] Then name = obj["name"] ' found xRel = mxD - obj["xLeft"] yRel = myD - obj["yTop"] iObject = nObject ' break EndIf EndFor EndSub Sub Mouse_Init ' Mouse | Initialize for common event handler clicked = "False" released = "False" moved = "False" object = "" nObject = 0 GraphicsWindow.MouseDown = Mouse_OnDown EndSub Sub Mouse_SetHandler ' Mouse | Set or reset common event handler ' param["down"] - "True" if set, "False" if reset ' param["move"] - "True" if set, "False" if reset ' param["up"] - - "True" if set, "False" if reset ' return clicked - "False" if set MouseDown ' return moved - "False" if set MouseMove ' return released - "False" if set MouseUp ' return dmu - which handlers are set for debug If param["up"] Then released = "False" GraphicsWindow.MouseUp = Mouse_OnUp handler["up"] = "U" ElseIf Not[param["up"]] Then GraphicsWindow.MouseUp = Mouse_DoNothing handler["up"] = "" EndIf If param["down"] Then clicked = "False" GraphicsWindow.MouseDown = Mouse_OnDown handler["down"] = "D" ElseIf Not[param["down"]] Then GraphicsWindow.MouseDown = Mouse_DoNothing handler["down"] = "" EndIf If param["move"] Then moved = "False" GraphicsWindow.MouseMove = Mouse_OnMove handler["move"] = "M" ElseIf Not[param["move"]] Then GraphicsWindow.MouseMove = Mouse_DoNothing handler["move"] = "" EndIf dmu = handler["down"] + handler["move"] + handler["up"] If debug Then smrc = " set " EndIf EndSub Sub Mouse_OnDown ' Mouse | Common event handler on mouse down ' return mxD, myD - position on mouse down mxD = Math.Floor(GraphicsWindow.MouseX) myD = Math.Floor(GraphicsWindow.MouseY) clicked = "True" released = "False" If debug Then smrc = " clicked " + mxD + "," + myD EndIf EndSub Sub Mouse_DoNothing ' Mouse | Common event handler to do nothing EndSub Sub Mouse_OnMove ' Mouse | Common event handler on mouse move ' return mxM, myM - position on mouse move mxM = Math.Floor(GraphicsWindow.MouseX) myM = Math.Floor(GraphicsWindow.MouseY) moved = "True" If debug Then smrc = " moved " + mxM + "," + myM EndIf EndSub Sub Mouse_OnTick ' Mouse | debug routine If clicked Then cmr = "C" Else cmr = "" EndIf If moved Then cmr = cmr + "M" EndIf If released Then cmr = cmr + "R" EndIf GraphicsWindow.Title = title + smrc + " " + dmu + " " + cmr EndSub Sub Mouse_OnUp ' Mouse | Common event handler on mouse up ' return mxU, myU - position on mouse up mxU = Math.Floor(GraphicsWindow.MouseX) myU = Math.Floor(GraphicsWindow.MouseY) released = "True" If debug Then smrc = " released " + mxU + "," + myU EndIf EndSub Sub Msg_Init ' Message | Initialize msgIn = 0 msgOut = 0 EndSub Sub Msg_Set ' Message | Set message to fifo ' param["cmd"] - massage command ' param["*"].. - message operands msgIn = msgIn + 1 message[msgIn] = param EndSub Sub Popup_Init TOPY = 10 ' top y LEFTX = 10 ' left x DELTAY = 36 ' delta y OPACITY = 70 POPUPCOLOR = "LightGray" CAPTIONCOLOR = "Black" TEXTCOLOR = "Black" BORDERCOLOR = "#666666" BOXCOLOR = "LightGray" SLITCOLOR = "#555555" UNDEFINED = "N/A" EndSub Sub Slider_Add ' Slider | Add slider as shapes and property ' param width ' param caption ' param min, max ' param left, top ' return slider[] - property of slider ' return iSlider - added slider index numSlider = numSlider + 1 iSlider = numSlider ' add shapes for slider GraphicsWindow.BrushColor = CAPTIONCOLOR len = Text.GetLength(caption) sldr = slider[iSlider] sldr["oCaption"] = Shapes.AddText(caption) Shapes.Move(sldr["oCaption"], left - (len * 5 + 10), top + 1) level = Math.Floor((min + max) / 2) sldr["level"] = level ' property sldr["min"] = min sldr["max"] = max GraphicsWindow.PenColor = BORDERCOLOR mag = (level - min) / (max - min) GraphicsWindow.BrushColor = SLITCOLOR sldr["oSlit"] = Shapes.AddRectangle(width, 10) GraphicsWindow.PenColor = BORDERCOLOR GraphicsWindow.BrushColor = BOXCOLOR sldr["oBox"] = Shapes.AddRectangle(10, 18) GraphicsWindow.BrushColor = CAPTIONCOLOR sldr["oLevel"] = Shapes.AddText(level) sldr["x0"] = left sldr["x1"] = left + width sldr["y0"] = top Shapes.Move(sldr["oLevel"], left + width + 5, top) ' move and zoom shapes for slider Shapes.Move(sldr["oSlit"], left, top + 4) slider[iSlider] = sldr Slider_SetLevel() EndSub Sub Slider_CallBack ' Slider | Call back ' param iSlider - changed slider CS_AdjustSlider() CS_GetColorFromSlider() CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle EndSub Sub Slider_GetLevel ' Slider | Get latest level of slider ' param iSlider ' return level sldr = slider[iSlider] level = sldr["level"] EndSub Sub Slider_GetMouseLevel ' Slider | Get mouse level of slider ' param iSlider ' return level sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] max = sldr["max"] min = sldr["min"] level = min + Math.Floor((max - min) * (mxM - x0) / (x1 - x0)) EndSub Sub Slider_WaitToRelease ' Slider | Get released point for slider moving ' param iSlider param = "down=False;move=True;up=True;" ' for slider moving / wait to release Mouse_SetHandler() While Not[released] If moved Then param = "move=False;" ' while slider moving Mouse_SetHandler() sldr = slider[iSlider] x0_ = sldr["x0"] x1_ = sldr["x1"] If mxM < x0_ Then mxM = x0_ EndIf If x1_ < mxM Then mxM = x1_ EndIf Slider_GetMouseLevel() ' get mouse level of slider Slider_SetLevel() ' set slider level and move slider box Slider_CallBack() param = "move=True;" ' for next slider moving Mouse_SetHandler() Else Program.Delay(100) EndIf EndWhile param = "move=False;up=False;" ' mouse released Mouse_SetHandler() EndSub Sub Slider_Remove ' Slider | Remove a slider ' param iSlider sldr = slider[iSlider] Shapes.Remove(sldr["oCaption"]) Shapes.Remove(sldr["oSlit"]) Shapes.Remove(sldr["oBox"]) Shapes.Remove(sldr["oLevel"]) EndSub Sub Slider_SetLevel ' Slider | Set slider level and move slider box ' param iSlider ' param level Stack.PushValue("local", width) sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] y0 = sldr["y0"] width = x1 - x0 sldr["level"] = level Shapes.SetText(sldr["oLevel"], level) ' move bar min = sldr["min"] max = sldr["max"] mag = (level - min) / (max - min) ' move box Shapes.Move(sldr["oBox"], x0 + Math.Floor(width * mag) - 5, y0) sldr["x2"] = x0 + Math.Floor(width * mag) - 5 sldr["x3"] = x0 + Math.Floor(width * mag) - 5 + 10 sldr["y2"] = y0 sldr["y3"] = y0 + 18 slider[iSlider] = sldr width = Stack.PopValue("local") EndSub Sub Text_GetWidthInPx ' param txt - text to get width in px ' param ratio - character width/height in a font ' param fs - font size (height) ' return px - width in px (pixels) len = Text.GetLength(txt) px = 0 For p = 1 To len px = px + ratio[Text.GetCharacterCode(Text.GetSubText(txt, p, 1))] EndFor px = Math.Floor(px * fs / 100) EndSub End>RFT686-2.sb< Start>RFT686-3.sb< ' 16x16 Plain PPM Icon Editor ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Version 0.5b ' Last update 2015-02-22 ' Program ID RFT686-3 ' Repository https://iconeditorsb.codeplex.com/ ' ' TODO: ' [ ] #9 Workaround for Silverlight ' [ ] #8 Add unit test feature ' [✓] #7 Add new command ' [ ] #5 Add redo command ' [ ] #4 Add undo command ' [✓] #3 Add save command ' [✓] #2 Add open command ' ' set graphics window title title = "Icon Editor 0.5b" fname = "Untitled" GraphicsWindow.Title = fname + " - " + title ' define variables as constants or functions debug = "False" If debug Then TextWindow.Title = "Debug - " + title Timer.Interval = 500 Timer.Tick = Mouse_OnTick EndIf CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) TAB = Text.GetCharacter(9) DIGIT = "0123456789" Not = "False=True;True=False;" ' width/height [%] of each character in Trebuchet MS font ratio = "32=30;48=58;49=58;50=58;51=58;52=58;53=58;54=58;55=58;56=58;57=58;97=53;98=58;99=51;100=58;101=57;102=37;103=50;104=59;105=30;106=37;107=55;108=29;109=86;110=59;111=56;112=58;113=58;114=43;115=43;116=39;117=59;118=53;119=78;120=55;121=53;122=53;65=63;66=59;67=61;68=64;69=57;70=58;71=67;72=68;73=28;74=53;75=62;76=55;77=74;78=67;79=70;80=59;81=71;82=61;83=51;84=61;85=68;86=62;87=88;88=60;89=61;90=56;" ' initialize mouse and keyboard events Mouse_Init() KB_Init() ' show menu, white icon, and edit field in graphics window pcolor = GraphicsWindow.PenColor Form() GraphicsWindow.FontSize = 12 Color_Init() Msg_Init() For y = 0 To iconHeight - 1 For x = 0 To iconWidth - 1 Icon_GetPixel() Icon_SetPixel() EndFor EndFor While "True" If clicked Then ' find clicked object - menu item or pixel of the icon Mouse_DetectObject() ' create message (command) for the object if found If name = "pen color" Then param = "cmd=color;" Msg_Set() ElseIf name = "icon" Then Icon_MouseToXY() If 0 <= x And 0 <= y Then param = "cmd=pixel;x=" + x + ";y=" + y + ";" Msg_Set() EndIf ElseIf name <> "" Then param = "cmd=" + name + ";" Msg_Set() EndIf clicked = "False" EndIf While keyOut < keyIn KB_InKey() ' create message (command) for the shortcut if found If c = "^N" Then param = "cmd=new;" Msg_Set() c = "" ElseIf c = "^O" Then param = "cmd=open;" Msg_Set() c = "" ElseIf c = "^S" Then param = "cmd=save;" Msg_Set() c = "" ElseIf c = "^Z" Then param = "cmd=undo;" Msg_Set() c = "" ElseIf c = "^Y" Then param = "cmd=redo;" Msg_Set() c = "" ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown = '" + c + "'") TextWindow.ForegroundColor = "Gray" c = "" EndIf EndWhile If msgOut < msgIn Then ' do action for the message (command) msgOut = msgOut + 1 msg = message[msgOut] If msg["cmd"] = "new" Then New() ElseIf msg["cmd"] = "open" Then Open() ElseIf msg["cmd"] = "save" Then Save() ElseIf msg["cmd"] = "color" Then color = pcolor CS_ShowPopup() pcolor = color Color_SetPenColor() ElseIf msg["cmd"] = "pixel" Then color = pcolor x = msg["x"] y = msg["y"] Icon_SetPixel() GraphicsWindow.Title = fname + " * - " + title Else GraphicsWindow.Title = msg["cmd"] + " - " + title EndIf EndIf If debug Then Debug_StateChanged() If changed Then Debug_Dump() EndIf EndIf EndWhile Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "DimGray" iconWidth = 16 '40 iconHeight = 16 '40 itemSize = 40 itemGap = 10 menuHeight = 60 size = 16 '6 gap = 2 Menu_Draw() xEdit = Math.Floor((gw - (size + gap + 1) * iconWidth) / 2) + iconWidth yEdit = Math.Floor((gh - menuHeight - (size + gap) * iconHeight) / 2) + menuHeight xIcon = Math.Floor((xEdit - iconWidth) / 2) yIcon = yEdit add = "True" Icon_Clear() add = "False" EndSub Sub New yes = "True" If Text.IsSubText(GraphicsWindow.Title, "*") Then caution = "Are you sure to clear the icon?" Dialog_YesNo() EndIf If yes Then Icon_Clear() fname = "Untitled" relPath = "" GraphicsWindow.Title = fname + " - " + title EndIf EndSub Sub Open ' open command File_Open() Parse_PPM() If match And relPath <> "" Then fname = relPath GraphicsWindow.Title = fname + " - " + title EndIf EndSub Sub Save ' save command File_GeneratePPM() File_Save() EndSub Sub Array_GetIndexOfValue ' param arry - array ' param value - value to get index ' return index - index if found or "" if not found nValue = Array.GetItemCount(arry) indices = Array.GetAllIndices(arry) index = "" For iArry = 1 To nValue If value = arry[indices[iArry]] Then index = indices[iArry] iArry = nValue + 1 ' break EndIf EndFor EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param sColor - "#rrggbb" ' return iR, iG, iB - [0, 255] sR = Text.GetSubText(sColor, 2, 2) sG = Text.GetSubText(sColor, 4, 2) sB = Text.GetSubText(sColor, 6, 2) sHex = sR Math_Hex2Dec() iR = iDec sHex = sG Math_Hex2Dec() iG = iDec sHex = sB Math_Hex2Dec() iB = iDec EndSub Sub Color_HSLtoRGB ' Color | Convert HSL to RGB ' param rHue - [0, 360) or UNDEFINED ' param rLightness - [0, 1] ' param rSaturation - [0, 1] ' return iR, iG, iB - RGB color ' return sColor - "#rrggbb" If rLightness <= 0.5 Then rN2 = rLightness * (1 + rSaturation) Else rN2 = rLightness + rSaturation - rLightness * rSaturation EndIf rN1 = 2 * rLightness - rN2 If rSaturation = 0 Then iR = Math.Round(rLightness * 255) iG = Math.Round(rLightness * 255) iB = Math.Round(rLightness * 255) Else rH = rHue + 120 Color_Value() iR = iValue rH = rHue Color_Value() iG = iValue rH = rHue - 120 Color_Value() iB = iValue EndIf sColor = GraphicsWindow.GetColorFromRGB(iR, iG, iB) EndSub Sub Color_Init Popup_Init() Color_SetPenColor() CS_InitPalette() ' initialize palette for color slider EndSub Sub Color_RGBtoHSL ' Color | Convert RGB to HSL ' param sColor - "#rrggbb" ' return rHue - [0, 360) or UNDEFINED ' return rLightness - (0, 1) ' return rSaturation - (0, 1) Color_ColorToRGB() ' rR = iR / 255 ' occurs Math.Max() bug rR = Math.Round(iR / 255 * 10000) / 10000 ' rG = iG / 255 ' occurs Math.Max() bug rG = Math.Round(iG / 255 * 10000) / 10000 ' rB = iB / 255 ' occurs Math.Max() bug rB = Math.Round(iB / 255 * 10000) / 10000 rMax = Math.Max(rR, rG) rMax = Math.Max(rMax, rB) rMin = Math.Min(rR, rG) rMin = Math.Min(rMin, rB) rLightness = (rMax + rMin) / 2 If rMax = rMin Then ' rR = rG = rB rSaturation = 0 rHue = UNDEFINED Else If rLightness <= 0.5 Then rSaturation = (rMax - rMin) / (rMax + rMin) Else rSaturation = (rMax - rMin) / (2 - rMax - rMin) EndIf rRC = (rMax - rR) / (rMax - rMin) rGC = (rMax - rG) / (rMax - rMin) rBC = (rMax - rB) / (rMax - rMin) If rR = rMax Then ' between Yellow and Magenta rHue = rBC - rGC ElseIf rG = rMax Then ' between Cyan and Yellow rHue = 2 + rRC - rBC ElseIf rB = rMax Then ' between Magenta and Cyan rHue = 4 + rGC - rRC Else TextWindow.WriteLine("Error:") TextWindow.WriteLine("rMax=" + rMax) TextWindow.WriteLine("rR=" + rR + ",sR=" + sR) TextWindow.WriteLine("rG=" + rG + ",sG=" + sG) TextWindow.WriteLine("rB=" + rB + ",sB=" + sB) EndIf rHue = rHue * 60 If rHue < 0 Then rHue = rHue + 360 EndIf EndIf EndSub Sub Color_Value ' Color | Function value ' param rN1, rN2 ' param rH - [-120, 480) ' return iValue - 0..255 If rH >= 360 Then rH = rH - 360 EndIF If rH < 0 Then rH = rH + 360 EndIF If rH < 60 Then rV = rN1 + (rN2 - rN1) * rH / 60 ElseIf rH < 180 Then rV = rN2 ElseIf rH < 240 Then rV = rN1 + (rN2 - rN1) * (240 - rH) / 60 Else rV = rN1 EndIf iValue = Math.Round(rV * 255) EndSub Sub CS_AddColorToPalette ' Color Selector | Add color to palette ' param color - color to set ' param maxPalette ' param nPalette ' param palette ' param tPalette - target palette Stack.PushValue("local", i) For i = 1 To nPalette pltt = palette[i] If color = pltt["color"] Then Goto csactp_not_new_color EndIf EndFor pltt = palette[tPalette] pltt["color"] = color palette[tPalette] = pltt If nPalette < maxPalette Then nPalette = nPalette + 1 EndIf tPalette = tPalette + 1 If maxPalette < tPalette Then tPalette = 1 EndIf csactp_not_new_color: i = Stack.PopValue("local") EndSub Sub CS_AdjustSlider ' Color Selector | Adjust slider ' param iSlider - moved slider Stack.PushValue("local", iSlider) If iSlider = iHue Or iSlider = iLightness Or iSlider = iSaturation Then If iSlider = iHue Then Slider_GetLevel() rHue = level ElseIf iSlider = iLightness Then Slider_GetLevel() rLightness = level / 100 Else Slider_GetLevel() rSaturation = level / 100 EndIf Color_HSLtoRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() Else CS_GetColorFromSlider() sColor = GraphicsWindow.GetColorFromRGB(red, green, blue) Color_RGBtoHSL() If rHue = UNDEFINED Then rHue = 0 EndIf iSlider = iHue level = Math.Floor(rHue) Slider_SetLevel() iSlider = iSaturation level = Math.Floor(rSaturation * 100) Slider_SetLevel() iSlider = iLightness level = Math.Floor(rLightness * 100) Slider_SetLevel() EndIf iSlider = Stack.PopValue("local") EndSub Sub CS_DoObject ' Color Selector | Do object ' param - obj While obj <> "" CS_DoSlider() If obj <> "" Then CS_DoPalette() EndIf EndWhile EndSub Sub CS_DoPalette ' Color Selector | Do palette ' param obj - clicked object If Text.StartsWith(obj, "palette") Then iPalette = Text.GetSubTextToEnd(obj, 8) pltt = palette[iPalette] color = pltt["color"] CS_SetColorToSlider() ' set color to slider CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DoSlider ' Color Selector | Do slider ' param obj - clicked object ' param iSlider - index of slider If Text.StartsWith(obj, "slider") Then Slider_WaitToRelease() obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DrawColorRect ' Color Selector | Draw color rectangle ' param color - color of rectangle ' param x, y, width, height - position and size of rectangle ' return oRect - rectangle object GraphicsWindow.BrushColor = color GraphicsWindow.PenColor = BORDERCOLOR If oRect <> "" Then Shapes.Remove(oRect) EndIf oRect = Shapes.AddRectangle(width, height) Shapes.Move(oRect, x, y) EndSub Sub CS_DrawPalette ' Color Selector | Draw palette ' param palette[] - color palette ' param nPalette - number of color in palette ' param x, y, width, height - position and size of rectangle ' return oPalette[] - palette object array Stack.PushValue("local", i) GraphicsWindow.PenColor = BORDERCOLOR For i = 1 To nPalette pltt = palette[i] GraphicsWindow.BrushColor = pltt["color"] pltt["oCell"] = Shapes.AddRectangle(width, height) dx = Math.Remainder((i - 1), (maxPalette / 2)) * (width + 4) dy = Math.Floor((i - 1) / (maxPalette / 2)) * (height + 4) Shapes.Move(pltt["oCell"], x + dx, y + dy) pltt["x"] = x + dx pltt["y"] = y + dy pltt["width"] = width pltt["height"] = height palette[i] = pltt EndFor i = Stack.PopValue("local") EndSub Sub CS_GetColorFromSlider ' Color Selector | get color from slider ' return color Stack.PushValue("local", iSlider) iSlider = iRed ' slider index Slider_GetLevel() red = level iSlider = iGreen ' slider index Slider_GetLevel() green = level iSlider = iBlue ' slider index Slider_GetLevel() blue = level color = GraphicsWindow.GetColorFromRGB(red, green, blue) iSlider = Stack.PopValue("local") EndSub Sub CS_Init ' Color Selector | Initialize sliders width = 256 min = 0 max = 255 left = 190 ' add red slider top = TOPY caption = "R" Slider_Add() iRed = iSlider ' index of slider ' add green slider top = top + DELTAY caption = "G" Slider_Add() iGreen = iSlider ' index of slider ' add blue slider top = top + DELTAY caption = "B" Slider_Add() iBlue = iSlider ' index of slider ' add hue slider width = 360 top = top + DELTAY max = 360 caption = "H" Slider_Add() iHue = iSlider ' index of slider ' add saturation slider width = 100 top = top + DELTAY max = 100 caption = "S" Slider_Add() iSaturation = iSlider ' index of slider ' add lightness slider width = 100 top = top + DELTAY max = 100 caption = "L" Slider_Add() iLightness = iSlider ' index of slider ' draw color rectangle CS_GetColorFromSlider() CS_ShowNewColor() x = LEFTX y = TOPY + DELTAY * 4 width = 100 height = 100 CS_DrawColorRect() ' add text box GraphicsWindow.BrushColor = CAPTIONCOLOR top = y + height + 4 oNewColor = Shapes.AddText("") Shapes.Move(oNewColor, LEFTX, top) EndSub Sub CS_DumpSlider ' Color Selector | Dump slider for debug For i = 1 To numSlider TextWindow.WriteLine("slider" + i) TextWindow.WriteLine(slider[i]) EndFor EndSub Sub CS_InitPalette ' Color Selector | Initialize palette ' This subroutine should be called before CS_ShowPopup(). pcolor = GraphicsWindow.PenColor If Text.GetLength(pcolor) = 9 Then ' for Silverlight pcolor = "#" + Text.GetSubText(pcolor, 4, 6) EndIf maxPalette = 24 ' max cell number of palette nPalette = 1 ' number of palette in use tPalette = 2 ' index of update target cell pltt = palette[1] pltt["color"] = pcolor palette[1] = pltt EndSub Sub CS_RemovePalette ' Color Selector | Remove palette ' param nPalette - number of color in palette ' return oPalette[] - palette object array Stack.PushValue("local", i) For i = 1 To nPalette oPalette = "Palette" + i pltt = palette[i] Shapes.Remove(pltt["oCell"]) EndFor i = Stack.PopValue("local") EndSub Sub CS_RemoveSliders ' Color Selector | Remove sliders For iSlider = 1 To numSlider Slider_Remove() EndFor numSlider = 0 EndSub Sub CS_SearchClickedObject ' Color Selector | Check slider clicked ' param mxD, myD - clicked point ' return obj - clicked slider or palette ' return iSlider - index if obj is slider ' return iPalette - index if obj is palette Stack.PushValue("local", i) For iSlider = 1 To numSlider obj = "slider" + iSlider sldr = slider[iSlider] x2 = sldr["x2"] y2 = sldr["y2"] x3 = sldr["x3"] y3 = sldr["y3"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor For iPalette = 1 To nPalette obj = "palette" + iPalette pltt = palette[iPalette] x2 = pltt["x"] y2 = pltt["y"] x3 = pltt["x"] + pltt["width"] y3 = pltt["y"] + pltt["height"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor obj = "" scco_obj_found: i = Stack.PopValue("local") EndSub Sub CS_SetColorToSlider ' Color Selector | Set color to slider ' param color Stack.PushValue("local", iSlider) sColor = color Color_ColorToRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() CS_AdjustSlider() iSlider = Stack.PopValue("local") EndSub Sub CS_ShowNewColor ' Color Selector | Show new color ' param oColor ' param color Shapes.SetText(oNewColor, color) EndSub Sub CS_ShowPopup ' Color Selector | Show popup ' param color - current color ' return color - new color ' define constant Stack.PushValue("local", cont) fs = 12 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = "Black" colorInit = color ' initial color GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = POPUPCOLOR GraphicsWindow.BrushColor = POPUPCOLOR oPopup = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oPopup, 64) Shapes.Move(oPopup, LEFTX - 10, TOPY - 10) GraphicsWindow.BrushColor = CAPTIONCOLOR oOK = Controls.AddButton("OK", gw - 100, gh - 34) oCancel = Controls.AddButton("Cancel", gw - 60, gh - 34) Controls.ButtonClicked = CS_OnButtonClicked CS_Init() Stack.PushValue("local", y) y = TOPY color = colorInit CS_DrawColorRect() ' original color oRectCurrent = oRect oRect = "" ' keep current color If Text.GetLength(color) = 9 Then ' for Silverlight color = "#" + Text.GetSubText(color, 4, 6) EndIf GraphicsWindow.BrushColor = CAPTIONCOLOR oColor = Shapes.AddText(colorInit) Shapes.Move(oColor, x, y + height + 2) y = Stack.PopValue("local") CS_SetColorToSlider() CS_DrawColorRect() ' draw new color rectangle CS_ShowNewColor() ' show new color name Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", width) Stack.PushValue("local", height) x = x + width + 30 y = TOPY + height * 2 + 24 width = 30 height = 30 CS_DrawPalette() height = Stack.PopValue("local") width = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") cont = "True" ' continue param = "down=True;move=False;up=False;" ' wait click Mouse_SetHandler() While cont If clicked Then CS_SearchClickedObject() CS_DoObject() clicked = "False" Else Program.Delay(100) EndIf EndWhile If cancel Then color = colorInit Else CS_AddColorToPalette() EndIf CS_RemovePalette() CS_RemoveSliders() Shapes.Remove(oColor) Shapes.Remove(oNewColor) Shapes.Remove(oRectCurrent) Shapes.Remove(oRect) Controls.Remove(oOK) Controls.Remove(oCancel) Shapes.Remove(oPopup) cont = Stack.PopValue("local") EndSub Sub CS_OnButtonClicked ' Color Selector | Event handler on button clicked cont = "False" If Controls.LastClickedButton = oCancel Then cancel = "True" Else cancel = "False" EndIf EndSub Sub Color_SetPenColor ' param pcolor GraphicsWindow.BrushColor = pcolor padding = 4 arry = item value = "Pen Color" Array_GetIndexOfValue() y = Math.Floor((menuHeight - itemSize - 10) / 2) + padding x = (index - 1) * (itemSize + itemGap) + itemGap + padding GraphicsWindow.FillRectangle(x, y, itemSize - 2 * padding, itemSize - 2 * padding) EndSub Sub Debug_StateChanged ' Debug | Check state changed ' return changed - "True" if state changed changed = "False" If keyIn <> lastKeyIn Then lastKeyIn = keyIn changed = "True" EndIf If keyOut <> lastKeyOut Then lastKeyOut = keyOut changed = "True" EndIf If msgIn <> lastMsgIn Then lastMsgIn = msgIn changed = "True" EndIf If msgOut <> lastMsgOut Then lastMsgOut = msgOut changed = "True" EndIf EndSub Sub Debug_Dump ' Debug | Dump state TextWindow.WriteLine("fifo = " + fifo) TextWindow.WriteLine("keyIn = " + keyIn) TextWindow.WriteLine("keyOut = " + keyOut) TextWindow.WriteLine("message = " + message) TextWindow.WriteLine("msgIn = " + msgIn) TextWindow.WriteLine("msgOut = " + msgOut) EndSub Sub Dialog_YesNo ' param caution - message ' return yes - if [Yes] pushed yes = "True" GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = POPUPCOLOR oMsgBox = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oMsgBox, 64) GraphicsWindow.BrushColor = CAPTIONCOLOR oCaution = Shapes.AddText(caution) yCaution = (gh - 80) / 2 Shapes.Move(oCaution, 150, yCaution) oYes = Controls.AddButton("Yes", 360, yCaution + 50) oNo = Controls.AddButton("No", 400, yCaution + 50) cont = "True" ' continue Controls.ButtonClicked = File_OnButtonClicked While cont Program.Delay(500) EndWhile If Controls.LastClickedButton = oNo Then yes = "False" EndIf Controls.Remove(oNo) Controls.Remove(oYes) Shapes.Remove(oCaution) Shapes.Remove(oMsgBox) EndSub Sub File_GetAbsPath ' param curDir - current directory ' param relPath - relative path ' return absPath - absolute path If Text.IsSubText(relPath, ":") Or Text.StartsWith(relPath, "\") Or relPath = "" Then absPath = relPath Else absPath = curDir + "\" + relPath File_RemoveDots() EndIf EndSub Sub File_RemoveDots ' param absPath - with dots ' return absPath - without dots path = absPath folder = "" n = 0 While Text.IsSubText(path, "\") n = n + 1 p = Text.GetIndexOf(path, "\") folder[n] = Text.GetSubText(path, 1, p - 1) path = Text.GetSubTextToEnd(path, p + 1) EndWhile If path <> "" Then n = n + 1 folder[n] = path EndIf While Array.ContainsValue(folder, ".") Or Array.ContainsValue(folder, "..") For i = 1 To n If folder[i] = "." Then File_RemoveEntry() i = n + 1 ' break ElseIf folder[i] = ".." Then i = i - 1 File_RemoveEntry() File_RemoveEntry() i = n + 1 ' break EndIf EndFor EndWhile absPath = folder[1] For i = 2 To n absPath = absPath + "\" + folder[i] EndFor EndSub Sub File_RemoveEntry ' param folder - entry array ' param i - entry index ' return folder - updated entry array ' return n For _i = i To n - 1 folder[_i] = folder[_i + 1] EndFor folder[n] = "" n = n - 1 EndSub Sub File_CloseDialog ' File | Close dialog for Open/Save ' param oPopup ' param oCaption ' param oFilename ' param oText ' param oMsg ' param oCancel Controls.Remove(oCancel) Controls.Remove(oMsg) Controls.Remove(oText) Controls.Remove(oFilename) Controls.Remove(oCaption) Controls.Remove(oPopup) EndSub Sub File_GeneratePPM ' File | Generate PPM in buf ' return buf - buffer buf = "P3" + CR + LF buf = buf + "16 16" + CR + LF buf = buf + "255" + CR + LF nRGB = 0 For y = 0 To iconHeight - 1 nCol = 0 For x = 0 To iconWidth - 1 Icon_GetPixel() sColor = color Color_ColorToRGB() len = Text.GetLength(iR) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iR + " " len = Text.GetLength(iG) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iG + " " len = Text.GetLength(iB) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iB If (Math.Remainder(nCol, 5) = 4) Or (nCol = iconWidth - 1) Then buf = buf + CR + LF Else buf = buf + " " EndIf nCol = nCol + 1 EndFor EndFor EndSub Sub File_GetBasename ' FIle | Get basename from filename ' param filename ' return basename ' return ext - extension pFilename = 1 While Text.IsSubText(Text.GetSubTextToEnd(filename, pFilename), "\") iBackslash = Text.GetIndexOf(Text.GetSubTextToEnd(filename, pFilename), "\") pFilename = pFilename + iBackslash EndWhile iDot = Text.GetIndexOf(Text.GetSubTextToEnd(filename, pFilename), ".") If 0 < iDot Then basename = Text.GetSubText(filename, pFilename, iDot - 1) ext = Text.GetSubTextToEnd(filename, pFilename + iDot) Else basename = Text.GetSubTextToEnd(filename, pFilename) ext = "" EndIf EndSub Sub File_Open ' File | Show input code to open ' return buf ' return filename Stack.PushValue("local", cont) relPath = "" filename = "" File_OpenDialog() oOpen = Controls.AddButton("Open", 486, gh - 34) Shapes.SetText(oMsg, "You can also click above, push Ctrl+V to paste from clipboard") Controls.ButtonClicked = File_OnButtonClicked Controls.TextTyped = File_OnTextTyped subname = "Shapes_Init" typed = "False" done = "False" While Not[done] cont = "True" ' continue While cont If typed Then curDir = Program.Directory relPath = Controls.GetTextBoxText(oFilename) File_GetAbsPath() filename = absPath buf = "" ' The following line could be harmful and has been automatically commented. ' buf = File.ReadContents(filename) Controls.SetTextBoxText(oText, buf) typed = "False" Else Program.Delay(200) EndIf EndWhile If Controls.LastClickedButton = oOpen Then buf = Controls.GetTextBoxText(oText) If buf <> "" Then done = "True" EndIf Else buf = "" relPath = "" filename = "" done = "True" EndIf EndWhile Controls.Remove(oOpen) File_CloseDialog() cont = Stack.PopValue("local") EndSub Sub File_OpenDialog ' File | Open dialog and common parts for Open/Save ' param relPath ' return oPopup ' return oCaption ' return oFilename ' return oText ' return oMsg ' return oCancel GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = POPUPCOLOR oPopup = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oPopup, 64) Shapes.Move(oPopup, LEFTX - 10, TOPY - 10) GraphicsWindow.BrushColor = CAPTIONCOLOR oCaption = Shapes.AddText("Filename") Shapes.Move(oCaption, LEFTX, TOPY + 4) GraphicsWindow.BrushColor = TEXTCOLOR oFilename = Controls.AddTextBox(LEFTX + 80, TOPY) Shapes.SetOpacity(oFilename, OPACITY) Controls.SetSize(oFilename, 300, 24) Controls.SetTextBoxText(oFilename, relPath) oText = Controls.AddMultiLineTextBox(LEFTX, TOPY + 30) Controls.SetSize(oText, gw - 20, gh - 84) Shapes.SetOpacity(oText, OPACITY) GraphicsWindow.BrushColor = CAPTIONCOLOR oMsg = Shapes.AddText("") Shapes.Move(oMsg, LEFTX, gh - 28) GraphicsWindow.BrushColor = TEXTCOLOR oCancel = Controls.AddButton("Cancel", 535, gh - 34) EndSub Sub File_Save ' File | Show output code to save ' param buf - program buffer ' param filename Stack.PushValue("local", cont) File_OpenDialog() Controls.SetTextBoxText(oText, buf) oSave = Controls.AddButton("Save", 488, gh - 34) Shapes.SetText(oMsg, "You can also click above, push Ctrl+A, Ctrl+C to copy to clipboard") Controls.ButtonClicked = File_OnButtonClicked Controls.TextTyped = File_OnTextTyped done = "False" While Not[done] cont = "True" ' continue While cont If typed Then curDir = Program.Directory relPath = Controls.GetTextBoxText(oFilename) File_GetAbsPath() filename = absPath File_GetBasename() lowerExt = Text.ConvertToLowerCase(ext) typed = "False" Else Program.Delay(500) EndIf EndWhile buf = Controls.GetTextBoxText(oText) If (Controls.LastClickedButton = oSave) And (filename <> "") Then dummy = "" ' for Silverlight ' The following line could be harmful and has been automatically commented. ' dummy = File.ReadContents(filename) yes = "True" If dummy <> "" Then caution = "'" + basename + "." + ext + "' already exists." + CR + LF + "Do you want to replace it?" Dialog_YesNo() EndIf If yes Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(filename, buf) done = "True" ' saved EndIf ElseIf Controls.LastClickedButton = oCancel Then done = "True" ' canceled EndIf EndWhile Controls.Remove(oSave) File_CloseDialog() cont = Stack.PopValue("local") EndSub Sub File_OnButtonClicked ' File | Button event handler cont = "False" EndSub Sub File_OnTextTyped ' File | Textbox event handler If Controls.LastTypedTextBox = oFilename Then typed = "True" EndIf EndSub Sub Icon_Clear ' param add - "True" to add menu to mouse object GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(xIcon, yIcon, iconWidth, iconHeight) For row = 0 To iconHeight - 1 y = yEdit + row * (size + gap) For col = 0 To iconWidth - 1 x = xEdit + col * (size + gap) GraphicsWindow.FillRectangle(x, y, size, size) EndFor EndFor If add Then param = "" param["name"] = "icon" param["xLeft"] = xEdit param["xRight"] = xEdit + iconWidth * (size + gap) - gap param["yTop"] = yEdit param["yBottom"] = yEdit + iconHeight * (size + gap) - gap Mouse_AddObject() EndIf EndSub Sub Icon_GetPixel ' param x, y - position in icon ' return color - got color color = GraphicsWindow.GetPixel(xIcon + x, yIcon + y) EndSub Sub Icon_MouseToXY ' param xRel, yRel - position in icon edit field ' return x, y - pixel of the icon or (-1, -1) if on the grid x = Math.Floor(xRel / (size + gap)) y = Math.Floor(yRel / (size + gap)) If (iconWidth - 1 < x) Or (iconHeight - 1 < y) Then x = -1 y = -1 Else xMod = Math.Remainder(xRel, (size + gap)) yMod = Math.Remainder(yRel, (size + gap)) If (size - 1 < xMod) Or (size - 1 < yMod) Then x = -1 y = -1 EndIf EndIf EndSub Sub Icon_SetPixel ' param x, y - position in icon ' param color - set color GraphicsWindow.SetPixel(xIcon + x, yIcon + y, color) GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(xEdit + x * (size + gap), yEdit + y * (size + gap), size, size) EndSub Sub KB_Init ' Keyboard | Initialization (use only ^n, ^o, ^s, ^z, ^y) shift = "" ctrl = "" keyIn = 0 keyOut = 0 GraphicsWindow.KeyDown = KB_OnKeyDown GraphicsWindow.KeyUp = KB_OnKeyUp EndSub Sub KB_InKey ' Keyboard | In key ' return c - input key If keyOut < keyIn Then keyOut = keyOut + 1 Program.Delay(1) ' workaround 29976 c = fifo[keyOut] 'fifo[keyOut] = "" EndIf EndSub Sub KB_OnKeyDown ' Keyboard | Key down event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "+" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "^" Else keyIn = keyIn + 1 fifo[keyIn] = shift + ctrl + key EndIf EndSub Sub KB_OnKeyUp ' Keyboard | Key up event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "" EndIf 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 Sub Menu_Draw GraphicsWindow.BrushColor = "#EEEEEE" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) item = "1=New;2=Open;3=Save;4=Undo;5=Redo;6=Pen Color;" nItem = Array.GetItemCount(item) add = "True" For i = 1 To nItem Menu_DrawItem() EndFor add = "False" EndSub Sub Menu_DrawItem ' param i - index number of the menu item ' param add - "True" to add menu to mouse object y = Math.Floor((menuHeight - itemSize - 10) / 2) x = (i - 1) * (itemSize + itemGap) + itemGap url = "http://www.nonkit.com/smallbasic.files/" + Text.ConvertToLowerCase(item[i]) + ".png" GraphicsWindow.DrawImage(url, x, y) If add Then param = "" param["name"] = Text.ConvertToLowerCase(item[i]) param["xLeft"] = x param["xRight"] = x + itemSize param["yTop"] = y param["yBottom"] = y + itemSize Mouse_AddObject() EndIf fs = 10 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" txt = item[i] Text_GetWidthInPx() dx = Math.Floor((itemSize - px) / 2) GraphicsWindow.DrawText(x + dx, y + itemSize, item[i]) EndSub Sub Mouse_AddObject ' Mouse | Add object to click ' param["name"] - name of the object to add ' param["xLeft"] - left x coordinate of the object ' param["xRight"] - right x coordinate of the object ' param["yTop"] - top y coordinate of the object ' param["yBottom"] - bottom y coordinate of the object ' return object ' return nObject nObject = nObject + 1 object[nObject] = param EndSub Sub Mouse_DetectObject ' param mxD, myD - mouse clicked coordinate ' return name - clicked object name if found, "" if not found ' return xRel - relative x coordinate from left x of the object ' return yRel - relative y coordinate from top y of the object name = "" ' not found For iObject = 1 To nObject obj = object[iObject] If obj["xLeft"] <= mxD And mxD <= obj["xRight"] And obj["yTop"] <= myD And myD <= obj["yBottom"] Then name = obj["name"] ' found xRel = mxD - obj["xLeft"] yRel = myD - obj["yTop"] iObject = nObject ' break EndIf EndFor EndSub Sub Mouse_Init ' Mouse | Initialize for common event handler clicked = "False" released = "False" moved = "False" object = "" nObject = 0 GraphicsWindow.MouseDown = Mouse_OnDown EndSub Sub Mouse_SetHandler ' Mouse | Set or reset common event handler ' param["down"] - "True" if set, "False" if reset ' param["move"] - "True" if set, "False" if reset ' param["up"] - - "True" if set, "False" if reset ' return clicked - "False" if set MouseDown ' return moved - "False" if set MouseMove ' return released - "False" if set MouseUp ' return dmu - which handlers are set for debug If param["up"] Then released = "False" GraphicsWindow.MouseUp = Mouse_OnUp handler["up"] = "U" ElseIf Not[param["up"]] Then GraphicsWindow.MouseUp = Mouse_DoNothing handler["up"] = "" EndIf If param["down"] Then clicked = "False" GraphicsWindow.MouseDown = Mouse_OnDown handler["down"] = "D" ElseIf Not[param["down"]] Then GraphicsWindow.MouseDown = Mouse_DoNothing handler["down"] = "" EndIf If param["move"] Then moved = "False" GraphicsWindow.MouseMove = Mouse_OnMove handler["move"] = "M" ElseIf Not[param["move"]] Then GraphicsWindow.MouseMove = Mouse_DoNothing handler["move"] = "" EndIf dmu = handler["down"] + handler["move"] + handler["up"] If debug Then smrc = " set " EndIf EndSub Sub Mouse_OnDown ' Mouse | Common event handler on mouse down ' return mxD, myD - position on mouse down mxD = Math.Floor(GraphicsWindow.MouseX) myD = Math.Floor(GraphicsWindow.MouseY) clicked = "True" released = "False" If debug Then smrc = " clicked " + mxD + "," + myD EndIf EndSub Sub Mouse_DoNothing ' Mouse | Common event handler to do nothing EndSub Sub Mouse_OnMove ' Mouse | Common event handler on mouse move ' return mxM, myM - position on mouse move mxM = Math.Floor(GraphicsWindow.MouseX) myM = Math.Floor(GraphicsWindow.MouseY) moved = "True" If debug Then smrc = " moved " + mxM + "," + myM EndIf EndSub Sub Mouse_OnTick ' Mouse | debug routine If clicked Then cmr = "C" Else cmr = "" EndIf If moved Then cmr = cmr + "M" EndIf If released Then cmr = cmr + "R" EndIf GraphicsWindow.Title = title + smrc + " " + dmu + " " + cmr EndSub Sub Mouse_OnUp ' Mouse | Common event handler on mouse up ' return mxU, myU - position on mouse up mxU = Math.Floor(GraphicsWindow.MouseX) myU = Math.Floor(GraphicsWindow.MouseY) released = "True" If debug Then smrc = " released " + mxU + "," + myU EndIf EndSub Sub Msg_Init ' Message | Initialize msgIn = 0 msgOut = 0 EndSub Sub Msg_Set ' Message | Set message to fifo ' param["cmd"] - massage command ' param["*"].. - message operands msgIn = msgIn + 1 message[msgIn] = param EndSub Sub Parse_Decimal ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return dec - decimal number ' return match - "True" if match match = "False" isDigit = "True" dec = 0 While isDigit char = Text.GetSubText(buf, p, 1) If Text.IsSubText(DIGIT, char) Then dec = dec * 10 + char p = p + 1 match = "True" Else isDigit = "False" EndIf EndWhile EndSub Sub Parse_MagicNumber ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return match - "True" if match If Text.StartsWith(Text.GetSubTextToEnd(buf, p), "P3") Then p = p + 2 match = "True" Else match = "False" EndIf EndSub Sub Parse_PPM ' param buf - buffer to parse ' return p - updated pointer ' return match - "True" if match p = 1 Parse_MagicNumber() If match Then Parse_WhiteSpace() EndIf If match Then Parse_Decimal() If match Then If dec <> iconWidth Then match = "False" EndIf EndIf EndIf If match Then Parse_WhiteSpace() EndIf If match Then Parse_Decimal() If match Then If dec <> iconHeight Then match = "False" EndIf EndIf EndIf If match Then Parse_WhiteSpace() EndIf If match Then Parse_Decimal() If match Then If 0 < dec And dec < 65536 Then maxVal = dec Else match = "False" EndIf EndIf EndIf If match Then Icon_Clear() For y = 0 To iconHeight - 1 For x = 0 To iconWidth - 1 Parse_WhiteSpace() Parse_Decimal() If match Then iR = dec Else Goto PPPM_Error EndIf Parse_WhiteSpace() Parse_Decimal() If match Then iG = dec Else Goto PPPM_Error EndIf Parse_WhiteSpace() Parse_Decimal() If match Then iB = dec Else Goto PPPM_Error EndIf color = GraphicsWindow.GetColorFromRGB(iR, iG, iB) Icon_SetPixel() EndFor EndFor EndIf PPPM_Error: EndSub Sub Parse_WhiteSpace ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return match - "True" isSpace = "True" While isSpace char = Text.GetSubText(buf, p, 1) If Text.IsSubText(" " + TAB + CR + LF, char) Then p = p + 1 Else isSpace = "False" EndIf EndWhile match = "True" EndSub Sub Popup_Init TOPY = 10 ' top y LEFTX = 10 ' left x DELTAY = 36 ' delta y OPACITY = 70 POPUPCOLOR = "LightGray" CAPTIONCOLOR = "Black" TEXTCOLOR = "Black" BORDERCOLOR = "#666666" BOXCOLOR = "LightGray" SLITCOLOR = "#555555" UNDEFINED = "N/A" EndSub Sub Slider_Add ' Slider | Add slider as shapes and property ' param width ' param caption ' param min, max ' param left, top ' return slider[] - property of slider ' return iSlider - added slider index numSlider = numSlider + 1 iSlider = numSlider ' add shapes for slider GraphicsWindow.BrushColor = CAPTIONCOLOR len = Text.GetLength(caption) sldr = slider[iSlider] sldr["oCaption"] = Shapes.AddText(caption) Shapes.Move(sldr["oCaption"], left - (len * 5 + 10), top + 1) level = Math.Floor((min + max) / 2) sldr["level"] = level ' property sldr["min"] = min sldr["max"] = max GraphicsWindow.PenColor = BORDERCOLOR mag = (level - min) / (max - min) GraphicsWindow.BrushColor = SLITCOLOR sldr["oSlit"] = Shapes.AddRectangle(width, 10) GraphicsWindow.PenColor = BORDERCOLOR GraphicsWindow.BrushColor = BOXCOLOR sldr["oBox"] = Shapes.AddRectangle(10, 18) GraphicsWindow.BrushColor = CAPTIONCOLOR sldr["oLevel"] = Shapes.AddText(level) sldr["x0"] = left sldr["x1"] = left + width sldr["y0"] = top Shapes.Move(sldr["oLevel"], left + width + 5, top) ' move and zoom shapes for slider Shapes.Move(sldr["oSlit"], left, top + 4) slider[iSlider] = sldr Slider_SetLevel() EndSub Sub Slider_CallBack ' Slider | Call back ' param iSlider - changed slider CS_AdjustSlider() CS_GetColorFromSlider() CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle EndSub Sub Slider_GetLevel ' Slider | Get latest level of slider ' param iSlider ' return level sldr = slider[iSlider] level = sldr["level"] EndSub Sub Slider_GetMouseLevel ' Slider | Get mouse level of slider ' param iSlider ' return level sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] max = sldr["max"] min = sldr["min"] level = min + Math.Floor((max - min) * (mxM - x0) / (x1 - x0)) EndSub Sub Slider_WaitToRelease ' Slider | Get released point for slider moving ' param iSlider param = "down=False;move=True;up=True;" ' for slider moving / wait to release Mouse_SetHandler() While Not[released] If moved Then param = "move=False;" ' while slider moving Mouse_SetHandler() sldr = slider[iSlider] x0_ = sldr["x0"] x1_ = sldr["x1"] If mxM < x0_ Then mxM = x0_ EndIf If x1_ < mxM Then mxM = x1_ EndIf Slider_GetMouseLevel() ' get mouse level of slider Slider_SetLevel() ' set slider level and move slider box Slider_CallBack() param = "move=True;" ' for next slider moving Mouse_SetHandler() Else Program.Delay(100) EndIf EndWhile param = "move=False;up=False;" ' mouse released Mouse_SetHandler() EndSub Sub Slider_Remove ' Slider | Remove a slider ' param iSlider sldr = slider[iSlider] Shapes.Remove(sldr["oCaption"]) Shapes.Remove(sldr["oSlit"]) Shapes.Remove(sldr["oBox"]) Shapes.Remove(sldr["oLevel"]) EndSub Sub Slider_SetLevel ' Slider | Set slider level and move slider box ' param iSlider ' param level Stack.PushValue("local", width) sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] y0 = sldr["y0"] width = x1 - x0 sldr["level"] = level Shapes.SetText(sldr["oLevel"], level) ' move bar min = sldr["min"] max = sldr["max"] mag = (level - min) / (max - min) ' move box Shapes.Move(sldr["oBox"], x0 + Math.Floor(width * mag) - 5, y0) sldr["x2"] = x0 + Math.Floor(width * mag) - 5 sldr["x3"] = x0 + Math.Floor(width * mag) - 5 + 10 sldr["y2"] = y0 sldr["y3"] = y0 + 18 slider[iSlider] = sldr width = Stack.PopValue("local") EndSub Sub Text_GetWidthInPx ' param txt - text to get width in px ' param ratio - character width/height in a font ' param fs - font size (height) ' return px - width in px (pixels) len = Text.GetLength(txt) px = 0 For p = 1 To len px = px + ratio[Text.GetCharacterCode(Text.GetSubText(txt, p, 1))] EndFor px = Math.Floor(px * fs / 100) EndSub End>RFT686-3.sb< Start>RFT686-4.sb< ' 16x16 Plain PPM Icon Editor ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Version 0.6b ' Last update 2015-02-23 ' Program ID RFT686-4 ' Repository https://iconeditorsb.codeplex.com/ ' ' TODO: ' [✓] #12 Support maxval in PPM ' [✓] #11 Support comment in PPM ' [ ] #10 Support other image format in Open ' [ ] #9 Workaround for Silverlight ' [ ] #8 Add unit test feature ' [✓] #5 Add redo command ' [✓] #4 Add undo command ' ' set graphics window title title = "Icon Editor 0.6b" fname = "Untitled" GraphicsWindow.Title = fname + " - " + title ' define variables as constants or functions debug = "False" If debug Then TextWindow.Title = "Debug - " + title Timer.Interval = 500 Timer.Tick = Mouse_OnTick EndIf CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) TAB = Text.GetCharacter(9) DIGIT = "0123456789" Not = "False=True;True=False;" ' width/height [%] of each character in Trebuchet MS font ratio = "32=30;48=58;49=58;50=58;51=58;52=58;53=58;54=58;55=58;56=58;" ratio = ratio + "57=58;65=63;66=59;67=61;68=64;69=57;70=58;71=67;" ratio = ratio + "72=68;73=28;74=53;75=62;76=55;77=74;78=67;79=70;" ratio = ratio + "80=59;81=71;82=61;83=51;84=61;85=68;86=62;87=88;" ratio = ratio + "88=60;89=61;90=56;97=53;98=58;99=51;100=58;101=57;" ratio = ratio + "102=37;103=50;104=59;105=30;106=37;107=55;108=29;" ratio = ratio + "109=86;110=59;111=56;112=58;113=58;114=43;115=43;" ratio = ratio + "116=39;117=59;118=53;119=78;120=55;121=53;122=53;" ' initialize mouse and keyboard events Mouse_Init() KB_Init() ' show menu, white icon, and edit field in graphics window pcolor = GraphicsWindow.PenColor Form() GraphicsWindow.FontSize = 12 Color_Init() Msg_Init() Macro_Init() While "True" If clicked Then ' find clicked object - menu item or pixel of the icon Mouse_DetectObject() ' create message (command) for the object if found If name = "pen color" Then param = "cmd=color;" Msg_Set() ElseIf name = "icon" Then Icon_MouseToXY() If 0 <= x And 0 <= y Then param = "cmd=pixel;x=" + x + ";y=" + y + ";" Msg_Set() EndIf ElseIf name <> "" Then param = "cmd=" + name + ";" Msg_Set() EndIf clicked = "False" EndIf While keyOut < keyIn KB_InKey() ' create message (command) for the shortcut if found If c = "^N" Then param = "cmd=new;" Msg_Set() c = "" ElseIf c = "^O" Then param = "cmd=open;" Msg_Set() c = "" ElseIf c = "^S" Then param = "cmd=save;" Msg_Set() c = "" ElseIf c = "^Z" Then param = "cmd=undo;" Msg_Set() c = "" ElseIf c = "^Y" Then param = "cmd=redo;" Msg_Set() c = "" ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown cmd: '" + c + "'") TextWindow.ForegroundColor = "Gray" c = "" EndIf EndWhile If msgOut < msgIn Then ' do action for the message (command) msgOut = msgOut + 1 msg = message[msgOut] If msg["cmd"] = "new" Then New() ElseIf msg["cmd"] = "open" Then Open() ElseIf msg["cmd"] = "save" Then Save() ElseIf msg["cmd"] = "undo" Then Macro_Undo() ElseIf msg["cmd"] = "redo" Then Macro_Redo() ElseIf msg["cmd"] = "color" Then color = pcolor CS_ShowPopup() pcolor = color Color_SetPenColor() ElseIf msg["cmd"] = "pixel" Then x = msg["x"] y = msg["y"] Icon_GetPixel() msg["from"] = color msg["to"] = pcolor Macro_Add() color = pcolor Icon_SetPixel() Else GraphicsWindow.Title = msg["cmd"] + " - " + title EndIf EndIf If debug Then Debug_StateChanged() If changed Then Debug_Dump() EndIf EndIf EndWhile Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "DimGray" iconWidth = 16 '40 iconHeight = 16 '40 itemSize = 40 itemGap = 10 menuHeight = 60 size = 16 '6 gap = 2 Menu_Draw() xEdit = Math.Floor((gw - (size + gap + 1) * iconWidth) / 2) + iconWidth yEdit = Math.Floor((gh - menuHeight - (size + gap) * iconHeight) / 2) + menuHeight xIcon = Math.Floor((xEdit - iconWidth) / 2) yIcon = yEdit add = "True" Icon_Clear() add = "False" EndSub Sub New yes = "True" If Text.IsSubText(GraphicsWindow.Title, "*") Then caution = "Are you sure to clear the icon?" Dialog_YesNo() EndIf If yes Then Icon_Clear() fname = "Untitled" relPath = "" Macro_Init() EndIf EndSub Sub Open ' open command File_Open() Parse_PPM() If match And relPath <> "" Then fname = relPath Macro_Init() EndIf EndSub Sub Save ' save command File_GeneratePPM() File_Save() EndSub Sub Array_GetIndexOfValue ' param arry - array ' param value - value to get index ' return index - index if found or "" if not found nValue = Array.GetItemCount(arry) indices = Array.GetAllIndices(arry) index = "" For iArry = 1 To nValue If value = arry[indices[iArry]] Then index = indices[iArry] iArry = nValue + 1 ' break EndIf EndFor EndSub Sub Color_ColorToRGB ' Color | Convert Color to RGB ' param sColor - "#rrggbb" ' return iR, iG, iB - [0, 255] sR = Text.GetSubText(sColor, 2, 2) sG = Text.GetSubText(sColor, 4, 2) sB = Text.GetSubText(sColor, 6, 2) sHex = sR Math_Hex2Dec() iR = iDec sHex = sG Math_Hex2Dec() iG = iDec sHex = sB Math_Hex2Dec() iB = iDec EndSub Sub Color_HSLtoRGB ' Color | Convert HSL to RGB ' param rHue - [0, 360) or UNDEFINED ' param rLightness - [0, 1] ' param rSaturation - [0, 1] ' return iR, iG, iB - RGB color ' return sColor - "#rrggbb" If rLightness <= 0.5 Then rN2 = rLightness * (1 + rSaturation) Else rN2 = rLightness + rSaturation - rLightness * rSaturation EndIf rN1 = 2 * rLightness - rN2 If rSaturation = 0 Then iR = Math.Round(rLightness * 255) iG = Math.Round(rLightness * 255) iB = Math.Round(rLightness * 255) Else rH = rHue + 120 Color_Value() iR = iValue rH = rHue Color_Value() iG = iValue rH = rHue - 120 Color_Value() iB = iValue EndIf sColor = GraphicsWindow.GetColorFromRGB(iR, iG, iB) EndSub Sub Color_Init Popup_Init() Color_SetPenColor() CS_InitPalette() ' initialize palette for color slider EndSub Sub Color_RGBtoHSL ' Color | Convert RGB to HSL ' param sColor - "#rrggbb" ' return rHue - [0, 360) or UNDEFINED ' return rLightness - (0, 1) ' return rSaturation - (0, 1) Color_ColorToRGB() ' rR = iR / 255 ' occurs Math.Max() bug rR = Math.Round(iR / 255 * 10000) / 10000 ' rG = iG / 255 ' occurs Math.Max() bug rG = Math.Round(iG / 255 * 10000) / 10000 ' rB = iB / 255 ' occurs Math.Max() bug rB = Math.Round(iB / 255 * 10000) / 10000 rMax = Math.Max(rR, rG) rMax = Math.Max(rMax, rB) rMin = Math.Min(rR, rG) rMin = Math.Min(rMin, rB) rLightness = (rMax + rMin) / 2 If rMax = rMin Then ' rR = rG = rB rSaturation = 0 rHue = UNDEFINED Else If rLightness <= 0.5 Then rSaturation = (rMax - rMin) / (rMax + rMin) Else rSaturation = (rMax - rMin) / (2 - rMax - rMin) EndIf rRC = (rMax - rR) / (rMax - rMin) rGC = (rMax - rG) / (rMax - rMin) rBC = (rMax - rB) / (rMax - rMin) If rR = rMax Then ' between Yellow and Magenta rHue = rBC - rGC ElseIf rG = rMax Then ' between Cyan and Yellow rHue = 2 + rRC - rBC ElseIf rB = rMax Then ' between Magenta and Cyan rHue = 4 + rGC - rRC Else TextWindow.WriteLine("Error:") TextWindow.WriteLine("rMax=" + rMax) TextWindow.WriteLine("rR=" + rR + ",sR=" + sR) TextWindow.WriteLine("rG=" + rG + ",sG=" + sG) TextWindow.WriteLine("rB=" + rB + ",sB=" + sB) EndIf rHue = rHue * 60 If rHue < 0 Then rHue = rHue + 360 EndIf EndIf EndSub Sub Color_Value ' Color | Function value ' param rN1, rN2 ' param rH - [-120, 480) ' return iValue - 0..255 If rH >= 360 Then rH = rH - 360 EndIF If rH < 0 Then rH = rH + 360 EndIF If rH < 60 Then rV = rN1 + (rN2 - rN1) * rH / 60 ElseIf rH < 180 Then rV = rN2 ElseIf rH < 240 Then rV = rN1 + (rN2 - rN1) * (240 - rH) / 60 Else rV = rN1 EndIf iValue = Math.Round(rV * 255) EndSub Sub CS_AddColorToPalette ' Color Selector | Add color to palette ' param color - color to set ' param maxPalette ' param nPalette ' param palette ' param tPalette - target palette Stack.PushValue("local", i) For i = 1 To nPalette pltt = palette[i] If color = pltt["color"] Then Goto csactp_not_new_color EndIf EndFor pltt = palette[tPalette] pltt["color"] = color palette[tPalette] = pltt If nPalette < maxPalette Then nPalette = nPalette + 1 EndIf tPalette = tPalette + 1 If maxPalette < tPalette Then tPalette = 1 EndIf csactp_not_new_color: i = Stack.PopValue("local") EndSub Sub CS_AdjustSlider ' Color Selector | Adjust slider ' param iSlider - moved slider Stack.PushValue("local", iSlider) If iSlider = iHue Or iSlider = iLightness Or iSlider = iSaturation Then If iSlider = iHue Then Slider_GetLevel() rHue = level ElseIf iSlider = iLightness Then Slider_GetLevel() rLightness = level / 100 Else Slider_GetLevel() rSaturation = level / 100 EndIf Color_HSLtoRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() Else CS_GetColorFromSlider() sColor = GraphicsWindow.GetColorFromRGB(red, green, blue) Color_RGBtoHSL() If rHue = UNDEFINED Then rHue = 0 EndIf iSlider = iHue level = Math.Floor(rHue) Slider_SetLevel() iSlider = iSaturation level = Math.Floor(rSaturation * 100) Slider_SetLevel() iSlider = iLightness level = Math.Floor(rLightness * 100) Slider_SetLevel() EndIf iSlider = Stack.PopValue("local") EndSub Sub CS_DoObject ' Color Selector | Do object ' param - obj While obj <> "" CS_DoSlider() If obj <> "" Then CS_DoPalette() EndIf EndWhile EndSub Sub CS_DoPalette ' Color Selector | Do palette ' param obj - clicked object If Text.StartsWith(obj, "palette") Then iPalette = Text.GetSubTextToEnd(obj, 8) pltt = palette[iPalette] color = pltt["color"] CS_SetColorToSlider() ' set color to slider CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DoSlider ' Color Selector | Do slider ' param obj - clicked object ' param iSlider - index of slider If Text.StartsWith(obj, "slider") Then Slider_WaitToRelease() obj = "" param = "down=True;move=False;up=False;" ' wait to click Mouse_SetHandler() EndIf EndSub Sub CS_DrawColorRect ' Color Selector | Draw color rectangle ' param color - color of rectangle ' param x, y, width, height - position and size of rectangle ' return oRect - rectangle object GraphicsWindow.BrushColor = color GraphicsWindow.PenColor = BORDERCOLOR If oRect <> "" Then Shapes.Remove(oRect) EndIf oRect = Shapes.AddRectangle(width, height) Shapes.Move(oRect, x, y) EndSub Sub CS_DrawPalette ' Color Selector | Draw palette ' param palette[] - color palette ' param nPalette - number of color in palette ' param x, y, width, height - position and size of rectangle ' return oPalette[] - palette object array Stack.PushValue("local", i) GraphicsWindow.PenColor = BORDERCOLOR For i = 1 To nPalette pltt = palette[i] GraphicsWindow.BrushColor = pltt["color"] pltt["oCell"] = Shapes.AddRectangle(width, height) dx = Math.Remainder((i - 1), (maxPalette / 2)) * (width + 4) dy = Math.Floor((i - 1) / (maxPalette / 2)) * (height + 4) Shapes.Move(pltt["oCell"], x + dx, y + dy) pltt["x"] = x + dx pltt["y"] = y + dy pltt["width"] = width pltt["height"] = height palette[i] = pltt EndFor i = Stack.PopValue("local") EndSub Sub CS_GetColorFromSlider ' Color Selector | get color from slider ' return color Stack.PushValue("local", iSlider) iSlider = iRed ' slider index Slider_GetLevel() red = level iSlider = iGreen ' slider index Slider_GetLevel() green = level iSlider = iBlue ' slider index Slider_GetLevel() blue = level color = GraphicsWindow.GetColorFromRGB(red, green, blue) iSlider = Stack.PopValue("local") EndSub Sub CS_Init ' Color Selector | Initialize sliders width = 256 min = 0 max = 255 left = 190 ' add red slider top = TOPY caption = "R" Slider_Add() iRed = iSlider ' index of slider ' add green slider top = top + DELTAY caption = "G" Slider_Add() iGreen = iSlider ' index of slider ' add blue slider top = top + DELTAY caption = "B" Slider_Add() iBlue = iSlider ' index of slider ' add hue slider width = 360 top = top + DELTAY max = 360 caption = "H" Slider_Add() iHue = iSlider ' index of slider ' add saturation slider width = 100 top = top + DELTAY max = 100 caption = "S" Slider_Add() iSaturation = iSlider ' index of slider ' add lightness slider width = 100 top = top + DELTAY max = 100 caption = "L" Slider_Add() iLightness = iSlider ' index of slider ' draw color rectangle CS_GetColorFromSlider() CS_ShowNewColor() x = LEFTX y = TOPY + DELTAY * 4 width = 100 height = 100 CS_DrawColorRect() ' add text box GraphicsWindow.BrushColor = CAPTIONCOLOR top = y + height + 4 oNewColor = Shapes.AddText("") Shapes.Move(oNewColor, LEFTX, top) EndSub Sub CS_DumpSlider ' Color Selector | Dump slider for debug For i = 1 To numSlider TextWindow.WriteLine("slider" + i) TextWindow.WriteLine(slider[i]) EndFor EndSub Sub CS_InitPalette ' Color Selector | Initialize palette ' This subroutine should be called before CS_ShowPopup(). pcolor = GraphicsWindow.PenColor If Text.GetLength(pcolor) = 9 Then ' for Silverlight pcolor = "#" + Text.GetSubText(pcolor, 4, 6) EndIf maxPalette = 24 ' max cell number of palette nPalette = 1 ' number of palette in use tPalette = 2 ' index of update target cell pltt = palette[1] pltt["color"] = pcolor palette[1] = pltt EndSub Sub CS_RemovePalette ' Color Selector | Remove palette ' param nPalette - number of color in palette ' return oPalette[] - palette object array Stack.PushValue("local", i) For i = 1 To nPalette oPalette = "Palette" + i pltt = palette[i] Shapes.Remove(pltt["oCell"]) EndFor i = Stack.PopValue("local") EndSub Sub CS_RemoveSliders ' Color Selector | Remove sliders For iSlider = 1 To numSlider Slider_Remove() EndFor numSlider = 0 EndSub Sub CS_SearchClickedObject ' Color Selector | Check slider clicked ' param mxD, myD - clicked point ' return obj - clicked slider or palette ' return iSlider - index if obj is slider ' return iPalette - index if obj is palette Stack.PushValue("local", i) For iSlider = 1 To numSlider obj = "slider" + iSlider sldr = slider[iSlider] x2 = sldr["x2"] y2 = sldr["y2"] x3 = sldr["x3"] y3 = sldr["y3"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor For iPalette = 1 To nPalette obj = "palette" + iPalette pltt = palette[iPalette] x2 = pltt["x"] y2 = pltt["y"] x3 = pltt["x"] + pltt["width"] y3 = pltt["y"] + pltt["height"] If x2 <= mxD And mxD <= x3 And y2 <= myD And myD <= y3 Then Goto scco_obj_found EndIf EndFor obj = "" scco_obj_found: i = Stack.PopValue("local") EndSub Sub CS_SetColorToSlider ' Color Selector | Set color to slider ' param color Stack.PushValue("local", iSlider) sColor = color Color_ColorToRGB() iSlider = iRed level = iR Slider_SetLevel() iSlider = iGreen level = iG Slider_SetLevel() iSlider = iBlue level = iB Slider_SetLevel() CS_AdjustSlider() iSlider = Stack.PopValue("local") EndSub Sub CS_ShowNewColor ' Color Selector | Show new color ' param oColor ' param color Shapes.SetText(oNewColor, color) EndSub Sub CS_ShowPopup ' Color Selector | Show popup ' param color - current color ' return color - new color ' define constant Stack.PushValue("local", cont) fs = 12 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = "Black" colorInit = color ' initial color GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = POPUPCOLOR GraphicsWindow.BrushColor = POPUPCOLOR oPopup = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oPopup, 64) Shapes.Move(oPopup, LEFTX - 10, TOPY - 10) GraphicsWindow.BrushColor = CAPTIONCOLOR oOK = Controls.AddButton("OK", gw - 100, gh - 34) oCancel = Controls.AddButton("Cancel", gw - 60, gh - 34) Controls.ButtonClicked = CS_OnButtonClicked CS_Init() Stack.PushValue("local", y) y = TOPY color = colorInit CS_DrawColorRect() ' original color oRectCurrent = oRect oRect = "" ' keep current color If Text.GetLength(color) = 9 Then ' for Silverlight color = "#" + Text.GetSubText(color, 4, 6) EndIf GraphicsWindow.BrushColor = CAPTIONCOLOR oColor = Shapes.AddText(colorInit) Shapes.Move(oColor, x, y + height + 2) y = Stack.PopValue("local") CS_SetColorToSlider() CS_DrawColorRect() ' draw new color rectangle CS_ShowNewColor() ' show new color name Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", width) Stack.PushValue("local", height) x = x + width + 30 y = TOPY + height * 2 + 24 width = 30 height = 30 CS_DrawPalette() height = Stack.PopValue("local") width = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") cont = "True" ' continue param = "down=True;move=False;up=False;" ' wait click Mouse_SetHandler() While cont If clicked Then CS_SearchClickedObject() CS_DoObject() clicked = "False" Else Program.Delay(100) EndIf EndWhile If cancel Then color = colorInit Else CS_AddColorToPalette() EndIf CS_RemovePalette() CS_RemoveSliders() Shapes.Remove(oColor) Shapes.Remove(oNewColor) Shapes.Remove(oRectCurrent) Shapes.Remove(oRect) Controls.Remove(oOK) Controls.Remove(oCancel) Shapes.Remove(oPopup) cont = Stack.PopValue("local") EndSub Sub CS_OnButtonClicked ' Color Selector | Event handler on button clicked cont = "False" If Controls.LastClickedButton = oCancel Then cancel = "True" Else cancel = "False" EndIf EndSub Sub Color_SetPenColor ' param pcolor GraphicsWindow.BrushColor = pcolor padding = 4 arry = item value = "Pen Color" Array_GetIndexOfValue() y = Math.Floor((menuHeight - itemSize - 10) / 2) + padding x = (index - 1) * (itemSize + itemGap) + itemGap + padding GraphicsWindow.FillRectangle(x, y, itemSize - 2 * padding, itemSize - 2 * padding) EndSub Sub Debug_StateChanged ' Debug | Check state changed ' return changed - "True" if state changed changed = "False" If keyIn <> lastKeyIn Then lastKeyIn = keyIn changed = "True" EndIf If keyOut <> lastKeyOut Then lastKeyOut = keyOut changed = "True" EndIf If msgIn <> lastMsgIn Then lastMsgIn = msgIn changed = "True" EndIf If msgOut <> lastMsgOut Then lastMsgOut = msgOut changed = "True" EndIf EndSub Sub Debug_Dump ' Debug | Dump state TextWindow.WriteLine("fifo = " + fifo) TextWindow.WriteLine("keyIn = " + keyIn) TextWindow.WriteLine("keyOut = " + keyOut) TextWindow.WriteLine("message = " + message) TextWindow.WriteLine("msgIn = " + msgIn) TextWindow.WriteLine("msgOut = " + msgOut) EndSub Sub Dialog_YesNo ' param caution - message ' return yes - if [Yes] pushed yes = "True" GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = POPUPCOLOR oMsgBox = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oMsgBox, 64) GraphicsWindow.BrushColor = CAPTIONCOLOR oCaution = Shapes.AddText(caution) yCaution = (gh - 80) / 2 Shapes.Move(oCaution, 150, yCaution) oYes = Controls.AddButton("Yes", 360, yCaution + 50) oNo = Controls.AddButton("No", 400, yCaution + 50) cont = "True" ' continue Controls.ButtonClicked = File_OnButtonClicked While cont Program.Delay(500) EndWhile If Controls.LastClickedButton = oNo Then yes = "False" EndIf Controls.Remove(oNo) Controls.Remove(oYes) Shapes.Remove(oCaution) Shapes.Remove(oMsgBox) EndSub Sub File_GetAbsPath ' param curDir - current directory ' param relPath - relative path ' return absPath - absolute path If Text.IsSubText(relPath, ":") Or Text.StartsWith(relPath, "\") Or relPath = "" Then absPath = relPath Else absPath = curDir + "\" + relPath File_RemoveDots() EndIf EndSub Sub File_RemoveDots ' param absPath - with dots ' return absPath - without dots path = absPath folder = "" n = 0 While Text.IsSubText(path, "\") n = n + 1 p = Text.GetIndexOf(path, "\") folder[n] = Text.GetSubText(path, 1, p - 1) path = Text.GetSubTextToEnd(path, p + 1) EndWhile If path <> "" Then n = n + 1 folder[n] = path EndIf While Array.ContainsValue(folder, ".") Or Array.ContainsValue(folder, "..") For i = 1 To n If folder[i] = "." Then File_RemoveEntry() i = n + 1 ' break ElseIf folder[i] = ".." Then i = i - 1 File_RemoveEntry() File_RemoveEntry() i = n + 1 ' break EndIf EndFor EndWhile absPath = folder[1] For i = 2 To n absPath = absPath + "\" + folder[i] EndFor EndSub Sub File_RemoveEntry ' param folder - entry array ' param i - entry index ' return folder - updated entry array ' return n For _i = i To n - 1 folder[_i] = folder[_i + 1] EndFor folder[n] = "" n = n - 1 EndSub Sub File_CloseDialog ' File | Close dialog for Open/Save ' param oPopup ' param oCaption ' param oFilename ' param oText ' param oMsg ' param oCancel Controls.Remove(oCancel) Controls.Remove(oMsg) Controls.Remove(oText) Controls.Remove(oFilename) Controls.Remove(oCaption) Controls.Remove(oPopup) EndSub Sub File_GeneratePPM ' File | Generate PPM in buf ' return buf - buffer buf = "P3" + CR + LF buf = buf + "16 16" + CR + LF buf = buf + "255" + CR + LF nRGB = 0 For y = 0 To iconHeight - 1 nCol = 0 For x = 0 To iconWidth - 1 Icon_GetPixel() sColor = color Color_ColorToRGB() len = Text.GetLength(iR) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iR + " " len = Text.GetLength(iG) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iG + " " len = Text.GetLength(iB) sp = Text.GetSubTextToEnd(" ", len) buf = buf + sp + iB If (Math.Remainder(nCol, 5) = 4) Or (nCol = iconWidth - 1) Then buf = buf + CR + LF Else buf = buf + " " EndIf nCol = nCol + 1 EndFor EndFor EndSub Sub File_GetBasename ' FIle | Get basename from filename ' param filename ' return basename ' return ext - extension pFilename = 1 While Text.IsSubText(Text.GetSubTextToEnd(filename, pFilename), "\") iBackslash = Text.GetIndexOf(Text.GetSubTextToEnd(filename, pFilename), "\") pFilename = pFilename + iBackslash EndWhile iDot = Text.GetIndexOf(Text.GetSubTextToEnd(filename, pFilename), ".") If 0 < iDot Then basename = Text.GetSubText(filename, pFilename, iDot - 1) ext = Text.GetSubTextToEnd(filename, pFilename + iDot) Else basename = Text.GetSubTextToEnd(filename, pFilename) ext = "" EndIf EndSub Sub File_Open ' File | Show input code to open ' return buf ' return filename Stack.PushValue("local", cont) relPath = "" filename = "" File_OpenDialog() oOpen = Controls.AddButton("Open", 486, gh - 34) Shapes.SetText(oMsg, "You can also click above, push Ctrl+V to paste from clipboard") Controls.ButtonClicked = File_OnButtonClicked Controls.TextTyped = File_OnTextTyped subname = "Shapes_Init" typed = "False" done = "False" While Not[done] cont = "True" ' continue While cont If typed Then curDir = Program.Directory relPath = Controls.GetTextBoxText(oFilename) File_GetAbsPath() filename = absPath buf = "" ' The following line could be harmful and has been automatically commented. ' buf = File.ReadContents(filename) Controls.SetTextBoxText(oText, buf) typed = "False" Else Program.Delay(200) EndIf EndWhile If Controls.LastClickedButton = oOpen Then buf = Controls.GetTextBoxText(oText) If buf <> "" Then done = "True" EndIf Else buf = "" relPath = "" filename = "" done = "True" EndIf EndWhile Controls.Remove(oOpen) File_CloseDialog() cont = Stack.PopValue("local") EndSub Sub File_OpenDialog ' File | Open dialog and common parts for Open/Save ' param relPath ' return oPopup ' return oCaption ' return oFilename ' return oText ' return oMsg ' return oCancel GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = POPUPCOLOR oPopup = Shapes.AddRectangle(gw, gh) Shapes.SetOpacity(oPopup, 64) Shapes.Move(oPopup, LEFTX - 10, TOPY - 10) GraphicsWindow.BrushColor = CAPTIONCOLOR oCaption = Shapes.AddText("Filename") Shapes.Move(oCaption, LEFTX, TOPY + 4) GraphicsWindow.BrushColor = TEXTCOLOR oFilename = Controls.AddTextBox(LEFTX + 80, TOPY) Shapes.SetOpacity(oFilename, OPACITY) Controls.SetSize(oFilename, 300, 24) Controls.SetTextBoxText(oFilename, relPath) oText = Controls.AddMultiLineTextBox(LEFTX, TOPY + 30) Controls.SetSize(oText, gw - 20, gh - 84) Shapes.SetOpacity(oText, OPACITY) GraphicsWindow.BrushColor = CAPTIONCOLOR oMsg = Shapes.AddText("") Shapes.Move(oMsg, LEFTX, gh - 28) GraphicsWindow.BrushColor = TEXTCOLOR oCancel = Controls.AddButton("Cancel", 535, gh - 34) EndSub Sub File_Save ' File | Show output code to save ' param buf - program buffer ' param filename Stack.PushValue("local", cont) File_OpenDialog() Controls.SetTextBoxText(oText, buf) oSave = Controls.AddButton("Save", 488, gh - 34) Shapes.SetText(oMsg, "You can also click above, push Ctrl+A, Ctrl+C to copy to clipboard") Controls.ButtonClicked = File_OnButtonClicked Controls.TextTyped = File_OnTextTyped done = "False" While Not[done] cont = "True" ' continue While cont If typed Then curDir = Program.Directory relPath = Controls.GetTextBoxText(oFilename) File_GetAbsPath() filename = absPath File_GetBasename() lowerExt = Text.ConvertToLowerCase(ext) typed = "False" Else Program.Delay(500) EndIf EndWhile buf = Controls.GetTextBoxText(oText) If (Controls.LastClickedButton = oSave) And (filename <> "") Then dummy = "" ' for Silverlight ' The following line could be harmful and has been automatically commented. ' dummy = File.ReadContents(filename) yes = "True" If dummy <> "" Then caution = "'" + basename + "." + ext + "' already exists." + CR + LF + "Do you want to replace it?" Dialog_YesNo() EndIf If yes Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents(filename, buf) done = "True" ' saved EndIf ElseIf Controls.LastClickedButton = oCancel Then done = "True" ' canceled EndIf EndWhile Controls.Remove(oSave) File_CloseDialog() cont = Stack.PopValue("local") EndSub Sub File_OnButtonClicked ' File | Button event handler cont = "False" EndSub Sub File_OnTextTyped ' File | Textbox event handler If Controls.LastTypedTextBox = oFilename Then typed = "True" EndIf EndSub Sub Icon_Clear ' param add - "True" to add menu to mouse object GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(xIcon, yIcon, iconWidth, iconHeight) For row = 0 To iconHeight - 1 y = yEdit + row * (size + gap) For col = 0 To iconWidth - 1 x = xEdit + col * (size + gap) GraphicsWindow.FillRectangle(x, y, size, size) EndFor EndFor If add Then param = "" param["name"] = "icon" param["xLeft"] = xEdit param["xRight"] = xEdit + iconWidth * (size + gap) - gap param["yTop"] = yEdit param["yBottom"] = yEdit + iconHeight * (size + gap) - gap Mouse_AddObject() EndIf EndSub Sub Icon_GetPixel ' param x, y - position in icon ' return color - got color color = GraphicsWindow.GetPixel(xIcon + x, yIcon + y) If Text.GetLength(color) = 9 Then color = "#" + Text.GetSubTextToEnd(color, 4) EndIf EndSub Sub Icon_MouseToXY ' param xRel, yRel - position in icon edit field ' return x, y - pixel of the icon or (-1, -1) if on the grid x = Math.Floor(xRel / (size + gap)) y = Math.Floor(yRel / (size + gap)) If (iconWidth - 1 < x) Or (iconHeight - 1 < y) Then x = -1 y = -1 Else xMod = Math.Remainder(xRel, (size + gap)) yMod = Math.Remainder(yRel, (size + gap)) If (size - 1 < xMod) Or (size - 1 < yMod) Then x = -1 y = -1 EndIf EndIf EndSub Sub Icon_SetPixel ' param x, y - position in icon ' param color - set color GraphicsWindow.SetPixel(xIcon + x, yIcon + y, color) GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(xEdit + x * (size + gap), yEdit + y * (size + gap), size, size) EndSub Sub KB_Init ' Keyboard | Initialization (use only ^n, ^o, ^s, ^z, ^y) shift = "" ctrl = "" keyIn = 0 keyOut = 0 GraphicsWindow.KeyDown = KB_OnKeyDown GraphicsWindow.KeyUp = KB_OnKeyUp EndSub Sub KB_InKey ' Keyboard | In key ' return c - input key If keyOut < keyIn Then keyOut = keyOut + 1 Program.Delay(1) ' workaround 29976 c = fifo[keyOut] 'fifo[keyOut] = "" EndIf EndSub Sub KB_OnKeyDown ' Keyboard | Key down event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "+" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "^" Else keyIn = keyIn + 1 fifo[keyIn] = shift + ctrl + key EndIf EndSub Sub KB_OnKeyUp ' Keyboard | Key up event handler key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then shift = "" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then ctrl = "" EndIf EndSub Sub Macro_Add ' Macro | Add macro ' param msg - message command iMacro = iMacro + 1 nMacro = iMacro macro[iMacro] = msg name = "undo" Menu_EnableItem() GraphicsWindow.Title = fname + " * - " + title name = "redo" Menu_DisableItem() EndSub Sub Macro_Init ' Macro | Initialize macro = "" iMacro = 0 nMacro = 0 name = "undo" Menu_DisableItem() GraphicsWindow.Title = fname + " - " + title name = "redo" Menu_DisableItem() EndSub Sub Macro_Redo ' Macro | Redo If iMacro < nMacro Then iMacro = iMacro + 1 msg = macro[iMacro] If msg["cmd"] = "pixel" Then x = msg["x"] y = msg["y"] color = msg["to"] Icon_SetPixel() ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown macro: '" + msg["cmd"] + "'") TextWindow.ForegroundColor = "Gray" EndIf name = "undo" Menu_EnableItem() GraphicsWindow.Title = fname + " * - " + title If iMacro = nMacro Then name = "redo" Menu_DisableItem() EndIf EndIf EndSub Sub Macro_Undo ' Macro | Undo If 0 < iMacro Then msg = macro[iMacro] If msg["cmd"] = "pixel" Then x = msg["x"] y = msg["y"] color = msg["from"] Icon_SetPixel() iMacro = iMacro - 1 name = "redo" Menu_EnableItem() If iMacro = 0 Then name = "undo" Menu_DisableItem() GraphicsWindow.Title = fname + " - " + title EndIf ElseIf debug Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Unknown macro: '" + msg["cmd"] + "'") TextWindow.ForegroundColor = "Gray" EndIf EndIf 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 Sub Menu_Draw GraphicsWindow.BrushColor = "#EEEEEE" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) item = "1=New;2=Open;3=Save;4=Undo;5=Redo;6=Pen Color;" nItem = Array.GetItemCount(item) add = "True" For i = 1 To nItem Menu_DrawItem() EndFor add = "False" EndSub Sub Menu_EnableItem ' param name - name of the menu item ' param item - array of the menu items ' param nItem - number of the menu items i = 1 While (Text.ConvertToLowerCase(item[i]) <> Text.ConvertToLowerCase(name)) And (i <= nItem) i = i + 1 EndWhile If (i <= nItem) And (mask[i] <> "") Then Shapes.Remove(mask[i]) mask[i] = "" EndIf EndSub Sub Menu_DisableItem ' param name - name of the menu item ' param item - array of the menu items ' param nItem - number of the menu items i = 1 While (Text.ConvertToLowerCase(item[i]) <> Text.ConvertToLowerCase(name)) And (i <= nItem) i = i + 1 EndWhile If (i <= nItem) And (mask[i] = "") Then y = Math.Floor((menuHeight - itemSize - 10) / 2) x = (i - 1) * (itemSize + itemGap) + itemGap GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#EEEEEE" mask[i] = Shapes.AddRectangle(itemSize, itemSize) Shapes.SetOpacity(mask[i], 70) Shapes.Move(mask[i], x, y) EndIf EndSub Sub Menu_DrawItem ' param i - index number of the menu item ' param add - "True" to add menu to mouse object y = Math.Floor((menuHeight - itemSize - 10) / 2) x = (i - 1) * (itemSize + itemGap) + itemGap url = "http://www.nonkit.com/smallbasic.files/" + Text.ConvertToLowerCase(item[i]) + ".png" GraphicsWindow.DrawImage(url, x, y) If add Then param = "" param["name"] = Text.ConvertToLowerCase(item[i]) param["xLeft"] = x param["xRight"] = x + itemSize param["yTop"] = y param["yBottom"] = y + itemSize Mouse_AddObject() EndIf fs = 10 GraphicsWindow.FontSize = fs GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" txt = item[i] Text_GetWidthInPx() dx = Math.Floor((itemSize - px) / 2) GraphicsWindow.DrawText(x + dx, y + itemSize, item[i]) EndSub Sub Mouse_AddObject ' Mouse | Add object to click ' param["name"] - name of the object to add ' param["xLeft"] - left x coordinate of the object ' param["xRight"] - right x coordinate of the object ' param["yTop"] - top y coordinate of the object ' param["yBottom"] - bottom y coordinate of the object ' return object ' return nObject nObject = nObject + 1 object[nObject] = param EndSub Sub Mouse_DetectObject ' param mxD, myD - mouse clicked coordinate ' return name - clicked object name if found, "" if not found ' return xRel - relative x coordinate from left x of the object ' return yRel - relative y coordinate from top y of the object name = "" ' not found For iObject = 1 To nObject obj = object[iObject] If obj["xLeft"] <= mxD And mxD <= obj["xRight"] And obj["yTop"] <= myD And myD <= obj["yBottom"] Then name = obj["name"] ' found xRel = mxD - obj["xLeft"] yRel = myD - obj["yTop"] iObject = nObject ' break EndIf EndFor EndSub Sub Mouse_Init ' Mouse | Initialize for common event handler clicked = "False" released = "False" moved = "False" object = "" nObject = 0 GraphicsWindow.MouseDown = Mouse_OnDown EndSub Sub Mouse_SetHandler ' Mouse | Set or reset common event handler ' param["down"] - "True" if set, "False" if reset ' param["move"] - "True" if set, "False" if reset ' param["up"] - - "True" if set, "False" if reset ' return clicked - "False" if set MouseDown ' return moved - "False" if set MouseMove ' return released - "False" if set MouseUp ' return dmu - which handlers are set for debug If param["up"] Then released = "False" GraphicsWindow.MouseUp = Mouse_OnUp handler["up"] = "U" ElseIf Not[param["up"]] Then GraphicsWindow.MouseUp = Mouse_DoNothing handler["up"] = "" EndIf If param["down"] Then clicked = "False" GraphicsWindow.MouseDown = Mouse_OnDown handler["down"] = "D" ElseIf Not[param["down"]] Then GraphicsWindow.MouseDown = Mouse_DoNothing handler["down"] = "" EndIf If param["move"] Then moved = "False" GraphicsWindow.MouseMove = Mouse_OnMove handler["move"] = "M" ElseIf Not[param["move"]] Then GraphicsWindow.MouseMove = Mouse_DoNothing handler["move"] = "" EndIf dmu = handler["down"] + handler["move"] + handler["up"] If debug Then smrc = " set " EndIf EndSub Sub Mouse_OnDown ' Mouse | Common event handler on mouse down ' return mxD, myD - position on mouse down mxD = Math.Floor(GraphicsWindow.MouseX) myD = Math.Floor(GraphicsWindow.MouseY) clicked = "True" released = "False" If debug Then smrc = " clicked " + mxD + "," + myD EndIf EndSub Sub Mouse_DoNothing ' Mouse | Common event handler to do nothing EndSub Sub Mouse_OnMove ' Mouse | Common event handler on mouse move ' return mxM, myM - position on mouse move mxM = Math.Floor(GraphicsWindow.MouseX) myM = Math.Floor(GraphicsWindow.MouseY) moved = "True" If debug Then smrc = " moved " + mxM + "," + myM EndIf EndSub Sub Mouse_OnTick ' Mouse | debug routine If clicked Then cmr = "C" Else cmr = "" EndIf If moved Then cmr = cmr + "M" EndIf If released Then cmr = cmr + "R" EndIf GraphicsWindow.Title = title + smrc + " " + dmu + " " + cmr EndSub Sub Mouse_OnUp ' Mouse | Common event handler on mouse up ' return mxU, myU - position on mouse up mxU = Math.Floor(GraphicsWindow.MouseX) myU = Math.Floor(GraphicsWindow.MouseY) released = "True" If debug Then smrc = " released " + mxU + "," + myU EndIf EndSub Sub Msg_Init ' Message | Initialize msgIn = 0 msgOut = 0 EndSub Sub Msg_Set ' Message | Set message to fifo ' param["cmd"] - massage command ' param["*"].. - message operands msgIn = msgIn + 1 message[msgIn] = param EndSub Sub Parse_Comment ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer char = Text.GetSubText(buf, p, 1) If char = "#" Then lenBuf = Text.GetLength(buf) While (char <> LF) And (p < lenBuf) p = p + 1 char = Text.GetSubText(buf, p, 1) EndWhile EndIf EndSub Sub Parse_Decimal ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return dec - decimal number ' return match - "True" if match match = "False" isDigit = "True" dec = 0 While isDigit char = Text.GetSubText(buf, p, 1) If Text.IsSubText(DIGIT, char) Then dec = dec * 10 + char p = p + 1 match = "True" Else isDigit = "False" EndIf EndWhile EndSub Sub Parse_MagicNumber ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return match - "True" if match If Text.StartsWith(Text.GetSubTextToEnd(buf, p), "P3") Then p = p + 2 match = "True" Else match = "False" EndIf EndSub Sub Parse_PPM ' param buf - buffer to parse ' return p - updated pointer ' return match - "True" if match p = 1 Parse_MagicNumber() If match Then Parse_WhiteSpaceAndComment() EndIf If match Then Parse_Decimal() If match Then If dec <> iconWidth Then match = "False" EndIf EndIf EndIf If match Then Parse_WhiteSpaceAndComment() EndIf If match Then Parse_Decimal() If match Then If dec <> iconHeight Then match = "False" EndIf EndIf EndIf If match Then Parse_WhiteSpaceAndComment() EndIf If match Then Parse_Decimal() If match Then If 0 < dec And dec < 65536 Then maxVal = dec Else match = "False" EndIf EndIf EndIf If match Then Parse_WhiteSpaceAndComment() EndIf If match Then Icon_Clear() For y = 0 To iconHeight - 1 For x = 0 To iconWidth - 1 Parse_WhiteSpace() Parse_Decimal() If match Then iR = Math.Floor(255 * dec / maxVal) Else Goto PPPM_Error EndIf Parse_WhiteSpace() Parse_Decimal() If match Then iG = Math.Floor(255 * dec / maxVal) Else Goto PPPM_Error EndIf Parse_WhiteSpace() Parse_Decimal() If match Then iB = Math.Floor(255 * dec / maxVal) Else Goto PPPM_Error EndIf color = GraphicsWindow.GetColorFromRGB(iR, iG, iB) Icon_SetPixel() EndFor EndFor EndIf PPPM_Error: EndSub Sub Parse_WhiteSpace ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return match - "True" isSpace = "True" While isSpace char = Text.GetSubText(buf, p, 1) If Text.IsSubText(" " + TAB + CR + LF, char) Then p = p + 1 Else isSpace = "False" EndIf EndWhile match = "True" EndSub Sub Parse_WhiteSpaceAndComment ' param buf - buffer to parse ' param p - poiter to the buffer ' return p - updated pointer ' return match - "True" isSpace = "True" While isSpace char = Text.GetSubText(buf, p, 1) If char = "#" Then Parse_Comment() ElseIf Text.IsSubText(" " + TAB + CR + LF, char) Then p = p + 1 Else isSpace = "False" EndIf EndWhile match = "True" EndSub Sub Popup_Init TOPY = 10 ' top y LEFTX = 10 ' left x DELTAY = 36 ' delta y OPACITY = 70 POPUPCOLOR = "LightGray" CAPTIONCOLOR = "Black" TEXTCOLOR = "Black" BORDERCOLOR = "#666666" BOXCOLOR = "LightGray" SLITCOLOR = "#555555" UNDEFINED = "N/A" EndSub Sub Slider_Add ' Slider | Add slider as shapes and property ' param width ' param caption ' param min, max ' param left, top ' return slider[] - property of slider ' return iSlider - added slider index numSlider = numSlider + 1 iSlider = numSlider ' add shapes for slider GraphicsWindow.BrushColor = CAPTIONCOLOR len = Text.GetLength(caption) sldr = slider[iSlider] sldr["oCaption"] = Shapes.AddText(caption) Shapes.Move(sldr["oCaption"], left - (len * 5 + 10), top + 1) level = Math.Floor((min + max) / 2) sldr["level"] = level ' property sldr["min"] = min sldr["max"] = max GraphicsWindow.PenColor = BORDERCOLOR mag = (level - min) / (max - min) GraphicsWindow.BrushColor = SLITCOLOR sldr["oSlit"] = Shapes.AddRectangle(width, 10) GraphicsWindow.PenColor = BORDERCOLOR GraphicsWindow.BrushColor = BOXCOLOR sldr["oBox"] = Shapes.AddRectangle(10, 18) GraphicsWindow.BrushColor = CAPTIONCOLOR sldr["oLevel"] = Shapes.AddText(level) sldr["x0"] = left sldr["x1"] = left + width sldr["y0"] = top Shapes.Move(sldr["oLevel"], left + width + 5, top) ' move and zoom shapes for slider Shapes.Move(sldr["oSlit"], left, top + 4) slider[iSlider] = sldr Slider_SetLevel() EndSub Sub Slider_CallBack ' Slider | Call back ' param iSlider - changed slider CS_AdjustSlider() CS_GetColorFromSlider() CS_ShowNewColor() ' show new color name CS_DrawColorRect() ' draw new color rectangle EndSub Sub Slider_GetLevel ' Slider | Get latest level of slider ' param iSlider ' return level sldr = slider[iSlider] level = sldr["level"] EndSub Sub Slider_GetMouseLevel ' Slider | Get mouse level of slider ' param iSlider ' return level sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] max = sldr["max"] min = sldr["min"] level = min + Math.Floor((max - min) * (mxM - x0) / (x1 - x0)) EndSub Sub Slider_WaitToRelease ' Slider | Get released point for slider moving ' param iSlider param = "down=False;move=True;up=True;" ' for slider moving / wait to release Mouse_SetHandler() While Not[released] If moved Then param = "move=False;" ' while slider moving Mouse_SetHandler() sldr = slider[iSlider] x0_ = sldr["x0"] x1_ = sldr["x1"] If mxM < x0_ Then mxM = x0_ EndIf If x1_ < mxM Then mxM = x1_ EndIf Slider_GetMouseLevel() ' get mouse level of slider Slider_SetLevel() ' set slider level and move slider box Slider_CallBack() param = "move=True;" ' for next slider moving Mouse_SetHandler() Else Program.Delay(100) EndIf EndWhile param = "move=False;up=False;" ' mouse released Mouse_SetHandler() EndSub Sub Slider_Remove ' Slider | Remove a slider ' param iSlider sldr = slider[iSlider] Shapes.Remove(sldr["oCaption"]) Shapes.Remove(sldr["oSlit"]) Shapes.Remove(sldr["oBox"]) Shapes.Remove(sldr["oLevel"]) EndSub Sub Slider_SetLevel ' Slider | Set slider level and move slider box ' param iSlider ' param level Stack.PushValue("local", width) sldr = slider[iSlider] x0 = sldr["x0"] x1 = sldr["x1"] y0 = sldr["y0"] width = x1 - x0 sldr["level"] = level Shapes.SetText(sldr["oLevel"], level) ' move bar min = sldr["min"] max = sldr["max"] mag = (level - min) / (max - min) ' move box Shapes.Move(sldr["oBox"], x0 + Math.Floor(width * mag) - 5, y0) sldr["x2"] = x0 + Math.Floor(width * mag) - 5 sldr["x3"] = x0 + Math.Floor(width * mag) - 5 + 10 sldr["y2"] = y0 sldr["y3"] = y0 + 18 slider[iSlider] = sldr width = Stack.PopValue("local") EndSub Sub Text_GetWidthInPx ' param txt - text to get width in px ' param ratio - character width/height in a font ' param fs - font size (height) ' return px - width in px (pixels) len = Text.GetLength(txt) px = 0 For p = 1 To len px = px + ratio[Text.GetCharacterCode(Text.GetSubText(txt, p, 1))] EndFor px = Math.Floor(px * fs / 100) EndSub End>RFT686-4.sb< Start>RFV485.sb< ' Brownian motion title = "Brownian Motion Simulation with Turtle - " GraphicsWindow.Title = title x0 = Turtle.X y0 = Turtle.y x1 = GraphicsWindow.Width y1 = GraphicsWindow.Height GraphicsWindow.PenColor = "LightGray" GraphicsWindow.DrawLine(x0, 0, x0, y1) GraphicsWindow.DrawLine(0, y0, x1, y0) GraphicsWindow.PenColor = "Black" Turtle.Speed = 10 angle = 360 distance = 1 GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(340, 14, "Angle is from 1 to") oAngle = Controls.AddTextBox(450, 10) Controls.SetTextBoxText(oAngle, angle) GraphicsWindow.DrawText(340, 44, "Distance is") oDistance = Controls.AddTextBox(450, 40) Controls.SetTextBoxText(oDistance, distance) Controls.TextTyped = OnTextTyped For i = 1 To 50000 GraphicsWindow.Title = title + i Turtle.Angle = Math.GetRandomNumber(angle) Turtle.Move(distance) EndFor Sub OnTextTyped oLast = Controls.LastTypedTextBox If oLast = oAngle Then angle = Controls.GetTextBoxText(oAngle) ElseIf oLast = oDistance Then distance = Controls.GetTextBoxText(oDistance) EndIf EndSub End>RFV485.sb< Start>RFW981.sb< 'Initialisation Window gw = 800 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 'Initialise Key events GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp keyLeft = 0 keyRight = 0 keyUp = 0 keyDown = 0 'Initialise ball ball = Shapes.AddEllipse(50,50) ballX = 100 ballY = 100 speed = 3 Shapes.Move(ball,ballX-25,ballY-25) 'Main loop - just move the ball While ("True") processKey() Shapes.Move(ball,ballX-25,ballY-25) 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 = "Left") Then keyLeft = 1 ElseIf (lastKey = "Right") Then keyRight = 1 ElseIf (lastKey = "Up") Then keyUp = 1 ElseIf (lastKey = "Down") Then keyDown = 1 EndIf EndSub Sub OnKeyUp lastKey = GraphicsWindow.LastKey If (lastKey = "Left") Then keyLeft = 0 ElseIf (lastKey = "Right") Then keyRight = 0 ElseIf (lastKey = "Up") Then keyUp = 0 ElseIf (lastKey = "Down") Then keyDown = 0 EndIf EndSub Sub processKey 'Move object - note it can move diagonally if 2 keys are pressed If (keyLeft = 1) Then ballX = ballX-speed EndIf If (keyRight = 1) Then ballX = ballX+speed EndIf If (keyUp = 1) Then ballY = ballY-speed EndIf If (keyDown = 1) Then ballY = ballY+speed EndIf 'Check for hitting edges If (ballX < 0) Then ballX = ballX+gw EndIf If (ballX > gw) Then ballX = ballX-gw EndIf If (ballY < 0) Then ballY = ballY+gh EndIf If (ballY > gh) Then ballY = ballY-gh EndIf EndSub End>RFW981.sb< Start>RGH405.sb< GraphicsWindow.Title ="Sierpinski Random Chaos Algorithm bw=400 bh=400 GraphicsWindow.Width=bw GraphicsWindow.Height = bh GraphicsWindow.BackgroundColor ="DarkBlue x1=bw/2 x2=bh/2 y1=0 y2=0 r=1 for k=1 to 50000 ecke=Math.GetRandomNumber (3)-1 ' ecke=(ecke+1) mod 3 if ecke=0 then x1=(x2+bw/2)/2 y1=y2/2 elseif ecke=1 then x1=x2/2 y1=(y2+bh)/2 else x1=(x2+bw)/2 y1=(y2+bh)/2 endif a=Math.Round (y1/bh*250) b=Math.Round (x1/bw*250) cc=GraphicsWindow.GetColorFromRGB (a,b,(255-a)) GraphicsWindow.SetPixel (x1,y1,cc) x2=x1 y2=y1 EndFor End>RGH405.sb< Start>RGJ318.sb< dw=800 dh=800 cc="3.57480:0.15400:13.7000:3.61040:0.99120:14.70200:3.33000:1.78240:15.31400:3.15440:1.19000:12.11840:2.65920:2.74480:14.30240:2.06480:3.41120:14.18720:1.69560:3.40680:12.67800:0.68040:4.06720:13.1000:-0.83880:4.75720:14.2600:-1.20:4.27120:12.36080:2.61960:2.08560:10.94960:1.96480:2.97960:10.96520:-1.02360:3.95440:9.66040:0.31080:3.91720:9.56920:1.28360:3.55480:10.2680:1.05720:3.62080:11.34520:1.40240:3.40760:11.13120:3.06520:0.99720:10.19840:3.25920:0.04560:10.52760:3.45160:0.04520:12.57440:3.2320:-0.10560:9.27720:3.00360:1.33800:10.05720:3.0200:1.5120:9.91560:2.86480:1.83760:10.04760:1.90320:3.18560:10.11280:1.56560:3.47160:9.97840:1.20320:3.73160:9.67680:1.15800:3.9520:9.29640:0.68560:3.91480:8.95760:1.17360:3.96560:8.46080:1.35920:3.96120:8.3480:1.64680:4.03880:8.75560:1.62480:3.81880:9.48560:2.42920:3.42640:9.53360:2.77520:2.49800:9.88920:3.48040:1.25920:9.29960:3.26680:0.92760:9.49240:3.34160:0.71760:9.27240:3.41120:0.14360:8.37400:3.40640:-0.01760:8.12200:3.20600:0.08440:6.77240:3.21160:0.15520:7.06600:3.45640:0.35040:8.46520:3.55120:0.79640:8.84320:3.53400:1.09240:8.90680:3.54120:1.30080:9.06120:3.32280:2.20160:9.29960:2.6440:3.43120:9.31640:2.59400:3.44560:9.07080:2.11920:3.91720:8.87800:1.98480:3.93120:8.61560:1.69880:3.90640:8.31960:1.74920:3.75960:8.2520:3.27760:0.29120:7.74280:3.33000:0.51520:8.20440:3.46320:0.74840:8.57120:3.47280:1.14240:8.85720:3.4600:1.4080:9.00240:3.26240:2.1880:9.20360:2.34200:3.44480:8.80960:2.54840:3.1880:8.94720:1.88120:3.68600:8.40240:1.60880:3.87160:8.11360:1.41680:3.95280:7.54480:1.36120:3.92520:6.6120:1.60880:3.37880:5.64200:1.87360:2.77960:5.23840:2.08440:2.26560:5.13920:2.34080:1.68280:5.24440:2.62520:1.11920:5.360:2.52640:1.29440:5.19440:2.28640:1.85360:4.96360:1.95320:2.46160:4.87680:1.29520:3.83040:6.18280:0.54440:3.84640:6.3080:0.50600:3.92440:7.34240:0.96760:3.93680:8.24640:0.32240:3.90680:8.76760:-0.97480:3.88840:9.01240:-0.28080:3.8520:7.74280:-0.89160:3.92160:6.6560:-0.64560:3.85360:6.21000:3.32880:-0.09640:6.43560:3.1480:0.27160:6.44760:2.84240:0.78560:5.74560:2.78920:0.9120:5.44760:2.79960:0.76040:4.63960:3.00360:0.76680:5.37120:2.62280:1.06080:5.04040:3.67560:-0.09280:6.17560:4.16880:0.33880:5.84640:3.38320:0.54560:5.80280:3.50360:0.65480:5.45640:3.40560:0.70600:5.31720:3.36240:0.69160:4.87080:3.34840:0.49440:4.36160:3.36320:0.0960:4.03320:2.86560:0.38760:4.06240:2.99800:0.26440:4.08040:2.9040:-0.09760:3.82880:4.52200:0.12640:5.84760:4.48680:0.38960:5.6240:4.73520:0.42920:5.36560:4.79800:0.45360:5.22560:4.80600:0.45880:4.83240:4.73760:0.22760:4.39280:4.74960:-0.10760:4.25160:5.11000:0.04280:5.22560:4.96600:0.31000:5.2360:4.99880:0.30320:4.9840:4.93120:0.34440:4.84480:5.07680:-0.0240:4.75560:2.67760:0.88080:3.82840:2.76360:0.31320:3.39280:2.65400:0.94440:3.5040:2.76120:0.23320:2.60280:2.74720:-0.64040:2.60200:1.79440:2.6160:4.26080:2.45840:1.49720:4.32600:2.42440:1.69560:3.16280:1.33560:3.05680:4.65680:2.79680:-0.64080:2.18480:2.87280:0.42360:1.73920:2.42320:1.92320:1.97560:1.9920:2.68240:2.25680:1.36240:3.16120:3.25960:0.45760:3.85760:3.05920:2.84960:0.00440:1.12280:2.61480:1.48360:1.31120:1.91480:2.760:1.74240:0.8360:3.63840:2.36160:2.24080:0.77800:0.95560:2.50200:1.37800:1.14960:1.95920:2.29800:1.3800:1.2840:2.65000:1.55560:0.94560:3.48520:2.12840:-0.05320:3.92040:2.60360:-0.95640:3.83480:2.82920:0.62360:3.520:5.10520:-1.09000:3.87800:5.29080:-0.9400:4.28360:3.89040:-0.00080:3.99040:3.6160:-0.54200:4.23720:3.1000:-1.12480:3.92560:6.11840:-1.68960:4.17040:4.680:-1.83360:4.53720:3.54080:-1.5440:4.38920:3.52040:-1.66320:4.29560:3.44320:-2.19920:4.48120:3.38120:-2.00240:4.06560:3.27560:-2.20080:4.16240:2.96520:-1.40920:3.42880:2.42600:-0.6560:2.840:2.14320:-0.03360:2.06680:1.95560:0.42960:1.19640:1.84960:0.65080:0.08920:1.78720:-2.520:4.21760:3.04440:-2.30960:4.05400:2.83320:-2.3920:3.3360:2.40:-1.72440:3.10720:2.08600:-1.08720:3.03280:2.04360:-0.20920:1.99960:1.77160:-0.66040:1.34760:1.32960:0.08920:1.12840:1.59840:0.07680:0.07000:1.47480:-0.58240:1.74360:1.52320:-1.0600:2.19840:1.55280:-1.27000:2.48280:1.67040:-2.04880:2.93760:1.97240:-3.20200:3.08240:2.25920:-2.79680:3.43120:2.65920:-3.120:3.86480:3.28280:-3.32720:3.54440:3.29320:-3.08280:4.09680:3.70600:-2.12480:4.48840:4.14320:-1.93000:4.09040:4.880:-1.27560:-0.0440:0.11960:-1.09760:1.19880:0.92440:-1.51480:1.78240:0.90040:-2.32600:1.79120:0.21680:-2.27040:2.51160:1.23160:-3.08600:2.81720:1.55480:-3.95520:2.60760:1.03520:-0.6200:3.59880:2.56520:0.39800:2.98280:2.0240:0.79120:2.80560:1.8080:0.55160:1.78880:2.11080:1.18720:0.2960:1.79480:-1.57960:4.13440:5.86720:-1.55440:4.27560:6.6160:-1.67360:4.36720:6.47400:-1.72440:4.52640:6.89840:-2.0680:5.07000:7.00280:-2.18760:5.18480:6.83760:-2.22360:5.22280:6.38720:-2.07320:4.96440:6.17840:-2.02680:4.77120:6.25440:-2.05560:4.91840:6.33960:-1.91360:4.6880:6.68720:-1.91840:4.760:6.76880:-1.78960:4.59720:6.7680:-1.82440:4.47320:5.87720:-1.85720:4.50640:5.61920:-1.97320:4.72960:5.68560:-1.9360:4.61800:6.33160:-2.06920:4.02600:5.39000:-1.71680:3.97720:5.3000:-2.20160:3.95160:5.25880:-2.07720:4.25800:5.48040:-2.12080:4.89520:5.68520:-2.34480:4.93360:5.61440:-2.34680:5.05680:5.75520:-2.27920:5.25760:6.77920:-2.41400:5.15440:6.92840:-2.28680:5.07520:7.08080:-1.83480:4.4880:7.22640:-1.79680:4.70760:7.1800:-1.55400:4.04240:6.9480:-2.3720:4.17720:5.6240:-2.35840:3.91480:5.56280:-2.35720:4.52280:5.53880:-2.38360:4.68760:5.55440:-2.66560:4.7400:5.97760:-2.60760:5.17280:6.43080:-2.49800:4.94520:6.8880:-2.36680:4.5080:6.92840:-2.0160:4.13680:6.97520:-1.95800:3.88600:6.94960:-2.39760:4.38600:6.81920:-2.4920:4.24880:6.40480:-2.65640:4.53480:6.2080:-2.49160:4.28480:5.79480:-2.40480:3.87520:5.65040:-2.4720:4.14120:5.80120:-2.46840:4.04680:6.22760:-2.42840:4.040:6.40480:-2.22360:3.85680:6.78120:-3.03400:3.68960:4.88880:-2.62280:3.71760:5.76120:-2.61280:3.70040:6.56600:-2.61000:3.71840:5.63400:-2.62080:3.560:7.7480:-2.81320:3.67240:10.70960:-1.94320:3.63880:8.35560:-2.14920:4.17120:12.24880:-2.91560:4.43160:14.02280:-1.85680:3.87880:6.97520:-4.11080:3.59440:13.1760:-4.95560:2.96280:13.52640:-3.89240:3.43800:11.95440:-4.10840:2.58480:8.2880:-4.07720:2.50680:7.44640:-3.36560:3.2440:7.19920:-3.59080:3.27560:4.59280:-4.27840:2.24920:4.55440:-3.80080:2.99440:3.22040:-5.54440:1.94840:1.76600:-4.95120:2.35760:1.15040:-5.21840:2.61480:13.27320:-5.55480:1.49480:12.7920:-5.17040:1.43920:10.95960:-4.45000:1.95800:6.7000:-4.46640:2.02560:7.54160:-4.62960:1.77000:4.22720:-4.99520:1.11920:4.06160:-5.17640:1.30360:3.46240:-5.55000:1.1360:2.92160:-4.85960:0.71280:7.68960:-4.81800:0.62760:6.14760:-4.89000:0.60960:4.85480:-5.14280:0.6480:4.07080:-5.69440:0.61960:3.06280:3.55360:0.60320:14.95480:3.41840:-0.06520:15.71560:3.29840:1.4320:15.50760:2.51840:1.82880:15.06480:2.94880:2.28960:14.94720:0.61760:4.18760:15.30200:-0.5920:4.6240:14.96920:-0.4320:3.84960:14.72520:-0.97960:3.77520:14.60840:-2.62080:4.42200:14.66960:-2.11840:3.86920:14.35320:-2.73680:3.43560:14.38560:-4.34520:3.46600:14.47720:-3.68240:3.14200:14.2600:-4.10160:2.73560:14.43400:-5.59760:2.06040:14.5480:-4.76760:1.8920:14.27880:-5.87040:-0.09640:14.70040:-4.1760:0.43640:14.65480:-3.79440:-0.07400:14.73920:-4.17120:0.68680:14.63840:-4.51120:1.4440:14.85440:-4.34040:1.88160:14.32440:-3.93440:1.77920:14.4440:-3.56760:2.49800:14.90320:-3.68720:2.79040:14.51360:-3.21720:3.0840:14.33720:-2.97840:2.31080:15.00560:-2.96920:1.60520:14.67040:-2.03560:2.5800:14.63720:-1.61680:3.46600:14.97560:-0.9960:3.32840:14.69400:-1.26720:2.77280:14.81520:-0.37480:3.55400:14.760:0.13960:3.19880:14.94720:-0.29120:2.98160:15.19120:1.45800:1.73080:15.38720:1.94720:1.34280:15.04520:2.24560:1.07160:15.08480:1.5960:0.65080:15.71040:0.92600:0.7880:15.13680:1.79640:-0.06720:15.43960:0.87400:-0.06360:15.67640:0.63720:0.87480:15.11520:0.39000:1.44160:15.63320:-2.95000:-0.07680:15.3400:-2.51160:0.30720:14.95320:-2.03080:0.17440:14.94360:-2.10680:1.47280:15.22960:-1.81160:1.88240:14.7880:-1.28720:0.91720:15.02760:-0.24480:0.01280:15.11960:0.30560:-0.06360:15.10360:-3.48640:0.92040:15.08640:-2.73560:0.75320:14.87120:-3.38760:0.10200:14.80920:-1.00840:1.99640:15.40960:-1.1720:2.57320:14.87800:-0.55000:2.29240:15.02160:0.55560:2.6080:15.360:1.53120:1.91040:15.38480:1.7840:0.99440:15.60320:2.23920:1.83880:15.02360:0.09080:2.19720:15.0600:-0.51520:2.92560:15.16440:-0.13960:1.49000:15.64160:-3.51920:1.73720:14.53480:-3.58040:2.3720:14.89680:-3.79520:0.49760:14.75360:-5.82760:1.06200:14.08560:-5.01840:0.89360:14.33440:4.99320:-0.15080:5.64640:1.82320:3.49920:14.73360:2.3360:2.14160:14.87560:1.89320:2.55920:14.94200:0.65360:3.21360:15.01080:-2.51240:0.56280:0.07840:-5.61760:0.44600:1.54920:-2.77080:1.08720:0.2040:-3.35080:2.21920:0.24600:-4.06600:2.32160:0.42920:-3.09440:1.70720:0.21960:3.66160:-1.05840:14.72080:2.91440:-2.68720:13.97520:3.35640:-1.56240:13.60240:2.05640:-3.86520:14.35960:1.53320:-4.25640:14.02440:1.53880:-4.09800:13.320:0.34920:-4.44880:12.360:-1.37800:-5.01520:13.67680:-0.39440:-4.76760:13.12320:3.22920:-1.63440:12.95640:2.11920:-3.34520:12.1560:1.39480:-3.9000:11.85480:0.92880:-4.1040:11.04520:0.18240:-4.28760:8.55800:-1.2120:-4.4720:11.12920:1.42760:-3.91040:10.27080:2.01400:-3.38360:11.15360:2.51840:-2.79960:10.50320:2.22760:-3.15240:11.40680:3.16960:-1.33240:11.18840:3.31000:-0.88200:11.80680:3.62680:0.01640:14.25480:3.28840:-0.33800:10.35680:3.25360:-0.87040:9.3760:3.04080:-1.82720:9.91280:2.74040:-2.41880:10.22360:2.9040:-2.24960:10.01000:1.95680:-3.70240:9.95680:1.46560:-3.97320:9.91120:1.84760:-4.29400:9.19520:0.74080:-4.30480:9.14920:1.0480:-4.23400:9.5240:0.67640:-4.3640:6.97120:1.13760:-4.36880:7.87720:0.77400:-4.32680:8.92080:1.1560:-4.39280:8.71760:1.27760:-4.41280:8.94240:2.30760:-4.09240:9.3000:2.60120:-3.30640:9.82120:3.00480:-2.39880:9.84640:3.47480:-1.94960:9.40120:3.12560:-1.95680:9.78440:3.37520:-0.65560:8.83160:3.48760:-1.22360:9.12960:3.44480:-0.6080:8.43680:3.24280:-0.56560:7.23960:3.42240:-0.49080:8.06880:3.40320:-0.37640:7.7040:3.45520:-0.74040:8.37240:3.50280:-1.05480:8.76720:3.49120:-2.15280:9.35160:3.55720:-1.60760:9.09840:3.09040:-3.12440:9.45920:2.67560:-3.74160:9.1160:2.39120:-4.04840:8.95040:1.82320:-4.42880:8.59720:1.97400:-4.40600:8.73240:1.77080:-4.19880:8.31040:3.34120:-0.78480:7.98440:3.36840:-1.05000:8.39320:3.45960:-1.24440:8.64320:3.36240:-1.18960:8.52760:3.46440:-1.81880:9.00040:3.26360:-2.59840:9.20240:2.49160:-3.720:8.91760:2.06240:-4.02080:8.56920:1.93040:-4.12360:8.46360:1.79520:-4.12720:8.28840:1.49400:-4.3080:7.4720:1.63760:-4.2720:8.08520:1.37920:-4.3560:7.12280:1.47160:-4.10880:6.12960:1.73760:-3.54360:5.44960:2.36160:-2.08880:5.15440:2.20320:-2.38080:5.19800:2.63440:-1.49240:5.44720:2.23680:-2.30280:4.70520:2.01480:-2.7760:5.00480:2.03480:-2.65920:4.76880:1.16680:-3.72320:5.2440:1.33320:-4.01360:5.90600:0.88880:-3.88360:5.47520:1.38360:-4.38720:7.82360:-0.53760:-4.22680:8.16240:-0.1320:-4.16880:5.95840:3.36840:-0.27480:6.34960:3.32160:-0.58360:6.20200:3.16840:-0.64040:6.39000:3.2240:-0.85640:6.03760:2.760:-1.33000:5.45880:3.15800:-0.9760:5.86680:3.00640:-1.1720:5.32040:2.62280:-1.47040:5.04040:4.17120:-0.31680:6.06200:3.42640:-0.87720:5.91560:3.67480:-0.67880:6.01160:4.16520:-1.03280:5.40760:4.0440:-1.11160:5.19280:4.07240:-1.09240:4.82520:4.01440:-0.91080:4.38360:4.0080:-0.54200:4.09120:2.80760:-1.10920:4.480:2.77720:-1.25920:4.90440:2.9920:-0.74640:4.15040:2.9920:-0.50720:3.96720:4.81680:-0.30320:5.78200:4.79560:-0.61840:5.60:4.44880:-1.0240:5.24960:4.52760:-0.85800:5.47440:4.73280:-0.87760:4.69120:4.73760:-0.63640:4.39280:4.75480:-0.30200:4.24560:5.11240:-0.45280:5.22600:4.96320:-0.72200:5.20320:5.12280:-0.48280:5.11960:4.8920:-0.74840:4.73640:5.09160:-0.34320:4.79560:2.63920:-1.41400:4.76360:2.57000:-1.61440:3.48160:2.82880:-0.35520:3.63440:2.24240:-2.28560:4.32280:2.46840:-1.96880:2.77440:2.20280:-2.38240:3.61320:2.23400:-2.45560:2.84440:1.17840:-3.67840:3.58240:1.13720:-3.66960:4.78120:2.75320:-1.53880:1.90600:1.6680:-3.24960:3.03160:2.18760:-2.66040:2.49720:2.91800:-0.63960:1.38920:2.81560:-0.43080:1.05920:2.69040:-1.84040:1.55920:1.98960:-3.10440:1.96880:0.17320:-4.41880:2.82320:2.23520:-1.18840:0.94320:2.40680:-1.9960:1.21520:2.03480:-1.72200:1.03440:1.05880:-3.51920:1.77400:0.72920:-3.9960:2.24640:0.62440:-3.69880:1.9640:-1.57040:-4.42280:3.27000:-0.28120:-4.15840:5.73160:-0.32520:-4.2320:4.81960:-0.07080:-4.48040:3.42880:-1.05400:-4.72040:3.99440:-1.32760:-4.7760:3.54600:-0.20560:-4.5440:3.18160:-1.10160:-4.36360:5.02680:-1.62120:-4.51520:4.87520:-1.65760:-4.82040:3.55800:-2.0360:-4.9800:3.55440:-2.3480:-4.76880:3.18360:-2.16240:-4.68280:3.08920:-2.1680:-4.35040:2.80200:-1.41040:-3.83360:2.42960:-0.65840:-3.24720:2.14560:-0.03720:-2.47320:1.96080:0.54880:-1.67240:2.11440:0.70680:-1.08600:2.01960:-2.90840:-4.5960:3.25000:-2.7680:-4.26960:2.89800:-1.5480:-3.63840:2.15640:-1.40520:-3.18600:1.88680:-1.21440:-3.51640:2.08480:-0.71400:-2.69040:1.72440:-0.17760:-1.91480:1.60640:0.12280:-1.05760:1.54920:-0.4920:-1.04720:1.27560:-0.78920:-1.71920:1.25760:-0.65320:-2.27840:1.54240:-0.99120:-1.99360:1.25880:-1.27080:-2.89240:1.67120:-2.98880:-3.3320:1.75480:-2.94080:-3.69080:2.55480:-3.07800:-3.45520:2.16280:-3.000:-4.120:2.9440:-3.33120:-4.17920:3.62240:-3.18600:-4.37560:3.77080:-3.48200:-3.98200:4.19120:-2.24360:-4.9280:4.11640:-2.48360:-4.40320:4.80560:-1.41280:-0.960:0.13320:-1.01800:-1.37800:0.92560:-1.64480:-1.21400:0.0280:-2.14680:-2.23080:0.42280:-1.87920:-2.69840:1.17680:-2.53000:-2.37120:0.27040:-4.44200:-2.99640:1.2640:-0.85400:-4.0600:2.71000:0.36240:-3.58440:2.03240:-0.44440:-3.37520:2.52200:1.02720:-2.94120:1.63960:0.87960:-1.54560:1.98320:0.77760:-2.22040:1.9400:1.1920:-0.51400:1.80560:-1.67960:-4.52520:5.5480:-1.58080:-4.72480:6.67400:-1.78360:-5.12560:7.09440:-1.62600:-4.84920:6.94520:-1.98960:-5.25280:6.78320:-2.25280:-5.67080:6.44520:-2.06120:-5.2520:6.06040:-2.06960:-5.30520:6.5720:-2.02880:-5.19960:6.26640:-1.89560:-5.11520:6.73480:-1.78280:-4.94880:6.77400:-1.88840:-4.97120:5.60920:-1.79120:-4.80360:5.85840:-2.04280:-5.28240:5.76240:-1.97040:-5.06240:6.080:-1.98920:-5.0920:6.26680:-1.67480:-4.79120:6.52080:-1.76760:-4.81320:6.04480:-1.97880:-4.41520:5.11640:-1.89760:-4.56040:5.43000:-2.15680:-4.97360:5.47640:-2.0440:-5.19240:5.61040:-2.26240:-5.10920:5.51040:-2.4920:-5.67920:6.23120:-2.3040:-5.69640:6.57040:-2.52760:-5.68120:6.44920:-1.96840:-5.18120:7.24840:-1.72320:-4.6520:7.10960:-1.60640:-4.78200:7.04960:-1.43680:-4.40:6.90320:-2.26680:-4.53360:5.52680:-2.22760:-4.39440:5.42200:-2.31400:-4.89920:5.50960:-2.42320:-4.83280:5.66440:-2.59760:-5.55960:6.18760:-2.50680:-5.29040:5.75040:-2.58320:-5.11280:6.63640:-2.06040:-5.05920:7.21760:-2.39800:-5.27040:7.01560:-1.95440:-4.84360:7.19840:-2.19800:-4.62760:6.90600:-2.43960:-4.60080:6.50600:-2.52680:-4.91040:6.68040:-2.60240:-4.86200:5.93960:-2.59040:-4.88080:5.84480:-2.44880:-4.56360:5.74880:-2.42360:-4.28520:5.69440:-2.45240:-4.28760:6.23560:-2.36520:-4.42640:6.55280:-2.11680:-4.28640:6.85520:-2.30840:-4.33720:5.33680:-3.02960:-3.96040:6.31000:-2.66120:-4.12960:5.53280:-2.43880:-4.21680:5.52440:-2.88560:-3.8960:7.51880:-2.03080:-4.16520:7.20160:-2.18120:-4.16320:7.08920:-2.92040:-4.08280:10.95000:-2.32560:-4.88280:13.56960:-3.09920:-4.30280:12.22200:-1.67360:-4.36520:7.01920:-4.72520:-3.74520:14.29360:-3.80840:-3.87680:11.91280:-3.7360:-3.68840:11.01880:-3.54440:-3.55160:9.33960:-4.13280:-2.8480:6.70280:-3.99000:-3.12880:7.81000:-4.200:-2.79560:5.78560:-4.31080:-2.68120:3.94280:-4.21760:-3.04440:2.49480:-4.23840:-2.84160:3.55360:-5.95080:-2.04120:14.30160:-5.39320:-2.74160:13.880:-4.97760:-2.73240:11.85680:-5.00120:-1.90120:9.95240:-4.95920:-1.78760:9.37160:-4.70160:-1.63160:5.760:-4.71680:-1.71280:7.29760:-4.77040:-1.63960:4.61840:-5.84760:-1.90680:1.99320:-5.7000:-1.3160:12.90080:-5.360:-0.3960:11.17000:-5.8440:-0.29000:13.11280:-5.360:1.02520:11.17000:-4.840:-1.01920:5.78360:-4.98640:-1.05000:4.46320:-5.34240:-1.05160:3.66680:-6.22120:-0.94680:2.26320:3.55280:-0.5120:15.61040:3.43440:-0.33800:15.72080:2.98040:-1.25680:14.96560:3.02560:-2.15080:15.5920:2.97960:-2.72200:14.95000:0.05240:-4.13640:14.84200:-0.18440:-4.95560:14.5920:-0.4320:-4.25920:14.72520:-0.98560:-4.9440:14.94840:-2.07640:-4.98280:14.26200:-2.11840:-4.27840:14.35320:-3.01560:-4.5360:14.71920:-3.92840:-4.22200:14.04240:-3.68240:-3.55160:14.2600:-4.5360:-3.47920:14.59640:-5.22600:-2.90520:14.11920:-4.76760:-2.30120:14.27880:-5.1880:-0.32160:14.46560:-4.4240:-0.45280:14.9440:-3.79440:-0.33560:14.73920:-4.41040:-1.45880:14.9080:-4.77280:-1.93720:14.54880:-4.34040:-2.29120:14.32440:-4.18520:-1.8520:14.87920:-4.13440:-2.62520:14.33560:-3.68720:-3.19960:14.51360:-3.16880:-3.18480:14.90040:-2.32840:-2.55000:14.66440:-2.96920:-2.01480:14.67040:-1.92880:-3.56160:14.98920:-1.62720:-4.12160:14.44880:-0.9960:-3.73760:14.69400:-1.67240:-3.48520:15.06440:-0.4840:-3.69760:15.08480:0.13960:-3.60840:14.94720:-0.20200:-2.92040:14.99560:1.1400:-1.84920:14.99040:1.94720:-1.75240:15.04520:2.05800:-1.29880:15.60240:1.41280:-0.52480:15.45840:0.92840:-1.19400:15.11160:2.11440:-0.34240:15.70880:0.82040:-0.76920:15.19960:0.32520:-1.74640:15.64520:0.76360:-1.35360:15.00440:-3.30320:-0.33280:14.84080:-2.51160:-0.71640:14.95320:-2.06160:-1.33800:15.30720:-2.50320:-1.93120:14.75160:-1.81160:-2.2920:14.7880:-1.79320:-1.42760:15.32840:-0.74840:-0.42240:15.67280:0.30560:-0.34600:15.10360:-3.53880:-1.63160:14.61680:-3.13640:-1.31480:15.1440:-3.38760:-0.51160:14.80920:-0.88680:-1.87240:15.05720:-1.29160:-2.68480:15.31360:-0.55000:-2.70160:15.02160:0.34600:-3.26840:15.01760:1.11440:-2.27360:15.02440:1.7840:-1.40320:15.60320:1.90360:-2.17280:15.38240:0.63720:-2.79360:15.36560:-0.51520:-3.33480:15.16440:-0.3320:-2.29920:15.11320:-3.74320:-2.39880:14.45880:-3.58040:-2.78120:14.89680:-3.61640:-0.51440:14.77080:-5.80120:-1.92640:14.54640:-5.01840:-1.30320:14.33440:4.93120:-0.25800:4.39320:5.15400:-0.09040:4.96920:4.98920:-0.41920:5.56720:1.11320:-4.44320:15.2520:2.22960:-2.69520:14.98440:2.80080:-2.98640:14.88760:0.64080:-3.29400:15.02640:-3.3440:-0.96200:0.43000:-2.41400:-0.35320:0.14680:-3.26600:-1.27640:0.35320:-2.72640:-1.51320:0.15640:-3.26840:-2.53120:0.2160:-2.63800:-2.21880:0.02720:-0.42920:4.56120:13.83680:-0.83880:4.75720:14.2600:-0.30040:4.0520:14.71360:-0.18440:4.54600:14.5920:-0.30440:4.17840:12.4160:-0.83240:4.06560:11.18080:-0.07160:3.93800:9.51320:-1.02360:3.95440:9.66040:-1.14920:4.03760:10.71400:0.5040:3.86240:9.88560:0.32240:3.90680:8.76760:-1.02360:3.95440:9.66040:-0.97920:3.79840:8.37840:3.24960:0.22880:7.58080:1.51680:3.880:7.44160:3.22920:1.93480:9.12280:1.64240:3.29480:5.73040:2.71440:0.90040:5.63320:-0.28080:3.8520:7.74280:-0.28080:3.8520:7.74280:-0.89160:3.92160:6.6560:-0.13240:3.75480:5.95840:-0.39960:3.78360:5.55640:-0.16160:4.14120:3.23320:-0.82440:4.32240:3.53920:-0.16160:4.14120:3.23320:-0.43280:4.11080:2.89000:-0.82440:4.32240:3.53920:-0.27240:4.19560:3.04880:-0.79160:3.36840:2.67480:-0.6200:3.59880:2.56520:-0.65560:3.88200:2.74080:-1.09120:4.37880:3.59040:-0.73920:4.01920:4.45160:-1.16560:3.93240:5.16120:-0.9400:4.28360:3.89040:-0.9400:4.28360:3.89040:-1.09000:3.87800:5.29080:-0.11760:2.7520:2.39480:-1.24560:3.41080:2.71960:-0.51680:2.84240:2.42480:-0.34720:2.48360:2.04760:-0.71400:2.28160:1.72440:-0.71400:2.28160:1.72440:-0.58240:1.74360:1.52320:-0.48040:-0.36920:1.23360:-1.09760:1.19880:0.92440:-0.95960:0.8760:0.91240:-0.66040:1.34760:1.32960:-0.4320:3.84960:14.72520:-0.66120:3.4480:14.70640:-0.66120:3.4480:14.70640:-0.76600:2.73360:14.88920:-0.60360:3.13480:15.09960:-0.88680:1.46320:15.05720:-0.55000:2.01840:15.06440:-0.77520:0.66640:15.13120:-0.24480:0.01280:15.11960:-0.6080:0.93560:15.12960:-0.66840:1.3360:15.10960:3.11480:-0.63840:6.62480:1.91360:-4.04360:8.43480:3.22920:-2.34440:9.12280:1.64240:-3.70440:5.73040:2.71440:-1.31000:5.63320 nln=text.GetCharacter (13)+Text.GetCharacter(10) GraphicsWindow.Title="Wait... 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,10,10,10, -1, -1, -1, "","","") ' The following line could be harmful and has been automatically commented. ' 'cc=File.ReadContents ("e:\mss1.txt") ll=LDText.Split (cc,":") For x=1 To Array.GetItemCount (ll) Step 3 'll=ldtext.Split (ln[x] ":") pp1= ll[x] pp2= ll[x+1] pp3= ll[x+2] 'tx=text.Append (tx pp1+":") 'tx=text.Append (tx pp2+":") 'tx=text.Append (tx pp3+":") ss=LD3DView.AddSphere (view3D .153 10 LDColours.HSLtoRGB(x/30 1 .6) "D") LD3DView.TranslateGeometry (view3D ss pp1 pp3 pp2) EndFor ' The following line could be harmful and has been automatically commented. ' 'File.WriteContents ("e:\smm.txt" tx) GraphicsWindow.Title=(x-1)/3+" nodes of Bart Simson's skull LD3DView.AutoControl ("true" "true", -1 .5) ya=15 r35=20 While "true 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 EndWhile End>RGJ318.sb< Start>RGJ775.sb< 'Drag_Bar Initializing' Drag_bar_init["value"] = 50 Drag_bar_init["width"] = 100 Drag_bar_init["height"] = 10 Drag_bar_init["top"] = 10 Drag_bar_init["left"] = 10 Drag_bar_init["slider_color"] = "Red" Drag_bar_init["bar_color"] = "Black" 'Do not Change the arrays below' Dragbar["up"] = 0 '<-- Do not change' Drag_bar_init["value2"] = 50'<-- Do not change' Drag_bar_init["minimum"] = 0'<-- Do not change' Drag_bar_init["maximum"] = 100'<-- Do not change' 'End Drag_Bar Initializing' 'GraphicsWindow Initializing' GraphicsWindow.Show() GraphicsWindow.Height = 200 GraphicsWindow.Width = 500 'End GraphicsWindow Initializing' 'Drag_Bar Output' 'This wil be the value of the Drag_bar' Dragbar["output"] = Dragbar["output"] 'End Drag_Bar Output' 'Building the Drag-Bar' Sub install Dragbar["temp_color"] = GraphicsWindow.PenColor GraphicsWindow.PenColor = Drag_bar_init["slider_color"] Dragbar["Ole1"] = Shapes.AddLine(Drag_bar_init["left"]+Drag_bar_init["value"],Drag_bar_init["top"]+Drag_bar_init["Height"]/10,Drag_bar_init["left"]+Drag_bar_init["value"],Drag_bar_init["top"]+Drag_bar_init["height"]-Drag_bar_init["Height"]/10) GraphicsWindow.PenColor = Drag_bar_init["bar_color"] Dragbar["Ole2"] = Shapes.AddLine(Drag_bar_init["left"],Drag_bar_init["top"]+Drag_bar_init["height"]/2,Drag_bar_init["left"]+Drag_bar_init["width"],Drag_bar_init["top"]+Drag_bar_init["height"]/2) Dragbar["Ole3"] = Shapes.AddLine(Drag_bar_init["left"],Drag_bar_init["top"],Drag_bar_init["left"],Drag_bar_init["top"]+Drag_bar_init["height"]) Dragbar["Ole4"] = Shapes.AddLine(Drag_bar_init["left"]+Drag_bar_init["width"],Drag_bar_init["top"],Drag_bar_init["left"]+Drag_bar_init["width"],Drag_bar_init["top"]+Drag_bar_init["height"]) GraphicsWindow.PenColor = Dragbar["temp_color"] Endsub 'End Building the Drag-Bar' Sub down if(GraphicsWindow.MouseX > Drag_bar_init["value"]+Drag_bar_init["left"] -5) And (GraphicsWindow.MouseX < Drag_bar_init["value"]+Drag_bar_init["left"] +5) And (graphicswindow.MouseY > Drag_bar_init["top"]) And (graphicswindow.MouseY < Drag_bar_init["top"] + Drag_bar_init["Height"]) then Drag_bar_init["up"] = 1 endif EndSub Sub up Drag_bar_init["up"] = 0 EndSub Sub move If(Drag_bar_init["up"] = 1) And (GraphicsWindow.MouseX > Drag_bar_init["left"]) And (GraphicsWindow.MouseX < Drag_bar_init["left"] + Drag_bar_init["width"]) then Drag_bar_init["value"] = GraphicsWindow.MouseX - Drag_bar_init["left"] endif If(Drag_bar_init["up"] = 1) And (GraphicsWindow.MouseX > Drag_bar_init["left"] + Drag_bar_init["width"] ) Then Drag_bar_init["value"] = Drag_bar_init["maximum"] endif If(Drag_bar_init["up"] = 1) And (GraphicsWindow.MouseX < Drag_bar_init["left"]) Then Drag_bar_init["value"] = Drag_bar_init["minimum"] endif Shapes.Move(Dragbar["Ole1"],Drag_bar_init["value"]-Drag_bar_init["value2"],0) EndSub 'SAMPLE CODE pres 5F to test this code' GraphicsWindow.MouseDown = mousedown GraphicsWindow.MouseUp = mouseup GraphicsWindow.MouseMove = mousemove install() Sub mousedown down() 'Your code for Mouse Down' EndSub Sub mouseup up() 'Your code for Mouse Up' EndSub Sub mousemove move() 'Your code for Mouse Move' EndSub 'Output wil be:' "Drag_bar_init["value"]" 'Can be used like this:' '(Make this code under work to see sample of' 'While "True" 'This is a loop' 'textwindow.WriteLine(Drag_bar_init["value"]) 'EndWhile End>RGJ775.sb< Start>RGJ873.sb< player() graphicwindow() bunker() Createmissiles() 'Graphic Window Sub graphicwindow GraphicsWindow.Title = "V-Space Invader" gw = 700 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp keyLeft = 0 keyRight = 0 keySpace = 0 key = 0 GraphicsWindow.BackgroundColor = "black" 'TitleLogo = Shapes.AddImage("http://i61.tinypic.com/14w4r5k.png") 'Shapes.Move(TitleLogo,gw - 468,gh - 400) 'GraphicsWindow.DrawText(10, gh - 20, "Loading...") 'Program.Delay(5000) 'Shapes.Remove(TitleLogo) 'Space GraphicsWindow.DrawImage("http://i58.tinypic.com/t66qeg.png",0,0) For y = 1 To 1 writeText[y] = Shapes.AddText("Lives: "+Lives+" Score: "+Score) Shapes.Move(writeText[y], 30,gh-590) EndFor EndSub 'Player Sub player player = Shapes.AddImage("http://i62.tinypic.com/2nhkowg.png") playerX = 300 playerY = 535 Lives = 3 Score = 0 speed = 3 HP = 100 'ship starts in the mid bottom of the map Shapes.Move(player,playerX,playerY) EndSub 'Invader Sub invader InvaderImage = Shapes.AddImage("http://i58.tinypic.com/34pe0yb.png") EndSub 'Bunkers Sub bunker Bunker1 = Shapes.AddImage("http://i58.tinypic.com/egz90o.png") Bunker2 = Shapes.AddImage("http://i58.tinypic.com/egz90o.png") Bunker3 = Shapes.AddImage("http://i58.tinypic.com/egz90o.png") Shapes.Move(Bunker1,100,410) Shapes.Move(Bunker2,300,410) Shapes.Move(Bunker3,500,410) For x = 1 To 3 writeText[x] = Shapes.AddText("HP: " + HP) Shapes.Move(writeText[x], 120 + ((x-1)*200), 415) EndFor EndSub While key = 0 processKey() Shapes.Move(player,playerX-25,playerY-25) Program.Delay(10) EndWhile Sub OnKeyDown lastKey = GraphicsWindow.LastKey If (lastKey = "Left") Then keyLeft = 1 ElseIf (lastKey = "Right") Then keyRight = 1 ElseIf (lastKey = "Space") Then keySpace = 1 EndIf EndSub Sub OnKeyUp lastKey = GraphicsWindow.LastKey If (lastKey = "Left") Then keyLeft = 0 ElseIf (lastKey = "Right") Then keyRight = 0 ElseIf (lastKey = "Space") Then keySpace = 0 EndIf EndSub Sub processKey If (keyLeft = 1) Then playerX = playerX-speed EndIf If (keyRight = 1) Then playerX = playerX+speed EndIf If (keySpace = 1) Then spaceDown = "true" While key = 0 start = Clock.ElapsedMilliseconds If spaceDown = "true" Then FireMissile() spaceDown = "False" EndIf Updatemissiles() delay = 20 - (Clock.ElapsedMilliseconds - start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile EndIf 'Check for hitting edges If (playerX < 0) Then playerX = 0 EndIf If (playerY < 0) Then playerY = 0 EndIf EndSub Sub Createmissiles missileImage = ImageList.LoadImage("http://i61.tinypic.com/vxn1xy.png") 'missile dimensions we use the half width and height missileWidth = ImageList.GetWidthOfImage(missileImage)/2 missileHeight = ImageList.GetHeightOfImage(missileImage)/2 nummissile = 50 For i = 1 To nummissile missileData["image"] = Shapes.AddImage(missileImage) missileData["Xpos"] = missileWidth + Math.GetRandomNumber(gw-2*missileWidth) missileData["Ypos"] = gh-missileHeight missileData["Xvel"] = 0 missileData["Yvel"] = -5 missileData["Status"] = 0 Shapes.HideShape(missileData["image"]) missiles[i] = missileData EndFor EndSub Sub Updatemissiles For i = 1 To nummissile missileData = missiles[i] 'get current missile array If (missileData["Status"] = 1) Then 'Reposition missile center missileData["Xpos"] = missileData["Xpos"] + missileData["Xvel"] missileData["Ypos"] = missileData["Ypos"] + missileData["Yvel"] 'Move missile center Shapes.Move(missileData["image"],missileData["Xpos"]-missileWidth,missileData["Ypos"]-missileHeight) 'missile finished with If (missileData["Ypos"] < -missileHeight) Then missileData["Status"] = 0 Shapes.HideShape(missileData["image"]) EndIf missiles[i] = missileData 'save updated missile array (it may have been modified) EndIf EndFor EndSub Sub FireMissile For i = 1 To nummissile missileData = missiles[i] 'get current missile array If (missileData["Status"] = 0) Then missileData["Status"] = 1 Shapes.ShowShape(missileData["image"]) missileData["Xpos"] = playerX + 7 missileData["Ypos"] = playerY + 10 missiles[i] = missileData 'save updated missile array (it may have been modified) i = nummissile 'End loop EndIf EndFor EndSub End>RGJ873.sb< Start>RGR475.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 Sub stcc For rr=0 To 7 For m=0 To 7 cc="gold dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m, rr,rr) dd=LD3DView.AddCube(view3D 1,cc "D") LD3DView.TranslateGeometry(view3D dd m+8, 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, 7,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 EndSub Sub nset dd=args[1] qw=args[5] LD3DView.TranslateGeometry(view3D dd args[2] args[3] args[4]) in[qw]=in[qw]+1 qq=": nds[qw][in[qw]]=args[2]+qq+(args[3]+5)+qq+args[4] EndSub stcc() 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") End>RGR475.sb< Start>RGW411-0.sb< 'Text Challenge 2 By Ashkore Dracson begin: linecount = 0 subcount = 1 TextWindow.Show() sbfilebegin: TextWindow.Write("Path to Small Basic file : ") sbfile = TextWindow.Read() If Text.EndsWith(sbfile,".sb") = "False" Then TextWindow.WriteLine("Invalid Small Basic file ! Try again.") Goto sbfilebegin EndIf ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' contents = File.ReadContents(sbfile) For i = 0 To Text.GetLength(contents) If Text.GetCharacterCode(Text.GetSubText(contents,i,1)) = 13 Then linecount = linecount + 1 EndIf EndFor For i = 1 To linecount ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' readline = File.ReadLine(sbfile,i) If Text.StartsWith(readline,"Sub ") = "True" Then TextWindow.WriteLine(subcount + " : " + Text.GetSubTextToEnd(readline,5)) subcount = subcount + 1 EndIf EndFor TextWindow.PauseWithoutMessage() TextWindow.Clear() Goto begin End>RGW411-0.sb< Start>RGW412.sb< '==================================================================== '=======================Level Creator built by Zock77, age 14. Started Aug 2012====== '=======================For levels to "RUN Little solder dude, RUN!" By Krueg======= '==================================================================== path = "http://krueg.com/sb/soldier/" LevelEditDebug = "No" version = .02 Section = 1 Backgroundimg = ImageList.LoadImage(path + "background.png") GraphicsWindow.MouseMove = MouseMove GraphicsWindow.MouseDown = MouseDown Controls.ButtonClicked = ButtonClicked GraphicsWindow.BrushColor = "Black" GraphicsWindow.Width = 800 GraphicsWindow.Height = 672 GraphicsWindow.DrawResizedImage(Backgroundimg,0,0,GraphicsWindow.Width,GraphicsWindow.Height) GraphicsWindow.Top = 5 GraphicsWindow.Left = 20 GraphicsWindow.Title = "Level Creator " + version + " For ''RUN little Soldier Dude, RUN!'' By Krueg. Made By Zock77." img1 = ImageList.LoadImage(path + "5brickred.png") img2 = ImageList.LoadImage(path + "5ground.png") img3 = ImageList.LoadImage(path + "signright.png") img4 = ImageList.LoadImage(path + "arch.png") img5 = ImageList.LoadImage(path + "starblue.png") img6 = ImageList.LoadImage(path + "signleft.png") img7 = ImageList.LoadImage(path + "5brickblue.png") img8 = ImageList.LoadImage(path + "spikered.png") img9 = ImageList.LoadImage(path + "5brickgreen.png") img10 = ImageList.LoadImage(path + "starred.png") img11 = ImageList.LoadImage(path + "5brickbrown.png") ArrowcountLeft = 102 BlueStarCount = 51 doorcount = 119 Arrowcount = 101 GroundBrickCount = 41 BrickRedCount = 31 BrickBlueCount = 11 SpikeRedcount = 91 BrickGreenCount = 21 RedStarcount = 61 BrownBrickCount = 1 AddButtons() '--------------------------bricks[1-9] are brown bricks star[51-59] are blue stars icon[101] is the sign pointing right '--------------------------bricks[11-19] are blue bricks star[61-69] are red stars icon[102] is the sign pointing left '--------------------------bricks[21-29] are green bricks spike[81-89] are green spikes '--------------------------bricks[31-39] are red bricks spike[91-99] are red spikes icon[118] 1up icon '--------------------------ground[41-49] are ground images icon[119] door to next level '==================================================================== '============================Subroutines=============================== '==================================================================== Sub ButtonClicked If Controls.LastClickedButton = BrickRed Then If BrickRedCount <= 39 Then Count = BrickRedCount BrickRedCount = BrickRedCount + 1 Objectmove = Shapes.AddImage(img1) Type = "Brick" EndIf EndIf If Controls.LastClickedButton = GroundBrick Then If GroundBrickCount <= 49 Then Count = GroundBrickCount GroundBrickCount = GroundBrickCount + 1 Objectmove = Shapes.AddImage(img2) Type = "Brick" EndIf EndIf If Controls.LastClickedButton = BrickBlue Then If BrickBlueCount <= 19 Then Count = BrickBlueCount BrickBlueCount = BrickBlueCount + 1 Objectmove = Shapes.AddImage(img7) Type = "Brick" EndIf EndIf If Controls.LastClickedButton = GreenBrick Then If BrickGreenCount <= 29 Then Count = BrickGreenCount BrickGreenCount = BrickGreenCount + 1 Objectmove = Shapes.AddImage(img9) Type = "Brick" EndIf EndIf If Controls.LastClickedButton = BrownBrick Then If BrownBrickCount <= 9 Then Count = BrownBrickCount BrownBrickCountt = BrownBrickCount + 1 Objectmove = Shapes.AddImage(img11) Type = "Brick" EndIf EndIf If Controls.LastClickedButton = Rightarrow Then If Arrowcount = 101 Then Objectmove = Shapes.AddImage(img3) Type = "Object" Count = Arrowcount Arrowcount = Arrowcount + 1 EndIf EndIf If Controls.LastClickedButton = Nextlevdoor Then If Doorcount = 119 Then Objectmove = Shapes.AddImage(img4) Type = "Door" Count = Doorcount Doorcount = Doorcount + 1 EndIf EndIf If Controls.LastClickedButton = StarBlue Then If BlueStarCount <= 59 Then Objectmove = Shapes.AddImage(img5) Type = "Object" Count = BlueStarCount BlueStarCount = BlueStarCount + 1 EndIf EndIf If Controls.LastClickedButton = RedStar Then If RedStarcount <= 69 Then Objectmove = Shapes.AddImage(img10) Type = "Object" Count = RedStarcount RedStarcount = RedStarcount + 1 EndIf EndIf If Controls.LastClickedButton = RedSpike Then If SpikeRedcount <= 99 Then Objectmove = Shapes.AddImage(img8) Type = "Object" Count = SpikeRedcount SpikeRedcount = SpikeRedcount + 1 EndIf EndIf If Controls.LastClickedButton = Leftarrow Then If ArrowcountLeft = 102 Then Objectmove = Shapes.AddImage(img6) Type = "Object" Count = ArrowcountLeft ArrowcountLeft = ArrowcountLeft + 1 EndIf EndIf If Controls.LastClickedButton = Sec2 Then If Section <> 4 Then Section = Section + 1 GraphicsWindow.Clear() GraphicsWindow.DrawResizedImage(Backgroundimg,0,0,GraphicsWindow.Width,GraphicsWindow.Height) AddButtons() Controls.SetButtonCaption(Sec2,"Go to Section " + (Section + 1)) EndIf EndIf If Section = 4 Then Controls.SetButtonCaption(Sec2,"Go to Section 4") EndIf If Controls.LastClickedButton = Help Then ShowHelptext() EndIf EndSub '==================================================================== '==================================================================== Sub MouseMove If Type = "Brick" Then MouseXRounded = Math.Round(GraphicsWindow.MouseX / 32) * 32 MouseYRounded = (Math.Round(GraphicsWindow.MouseY / 134.4) * 134.4) - 32 ElseIf Type = "Object" Then MouseXRounded = Math.Round(GraphicsWindow.MouseX / 32) * 32 MouseYRounded = (Math.Round(GraphicsWindow.MouseY / 134.4) * 134.4) - 64 EndIf If Type = "Door" Then MouseXRounded = Math.Round(GraphicsWindow.MouseX / 32) * 32 MouseYRounded = (Math.Round(GraphicsWindow.MouseY / 134.4) * 134.4) - 130 EndIf Shapes.Move(Objectmove,MouseXRounded,MouseYRounded) EndSub '==================================================================== '==================================================================== Sub MouseDown Objectmove = "" LevelX = Math.Round(Math.Round(GraphicsWindow.MouseX / 32)) If Section = 2 Then LevelX = LevelX + Math.Round(GraphicsWindow.Width / 32) ElseIf Section = 3 Then LevelX = LevelX + Math.Round((GraphicsWindow.Width * 2) / 32) ElseIf Section = 4 Then LevelX = LevelX + Math.Round((GraphicsWindow.Width * 3) / 32) EndIf Level = Math.Ceiling(MouseYRounded / 134.4) If Level = 1 Then pf1 = pf1 + LevelX + "=" + Count + ";" EndIf If Level = 2 Then pf2 = pf2 + LevelX + "=" + Count + ";" EndIf If Level = 3 Then pf3 = pf3 + LevelX + "=" + Count + ";" EndIf If Level = 4 Then pf4 = pf4 + LevelX + "=" + Count + ";" EndIf If Level = 5 Then pf5 = pf5 + LevelX + "=" + Count + ";" EndIf If LevelEditDebug = "Yes" Then TextWindow.Clear() TextWindow.Left = 900 TextWindow.WriteLine("LevelX = " + LevelX) TextWindow.WriteLine("Section = " + Section) TextWindow.WriteLine("Level = " + Level) TextWindow.WriteLine("Count = " + Count) EndIf If Mouse.IsRightButtonDown = "True" Then Save() EndIf EndSub '==================================================================== '==================================================================== Sub Save TextWindow.WriteLine("pf1 = " + pf1) TextWindow.WriteLine("pf2 = " + pf2) TextWindow.WriteLine("pf3 = " + pf3) TextWindow.WriteLine("pf4 = " + pf4) TextWindow.WriteLine("pf5 = " + pf5) ask: TextWindow.Write("Enter Your save Directory: ") Directory = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(Directory) ' The following line could be harmful and has been automatically commented. ' Files = File.GetFiles(Directory) If Files = "" Then TextWindow.WriteLine("There are no .txt files in this directory, Please try again") Goto ask EndIf TextWindow.WriteLine("These are the files in this directory.") TextWindow.WriteLine(" -- ") TextWindow.WriteLine(Files) TextWindow.WriteLine(" -- ") TextWindow.WriteLine("Enter your txt name") Name = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Directory + "/" + Name,1,"pf1 = " + pf1) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Directory + "/" + Name,2,"pf2 = " + pf2) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Directory + "/" + Name,3"pf3 = " + pf3) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Directory + "/" + Name,4,"Pf4 = " + pf4) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Directory + "/" + Name,5,"pf5 = " + pf5) For ii = 1 To 3 Loading = "Loading" For ii = 1 To 3 Program.Delay(200) Loading = Loading + "." TextWindow.Clear() TextWindow.WriteLine(Loading) EndFor EndFor TextWindow.WriteLine("Done") EndSub '==================================================================== '==================================================================== Sub AddButtons Sec2 = Controls.AddButton("Go to Section " + (Section + 1) ,380,90) BrickRed = Controls.AddButton("Add Red Brick",10,10) GroundBrick = Controls.AddButton("Add Ground Brick",120,10) Rightarrow = Controls.AddButton("Add Right Arrow",250,10) Nextlevdoor = Controls.AddButton("Add Door",375,10) StarBlue = Controls.AddButton("Add Blue star",460,10) LeftArrow = Controls.AddButton("Add Left Arrow",570,10) BrickBlue = Controls.AddButton("Add Blue Brick",690,10) Help = Controls.AddButton("Help",390,50) RedSpike = Controls.AddButton("Add Red Spike",10,50) GreenBrick = Controls.AddButton("Add Green Brick",120,50) RedStar = Controls.AddButton("Add Red Star",260,50) BrownBrick = Controls.AddButton("Add Brown Brick",460,50) EndSub '================================================================== '================================================================== Sub ShowHelptext TextWindow.Clear() TextWindow.WriteLine(" --") TextWindow.WriteLine("To Add a brick, click the add brick button") TextWindow.WriteLine(" --") TextWindow.WriteLine("To change sections, click the Go to section button") TextWindow.WriteLine(" --") TextWindow.WriteLine("To save, Right click") Program.Delay(7000) TextWindow.Hide() EndSub End>RGW412.sb< Start>RGW471-1.sb< GraphicsWindow.Width=1366 GraphicsWindow.Height=768 GraphicsWindow.BackgroundColor="#111177" GraphicsWindow.BRUSHColor ="#DDCCAA" GraphicsWindow.PenWidth=0 zz=1 ff="false not="true=false;false=true y=1 f5=10 f51=7 GraphicsWindow.Title="RLE bmp lx=ldtext.Split ("25 25 25 25 24 24 24 24 23 23 23 23 22 22 22 22 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 23 23 23 23 24 24 24 24 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 " " ") full="false 'xdrw() full="true xx=0 yy=0 y=1 sx=10 'xdrw() cset() For r=1 to 93 ll=ldtext.Split (gl[r] "!") For q=2 to ll[1]+3 b=ldmath.Decimal2Base (ll[q] 2) b=text.Append ("0000000" b) b=text.GetSubTextToEnd (b Text.GetLength(b)-7) xx=sx 'TextWindow.WriteLine (b) For f=1 To 8 st= Text.GetSubText(b f 1) If st="1" Then Shapes.Move (Shapes.addRectangle(f51 f5) xx yy+sy) 'GraphicsWindow.fillRectangle (xx yy+sy f51 f5) endif xx=xx+f51 endfor yy=yy+f5 endfor yy=0 If (r>=3 And r<=6) Or r=45 Or r=55 then sx=sx+45 elseif array.ContainsValue ( "1=70;2=74;3=83" r) then sx=sx+23 elseif array.ContainsValue ( "1=41;2=52;3=54" r) then sx=sx+30 elseif (r=77) or (r=87) Then sx=sx+40 elseif (r=73) or (r=76) Then sx=sx+14 elseif r>63 Then sx=sx+28 else sx=sx+35 endif If sx>1200 Then sy=sy+90 sx=0 endif endfor GraphicsWindow.KeyDown=kdd Sub kdd If GraphicsWindow.LastKey="Space" Then else cc= LDGraphicsWindow.Capture ("" "false") GraphicsWindow.DrawImage (cc 0 0) endif EndSub LDEvents.MouseWheel=mww GraphicsWindow.MouseMove=mmv GraphicsWindow.MouseDown=mdd Sub mww If GraphicsWindow.LastKey="Space" Then zr=zr+LDEvents.LastMouseWheelDelta*5 else zz=zz+ LDEvents.LastMouseWheelDelta /10 If zz>2 Then zz=2 ElseIf zz<.1 then zz=.1 EndIf GraphicsWindow.Title =zz endif LDGraphicsWindow.Reposition (zz zz 100 200 zr) EndSub Sub mdd sx= GraphicsWindow.MouseX sy= GraphicsWindow.MouseY EndSub Sub mmv If Mouse.IsLeftButtonDown Then ddx= GraphicsWindow.MouseX -sx ddy= GraphicsWindow.MouseY - sy gw= GraphicsWindow.Width gh= GraphicsWindow.Height gwX = (ddx+wx)*zz + gw*(1-zz)/2 gwY = (ddy+wy)*zz + gh*(1-zz)/2 wx=wx+ddx wy=wy+ddy LDGraphicsWindow.Reposition (zz zz gwx gwy zr) endif endsub Sub cset gc= "4!112!128!96!16!224! S code=50| gc=gc+"5!136!216!168!136!136!0! M code=44| gc=gc+"4!96!144!240!144!144!0! A code=32| gc=gc+"4!128!128!128!128!240!0! L code=43| gc=gc+"4!128!128!128!128!240!0! L code=43| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"4!224!144!224!144!224!0! B code=33| gc=gc+"4!96!144!240!144!144!0! A code=32| gc=gc+ "4!112!128!96!16!224! S code=50| gc=gc+"3!224!64!64!64!224!0! I code=40| gc=gc+"4!112!128!128!128!112!0! C code=34| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"5!96!144!104!144!104!0! & code=5| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"3!64!128!192!128!128!0! f code=69| gc=gc+"3!0!160!160!160!224!0! u code=84| gc=gc+"3!0!224!160!160!160!0! n code=77| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"3!64!224!64!64!64!0! t code=83| gc=gc+"3!0!224!160!160!224!0! o code=78| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"3!0!224!128!128!224!0! c code=66| gc=gc+"3!0!224!160!160!224!0! o code=78| gc=gc+"5!0!248!168!168!168!0! m code=76| gc=gc+"4!0!224!160!160!224!128! p code=79| gc=gc+"3!0!160!160!160!224!0! u code=84| gc=gc+"3!64!224!64!64!64!0! t code=83| gc=gc+"3!0!224!224!128!224!0! e code=68| gl=ldtext.Split (gc "|") EndSub End>RGW471-1.sb< Start>RGW471.sb< GraphicsWindow.Width=1200 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor="teal GraphicsWindow.BrushColor ="orange GraphicsWindow.PenWidth=0 zz=1 ff="false not="true=false;false=true y=1 f5=10 f51=7 GraphicsWindow.Title="RLE bmp lx=ldtext.Split ("25 25 25 25 24 24 24 24 23 23 23 23 22 22 22 22 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 23 23 23 23 24 24 24 24 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 " " ") full="false 'xdrw() full="true xx=0 yy=0 y=1 sx=10 'xdrw() cset() GraphicsWindow.BrushColor ="black For r=1 to 93 ll=ldtext.Split (gl[r] "!") For q=2 to ll[1]+3 b=ldmath.Decimal2Base (ll[q] 2) b=text.Append ("0000000" b) b=text.GetSubTextToEnd (b Text.GetLength(b)-7) xx=sx 'TextWindow.WriteLine (b) For f=1 To 8 st= Text.GetSubText(b f 1) If st="1" Then Shapes.Move (Shapes.addRectangle(f51 f5) xx yy+sy) 'GraphicsWindow.fillRectangle (xx yy+sy f51 f5) endif xx=xx+f51 endfor yy=yy+f5 endfor yy=0 If (r>=3 And r<=6) Or r=45 Or r=55 then sx=sx+45 elseif array.ContainsValue ( "1=70;2=74;3=83" r) then sx=sx+23 elseif array.ContainsValue ( "1=41;2=52;3=54" r) then sx=sx+30 elseif (r=77) or (r=87) Then sx=sx+40 elseif (r=73) or (r=76) Then sx=sx+14 elseif r>63 Then sx=sx+28 else sx=sx+35 endif If sx>1200 Then sy=sy+90 sx=0 endif endfor GraphicsWindow.KeyDown=kdd Sub kdd If GraphicsWindow.LastKey="Space" Then else cc= LDGraphicsWindow.Capture ("" "false") GraphicsWindow.DrawImage (cc 0 0) endif EndSub LDEvents.MouseWheel=mww GraphicsWindow.MouseMove=mmv GraphicsWindow.MouseDown=mdd Sub mww If GraphicsWindow.LastKey="Space" Then zr=zr+LDEvents.LastMouseWheelDelta*5 else zz=zz+ LDEvents.LastMouseWheelDelta /10 If zz>2 Then zz=2 ElseIf zz<.1 then zz=.1 EndIf GraphicsWindow.Title =zz endif LDGraphicsWindow.Reposition (zz zz 100 200 zr) EndSub Sub mdd sx= GraphicsWindow.MouseX sy= GraphicsWindow.MouseY EndSub Sub mmv If Mouse.IsLeftButtonDown Then ddx= GraphicsWindow.MouseX -sx ddy= GraphicsWindow.MouseY - sy gw= GraphicsWindow.Width gh= GraphicsWindow.Height gwX = (ddx+wx)*zz + gw*(1-zz)/2 gwY = (ddy+wy)*zz + gh*(1-zz)/2 wx=wx+ddx wy=wy+ddy LDGraphicsWindow.Reposition (zz zz gwx gwy zr) endif endsub Sub cset gc= "1!128!128!128!0!128!0! ¡ code=0| gc=gc+"3!160!160!0!0!0!0! » code=1| gc=gc+"5!80!248!80!248!80!0! # code=2| gc=gc+"5!120!160!112!40!240!0! $ code=3| gc=gc+"5!136!16!32!64!136!0! % code=4| gc=gc+"5!96!144!104!144!104!0! & code=5| gc=gc+"2!128!64!0!0!0!0! ' code=6| gc=gc+"3!64!128!128!128!64!0! ( code=7| gc=gc+"3!128!64!64!64!128!0! ) code=8| gc=gc+"3!0!160!64!160!0!0! * code=9| gc=gc+"3!0!64!224!64!0!0! + code=10| gc=gc+"4!0!0!0!0!64!128! , code=11| gc=gc+"3!0!0!224!0!0!0! - code=12| gc=gc+"3!0!0!0!0!128!0! . code=13| gc=gc+"5!8!16!32!64!128!0! / code=14| gc=gc+"4!96!144!144!144!96! 0 code=15| gc=gc+"3!64!192!64!64!224!0! 1 code=16| gc=gc+"4!224!16!96!128!240!0! 2 code=17| gc=gc+"4!224!16!96!16!224!0! 3 code=18| gc=gc+"4!144!144!240!16!16!0! 4 code=19| gc=gc+"4!240!128!224!16!224!0! 5 code=20| gc=gc+"4!96!128!224!144!96!0! 6 code=21| gc=gc+"4!240!16!32!64!64!0! 7 code=22| gc=gc+"4!96!144!96!144!96!0! 8 code=23| gc=gc+"4!96!144!112!16!96!0! 9 code=24| gc=gc+"2!0!128!0!128!0!0! : code=25| gc=gc+"4!0!64!0!0!64!128! ; code=26| gc=gc+"3!32!64!128!64!32!0! < code=27| gc=gc+"3!0!224!0!224!0!0! = code=28| gc=gc+"3!128!64!32!64!128!0! > code=29| gc=gc+"4!224!16!96!0!64!0! ? code=30| gc=gc+"4!96!144!176!128!112!0! @ code=31| gc=gc+"4!96!144!240!144!144!0! A code=32| gc=gc+"4!224!144!224!144!224!0! B code=33| gc=gc+"4!112!128!128!128!112!0! C code=34| gc=gc+"4!224!144!144!144!224!0! D code=35| gc=gc+"4!240!128!224!128!240!0! E code=36| gc=gc+"4!240!128!224!128!128!0! F code=37| gc=gc+"4!112!128!176!144!112!0! G code=38| gc=gc+"4!144!144!240!144!144!0! H code=39| gc=gc+"3!224!64!64!64!224!0! I code=40| gc=gc+"4!240!16!16!144!96!0! J code=41| gc=gc+"4!144!160!192!160!144!0! K code=42| gc=gc+"4!128!128!128!128!240!0! L code=43| gc=gc+"5!136!216!168!136!136!0! M code=44| gc=gc+"4!144!208!176!144!144!0! N code=45| gc=gc+"4!96!144!144!144!96!0! O code=46| gc=gc+"4!224!144!224!128!128!0! P code=47| gc=gc+"4!96!144!144!144!96!16! Q code=48| gc=gc+"4!224!144!224!160!144!0! R code=49| gc=gc+"4!112!128!96!16!224! S code=50| gc=gc+"3!224!64!64!64!64!0! T code=51| gc=gc+"4!144!144!144!144!96!0! U code=52| gc=gc+"3!160!160!160!160!64!0! V code=53| gc=gc+"5!136!168!168!168!80!0! W code=54| gc=gc+"4!144!144!96!144!144!0! X code=55| gc=gc+"3!160!160!64!64!64!0! Y code=56| gc=gc+"4!240!16!96!128!240!0! Z code=57| gc=gc+"3!192!128!128!128!192!0! [ code=58| gc=gc+"5!128!64!32!16!8!0! \ code=59| gc=gc+"3!192!64!64!64!192!0! ] code=60| gc=gc+"5!32!80!136!0!0!0! ^ code=61| gc=gc+"4!0!0!0!0!24! _ code=62| gc=gc+"2!128!64!0!0!0!0! ` code=63| gc=gc+"3!0!224!32!224!224!0! a code=64| gc=gc+"3!128!224!160!160!224!0! b code=65| gc=gc+"3!0!224!128!128!224!0! c code=66| gc=gc+"3!32!224!160!160!224!0! d code=67| gc=gc+"3!0!224!224!128!224!0! e code=68| gc=gc+"3!64!128!192!128!128!0! f code=69| gc=gc+"4!0!224!160!224!32!224! g code=70| gc=gc+"3!128!224!160!160!160!0! h code=71| gc=gc+"3!128!0!128!128!128!0! i code=72| gc=gc+"4!0!192!64!64!64!128!224 j code=73| gc=gc+"3!128!160!192!160!160!0! k code=74| gc=gc+"3!128!128!128!128!128!0! l code=75| gc=gc+"5!0!248!168!168!168!0! m code=76| gc=gc+"3!0!224!160!160!160!0! n code=77| gc=gc+"3!0!224!160!160!224!0! o code=78| gc=gc+"4!0!224!160!160!224!128! p code=79| gc=gc+"4!0!224!160!160!224!32! q code=80| gc=gc+"3!0!224!128!128!128!0! r code=81| gc=gc+"3!0!192!128!64!192!0! s code=82| gc=gc+"3!64!224!64!64!64!0! t code=83| gc=gc+"3!0!160!160!160!224!0! u code=84| gc=gc+"3!0!160!160!160!64!0! v code=85| gc=gc+"3!0!168!168!168!80!0! w code=86| gc=gc+"3!0!160!64!160!160!0! x code=87| gc=gc+"4!0!160!160!224!32!224! y code=88| gc=gc+"5!0!192!64!128!192!0! z code=89| gc=gc+"3!96!64!192!64!96!0! { code=90| gc=gc+"1!128!128!128!128!128!0! code=91| gc=gc+"3!192!64!96!64!192!0! } code=92| gc=gc+"3!96!192!0!0!0!0! ~ code=93| gl=ldtext.Split (gc "|") EndSub End>RGW471.sb< Start>RGW723.sb< ' Analogue Clock by NaochanON 2012/07/03 init() Timer.Tick=demo Timer.Interval=1000 Timer.Resume() DEMO() Sub DEMO sANGLE=360*Clock.Second/w_mAX Move_second() mANGLE=360*(Clock.minute+Clock.Second/w_max)/w_mAX Move_minute() hANGLE=5*360*(Clock.Hour+Clock.minute/w_max+Clock.Second/w_max/w_max)/w_mAX Move_Hour() Shapes.SetText(stime,clock.Date+Text.GetCharacter(10)+Clock.Time) ENDSUB Sub Move_second dsx=(DR/4-DR/2*0.1)*math.Cos(Math.GetRadians(sangle-90)) ' 44/2 ..... center of arrow length dsy=(DR/4-DR/2*0.1)*math.sin(Math.GetRadians(sangle-90)) Shapes.Move(blc[4],x+DR/2+dsx-wr,y+dsy+0.1*DR/2+DR/4-wr) Shapes.Rotate(blc[4],sangle) EndSub Sub Move_minute dmx=0.75/0.8*(DR/4-DR/2*0.125)*math.Cos(Math.GetRadians(mangle-90)) ' 44/2 ..... center of arrow length dmy=0.75/0.8*(DR/4-DR/2*0.125)*math.sin(Math.GetRadians(mangle-90)) Shapes.Move(blc[3],x+DR/2+dmx-wr,y+dmy+0.125*DR/2+DR/4-wr) Shapes.Rotate(blc[3],mangle) EndSub Sub Move_hour dhx=0.7/0.8*(DR/4-DR/2*0.15)*math.Cos(Math.GetRadians(hangle-90)) ' 44/2 ..... center of arrow length dhy=0.7/0.8*(DR/4-DR/2*0.15)*math.sin(Math.GetRadians(hangle-90)) Shapes.Move(blc[2],x+DR/2+dhx-wr,y+dhy+0.15*DR/2+DR/4-wr) Shapes.Rotate(blc[2],hangle) EndSub Sub scaling GraphicsWindow.BrushColor="Blue" GraphicsWindow.FontSize=12 For j=1 To 60 angle=360/60*j scx=DR/2*math.Cos(math.GetRadians(angle-90)) scY=DR/2*math.sin(math.GetRadians(angle-90)) scm[j]=Shapes.AddRectangle(2,5) ' narrow mark If Math.Remainder(j,5)=0 Then ' 5 pitch scm[j]=Shapes.AddRectangle(5,5) ' wide mark sct[j]=Shapes.AddText(math.Floor(j/5)) Shapes.Move(sct[j],X+DR/2+0.85*scx-6,Y+DR/2+0.85*scy-7) EndIf Shapes.Move(scm[j],X+DR/2+scx-1,Y+DR/2+scy-1) Shapes.Rotate(scm[j],angle) EndFor EndSub Sub init GraphicsWindow.Hide() GraphicsWindow.BackgroundColor="LightCyan" GraphicsWindow.Width=250 GraphicsWindow.Height=250 GraphicsWindow.Top=20 GraphicsWindow.Left=50 GraphicsWindow.BrushColor="Red" msg=shapes.AddText(" ") Shapes.Move(msg,250,230) w_mAX=60 ' full scale face() ' draw analoguebalance scaling() GraphicsWindow.Show() EndSub Sub face X=20 Y=20 DR=208 wr=3 GraphicsWindow.BrushColor="Black" base= Shapes.AddEllipse(DR+8,DR+8) '------------------------ body ------------------------- GraphicsWindow.BrushColor="white" blc[1]= Shapes.AddEllipse(DR,DR) ' circle '------------------------ Hour Arrow ------------------------- GraphicsWindow.BrushColor="Black" GraphicsWindow.PenColor="Black" blc[2]= Shapes.AddTriangle(wr,0,0,DR/2*0.7,2*wr,DR/2*0.7) ' <----- Hour arrow '------------------------ Minute Arrow ------------------------- GraphicsWindow.BrushColor="Navy" GraphicsWindow.PenColor="Navy" blc[3]= Shapes.AddTriangle(wr,0,0,DR/2*0.75,2*wr,DR/2*0.75) ' <----- Minute arrow '------------------------ second Arrow ------------------------- GraphicsWindow.BrushColor="Red" GraphicsWindow.PenColor="Red" blc[4]= Shapes.AddTriangle(wr,0,0,DR/2*0.8,2*wr,DR/2*0.8) ' <----- Second arrow blc[5]= Shapes.AddEllipse(15,15) stime= Shapes.AddText(" ") '--------------------------------------------------------- Shapes.Move(base,X-4,y-4) Shapes.Move(blc[1],X-1,Y-1) ' center circle Shapes.Move(blc[4],X+DR/2-wr,Y) ' arrow Shapes.Move(blc[5],X+DR/2-7.5,Y+DR/2-7.5) Shapes.Move(stime,x+70,y+DR-75) GraphicsWindow.BrushColor="Black" GraphicsWindow.PenColor="Black" EndSub End>RGW723.sb< Start>RGX354.sb< ' More low resolution graphics in textwindow. ' ' Use Window's character map program to get these, ' look in start-all programs-accessories-system tools-character map ' Click advanced view checkbox, select Group By: Unicode Subrange, then in the new Group By box ' that pops up, click on Box Drawings. When you find a character you like, click on it or ' use arrow keys to pick. Then on the bottom left corner something like "U+2500" will show ' up. The 2500 for example is in hexadecimal, so you'll need to convert to decimal using ' windows calculator (=9472 decimal). Once done use that number in Text.GetCharacter(9472) ' to print it on text display. TextWindow.Show() horzLine = Text.GetCharacter(9472) vertLine = Text.GetCharacter(9474) ulCorner = Text.GetCharacter(9484) urCorner = Text.GetCharacter(9488) llCorner = Text.GetCharacter(9492) lrCorner = Text.GetCharacter(9496) teeRight = Text.GetCharacter(9500) teeLeft = Text.GetCharacter(9508) teeDown = Text.GetCharacter(9516) teeUp = Text.GetCharacter(9524) cross = Text.GetCharacter(9532) For k = 1 To 20000 ' TextWindow appears to have 23 rows, 78 columns TextWindow.CursorTop = Math.GetRandomNumber(23) TextWindow.CursorLeft = Math.GetRandomNumber(78) i = Math.GetRandomNumber(11) If i = 1 Then character = horzLine ElseIf i = 2 then character = vertLine ElseIf i = 3 then character = ulCorner ElseIf i = 4 then character = urCorner ElseIf i = 5 then character = llCorner ElseIf i = 6 then character = lrCorner ElseIf i = 7 then character = teeRight ElseIf i = 8 then character = teeLeft ElseIf i = 9 then character = teeDown ElseIf i = 10 then character = teeUp ElseIf i = 11 then character = cross EndIf TextWindow.WriteLine(character) EndFor While 1=1 EndWhile End>RGX354.sb< Start>RHF528.sb< 'let ammoSync = obj() Path= "http://imode.free.fr/images1942/" 'Game area controls gameWidth = 640 gameHeight = 480 fps = 50 bgs = 2 'backgroundspeed Player_Lives = 10 nbrisland = 5 'nomber of island images islandcount = 5 'nomber of island in the wall field ' Window title gameTitle = "1942, Score: " GraphicsWindow.Hide() GraphicsWindow.Title = gameTitle + "0" GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gameWidth GraphicsWindow.Height = gameHeight 'Presentation ' todo ' Start game Init() define_paths() TimePlay = 0 pathNBR = 1 'create_enemies1() Play() ' Setup world Sub Init GraphicsWindow.Hide() Mouse.HideCursor() ' addImage in the right order is needed to define the shapes depth island4= ImageList.LoadImage(Path + "island4.png") island1= ImageList.LoadImage(Path + "island1.png") island2= ImageList.LoadImage(Path + "island2.png") island3= ImageList.LoadImage(Path + "island3.png") island5= ImageList.LoadImage(Path + "island5.png") player0 = ImageList.LoadImage(Path + "myplane1.png") background = ImageList.LoadImage(Path + "fond.png") bullet0 = ImageList.LoadImage(Path + "bullet.png") enemy= ImageList.LoadImage(Path + "enemy1.png") enemy2 = ImageList.LoadImage(Path + "enemy2.png") enemy_expl1=ImageList.LoadImage(Path + "explo1.png") enemy_expl2=ImageList.LoadImage(Path + "explo2.png") player_expl=ImageList.LoadImage(Path + "explo2.png") Enemy_bullet=ImageList.LoadImage(Path + "E_bullet.png") end = ImageList.LoadImage(Path + "End.png") enemy_Array = "EnemyArray" 'Array that contain all the enemies ' every enemy in tha array has 5 informations ' TimeLine: each enemy has its own timeline ' PathNBR: the precalculated path defineing the movement ' the movement is decomposed in LineNbr differents lines ' each line is define in the enemy_path table with rotation, deltaY and deltaY ' PositonX, PositonY: position in space ' ' enemy_TimeLine = "EnemyTimeLine" enemy_line = "enemyLineNbr" enemy_PosX = "enemyPositonX" enemy_PosY = "enemyPositonY" enemy_PathNBR="enemy_PathNBR" enemy_Nbr = 6 enemy_Count = 0 enemy_speed = 4 'enemy_NextRemove = 1 enemy_Life = 10 player_size= 65 enemy_size = 32 enemy_ammo_size = 8 player_bullet_size = 32 island_Array = "Island array" IslandsPosition() create_level1() fond= Shapes.AddImage(background) Array.SetValue(island_Array,1,Shapes.AddImage(island1)) Array.SetValue(island_Array,2,Shapes.AddImage(island2)) Array.SetValue(island_Array,3,Shapes.AddImage(island3)) Array.SetValue(island_Array,4,Shapes.AddImage(island4)) Array.SetValue(island_Array,5,Shapes.AddImage(island5)) For i = 6 to islandcount Array.SetValue(island_Array,i,Array.getValue(island_Array,Math.Remainder(i,4))) Endfor player = Shapes.AddImage(player0) GraphicsWindow.FontSize = 20 GraphicsWindow.BackgroundColor = "Grey" GraphicsWindow.PenColor = "Yellow" Player_Ammo = "Player_AmmoArray" Player_AmmoAge = "Player_AmmoAge" Player_AmmoMax = 50 Player_AmmoCount = 0 Player_Ammospeed = bgs +4 Player_AmmoLife = 100 Enemy_Ammo = "Enemy_AmmoArray" Enemy_AmmoAge = "Enemy_AmmoAge" Enemy_Ammo_Angle="Enemy_Ammo_Angle" Enemy_AmmoMax = 30 Enemy_AmmoCount = 0 Enemy_Ammospeed = bgs +4 Enemy_AmmoLife = 50 Enemy_Agresivity = 200 score = 0 EndSub ' Main gane routine Sub Play GraphicsWindow.Show() ' Main loop play = 1 pause = 0 incx =0 ' X-axis increment for background incy = 0 ' Y-axis increment for background incbx = 0 'increment for bullets and all objects on X incby = 0 'increment for bullets and all objects on Y squadron = 1 ' Island initial position j= 0 For i= 1 To islandcount j=Math.Remainder(i,6) posy[i]= islandPos[j][2] posx[i]= islandPos[j][3] incislandx[i] = 0 incislandy[i] = 0 EndFor TimePlay = 0 Shapes.Move(player, gameWidth/2 , gameHeight -80 ) While(play = 1) Program.Delay(1000/fps) TimePlay = TimePlay +1 If (pause = 0) Then If (TimePlay = level1[squadron][1]) then pathNBR = level1[squadron][2] enemyPosX1 = level1[squadron][3] 'X position enemyPosY1 = level1[squadron][4] 'Y position enemy_Nbr = level1[squadron][6] enemy_type = level1[squadron][7] if (level1[squadron][5]=1) then create_enemies_left() Else create_enemies_right() endif squadron = squadron + 1 endif If (TimePlay > 4000) then Shapes.Move(Shapes.addImage(end), 230,200) Program.Delay(5000) Program.End() Endif moveall() GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown AgePlayer_Ammo() EndIf EndWhile EndSub Sub OnMouseMove paddleX = GraphicsWindow.MouseX - player_size/2 paddleY = GraphicsWindow.MouseY- player_size If (paddleX < 0) then paddleX = 0 endif Shapes.Move(player, paddleX , paddleY ) EndSub Sub OnMouseDown ShootX = GraphicsWindow.MouseX - 15 ' in order to be from the neck of the plane ShootY = GraphicsWindow.MouseY - 80 Fire() EndSub Sub moveall incbx = 0 incby =0 GraphicsWindow.Title = gameTitle + score +" Lives:"+Player_Lives If (paddleX >(gameWidth-62) ) Then incx = incx - bgs incbx = incbx - bgs For i= 1 To islandcount incislandx[i] = incislandx[i] - bgs EndFor If (incx = -32 ) Then incx =0 Endif Endif If (paddleX < 64 ) Then incx = incx + bgs incbx = incbx + bgs For i= 1 To islandcount incislandx[i] = incislandx[i] + bgs EndFor If (incx = 32 ) Then incx =0 Endif Endif Shapes.Move(fond,incx -32 ,incy - 32) For i= 1 To islandcount islx = posx[i]+incislandx[i] isly = posy[i]+incislandy[i] Shapes.Move(Array.GetValue(island_Array,i),islx,isly) EndFor incy = incy + bgs incby = incby+ bgs For i= 1 To islandcount incislandy[i] = incislandy[i] + bgs EndFor If (incy = 32) Then incy =0 Endif For i= 1 To islandcount If ((posy[i]+incislandy[i]) > (gameHeight+15)) Then 'relaunch island if no more visible R= Math.Round(Math.GetRandomNumber(nbrisland)) AA = Math.Remainder(TimePlay,6) 'give new coordinates posx[i]= islandPos[AA][2] posy[i]= islandPos[AA][3] Shapes.move(Array.GetValue(island_Array,R),posx[i],posy[i]) incislandy[i]=0 incislandx[i]=0 EndIf ENDFOR ' Move playerammo For i = 1 To Player_AmmoCount Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i)) +incbx Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i)) - Player_Ammospeed Shapes.Move(Array.GetValue(Player_Ammo, i), Player_Ammox, Player_Ammoy) Array.SetValue(Player_AmmoAge, i, Array.GetValue(Player_AmmoAge, i) + 1) EndFor ' Move Enemy ammo For iea = 1 To Enemy_AmmoCount dx =(Math.Sin((Array.GetValue(Enemy_Ammo_Angle, iea) )) * Enemy_Ammospeed) dy =(Math.Cos((Array.GetValue(Enemy_Ammo_Angle, iea) ))* Enemy_Ammospeed) Enemy_Ammox = Shapes.GetLeft(Array.GetValue(Enemy_Ammo, iea)) +dx+incbx Enemy_Ammoy = Shapes.GetTop(Array.GetValue(Enemy_Ammo, iea)) +dy+incby*0.1 Shapes.Move(Array.GetValue(Enemy_Ammo, iea), Enemy_Ammox, Enemy_Ammoy) Array.SetValue(Enemy_AmmoAge, iea, Array.GetValue(Enemy_AmmoAge, iea) + 1) EndFor ' move ennemies For i=1 To enemy_Count ' move as TimeLine and Path say eNBR= Array.GetValue(enemy_PathNBR,i) uu =Array.GetValue(enemy_line,i) Time= Array.GetValue(enemy_TimeLine, i) etl=enemyPath[eNBR][1][uu] 'enemy own timeLine IF (Time=etl) Then 'it's time to rotate enemy rr = enemyPath[eNBR][2][uu+1] Shapes.Rotate(Array.GetValue(enemy_Array,i),rr) EndIf IF (Time > etl) Then uu = uu+1 Array.SetValue(enemy_line,i,uu) ' next line for enemy move EndIf xx1=Array.GetValue(enemy_PosX,i) yy1= Array.GetValue(enemy_PosY,i) xx = xx1+enemyPath[eNBR][3][uu]+incbx yy = yy1+enemyPath[eNBR][4][uu]+incby*0.1 ' Randomly fire-enemy If (Math.GetRandomNumber(Enemy_Agresivity)=1) Then Enemy_ShootX = xx1 + 16 Enemy_ShootY = yy1 + 4 If (yy1 > 0 AND xx1 > 0 And yy1< gameHeight And xx1 < gameWidth) then 'this avoid enemy fire from outside the screen fire_Enemy() Endif EndIf Shapes.Move(Array.GetValue(enemy_Array,i),xx,yy) Array.SetValue(enemy_PosX,i,xx) Array.SetValue(enemy_PosY,i,yy) Array.SetValue(enemy_TimeLine, i, Time + 1) If ((uu > enemyPath[eNBR][0][0]) And (Time > etl)) Then ' if last timelife remove the enemy sprite next_enemy_remove = i remove_enemy() endif Collision_pbe() Collision_ep() EndFor EndSub Sub RemovePlayer_Ammo Shapes.Remove(Array.GetValue(Player_Ammo, Player_Ammo_nextRemove)) For iz = Player_Ammo_nextRemove To Player_AmmoCount - 1 Array.SetValue(Player_Ammo, iz, Array.GetValue(Player_Ammo, iz+1)) Array.SetValue(Player_AmmoAge, iz, Array.GetValue(Player_AmmoAge, iz+1)) EndFor Array.RemoveValue(Player_Ammo, Player_AmmoCount) Array.RemoveValue(Player_AmmoAge, Player_AmmoCount) Player_AmmoCount = Player_AmmoCount - 1 EndSub Sub RemoveEnemy_Ammo Shapes.Remove(Array.GetValue(Enemy_Ammo, Enemy_Ammo_nextRemove)) For irea = Enemy_Ammo_nextRemove To Enemy_AmmoCount - 1 Array.SetValue(Enemy_Ammo, irea, Array.GetValue(Enemy_Ammo, irea+1)) Array.SetValue(Enemy_AmmoAge, irea, Array.GetValue(Enemy_AmmoAge, irea+1)) Array.SetValue(Enemy_Ammo_Angle, irea, Array.GetValue(Enemy_Ammo_Angle,irea+1)) EndFor Array.RemoveValue(Enemy_Ammo, Enemy_AmmoCount) Array.RemoveValue(Enemy_AmmoAge, Enemy_AmmoCount) Array.RemoveValue(Enemy_Ammo_Angle,Enemy_AmmoCount) Enemy_AmmoCount = Enemy_AmmoCount - 1 EndSub Sub fire ' Remove additional player Ammo While(Player_AmmoCount > Player_AmmoMax ) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile ' Add the player Ammo Player_AmmoCount = Player_AmmoCount + 1 Array.SetValue(Player_Ammo, Player_AmmoCount, Shapes.AddImage(bullet0)) Shapes.Move(Array.GetValue(Player_Ammo, Player_AmmoCount), ShootX, ShootY) EndSub Sub fire_Enemy ' Remove additional Enemy Ammo While(Enemy_AmmoCount > (Enemy_AmmoMax - 1)) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile ' Add the Enemy Ammo Enemy_AmmoCount = Enemy_AmmoCount + 1 Array.SetValue(Enemy_Ammo, Enemy_AmmoCount, Shapes.AddImage(Enemy_bullet)) Array.SetValue(Enemy_Ammo_Angle, Enemy_AmmoCount,Math.ArcTan((paddleX- Enemy_ShootX+player_size/2)/(paddleY-Enemy_ShootY))) Shapes.Move(Array.GetValue(Enemy_Ammo, Enemy_AmmoCount), Enemy_ShootX, Enemy_ShootY) EndSub 'Check playerammo age Sub AgePlayer_Ammo While (Array.GetValue(Player_AmmoAge, 1) > Player_AmmoLife) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile EndSub 'Check enemy ammo age Sub AgeEnemy_Ammo While (Array.GetValue(Enemy_AmmoAge, 1) > Enemy_AmmoLife) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile EndSub Sub remove_enemy Shapes.remove(Array.GetValue(enemy_Array,next_enemy_remove)) ' Remove all references from the arrays For ii = next_enemy_remove To enemy_Count - 1 Array.SetValue(enemy_Array, ii, Array.GetValue(enemy_Array, ii+1)) Array.SetValue(enemy_line, ii, Array.GetValue(enemy_line, ii+1)) Array.SetValue(enemy_PosX, ii, Array.GetValue(enemy_PosX, ii+1)) Array.SetValue(enemy_PosY, ii, Array.GetValue(enemy_PosY, ii+1)) Array.SetValue(enemy_TimeLine, ii, Array.GetValue(enemy_TimeLine, ii+1)) Array.SetValue(enemy_PathNBR, ii , Array.GetValue(enemy_PathNBR, ii+1)) EndFor Array.RemoveValue(enemy_Array, enemy_Count) Array.RemoveValue(enemy_line, enemy_Count) Array.RemoveValue(enemy_PosX, enemy_Count) Array.RemoveValue(enemy_PosY, enemy_Count) Array.RemoveValue(enemy_TimeLine, enemy_Count) Array.RemoveValue(enemy_PathNBR,enemy_Count) enemy_Count = enemy_Count - 1 EndSub Sub create_enemies_left TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) If (enemy_type = 2) Then Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy2)) Else Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) EndIf Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 - 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub create_enemies_right TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 + 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub Collision_pbe 'for player-bullet and enemies For i1 = 1 To Player_AmmoCount ' player bullet position Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i1)) Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i1)) px1=Player_Ammox+player_bullet_size/3 'in order to have a more precise collison than the bullet image size py1=Player_Ammoy+player_bullet_size/3 px2=px1+2*player_bullet_size/3 py2=py1+2*player_bullet_size/3 For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2)+enemy_size/4 ay1=Array.GetValue(enemy_PosY,i2)+enemy_size/4 ax2=ax1+3*enemy_size/4 ay2=ay1+3*enemy_size/4 If ( (ax1 < px1 And ax2 > px1) Or (ax1 < px2 And ax2 > px2) ) Then If ( (ay1 < py1 And ay2 > py1) Or (ay1 < py2 And ay2 > py2) ) Then ' collision between enemy nbr i2 and player bullet i ' remove bullet i and animate explosion and remove enemy i2 Player_Ammo_nextRemove = i1 RemovePlayer_Ammo() next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(enemy_expl2) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) score = score +100 EndIf EndIf EndFor Endfor EndSub Sub Collision_ep 'for enemies and player px1 = Shapes.GetLeft(player) py1 = Shapes.GetTop(player) px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2) ay1=Array.GetValue(enemy_PosY,i2) ax2=ax1+enemy_size ay2=ay1+enemy_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy nbr i2 and player ' animate explosion and decrease lives next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,ax1,ay1) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor px1 = paddleX py1 = paddleY px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i3 = 1 to Enemy_AmmoCount ' enemy position ax1=Shapes.GetLeft(Array.GetValue(enemy_Ammo,i3)) ay1=Shapes.GetTop(Array.GetValue(enemy_Ammo,i3)) ax2=ax1+enemy_ammo_size ay2=ay1+enemy_ammo_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy ammo nbr i3 and player ' animate explosion and decrease lives Enemy_Ammo_nextRemove = i3 RemoveEnemy_Ammo() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor EndSub Sub IslandsPosition ' island positions, avoid randomGeneration and islands overlap islandPos[0][1]=1 islandPos[0][2]=0 islandPos[0][3]=-150 islandPos[1][1]=1 islandPos[1][2]=-Math.Round(gameWidth/2) islandPos[1][3]=-150 islandPos[2][1]=2 islandPos[2][2]=-2*Math.Round(gameWidth/3) islandPos[2][3]=-150 islandPos[3][1]=1 islandPos[3][2]=2*Math.Round(gameWidth/3) islandPos[3][3]=-150 islandPos[4][1]=2 islandPos[4][2]=gameWidth islandPos[4][3]=-150 islandPos[5][1]=3 islandPos[5][2]=Math.Round(gameWidth/3) islandPos[5][3]=-150 islandPos[6][1]=3 islandPos[6][2]=-gameWidth islandPos[6][3]=-150 EndSub Sub define_paths enemyPath[0][0][0] = 3 'nbr of strait lines of path enemyPath[0][1][1] = 30 'from 0 to this in timeline enemyPath[0][1][2] = 100 ' from this to next in timeline enemyPath[0][1][3] = 400 'sprite goes up enemyPath[0][2][1] = 0 'first line rotation = 0 enemyPath[0][2][2] = 45 ' second line rotation = 45 enemyPath[0][2][3] = 45 enemyPath[0][3][1] = enemy_speed ' first line x movment enemyPath[0][3][2] = enemy_speed 'second line x movment enemyPath[0][3][3] = enemy_speed ' third line ... enemyPath[0][4][1] = 0 ' first line y movment enemyPath[0][4][2] = enemy_speed enemyPath[0][4][3] = enemy_speed '---------- second path enemyPath[1][0][0] = 4 enemyPath[1][1][1] = 1 enemyPath[1][1][2] = 1 enemyPath[1][1][3] = 100 enemyPath[1][1][4] = 400 enemyPath[1][2][1] = 180 enemyPath[1][2][2] = 135 enemyPath[1][2][3] = 135 enemyPath[1][2][4] = 90 enemyPath[1][3][1] = -enemy_speed enemyPath[1][3][2] = -enemy_speed enemyPath[1][3][3] = -enemy_speed enemyPath[1][3][4] = 0 enemyPath[1][4][1] = 0 enemyPath[1][4][2] = 0 enemyPath[1][4][3] = enemy_speed enemyPath[1][4][4] = enemy_speed 'round r=5 enemyPath[2][0][0]=21 enemyPath[2][1][1]=50 enemyPath[2][1][2]=55 enemyPath[2][1][3]=60 enemyPath[2][1][4]=65 enemyPath[2][1][5]=70 enemyPath[2][1][6]=75 enemyPath[2][1][7]=80 enemyPath[2][1][8]=85 enemyPath[2][1][9]=90 enemyPath[2][1][10]=95 enemyPath[2][1][11]=100 enemyPath[2][1][12]=105 enemyPath[2][1][13]=110 enemyPath[2][1][14]=115 enemyPath[2][1][15]=120 enemyPath[2][1][16]=125 enemyPath[2][1][17]=130 enemyPath[2][1][18]=135 enemyPath[2][1][19]=140 enemyPath[2][1][20]=145 enemyPath[2][1][21]=350 enemyPath[2][2][1]=0 enemyPath[2][2][2]=18 enemyPath[2][2][3]=36 enemyPath[2][2][4]=54 enemyPath[2][2][5]=72 enemyPath[2][2][6]=90 enemyPath[2][2][7]=108 enemyPath[2][2][8]=126 enemyPath[2][2][9]=144 enemyPath[2][2][10]=162 enemyPath[2][2][11]=180 enemyPath[2][2][12]=198 enemyPath[2][2][13]=216 enemyPath[2][2][14]=234 enemyPath[2][2][15]=252 enemyPath[2][2][16]=-90 enemyPath[2][2][17]=-72 enemyPath[2][2][18]=-54 enemyPath[2][2][19]=-36 enemyPath[2][2][20]=-18 enemyPath[2][2][21]=0 enemyPath[2][3][1]=enemy_speed enemyPath[2][3][2]=0.95*enemy_speed enemyPath[2][3][3]=0.81*enemy_speed enemyPath[2][3][4]=0.59*enemy_speed enemyPath[2][3][5]=0.31*enemy_speed enemyPath[2][3][6]=0 enemyPath[2][3][7]=-0.31*enemy_speed enemyPath[2][3][8]=-0.59*enemy_speed enemyPath[2][3][9]=-0.81*enemy_speed enemyPath[2][3][10]=-0.95*enemy_speed enemyPath[2][3][11]=-enemy_speed enemyPath[2][3][12]=-0.95*enemy_speed enemyPath[2][3][13]=-0.81*enemy_speed enemyPath[2][3][14]=-0.59*enemy_speed enemyPath[2][3][15]=-0.31*enemy_speed enemyPath[2][3][16]=0 enemyPath[2][3][17]=0.31*enemy_speed enemyPath[2][3][18]=0.59*enemy_speed enemyPath[2][3][19]=0.81*enemy_speed enemyPath[2][3][20]=0.95*enemy_speed enemyPath[2][3][21]=enemy_speed enemyPath[2][4][1]=0 enemyPath[2][4][2]=0.31*enemy_speed enemyPath[2][4][3]=0.59*enemy_speed enemyPath[2][4][4]=0.81*enemy_speed enemyPath[2][4][5]=0.95*enemy_speed enemyPath[2][4][6]=enemy_speed enemyPath[2][4][7]=0.95*enemy_speed enemyPath[2][4][8]=0.81*enemy_speed enemyPath[2][4][9]=0.59*enemy_speed enemyPath[2][4][10]=0.31*enemy_speed enemyPath[2][4][11]=0 enemyPath[2][4][12]=-0.31*enemy_speed enemyPath[2][4][13]=-0.59*enemy_speed enemyPath[2][4][14]=-0.81*enemy_speed enemyPath[2][4][15]=-0.95*enemy_speed enemyPath[2][4][16]=-enemy_speed enemyPath[2][4][17]=-0.95*enemy_speed enemyPath[2][4][18]=-0.81*enemy_speed enemyPath[2][4][19]=-0.59*enemy_speed enemyPath[2][4][20]=-0.31*enemy_speed enemyPath[2][4][21]=0 'round r=20 enemyPath[3][0][0]=21 enemyPath[3][1][1]=120 enemyPath[3][1][2]=140 enemyPath[3][1][3]=160 enemyPath[3][1][4]=180 enemyPath[3][1][5]=200 enemyPath[3][1][6]=220 enemyPath[3][1][7]=240 enemyPath[3][1][8]=260 enemyPath[3][1][9]=280 enemyPath[3][1][10]=300 enemyPath[3][1][11]=320 enemyPath[3][1][12]=340 enemyPath[3][1][13]=360 enemyPath[3][1][14]=380 enemyPath[3][1][15]=400 enemyPath[3][1][16]=420 enemyPath[3][1][17]=440 enemyPath[3][1][18]=460 enemyPath[3][1][19]=480 enemyPath[3][1][20]=500 enemyPath[3][1][21]=600 enemyPath[3][2][1]=0 enemyPath[3][2][2]=18 enemyPath[3][2][3]=36 enemyPath[3][2][4]=54 enemyPath[3][2][5]=72 enemyPath[3][2][6]=90 enemyPath[3][2][7]=108 enemyPath[3][2][8]=126 enemyPath[3][2][9]=144 enemyPath[3][2][10]=162 enemyPath[3][2][11]=180 enemyPath[3][2][12]=198 enemyPath[3][2][13]=216 enemyPath[3][2][14]=234 enemyPath[3][2][15]=252 enemyPath[3][2][16]=-90 enemyPath[3][2][17]=-72 enemyPath[3][2][18]=-54 enemyPath[3][2][19]=-36 enemyPath[3][2][20]=-18 enemyPath[3][2][21]=0 enemyPath[3][3][1]=enemy_speed enemyPath[3][3][2]=0.95*enemy_speed enemyPath[3][3][3]=0.81*enemy_speed enemyPath[3][3][4]=0.59*enemy_speed enemyPath[3][3][5]=0.31*enemy_speed enemyPath[3][3][6]=0 enemyPath[3][3][7]=-0.31*enemy_speed enemyPath[3][3][8]=-0.59*enemy_speed enemyPath[3][3][9]=-0.81*enemy_speed enemyPath[3][3][10]=-0.95*enemy_speed enemyPath[3][3][11]=-enemy_speed enemyPath[3][3][12]=-0.95*enemy_speed enemyPath[3][3][13]=-0.81*enemy_speed enemyPath[3][3][14]=-0.59*enemy_speed enemyPath[3][3][15]=-0.31*enemy_speed enemyPath[3][3][16]=0 enemyPath[3][3][17]=0.31*enemy_speed enemyPath[3][3][18]=0.59*enemy_speed enemyPath[3][3][19]=0.81*enemy_speed enemyPath[3][3][20]=0.95*enemy_speed enemyPath[3][3][21]=enemy_speed enemyPath[3][4][1]=0 enemyPath[3][4][2]=0.31*enemy_speed enemyPath[3][4][3]=0.59*enemy_speed enemyPath[3][4][4]=0.81*enemy_speed enemyPath[3][4][5]=0.95*enemy_speed enemyPath[3][4][6]=enemy_speed enemyPath[3][4][7]=0.95*enemy_speed enemyPath[3][4][8]=0.81*enemy_speed enemyPath[3][4][9]=0.59*enemy_speed enemyPath[3][4][10]=0.31*enemy_speed enemyPath[3][4][11]=0 enemyPath[3][4][12]=-0.31*enemy_speed enemyPath[3][4][13]=-0.59*enemy_speed enemyPath[3][4][14]=-0.81*enemy_speed enemyPath[3][4][15]=-0.95*enemy_speed enemyPath[3][4][16]=-enemy_speed enemyPath[3][4][17]=-0.95*enemy_speed enemyPath[3][4][18]=-0.81*enemy_speed enemyPath[3][4][19]=-0.59*enemy_speed enemyPath[3][4][20]=-0.31*enemy_speed enemyPath[3][4][21]=0 'round r=10 enemyPath[4][0][0]=21 enemyPath[4][1][1]=110 enemyPath[4][1][2]=120 enemyPath[4][1][3]=130 enemyPath[4][1][4]=140 enemyPath[4][1][5]=150 enemyPath[4][1][6]=160 enemyPath[4][1][7]=170 enemyPath[4][1][8]=180 enemyPath[4][1][9]=190 enemyPath[4][1][10]=200 enemyPath[4][1][11]=210 enemyPath[4][1][12]=220 enemyPath[4][1][13]=230 enemyPath[4][1][14]=240 enemyPath[4][1][15]=250 enemyPath[4][1][16]=260 enemyPath[4][1][17]=270 enemyPath[4][1][18]=280 enemyPath[4][1][19]=290 enemyPath[4][1][20]=300 enemyPath[4][1][21]=500 enemyPath[4][2][1]=0 enemyPath[4][2][2]=18 enemyPath[4][2][3]=36 enemyPath[4][2][4]=54 enemyPath[4][2][5]=72 enemyPath[4][2][6]=90 enemyPath[4][2][7]=108 enemyPath[4][2][8]=126 enemyPath[4][2][9]=144 enemyPath[4][2][10]=162 enemyPath[4][2][11]=180 enemyPath[4][2][12]=198 enemyPath[4][2][13]=216 enemyPath[4][2][14]=234 enemyPath[4][2][15]=252 enemyPath[4][2][16]=-90 enemyPath[4][2][17]=-72 enemyPath[4][2][18]=-54 enemyPath[4][2][19]=-36 enemyPath[4][2][20]=-18 enemyPath[4][2][21]=0 enemyPath[4][3][1]=enemy_speed enemyPath[4][3][2]=0.95*enemy_speed enemyPath[4][3][3]=0.81*enemy_speed enemyPath[4][3][4]=0.59*enemy_speed enemyPath[4][3][5]=0.31*enemy_speed enemyPath[4][3][6]=0 enemyPath[4][3][7]=-0.31*enemy_speed enemyPath[4][3][8]=-0.59*enemy_speed enemyPath[4][3][9]=-0.81*enemy_speed enemyPath[4][3][10]=-0.95*enemy_speed enemyPath[4][3][11]=-enemy_speed enemyPath[4][3][12]=-0.95*enemy_speed enemyPath[4][3][13]=-0.81*enemy_speed enemyPath[4][3][14]=-0.59*enemy_speed enemyPath[4][3][15]=-0.31*enemy_speed enemyPath[4][3][16]=0 enemyPath[4][3][17]=0.31*enemy_speed enemyPath[4][3][18]=0.59*enemy_speed enemyPath[4][3][19]=0.81*enemy_speed enemyPath[4][3][20]=0.95*enemy_speed enemyPath[4][3][21]=enemy_speed enemyPath[4][4][1]=0 enemyPath[4][4][2]=0.31*enemy_speed enemyPath[4][4][3]=0.59*enemy_speed enemyPath[4][4][4]=0.81*enemy_speed enemyPath[4][4][5]=0.95*enemy_speed enemyPath[4][4][6]=enemy_speed enemyPath[4][4][7]=0.95*enemy_speed enemyPath[4][4][8]=0.81*enemy_speed enemyPath[4][4][9]=0.59*enemy_speed enemyPath[4][4][10]=0.31*enemy_speed enemyPath[4][4][11]=0 enemyPath[4][4][12]=-0.31*enemy_speed enemyPath[4][4][13]=-0.59*enemy_speed enemyPath[4][4][14]=-0.81*enemy_speed enemyPath[4][4][15]=-0.95*enemy_speed enemyPath[4][4][16]=-enemy_speed enemyPath[4][4][17]=-0.95*enemy_speed enemyPath[4][4][18]=-0.81*enemy_speed enemyPath[4][4][19]=-0.59*enemy_speed enemyPath[4][4][20]=-0.31*enemy_speed enemyPath[4][4][21]=0 'round r=15 + exit down enemyPath[5][0][0]=27 enemyPath[5][1][1]=120 enemyPath[5][1][2]=125 enemyPath[5][1][3]=150 enemyPath[5][1][4]=165 enemyPath[5][1][5]=180 enemyPath[5][1][6]=195 enemyPath[5][1][7]=210 enemyPath[5][1][8]=225 enemyPath[5][1][9]=240 enemyPath[5][1][10]=255 enemyPath[5][1][11]=270 enemyPath[5][1][12]=285 enemyPath[5][1][13]=300 enemyPath[5][1][14]=315 enemyPath[5][1][15]=330 enemyPath[5][1][16]=345 enemyPath[5][1][17]=360 enemyPath[5][1][18]=375 enemyPath[5][1][19]=390 enemyPath[5][1][20]=405 enemyPath[5][1][21]=600 enemyPath[5][1][22]=615 enemyPath[5][1][23]=630 enemyPath[5][1][24]=645 enemyPath[5][1][254]=660 enemyPath[5][1][26]=675 enemyPath[5][1][27]=800 enemyPath[5][2][1]=0 enemyPath[5][2][2]=18 enemyPath[5][2][3]=36 enemyPath[5][2][4]=54 enemyPath[5][2][5]=72 enemyPath[5][2][6]=90 enemyPath[5][2][7]=108 enemyPath[5][2][8]=126 enemyPath[5][2][9]=144 enemyPath[5][2][10]=162 enemyPath[5][2][11]=180 enemyPath[5][2][12]=198 enemyPath[5][2][13]=216 enemyPath[5][2][14]=234 enemyPath[5][2][15]=252 enemyPath[5][2][16]=-90 enemyPath[5][2][17]=-72 enemyPath[5][2][18]=-54 enemyPath[5][2][19]=-36 enemyPath[5][2][20]=-18 enemyPath[5][2][21]=0 enemyPath[5][2][22]=18 enemyPath[5][2][23]=36 enemyPath[5][2][24]=54 enemyPath[5][2][25]=72 enemyPath[5][2][26]=90 enemyPath[5][2][27]=90 enemyPath[5][3][1]=enemy_speed enemyPath[5][3][2]=0.95*enemy_speed enemyPath[5][3][3]=0.81*enemy_speed enemyPath[5][3][4]=0.59*enemy_speed enemyPath[5][3][5]=0.31*enemy_speed enemyPath[5][3][6]=0 enemyPath[5][3][7]=-0.31*enemy_speed enemyPath[5][3][8]=-0.59*enemy_speed enemyPath[5][3][9]=-0.81*enemy_speed enemyPath[5][3][10]=-0.95*enemy_speed enemyPath[5][3][11]=-enemy_speed enemyPath[5][3][12]=-0.95*enemy_speed enemyPath[5][3][13]=-0.81*enemy_speed enemyPath[5][3][14]=-0.59*enemy_speed enemyPath[5][3][15]=-0.31*enemy_speed enemyPath[5][3][16]=0 enemyPath[5][3][17]=0.31*enemy_speed enemyPath[5][3][18]=0.59*enemy_speed enemyPath[5][3][19]=0.81*enemy_speed enemyPath[5][3][20]=0.95*enemy_speed enemyPath[5][3][21]=enemy_speed enemyPath[5][3][22]=0.95*enemy_speed enemyPath[5][3][23]=0.81*enemy_speed enemyPath[5][3][24]=0.59*enemy_speed enemyPath[5][3][25]=0.31*enemy_speed enemyPath[5][3][26]=0 enemyPath[5][3][27]=0 enemyPath[5][4][1]=0 enemyPath[5][4][2]=0.31*enemy_speed enemyPath[5][4][3]=0.59*enemy_speed enemyPath[5][4][4]=0.81*enemy_speed enemyPath[5][4][5]=0.95*enemy_speed enemyPath[5][4][6]=enemy_speed enemyPath[5][4][7]=0.95*enemy_speed enemyPath[5][4][8]=0.81*enemy_speed enemyPath[5][4][9]=0.59*enemy_speed enemyPath[5][4][10]=0.31*enemy_speed enemyPath[5][4][11]=0 enemyPath[5][4][12]=-0.31*enemy_speed enemyPath[5][4][13]=-0.59*enemy_speed enemyPath[5][4][14]=-0.81*enemy_speed enemyPath[5][4][15]=-0.95*enemy_speed enemyPath[5][4][16]=-enemy_speed enemyPath[5][4][17]=-0.95*enemy_speed enemyPath[5][4][18]=-0.81*enemy_speed enemyPath[5][4][19]=-0.59*enemy_speed enemyPath[5][4][20]=-0.31*enemy_speed enemyPath[5][4][21]=0 enemyPath[5][4][22]=0.31*enemy_speed enemyPath[5][4][23]=0.59*enemy_speed enemyPath[5][4][24]=0.81*enemy_speed enemyPath[5][4][25]=0.95*enemy_speed enemyPath[5][4][26]=enemy_speed enemyPath[5][4][27]=enemy_speed enemyPath[6][0][0]=3 enemyPath[6][1][1]=1 enemyPath[6][1][2]=80 enemyPath[6][1][3]=200 enemyPath[6][2][1]=0 enemyPath[6][2][2]=90 enemyPath[6][2][3]=-90 enemyPath[6][3][1]=0 enemyPath[6][3][2]=0 enemyPath[6][3][3]=0 enemyPath[6][4][1]=0 enemyPath[6][4][2]=enemy_speed enemyPath[6][4][3]=-enemy_speed EndSub Sub create_level1 'this define the behavior of the différent squadron along the time play for level 1 level1[1][1]=20 'when timeplay=level1[1][1] level1[1][2]= 2 ' lauch enemy with Path level1[1][2] level1[1][3]= -10 ' at x coordinate level1[1][3] level1[1][4] = 0 ' at y coordinate level1[1][4] level1[1][5] = 1 ' 1 for create enemy at the left side; 2 for the right side of screen level1[1][6] = 4 'level[1][6] is the number of enemies level1[1][7] = 1 'type of enemy level1[2][1]= 80 level1[2][2]= 6 level1[2][3]= gameWidth/2 level1[2][4] = -500 level1[2][5] = 1 level1[2][6] = 3 level1[2][7] = 1 level1[3][1]= 150 level1[3][2]= 0 level1[3][3]= -10 level1[3][4] = 0 level1[3][5] = 1 level1[3][6] = 6 level1[3][7] = 2 level1[4][1]= 280 level1[4][2]= 4 level1[4][3]= -10 level1[4][4] = 0 level1[4][5] = 1 level1[4][6] = 3 level1[4][7] = 2 level1[5][1]= 410 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 3 level1[5][7] = 1 level1[6][1]= 430 level1[6][2]= 6 level1[6][3]= 2*gameWidth/3 level1[6][4] = -50 level1[6][5] = 2 level1[6][6] = 3 level1[6][7] = 1 level1[5][1]= 500 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 6 level1[5][7] = 2 level1[6][1]= 590 level1[6][2]= 5 level1[6][3]= 100 level1[6][4] = -80 level1[6][5] = 1 level1[6][6] = 3 level1[6][7] = 3 level1[7][1]= 690 level1[7][2]= 6 level1[7][3]= gameWidth/3 level1[7][4] = -50 level1[7][5] = 2 level1[7][6] = 3 level1[7][7] = 2 For i= 1 To 10 Level1[7+i][1]=700+50*i level1[7+i][2]= 6 level1[7+i][3]= math.GetrandomNumber(gameWidth) level1[7+i][4] = -50 +i level1[7+i][5] = math.GetrandomNumber(2) level1[7+i][6] = math.GetrandomNumber(3) level1[7+i][7] = math.GetrandomNumber(2) EndFor level1[18][1]= 1300 level1[18][2]= 1 level1[18][3]= gameWidth level1[18][4] = -10 level1[18][5] = 2 level1[18][6] = 6 level1[18][7] = 2 For i= 1 To 10 Level1[18+i][1]=1330+50*i level1[18+i][2]= 4+math.GetrandomNumber(2) level1[18+i][3]= math.GetrandomNumber(50) level1[18+i][4] = i level1[18+i][5] = 1 level1[18+i][6] = math.GetrandomNumber(3) level1[18+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[28+i][1]=1900+50*i level1[28+i][2]= 4+math.GetrandomNumber(2) level1[28+i][3]= -math.GetrandomNumber(50) level1[28+i][4] = i level1[28+i][5] = 1 level1[28+i][6] = math.GetrandomNumber(3) level1[28+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[38+i][1]=2450+100*i level1[38+i][2]= 6 level1[38+i][3]= math.GetrandomNumber(gameWidth) level1[38+i][4] = -50 +i level1[38+i][5] = math.GetrandomNumber(2) level1[38+i][6] = math.GetrandomNumber(5) level1[38+i][7] = math.GetrandomNumber(2) EndFor EndSub End>RHF528.sb< Start>RHF894.sb< GraphicsWindow.BackgroundColor="teal GraphicsWindow.BrushColor="orange GraphicsWindow.Title ="Brickout GraphicsWindow.Width =950 f2=1.5 For y=1 To 8 x=1 GraphicsWindow.PenWidth =0 rr=math.Remainder (y 2)*20 p300=355 p20=28 If rr>0 Then ps=0 dww() Endif ' Program.Delay (333) brw= LDShapes.BrushGradient ("1=brown;2=brown" "DD") brk= LDShapes.BrushGradient ("1=brown;2=black" "DD") 'Program.Delay (333) For f=1 To 10 dhx=x*42+rr+p20 dhy=p300-y*22 dvx=x*42+40+rr+p20 mkp() GraphicsWindow.BrushColor="orange GraphicsWindow.FillRectangle (x*42+rr+p20 p300-y*22 40 20) x=x+1 EndFor ' Program.Delay (333) x=1 For f=1 To 5 f300=485 dhx=x*42+rr+p20 +f300 dhy=p300-y*22 - 65 dvx=x*42+40+rr+p20 +f300 mkp() If f<5 or y=8 then GraphicsWindow.BrushColor=LDColours.HSLtoRGB (30 .8 .52) GraphicsWindow.FillRectangle (x*42+rr+p20+f300 p300-y*22- 65 40 20) endif x=x+1 endfor If rr=0 Then ps=1 dww() Endif x=1 For f=1 To 5 f300=630 dhx=x*42+rr+p20 +f300 dhy=p300-y*22 dvx=x*42+40+rr+p20 +f300 mkp() GraphicsWindow.BrushColor="orange GraphicsWindow.FillRectangle (x*42+rr+p20+f300 p300-y*22 40 20) x=x+1 endfor EndFor Sub mkp hp[1][1]=dhx hp[1][2]=dhy hp[2][1]=40+dhx hp[2][2]=dhy hp[3][1]=55+dhx hp[3][2]=-10+dhy hp[4][1]=15+dhx hp[4][2]=-10+dhy vp[1][1]=dvx vp[1][2]=dhy vp[2][1]=dvx vp[2][2]=20+dhy vp[3][1]=15+dvx vp[3][2]=10+dhy vp[4][1]=15+dvx vp[4][2]=-10+dhy LDShapes.BrushPolygon (brw hp) LDShapes.BrushPolygon (brk vp) EndSub sub dww c1=LDColours.HSLtoRGB (30 .7 .45) b1= LDShapes.BrushGradient ("1="+c1+";2="+c1 "DD") b2= LDShapes.BrushGradient ("1=brown;2=black" "DD") For dd=0 To 1 For qq=3 To 1 Step -1 If dd=0 then sy=355-(y+qq-1)*22-rr/f2 sx=(qq-1)*22+rr/f2 +490+dd*209 Else sy=355-(y+qq-1)*22-(20-rr)/f2 sx=(qq-1)*22+(20-rr)/f2 +490+dd*209 endif GraphicsWindow.BrushColor = LDColours.HSLtoRGB (30 .7 .25) GraphicsWindow.FillRectangle (2+sx sy 20 20) dx=22+sx dp[1][1]=dx dp[1][2]=sy dp[2][1]=dx dp[2][2]=20+sy dp[3][1]=20+dx dp[3][2]=sy dp[4][1]=20+dx dp[4][2]=sy-20 dt[1][1]=sx dt[1][2]=sy dt[2][1]=20+sx dt[2][2]=sy dt[3][1]=40+sx dt[3][2]=sy-20 dt[4][1]=20+sx dt[4][2]=sy-20 LDShapes.BrushPolygon (b1 dp) LDShapes.BrushPolygon (b2 dt) EndFor EndFor EndSub End>RHF894.sb< Start>RHH083.sb< line1 = "HELLO JOHN MY DAY WAS great!! How are you?!" line2 = "HELLO MY DAY TODAY WAS GREAT. How are you?" punctuation = ",.!?()[]{};:@-" 'Treated as separate words 'Parse line1 phrase = line1 GetWords() words1 = words spaces1 = spaces nWord1 = Array.GetItemCount(words1) 'Parse line2 phrase = line2 GetWords() words2 = words spaces2 = spaces nWord2 = Array.GetItemCount(words2) word1 = 1 word2 = 1 maxWords = Math.Max(nWord1,nWord2)+1 'To use when looking for future matches While (word1 <= nWord1 And word2 <= nWord2) If (word1 > nWord1) Then 'Line1 has finshed word2 = nWord2 ElseIf (word2 > nWord2) Then 'Line2 has finshed word1 = nWord1 ElseIf (words1[word1] = words2[word2]) Then 'Current words are the same status1[word1] = 1 status2[word2] = 1 ElseIf (Text.ConvertToLowerCase(words1[word1]) = Text.ConvertToLowerCase(words2[word2])) Then 'Current words are the same (but different case) status1[word1] = 2 status2[word2] = 2 Else 'Look a word in line2 that matches current line1 word (case insensitive) next2 = maxWords For i = word2+1 To nWord2 If (Text.ConvertToLowerCase(words1[word1]) = Text.ConvertToLowerCase(words2[i])) Then next2 = i-word2 i = nWord2 EndIf EndFor 'Look a word in line1 that matches current line2 word (case insensitive) next1 = maxWords For i = word1+1 To nWord1 If (Text.ConvertToLowerCase(words2[word2]) = Text.ConvertToLowerCase(words1[i])) Then next1 = i-word1 i = nWord1 EndIf EndFor If (next1 <> next2) Then 'A match was found - set a case match If (next1 < next2) Then 'We found a match to line2 word earlier in line1 - so move to it word1 = word1+next1 ElseIf (next2 < next1) Then 'We found a match to line1 word earlier in line2 - so move to it word2 = word2+next2 EndIf If (words1[word1] = words2[word2]) Then 'Same case status1[word1] = 1 status2[word2] = 1 Else 'Different case status1[word1] = 2 status2[word2] = 2 EndIf EndIf EndIf 'Next words word1 = word1+1 word2 = word2+1 EndWhile 'Output Line 1 matches + spaces For i = 0 To nWord1 If (status1[i] = 1) Then TextWindow.ForegroundColor = "Green" ElseIf (status1[i] = 2) Then TextWindow.ForegroundColor = "Yellow" Else TextWindow.ForegroundColor = "Red" EndIf TextWindow.Write(words1[i]) TextWindow.Write(spaces1[i]) EndFor TextWindow.WriteLine("") 'Output Line 2 matches + spaces (start from 0 for possible spaces at the start) For i = 0 To nWord2 If (status2[i] = 1) Then TextWindow.ForegroundColor = "Green" ElseIf (status2[i] = 2) Then TextWindow.ForegroundColor = "Yellow" Else TextWindow.ForegroundColor = "Red" EndIf TextWindow.Write(words2[i]) TextWindow.Write(spaces2[i]) EndFor TextWindow.WriteLine("") 'Parse a line to find words separated by space(s) - we could also consider ignoring punctuation, but not here Sub GetWords words = "" spaces = "" isWord = "False" count = 0 For i = 1 To Text.GetLength(phrase) char = Text.GetSubText(phrase,i,1) If (char = " ") Then 'We are not in a word add number of spaces (these ares spaces after the word - count = 0 is initial spaces before first word) isWord = "False" spaces[count] = Text.Append(spaces[count],char) ElseIf (Text.IsSubText(punctuation,char)) Then 'Treat punctation as a new separate word count = count+1 words[count] = char isWord = "False" ElseIf (isWord) Then 'We are in the middle of a word so update it words[count] = Text.Append(words[count],char) Else 'A new word has started count = count+1 isWord = "True" words[count] = char EndIf EndFor EndSub End>RHH083.sb< Start>RHH485.sb< GraphicsWindow.Title = "Saltire" GraphicsWindow.Width = 650 GraphicsWindow.Height = 400 GraphicsWindow.BackgroundColor = "#100090" GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 65 GraphicsWindow.DrawLine(0,0,650,400) GraphicsWindow.DrawLine(0,400,650,0) End>RHH485.sb< Start>RHL451.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!) + MEGA EPIC ITEMS! xD 'questgiver (HOW!?!?!) + daily quests '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!") TextWindow.WriteLine("Diablo roams the streets of the human world once again.") 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 Tristram") 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("Tristram ") 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("Tristram") space() EndIf If x = 1 And (2 <= y And y <= 6) Then TextWindow.WriteLine("Tristram") 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("Bloodletter: Has a 40% chance to siphon the enemy hp and add it to yours") space() TextWindow.WriteLine("Thunderfury, Blessed Blade of the Windseeker: 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 merchants around the world randomly.") space() space() TextWindow.WriteLine("Tristram: 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("In safe zones you will randomly find potions.") TextWindow.WriteLine("Towns will always have one or two merchants. ") space() space() TextWindow.WriteLine("Tristram: 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("Nephalem Health: " + playerhp + "/" + totalplayerhp + " Nephalem Mana: " + playermp + "/" + totalplayermp) space() space() TextWindow.WriteLine("1. Strength: " + playerstr + " Gives 1 damage per point") TextWindow.WriteLine("2. Vitality: " + playervit + " Gives 5 health per point") TextWindow.WriteLine("3. Endurance: " + playerdef + " Reduces 1 damage per point") TextWindow.WriteLine("4. Intelligence: " + playerint + " Gives 3 mana points 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 have found a Health Potion.") space() enter() hppot = hppot + 1 selectlocation() elseIf randomencounter1 < 10 then TextWindow.Clear() TextWindow.WriteLine("You have found a Mana 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("Health Pot: x" + hppot + " Mana Pot: x" + mppot) space() TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Buy 1 Health Pot for 10 gold") TextWindow.WriteLine("2. Buy 1 Mana Pot for 10 gold") space() TextWindow.WriteLine("3. Sell 1 Health Pot for 5 gold") TextWindow.WriteLine("4. Sell 1 Mana Pot for 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 Bloodletter x" + activatevls + " Cost: 50 gold") TextWindow.WriteLine("2. Buy Thunderfury, Blessed Blade of the Windseeker 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 Bloodletter!") 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 Thunderfury, Blessed Blade of the Windseeker!") activatelbs = 1 activatevls = 0 playergold = playergold - 50 TextWindow.Clear() weapons() elseif weapon1 = 3 then TextWindow.Clear() shop() Else wrongoption() weapons() EndIf EndSub Sub bloodletter If activatevls = 1 then vlschance = Math.GetRandomNumber(100) If vlschance <40 Then vlssiphon = enemyhp/10 weapon = "Bloodletter" enemyhp = enemyhp - vlssiphon playerhp = playerhp + vlssiphon space() TextWindow.WriteLine("Bloodletter siphons " + vlssiphon + " Health Points") 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 = "Thunderfury, Blessed Blade of the Windseeker" 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 stuned 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 stuned for 1 turn.") space() enter() battle() endsub Sub weaponname If activatevls = 1 then weapon = "Bloodletter" EndIf If activatelbs = 1 then weapon = "Thunderfury, Blessed Blade of the Windseeker" 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("Nephalem Health: " + playerhp + "/" + totalplayerhp+ " Nephalem Mana: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use Health Pot x" + hppot) TextWindow.WriteLine("2. Use Mana 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 gained 15 Health Points") 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 gained 15 Mana Points") 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("Your 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("Nephalem Helth: " + playerhp + "/" + totalplayerhp+ " Nephalem Mana: " + 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("Nephalem Health: " + playerhp + "/" + totalplayerhp+ " Nephalem Mana: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use Health Pot x" + hppot) TextWindow.WriteLine("2. Use Mana 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 gained 15 Health Points") 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 gained 15 Mana Points") 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("Nephalem Health: " + playerhp + "/" + totalplayerhp+ " Nephalem Mana: " + playermp + "/" + totalplayermp) TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp) space() TextWindow.WriteLine("1. Instant Critical strike Cost: 5 Mana") TextWindow.WriteLine("2. Heal Cost: 5 Mana") TextWindow.WriteLine("3. Cast a powerfull spell| NEED SUB MENU/FUNCTIONS!") 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 health points.") 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.") bloodletter() 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 have defeated " + enemyname + ",mortal") space() TextWindow.WriteLine("You gained " + xpdrop + " experience.") TextWindow.WriteLine("You gained " + golddrop + " gold.") playerxp = playerxp + xpdrop playergold = playergold + golddrop space() enter() selectlocation() EndSub Sub defeat TextWindow.Clear() TextWindow.WriteLine("You have been defeated by " + enemyname + ".") TextWindow.WriteLine("Your deeds of valor shall be remembered.") enter() Program.End() EndSub End>RHL451.sb< Start>RHN132.sb< 'created by : 'Antonio Augusto Barbaro 'aabproducoes.peperonity.com 'aabproducoes.cwap.me 'facebook.com/antonio.augusto.9444023 'aaugusto444@gmail.com 'Multi Leafes Draw 0.1 'All the leafes are created using simply commands 'Very thanks to play my program 'Thanks Sb and LitDev too GraphicsWindow.Width=400 GraphicsWindow.Height=400 GraphicsWindow.CanResize=0 GraphicsWindow.Title="Leafes Draw 0.1" GraphicsWindow.DrawText(10,30,"Use LEFT and RIGHT to change the leafe draw") GraphicsWindow.PenColor="Green" GraphicsWindow.BrushColor="DarkGreen" gw= GraphicsWindow.Width gh= GraphicsWindow.Height cx= gw/2 cy= gh/2 leaf_number= 9 ckd= 0 avaible= 1 GraphicsWindow.KeyDown=kd Sub kd 'remove all variables and arrays If avaible=1 Then 'verify if the draw is ended avaible=0 cnt=0 pxc="" pyc="" LDArray.Delete(px) LDArray.Delete(py) GraphicsWindow.Clear() If GraphicsWindow.LastKey="Left" Then ckd=ckd-1 If ckd<=0 Then ckd=leaf_number EndIf ElseIf GraphicsWindow.LastKey="Right" then ckd= ckd+1 If ckd>leaf_number then ckd=1 EndIf EndIf GraphicsWindow.Title="Drawing "+ckd GraphicsWindow.Clear() If ckd=1 Then dl2() ElseIf ckd=2 then dl3() elseif ckd=3 then dl4() elseif ckd=4 then dl5() elseif ckd=5 then dl6() elseif ckd=6 then dl7() elseif ckd=7 then dl8() elseif ckd=8 then dl9() elseif ckd=9 then dl10() EndIf avaible=1 EndIf EndSub sub dl2 For i=1 To 20 Step 2 ang= i*Math.Pi/10-Math.Pi/2 pxc= cx+150*Math.Cos(ang) pyc= cy+150*Math.Sin(ang) If i<6 Or i>14 Then cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndIf EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 180/ cnt For i=(p*adv) To ((p*adv)+180) ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+50*Math.Cos(ang) pyc= py[p]+50*Math.Sin(ang) GraphicsWindow.BrushColor="Green" GraphicsWindow.FillEllipse(pxc-5,pyc-5,10,10) GraphicsWindow.PenColor="darkgreen" GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100) EndFor EndFor EndSub sub dl3 For i=1 To 20 Step 2 ang= i*Math.Pi/10-Math.Pi/2 pxc= cx+150*Math.Cos(ang) pyc= cy+150*Math.Sin(ang) If i<6 Or i>14 Then cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndIf EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 180/ cnt For i=1 To 360 ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+50*Math.Cos(ang) pyc= py[p]+50*Math.Sin(ang) GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100) EndFor EndFor EndSub sub dl4 LDArray.Delete(px) For i=1 To 20 Step 2 ang= i*Math.Pi/10-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 180/ cnt For i=1 To 360 ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+20*Math.Cos(ang) pyc= py[p]+10*Math.Sin(ang) GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100) EndFor EndFor EndSub sub dl5 cnt=0 For i=1 To 20 Step 5 ang= i*Math.Pi/10-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 180/ cnt For i=1 To 360 ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+60*Math.Cos(ang) pyc= py[p]+60*Math.Sin(ang) GraphicsWindow.DrawLine(pxc,pyc,cx,cy) EndFor EndFor EndSub sub dl6 For i=1 To 10 ang= i*Math.Pi/5-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 360/ cnt For i=(p*adv) To ((p*adv)+180) ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+60*Math.Cos(ang) pyc= py[p]+60*Math.Sin(ang) GraphicsWindow.DrawLine(pxc,pyc,cx,cy) EndFor EndFor EndSub sub dl7 For i=1 To 10 ang= i*Math.Pi/5-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 360/ cnt For i=(p*adv-90) To ((p*adv)+90) ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+30*Math.Cos(ang) pyc= py[p]+30*Math.Sin(ang) GraphicsWindow.DrawLine(pxc,pyc,cx,cy) EndFor EndFor EndSub sub dl8 cnt=0 For i=1 To 10 ang= i*Math.Pi/5-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 360/ cnt For i=(p*adv-90) To ((p*adv)+90) ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+32*Math.Cos(ang) pyc= py[p]+32*Math.Sin(ang) GraphicsWindow.FillEllipse(pxc-5,pyc-5,10,10) GraphicsWindow.PenColor="Darkgreen" GraphicsWindow.DrawLine(pxc,pyc,cx,cy) EndFor EndFor EndSub sub dl9 cnt=0 For i=1 To 20 Step 3 ang= i*Math.Pi/10-Math.Pi/2 pxc= cx+100*Math.Cos(ang) pyc= cy+100*Math.Sin(ang) If i<8 Or i>12 Then cnt=cnt+1 px[cnt]= pxc py[cnt]= pyc EndIf EndFor GraphicsWindow.BrushColor="Green" For p=1 To cnt adv= 360/ cnt For i=(p*adv-90) To ((p*adv)+90) ang= i*Math.Pi/180-Math.Pi/2 pxc= px[p]+32*Math.Cos(ang) pyc= py[p]+32*Math.Sin(ang) GraphicsWindow.PenColor="Darkgreen" GraphicsWindow.DrawLine(pxc,pyc,cx,cy) EndFor EndFor endsub sub dl10 lenghtx= 30 lenghty=50 cx= gw/2 cy= gh/2 px1= cx py1= 100 px2= cx py2= 250 GraphicsWindow.PenColor="Green" dx= (px2-px1)/100 dy= (py2-py1)/100 For i=1 To 100 Step 2 px= dx*i+px1 py= dy*i+py1 GraphicsWindow.DrawLine(px,py,px-i,py-lenghty+i) GraphicsWindow.DrawLine(px,py,px+i,py-lenghty+i) EndFor EndSub End>RHN132.sb< Start>RHN644-0.sb< GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 Ground = 500 GraphicsWindow.DrawLine(0,Ground,600,Ground) Box_Width = 100 Box_Height = 100 Box_X = 150 Box_Y = 150 Box_VY = 0 Box_Angle = 45 Gravity = 0.1 Pi = Math.Pi Box_Radius = Math.SquareRoot(Box_Width*Box_Width + Box_Height*Box_Height)/2 GraphicsWindow.BrushColor = "Transparent" GraphicsWindow.PenColor = "Green" Box = Shapes.AddRectangle(Box_Width,Box_Height) GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenWidth = 0 For i = 1 To 5 Corner[i] = Shapes.AddRectangle(5,5) endfor While GraphicsWindow.LastKey <> "Escape" Box_VY = Box_VY + Gravity Box_Angle = Box_Angle + 1 Box_Update() Box_Y = Box_Y + Box_VY Program.Delay(15) EndWhile Program.End() Sub Box_Update 'Find lowest corner - we only want one on the ground at any point in time iLow = 1 For i = 2 To 4 If (Corner_Y[i] > Corner_Y[iLow]) Then iLow = i EndIf EndFor 'Check this corner for on the ground and find block centre - due to small rounding errors with the trig we need to to check for 'near' If (Corner_Y[iLow] > Ground Or Math.Abs(Corner_Y[iLow]-Ground) < 1) Then Corner_Y[iLow] = Ground Box_VY = 0 theta = Math.GetRadians(Box_Angle+iLow*90-45+180) Box_X = Corner_X[iLow] + Math.Cos(theta) * Box_Radius Box_Y = Corner_Y[iLow] + Math.Sin(theta) * Box_Radius EndIf 'Rotate box corners For i = 1 To 4 theta = Math.GetRadians(Box_Angle+i*90-45) Corner_X[i] = Box_X + Math.Cos(theta) * Box_Radius Corner_Y[i] = Box_Y + Math.Sin(theta) * Box_Radius Shapes.Move(Corner[i],Corner_X[i]-2.5,Corner_Y[i]-2.5) endfor 'UPDATE BOX Shapes.Move(Box,Box_X-Box_Width/2,Box_Y-Box_Height/2) Shapes.Rotate(Box,Box_Angle) Shapes.Move(Corner[5], Box_X-2.5, Box_Y-2.5) EndSub End>RHN644-0.sb< Start>RHP722.sb< ' Addition by Writing ' Version 0.1 ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Last update 2016-03-14 ' GraphicsWindow.Title = "Addition 0.1" num1 = 12345 num2 = 67890 interval = 1000 ' [ms] Form() GraphicsWindow.PenColor = "LightGray" DrawGrid() While "True" If buttonClicked Then GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(0, 0, gw, gh) GraphicsWindow.PenColor = "LightGray" DrawGrid() GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" ' Input numbers num1 = Controls.GetTextBoxText(tboxN1) num2 = Controls.GetTextBoxText(tboxN2) interval = Controls.GetTextBoxText(tboxInt) ' Calculate each length and positon (column) len1 = Text.GetLength(num1) len2 = Text.GetLength(num2) len = Math.Max(len1, len2) col1 = 2 + (len - len1) col2 = 2 + (len - len2) ' Write numbers param = "col=" + col1 + ";row=1;text=" + num1 + ";" DrawText() Program.Delay(interval) param = "col=" + col2 + ";row=2;text=" + num2 + ";" DrawText() Program.Delay(interval) ' Write a sign + param = "col=1;row=2;text=+;" DrawText() Program.Delay(interval) ' Draw a line param = "col=1;row=2;len=" + (len + 1) + ";" DrawUnderline() Program.Delay(interval) ' Add numbers from ones places c = 0 ' carry For i = 1 To len d1 = Text.GetSubText(num1, len1 - i + 1, 1) d2 = Text.GetSubText(num2, len2 - i + 1, 1) AddDigit() param = "col=" + (2 + len - i) + ";row=3;text=" + d + ";" DrawText() If 0 < c Then param = "col=" + (1 + len - i) + ";row=3;text=" + c + ";" If i < len Then DrawCarry() Else DrawText() EndIf EndIf Program.Delay(interval) EndFor buttonClicked = "False" Else Program.Delay(200) ' wait next button EndIf EndWhile Sub AddDigit ' param d1 - digit1 ' param d2 - digit2 ' param c - carry ' return d - digit ' return c - new carry d = d1 + d2 + c If 1 < Text.GetLength(d) Then c = Text.GetSubText(d, 1, 1) d = Text.GetSubText(d, 2, 1) Else c = 0 EndIf EndSub Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.FontName = "Courier New" fs = 60 fw = fs * 0.6 GraphicsWindow.BrushColor = "Gray" GraphicsWindow.PenWidth = 0 panel = Shapes.AddRectangle(gw, gh - fs * 5) Shapes.SetOpacity(panel, 50) Shapes.Move(panel, 0, fs * 5) GraphicsWindow.FontSize = fs / 3 GraphicsWindow.BrushColor = "Black" txtN1 = Shapes.AddText("Number1") Shapes.Move(txtN1, fw, fs * 5.3) tboxN1 = Controls.AddTextBox(fw * 3.5, fs * 5.26) Controls.SetTextBoxText(tboxN1, num1) txtN2 = Shapes.AddText("Number2") Shapes.Move(txtN2, fw, fs * 6.3) tboxN2 = Controls.AddTextBox(fw * 3.5, fs * 6.26) Controls.SetTextBoxText(tboxN2, num2) txtInt = Shapes.AddText("Interval") Shapes.Move(txtInt, fw * 8.5, fs * 5.3) tboxInt = Controls.AddTextBox(fw * 11.5, fs * 5.26) Controls.SetTextBoxText(tboxInt, interval) Controls.AddButton("Calc", fw * 14, fs * 6.22) Controls.ButtonClicked = OnButtonClicked GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "Black" GraphicsWindow.FontSize = fs EndSub Sub OnButtonClicked buttonClicked = "True" EndSub Sub DrawCarry ' param["col"] - column ' param["row"] - row ' param["text"] - text for carry ' return carry - shape _x = param["col"] * fw _y = param["row"] * fs GraphicsWindow.FontSize = fs * 0.25 GraphicsWindow.DrawText(_x + fw * 0.75, _y, param["text"]) GraphicsWindow.FontSize = fs EndSub Sub DrawGrid ' param gw, gh - width and height for the graphics window ' param fw, fs - font width and font size (height) For _x = 0 To gw Step fw GraphicsWindow.DrawLine(_x, 0, _x, gh) EndFor For _y = 0 To gh Step fs GraphicsWindow.DrawLine(0, _y, gw, _y) EndFor EndSub Sub DrawText ' param["col"] - column ' param["row"] - row ' param["text"] - text _x = param["col"] * fw _y = param["row"] * fs GraphicsWindow.DrawText(_x, _y, param["text"]) EndSub Sub DrawUnderline ' param["col"] - column ' param["row"] - row ' param["len"] - length _x = param["col"] * fw _y = (param["row"] + 1) * fs _len = param["len"] * fw GraphicsWindow.DrawLine(_x, _y, _x + _len, _y) EndSub End>RHP722.sb< Start>RHQ594-0.sb< ' Countdown & Clock ' by BlackSc0rp (2012/Nov) ' remixed by GoToLoop ' RHQ594-0 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/f2768efb-8f3b-4ff4-b162-333cfdb780b7 gw = GraphicsWindow.Width ' stores GraphicsWindow's dimensions gh = GraphicsWindow.Height fs = 64 ' text font size for clock display GraphicsWindow.BackgroundColor = "Yellow" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = fs display = Shapes.AddText( Clock.Time ) ' creates text shape object to display current clock time Shapes.Move( display gw/2 - fs*3, gh/2 - fs*2/3 ) ' places clock at about the center of GraphicsWindow Timer.Tick = Seconds ' triggered event subroutine to change the text displayed by shape object -> display Timer.Interval = 1000 ' it's called-back every 1 second ( 1 second = 1000 milliseconds ) Sub Seconds Shapes.SetText( display, Clock.Time ) ' changes displayed text to current clock time EndSub End>RHQ594-0.sb< Start>RHQ594-1.sb< PD = 60 'hiermit kann man ausprobieren wann der Bildchschim nicht mehr flackert. Je größer PD desto größer ist die Pause uhrCheck = 0 While uhrCheck = 0 GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(260, 100, 300, 30) GraphicsWindow.BrushColor = "Black" zeit = Clock.Time GraphicsWindow.DrawText(260, 100, "Es ist gerade " + zeit) ' used german words Program.Delay(PD) EndWhile End>RHQ594-1.sb< Start>RHQ594-2.sb< ' Countdown & Clock (v2.0) ' by BlackSc0rp (2012/Nov) ' remixed by GoToLoop ' RHQ594-1 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/f2768efb-8f3b-4ff4-b162-333cfdb780b7 gw = GraphicsWindow.Width ' stores GraphicsWindow's dimensions gh = GraphicsWindow.Height fs = 64 ' text font size for clock display cd = 60 ' countdown seconds GraphicsWindow.BackgroundColor = "Yellow" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = fs display = Shapes.AddText( Clock.Time ) ' creates text shape object to display current clock time Shapes.Move( display gw/2 - fs*3, gh/2 - fs*2/3 ) ' places clock at about the center of GraphicsWindow Timer.Tick = Seconds ' triggered event subroutine to change the text displayed by shape object -> display Timer.Interval = 1000 ' it's called-back every 1 second ( 1 second = 1000 milliseconds ) Sub Seconds If cd > 0 Then cd = cd - 1 ' 1 second less for countdown EndIf Shapes.SetText( display, Clock.Time ) ' changes displayed text to current clock time GraphicsWindow.Title = "Countdown: " + cd + " seconds" ' displays countdown as title bar EndSub End>RHQ594-2.sb< Start>RHQ594.sb< uhrCheck = 0 While uhrCheck = 0 GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(260, 100, 300, 30) GraphicsWindow.BrushColor = "Black" zeit = Clock.Time GraphicsWindow.DrawText(260, 100, "Es ist gerade " + zeit) ' used german words EndWhile End>RHQ594.sb< Start>RHR558.sb< texttoencode = "Theredroadis" 'must have a number that is divisible by three pos = Text.GetLength(texttoencode) ' each letter in order is a number start = 3 ' starts at e because the matrix starts at the third letter down. TextWindow.Write(Text.GetSubText(texttoencode, start, 1)) 'types e secondpart() Sub secondpart TextWindow.Write(Text.GetSubText(texttoencode,start-1,1)) 'h TextWindow.Write(Text.GetSubText(texttoencode,start*2,1)) ' d endsub start = 1 While numbers < (pos-6) firstnumber = Text.GetSubText(texttoencode, start, 1) 't, r TextWindow.Write(firstnumber) secondnumber= Text.GetSubText(texttoencode, (start+4), 1) 'e,o TextWindow.Write(secondnumber) thirdnumber = Text.GetSubText(texttoencode,(start+8),1)'a,s TextWindow.Write(thirdnumber) 'TextWindow.Pause() numbers = numbers +3 start = start +3 endwhile thirdpart() Sub thirdpart lastthree = Text.GetSubText(texttoencode,pos-5, 1)' r lasttwo = Text.GetSubText(texttoencode,pos-1, 1)'i lastone = Text.GetSubText(texttoencode,pos-2, 1)'d TextWindow.Write(lastthree + lasttwo + lastone) EndSub End>RHR558.sb< Start>RHR872.sb< 'Developed By Chase Morell 2012 GraphicsWindow.Show() GraphicsWindow.Height = 375 GraphicsWindow.Width = 400 GraphicsWindow.BackgroundColor = "Black" Goto start start: title = Shapes.AddImage ("http://soccercleat.webs.com/Ultimate%20Dodge.jpg") Shapes.Zoom (title,.3,.8) Shapes.Move (title,-320,-50) titleLOOP: TOPAC = TOPAC + 2 Shapes.SetOpacity (title,TOPAC) Program.Delay (100) If TOPAC > 100 then Goto titleloop2 endif Goto titleLOOP titleloop2: OSET = OSET + 1 Shapes.setOpacity (title,100 - OSET) Program.Delay (100) If OSET > 30 then OSET = OSET + 2 endif If OSET > 110 then Shapes.Remove (title) Goto start2ACTUALGAME endif Goto titleloop2 start2ACTUALGAME: GraphicsWindow.BrushColor = "Orange" GraphicsWindow.BrushColor = "Red" GraphicsWindow.ShowMessage ("Use Your mouse to dodge obstacles,If your player (The Circle) wanders off the visible path, you will loose. The 'w' key controls the rocket, wich you can use to destroy oncoming obstacles. Be carefull, though, you only have five rockets. The 'A' and 'D' keys control your small gunns that shoot to the side. Try to get a highscore!","How To Play") GS: GraphicsWindow.BrushColor = "Red" loop3: '****************************************************************************************************************** background = Shapes.AddImage ("http://www.littleboxofideas.com/images/blog/resources/155_bokeh_textures/bokeh_texture01.jpg") ASUFORGAME: GraphicsWindow.BrushColor = "Red" user = Shapes.AddEllipse (50,50) Mouse.HideCursor() loop: '***************************************************************************************************************** x = Mouse.MouseX y = Mouse.MouseY 'initiate powerups If Mouse.IsLeftButtonDown Then pu = pu + 1 If pu < 4 Then speed = 70 EndIf If pu > 4 Then speed = speed EndIf EndIf GraphicsWindow.PenColor = "black" 'set x value of obstacles obstaclex = Math.GetRandomNumber(340) 'make obstacle obstacle = Shapes.AddRectangle (100,10) 'delay it Program.Delay (20) 'move the 'LOOOOOOOOPPP '******************************************************************************************************************** loop2: oY = oY + 1 Shapes.Move (obstacle,obstaclex,oY) If oY = 400 Then Shapes.Remove (obstacle) oY = 0 OV = 0 Goto loop EndIf GraphicsWindow.KeyDown = fire Sub fire If GraphicsWindow.LastKey = "A" Then ammo = Shapes.AddEllipse (5,5) Shapes.Move (ammo,X,270) Shapes.Animate (ammo,x - 500,270 - 500,700) EndIf If GraphicsWindow.LastKey = "D" Then ammo2 = Shapes.AddEllipse (5,5) Shapes.Move (ammo2,X,270) Shapes.Animate (ammo2,x + 500,270 - 500,700) EndIf If GraphicsWindow.LastKey = "P" Then Program.End() EndIf If GraphicsWindow.LastKey = "W" Then rAL = rAL + 1 If rAL < 5 then rocket = Shapes.AddRectangle (5,10) Shapes.Move (rocket,x,270) Shapes.Animate (rocket,x,y - 600,700) If x > obstaclex And x < obstaclex + 100 And GraphicsWindow.LastKey = "W" Then Shapes.Remove (obstacle) OV = 1 EndIf EndIf EndIf EndSub 'XXXXXXXXXXXXXXXXXXXXX 'Set Speeed by frame rate speed = speed + 1 If speed < 300 Then speedActual = 3 EndIf If speed > 300 And speed < 700 Then speedActual = 2 EndIf If speed > 700 And speed > 1100 Then speedActual = 1 EndIf If speed > 1100 then speedActual = .7 EndIf 'end speed setup '----------------------------------- '------------------------------------ '-------------------------------------- 'XXXXXXXXXXXXXXXXXXXXXx Program.Delay(speedACTUAL) x = Mouse.MouseX y = Mouse.MouseY Shapes.Move (user,x,280) If Mouse.MouseX > 600 Or Mouse.MouseX < -50 And speed > 100 Then Goto lost EndIf If OV = 1 Then Goto removedetour EndIf 'Collision Detection If x > obstaclex And x < obstaclex + 100 And oY = 280 and OV = 0 Then lost: Mouse.ShowCursor() GraphicsWindow.ShowMessage ("You loose. Your score is : " + speed, "Game Over") speed = 0 GraphicsWindow.Clear() pu = 0 rAL = 0 Goto loop3 EndIf removedetour: Goto loop2 End>RHR872.sb< Start>RHT662.sb< ' two text challenge compares ' SB June challenge ' Yled, June 2th 2016 y=1 z=1 TextWindow.Title = "Text Comparison" text[1] = "HELLO JOHN MY DAY WAS GREAT" text[2] = "HELLO MY DAY TODAY WAS GREAT" extract_words_text1() results_text1() extract_words_text2() results_text2() ' _____________________________ end _________________________________ Sub extract_words_text1 k[1]=text.GetLength (text[1]) For x = 1 To k[1] ls=text.GetSubText(text[1],x,1) TextWindow.ForegroundColor="red" TextWindow.Write(ls) Program.Delay(25) Sound.PlayClickandwait() If ls=" " Then ' check space count_words_text1() EndIf If x=k[1] Then ' check end of line L1=text.Append(L1,ls) count_words_text1() EndIf L1=text.Append(L1,ls) EndFor EndSub Sub count_words_text1 words[y]=L1 y=y+1 L1="" EndSub Sub results_text1 TextWindow.WriteLine("") For w = 1 To y TextWindow.ForegroundColor="green" TextWindow.Writeline(words[w]) Program.Delay(25) Sound.PlayClickandwait() EndFor TextWindow.ForegroundColor="white" TextWindow.WriteLine("numbers of words in text1: "+ y) EndSub Sub extract_words_text2 TextWindow.WriteLine("") q[1]=text.GetLength (text[2]) For x = 1 To q[1] lq=text.GetSubText(text[2],x,1) TextWindow.ForegroundColor="blue" TextWindow.Write(lq) Program.Delay(25) Sound.PlayClickandwait() If lq=" " Then ' check space count_words_text2() EndIf If x=q[1] Then ' check end of line L2=text.Append(L2,lq) count_words_text2() EndIf L2=text.Append(L2,lq) EndFor EndSub Sub count_words_text2 words2[z]=L2 z=z+1 L2="" EndSub Sub results_text2 TextWindow.WriteLine("") For t = 1 To z TextWindow.ForegroundColor="green" TextWindow.Writeline(words2[t]) Program.Delay(25) Sound.PlayClickandwait() EndFor TextWindow.ForegroundColor="yellow" TextWindow.WriteLine("numbers of words in text2: "+ z) EndSub TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") End>RHT662.sb< Start>RJB002.sb< GraphicsWindow.Width = 1450 ' GraphicsWindow.Height = 570 ' GraphicsWindow.CanResize = "true GraphicsWindow.Title="Endless Sky demo bs=5 BXI=0 BXII=725 BXII2=BXII*2 a=ImageList.LoadImage("http://www.geocities.jp/beratorikku/sky.png") yi=0 ai= Shapes.AddImage(a)' bi= Shapes.AddImage(a) bii= Shapes.AddImage(a) Shapes.Move(ai,BXI,yi) Shapes.Move(bi,BXII,yi) Shapes.Move(bii,BXII2,yi) ff="true GraphicsWindow.BrushColor="#aa000088 tt=Shapes.AddText (" Lorem ipsum sky fly demo") LDShapes.Font (tt "Calibri" 99 ff ff) While "true Shapes.Move(ai,BXI,yi)' Shapes.Move(bi,BXII,yi)' Shapes.Move(bii,BXII2,yi)' BXI=BXI-bs' BXII=BXII-bs' BXII2 =BXII2 -bs If BXI<=-725 Then BXI=725*2 EndIf If BXII<=-725 Then BXII=725*2 EndIf If BXII2<=-725 Then BXII2=725*2 EndIf Program.Delay (22) EndWhile End>RJB002.sb< Start>RJB501.sb< dw=1400 dh=900 td=0 GraphicsWindow.BackgroundColor ="Darkblue GraphicsWindow.Width = dw GraphicsWindow.Height = dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 GraphicsWindow.Title ="3D turtle args=0 deg=44/7/360 view3D = LD3DView.AddView(dw,dh,"True") 'Some different light types LD3DView.AddDirectionalLight(view3D,"cyan",-1,-1,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#50111111") LD3DView.SpecularExponent=8 LD3DView.ResetCamera(view3D,0,0,170, 0,0,-1,"","","") df=1 For qq=1 to 5 T_x=0 T_y=0 ty=0 T_Angle=0 pp="" z_ang=45 z_r=1 For q=0 To 200 LDCall.Function ("tmove" 2-qq/5) T_Angle=T_Angle +3.6 z_ang=LDMath.Sin(q*3.6)*180 EndFor LDCall.Function("tset" pp) endfor sub tMove mm=LDMath.Convert2Cartesian (t_x,t_y,args[1] t_Angle-90 ) t_x= (mm[1]) t_y= (mm[2]) ee=ee+ldmath.Sin(z_ang)*z_r pp=pp+":"+t_x+":"+ee+":"+T_y EndSub 'camera orbit r170=100 LDEvents.MouseWheel =mww LD3DView.AutoControl ("true" "true", -1 1) p100=50 GraphicsWindow.KeyDown =kdd 'pa="true While 1=1 If pa Then else n=n+2 deg=deg-1 x=ldMath.Sin(n)*r170 z=ldmath.Cos(n)*r170 LD3DView.ResetCamera(view3D,x,za,z,-x*5,0,-z*5,"","","") Program.Delay(p100) endif EndWhile Sub tset oo=LD3DView.addtube(view3d,args[1],1.5,20,"cyan","S") LD3DView.TranslateGeometry (view3d oo 0 qq*2 td) 'LD3DView.AnimateRotation (view3D oo 0 1 0 0, 360*df qq*1.5,-1) df=-1*df 'Program.Delay (200) EndSub Sub mww za=za+ LDEvents.LastMouseWheelDelta*2 EndSub Sub kdd If GraphicsWindow.LastKey="Escape" Then pa="true GraphicsWindow.Title ="Pause" Else pa="false GraphicsWindow.Title ="Orbiting... EndIf EndSub End>RJB501.sb< Start>RJC272.sb< ' Search files using SBFileinfo.SearchFile extension Controls.ButtonClicked=Onclicked gui() Sub Onclicked nm= Controls.GetButtonCaption(Controls.LastClickedButton) If nm="Dir" Then stDir=SBFileInfo.OpenDirFile(Program.Directory) '<------ select a directory Controls.SetTextBoxText(box[1],stDir) elseif text.IsSubText(nm,"Do" )="True" then Result="" Controls.SetTextBoxText(box[5],"") startdir=controls.GetTextBoxText(box[1]) omit=controls.GetTextBoxText(box[2]) word= controls.GetTextBoxText(box[3]) ext= controls.GetTextBoxText(box[4]) arr= SBFileInfo.SearchFiles(startdir,omit,word,ext) '<---------- searchfile extension For i= 1 to Array.GetItemCount(arr) result=result+i+" : "+arr[i]+CRLF endfor Controls.SetTextBoxText(box[5],result) Controls.SetButtonCaption(btn, "ReDo") EndIf EndSub Sub gui GraphicsWindow.Width=680 GraphicsWindow.Height=350 GraphicsWindow.BackgroundColor="Darkgreen" box[1]= Controls.AddTextBox(20,20) Controls.SetSize(box[1],500,30) box[2]= Controls.AddTextBox(20,65) Controls.SetSize(box[2],500,30) Controls.SetTextBoxText(box[2],"$RECYCLE.BIN, System Volume Information") box[3]= Controls.AddTextBox(20,110) Controls.SetSize(box[3],200,30) box[4]= Controls.AddTextBox(320,110) Controls.SetSize(box[4],200,30) box[5]=Controls.AddMultiLineTextBox(20,155) Controls.SetSize(box[5],650,230) Controls.AddButton("Dir",525,20) GraphicsWindow.FontSize=30 btn=Controls.AddButton("Do",560,20) Controls.SetSize(btn,110,80) GraphicsWindow.FontSize=12 GraphicsWindow.BrushColor="Lightcyan" GraphicsWindow.DrawText(20,5,"Input starting directory or click Dir button to select a directory EX; E:\Test ") GraphicsWindow.DrawText(20,50,"Directories to be omitted ... EX;$RECYCLE.BIN, System Volume Information,... ") GraphicsWindow.DrawText(20,95,"Input search word ... EX; sample ") GraphicsWindow.DrawText(320,95,"Input extension type ... EX; .txt ") GraphicsWindow.DrawText(20,140,"Result ....") CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) EndSub End>RJC272.sb< Start>RJC750.sb< 'register Events GraphicsWindow.MouseDown = OnMouseDown Controls.ButtonClicked = OnButtonClick Initialise() While "True" start = Clock.ElapsedMilliseconds UpdateProgram() RefreshScreen() FrameRate() EndWhile '=================================================================== 'Event Handlers '=================================================================== Sub OnButtonClick buttonClicked = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub '========================================================= '1st Order Subroutines '========================================================= Sub UpdateProgram If buttonClicked Then GetPizzaSizeAndCrust() displayMessage = "True" ' I have a Structure issue here. EndIf If mouseDown Then SetRadioButton() GetPizzaSizeAndCrust() EndIf buttonClicked = "False" mouseDown = "False" EndSub Sub RefreshScreen If displayMessage Then ShowMessage() EndIf If radioButtonSet Then DrawRBDeselection() DrawRBSelection() EndIf If drawPizza Then DrawRescaledPizza() EndIf displayMessage = "False" radioButtonSet = "False" drawPizza = "False" EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then Program.Delay(delay) EndIf EndSub '-------------------------------------------------------------------------------------------------- 'Setup & Initialise '-------------------------------------------------------------------------------------------------- Sub Initialise fps = 50 'get some GW properties to set variables gw = GraphicsWindow.Width gh = GraphicsWindow.Height canContinue = "False" buttonClicked = "False" displayMessage = "False" 'button Graphics properties & RO (relative offset) rbPropZ[1] = "W=15;PW=1;PC=Silver;BC=White;Op=100;RO=0" rbPropZ[2] = "W=11;PW=0;BC=Gainsboro;Op=100;RO=2" rbPropZ[3] = "W=7;PW=0;BC=White;Op=70;RO=5" 'onSelection properties rbPropZ[4] = "W=8;PW=0;BC=MediumBlue;Op=0;RO=3.5" rbPropZ[5] = "W=4;PW=0;BC=PowderBlue;Op=0;RO=5" zOrder = Array.GetItemCount(rbPropZ) 'gui grid columns = 2 rows[1] = 3 rows[2] = 2 columnSpace = 150 rowSpace = 50 leftOffset = 30 topOffset = 60 'pizza Size & Crust data txtVal[1] = "1=Small;2=Medium;3=Large" txtVal[2] = "1=Thin;2=Thick" 'zoom scale (size & crust) zoomPizza[1] = "1=1;2=1.5;3=2" zoomPizza[2] = "1=1;2=1.5" 'add Shapes & Control pizza = Shapes.AddRectangle(200, 15) Shapes.Move(pizza, 200, 250) Shapes.HideShape(pizza) btnWidth = 100 btn = Controls.AddButton("Continue", gw - btnWidth - 10, 10) Controls.SetSize(btn, btnWidth, 30) AddRadioButtons() EndSub '========================================================= '2nd Order Subroutines '========================================================= Sub AddRadioButtons For c = 1 To columns X = leftOffset * c + (columnSpace * (c-1)) rbX[c] = X For r = 1 To rows[c] Y = topOffset + (rowSpace * (r-1)) rbY[c][r] = Y selection[c][r] = -1 'initialise -1 = not selected GraphicsWindow.BrushColor = "Black" txt = Shapes.AddText(txtVal[c][r]) Shapes.Move(txt, X + 20, Y) For z = 1 To zOrder GraphicsWindow.PenWidth = rbPropZ[z]["PW"] GraphicsWindow.PenColor = rbPropZ[z]["PC"] GraphicsWindow.BrushColor = rbPropZ[z]["BC"] rb[z][c][r] = Shapes.AddEllipse(rbPropZ[z]["W"], rbPropZ[z]["W"]) Shapes.Move(rb[z][c][r], rbPropZ[z]["RO"] + X, rbPropZ[z]["RO"] + Y) Shapes.SetOpacity(rb[z][c][r], rbPropZ[z]["Op"]) EndFor EndFor EndFor EndSub Sub DrawRBSelection For z = 4 To 5 'show selected dot using c & r onClick Shapes.SetOpacity(rb[z][group][choice], 100) EndFor EndSub Sub DrawRBDeselection For j = 1 To rows[group] For z = 4 To 5 'show selected dot using c & r onClick Shapes.SetOpacity(rb[z][group][j], 0) EndFor EndFor EndSub Sub ShowMessage If canContinue Then GraphicsWindow.ShowMessage(txtVal[1][showSize] + ", " + txtVal[2][showCrust] , "Proceed") Else GraphicsWindow.ShowMessage("You must select a size & crust", "Wait") EndIf EndSub Sub DrawRescaledPizza Shapes.ShowShape(pizza) Shapes.Zoom(pizza, size, type) EndSub Sub SetRadioButton mouseX = GraphicsWindow.MouseX mouseY = GraphicsWindow.MouseY For c = 1 To columns If mouseX > rbX[c] And mouseX < rbX[c] + rbPropZ[1]["W"] Then For r = 1 To rows[c] If mouseY > rbY[c][r] And mouseY < rbY[c][r] + rbPropZ[1]["W"] Then selection[c][r] = selection[c][r] * -1 radioButtonSet = "True" 'DeselectRBGroup() 'SelectRB() group = c choice = r For j = 1 To rows[c] If j <> r Then 'unset the others selection[c][j] = -1 EndIf EndFor EndIf EndFor EndIf EndFor EndSub Sub GetPizzaSizeAndCrust If Array.ContainsValue(selection[1], 1) And Array.ContainsValue(selection[2], 1) Then canContinue = "True" drawPizza = "True" For c = 1 To columns For r = 1 To rows[c] If selection[1][r] = 1 Then size = zoomPizza[1][r] showSize = r EndIf If selection[2][r] = 1 Then type = zoomPizza[2][r] showCrust = r EndIf EndFor EndFor EndIf EndSub End>RJC750.sb< Start>RJC866.sb< GraphicsWindow.KeyUp = OnKeyUp InitCube() 'This SUB definate the cube MainLoop = 1 While MainLoop = 1 ShowCube() 'This SUB show the cube LK = "S" While LK <> "W" 'If you press the key W next Cube showing EndWhile HideCube() 'This SUB hide the cube EndWhile Sub InitCube GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.Show() Cube = shapes.AddRectangle(40,40) Shapes.HideShape(Cube) GraphicsWindow.BrushColor = "Black" Point[1] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[1]) Point[2] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[2]) Point[3] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[3]) Point[4] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[4]) Point[5] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[5]) Point[6] = Shapes.AddEllipse(6,6) Shapes.HideShape(Point[6]) EndSub Sub ShowCube CubeX = Math.GetRandomNumber(100) + 100 CubeY = Math.GetRandomNumber(100) + 100 NumberOfPoints = Math.GetRandomNumber(6) Shapes.Move(Cube, CubeX, CubeY) Shapes.ShowShape(Cube) If NumberOfPoints = 1 Then Shapes.Move(Point[1], CubeX + 17, CubeY + 17) Shapes.ShowShape(Point[1]) ElseIf NumberOfPoints = 2 Then Shapes.Move(Point[1], CubeX + 6, CubeY + 6) Shapes.Move(Point[2], CubeX + 28, CubeY + 28) Shapes.ShowShape(Point[1]) Shapes.ShowShape(Point[2]) ElseIf NumberOfPoints = 3 Then Shapes.Move(Point[1], CubeX + 6, CubeY + 6) Shapes.Move(Point[2], CubeX + 17, CubeY + 17) Shapes.Move(Point[3], CubeX + 28, CubeY + 28) Shapes.ShowShape(Point[1]) Shapes.ShowShape(Point[2]) Shapes.ShowShape(Point[3]) ElseIf NumberOfPoints = 4 Then Shapes.Move(Point[1], CubeX + 6, CubeY + 6) Shapes.Move(Point[2], CubeX + 6, CubeY + 28) Shapes.Move(Point[3], CubeX + 28, CubeY + 6) Shapes.Move(Point[4], CubeX + 28, CubeY + 28) Shapes.ShowShape(Point[1]) Shapes.ShowShape(Point[2]) Shapes.ShowShape(Point[3]) Shapes.ShowShape(Point[4]) ElseIf NumberOfPoints = 5 Then Shapes.Move(Point[1], CubeX + 6, CubeY + 6) Shapes.Move(Point[2], CubeX + 6, CubeY + 28) Shapes.Move(Point[3], CubeX + 28, CubeY + 6) Shapes.Move(Point[4], CubeX + 28, CubeY + 28) Shapes.Move(Point[5], CubeX + 17, CubeY + 17) Shapes.ShowShape(Point[1]) Shapes.ShowShape(Point[2]) Shapes.ShowShape(Point[3]) Shapes.ShowShape(Point[4]) Shapes.ShowShape(Point[5]) Else Shapes.Move(Point[1], CubeX + 6, CubeY + 6) Shapes.Move(Point[2], CubeX + 6, CubeY + 28) Shapes.Move(Point[3], CubeX + 28, CubeY + 6) Shapes.Move(Point[4], CubeX + 28, CubeY + 28) Shapes.Move(Point[5], CubeX + 18, CubeY + 28) Shapes.Move(Point[6], CubeX + 18, CubeY + 6) Shapes.ShowShape(Point[1]) Shapes.ShowShape(Point[2]) Shapes.ShowShape(Point[3]) Shapes.ShowShape(Point[4]) Shapes.ShowShape(Point[5]) Shapes.ShowShape(Point[6]) EndIf EndSub 'ShowCube Sub HideCube For i = 1 To 6 Shapes.HideShape(Point[i]) EndFor Shapes.HideShape(Cube) EndSub 'HideCube Sub OnKeyUp LK = GraphicsWindow.LastKey EndSub End>RJC866.sb< Start>RJD177.sb< position = 4 TextWindow.WriteLine("Please enter a valid .com Email.") Email = TextWindow.Read() For i = 1 To Text.GetLength(Email) character[i] = Text.GetSubText(email, i, 1) EndFor If Array.ContainsValue(character, "@") Then atSymbol = 1 Else TextWindow.WriteLine("Your email is incorrect, It does not contain an @ sign.") EndIf For i = 1 To 4 position = position -1 comcheck[i] = Text.GetSubText(Email, (Text.GetLength(Email)-position), 1) EndFor If Array.ContainsValue(comcheck, ".") And Array.ContainsValue(comcheck, "c") And Array.ContainsValue(comcheck, "o") And Array.ContainsValue(comcheck, "m") Then com = 1 Else TextWindow.WriteLine("Your email does not contain .com") EndIf If com = 1 And atSymbol = 1 Then TextWindow.WriteLine("Your email is correct") Else TextWindow.WriteLine("Your email is incorrect, Please use the suggestions above.") EndIf End>RJD177.sb< Start>RJJ372.sb< ' Small Challange 1 May 2013 from Microsoft web ' -- Write a program that finds all the numbers less than 1000 that contain only digits ' that sum to 10, e.g. 55, 73, 136, but not 423. How many are there? -- ' by Radomir Folta, 2013. ' count = 0 For x = 1 To 1000 l = Text.GetLength(x) x1 = Text.GetSubText (x,1,1) if x > 9 Then x2 = Text.GetSubText (x,2,1) EndIf If x > 99 Then x3 = Text.GetSubText (x,3,1) EndIf If x > 999 Then x4 = Text.GetSubText (x,4,1) EndIf sum = x1+x2+x3+x4 If sum = 10 Then TextWindow.WriteLine ("number "+ x + " ; total " +sum) count = count + 1 EndIf EndFor TextWindow.WriteLine ("Count "+ count) End>RJJ372.sb< Start>RJM233.sb< ' menu MENU : GraphicsWindow.BackgroundColor="Aquamarine" GraphicsWindow.BrushColor = "BLUE" GraphicsWindow.FontSize= (70) GraphicsWindow.DrawText(25,25,"SpaceGladiator_2021") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.FillRectangle(100,100,600,100) GraphicsWindow.BrushColor = "Magenta" GraphicsWindow.FontSize= (50) GraphicsWindow.DrawText(320,100,"START") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.FillRectangle(100,300,600,100) GraphicsWindow.BrushColor = "Magenta" GraphicsWindow.FontSize=(50) GraphicsWindow.DrawText(285,300,"WebPage") GraphicsWindow.BrushColor = "Lime" GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.FillRectangle(100,500,600,100) GraphicsWindow.BrushColor = "Magenta" GraphicsWindow.FontSize=(50) GraphicsWindow.DrawText(335,500,"Quit") GraphicsWindow.MouseDown = OnMouseDownMenu Sub OnMouseDownMenu x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If(x >= 100 And x <= 700 And y>=100 And y<=200)Then TheGame() EndIf If(x >= 100 And x <= 700 And y>=300 And y<=400)Then Network.GetWebPageContents("http://www.bfu.bg") EndIf If(x >= 100 And x <= 700 And y>=500 And y<=600)Then program.End() EndIf ' ..... endsub ' TheGame Sub TheGame Path= "http://imode.free.fr/images1942/" Path2= Program.Directory ' Game area controls gameWidth = 800 gameHeight = 600 fps = 50 bgs = 2 'backgroundspeed Player_Lives = 10 nbrisland = 5 'nomber of island images islandcount = 5 'nomber of island in the wall field ' Window title gameTitle = "SpaceGladiator2021, Score: " GraphicsWindow.Hide() GraphicsWindow.Title = gameTitle + "0" GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gameWidth GraphicsWindow.Height = gameHeight 'Presentation ' todo ' Start game Init() define_paths() TimePlay = 0 pathNBR = 1 'create_enemies1() Play() EndSub ' Setup world Sub Init GraphicsWindow.Hide() Mouse.HideCursor() ' addImage in the right order is needed to define the shapes depth island4= ImageList.LoadImage(Path2 + "\sun.png") island1= ImageList.LoadImage(Path2 + "\m1.png") island2= ImageList.LoadImage(Path2 + "\planet.png") island3= ImageList.LoadImage(Path2 + "\Planet 1.png") island5= ImageList.LoadImage(Path2 + "\mothership.png") player0 = ImageList.LoadImage(Path2 + "\spaceship1.png") background = ImageList.LoadImage(Path2 + "\sp.png") bullet0 = ImageList.LoadImage(Path2 + "\laser.png") enemy= ImageList.LoadImage(Path2 + "\spaceship1_final.png") enemy2 = ImageList.LoadImage(Path2 + "\epic_spaceship.png") enemy_expl1=ImageList.LoadImage(Path + "explo1.png") enemy_expl2=ImageList.LoadImage(Path + "explo2.png") player_expl=ImageList.LoadImage(Path + "explo2.png") Enemy_bullet=ImageList.LoadImage(Path + "E_bullet.png") end = ImageList.LoadImage(Path + "End.png") enemy_Array = "EnemyArray" 'Array that contain all the enemies ' every enemy in tha array has 5 informations ' TimeLine: each enemy has its own timeline ' PathNBR: the precalculated path defineing the movement ' the movement is decomposed in LineNbr differents lines ' each line is define in the enemy_path table with rotation, deltaY and deltaY ' PositonX, PositonY: position in space ' ' enemy_TimeLine = "EnemyTimeLine" enemy_line = "enemyLineNbr" enemy_PosX = "enemyPositonX" enemy_PosY = "enemyPositonY" enemy_PathNBR="enemy_PathNBR" enemy_Nbr = 6 enemy_Count = 0 enemy_speed = 4 'enemy_NextRemove = 1 enemy_Life = 10 player_size= 65 enemy_size = 40 enemy_ammo_size = 8 player_bullet_size = 15 island_Array = "Island array" IslandsPosition() create_level1() fond= Shapes.AddImage(background) Array.SetValue(island_Array,1,Shapes.AddImage(island1)) Array.SetValue(island_Array,2,Shapes.AddImage(island2)) Array.SetValue(island_Array,3,Shapes.AddImage(island3)) Array.SetValue(island_Array,4,Shapes.AddImage(island4)) Array.SetValue(island_Array,5,Shapes.AddImage(island5)) For i = 6 to islandcount Array.SetValue(island_Array,i,Array.getValue(island_Array,Math.Remainder(i,4))) Endfor player = Shapes.AddImage(player0) GraphicsWindow.FontSize = 20 GraphicsWindow.BackgroundColor = "Grey" GraphicsWindow.PenColor = "Yellow" Player_Ammo = "Player_AmmoArray" Player_AmmoAge = "Player_AmmoAge" Player_AmmoMax = 50 Player_AmmoCount = 0 Player_Ammospeed = bgs +4 Player_AmmoLife = 100 Enemy_Ammo = "Enemy_AmmoArray" Enemy_AmmoAge = "Enemy_AmmoAge" Enemy_Ammo_Angle="Enemy_Ammo_Angle" Enemy_AmmoMax = 30 Enemy_AmmoCount = 0 Enemy_Ammospeed = bgs +4 Enemy_AmmoLife = 50 Enemy_Agresivity = 200 score = 0 EndSub ' Main gane routine Sub Play GraphicsWindow.Show() ' Main loop play = 1 pause = 0 incx =0 ' X-axis increment for background incy = 0 ' Y-axis increment for background incbx = 0 'increment for bullets and all objects on X incby = 0 'increment for bullets and all objects on Y squadron = 1 ' Island initial position j= 0 For i= 1 To islandcount j=Math.Remainder(i,6) posy[i]= islandPos[j][2] posx[i]= islandPos[j][3] incislandx[i] = 0 incislandy[i] = 0 EndFor TimePlay = 0 Shapes.Move(player, gameWidth/2 , gameHeight -80 ) While(play = 1) Program.Delay(1000/fps) TimePlay = TimePlay +1 If (pause = 0) Then If (TimePlay = level1[squadron][1]) then pathNBR = level1[squadron][2] enemyPosX1 = level1[squadron][3] 'X position enemyPosY1 = level1[squadron][4] 'Y position enemy_Nbr = level1[squadron][6] enemy_type = level1[squadron][7] if (level1[squadron][5]=1) then create_enemies_left() Else create_enemies_right() endif squadron = squadron + 1 endif If (TimePlay > 4000) then Shapes.Move(Shapes.addImage(end), 230,200) Program.Delay(5000) Program.End() Endif moveall() GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown AgePlayer_Ammo() EndIf EndWhile EndSub Sub OnMouseMove paddleX = GraphicsWindow.MouseX - player_size/2 paddleY = GraphicsWindow.MouseY- player_size If (paddleX < 0) then paddleX = 0 endif Shapes.Move(player, paddleX , paddleY ) EndSub Sub OnMouseDown ShootX = GraphicsWindow.MouseX - 15 ' in order to be from the neck of the plane ShootY = GraphicsWindow.MouseY - 80 Fire() ShootX = GraphicsWindow.MouseX - 100 ' in order to be from the neck of the plane ShootY = GraphicsWindow.MouseY - 80 Fire() EndSub Sub moveall incbx = 0 incby =0 GraphicsWindow.Title = gameTitle + score +" Lives:"+Player_Lives If (paddleX >(gameWidth-62) ) Then incx = incx - bgs incbx = incbx - bgs For i= 1 To islandcount incislandx[i] = incislandx[i] - bgs EndFor If (incx = -32 ) Then incx =0 Endif Endif If (paddleX < 64 ) Then incx = incx + bgs incbx = incbx + bgs For i= 1 To islandcount incislandx[i] = incislandx[i] + bgs EndFor If (incx = 32 ) Then incx =0 Endif Endif Shapes.Move(fond,incx -32 ,incy - 32) For i= 1 To islandcount islx = posx[i]+incislandx[i] isly = posy[i]+incislandy[i] Shapes.Move(Array.GetValue(island_Array,i),islx,isly) EndFor incy = incy + bgs incby = incby+ bgs For i= 1 To islandcount incislandy[i] = incislandy[i] + bgs EndFor If (incy = 32) Then incy =0 Endif For i=0 To islandcount If ((posy[i]+incislandy[i]) > (gameHeight+15)) Then 'relaunch island if no more visible R= Math.Round(Math.GetRandomNumber(nbrisland)) AA = Math.Remainder(TimePlay,6) 'give new coordinates posx[i]= islandPos[AA][2] posy[i]= islandPos[AA][3] Shapes.move(Array.GetValue(island_Array,R),posx[i],posy[i]) incislandy[i]=0 incislandx[i]=0 EndIf ENDFOR ' Move playerammo For i = 1 To Player_AmmoCount Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i)) +incbx Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i)) - Player_Ammospeed Shapes.Move(Array.GetValue(Player_Ammo, i), Player_Ammox, Player_Ammoy) Array.SetValue(Player_AmmoAge, i, Array.GetValue(Player_AmmoAge, i) + 1) EndFor ' Move Enemy ammo For iea = 1 To Enemy_AmmoCount dx =(Math.Sin((Array.GetValue(Enemy_Ammo_Angle, iea) )) * Enemy_Ammospeed) dy =(Math.Cos((Array.GetValue(Enemy_Ammo_Angle, iea) ))* Enemy_Ammospeed) Enemy_Ammox = Shapes.GetLeft(Array.GetValue(Enemy_Ammo, iea)) +dx+incbx Enemy_Ammoy = Shapes.GetTop(Array.GetValue(Enemy_Ammo, iea)) +dy+incby*0.1 Shapes.Move(Array.GetValue(Enemy_Ammo, iea), Enemy_Ammox, Enemy_Ammoy) Array.SetValue(Enemy_AmmoAge, iea, Array.GetValue(Enemy_AmmoAge, iea) + 1) EndFor ' move ennemies For i=1 To enemy_Count ' move as TimeLine and Path say eNBR= Array.GetValue(enemy_PathNBR,i) uu =Array.GetValue(enemy_line,i) Time= Array.GetValue(enemy_TimeLine, i) etl=enemyPath[eNBR][1][uu] 'enemy own timeLine IF (Time=etl) Then 'it's time to rotate enemy rr = enemyPath[eNBR][2][uu+1] Shapes.Rotate(Array.GetValue(enemy_Array,i),rr) EndIf IF (Time > etl) Then uu = uu+1 Array.SetValue(enemy_line,i,uu) ' next line for enemy move EndIf xx1=Array.GetValue(enemy_PosX,i) yy1= Array.GetValue(enemy_PosY,i) xx = xx1+enemyPath[eNBR][3][uu]+incbx yy = yy1+enemyPath[eNBR][4][uu]+incby*0.1 ' Randomly fire-enemy If (Math.GetRandomNumber(Enemy_Agresivity)=1) Then Enemy_ShootX = xx1 + 16 Enemy_ShootY = yy1 + 4 If (yy1 > 0 AND xx1 > 0 And yy1< gameHeight And xx1 < gameWidth) then 'this avoid enemy fire from outside the screen fire_Enemy() Endif EndIf Shapes.Move(Array.GetValue(enemy_Array,i),xx,yy) Array.SetValue(enemy_PosX,i,xx) Array.SetValue(enemy_PosY,i,yy) Array.SetValue(enemy_TimeLine, i, Time + 1) If ((uu > enemyPath[eNBR][0][0]) And (Time > etl)) Then ' if last timelife remove the enemy sprite next_enemy_remove = i remove_enemy() endif Collision_pbe() Collision_ep() EndFor EndSub Sub RemovePlayer_Ammo Shapes.Remove(Array.GetValue(Player_Ammo, Player_Ammo_nextRemove)) For iz = Player_Ammo_nextRemove To Player_AmmoCount - 1 Array.SetValue(Player_Ammo, iz, Array.GetValue(Player_Ammo, iz+1)) Array.SetValue(Player_AmmoAge, iz, Array.GetValue(Player_AmmoAge, iz+1)) EndFor Array.RemoveValue(Player_Ammo, Player_AmmoCount) Array.RemoveValue(Player_AmmoAge, Player_AmmoCount) Player_AmmoCount = Player_AmmoCount - 1 EndSub Sub RemoveEnemy_Ammo Shapes.Remove(Array.GetValue(Enemy_Ammo, Enemy_Ammo_nextRemove)) For irea = Enemy_Ammo_nextRemove To Enemy_AmmoCount - 1 Array.SetValue(Enemy_Ammo, irea, Array.GetValue(Enemy_Ammo, irea+1)) Array.SetValue(Enemy_AmmoAge, irea, Array.GetValue(Enemy_AmmoAge, irea+1)) Array.SetValue(Enemy_Ammo_Angle, irea, Array.GetValue(Enemy_Ammo_Angle,irea+1)) EndFor Array.RemoveValue(Enemy_Ammo, Enemy_AmmoCount) Array.RemoveValue(Enemy_AmmoAge, Enemy_AmmoCount) Array.RemoveValue(Enemy_Ammo_Angle,Enemy_AmmoCount) Enemy_AmmoCount = Enemy_AmmoCount - 1 EndSub Sub fire ' Remove additional player Ammo While(Player_AmmoCount > Player_AmmoMax ) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile ' Add the player Ammo Player_AmmoCount = Player_AmmoCount + 1 Array.SetValue(Player_Ammo, Player_AmmoCount, Shapes.AddImage(bullet0)) Shapes.Move(Array.GetValue(Player_Ammo, Player_AmmoCount), ShootX, ShootY) EndSub Sub fire_Enemy ' Remove additional Enemy Ammo While(Enemy_AmmoCount > (Enemy_AmmoMax - 1)) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile ' Add the Enemy Ammo Enemy_AmmoCount = Enemy_AmmoCount + 1 Array.SetValue(Enemy_Ammo, Enemy_AmmoCount, Shapes.AddImage(Enemy_bullet)) Array.SetValue(Enemy_Ammo_Angle, Enemy_AmmoCount,Math.ArcTan((paddleX- Enemy_ShootX+player_size/2)/(paddleY-Enemy_ShootY))) Shapes.Move(Array.GetValue(Enemy_Ammo, Enemy_AmmoCount), Enemy_ShootX, Enemy_ShootY) EndSub 'Check playerammo age Sub AgePlayer_Ammo While (Array.GetValue(Player_AmmoAge, 1) > Player_AmmoLife) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile EndSub 'Check enemy ammo age Sub AgeEnemy_Ammo While (Array.GetValue(Enemy_AmmoAge, 1) > Enemy_AmmoLife) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile EndSub Sub remove_enemy Shapes.remove(Array.GetValue(enemy_Array,next_enemy_remove)) ' Remove all references from the arrays For ii = next_enemy_remove To enemy_Count - 1 Array.SetValue(enemy_Array, ii, Array.GetValue(enemy_Array, ii+1)) Array.SetValue(enemy_line, ii, Array.GetValue(enemy_line, ii+1)) Array.SetValue(enemy_PosX, ii, Array.GetValue(enemy_PosX, ii+1)) Array.SetValue(enemy_PosY, ii, Array.GetValue(enemy_PosY, ii+1)) Array.SetValue(enemy_TimeLine, ii, Array.GetValue(enemy_TimeLine, ii+1)) Array.SetValue(enemy_PathNBR, ii , Array.GetValue(enemy_PathNBR, ii+1)) EndFor Array.RemoveValue(enemy_Array, enemy_Count) Array.RemoveValue(enemy_line, enemy_Count) Array.RemoveValue(enemy_PosX, enemy_Count) Array.RemoveValue(enemy_PosY, enemy_Count) Array.RemoveValue(enemy_TimeLine, enemy_Count) Array.RemoveValue(enemy_PathNBR,enemy_Count) enemy_Count = enemy_Count - 1 EndSub Sub create_enemies_left TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) If (enemy_type = 2) Then Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy2)) Else Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) EndIf Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 - 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub create_enemies_right TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 + 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub Collision_pbe 'for player-bullet and enemies For i1 = 1 To Player_AmmoCount ' player bullet position Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i1)) Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i1)) px1=Player_Ammox+player_bullet_size/3 'in order to have a more precise collison than the bullet image size py1=Player_Ammoy+player_bullet_size/3 px2=px1+2*player_bullet_size/3 py2=py1+2*player_bullet_size/3 For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2)+enemy_size/4 ay1=Array.GetValue(enemy_PosY,i2)+enemy_size/4 ax2=ax1+3*enemy_size/4 ay2=ay1+3*enemy_size/4 If ( (ax1 < px1 And ax2 > px1) Or (ax1 < px2 And ax2 > px2) ) Then If ( (ay1 < py1 And ay2 > py1) Or (ay1 < py2 And ay2 > py2) ) Then ' collision between enemy nbr i2 and player bullet i ' remove bullet i and animate explosion and remove enemy i2 Player_Ammo_nextRemove = i1 RemovePlayer_Ammo() next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(enemy_expl2) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) score = score +100 EndIf EndIf EndFor Endfor EndSub Sub Collision_ep 'for enemies and player px1 = Shapes.GetLeft(player) py1 = Shapes.GetTop(player) px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2) ay1=Array.GetValue(enemy_PosY,i2) ax2=ax1+enemy_size ay2=ay1+enemy_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy nbr i2 and player ' animate explosion and decrease lives next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,ax1,ay1) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor px1 = paddleX py1 = paddleY px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i3 = 1 to Enemy_AmmoCount ' enemy position ax1=Shapes.GetLeft(Array.GetValue(enemy_Ammo,i3)) ay1=Shapes.GetTop(Array.GetValue(enemy_Ammo,i3)) ax2=ax1+enemy_ammo_size ay2=ay1+enemy_ammo_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy ammo nbr i3 and player ' animate explosion and decrease lives Enemy_Ammo_nextRemove = i3 RemoveEnemy_Ammo() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor EndSub Sub IslandsPosition ' island positions, avoid randomGeneration and islands overlap islandPos[0][1]=100 islandPos[0][2]=0 islandPos[0][3]=-150 islandPos[1][1]=200 islandPos[1][2]=-Math.Round(gameWidth/2) islandPos[1][3]=-250 islandPos[2][1]=300 islandPos[2][2]=-2*Math.Round(gameWidth/3) islandPos[2][3]=-350 islandPos[3][1]=400 islandPos[3][2]=2*Math.Round(gameWidth/3) islandPos[3][3]=-450 islandPos[4][1]=500 islandPos[4][2]=gameWidth islandPos[4][3]=-550 islandPos[5][1]=600 islandPos[5][2]=Math.Round(gameWidth/3) islandPos[5][3]=-650 islandPos[6][1]=700 islandPos[6][2]=-gameWidth islandPos[6][3]=-750 EndSub Sub define_paths enemyPath[0][0][0] = 3 'nbr of strait lines of path enemyPath[0][1][1] = 30 'from 0 to this in timeline enemyPath[0][1][2] = 100 ' from this to next in timeline enemyPath[0][1][3] = 400 'sprite goes up enemyPath[0][2][1] = 0 'first line rotation = 0 enemyPath[0][2][2] = 45 ' second line rotation = 45 enemyPath[0][2][3] = 45 enemyPath[0][3][1] = enemy_speed ' first line x movment enemyPath[0][3][2] = enemy_speed 'second line x movment enemyPath[0][3][3] = enemy_speed ' third line ... enemyPath[0][4][1] = 0 ' first line y movment enemyPath[0][4][2] = enemy_speed enemyPath[0][4][3] = enemy_speed '---------- second path enemyPath[1][0][0] = 4 enemyPath[1][1][1] = 1 enemyPath[1][1][2] = 1 enemyPath[1][1][3] = 100 enemyPath[1][1][4] = 400 enemyPath[1][2][1] = 180 enemyPath[1][2][2] = 135 enemyPath[1][2][3] = 135 enemyPath[1][2][4] = 90 enemyPath[1][3][1] = -enemy_speed enemyPath[1][3][2] = -enemy_speed enemyPath[1][3][3] = -enemy_speed enemyPath[1][3][4] = 0 enemyPath[1][4][1] = 0 enemyPath[1][4][2] = 0 enemyPath[1][4][3] = enemy_speed enemyPath[1][4][4] = enemy_speed 'round r=5 enemyPath[2][0][0]=21 enemyPath[2][1][1]=50 enemyPath[2][1][2]=55 enemyPath[2][1][3]=60 enemyPath[2][1][4]=65 enemyPath[2][1][5]=70 enemyPath[2][1][6]=75 enemyPath[2][1][7]=80 enemyPath[2][1][8]=85 enemyPath[2][1][9]=90 enemyPath[2][1][10]=95 enemyPath[2][1][11]=100 enemyPath[2][1][12]=105 enemyPath[2][1][13]=110 enemyPath[2][1][14]=115 enemyPath[2][1][15]=120 enemyPath[2][1][16]=125 enemyPath[2][1][17]=130 enemyPath[2][1][18]=135 enemyPath[2][1][19]=140 enemyPath[2][1][20]=145 enemyPath[2][1][21]=350 enemyPath[2][2][1]=0 enemyPath[2][2][2]=18 enemyPath[2][2][3]=36 enemyPath[2][2][4]=54 enemyPath[2][2][5]=72 enemyPath[2][2][6]=90 enemyPath[2][2][7]=108 enemyPath[2][2][8]=126 enemyPath[2][2][9]=144 enemyPath[2][2][10]=162 enemyPath[2][2][11]=180 enemyPath[2][2][12]=198 enemyPath[2][2][13]=216 enemyPath[2][2][14]=234 enemyPath[2][2][15]=252 enemyPath[2][2][16]=-90 enemyPath[2][2][17]=-72 enemyPath[2][2][18]=-54 enemyPath[2][2][19]=-36 enemyPath[2][2][20]=-18 enemyPath[2][2][21]=0 enemyPath[2][3][1]=enemy_speed enemyPath[2][3][2]=0.95*enemy_speed enemyPath[2][3][3]=0.81*enemy_speed enemyPath[2][3][4]=0.59*enemy_speed enemyPath[2][3][5]=0.31*enemy_speed enemyPath[2][3][6]=0 enemyPath[2][3][7]=-0.31*enemy_speed enemyPath[2][3][8]=-0.59*enemy_speed enemyPath[2][3][9]=-0.81*enemy_speed enemyPath[2][3][10]=-0.95*enemy_speed enemyPath[2][3][11]=-enemy_speed enemyPath[2][3][12]=-0.95*enemy_speed enemyPath[2][3][13]=-0.81*enemy_speed enemyPath[2][3][14]=-0.59*enemy_speed enemyPath[2][3][15]=-0.31*enemy_speed enemyPath[2][3][16]=0 enemyPath[2][3][17]=0.31*enemy_speed enemyPath[2][3][18]=0.59*enemy_speed enemyPath[2][3][19]=0.81*enemy_speed enemyPath[2][3][20]=0.95*enemy_speed enemyPath[2][3][21]=enemy_speed enemyPath[2][4][1]=0 enemyPath[2][4][2]=0.31*enemy_speed enemyPath[2][4][3]=0.59*enemy_speed enemyPath[2][4][4]=0.81*enemy_speed enemyPath[2][4][5]=0.95*enemy_speed enemyPath[2][4][6]=enemy_speed enemyPath[2][4][7]=0.95*enemy_speed enemyPath[2][4][8]=0.81*enemy_speed enemyPath[2][4][9]=0.59*enemy_speed enemyPath[2][4][10]=0.31*enemy_speed enemyPath[2][4][11]=0 enemyPath[2][4][12]=-0.31*enemy_speed enemyPath[2][4][13]=-0.59*enemy_speed enemyPath[2][4][14]=-0.81*enemy_speed enemyPath[2][4][15]=-0.95*enemy_speed enemyPath[2][4][16]=-enemy_speed enemyPath[2][4][17]=-0.95*enemy_speed enemyPath[2][4][18]=-0.81*enemy_speed enemyPath[2][4][19]=-0.59*enemy_speed enemyPath[2][4][20]=-0.31*enemy_speed enemyPath[2][4][21]=0 'round r=20 enemyPath[3][0][0]=21 enemyPath[3][1][1]=120 enemyPath[3][1][2]=140 enemyPath[3][1][3]=160 enemyPath[3][1][4]=180 enemyPath[3][1][5]=200 enemyPath[3][1][6]=220 enemyPath[3][1][7]=240 enemyPath[3][1][8]=260 enemyPath[3][1][9]=280 enemyPath[3][1][10]=300 enemyPath[3][1][11]=320 enemyPath[3][1][12]=340 enemyPath[3][1][13]=360 enemyPath[3][1][14]=380 enemyPath[3][1][15]=400 enemyPath[3][1][16]=420 enemyPath[3][1][17]=440 enemyPath[3][1][18]=460 enemyPath[3][1][19]=480 enemyPath[3][1][20]=500 enemyPath[3][1][21]=600 enemyPath[3][2][1]=0 enemyPath[3][2][2]=18 enemyPath[3][2][3]=36 enemyPath[3][2][4]=54 enemyPath[3][2][5]=72 enemyPath[3][2][6]=90 enemyPath[3][2][7]=108 enemyPath[3][2][8]=126 enemyPath[3][2][9]=144 enemyPath[3][2][10]=162 enemyPath[3][2][11]=180 enemyPath[3][2][12]=198 enemyPath[3][2][13]=216 enemyPath[3][2][14]=234 enemyPath[3][2][15]=252 enemyPath[3][2][16]=-90 enemyPath[3][2][17]=-72 enemyPath[3][2][18]=-54 enemyPath[3][2][19]=-36 enemyPath[3][2][20]=-18 enemyPath[3][2][21]=0 enemyPath[3][3][1]=enemy_speed enemyPath[3][3][2]=0.95*enemy_speed enemyPath[3][3][3]=0.81*enemy_speed enemyPath[3][3][4]=0.59*enemy_speed enemyPath[3][3][5]=0.31*enemy_speed enemyPath[3][3][6]=0 enemyPath[3][3][7]=-0.31*enemy_speed enemyPath[3][3][8]=-0.59*enemy_speed enemyPath[3][3][9]=-0.81*enemy_speed enemyPath[3][3][10]=-0.95*enemy_speed enemyPath[3][3][11]=-enemy_speed enemyPath[3][3][12]=-0.95*enemy_speed enemyPath[3][3][13]=-0.81*enemy_speed enemyPath[3][3][14]=-0.59*enemy_speed enemyPath[3][3][15]=-0.31*enemy_speed enemyPath[3][3][16]=0 enemyPath[3][3][17]=0.31*enemy_speed enemyPath[3][3][18]=0.59*enemy_speed enemyPath[3][3][19]=0.81*enemy_speed enemyPath[3][3][20]=0.95*enemy_speed enemyPath[3][3][21]=enemy_speed enemyPath[3][4][1]=0 enemyPath[3][4][2]=0.31*enemy_speed enemyPath[3][4][3]=0.59*enemy_speed enemyPath[3][4][4]=0.81*enemy_speed enemyPath[3][4][5]=0.95*enemy_speed enemyPath[3][4][6]=enemy_speed enemyPath[3][4][7]=0.95*enemy_speed enemyPath[3][4][8]=0.81*enemy_speed enemyPath[3][4][9]=0.59*enemy_speed enemyPath[3][4][10]=0.31*enemy_speed enemyPath[3][4][11]=0 enemyPath[3][4][12]=-0.31*enemy_speed enemyPath[3][4][13]=-0.59*enemy_speed enemyPath[3][4][14]=-0.81*enemy_speed enemyPath[3][4][15]=-0.95*enemy_speed enemyPath[3][4][16]=-enemy_speed enemyPath[3][4][17]=-0.95*enemy_speed enemyPath[3][4][18]=-0.81*enemy_speed enemyPath[3][4][19]=-0.59*enemy_speed enemyPath[3][4][20]=-0.31*enemy_speed enemyPath[3][4][21]=0 'round r=10 enemyPath[4][0][0]=21 enemyPath[4][1][1]=110 enemyPath[4][1][2]=120 enemyPath[4][1][3]=130 enemyPath[4][1][4]=140 enemyPath[4][1][5]=150 enemyPath[4][1][6]=160 enemyPath[4][1][7]=170 enemyPath[4][1][8]=180 enemyPath[4][1][9]=190 enemyPath[4][1][10]=200 enemyPath[4][1][11]=210 enemyPath[4][1][12]=220 enemyPath[4][1][13]=230 enemyPath[4][1][14]=240 enemyPath[4][1][15]=250 enemyPath[4][1][16]=260 enemyPath[4][1][17]=270 enemyPath[4][1][18]=280 enemyPath[4][1][19]=290 enemyPath[4][1][20]=300 enemyPath[4][1][21]=500 enemyPath[4][2][1]=0 enemyPath[4][2][2]=18 enemyPath[4][2][3]=36 enemyPath[4][2][4]=54 enemyPath[4][2][5]=72 enemyPath[4][2][6]=90 enemyPath[4][2][7]=108 enemyPath[4][2][8]=126 enemyPath[4][2][9]=144 enemyPath[4][2][10]=162 enemyPath[4][2][11]=180 enemyPath[4][2][12]=198 enemyPath[4][2][13]=216 enemyPath[4][2][14]=234 enemyPath[4][2][15]=252 enemyPath[4][2][16]=-90 enemyPath[4][2][17]=-72 enemyPath[4][2][18]=-54 enemyPath[4][2][19]=-36 enemyPath[4][2][20]=-18 enemyPath[4][2][21]=0 enemyPath[4][3][1]=enemy_speed enemyPath[4][3][2]=0.95*enemy_speed enemyPath[4][3][3]=0.81*enemy_speed enemyPath[4][3][4]=0.59*enemy_speed enemyPath[4][3][5]=0.31*enemy_speed enemyPath[4][3][6]=0 enemyPath[4][3][7]=-0.31*enemy_speed enemyPath[4][3][8]=-0.59*enemy_speed enemyPath[4][3][9]=-0.81*enemy_speed enemyPath[4][3][10]=-0.95*enemy_speed enemyPath[4][3][11]=-enemy_speed enemyPath[4][3][12]=-0.95*enemy_speed enemyPath[4][3][13]=-0.81*enemy_speed enemyPath[4][3][14]=-0.59*enemy_speed enemyPath[4][3][15]=-0.31*enemy_speed enemyPath[4][3][16]=0 enemyPath[4][3][17]=0.31*enemy_speed enemyPath[4][3][18]=0.59*enemy_speed enemyPath[4][3][19]=0.81*enemy_speed enemyPath[4][3][20]=0.95*enemy_speed enemyPath[4][3][21]=enemy_speed enemyPath[4][4][1]=0 enemyPath[4][4][2]=0.31*enemy_speed enemyPath[4][4][3]=0.59*enemy_speed enemyPath[4][4][4]=0.81*enemy_speed enemyPath[4][4][5]=0.95*enemy_speed enemyPath[4][4][6]=enemy_speed enemyPath[4][4][7]=0.95*enemy_speed enemyPath[4][4][8]=0.81*enemy_speed enemyPath[4][4][9]=0.59*enemy_speed enemyPath[4][4][10]=0.31*enemy_speed enemyPath[4][4][11]=0 enemyPath[4][4][12]=-0.31*enemy_speed enemyPath[4][4][13]=-0.59*enemy_speed enemyPath[4][4][14]=-0.81*enemy_speed enemyPath[4][4][15]=-0.95*enemy_speed enemyPath[4][4][16]=-enemy_speed enemyPath[4][4][17]=-0.95*enemy_speed enemyPath[4][4][18]=-0.81*enemy_speed enemyPath[4][4][19]=-0.59*enemy_speed enemyPath[4][4][20]=-0.31*enemy_speed enemyPath[4][4][21]=0 'round r=15 + exit down enemyPath[5][0][0]=27 enemyPath[5][1][1]=120 enemyPath[5][1][2]=125 enemyPath[5][1][3]=150 enemyPath[5][1][4]=165 enemyPath[5][1][5]=180 enemyPath[5][1][6]=195 enemyPath[5][1][7]=210 enemyPath[5][1][8]=225 enemyPath[5][1][9]=240 enemyPath[5][1][10]=255 enemyPath[5][1][11]=270 enemyPath[5][1][12]=285 enemyPath[5][1][13]=300 enemyPath[5][1][14]=315 enemyPath[5][1][15]=330 enemyPath[5][1][16]=345 enemyPath[5][1][17]=360 enemyPath[5][1][18]=375 enemyPath[5][1][19]=390 enemyPath[5][1][20]=405 enemyPath[5][1][21]=600 enemyPath[5][1][22]=615 enemyPath[5][1][23]=630 enemyPath[5][1][24]=645 enemyPath[5][1][254]=660 enemyPath[5][1][26]=675 enemyPath[5][1][27]=800 enemyPath[5][2][1]=0 enemyPath[5][2][2]=18 enemyPath[5][2][3]=36 enemyPath[5][2][4]=54 enemyPath[5][2][5]=72 enemyPath[5][2][6]=90 enemyPath[5][2][7]=108 enemyPath[5][2][8]=126 enemyPath[5][2][9]=144 enemyPath[5][2][10]=162 enemyPath[5][2][11]=180 enemyPath[5][2][12]=198 enemyPath[5][2][13]=216 enemyPath[5][2][14]=234 enemyPath[5][2][15]=252 enemyPath[5][2][16]=-90 enemyPath[5][2][17]=-72 enemyPath[5][2][18]=-54 enemyPath[5][2][19]=-36 enemyPath[5][2][20]=-18 enemyPath[5][2][21]=0 enemyPath[5][2][22]=18 enemyPath[5][2][23]=36 enemyPath[5][2][24]=54 enemyPath[5][2][25]=72 enemyPath[5][2][26]=90 enemyPath[5][2][27]=90 enemyPath[5][3][1]=enemy_speed enemyPath[5][3][2]=0.95*enemy_speed enemyPath[5][3][3]=0.81*enemy_speed enemyPath[5][3][4]=0.59*enemy_speed enemyPath[5][3][5]=0.31*enemy_speed enemyPath[5][3][6]=0 enemyPath[5][3][7]=-0.31*enemy_speed enemyPath[5][3][8]=-0.59*enemy_speed enemyPath[5][3][9]=-0.81*enemy_speed enemyPath[5][3][10]=-0.95*enemy_speed enemyPath[5][3][11]=-enemy_speed enemyPath[5][3][12]=-0.95*enemy_speed enemyPath[5][3][13]=-0.81*enemy_speed enemyPath[5][3][14]=-0.59*enemy_speed enemyPath[5][3][15]=-0.31*enemy_speed enemyPath[5][3][16]=0 enemyPath[5][3][17]=0.31*enemy_speed enemyPath[5][3][18]=0.59*enemy_speed enemyPath[5][3][19]=0.81*enemy_speed enemyPath[5][3][20]=0.95*enemy_speed enemyPath[5][3][21]=enemy_speed enemyPath[5][3][22]=0.95*enemy_speed enemyPath[5][3][23]=0.81*enemy_speed enemyPath[5][3][24]=0.59*enemy_speed enemyPath[5][3][25]=0.31*enemy_speed enemyPath[5][3][26]=0 enemyPath[5][3][27]=0 enemyPath[5][4][1]=0 enemyPath[5][4][2]=0.31*enemy_speed enemyPath[5][4][3]=0.59*enemy_speed enemyPath[5][4][4]=0.81*enemy_speed enemyPath[5][4][5]=0.95*enemy_speed enemyPath[5][4][6]=enemy_speed enemyPath[5][4][7]=0.95*enemy_speed enemyPath[5][4][8]=0.81*enemy_speed enemyPath[5][4][9]=0.59*enemy_speed enemyPath[5][4][10]=0.31*enemy_speed enemyPath[5][4][11]=0 enemyPath[5][4][12]=-0.31*enemy_speed enemyPath[5][4][13]=-0.59*enemy_speed enemyPath[5][4][14]=-0.81*enemy_speed enemyPath[5][4][15]=-0.95*enemy_speed enemyPath[5][4][16]=-enemy_speed enemyPath[5][4][17]=-0.95*enemy_speed enemyPath[5][4][18]=-0.81*enemy_speed enemyPath[5][4][19]=-0.59*enemy_speed enemyPath[5][4][20]=-0.31*enemy_speed enemyPath[5][4][21]=0 enemyPath[5][4][22]=0.31*enemy_speed enemyPath[5][4][23]=0.59*enemy_speed enemyPath[5][4][24]=0.81*enemy_speed enemyPath[5][4][25]=0.95*enemy_speed enemyPath[5][4][26]=enemy_speed enemyPath[5][4][27]=enemy_speed enemyPath[6][0][0]=3 enemyPath[6][1][1]=1 enemyPath[6][1][2]=80 enemyPath[6][1][3]=200 enemyPath[6][2][1]=0 enemyPath[6][2][2]=90 enemyPath[6][2][3]=-90 enemyPath[6][3][1]=0 enemyPath[6][3][2]=0 enemyPath[6][3][3]=0 enemyPath[6][4][1]=0 enemyPath[6][4][2]=enemy_speed enemyPath[6][4][3]=-enemy_speed EndSub Sub create_level1 'this define the behavior of the différent squadron along the time play for level 1 level1[1][1]=20 'when timeplay=level1[1][1] level1[1][2]= 2 ' lauch enemy with Path level1[1][2] level1[1][3]= -10 ' at x coordinate level1[1][3] level1[1][4] = 0 ' at y coordinate level1[1][4] level1[1][5] = 1 ' 1 for create enemy at the left side; 2 for the right side of screen level1[1][6] = 4 'level[1][6] is the number of enemies level1[1][7] = 1 'type of enemy level1[2][1]= 80 level1[2][2]= 6 level1[2][3]= gameWidth/2 level1[2][4] = -500 level1[2][5] = 1 level1[2][6] = 3 level1[2][7] = 1 level1[3][1]= 150 level1[3][2]= 0 level1[3][3]= -10 level1[3][4] = 0 level1[3][5] = 1 level1[3][6] = 6 level1[3][7] = 2 level1[4][1]= 280 level1[4][2]= 4 level1[4][3]= -10 level1[4][4] = 0 level1[4][5] = 1 level1[4][6] = 3 level1[4][7] = 2 level1[5][1]= 410 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 3 level1[5][7] = 1 level1[6][1]= 430 level1[6][2]= 6 level1[6][3]= 2*gameWidth/3 level1[6][4] = -50 level1[6][5] = 2 level1[6][6] = 3 level1[6][7] = 1 level1[5][1]= 500 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 6 level1[5][7] = 2 level1[6][1]= 590 level1[6][2]= 5 level1[6][3]= 100 level1[6][4] = -80 level1[6][5] = 1 level1[6][6] = 3 level1[6][7] = 3 level1[7][1]= 690 level1[7][2]= 6 level1[7][3]= gameWidth/3 level1[7][4] = -50 level1[7][5] = 2 level1[7][6] = 3 level1[7][7] = 2 For i= 1 To 10 Level1[7+i][1]=700+50*i level1[7+i][2]= 6 level1[7+i][3]= math.GetrandomNumber(gameWidth) level1[7+i][4] = -50 +i level1[7+i][5] = math.GetrandomNumber(2) level1[7+i][6] = math.GetrandomNumber(3) level1[7+i][7] = math.GetrandomNumber(2) EndFor level1[18][1]= 1300 level1[18][2]= 1 level1[18][3]= gameWidth level1[18][4] = -10 level1[18][5] = 2 level1[18][6] = 6 level1[18][7] = 2 For i= 1 To 10 Level1[18+i][1]=1330+50*i level1[18+i][2]= 4+math.GetrandomNumber(2) level1[18+i][3]= math.GetrandomNumber(50) level1[18+i][4] = i level1[18+i][5] = 1 level1[18+i][6] = math.GetrandomNumber(3) level1[18+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[28+i][1]=1900+50*i level1[28+i][2]= 4+math.GetrandomNumber(2) level1[28+i][3]= -math.GetrandomNumber(50) level1[28+i][4] = i level1[28+i][5] = 1 level1[28+i][6] = math.GetrandomNumber(3) level1[28+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[38+i][1]=2450+100*i level1[38+i][2]= 6 level1[38+i][3]= math.GetrandomNumber(gameWidth) level1[38+i][4] = -50 +i level1[38+i][5] = math.GetrandomNumber(2) level1[38+i][6] = math.GetrandomNumber(5) level1[38+i][7] = math.GetrandomNumber(2) EndFor EndSub End>RJM233.sb< Start>RJN433.sb< 'instructions and characteristics of textwindow GraphicsWindow.Hide() TextWindow.BackgroundColor="black" TextWindow.ForegroundColor="yellow" TextWindow.WriteLine("Welcome to Pacman") TextWindow.WriteLine("_________________") TextWindow.WriteLine(" ") TextWindow.ForegroundColor="green" TextWindow.WriteLine(" This game is fairly simple. What you have to do is go through the maze and collect various money coins around the screen. You can move pacman by using the W,A,S,D keys on your keyboard. Now its not that simple, there will be ghosts appearing on the screen throughout the game, you need to avoid these ghosts. In this game you have 3 lives, if you get hit by a ghost 3 times the game is over. Now how do you win the game? If you complete the level, collecting all the money pots without losing all of your lives you succesfully win pacman. Please hit enter to begin ") TextWindow.Read() TextWindow.Clear() TextWindow.Hide() GraphicsWindow.Show() '................................................................................................................................................................................... 'variables l=1 ' sets level to 1 lives=3 'sets number of lives score=0 'sets score at beginning of game coinpic="http://th373.photobucket.com/albums/oo179/Base_Oiboi/th_I_GoldCoin1.gif" x=40 'x coordinate of pacman at beginning of game y=355 'y coordinate of pacman at beginning of game coin1used=0 coin2used=0 coin3used=0 coin4used=0 coin5used=0 coin6used=0 coin7used=0 move=0 '..................................................................................................................................................................................... 'sub graphics 'characteristics and text for graphics window and walls (background) GraphicsWindow.Clear() GraphicsWindow.Height=400 GraphicsWindow.Width=390 GraphicsWindow.CanResize="false" GraphicsWindow.BackgroundColor= "pink" GraphicsWindow.BrushColor="black" GraphicsWindow.FontSize=20 GraphicsWindow.DrawText(20,5,"PACMAN") GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize=13 GraphicsWindow.DrawText(130,10,"Level: " + l ) GraphicsWindow.DrawText(220,10,"Lives: " + lives ) GraphicsWindow.DrawText(310,10,"Score: " + " /7") GraphicsWindow.BrushColor="orange" GraphicsWindow.FillRectangle(20,390,360,15) GraphicsWindow.FillRectangle(365,250,15,150) GraphicsWindow.FillRectangle(20,250,15,150) GraphicsWindow.FillRectangle(0,250,20,15) GraphicsWindow.FillRectangle(365,250,35,15) GraphicsWindow.FillRectangle(0,200,35,15) GraphicsWindow.FillRectangle(365,200,35,15) GraphicsWindow.FillRectangle(20,40,15,160) 'left wall top vertical GraphicsWindow.FillRectangle(365,40,15,160) 'right wall top vertical GraphicsWindow.FillRectangle(20,40,360,15) 'very top horizontal GraphicsWindow.FillRectangle(310,210,15,125) 'right wall bottom vertical GraphicsWindow.FillRectangle(70,210,15,125) 'left wall bottom vertical GraphicsWindow.FillRectangle(70,335,75,15) GraphicsWindow.FillRectangle(120,280,145,15) 'middle line GraphicsWindow.FillRectangle(250,335,75,15) GraphicsWindow.FillRectangle(190,295,15,40) GraphicsWindow.FillRectangle(185,55,15,50) 'very top middle vertical GraphicsWindow.FillRectangle(75,95,70,15) GraphicsWindow.FillRectangle(240,95,80,15) GraphicsWindow.FillRectangle(70,150,255,15) GraphicsWindow.FillRectangle(120,210,15,30) GraphicsWindow.FillRectangle(260,210,15,30) GraphicsWindow.FillRectangle(135,225,125,15) GraphicsWindow.FillRectangle(190,165,15,25) '................................................................................................................................................................................. pacman() ' calling sub to add pacman to screen '..................................................................................................................................................................................... 'subs Sub pacman 'adding pacman to screen and moving to bottom left corner pacman= Shapes.AddImage("http://docente.ucol.mx/oscastrejon/oswaldo_archivos/PacOE.gif") Shapes.HideShape(pacman) Shapes.Move(pacman,40,355) Shapes.ShowShape(pacman) GraphicsWindow.TextInput= move 'calling sub to move pacman using keys money() ' calling sub to add money coins to screen ghost() EndSub Sub money 'adding money coins to screen at various locations coin1= Shapes.AddImage(coinpic) Shapes.HideShape(coin1) Shapes.Move(coin1,35,60) Shapes.ShowShape(coin1) coin2= Shapes.AddImage(coinpic) Shapes.HideShape(coin2) Shapes.Move(coin2,110,300) Shapes.ShowShape(coin2) coin3= Shapes.AddImage(coinpic) Shapes.HideShape(coin3) Shapes.Move(coin3,195,110) Shapes.ShowShape(coin3) coin4= Shapes.AddImage(coinpic) Shapes.HideShape(coin4) Shapes.Move(coin4,345,215) Shapes.ShowShape(coin4) coin5= Shapes.AddImage(coinpic) Shapes.HideShape(coin5) Shapes.Move(coin5,175,350) Shapes.ShowShape(coin5) coin6=Shapes.AddImage(coinpic) Shapes.HideShape(coin6) Shapes.Move(coin6,205,160) Shapes.ShowShape(coin6) coin7=Shapes.AddImage(coinpic) Shapes.HideShape(coin7) Shapes.Move(coin7,335,65) Shapes.ShowShape(coin7) EndSub Sub move 'code to move pacman using keys also code to make sure pacman cannot move through orange walls Shapes.GetTop(pacman) Shapes.GetLeft(pacman) If GraphicsWindow.LastKey = "W" Then if y=55 Then y=y ElseIf y=355 and x>=50 and x<=140 then y=y elseif y=355 and x>=230 and x<=320 then y=y ElseIf y=115 and x>=60 and x<=140 then y=y ElseIf y=115 and x>=220 and x<=320 then y=y ElseIf y=105 and x>=170 and x<=190 then y=y ElseIf y=245 and x>=100 and x<=270 then y=y ElseIf y=295 and x>=100 and x<=170 then y=y ElseIf y=335 and x>=170 and x<=200 then y=y ElseIf y=295 and x>=210 and x<=250 then y=y ElseIf y=165 and x>=50 and x<=160 then y=y ElseIf y=195 and x>=170 and x<=200 then y=y ElseIf y=165 and x>=210 and x<=320 then y=y Else y = y-10 endif Shapes.Move(pacman,x,y) GraphicsWindow.Title="y" + Shapes.GetTop(pacman) + "x" + Shapes.GetLeft(pacman) 'debugging colide() scores() offscreen() '.............................................................................................................. ElseIf GraphicsWindow.LastKey = "A" Then If x=40 and y<=365 and y>=235 then x=x elseif x=40 and y<=205 and y>50 then x=x elseif x=90 and y>=195 and y<=305 then x=x elseif x=150 and y>=315 and y<=345 then x=x elseif x=330 and y>=195 and y<=345 then x=x elseif x=140 and y>=75 and y<=105 then x=x elseif x=320 and y>=75 and y<=105 then x=x elseif x=200 and y>=55 and y<=95 then x=x elseif x=280 and y>=195 and y<=235 then x=x elseif x=140 and y=195 then x=x elseif x=210 and y>=295 and y<=325 then x=x elseif x=270 and y>=265 and y<=285 then x=x elseif x=210 and y>=165 and y<=185 then x=x elseif x=330 and y>=135 and y<=155 then x=x Else x = x-10 EndIf Shapes.Move(pacman,x,y) GraphicsWindow.Title="y" + Shapes.GetTop(pacman) + "x" + Shapes.GetLeft(pacman) 'debugging colide() scores() offscreen() '.............................................................................................................. elseif GraphicsWindow.LastKey = "D" Then If x=340 and y<=365 and y>=235 then x=x elseif x=340 and y<=205 and y>=55 then x=x elseif x=40 and y<=345 and y>=195 then x=x elseif x=220 and y>=315 and y<=345 then x=x elseif x=280 and y>=195 and y<=305 then x=x elseif x=50 and y>=75 and y<=105 then x=x elseif x=210 and y>=75 and y<=105 then x=x elseif x=160 and y>= 55 and y<=95 then x=x elseif x=90 and y>=195 and y<=235 then x=x elseif x=230 and y=195 then x=x elseif x=160 and y>=295 and y<=325 then x=x elseif x=90 and y>=265 and y<=285 then x=x elseif x=160 and y>=165 and y<=185 then x=x elseif x=40 and y>=135 and y<=165 then x=x else x = x+10 EndIf Shapes.Move(pacman,x,y) GraphicsWindow.Title="y" + Shapes.GetTop(pacman) + "x" + Shapes.GetLeft(pacman) 'debugging colide() scores() offscreen() '.............................................................................................................. elseif GraphicsWindow.LastKey = "S" Then If y=365 then y=y elseif y=185 and x>=50 and x<=80 then y=y elseif y=305 and x>=90 and x<=130 then y=y elseif y=185 and x>=290 and x<=320 then y=y elseif y=305 and x>=230 and x<=280 then y=y elseif y=65 and x>=60 and x<=140 then y=y elseif y=65 and x>=220 and x<=320 then y=y elseif y=185 and x>=240 and x<=270 then y=y elseif y=195 and x>=130 and x<=240 then y=y elseif y=185 and x>=100 and x<=130 then y=y elseif y=255 and x>=110 and x<=260 then y=y elseif y=125 and x>=50 and x<=320 then y=y Else y = y+10 EndIf Shapes.Move(pacman,x,y) GraphicsWindow.Title="y" + Shapes.GetTop(pacman) + "x" + Shapes.GetLeft(pacman) 'debugging colide() scores() offscreen() EndIf EndSub Sub scores 'adds 1 to score when pacman goes over a coin GraphicsWindow.BrushColor="white" w=Shapes.GetTop(pacman) z=Shapes.GetLeft(pacman) if w=65 And z=40 And coin1used=0 then score=score +1 coin1used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin1) elseIf w=305 and z=110 and coin2used=0 then score=score+1 coin2used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin2) elseif w=115 and z=200 and coin3used=0 then score=score+1 coin3used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin3) Elseif w=225 and z=350 and coin4used=0 then score=score+1 coin4used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin4) elseif w=355 and z=180 and coin5used=0 then score=score+1 coin5used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin5) elseif w=165 and z=210 and coin6used=0 then score=score+1 coin6used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin6) elseif w=65 and z=340 and coin7used=0 then score=score+1 coin7used=1 GraphicsWindow.BrushColor="pink" GraphicsWindow.FillRectangle(350,10,20,20) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(355,10,score) Shapes.Remove(coin7) endif If score=7 Then ' shows message if you get all of the coins GraphicsWindow.ShowMessage("Congratulations you win pacman!!!","Good job") Program.End() EndIf EndSub Sub offscreen ' make pacman move to the other side of the screen w=Shapes.GetTop(pacman) z=Shapes.GetLeft(pacman) If w=225 And z=10 Then Program.Delay(1000) Shapes.Move(pacman,370,225) x=370 y=225 ElseIf w=215 and z=10 then Program.Delay(1000) Shapes.Move(pacman,370,215) x=370 y=215 elseif w=215 and z=370 then Program.Delay(1000) Shapes.Move(pacman,10,215) x=10 y=215 elseif w=225 and z=370 then Program.Delay(1000) Shapes.Move(pacman,10,225) x=10 y=225 EndIf EndSub Sub ghost ghost1=Shapes.AddImage("http://i62.photobucket.com/albums/h114/djkarn/Ghost1crosteyes.png") Shapes.Move(ghost1,90,245) Shapes.ShowShape(ghost1) 'shapes.Animate(ghost1,160,100,2000) ghost2() EndSub Sub ghost2 Program.Delay(500) ghost2=Shapes.AddImage("http://i62.photobucket.com/albums/h114/djkarn/Ghost1crosteyes.png") Shapes.HideShape(ghost2) Shapes.Move(ghost2,340,65) Shapes.ShowShape(ghost2) ghost3() EndSub Sub ghost3 Program.Delay(500) ghost3=Shapes.AddImage("http://i62.photobucket.com/albums/h114/djkarn/Ghost1crosteyes.png") Shapes.HideShape(ghost3) Shapes.Move(ghost3,335,360) Shapes.ShowShape(ghost3) ghost4() EndSub Sub ghost4 Program.Delay(500) ghost4=Shapes.AddImage("http://i62.photobucket.com/albums/h114/djkarn/Ghost1crosteyes.png") Shapes.HideShape(ghost4) Shapes.Move(ghost4,40,165) Shapes.ShowShape(ghost4) ghost5() EndSub Sub ghost5 Program.Delay(500) ghost5=Shapes.AddImage("http://i62.photobucket.com/albums/h114/djkarn/Ghost1crosteyes.png") Shapes.HideShape(ghost5) Shapes.Move(ghost5,180,245) Shapes.ShowShape(ghost5) ghostmove() EndSub 'add another ghost Sub ghostmove ' code to make all of the ghost move While move=0 t=245 For i=1 To 3 t=t-12 Shapes.Move(ghost1,90,t) Program.Delay(100) EndFor g=340 For i=1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p= 361 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) EndFor k=165 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor b=180 For i=1 To 3 b=b+12 Shapes.Move(ghost5,b,245) Program.Delay(100) EndFor t=215 For i=1 To 3 t=t-12 Shapes.Move(ghost1,90,t) Program.Delay(100) EndFor g= 304 For i= 1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p=325 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) endfor k=129 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor b=216 For i=1 To 3 b=b+12 Shapes.Move(ghost5,b,245) Program.Delay(100) EndFor r=90 For i=1 To 4 r=r-12 Shapes.Move(ghost1,r,179) Program.Delay(100) EndFor g=268 For i= 1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p=295 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) endfor k=93 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor b=252 For i=1 To 2 b=b+12 Shapes.Move(ghost5,b,245) Program.Delay(100) EndFor t= 179 For i=1 To 3 t=t+12 Shapes.Move(ghost1,42,t) Program.Delay(100) EndFor g=232 For i= 1 To 2 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p=265 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) endfor l=40 For i= 1 To 3 l=l+12 Shapes.Move(ghost4,l,57) Program.Delay(100) EndFor v=245 For i=1 To 3 v=v-12 Shapes.Move(ghost5,276,v) Program.Delay(100) EndFor t=215 For i=1 To 3 t=t+12 Shapes.Move(ghost1,42,t) Program.Delay(100) EndFor f=65 For i= 1 to 4 f=f+12 Shapes.Move(ghost2,208,f) Program.Delay(100) EndFor p=235 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) endfor l=76 For i= 1 To 3 l=l+12 Shapes.Move(ghost4,l,57) Program.Delay(100) EndFor v=209 For i=1 To 3 v=v-12 Shapes.Move(ghost5,276,v) Program.Delay(100) EndFor t=251 For i=1 To 3 t=t+12 Shapes.Move(ghost1,42,t) Program.Delay(100) EndFor g=208 For i=1 To 3 g=g+12 Shapes.Move(ghost2,g,113) Program.Delay(100) EndFor p=205 For i=1 To 3 p=p-12 Shapes.Move(ghost3,335,p) Program.Delay(100) endfor l=112 For i= 1 To 3 l=l+12 Shapes.Move(ghost4,l,57) Program.Delay(100) EndFor b=276 For i=1 To 3 b=b-12 Shapes.Move(ghost5,b,173) Program.Delay(100) EndFor t=287 For i=1 To 3 t=t+12 Shapes.Move(ghost1,42,t) Program.Delay(100) EndFor g=244 For i=1 To 3 g=g+12 Shapes.Move(ghost2,g,113) Program.Delay(100) EndFor q=335 For i=1 To 2 q=q-12 Shapes.Move(ghost3,q,170) Program.Delay(100) EndFor k=57 For i= 1 To 3 k=k+12 Shapes.Move(ghost4,148,k) Program.Delay(100) EndFor b=240 For i=0 To 1 b=b-12 Shapes.Move(ghost5,b,173) Program.Delay(100) EndFor t=323 For i=1 To 3 t=t+12 Shapes.Move(ghost1,42,t) Program.Delay(100) EndFor g=280 For i=1 To 3 g=g+12 Shapes.Move(ghost2,g,113) Program.Delay(100) EndFor q=311 For i=1 To 2 q=q-12 Shapes.Move(ghost3,q,170) Program.Delay(100) EndFor k= 93 For i=1 To 2 k=k+12 Shapes.Move(ghost4,148,k) Program.Delay(100) EndFor v=173 For i=0 To 1 v=v+12 Shapes.Move(ghost5,216,v) Program.Delay(100) EndFor r=42 For i=1 To 3 r=r+12 Shapes.Move(ghost1,r,359) Program.Delay(100) EndFor g=316 For i=1 To 2 g=g+12 Shapes.Move(ghost2,g,113) Program.Delay(100) EndFor p=170 For i=1 To 3 p=p+12 Shapes.Move(ghost3,287,p) Program.Delay(100) endfor l= 148 For i= 1 To 3 l=l-12 Shapes.Move(ghost4,l,117) Program.Delay(100) EndFor b=216 For i=1 To 3 b=b-12 Shapes.Move(ghost5,b,197) Program.Delay(100) EndFor r=78 For i=1 To 3 r=r+12 Shapes.Move(ghost1,r,359) Program.Delay(100) EndFor f=113 For i=1 To 3 f=f+12 Shapes.Move(ghost2,340,f) Program.Delay(100) EndFor p=206 For i = 1 To 3 p=p+12 Shapes.Move(ghost3,287,p) Program.Delay(100) endfor l= 112 For i= 1 To 3 l=l-12 Shapes.Move(ghost4,l,117) Program.Delay(100) colide() EndFor b=180 For i=1 To 2 b=b-12 Shapes.Move(ghost5,b,197) Program.Delay(100) EndFor r=114 For i=1 To 3 r=r+12 Shapes.Move(ghost1,r,359) Program.Delay(100) EndFor f= 149 For i=1 To 3 f=f-12 Shapes.Move(ghost2,340,f) Program.Delay(100) EndFor p=242 For i=1 To 3 p=p+12 Shapes.Move(ghost3,287,p) Program.Delay(100) endfor l= 76 For i= 1 To 3 l=l-12 Shapes.Move(ghost4,l,117) Program.Delay(100) colide() EndFor v= 197 for i= 0 To 1 v=v-12 Shapes.Move(ghost5,156,v) Program.Delay(100) EndFor t= 359 For i=1 To 3 t=t-12 Shapes.Move(ghost1,150,t) Program.Delay(100) EndFor f= 113 For i=1 To 4 f=f-12 Shapes.Move(ghost2,340,f) Program.Delay(100) EndFor p=278 For i=1 To 2 p=p+12 Shapes.Move(ghost3,287,p) Program.Delay(100) endfor k=117 For i=1 To 3 k=k+12 Shapes.Move(ghost4,40,k) Program.Delay(100) endfor b=156 For i= 1 to 3 b=b-12 Shapes.Move(ghost5,b,173) Program.Delay(100) EndFor t= 323 For i=1 To 2 t=t-12 Shapes.Move(ghost1,150,t) Program.Delay(100) EndFor g=340 For i=1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor q=287 For i=1 To 3 q=q-12 Shapes.Move(ghost3,q,302) Program.Delay(100) EndFor k=165 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor b=120 For i= 0 To 1 b=b-12 Shapes.Move(ghost5,b,173) Program.Delay(100) EndFor r= 150 For i=1 To 4 r=r-12 Shapes.Move(ghost1,r,299) Program.Delay(100) EndFor g= 304 For i= 1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor q=251 For i=1 To 3 q=q-12 Shapes.Move(ghost3,q,302) Program.Delay(100) EndFor k=129 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor v=173 For i=1 To 3 v=v+12 Shapes.Move(ghost5,96,v) Program.Delay(100) EndFor t=245 For i=1 To 3 t=t-12 Shapes.Move(ghost1,90,t) Program.Delay(100) EndFor g=268 For i= 1 To 3 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p=302 For i=1 To 3 p=p+12 Shapes.Move(ghost3,215,p) Program.Delay(100) EndFor k=93 For i= 1 To 3 k=k-12 Shapes.Move(ghost4,40,k) Program.Delay(100) EndFor v=209 For i=1 To 3 v=v+12 Shapes.Move(ghost5,96,v) Program.Delay(100) EndFor t=215 For i=1 To 3 t=t-12 Shapes.Move(ghost1,90,t) Program.Delay(100) EndFor g=232 For i= 1 To 2 g=g-12 Shapes.Move(ghost2,g,65) Program.Delay(100) EndFor p=338 For i=1 To 2 p=p+12 Shapes.Move(ghost3,215,p) Program.Delay(100) EndFor l=40 For i= 1 To 3 l=l+12 Shapes.Move(ghost4,l,57) Program.Delay(100) EndFor b=96 For i=1 To 3 b=b+12 Shapes.Move(ghost5,b,245) Program.Delay(100) EndFor r=90 For i=1 To 4 r=r-12 Shapes.Move(ghost1,r,179) Program.Delay(100) EndFor f=65 For i= 1 to 4 f=f+12 Shapes.Move(ghost2,208,f) Program.Delay(100) EndFor q=215 For i= 1 To 3 q=q+12 Shapes.Move(ghost3,q,362) Program.Delay(100) EndFor l=76 For i= 1 To 3 l=l+12 Shapes.Move(ghost4,l,57) Program.Delay(100) EndFor b=132 For i=1 To 3 b=b+12 Shapes.Move(ghost5,b,245) Program.Delay(100) EndFor Endwhile EndSub Sub colide ' sub to detect if pacman has hit any of the ghosts pactop =0 pacleft =0 ghost1toprangelow=0 ghost1toprangehigh = 0 ghost1leftrangelow = 0 ghost1leftrangehigh = 0 ghost2toprangelow=0 ghost2toprangehigh = 0 ghost2leftrangelow = 0 ghost2leftrangehigh = 0 ghost3toprangelow=0 ghost3toprangehigh = 0 ghost3leftrangelow = 0 ghost3leftrangehigh = 0 ghost4toprangelow=0 ghost4toprangehigh = 0 ghost4leftrangelow = 0 ghost4leftrangehigh = 0 ghost5toprangelow=0 ghost5toprangehigh = 0 ghost5leftrangelow = 0 ghost5leftrangehigh = 0 pactop=Shapes.GetTop(pacman) pacleft=Shapes.GetLeft(pacman) ghost1top=Shapes.GetTop(ghost1) ghost1left=Shapes.GetLeft(ghost1) ghost2top=Shapes.GetTop(ghost2) ghost2left=Shapes.GetLeft(ghost2) ghost3top=Shapes.GetTop(ghost3) ghost3left=Shapes.GetLeft(ghost3) ghost4top=Shapes.GetTop(ghost4) ghost4left=Shapes.GetLeft(ghost4) ghost5top=Shapes.GetTop(ghost5) ghost5left=Shapes.GetLeft(ghost5) ghost1toprangelow = ghost1top - 15 ghost1toprangehigh = ghost1top + 15 ghost1leftrangelow = ghost1left -15 ghost1leftrangehigh = ghost1left +15 ghost2toprangelow = ghost2top - 15 ghost2toprangehigh = ghost2top + 15 ghost2leftrangelow = ghost2left -15 ghost2leftrangehigh = ghost2left +15 ghost3toprangelow = ghost3top - 15 ghost3toprangehigh = ghost3top + 15 ghost3leftrangelow = ghost3left -15 ghost3leftrangehigh = ghost3left +15 ghost4toprangelow = ghost4top - 15 ghost4toprangehigh = ghost4top + 15 ghost4leftrangelow = ghost4left -15 ghost4leftrangehigh = ghost4left +15 ghost5toprangelow = ghost5top - 15 ghost5toprangehigh = ghost5top + 15 ghost5leftrangelow = ghost5left -15 ghost5leftrangehigh = ghost5left +15 If pactop > ghost1toprangelow and pactop < ghost1toprangehigh and pacleft >ghost1leftrangelow And pacleft ghost2toprangelow and pactop < ghost2toprangehigh and pacleft >ghost2leftrangelow And pacleft ghost3toprangelow and pactop < ghost3toprangehigh and pacleft >ghost3leftrangelow And pacleft ghost4toprangelow and pactop < ghost4toprangehigh and pacleft >ghost4leftrangelow And pacleft ghost5toprangelow and pactop < ghost5toprangehigh and pacleft >ghost5leftrangelow And pacleft RJN433.sb< Start>RJP086.sb< ' RomanNumeralClock.sb 'This program was written by Glennium GraphicsWindow.Show() GraphicsWindow.Title = "Roman Numeral Digital Clock" Bloc() GraphicsWindow.Width =555 GraphicsWindow.Height = 75 Start: GetTime() TestTime()' Tests the time and sets a few variables. Stack.PushValue("Time",Time3) Stack.PushValue("Time",Time2) Stack.PushValue("Time",Time1a) '= = = = = = = = = = For a = 1 To 3 N[a]= stack.PopValue("Time") Len[a] = Text.GetLength(N[a]) StripAndLoad() EndFor ' = = = = = = = = = For b = 1 to 3 Stack.PushValue("Time2",N[b]) Endfor '= = = = = = = = = = Roman3 = Stack.PopValue("Times2") Roman2 = Stack.PopValue("Times2") Roman1 = Stack.PopValue("Times2") GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 50 If Time2 = "0" Then Roman2 = "---" endif If Time3 = "0" Then Roman3 = "---" endif GraphicsWindow.DrawText(10,10 Roman1 + " : " + Roman2 + " : " + Roman3 ) Goto Start ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub GetTime Time1 = Clock.Hour Time2 = Clock.Minute Time3 = Clock.Second EndSub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub TestTime Time1a = Time1 If Time1 > 12 Then Time1a = Time1 - 12 Endif If Time1 = 0 Then Time1a = 12 Endif If Time1 <> T1 Then GraphicsWindow.Clear() EndIf If Time2<> T2 Then GraphicsWindow.Clear() EndIf If Time3 <> T3 Then GraphicsWindow.Clear() EndIf T1 = Time1 T2 = Time2 T3 = Time3 EndSub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub StripAndLoad If Len[a] = 1 Then D2 = N[a] Stack.PushValue("Times2",Letters[1][D2]) ElseIf Len[a]= 2 Then D1 = Math.Floor(N[a]/10) D2 = Math.Remainder(N[a],(D1*10)) Stack.PushValue("Times2",(Letters[2][D1]+Letters[1][D2])) EndiF EndSub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Bloc Letters [1] [1] = "I" Letters [1] [2] = "II" Letters [1] [3] = "III" Letters [1] [4] = "IV" Letters [1] [5] = "V" Letters [1] [6] = "VI" Letters [1] [7] = "VII" Letters [1] [8] = "VIII" Letters [1] [9] = "IX" Letters [1] [0] = "" Letters [2] [1] = "X" Letters [2] [2] = "XX" Letters [2] [3] = "XXX" Letters [2] [4] = "XL" Letters [2] [5] = "L" Letters [2] [0] = "" EndSub End>RJP086.sb< Start>RJP134.sb< ' Challenge of the Month - December 2014 Guage type analog clock by NaochanON Timer.Tick=onTick Timer.Interval=1000 Timer.Pause() gui() Timer.Resume() Sub gui h = 14 GraphicsWindow.Width=500 GraphicsWindow.Height=500 GraphicsWindow.FontSize=h GraphicsWindow.FontName = "Arial" ' "Georgia" ' "Courier New" color="1=Navy;2=Green;3=Orange;4=Red" dumy=Clock.Hour+" : "+Clock.Minute+" : " ' " ■■■■■■■■■" L=120 X0=2*L Y0=2*L div=60 For i=0 to div-1 GraphicsWindow.BrushColor=color[math.floor(i/15)+1] txt[i]= dumy+i ' i+ dumy w[i] = Text.GetLength(txt[i])*h*0.6 ' text width stxt[i]= Shapes.AddText(txt[i]) dA=-240+300/div*i ' divided angle cosX= Math.cos(Math.GetRadians(dA)) sinY=Math.sin(Math.GetRadians(dA)) Shapes.Move(stxt[i],X0+(L+w[i]/2)*cosX-w[i]/2,Y0+(L+w[i]/2)*sinY-h/2) Shapes.Rotate(stxt[i],dA) endfor For i=Clock.Second+1 To div-1 Shapes.SetText(stxt[i], dumy) ' show start second EndFor EndSub Sub ontick N=clock.Second dumy=Clock.Hour+" : "+Clock.Minute+" : " If N=0 Then Shapes.SetText(stxt[0], dumy+"0" ) For i=1 To div Shapes.SetText(stxt[i], dumy ) EndFor Else Shapes.SetText(stxt[N], dumy+N) EndIf EndSub End>RJP134.sb< Start>RJP883-1.sb< 'Meteor Shower - An orginal game concept by codingCat aka Matthew L. Parets -- Originally created for ExtendedBasic on the TI/99-4A -- Recreate for SmallBasic 'importCode: RJP883-0 GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "black" meteorStart = 30 meteorCount = meteorStart frameRate = 13 'Minimum Milliseconds per fram Ship = Shapes.AddText(Text.GetCharacter(65)) Shapes.Rotate(ship,90) GraphicsWindow.FontSize = 20 For i = 1 to meteorCount GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(Math.GetRandomNumber(175) + 75,0,0) meteor[i] = Shapes.AddText(Text.GetCharacter(9732)) Shapes.Rotate(meteor[i], 26) meteorY[i] = Math.GetRandomNumber(GraphicsWindow.Height) meteorX[i] = GraphicsWindow.Width Shapes.Move(meteor[i], meteorX[i], meteorY[i]) meteorSpeed[i] = Math.GetRandomNumber(50) / 10 endfor GraphicsWindow.BrushColor = "orange" GraphicsWindow.PenColor = "orange" home = Shapes.AddRectangle(20,15) base = Shapes.AddRectangle(20,15) homex = 2 basex = GraphicsWindow.Width - 22 basey = GraphicsWindow.Height / 2 RelocateBase() Shapes.Move(base, basex , basey) GraphicsWindow.PenColor = "green" 'GraphicsWindow.DrawRectangle(0,2,10,10) ' Determine the size and offset of hit box for ship 'GraphicsWindow.DrawRectangle(0,6,18,15) 'Determine the size and offset of hit box for meteor 'GraphicsWindow.DrawRectangle(meteorX[i],meteorY[i]+6, 18,15) 'GraphicsWindow.DrawRectangle(0,0,20,15) 'Determine the size and office of hit box for base shipx = 7 shipy = homey shipmovex = 0 shipmovey = 0 homeBase = "True" score = 0 damage = 0 GraphicsWindow.KeyDown = moveShip Shapes.Move(ship, shipx, shipy) ShowStatus() FlashHome() While damage < 100 frameStart = Clock.ElapsedMilliseconds 'Move the ship shipx = shipx + shipmovex shipy = shipy + shipmovey 'Handle the edges of the screen If shipx > GraphicsWindow.Width - 10 Then shipx = GraphicsWindow.Width - 10 shipmovex = 0 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) 'Detect Base ' 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 Shapes.HideShape(Ship) If Clock.ElapsedMilliseconds - shotClock > 20000 then score = score + ( (meteorCount - (meteorStart - 1)) * 100) Else score = score + ( (meteorCount - (meteorStart - 1)) * (20000 - (clock.ElapsedMilliseconds - shotClock)) ) endif score = Math.Round(score) ShowStatus() homeBase = "True" shipmovex = 0 shipmovey = 0 FlashBase() RelocateBase() shipx = 7 shipy = homey Shapes.Move(Ship,shipx, shipy) Shapes.ShowShape(ship) FlashHome() EndIf 'Detect colision with meteor If homeBase = "False" then 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 homeBase = "True" damage = damage + (5 * meteorSpeed[i]) ShowStatus() SpinHome() FlashHome() endif EndFor endif 'Move meteors UpdateMeteors() endWhile 'Game over Man - GAME OVER!! damage = 100 ShowStatus() Sub moveShip If homeBase = "True" Then shotClock = Clock.ElapsedMilliseconds EndIf homeBase = "False" Shapes.HideShape(home) key = GraphicsWindow.LastKey If key = "Left" Then if shipmovex = 1 Then shipmovex = 0 ElseIf shipmovex = 0 then shipmovex = -1 EndIf ElseIf key = "Right" then timetest = Clock.ElapsedMilliseconds if shipmovex = -1 Then shipmovex = 0 ElseIf shipmovex = 0 then shipmovex = 1 EndIf ElseIf key = "Up" then if shipmovey = 1 Then shipmovey = 0 ElseIf shipmovey = 0 then shipmovey = -1 EndIf ElseIf key = "Down" then if shipmovey = -1 Then shipmovey = 0 ElseIf shipmovey = 0 then shipmovey = 1 EndIf EndIf EndSub Sub ShowStatus title = "Meteor Shower -- Score: " title = title + score title = title + " - Damage: " title = title + damage title = title + "%" GraphicsWindow.Title = title EndSub Sub FlashHome holdb = base base = home holdbx = basex basex= homex holdby = basey basey = homey FlashBase() base = holdb basex = holdbx basey = holdby homeBase = "True" endsub 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 sub UpdateMeteors For ium = 1 to meteorCount meteorX[ium] = meteorX[ium] - meteorSpeed[ium] 'respawn if the screen edge is reached If meteorX[ium] < 0 Then meteorX[ium] = GraphicsWindow.Width meteorY[ium] = Math.GetRandomNumber(GraphicsWindow.Height) meteorSpeed[ium] = Math.GetRandomNumber(50) / 10 EndIf Shapes.Move(meteor[ium], meteorX[ium], meteorY[ium]) EndFor 'Spin in place to pace the game While Clock.ElapsedMilliseconds - frameStart < frameRate endwhile endsub Sub RelocateBase GraphicsWindow.BrushColor = "black" GraphicsWindow.FillRectangle(basex,basey, 20,15) GraphicsWindow.FillRectangle(homex,homey, 20,15) homey = basey Shapes.Move(home, homex, homey) basey = Math.GetRandomNumber(GraphicsWindow.Height - 19) + 2 Shapes.Move(base, basex, basey) EndSub Sub SpinHome Shapes.Animate(ship, homex, homey, 1000) starthome = Clock.ElapsedMilliseconds rotateAngle = 90 rotatehome = Clock.ElapsedMilliseconds While Clock.ElapsedMilliseconds - starthome < 1000 frameStart = Clock.ElapsedMilliseconds If Clock.ElapsedMilliseconds - rotatehome < 50 then rotateAngle = rotateAngle + 5 Shapes.Rotate(Ship,rotateAngle) rotatehome = Clock.ElapsedMilliseconds EndIf UpdateMeteors() EndWhile shipx = 7 shipy = homey shipmovex = 0 shipmovey = 0 Shapes.Move(Ship,shipx, shipy) Shapes.Rotate(Ship,90) EndSub End>RJP883-1.sb< Start>RJR735.sb< ' SmallBasic Version 1.2 ' Program: GWShooter ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/96f3d946-bf38-46f4-8c35-d59bad826099/graphic-windows ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: Automatically by Timer a/o MouseClick ' First create a folder 'Shots' under Program.Directory to collect the GW-Screenshots ' Variables: ' ToDo: '=============================================================================== intv = 5000 dir = Program.Directory +"\Shots\" name = "GWShot_" id = 1 qu = Text.GetCharacter(34) gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.Title = "Press 'Space' to activate" x = gw/2 - 25 y = 0 d = 1 ell = Shapes.AddEllipse(50,50) Shapes.Move(ell, gw/2 - 25,0) GraphicsWindow.KeyDown = OnKeyDown 'GraphicsWindow.MouseDown = OnAction '' Shot on MouseClick ... Timer.Tick = OnAction '' a/o Shot on TimerTick Timer.Interval = intv While "True" y = y + d Shapes.Move(ell, x,y) If y = 0 Or y = gh-50 Then d = -d EndIf Program.Delay(10) EndWhile ' //////////////////// SUBs //////////////////// Sub GetNewFileName ' The following line could be harmful and has been automatically commented. ' While LDFile.Exists(dir + name + id + ".png") id = id + 1 EndWhile path = dir + name + id + ".png" GraphicsWindow.Title = name + id + ".png" EndSub Sub SaveShot GetNewFileName() LDGraphicsWindow.Capture(path, "") EndSub ' ////////////////// EVENTs /////////////////// Sub OnAction If shot Then LDCall.CallAsync("","","", "SaveShot", "") EndIf EndSub Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "Space" Then If shot Then shot = "" GraphicsWindow.Title = "Press 'Space' to activate" Else shot = "True" EndIf EndIf EndSub End>RJR735.sb< Start>RJS426.sb< GraphicsWindow.FontSize=177 GraphicsWindow.FontBold="false GraphicsWindow.BackgroundColor="tan GraphicsWindow.PenWidth=0 GraphicsWindow.Width=800 GraphicsWindow.Height=800 GraphicsWindow.Top=5 not="false=true;true=false bcc="🂠 c[1]=ldtext.Split ("🂡 🂢 🂣 🂤 🂥 🂦 🂧 🂨 🂩 🂪 🂫 🂭 🂮" " ") c[2]=ldtext.Split ("🂱 🂲 🂳 🂴 🂵 🂶 🂷 🂸 🂹 🂺 🂻 🂽 🂾" " ") c[3]=ldtext.Split ("🃁 🃂 🃃 🃄 🃅 🃆 🃇 🃈 🃉 🃊 🃋 🃍 🃎" " ") c[4]=ldtext.Split ("🃑 🃒 🃓 🃔 🃕 🃖 🃗 🃘 🃙 🃚 🃛 🃝 🃞" " ") rr=Shapes.AddRectangle(105 162) Shapes.Move(rr 5 34) LDShapes.BrushColour(rr "white") LDShapes.SetShapeEvent(rr) rr=Shapes.AddRectangle(105 162) Shapes.Move(rr 255 34) LDShapes.BrushColour(rr "white") cc1=Shapes.AddText(bcc) LDShapes.SetShapeEvent(cc1) LDShapes.PenColour(cc1 "darkred") cc=Shapes.AddText(">") Shapes.Move(cc 250 0) LDShapes.SetShapeEvent(cc) LDEffect.DropShadow(rr "gray") LDShapes.ShapeEvent=see cmix() n=0 nxc=0 nxm="0=red;1=black Sub cmix n=52 While n>0 m1=Math.GetRandomNumber(4) m2=Math.GetRandomNumber(13) If c[m1][m2]="x" Then Else mx[n]=c[m1][m2] mc[n]="black If m1=2 or m1=3 Then mc[n]="red EndIf n=n-1 GraphicsWindow.Title=n EndIf EndWhile EndSub Sub see If LDShapes.LastEventType="MouseDown" Then If LDShapes.LastEventShape=cc1 Then tt: n=n+1 If n>52 Then n=1 EndIf GraphicsWindow.Title=n If mx[n]="x" Then goto tt Else LDShapes.PenColour(cc mc[n] ) empp="false Shapes.SetText(cc mx[n]) EndIf Elseif not[empp] and mc[n]=nxm[nxc] then nxc=1-nxc ss=LDMath.Sin(Math.GetRandomNumber(360))*7 Shapes.Move(cc 400+ss nn) Shapes.Move(rr 405+ss 34+nn) aa=Math.GetRandomNumber(6)-3 Shapes.Rotate(cc aa) Shapes.Rotate(rr aa) nn=nn+30 mx[n]="x" GraphicsWindow.BrushColor="white rr=Shapes.AddRectangle(105 162) LDEffect.DropShadow(rr "gray") Shapes.Move(rr 255 34) GraphicsWindow.BrushColor="gray cc=Shapes.AddText(">") empp="true Shapes.Move(cc 250 0) LDShapes.SetShapeEvent(cc) EndIf EndIf EndSub End>RJS426.sb< Start>RJV536-0.sb< q="128.34728 63.551917 -0.72266 0.352539 -0.72265 0.35254 -0.72266 0.352539 -0.72266 0.352539 -0.86914 0.220703 -0.86914 0.220703 -0.86914 0.220703 -0.86914 0.220703 -0.47949 0.08789 -0.47949 0.08789 -0.4795 0.08789 -0.47949 0.08789 0.001 -0.0034 0.001 -0.0034 0 -0.0034 0.001 -0.0034 0.001 -0.0029 0 -0.0029 0.001 -0.0029 0.001 -0.0029 0 -0.0029 0.001 -0.0029 0.001 -0.0029 0 -0.0029 0.001 -0.0034 0.001 -0.0034 0 -0.0034 0.001 -0.0034 -0.0547 0.0059 -0.0547 0.0059 -0.0547 0.0059 -0.0547 0.0059 0.0197 0.340759 0.0182 0.307028 0.0134 0.221904 0.005 0.08539 0.0288 0.565118 0.0604 0.56092 0.11293 0.554054 0.18651 0.544517 3.18432 0.38145 1.92798 -0.159076 1.98366 -0.36237 1.91319 -0.543235 1.71658 -0.70167 2.33872 -1.788928 -1.15558 -0.512689 -1.13444 -0.539291 -1.112 -0.565547 -1.08821 -0.591457 -0.1329 -0.103517 -0.13289 -0.103517 -0.1329 -0.103516|35.352 64.319 -2.227713 -0.219096 -2.30774 0.146705 -2.31592 0.480995 -2.252252 0.783771 -2.116736 1.055037 -1.909373 1.294791 -1.630162 1.503033 r 19.313 71.044 -1.653703 3.254176 -0.877172 2.988231 -0.270234 2.810715 0.167109 2.721629 0.434859 2.720973 0.533016 2.808746 0.461578 2.984949 0.220547 3.249582 -0.271672 1.533842 -0.768453 1.092267 -1.126766 0.674307 r 10 95.812001 0.63248 1.853675 1.206489 1.693293 1.655316 1.466561 1.978965 1.17347 2.177434 0.81404 2.250722 0.38824 2.198832 -0.10389 2.021762 -0.66239 2.568512 -2.14337 1.259269 -2.842567 0.290879 -3.257781 -0.33666 -3.389031 -0.623348 -3.236313 -0.569183 -2.799625 -0.174168 -2.078968 0.561699 -1.074344 1.768424 -0.355484 1.405154 0.542921 1.221709 1.093516 1.218088 1.296297 1.394291 1.151266 1.750318 0.658421 2.28617 -0.182234 3.001846 -1.370703 0.157881 -0.09234 0.189791 -0.105816 0.215549 -0.117864 0.235154 -0.12848 0.248607 -0.137668 0.255909 -0.145426 0.257056 -0.151754 0.252053 -0.156652 0.582205 -0.285176 0.446748 -0.33498 0.329115 -0.357715 0.229307 -0.353379 0.147322 -0.321973 0.08316 -0.263496 0.03683 -0.177949 0.0083 -0.06533 0.128195 -1.145328 -0.01557 -1.496422 |25.099611 124.83121 -0.221344 0.3687 -0.218028 0.36176 -0.16631 0.27534 -0.06619 0.10944 -0.294222 0.47921 -0.261539 0.48687 -0.207291 0.49945 -0.131479 0.51689 2.84754 1.43439 4.061162 0.94092 4.201538 0.24154 3.268666 -0.66373 -0.72238 -0.73317 -0.692386 -0.74531 -0.664203 -0.75607 -0.637828 -0.76545 -1.917735 0.19323 -2.397573 -0.19819 -2.621755 -0.6122 -2.59028 -1.04885 -0.139618 -0.0785 -0.142267 -0.0922 -0.143415 -0.10306 |58.007814 128.50895 -0.421874 0.16211 -0.683594 0.17187 -0.78711 0.12891 -0.867187 0.0918 -0.414063 -0.008 -0.414062 -0.008 -0.414063 -0.008 -0.412109 -0.01 -0.414062 -0.008 -0.414063 -0.008 -0.414063 -0.008 -0.414062 -0.006 -1.03125 -0.16016 -0.300781 -0.21484 -0.289063 1.13281 -0.07631 0.28146 -0.07183 0.28213 -0.06524 0.28321 -0.05655 0.28468 -0.04576 0.28657 -0.03286 0.28883 -0.01786 0.29151 0 0.29458 1.033973 0.69886 1.350507 0.53823 1.561294 0.36547 1.666333 0.18059 1.665625 -0.0164 1.559171 -0.22557 1.346968 -0.44685 1.029019 -0.68025 -2.855468 -3.38867 |113.0918 97.143714 -0.0767 0.23261 -0.0765 0.232667 -0.0733 0.223148 -0.067 0.20405 -0.0575 0.175377 -0.0449 0.137127 -0.0292 0.0893 -0.0104 0.03189 -0.11589 0.331343 -0.10916 0.332122 -0.0992 0.333377 -0.0861 0.335109 -0.0697 0.337313 -0.0501 0.34 -0.0273 0.34316 -0.001 0.3468 1.56951 0.82271 2.0501 0.63353 2.37012 0.43009 2.52961 0.2124 2.52852 -0.0196 2.3669 -0.26575 2.04473 -0.5262 1.56199 -0.80091 -0.49942 -0.415 -0.49153 -0.42033 -0.48389 -0.42536 -0.47644 -0.430124 -0.46923 -0.434587 -0.46223 -0.438771 -0.45546 -0.442669 -0.44891 -0.446281 -0.0639 0.02067 -0.0642 0.02127 -0.0644 0.02165 -0.0645 0.02181 -0.0645 0.02176 -0.0643 0.02148 -0.0641 0.02099 -0.0637 0.02028 -1.35304 0.301248 -1.32672 0.199416 -1.25289 0.116589 -1.13159 0.05277 -0.9628 0.008 -0.74651 -0.01785 -0.48273 -0.02465 -0.17146 -0.01244 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.001 0.0051 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.002 -0.0061 -0.72164 -0.164991 -0.66678 -0.197372 -0.61248 -0.222916 -0.55871 -0.241624 -0.50548 -0.253495 -0.4528 -0.258531 -0.40065 -0.256729 -0.34904 -0.248092 0 0|100.81055 15.616371 -2.615399 1.42777 -2.22672 2.156908 -2.330013 1.894172 -2.925276 0.63956 -2.329324 -0.498526 -2.365821 -0.642961 -2.326481 -0.171782 -2.211304 0.91501 -0.74699 0.716199 -0.714623 0.842844 -0.706635 0.375394 -0.723027 -0.686147 -1.907887 -1.023458 -2.09289 -0.107015 -2.036799 0.661092 -1.739611 1.280866 -1.145213 0.673372 -1.325752 0.179601 -1.109496 -0.448236 -0.496441 -1.210137 0.351352 -1.150991 1.225107 -0.59921 0.919266 -0.483001 -0.566168 -0.802366 -2.373601 -1.090654 -2.604359 0.311497 -2.048774 1.498939 -0.706846 2.471675 0.278402 1.61401 0.734056 1.459957 1.093267 1.208752 1.356037 0.860397 -0.651979 1.184708 0.634702 0.875303 1.27007 0.667625 1.254126 0.561674 -0.511416 0.976878 -0.510102 1.248541 -0.149488 1.349139 0.570428 1.278674 0.560853 1.181376 -0.07446 1.347197 -0.618324 0.915416 -1.070733 -0.113971 -0.114784 -1.317957 0.05799 -1.10479 -0.336265 -0.457117 -1.297545 0.625062 -1.529517 1.195927 -1.185519 1.602071 -0.404657 1.792692 0.813065 1.76779 0.627681 0.650546 0.738871 0.563475 0.788629 0.445229 0.776957 0.295807 -0.513486 1.296052 0.278376 1.264925 0.555111 1.271057 0.316718 1.31445 -0.883257 1.060792 -1.166023 0.498399 -1.296831 -0.02801 -1.275683 -0.518437 -1.208821 -0.83226 -0.478498 0.383764 0.03022 1.121284 0.317342 1.380303 1.036113 1.353646 1.381515 0.927663 1.601565 0.535197 1.696262 0.17625 -0.72235 1.213695 -0.284497 1.433578 -0.317517 1.372535 -0.821411 1.030567 -1.276567 -0.295154 -0.706765 0.122057 -0.04569 0.632425 0.706662 1.235945 1.653693 0.754035 1.811106 -0.223135 1.805567 -0.765974 1.637075 -0.87448 1.247455 -0.287344 1.296444 -0.573405 0.57881 -0.217365 -0.905446 0.780775 -2.431521 2.125754 -2.387149 2.191603 -2.429809 2.128295 -2.559505 1.935825 -4.177901 1.8208 -4.330016 1.621492 -4.071355 2.014826 -3.40192 3.000803 -0.635763 1.071924 -0.511834 1.107966 -0.600138 1.036094 -0.900675 0.856311 -2.203517 2.684978 -1.787272 3.017846 -0.923714 3.277009 0.387161 3.462469 0.450291 2.172032 -0.124321 2.183054 -0.751228 2.025513 -1.430425 1.69939 -1.095294 1.07461 -1.321122 0.88348 -1.245742 0.92365 -0.869153 1.19513 -0.369847 3.95898 -1.270639 3.72521 -2.003555 3.41623 -2.568596 3.03205 -0.634749 1.3401 0.572996 1.26803 1.239566 1.02236 1.364958 0.60306 2.143675 0.66419 2.236985 0.46833 2.244842 0.0954 2.167249 -0.4546 -0.241218 -1.13918 -0.487385 -1.11554 -0.425588 -1.14678 -0.05583 -1.23287 0.698859 -4.46539 2.158643 -3.93805 3.216888 -3.23101 3.873594 -2.34425 0.365677 0.31426 -0.165904 1.04196 -0.377113 1.29206 -0.267945 1.06455 -0.479719 1.4279 -0.535821 1.46559 -0.09096 1.42049 0.854863 1.29265 1.745203 1.4719 1.833812 1.43999 1.595643 1.62675 1.0307 2.03212 0.03057 1.13168 -0.04449 1.14776 0.01279 1.1355 0.202404 1.09487 1.827125 0.50156 1.882043 0.0393 1.901566 -0.18421 1.885693 -0.16896 0.84768 -0.54982 -0.08556 -0.77877 -0.585718 -0.83027 -0.652786 -0.7043 -2.610393 -2.91919 -2.480372 -3.12295 -1.702199 -3.45546 -0.275872 -3.91674 2.418538 -3.90332 3.27999 -3.30278 3.211855 -3.35461 2.214134 -4.058799 0.28314 -0.953366 0.329491 -0.891256 0.539409 -0.672583 0.912896 -0.297344 5.813635 -2.041923 6.018474 -1.394351 6.013762 -1.419202 5.7995 -2.116478 1.690186 -0.861756 1.497092 -1.13063 1.27336 -1.373819 1.01899 -1.591323 4.332282 -0.102336 4.272383 -0.851231 4.26731 -0.705038 4.3171 0.336242 1.43532 0.245926 1.4596 0.328879 1.1838 0.695076 0.60792 1.344519 0.71757 2.743101 0.0269 2.838059 -0.80854 2.658985 -1.78872 2.205882 -0.49024 0.707506 -0.0226 0.706652 0.37675 0.626216 0.70777 0.466195 1.98843 1.163201 2.14072 0.597758 2.23744 0.144458 2.27857 -0.196697 1.08428 -0.162351 1.12895 -0.16687 1.08563 -0.26561 0.95433 -0.458572 -0.34465 -1.524384 -0.84019 -1.369511 -0.96504 -1.347932 -0.71915 -1.459644 -1.14157 -2.626873 -0.58695 -2.784458 0.10138 -2.814131 0.92339 -2.715889 0.56177 -1.781667 -0.19518 -1.76885 -0.83784 -1.59655 -1.36625 -1.264764 -1.96166 -1.284325 -2.20816 -0.540935 -2.32395 -0.0011 -2.30901 0.335027 -3.26692 -0.0791 -3.12371 -0.857149 -3.03054 -1.271907 -2.987389 -1.323376 2.007879 -2.654164 1.89567 -2.732271 1.72076 -2.840811 1.48314 -2.979786 1.54854 -1.63624 1.85459 -1.264091 2.04805 -0.950144 2.12895 -0.6944 1.08524 0.919894 0.52648 1.378069 0.26451 1.55593 0.29937 1.453472 0.24121 1.638123 0.007 1.668273 0.0606 1.647706 0.40236 1.576424 2.08295 0.38912 2.11482 -0.232752 2.12619 -0.534568 2.11707 -0.516328 1.31877 -0.567765 1.21288 -0.762391 0.73813 -1.028225 -0.10547 -1.365269 -3.10586 -2.891924 -2.49862 -3.412616 -1.78677 -3.825527 -0.97032 -4.130658 -0.61122 -1.135829 -0.92485 -0.961128 -1.14948 -0.640235 -1.28507 -0.173151 -2.59703 0.251311 -2.29785 1.177618 -2.0066 1.752744 -1.72332 1.976688 -2.57277 2.30495 -3.01629 1.644817 -3.191563 1.38918 -3.098563 1.538035 -1.949257 -3.67755 -2.009858 -3.697406 -1.67178 -3.803874 -0.935025 -3.996953 1.833413 -0.985769 1.441122 -1.513768 0.930684 -1.872887 0.302101 -2.063126 0.849373 -0.552355 0.833547 -0.01213 0.818746 0.353121 0.804975 0.543391 3.025165 0.731227 3.112 -0.715679 2.31134 -1.966872 0.62314 -3.022355 -0.90543 -0.905473 -1.31315 -0.138055 -1.43662 0.04168 -1.27582 -0.366267 1.88455 -0.560834 2.02079 -0.388065 1.74653 -0.755716 1.06178 -1.663791 0.10031 -2.953655 -1.19974 -2.762376 -2.11753 -2.22779 -2.65309 -1.349899 -0.2998 -0.05092 -0.29979 -0.05092 -0.2998 -0.05092 |66.984557 19.681992 -1.83539 1.543211 -0.3837 1.787664 0.84743 1.614414 1.85799 1.023461 0.35615 0.0778 0.33707 0.04729 0.32004 0.0199 0.3051 -0.0044 -0.33447 0.05273 -0.33448 0.05273 -0.33447 0.05273 -0.33448 0.05273 -0.44873 0.168457 -0.44873 0.168457 -0.44873 0.168457 -0.44873 0.168457 -0.11328 0.08594 -0.11328 0.08594 -0.11328 0.08594 -0.11328 0.08594 -2.64943 -2.19867 -0.75344 -2.405497 1.39331 -1.937886 |69.68359 22.271484 0.7612 0.102943 0.74539 0.202495 0.67715 0.301728 0.5565 0.400647 0.0747 0.09294 0.0672 0.116657 0.0675 0.121724 0.0757 0.108136 -0.36572 0.646484 -0.36573 0.646484 -0.36572 0.646485 -0.36572 0.646484 -0.39697 -0.156738 -0.39697 -0.156738 -0.39698 -0.156739 -0.39697 -0.156738 -0.47852 -0.114258 -0.47851 -0.114258 -0.47851 -0.114257 -0.47852 -0.114258 -0.52441 -0.06055 -0.52442 -0.06055 -0.52441 -0.06055 -0.52442 -0.06055 -0.52881 0.0049 -0.5288 0.0049 -0.52881 0.0049 -0.52881 0.0049 1.29256 -0.595063 1.16809 -0.842136 1.23855 -0.800783 1.50392 -0.471003 0.22432 -0.02125 0.23433 -0.0099 0.30495 0.0013 0.18562 0.01226 |66.36719 25.460937 0.007 0.01123 0.007 0.01123 0.007 0.01123 0.007 0.01123 -0.15425 0.649379 -0.15557 0.684666 -0.1569 0.730045 -0.15828 0.78552 -3.92625 0.579992 -1.62854 2.409008 -1.54304 2.98482 -3.66975 2.30743 4.25885 -1.240062 1.78876 -2.53411 1.40851 -2.458548 3.1181 -1.013374 -0.29376 1.720274 -0.28613 1.899703 -0.2745 2.090202 -0.25889 2.291774 -0.0366 0.351696 -0.0377 0.346906 -0.0386 0.341843 -0.0394 0.336508 -2.97187 1.47069 -2.03091 2.710217 -1.96116 2.715466 -2.76262 1.48644 3.16557 -0.998698 2.19178 -2.200662 1.8886 -2.267973 2.25601 -1.200636 -0.2584 1.682951 -0.27493 1.522393 -0.28805 1.370893 -0.29777 1.228451 -2.14447 0.436199 -1.50244 1.400041 -1.11843 1.893543 -0.99247 1.916701 -0.38412 0.435912 -0.42095 0.339205 -0.63413 0.324205 -1.02369 0.390912 2.29017 -0.476007 1.54136 -1.569664 1.31504 -1.94429 1.61124 -1.599883 0.27732 -0.191282 0.30881 -0.173171 0.32289 -0.163796 0.3195 -0.163157 -1.19235 3.209514 -1.07781 1.716955 -0.78061 0.689268 -0.30079 0.126451 -1.99457 1.004981 -1.98648 1.616058 -1.90904 1.294308 -1.76226 0.03973 0.37262 -0.134849 0.3166 -0.182144 0.26691 -0.22433 0.22356 -0.261411 0.0293 -0.0419 0.0282 -0.04291 0.0273 -0.04347 0.0265 -0.04359 0.47995 -1.276323 0.27343 -1.471935 0.34449 -1.443997 0.69314 -1.19251 0.0443 -0.04697 0.0439 -0.04708 0.0452 -0.04595 0.0482 -0.04359 0.05 -0.02001 0.0485 -0.02085 0.0476 -0.02141 0.0472 -0.0217 0.45561 -0.270181 0.32734 -0.337523 0.17659 -0.401835 0.003 -0.463118 -1.906 0.705998 -1.88132 0.0072 -1.78063 -0.804467 -1.60393 -1.729064 2.32923 0.587195 1.70626 -0.151546 1.22513 -0.729234 0.88586 -1.145868 0.24915 -1.059018 -0.25774 -1.086865 -0.45217 -1.086677 -0.33416 -1.058456 0.0233 -0.514969 0.21422 -0.434156 0.3406 -0.381469 0.40239 -0.356906 2.29915 -0.388011 1.90851 -0.881598 1.18944 -1.257537 0.14196 -1.515823 -3.98842 2.419167 -3.77503 -0.08443 -1.92553 -2.006683 1.56008 -3.347583 0.89181 1.615039 1.27264 0.534485 1.27734 -0.228266 0.90586 -0.673211 0.40387 -1.687244 -0.4633 -1.95431 -0.56004 -1.916249 0.11361 -1.573056 0.13739 -0.215798 0.18473 -0.235789 0.22386 -0.251206 0.25481 -0.262051 0.1582 0.04981 0.1582 0.0498 0.15821 0.0498 0.1582 0.04981 0.36719 0.08008 0.36718 0.08008 0.36719 0.08008 0.36719 0.08008 0.37353 0.04785 0.37354 0.04785 0.37353 0.04785 0.37354 0.04785 0.375 0.01318 0.375 0.01318 0.375 0.01318 0.375 0.01318 0.37353 -0.02149 0.37354 -0.02148 0.37353 -0.02148 0.37354 -0.02149 0.0366 -0.0068 0.0366 -0.0068 0.0366 -0.0068 0.0366 -0.0068 0.0366 -0.0073 0.0366 -0.0073 0.0366 -0.0073 0.0366 -0.0073 0.0361 -0.0088 0.0361 -0.0088 0.0361 -0.0088 0.0361 -0.0088 0.0356 -0.0093 0.0357 -0.0093 0.0356 -0.0093 0.0357 -0.0093 0.0356 -0.01025 0.0356 -0.01026 0.0356 -0.01026 0.0357 -0.01026 0.0352 -0.01123 0.0352 -0.01123 0.0351 -0.01123 0.0352 -0.01123 0.0356 -0.01172 0.0357 -0.01172 0.0357 -0.01172 0.0356 -0.01172 0.0347 -0.01172 0.0347 -0.01172 0.0347 -0.01172 0.0347 -0.01172 0.0635 -0.02295 0.0635 -0.02295 0.0635 -0.02295 0.0635 -0.02295 0.043 -0.01563 0.043 -0.01563 0.043 -0.01563 0.043 -0.01563 0.0303 -0.01123 0.0303 -0.01123 0.0303 -0.01123 0.0303 -0.01123 0.023 -0.0093 0.023 -0.0093 0.0229 -0.0093 0.023 -0.0093 0.023 -0.0098 0.0229 -0.0098 0.023 -0.0098 0.023 -0.0098 0.0293 -0.0127 0.0293 -0.01269 0.0293 -0.0127 0.0293 -0.0127 0.043 -0.01807 0.043 -0.01807 0.043 -0.01807 0.043 -0.01807 0.0625 -0.02588 0.0625 -0.02588 0.0625 -0.02588 qq=LDText.Split(q "|") GraphicsWindow.BackgroundColor="teal GraphicsWindow.PenWidth=.8 GraphicsWindow.BrushColor="transparent For f=1 To 9 q=LDText.Split(qq[f] " ") i=0 pp="" pp1="" p0=q[1]*2 p1=q[2]*2 For r=3 To Array.GetItemCount(q) Step 2 If q[r]="r" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 Else i=i+1 pp[i][1]=p0+q[r]*2 pp[i][2]=p1+q[r+1]*2 p0=pp[i][1] p1=pp[i][2] EndIf EndFor If f>=7 or f=2 Then GraphicsWindow.BrushColor="gold ElseIf f<=5 Then GraphicsWindow.BrushColor="black Else GraphicsWindow.BrushColor="brown EndIf pq=LDShapes.AddPolygon(pp) For a=1 To Array.GetItemCount(pp) pp1[a][1]=600-pp[a][1] pp1[a][2]=pp[a][2] EndFor pq1=LDShapes.AddPolygon(pp1) If f=6 or f=2 Then LDEffect.DropShadow(pq "") LDEffect.DropShadow(pq1 "") ElseIf f=8 Then LDShapes.Move(pq 140 45) LDShapes.Move(pq1 580-140 45) ElseIf f=9 Then LDShapes.Move(pq 120 63) LDShapes.Move(pq1 565-120 63) EndIf GraphicsWindow.Title=f Program.Delay(22) EndFor LDEvents.MouseWheel=mww zz=1 GraphicsWindow.BrushColor="black pq=Shapes.AddEllipse(7 7) Shapes.Move(pq 170 49) pq=Shapes.AddEllipse(7 7) Shapes.Move(pq 593-170 49) GraphicsWindow.Title="Ponnies Sub mww zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz 100 150 0) EndSub End>RJV536-0.sb< Start>RJV536-1.sb< q="160.0636 76.7484 -0.49985 -0.579723 -0.55061 -0.580539 -0.60584 -0.581083 -0.6655 -0.581355 -4.83263 -3.257293 -4.96295 -1.787148 -5.03746 -0.633208 -5.42673 0.301599 -10.72658 3.233741 |37.0842 90.3515 -0.33112 2.727844 1.225232 2.696156 2.161627 2.480981 2.478061 2.082319 -3.898905 0.57432 -2.930532 0.59363 -1.91149 1.15703 -0.841773 2.26452 0.666158 2.21507 2.085279 1.36962 2.835186 0.8593 2.915877 0.68411 -2.283317 1.1548 -1.771021 1.42314 -0.929201 1.66484 0.242139 1.87992 1.731517 1.55033 2.908145 0.82883 3.388915 0.14538 3.173823 -0.50004 -1.475847 3.5062 -0.613703 3.79253 1.414072 2.49274 4.607478 -0.39317 5.554383 -2.48179 4.777579 -3.01938 4.537824 -3.50783 4.835114 -3.9471 8.751444 7.1318 9.434806 4.67731 8.878156 2.0455 7.081494 -0.76361 9.10962 -5.15252 7.26184 -7.32191 5.61044 -8.97988 4.1554 -10.12649|161.7907 77.6633 -0.41972 -0.258675 -0.42812 -0.2382 -0.43597 -0.218963 -0.44329 -0.200962 -3.0592 -0.888191 -3.24581 -0.236609 -3.31333 0.282091 -3.26176 0.667909 -0.71698 0.190125 -0.70752 0.2007 -0.69613 0.210487 -0.68277 0.219488 -4.04056 1.733698 -3.38254 2.369615 -2.67394 3.084607 -1.91476 3.87868 -0.24211 0.729802 -0.20489 0.709786 -0.16784 0.691092 -0.13096 0.67372 -0.1462 1.291273 0.003 1.23794 0.1486 1.195732 0.28985 1.164655 0.52238 1.350684 0.71974 1.338666 0.91996 1.34347 1.12302 1.36508 3.22129 2.69987 3.83447 1.62718 3.98 0.18471 3.65784 -1.62756 -2.43081 -1.34539 -1.69358 -2.06627 -0.90913 -2.566098 -0.0775 -2.844842 2.4176 -0.935229 2.76801 0.302656 2.68296 1.337273 6.45807 6.16485 4.79455 9.00578 2.87801 9.22747 4.58211 -18.48261 -2.31259 -13.492965 -4.69589 -8.268206|119.283 128.9671 2.70826 -2.71689 2.97784 -1.77129 3.36312 -0.92892 3.86408 -0.1898 1.80559 0.23996 1.69088 0.60171 1.33107 1.01711 0.72616 1.48612 -1.1186 2.09234 -3.4149 0.67481 -3.94875 0.26973 -2.72015 0.87712 5.37835 0.16498 4.6075 1.53233 3.24572 2.32908 1.29303 2.55521 -0.56886 1.59868 -1.53803 0.94568 -2.02145 0.31833 -2.01916 -0.28339 -4.24135 -1.4397 -4.10499 -1.10749 -3.71542 0.11338 -3.07264 2.22291 -0.62877 0.90575 -0.60507 0.81644 -0.70944 0.62674 -0.94192 0.33667 -1.19556 -0.0937 -1.05958 -0.54947 -0.74733 -0.90358 -0.25883 -1.15599 0.45749 -2.01224 0.81072 -1.75501 0.60555 -1.71653 -0.15806 -1.89682 -2.19032 -2.90054 -3.73913 -2.435 -4.41315 -2.13701 -4.2124 -2.00655 1.8921 -0.31962 2.06764 -0.64497 1.96877 -0.91412 1.59549 -1.12709 2.06368 1.20321 2.93657 2.27286 3.17507 2.85498|L 113.3711 87.6573 102.5079 78.282286 92.110938 63.898238 83.509311 47.792095 78.0321 33.2508 76.546041 30.120186 73.520175 26.680338 68.687597 23.052745 61.7814 19.3589 58.098748 17.817264 54.172713 16.510462 49.96222 15.493105 |45.4262 14.8198 -0.987517 -0.242472 -3.01592 -0.488903 -5.124377 -0.377566 -7.312886 0.09154 -7.522478 1.335887 -7.399536 2.985922 -6.4875571 4.264012 -4.7865414 5.170155 -2.29648988 5.704351 0.98259768 5.866602 5.0507221 5.656907 9.9078826 5.075265 3.85446 1.240857 3.950724 0.949752 3.943933 0.685766 3.834083 0.4489 6.926391 0.295678 5.250309 -0.326353 -2.686623 1.887583 -3.829764 3.28578 -2.981721 4.192248 -0.142492 4.606989 1.831874 2.925675 3.700578 0.0093 8.942486 -1.280125 8.321542 -2.768012 3.66962 -1.528713 -3.239427 3.066208 -2.631935 3.458729 -1.300105 3.507011 0.756067 3.211052 4.196773 2.431139 5.537165 -0.0293 4.826445 -1.063495 |69.0047 83.5611 -0.454928 2.63905 0.795528 2.13925 2.494055 1.197022 3.563358 0.283053 3.625701 -0.330409 2.681086 -0.643366 -1.108197 3.730309 -0.120128 3.038566 0.707084 2.259278 1.373441 1.392447 2.421492 0.687473 3.638996 -0.249286 4.426326 -1.195129 4.783486 -2.150058 3.74115 3.625667 4.37786 1.714023 4.12761 0.17395 2.99038 -0.99454 1.74237 -1.535059 1.17619 -1.813666 0.64484 -2.079428 0.1483 -2.332347 -0.15201 -1.285556 -0.50185 -1.442644 -1.02733 -1.443694|134.0108 109.62518 -0.27619 0.01 -0.28442 0.0188 -0.29366 0.0264 -0.30394 0.0327 -2.6467 0.55358 -2.22013 1.00866 -1.8619 1.54785 -1.57205 2.17116 -0.32364 -0.2734 -0.34331 -0.27423 -0.35896 -0.27434 -0.37057 -0.27373 -0.54473 0.74013 -0.55673 0.72792 -0.56948 0.7151 -0.58297 0.70162 0.51162 0.26803 0.39876 0.23519 0.26681 0.19647 0.11578 0.15187 0.1292 1.36655 -0.20938 1.24299 -0.26352 1.25901 -0.0332 1.41465 0.30512 0.76944 0.61458 0.54164 0.79144 0.26306 0.83573 -0.0663 0.61322 -0.33555 0.42104 -0.50974 0.32823 -0.62909 0.33478 -0.69358 1.87784 -1.87055 2.55216 -0.48461 2.95435 0.31553 3.0844 0.52986 1.42459 -0.0253 1.36063 -0.44104 0.95825 -0.82117 0.21747 -1.16564 -0.84445 -1.42085 -1.83364 -0.95912 -2.83346 -0.63584 -3.84392 -0.45098 3.36323 -0.93891 2.04498 -1.21209 0.80719 -1.203 -0.35017 -0.91163 -0.73181 -0.46282 -0.72608 -0.29211 -0.7447 -0.14902 -0.78764 -0.0335 0 0|120.60455 0.25409612 -4.03883 0.90949628 -3.02929 2.8823672 -1.59289 5.1666111 0.27038 7.7622283 1.33726 5.810094 2.00911 5.420107 2.25047 4.574538 2.06137 3.273387 -2.16512 -1.068732 -3.47042 -1.313594 -3.75665 -0.446649 -3.02383 1.532099 0.0566 4.605157 3.97863 5.320401 4.71983 4.39522 2.28013 1.829613 -3.12103 -1.009584 -3.16066 -0.479494 -2.72244 0.396881 -1.80642 1.619541 -0.0891 3.566047 1.97133 3.5633 2.38814 2.739837 1.1613 1.09566 -1.96512 0.128123 -2.15167 0.256845 -1.8633 0.636626 -1.09999 1.267468 0.10634 2.031915 1.07319 2.399874 1.49123 2.223531 1.36049 1.502883 -2.79816 0.599711 -2.00357 0.993894 -1.20914 1.253244 -0.41491 1.377761 0.19343 1.26108 0.76783 1.544187 1.2833 1.718213 1.73982 1.78316 2.39273 -1.52819 2.27997 -1.456877 2.08132 -1.324695 1.79676 -1.131644 3.31236 -1.981694 3.35447 -1.816738 3.38385 -1.616253 3.40049 -1.380237 3.60267 -5.915316 3.8485 -5.525789 3.87877 -4.871642 3.6935 -3.952878 1.49711 -2.062249 1.15335 -3.165221 0.6377 -4.397677 -0.0499 -5.759618 -0.30366 -2.919916 -0.54075 -2.994672 -0.82753 -3.076441 -1.164 -3.165221 -0.19173 -0.722907 -0.74778 -2.11907 -1.56269 -3.440758 -2.63647 -4.687969 -3.77321 -4.6403656 -4.88987 -3.8673777 -5.385 -2.6408498 qq=LDText.Split(q "|") GraphicsWindow.BackgroundColor="teal GraphicsWindow.PenWidth=.8 GraphicsWindow.BrushColor="transparent For f=1 To 9 q=LDText.Split(qq[f] " ") i=0 pp="" pp1="" If f=5 Then For r=2 To Array.GetItemCount(q) Step 2 i=i+1 pp[i][1]=q[r]*2 pp[i][2]=q[r+1]*2 EndFor i=i+1 pp[i][1]=86 pp[i][2]=30 i=i+1 pp[i][1]=136 pp[i][2]=175 i=i+1 pp[i][1]=230 pp[i][2]=177 ' 178 262 193 Else p0=q[1]*2 p1=q[2]*2 For r=3 To Array.GetItemCount(q) Step 2 If q[r]="r" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 Else i=i+1 pp[i][1]=p0+q[r]*2 pp[i][2]=p1+q[r+1]*2 p0=pp[i][1] p1=pp[i][2] EndIf EndFor If f=1 Then i=i+1 pp[i][1]=178 pp[i][2]=193 i=i+1 pp[i][1]=262 pp[i][2]=193 EndIf EndIf GraphicsWindow.PenWidth=0 If f=3 or f=4 or f=8 Then GraphicsWindow.BrushColor="gold ElseIf f=9 or f=5 or f=6 or f=7 Then GraphicsWindow.BrushColor="blue Else GraphicsWindow.BrushColor="red EndIf pq=LDShapes.AddPolygon(pp) LDShapes.ZIndex(pq f) GraphicsWindow.Title=f LDEffect.DropShadow(pq "direction=225;shadowdepth=3") Program.Delay(12) EndFor LDShapes.ZIndex(pq 0) LDShapes.BrushColour(pq,"darkblue") LDEvents.MouseWheel=mww zz=1.5 GraphicsWindow.BrushColor="white pq=Shapes.AddEllipse(21 19) Shapes.Move(pq 260 155) LDShapes.ZIndex(pq 102) GraphicsWindow.BrushColor="black pq=Shapes.AddEllipse(7 7) Shapes.Move(pq 270 165) LDShapes.ZIndex(pq 103) GraphicsWindow.BrushColor="blue pq=Shapes.AddEllipse(39 30) Shapes.Move(pq 250 150) LDShapes.ZIndex(pq 2) GraphicsWindow.MouseDown=mmm GraphicsWindow.Title="Parrot LDGraphicsWindow.Reposition(zz zz 100 100 0) Sub mmm GraphicsWindow.Title=GraphicsWindow.MouseX+";"+GraphicsWindow.MouseY EndSub Sub mww zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz 100 100 0) EndSub End>RJV536-1.sb< Start>RJV536-2.sb< q="74.304688 3.5859375 1.769515 1.1710107 3.435735 2.9437235 4.004984 3.7252233 3.477266 3.515511 5.701936 -0.719469 12.812986 -0.906031 14.67955 1.094219 11.30162 5.281281 -1.51563 0.247559 -1.51562 0.247558 -1.51562 0.247559 -1.51563 0.247559 0.28906 1.815918 0.28907 1.815917 0.28906 1.815918 0.28906 1.815918 2.271 -0.247559 2.271 -0.247558 2.27099 -0.247559 2.271 -0.247558 0.11146 0.415432 0.27626 0.943201 0.35388 1.016326 0.34433 0.634807 0.71658 0.167655 1.17086 -0.0095 1.09287 -0.08221 0.48258 -0.05059 0.0465 0.756675 -0.18015 1.751684 -0.88627 1.969185 -2.07187 1.409175 -2.13078 0.335556 -3.50054 0.345522 -3.47784 0.263772 -2.06272 0.09031 -1.18978 -3.704157 -2.11053 -3.631671 -3.01652 -2.964733 -3.90778 -1.703345 -3.66847 -0.327983 -4.10674 0.396013 -4.02724 1.207702 -3.42997 2.107081 -2.188744 2.495684 -1.702662 3.026605 -1.172974 3.207355 -0.599682 3.037934 -12.320383 -1.514304 -14.116867 -0.769095 -13.73418 -0.03316 -11.17232 0.693508 -0.664403 -3.531695 -1.476386 -3.273477 -2.066636 -2.862103 -2.435153 -2.297569 -2.808926 -1.836155 -3.956996 -0.491389 -3.922345 0.438595 -3.410858 0.861707 -3.266848 1.651977 -2.579293 2.281576 -1.469984 2.486351 -0.83475 3.085854 -3.617977 0.137358 a 7.586875 34.505639 a 5.1936016 32.84864 a 4.5625 29.757812 a 4.8327727 29.053711 a 5.3134674 28.35781 a 6.640625 25.132812 r 17 27 0.09863 -1.432617 0.09863 -1.432617 0.09863 -1.432617 0.09863 -1.432617 -0.781208 -0.180685 -1.821706 -0.451206 -2.079332 -0.585456 -1.5540824 -0.583435 2.8031624 -2.842242 3.748806 -1.546008 4.259932 -0.547195 4.336537 0.154195 7.784765 0.725701 7.795508 0.635417 7.809571 0.475854 7.826953 0.247013 4.379695 -0.01512 5.509805 -0.108931 4.994742 -0.163118 2.834508 -0.177679 0.154353 -3.395111 0.325553 -3.7405452 0.45474 -3.034045`11.328461 91.623105 a 11.328461 91.623105 -0.142938 3.666016 5.833406 0.503906 -0.04635 -3.226562`48.999804 105.30737 -0.936016 -0.8858 -1.611859 -2.76182 -1.994172 -3.39277 -2.082953 -2.778609 -3.036422 -1.862656 -3.749953 -0.684594 -3.962016 0.207531 -3.672609 0.813719 -0.911969 0.398656 -1.211781 0.617094 -1.173906 0.561219 -0.798344 0.231031 -0.252406 -0.102656 -0.02759 -0.211594 0.101406 -0.234469 0.134594 -0.171281 1.976719 -1.394437 2.401031 -1.071563 2.578406 -0.756562 2.508844 -0.449438 3.398397 -0.02682 3.398681 0.571411 2.708911 1.177948 2.156636 1.857208 2.964484 4.727531`125.1458 96.507371 -0.59925 0.30875 -0.95175 -0.37375 -3.2079 -2.383488 -3.64327 -1.383668 -3.86721 -0.381528 -3.87974 0.622934 -3.68085 1.629715 -3.27054 2.638816 -2.648817 3.650238 -1.815669 4.66398 -1.271375 0.2875 -0.964625 -1.1375 2.262672 -6.173414 3.713644 -4.216898 4.64804 -2.502117 5.06589 -1.02907 4.96717 0.202242 4.35189 1.19182 3.22005 1.939665`138.7118 97.169371 a 138.7118 97.169371 -6.244 0.639 -0.527 -4.221 4.675 -0.279`97.425544 107.63737 0.23701 0.87825 -0.636668 0.60375 -1.2268 -0.32977 -1.76237 -0.33418 -2.107201 -0.32456 -2.261293 -0.30087 -2.224645 -0.26313 -1.997257 -0.21135 -1.579131 -0.14551 -0.970264 -0.0656 -4.315006 -0.0884 -4.324815 0.0239 -4.330276 0.12205 -4.331387 0.20603 -4.32815 0.27581 -4.320564 0.33145 -4.308628 0.37291 -4.292344 0.4002 -0.544006 -0.36562 0.291687 -0.61538 2.310327 -0.40721 4.856255 -0.4302 6.680102 -0.38655 7.781869 -0.27629 8.161557 -0.0994 7.819165 0.14416 6.754692 0.45433 qq=LDText.Split(q "`") GraphicsWindow.Title="Convertible bb=LDShapes.BrushGradient("1=lightblue;2=lightblue;3=lightblue;4=darkblue;5=black" "V") ldGraphicsWindow.BackgroundBrush(bb) For f=1 To 5 q=LDText.Split(qq[f] " ") i=0 pp="" pp1="" p0=q[1]*2 p1=q[2]*2 For r=3 To Array.GetItemCount(q) Step 2 If q[r]="r" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 ElseIf q[r]="a" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 i=i+1 pp[i][1]=p0 pp[i][2]=p1 Else i=i+1 pp[i][1]=p0+q[r]*2 pp[i][2]=p1+q[r+1]*2 p0=pp[i][1] p1=pp[i][2] EndIf EndFor If f=1 Then GraphicsWindow.PenWidth=1.8 GraphicsWindow.BrushColor=LDColours.HSLtoRGB(210 1 .45) ElseIf f=2 or f=5 Then GraphicsWindow.PenWidth=3 GraphicsWindow.BrushColor="gold If f=2 Then GraphicsWindow.BrushColor="red EndIf Else GraphicsWindow.PenWidth=0.1 GraphicsWindow.BrushColor="black EndIf pq=LDShapes.AddPolygon(pp) ' GraphicsWindow.Title=f If f>1 Then Shapes.Move(pq Shapes.GetLeft(pq)-8 Shapes.GetTop(pq)-142) ElseIf f=1 Then LDEffect.DropShadow(pq "shadowdepth=3") EndIf LDShapes.ZIndex(pq f) Program.Delay(12) EndFor LDEvents.MouseWheel=mww zz=2 GraphicsWindow.BrushColor="black e=Shapes.AddEllipse(50 37) LDShapes.Centre(e 57 71) LDShapes.ZIndex(e 55) LDEffect.DropShadow(e "shadowdepth=2") e=Shapes.AddEllipse(50 37) LDShapes.Centre(e 222 71) LDShapes.ZIndex(e 55) LDEffect.DropShadow(e "shadowdepth=2") GraphicsWindow.PenWidth=0 e=Shapes.AddRectangle(3 37) LDShapes.Centre(e 173 53) LDShapes.ZIndex(e 55) e=Shapes.AddRectangle(3 33) LDShapes.Centre(e 96 53) LDShapes.ZIndex(e 55) e=Shapes.AddRectangle(8 4) LDShapes.Centre(e 105 44) LDShapes.ZIndex(e 55) GraphicsWindow.BrushColor="cyan GraphicsWindow.PenWidth=2 e=Shapes.AddTriangle(155.5 17 154 32 170 30) LDShapes.ZIndex(e 55) GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="teal GraphicsWindow.BrushColor="lightgray e=Shapes.AddEllipse(23 20) LDShapes.Centre(e 57 71) LDShapes.ZIndex(e 55) e=Shapes.AddEllipse(23 20) LDShapes.Centre(e 222 71) LDShapes.ZIndex(e 55) GraphicsWindow.MouseDown=mmm LDGraphicsWindow.Reposition(zz zz 170 250 0) GraphicsWindow.FontSize=22 GraphicsWindow.FontBold="false GraphicsWindow.FontName="Edwardian Script ITC" s=shapes.addText("Convert") LDShapes.ZIndex(s 65) LDShapes.Centre(s 133 65) Sub mmm GraphicsWindow.Title=GraphicsWindow.MouseX+";"+GraphicsWindow.MouseY EndSub Sub mww zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz 170 250 0) EndSub End>RJV536-2.sb< Start>RJV536-3.sb< q="101.78735 53.128398 3.97195 1.950087 5.33243 2.781828 4.66585 2.517641 1.96202 1.259984 -0.34492 0.291859 -0.37595 0.396766 -0.34127 0.433703 -0.24086 0.402672 1.94494 0.912219 1.56656 0.08328 1.56281 -0.0097 1.93369 0.633219 1.55644 -1.153969 1.61306 -0.670781 1.66406 0.03909 1.70944 0.975656 1.74516 -0.912016 1.77009 -0.222109 1.79897 0 1.83178 -0.246578 2.13792 -0.808219 2.14871 -0.790781 2.15189 -0.133781 2.14748 1.162781 0.45845 0.525969 0.36968 0.621031 0.25735 0.678031 0.12152 0.696969 -0.3205 1.324 -0.91225 1.303 -1.18937 1.108 -1.15188 0.739 -2.82455 0.595313 -2.96432 -0.04481 -2.85465 0.441188 -2.49548 2.053312 -0.93387 0.378156 -0.98188 0.258344 -0.998 0.05959 -0.98225 -0.218094 -0.90622 0.762328 -0.72678 0.468047 -0.43278 0.590859 -0.0242 1.130766 -0.0937 0.594734 -0.49756 0.495641 -0.94944 0.416703 -1.44931 0.357922 -0.46347 0.763953 -0.90053 0.588922 -1.25753 0.219734 -1.53447 -0.343609 -0.46909 -0.238938 -0.43441 -0.323312 -0.34216 -0.411437 -0.19234 -0.503313 -0.68139 0.247625 -0.70398 0.237875 -0.70755 0.07813 -0.69208 -0.231625 -0.77642 -0.437047 -0.40846 -0.636828 -0.51176 -0.302141 -1.08636 0.567016 2.07245 1.124078 2.17942 0.862047 1.80499 1.249234 0.94914 2.285641 0.15147 2.740219 -0.17572 2.750531 -0.46484 2.718656 -0.71591 2.644594 1.47973 0.336953 1.9754 0.427422 1.86007 0.497734 1.1338 0.547891 -0.44603 2.03675 -0.83997 1.89875 -1.22922 1.644504 -1.61378 1.274 -2.08606 -0.8357 -2.06469 -1.021428 -2.07781 -1.03286 -2.12544 -0.870016 -2.85441 -1.080891 -2.80059 -1.223484 -2.78109 -1.273547 -2.79591 -1.231078 -0.0152 3.782188 -1.052593 3.526816 -1.99197 3.07306 -2.83328 2.42094 0.64697 1.27186 0.73678 1.22226 0.84516 1.14146 0.97209 1.02942 -1.44044 1.38238 -2.83431 0.88587 -3.08669 0.38225 -2.19756 -0.1285 -0.12678 -0.60462 0.0635 -0.59788 0.15241 -0.59187 0.13984 -0.58663 -0.0752 -1.98483 -0.64545 -2.16529 -0.90065 -2.12499 -0.84073 -1.86389 -0.72787 -1.18197 -0.95963 -0.98453 -1.03162 -0.925285 -0.94388 -1.004219 -1.17212 0.431234 -1.36188 0.571391 -1.12787 0.498828 -0.47013 0.213551 -0.42259 -0.318113 -0.33691 -0.486016 -0.27016 -0.547703 -0.22234 -0.503172 -1.67653 -3.441234 -1.86272 -3.062391 -2.32059 -2.690578 -3.05016 -2.325797 -1.36547 0.602203 -1.25278 0.293672 -1.27791 -0.01177 -1.44084 -0.314109 -2.0567 0.1245 -1.97992 0.93825 -1.99211 0.715875 -2.09327 -0.542625 -0.46158 0.08848 -0.45454 0.108641 -0.39099 0.213078 -0.27089 0.401797 -0.65936 1.895062 -0.66151 1.539938 -1.02208 1.309687 -1.74105 1.204313 -1.19445 0.477844 -1.27592 0.215906 -1.29374 -0.04772 -1.24789 -0.313031 -0.92264 0.894172 -1.07348 0.650703 -1.18918 0.365516 -1.2697 0.03861 -3.92062 4.845622 -5.17013 4.02663 -5.892 2.7085 -6.08625 0.89125 -2.22162 -0.0648 -2.42638 -0.22891 -2.27187 -0.62903 -1.7581304 -1.26522 -0.4097 -1.11161 0.26933 -0.92852 0.0843 -0.88445 -0.96489 -0.97942 -1.13542 -1.60433 0.3133 -1.8958 0.6431 -1.859231 -0.14598 -1.494641 -1.438 -3.854 1.532 -4.331 -0.56122 -3.198094 0.46823 -1.037906 2.5152204 -2.399344 -0.0562 -1.264656 -0.0208 -3.137625 0.57881 -0.956375 2.784 -2.094 -0.12352 -1.728891 0.41715 -1.935234 0.98957 -1.388672 1.5938 -0.0892 2.98525 2.993719 2.7295 4.465031 4.36188 3.936656 7.88237 1.408594 1.39533 -0.974844 1.66055 -0.657406 1.7106 -0.06678 1.54552 0.797031 2.32802 -1.165703 2.29811 -0.450672 2.27054 0.381266 2.24533 1.330109 1.68953 -0.963719 1.56597 0.144969 1.52772 0.329094 1.57478 -0.411344 -4.31334 -2.854891 -1.29141 -3.420484 0.79172 -4.018797 1.93603 -4.649828 -4.83459 -1.412266 -5.49591 -0.840109 -4.50741 -0.404172 -1.86909 -0.104453 5.16234 -3.523172 6.24141 -2.855203 6.54928 -2.378766 6.08597 -2.093859 -2.69498 -2.362031 -2.64539 -2.644969 -2.89871 -2.104969 -3.45492 -0.742031 -0.18187 -0.223766 -0.0574 -0.272609 0.039 -0.285922 0.10725 -0.263703 6.93856 -1.884328 3.95469 1.012453 3.54331 1.876641 5.70444 0.708234 -1.32211 -2.050109 -1.35801 -2.055266 -1.10846 -2.168328 -0.57342 -2.389297 1.92288 -0.636563 3.93362 -0.999187 4.12563 -1.073812 2.49887 -0.860438 -0.34916 -1.402828 -0.30284 -1.418297 -0.35909 -1.399734 -0.51791 -1.347141 -1.00906 0.01289 -1.01694 0.138234 -1.01319 0.08667 -0.99781 -0.141797 -0.26558 -1.016047 0.0857 -0.889578 0.21039 -0.853016 0.10848 -0.906359 -0.1195 -0.348594 -0.2845 -0.229156 -0.361 -0.142531 -0.349 -0.08872 -3.13964 -0.749391 -3.17948 -1.276734 -2.64193 -2.405672 -1.52695 -4.136203 -0.0894 -2.390094 -0.44263 -2.2609063 -0.51312 -2.2196563 -0.30088 -2.2663438 0.0408 -0.2352656 0.12122 -0.1363594 0.18197 -0.058547 0.22303 -0.00183 0 0 2.36605 2.5510938 2.01757 2.1871563 2.36652 1.6385313 3.41286 0.905219 4.53559 0.214281 6.67666 0.110969 6.66203 0.150344 4.49172 0.332406 5.11117 1.512938 5.142203 2.665312 4.52927 3.574687 3.27236 4.241063 2.42328 -0.3815 3.65647 -0.638 3.45884 -0.58025 1.83041 -0.20825 1.27419 0.573297 1.18231 1.130828 0.92806 1.385266 0.51144 1.336609 -2.57044 0.690234 -2.57381 0.678141 -2.56594 0.707953 -2.54681 0.779672 -0.0832 0.596406 0.0521 0.477344 0.16964 0.372719 0.26948 0.282531 6.34887 1.289844 6.06838 2.370406 4.78175 2.759281 2.489 2.456469 -2.5453 0.288109 -4.28407 0.249016 -4.50065 0.184703 -3.19498 0.09517 0.0866 1.349656 -0.0361 1.344594 -0.11856 1.341969 -0.16094 1.341781 -1.93769 -1.049156 -1.84431 -1.221844 -1.87956 -1.145344 -2.04344 -0.819656 -0.57402 -0.146891 -0.60635 -0.143234 -0.61668 -0.132172 -0.60495 -0.113703 0.0399 0.209203 0.0624 0.479672 -0.001 0.528234 -0.15025 0.354891 -0.59327 0.211344 -0.75835 0.01541 -0.6783 -0.122969 -0.35308 -0.203781 -0.0542 -0.391719 0.023 -0.569281 0.0504 -0.513031 0.0279 -0.222969 -1.4587 0.03803 -1.47417 0.197219 -1.42074 0.388844 -1.29839 0.612906 1.65188 1.746313 2.17837 1.052187 2.5035 0.501687 2.62725 0.09481 0.075 -0.300297 0.0159 -0.669578 0.007 -0.700891 0.0497 -0.394234 0.3655 -0.1305 0.706 -0.1035 0.7285 -0.02925 0.433 0.09225 0.19931 0.410031 0.21019 0.682469 0.18844 0.637469 0.13406 0.275031 0.41902 -0.0507 0.40861 -0.05267 0.39679 -0.05398 0.38358 -0.05464 2.72111 2.172094 2.64527 2.465906 2.62407 2.493656 2.65755 2.255344 -5.67462 0.428 -7.17313 -0.81775 -7.031 -1.625125 -5.24825 -1.994125 -0.234 1.285`108.37036 31.889481 2.5835 0.49075 6.16325 1.38325 7.36213 2.14225 6.18012 2.76775 -3.64353 0.345281 -3.68572 0.03047 -3.68759 -0.181406 -3.64916 -0.290344 1.101 -0.726422 1.2015 -0.795703 0.96675 -0.641391 0.39675 -0.263484 -2.38542 0.310688 -2.35946 0.488062 -2.29551 0.719438 -2.19361 1.004812 1.27025 0.951687 2.501 0.724063 2.61088 0.492688 1.59987 0.257562 0.1183 0.795 0.11857 0.79425 0.0929 0.796875 0.0412 0.802875 -4.03927 -2.126375 -4.4301 -1.520375 -4.82518 -0.26825 -5.22445 1.63 2.40811 3.967422 3.46326 2.010203 4.12383 0.330391 4.3898 -1.072016 1.88694 1.560641 1.78456 1.682234 1.72456 1.750297 1.70694 1.764828 -6.57309 -0.867906 -6.08166 -1.357844 -5.84503 -2.136719 -5.863223 -3.204531 0.878969 -2.4065 0.293031 -2.55125 -0.188469 -2.583125 -0.565531 -2.502125 1.578 -0.81 2.316553 3.082594 3.29332 0.452906 1.94944 -0.591757 0.70846 -1.234587 0.63912 -1.770922 -0.22889 -1.984234 -0.418 -1.38 0.73 -0.262`82.668197 43.80432 3.316922 -1.445766 3.227953 -1.643109 3.215766 -1.669172 3.280359 -1.523953 0.397484 2.241484 -0.140359 2.398891 -0.546672 2.363453 -0.821453 2.135172 -3.296781 4.241578 -4.581719 3.908297 -4.262219 3.926859 -2.338281 4.297266 0.116031 -2.761859 0.470219 -2.228516 1.129094 -1.875078 2.092656 -1.701547 2.533344 -2.306766 2.106406 -3.200109 1.503031 -3.564422 0.723219 -3.399703 -0.526266 -0.290344 -0.371109 0.540844 -0.247172 0.843844 -0.154453 0.618656 -2.077609 3.804625 -4.339516 4.816375 -6.560453 3.766375 -8.740422 0.654625 -1.683687 -0.123828 -1.672063 0.168203 -1.618437 0.455266 -1.522813 0.737359 3.178859 -2.926578 3.298016 -1.280047 3.493578 -0.545234 3.765547 -0.722141 2.286734 -1.168187 2.273891 -1.972563 1.942578 -2.341938 1.292797 -2.276312 -0.143 -0.952`80.909197 44.61432 -1.588016 2.353219 -2.031359 2.014031 -2.344672 1.603406 -2.527953 1.121344 -7.163406 -0.450547 -5.109344 -2.766828 -4.147469 -3.216641 -4.277781 -1.799984 3.580453 -0.354531 2.077172 0.714031 1.475859 1.141531 1.776516 0.927969 2.115109 0.561937 2.276266 0.187313 2.285078 -0.187313 2.141547 -0.561937 0.806734 0.694 0.706891 0.823 0.750578 0.778 0.937797 0.559 1.989109 -1.229781 2.054266 -1.073219 2.097578 -0.956969 2.119047 -0.881031`33.388717 84.83432 -0.707188 3.111797 0.719688 3.335578 1.687938 3.051141 2.197562 2.258484 -0.927998 1.283 -2.289937 2.83141 -2.820563 2.71234 -3.154312 2.22522 -3.291188 1.37003 -2.626359 0.48741 -3.125766 0.25359 -3.092203 -0.15291 -2.525672 -0.73209 -1.113141 -0.82584 -0.05273 -0.68691 0.332953 -0.78703 0.04392 -1.12622 -0.797141 -1.10544 -1.146734 -0.44506 -0.812797 -0.49081 0.204672 -1.24269 0.7429844 -0.649438 1.104391 -0.463062 1.178453 -0.620563 0.965172 -1.121937 0.0385 -1.591984 -0.713 -1.578391 -0.31775 -1.421453 1.22425 -1.121172 0.535172 -0.19725 0.492703 -0.18975 0.477516 -0.234 0.489609 -0.33 0.464563 -1.217844 0.05994 -1.619656 0.354688 -1.081156 1.348812 0.397656 0.796813 0.999437 0.820437 1.584813 0.847063 1.696937 0.876687 1.335813 1.345063 1.415281 1.421937 1.311219 1.511938 1.197219 1.615062 1.073281 1.398547 0.590453 1.391328 0.199422 1.423391 0.0065 1.494731 0.01163 qq=LDText.Split(q "`") GraphicsWindow.Title="BlairWitch bb=LDShapes.BrushGradient("1=orange;2=brown;3=darkred;4=black" "DD") b1=LDShapes.BrushGradient("2=brown;1=tan;3=black;4=black" "H") ldGraphicsWindow.BackgroundBrush(bb) 'GraphicsWindow.BackgroundColor="tan zz=.1 mww() For f=1 To 5 q=LDText.Split(qq[f] " ") i=0 pp="" pp1="" p0=q[1]*2 p1=q[2]*2 For r=3 To Array.GetItemCount(q) Step 2 If q[r]="r" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 ElseIf q[r]="a" Then p0=q[r+1]*2 p1=q[r+2]*2 r=r+1 i=i+1 pp[i][1]=p0 pp[i][2]=p1 Else i=i+1 pp[i][1]=p0+q[r]*2 pp[i][2]=p1+q[r+1]*2 p0=pp[i][1] p1=pp[i][2] EndIf EndFor GraphicsWindow.PenWidth=0 If f=5 Then GraphicsWindow.BrushColor="#99cc6611 ElseIf f>2 Then GraphicsWindow.BrushColor="gold Else GraphicsWindow.BrushColor="lime EndIf pq=LDShapes.AddPolygon(pp) If f=1 Then LDShapes.BrushShape(pq b1) EndIf ' GraphicsWindow.Title=f If f>1 Then 'Shapes.Move(pq Shapes.GetLeft(pq)-8 Shapes.GetTop(pq)-142) ElseIf f=1 Then LDEffect.DropShadow(pq "shadowdepth=3;direction=270") EndIf LDShapes.ZIndex(pq f) 'Program.Delay(12) EndFor 'GraphicsWindow.MouseDown=mmm LDEvents.MouseWheel=mww zz=1 GraphicsWindow.Height=555 GraphicsWindow.BrushColor="white e=Shapes.AddEllipse(18 11) LDShapes.Centre(e 207 71) LDShapes.ZIndex(e 55) GraphicsWindow.BrushColor="black e=Shapes.AddEllipse(3 11) LDShapes.Centre(e 207 71) LDShapes.ZIndex(e 55) for zz=.1 to 2 step .05 LDGraphicsWindow.Reposition(zz zz 170 250 0) Program.Delay(55) EndFor for zz=2 to 1.3 step -.04 LDGraphicsWindow.Reposition(zz zz 170 250 0) Program.Delay(33) EndFor Sub mmm GraphicsWindow.Title=GraphicsWindow.MouseX+";"+GraphicsWindow.MouseY EndSub Sub mww zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz 170 250 0) ' GraphicsWindow.Title=zz EndSub End>RJV536-3.sb< Start>RKC982.sb< ss=44 Init() z1=8 For dt=1 to z1 For x=1 to z1 gm[x][dt]=0 z=1 ldcall.Function5("DrawCube",x dt z 0 "teal") endfor LDFastShapes.Update () endfor gm[4][4]=1 gm[4][5]=2 gm[5][4]=2 gm[5][5]=1 ccl[1]="Orange ccl[2]="Brown spl=1 chfrr() bset() sccd() LDShapes.ShapeEvent =see LDEvents.MouseWheel =rot Sub sccd '-------------------------------------------scoreboad design GraphicsWindow.PenWidth =3 GraphicsWindow.PenColor="teal For f=1 to 2 pl[f]=Shapes.AddEllipse (40 25) Shapes.Move (pl[f],5,f*45+5) LDShapes.BrushColour (pl[f] ccl[f]) scc[f]=shapes.AddText (2) Shapes.Move (scc[f],50,f*45+5) LDShapes.penColour (scc[f] "cyan") endfor GraphicsWindow.PenWidth =0 LDShapes.PenColour (pl[spl] "yellow") EndSub Sub chkmv'------------------------------------------validate move valid="false If gm[px][py]>0 Then 'nil else LDCall.Function2 ("cdir" 0 1) LDCall.Function2 ("cdir" 0, -1) LDCall.Function2 ("cdir" 1 0) LDCall.Function2 ("cdir", -1 0) LDCall.Function2 ("cdir" 1 1) LDCall.Function2 ("cdir", -1, -1) LDCall.Function2 ("cdir" 1, -1) LDCall.Function2 ("cdir", -1 1) endif EndSub Sub cdir'-----------------------------------------------check direction If cmod Then ipx=fx ipy=fy Else ipx=px ipy=py EndIf dx=args[1] dy=args[2] cpx=ipx+dx cpy=ipy+dy If gm[cpx][cpy]=0 Then goto sxx'--------exit sub EndIf ww=0 For f=1 To 7 If gm[cpx][cpy]=3-spl Then ww=ww+1 cpx=cpx+dx cpy=cpy+dy Else Goto xf'--------exit for EndIf EndFor xf: If ww>0 then if gm[cpx][cpy]=spl Then valid="true cpx=ipx cpy=ipy If cmod then ff[fx][fy]=2 else For x=1 To ww cpx=cpx+dx cpy=cpy+dy gm[cpx][cpy]=spl endfor endif endif EndIf sxx: EndSub Sub chfrr cmod="true For fx=1 To z1 For fy=1 To z1 ff[fx][fy]=0 If gm[fx][fy]=0 Then LDCall.Function2 ("cdir" 0 1) LDCall.Function2 ("cdir" 0, -1) LDCall.Function2 ("cdir" 1 0) LDCall.Function2 ("cdir", -1 0) LDCall.Function2 ("cdir" 1 1) LDCall.Function2 ("cdir", -1, -1) LDCall.Function2 ("cdir" 1, -1) LDCall.Function2 ("cdir", -1 1) EndIf EndFor EndFor cmod="false EndSub Sub see'--------------------------------------------shape events if LDShapes.LastEventType="MouseDown" Then ls=LDShapes.LastEventShape lt=text.GetSubTextToEnd(ls,8)/3 py=Math.Remainder (lt-1,8)+1 px=math.Floor ((lt-1)/8)+1 chkmv() If valid Then GraphicsWindow.Title="Ok" gm[px][py]=spl bset() LDShapes.PenColour (pl[spl] "teal") spl=3-spl LDShapes.PenColour (pl[spl] "yellow") cntsc() chfrr() Else GraphicsWindow.Title="Wrong!!!" endif ' GraphicsWindow.Title= px+":"+py endif EndSub Sub cntsc '-------------------------------------score management cs1=0 cs2=0 For ly=1 To z1 For lx=1 To z1 If gm[ly][lx]=1 Then cs1=cs1+1 elseIf gm[ly][lx]=2 Then cs2=cs2+1 EndIf EndFor EndFor Shapes.SetText (scc[1] cs1) Shapes.SetText (scc[2] cs2) EndSub Sub rot '----------------------------------------wheel zoom ang=ang+ LDEvents.LastMouseWheelDelta/50 If ang<.75 Then ang=.75 ElseIf ang>1.3 then ang=1.3 EndIf for w=1 to 8 for wi=1 to 8 For f=1 To 3 ldfastShapes.zoom (po[w][wi][f],ang ang) endfor endfor endfor LDFastShapes.Update () EndSub Sub bset'--------------------------------------update board ll=1 For ly=1 To z1 For lx=1 To z1 If gm[ly][lx]>0 Then lw=100 si=(lx+(ly-1)*8)*3 sn="Polygon"+si LDShapes.BrushColour (sn ccl[gm[ly][lx]]) ' ElseIf ff[ly][lx]=2 then 'lw=77 Else lw=44 EndIf ldfastShapes.SetOpacity (po[lx][ly][1] lw) ldfastShapes.SetOpacity (po[lx][ly][2] lw) ldfastShapes.SetOpacity (po[lx][ly][3] lw) EndFor EndFor LDFastShapes.Update () EndSub '--------------------------=========cube draw section=============------------------------------- Sub Conv3Dto2D cx = gw / 2 - args[1]*ms1 cx = cx + ms1 * args[2] cy = gh / 2 + ms6 * args[1] cy = cy + ms6 * args[2] cy = cy - ms3 * args[3] EndSub Sub DrawCube lz=args[3] xx=args[1] yy=args[2] Conv3Dto2D() x1 = math.Round (cx) y1 = math.Round (cy) sColor = args[5] For i=1 To 3 color[i] = LDColours.HSLtoRGB(ccc 1 .8/Math.Power(1.5 i)) EndFor GraphicsWindow.PenWidth =0 i=1 For a = 0 To 300 Step 60 xxx[i] = math.Round (cx - mSin[a]) yyy[i] = math.Round (cy - mCos[a]) i=i+1 endfor ppp=0 For f=1 To 6 ppp[f][1]=xxx[f] ppp[f][2]=yyy[f] endfor sargs=args LDCall.Function("Padd",1) ppp=0 For f=2 To 4 ppp[f-1][1]=xxx[f] ppp[f-1][2]=yyy[f] EndFor ppp[4][1]=cx ppp[4][2]=cy LDCall.Function("Padd",2) ppp=0 For f=1 To 2 ppp[f][1]=xxx[f] ppp[f][2]=yyy[f] EndFor ppp[3][1]=cx ppp[3][2]=cy ppp[4][1]=xxx[6] ppp[4][2]=yyy[6] LDCall.Function("Padd",3) EndSub Sub padd p2=args[1] sss=LDShapes.AddPolygon (ppp) po[xx][yy][p2]= LDFastShapes.ShapeIndex (sss) If lz=1 And p2=3 Then ldShapes.SetShapeEvent (sss) endif If lz=2 Then sm[xx][yy][p2]=sss EndIf LDShapes.BrushColour(sss,color[p2]) if sargs[3]>1 then ldfastShapes.SetOpacity (po[xx][yy][p2] 0) Else ldfastShapes.SetOpacity (po[xx][yy][p2] 100) endif EndSub Sub Init'---------------------------------------initialization args=0 GraphicsWindow.Title = "IsoReversi GraphicsWindow.PenWidth=0 bl=0 rx=1 LDUtilities.ShowNoShapeErrors ="false edge = Math.SquareRoot(2 / 3) * (ss-3) ms1=Math.SquareRoot(1 / 2)*ss ms6=Math.SquareRoot(1 / 6)*ss ms3=Math.SquareRoot(2 / 3)*ss c160=211 ccc=c160 gw = 1000 gh = 800 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "teal For a = 0 To 300 Step 60 mSin[a]=edge * ldmath.Sin(a) mcos[a]=edge * ldmath.cos(a) EndFor EndSub End>RKC982.sb< Start>RKD110.sb< 'Copyright(c)All Rights Reserved. 'Made by ProfessionalOfSmallBasic[POSB] 'Made date :02.04.2014 19.42 'Thanks For Playing 'Special Thanks For "Jibba Jabba" Background() Initialise() While "True" UpdateGame() UpdateFrame() FrameRate() WrongWay() EndWhile Sub UpdateGame 'update game on keyDown 'player motion If key["a"] Then velOneX = -2 ElseIf key["d"] Then velOneX = 2 EndIf If key["Left"] Then velTwoX = -2 ElseIf key["Right"] Then velTwoX = 2 EndIf If key["w"] Then honeY = -2 ElseIf key["s"] Then honeY = 2 EndIf If key["Up"] Then htwoY = -2 ElseIf key["Down"] Then htwoY = 2 EndIf key = "" playerOneX = playerOneX + velOneX playerTwoX = playerTwoX + velTwoX playerOneY = playerOneY + honeY playerTwoY = playerTwoY + htwoY EndSub Sub UpdateFrame Shapes.Move(playerOne, playerOneX, playerOneY) Shapes.Move(playerTwo, playerTwoX, playerTwoY) EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then Program.Delay(delay) EndIf start = Clock.ElapsedMilliseconds EndSub Sub Initialise fps = 50 GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="black" GraphicsWindow.Width=600 GraphicsWindow.Height=400 GraphicsWindow.CanResize="False" GraphicsWindow.Left = GraphicsWindow.Width -50 GraphicsWindow.BrushColor="Red" playerOne = Shapes.AddEllipse(20, 20) GraphicsWindow.BrushColor="Blue" playerTwo = Shapes.AddEllipse(20, 20) Shapes.Move(playerTwo, GraphicsWindow.Width - 20, 0) playerTwoX = Shapes.GetLeft(playerTwo) GraphicsWindow.KeyDown = OnKeyDown EndSub Sub OnKeyDown lastKey = Text.ConvertToLowerCase(GraphicsWindow.LastKey) key[lastKey] = "True" EndSub Sub Background GraphicsWindow.BackgroundColor="gray" GraphicsWindow.BrushColor="Darkgray" GraphicsWindow.FillRectangle(130,142,365,150) GraphicsWindow.PenWidth=150 GraphicsWindow.PenColor="Gold" GraphicsWindow.DrawLine(56,115,-25,300) GraphicsWindow.DrawLine(565,115,GraphicsWindow.Width+20,300) GraphicsWindow.PenWidth=1 GraphicsWindow.BrushColor="gold" GraphicsWindow.FillTriangle(127,140,128,295,25,345) GraphicsWindow.FillTriangle(497,140,495,295,585,345) GraphicsWindow.FillTriangle(0,280,50,330,0,350) GraphicsWindow.FillTriangle(575,330,625,280,625,350) pic=ImageList.LoadImage("http://fc05.deviantart.net/fs70/i/2012/047/a/6/room_window_frame_by_mysticmorning-d4pxwms.png") GraphicsWindow.DrawResizedImage(pic,0,0,GraphicsWindow.Width,GraphicsWindow.Height) EndSub Sub WrongWay gw=GraphicsWindow.Width gh=GraphicsWindow.Height If playerOneX=-2 Then playerOneX = playerOneX + 2 EndIf If playerTwoX=-2 Then playerTwoX = playerTwoX + 2 EndIf If playerOneY=-2 Then playerOneY = playerOneY + 2 EndIf If playerTwoY=-2 Then playerTwoY = playerTwoY + 2 EndIf If playerOneX=gw-18 Then playerOneX = playerOneX - 2 EndIf If playerTwoX=gw-18 Then playerTwoX = playerTwoX - 2 EndIf If playerOneY=gh-18 Then playerOneY = playerOneY - 2 EndIf If playerTwoY=gh-18 Then playerTwoY = playerTwoY - 2 EndIf EndSub End>RKD110.sb< Start>RKD135.sb< ' June Challenge 2016, keyboard on screen ' yled program no; 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 space=0 For t=1 To 10 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+space,20) Shapes.SetOpacity(carre[t],30) space=space+60 EndFor space=0 For t=1 To 10 GraphicsWindow.DrawText(40+space,32,touche[t]) space=space+60 EndFor ' RANGÉ #2 DE LETTRES space=0 For t=11 To 21 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],40+space,80) Shapes.SetOpacity(carre[t],30) space=space+60 EndFor space=0 For t = 11 To 21 If t = 20 Then GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(50+space,100,"é") GraphicsWindow.BrushColor="white" endif If T= 21 Then GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="YELLOW" Else GraphicsWindow.FontSize=22 EndIf GraphicsWindow.DrawText(60+space,90,touche[t]) space=space+60 EndFor ' RANGÉ #3 DE LETTRES space=0 For t=22 To 32 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+space,140) Shapes.SetOpacity(carre[t],30) space=space+60 EndFor space=0 For t=22 To 32 If t= 32 Then GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="magenta" Else GraphicsWindow.FontSize=22 EndIf GraphicsWindow.DrawText(40+space,150,touche[t]) space=space+60 EndFor ' RANGÉ #4 DE LETTRES space=0 For t=33 To 34 GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],20+space,200) Shapes.SetOpacity(carre[t],30) space=space+60 EndFor space=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+space,210,touche[t]) space=space+60 EndFor ' space bar GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(350,sz) Shapes.Move(carre[t],140,200) Shapes.SetOpacity(carre[t],30) ' mail GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],500,200) Shapes.SetOpacity(carre[t],30) GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawText(510,210,touche[36]) ' ctrl GraphicsWindow.BrushColor="white" carre[t]=Shapes.AddRectangle(sz,sz) Shapes.Move(carre[t],560,200) Shapes.SetOpacity(carre[t],30) GraphicsWindow.FontSize=18 GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(570,210,touche[37]) Sub defin touche[1]="Q" touche[2]="W" touche[3]="E" touche[4]="R" touche[5]="T" touche[6]="Y" touche[7]="U" touche[8]="I" touche[9]="O" touche[10]="P" touche[11]="A" touche[12]="S" touche[13]="D" touche[14]="F" touche[15]="G" touche[16]="H" touche[17]="J" touche[18]="K" touche[19]="L" ' à 32 commence les codes de caracteres commencant par ! xx=Text.GetCharacter(34) touche[20]=xx touche[21]="⏎" touche[22]="Z" touche[23]="X" touche[24]="C" touche[25]="V" touche[26]="B" touche[27]="N" touche[28]="M" touche[29]=";" touche[30]=":" touche[31]="!" touche[32]="⇧" touche[33]="℮" touche[34]="alt" touche[35]=" " touche[36]="✉" touche[37]="Ctrl" endsub End>RKD135.sb< Start>RKD630.sb< 'inputfile= " .\result\filesplitter-10-OK.sb" inputfile= " D:\Data\Small-Basic\GPXCleaner-165\Route-WP-TR-RT.gpx" progdir=Program.directory textwindow.writeline("Program Director = "+progdir) 'inputfile= "D:\Data\GPS - COURS - TOUT\Cours GPS TOUS\20141025-Mozet\Mozet.gpx TestInputFile() 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub TestInputFile begin=0 Arnr=0 i=1 While text.GetSubText(inputfile,i,1)= " " begin=begin+1 i=i+1 Endwhile newbegin=0 NewInputFile=Text.GetSubTextToEnd(inputfile,begin+1) 'TextWindow.WriteLine("begin= "+begin) TextWindow.WriteLine("InputFile = "+ NewInputFile) length=text.getlength(Newinputfile) For i=1 To length char=text.GetSubText(newinputfile,i,1) 'TextWindow.WriteLine("character= "+char) If char="\" Then 'TextWindow.WriteLine("slash at "+i) Arnr=Arnr+1 Mydir[Arnr]["slash"]=i 'TextWindow.WriteLine("Slash at Mydir "+Arnr+" = "+Mydir[Arnr]["slash"]) Endif Endfor 'TextWindow.WriteLine("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx") 'TextWindow.WriteLine("") For i=1 To Arnr If Mydir[i]["slash"]>0 Then TextWindow.WriteLine("") TextWindow.WriteLine("Directory = "+text.getsubtext(newinputfile,1,Mydir[i]["slash"]-1)) slashbegin=Mydir[i-1]["slash"]+1 slashend=Mydir[i]["slash"] 'TextWindow.WriteLine("i = "+i + " slashbegin = "+ slashbegin+" slashend = "+ slashend ) Shortdirectory=text.getsubtext(newinputfile,slashbegin,slashend-slashbegin) TextWindow.WriteLine("Directory short = "+shortdirectory) Mydir[i]["shortdirectory"]= shortdirectory Mydir[i]["directory"]=text.getsubtext(newinputfile,1,Mydir[i]["slash"]-1) listMydir=file.GetFiles(Mydir[i]["directory"]) 'TextWindow.WriteLine("Directory = "+listMydir) If listMydir = "FAILED" then TextWindow.Foregroundcolor="Red" TextWindow.WriteLine("Directory : "+text.getsubtext(newinputfile,1,Mydir[i]["slash"]-1) +" FAILED !!! ") TextWindow.Foregroundcolor="white" Else TextWindow.Foregroundcolor="yellow" ' "Directory = "+text.getsubtext(newinputfile,1,Mydir[i]["slash"]-1) TextWindow.WriteLine("Directory : "+text.getsubtext(newinputfile,1,Mydir[i]["slash"]-1) +" is OK !!! ") TextWindow.Foregroundcolor="white" Endif Endif Endfor 'For i=1 To Arnr ' TextWindow.WriteLine("i= "+i+" Directory short = "+ Mydir[i]["shortdirectory"]) ' endfor MyFile = text.getsubtext(newinputfile,Mydir[arnr]["slash"]+1,length) TextWindow.WriteLine("") 'TextWindow.WriteLine("File = "+MyFile) TextWindow.WriteLine("Short File = "+MyFile) TextWindow.WriteLine("File = "+NewInputFile) Mydir[i]["directory"]=MyFile TestIfFileExist() TextWindow.WriteLine("") TextWindow.WriteLine("Directories are : ") For i=1 To Arnr TextWindow.WriteLine("i= "+i+" Directory short = "+ Mydir[i]["shortdirectory"]) endfor TextWindow.Foregroundcolor="Red" TextWindow.WriteLine("") Endsub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx SUB TestIfFileExist Searchdir=text.ConvertToUpperCase(listMydir) Searchfile=text.ConvertToUpperCase(Myfile) If text.IsSubText(SearchDir,SearchFile) Then 'Verification if the configfile exist Filetestflag="True" TextWindow.Foregroundcolor="Yellow" TextWindow.WriteLine("File = "+MyFile+" File EXIST !!!") Else Filetestflag="False" TextWindow.Foregroundcolor="Red" TextWindow.WriteLine("File = "+MyFile+" FAILED FILE DOESN'T EXIST !!!" ) Endif TextWindow.Foregroundcolor="white" TextWindow.WriteLine("") EndSub End>RKD630.sb< Start>RKD642.sb< 'Initialisation Window gw = 600 gh = 400 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 'Initialise Key events GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp keyLeft = 0 keyRight = 0 keyUp = 0 keyDown = 0 'Initialise ball spr_pacman = ImageList.LoadImage(Program.Directory + "\Graphics\Pacman_mouth_open.png") obj_pacman = Shapes.AddImage(spr_pacman) obj_pacmanX = 100 obj_pacmanY = 100 obj_pacman_width = ImageList.GetWidthOfImage(spr_pacman) obj_pacman_height = ImageList.GetHeightOfImage(spr_pacman) speed = 4 Shapes.Move(obj_pacman,obj_pacmanX-25,obj_pacmanY-25) 'Initialise wall spr_wall = ImageList.LoadImage(Program.Directory + "\Graphics\Wall.png") obj_wall = Shapes.AddImage(spr_wall) obj_wall_x = 100 obj_wall_y = 100 obj_wall_width = ImageList.GetWidthOfImage(spr_wall) obj_wall_height = ImageList.GetHeightOfImage(spr_wall) Shapes.Move(obj_wall, obj_wall_x, obj_wall_y) 'Main loop - just move the ball While ("True") processKey() Shapes.Move(obj_pacman,obj_pacmanX-25,obj_pacmanY-25) 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 = "Left") Then keyLeft = 1 ElseIf (lastKey = "Right") Then keyRight = 1 ElseIf (lastKey = "Up") Then keyUp = 1 ElseIf (lastKey = "Down") Then keyDown = 1 EndIf EndSub Sub OnKeyUp lastKey = GraphicsWindow.LastKey If (lastKey = "Left") Then keyLeft = 0 ElseIf (lastKey = "Right") Then keyRight = 0 ElseIf (lastKey = "Up") Then keyUp = 0 ElseIf (lastKey = "Down") Then keyDown = 0 EndIf EndSub Sub processKey 'Move object - note it can move diagonally if 2 keys are pressed If ((keyLeft = 1)) Then obj_pacmanX = obj_pacmanX - speed Shapes.Rotate(obj_pacman,180) EndIf 'We are currently checking only for 1 pixel not the whole height of the wall fix that 'Use a increasing loop to check for every pixel clock wise... which is to the right of our direction If ((keyRight = 1) and (( (obj_pacmanX + speed) < (obj_wall_x) ) or ((obj_pacmanY < obj_wall_y) or (obj_pacmanY > obj_wall_y + obj_wall_height ))) ) Then obj_pacmanX = obj_pacmanX + speed Shapes.Rotate(obj_pacman,0) EndIf If ((keyUp = 1)) Then obj_pacmanY = obj_pacmanY - speed Shapes.Rotate(obj_pacman,270) EndIf If ((keyDown = 1)) Then obj_pacmanY = obj_pacmanY + speed Shapes.Rotate(obj_pacman,90) EndIf EndSub 'Getting the left side of the bounding box Sub LeftBounding 'Getting the name of the image used for checking sprite_checked = 0 'Getting the coordinates of the sprite sprite_x = 0 sprite_y = 0 'Getting the height for pixel amount to be checked in the loop pixels_checked = 0 'Checking from the Y coordinate till the bottom of image ( y + height ) While() then 'nothing yet 'nothing yet EndWhile EndSub End>RKD642.sb< Start>RKD861.sb< '2014.10.1 开始制作 '更新步骤: GraphicsWindow.Width=700 GraphicsWindow.Height=530 GraphicsWindow.Left=(Desktop.Width-GraphicsWindow.Width)/2-50 GraphicsWindow.Top=(Desktop.Height-GraphicsWindow.Height)/2-50 GraphicsWindow.Title="Island Craft" Controls.ButtonClicked=buttonclicked GraphicsWindow.KeyDown=keydown GraphicsWindow.MouseDown=mousedown screen=1 check=1 gameload=0 path="E:\编程\LOCK\LOCK2\lock\文件\Island Craft1" '默认打开方式 标准:E:\Island Craft1 , E:\编程\LOCK\LOCK2\lock\文件\Island Craft1 baginformation() typerinformation() drawscreen() worldwidth=100 worldlength=worldwidth Sub drawscreen If screen=1 Then GraphicsWindow.Clear() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=36 GraphicsWindow.DrawText(50,50,"Island Craft岛屿生存") GraphicsWindow.FontSize=25 GraphicsWindow.DrawText(50,165,"输入存档路径:") enterkeypath=Controls.AddTextBox(50,200) Controls.SetSize(enterkeypath,500,40) Controls.SetTextBoxText(enterkeypath,path) startplaygame=Controls.AddButton("PLAY",580,200) Controls.SetSize(startplaygame,80,40) ElseIf screen=2 Then GraphicsWindow.Clear() firstgameload=0 GraphicsWindow.DrawText(200,150,"第一次进入此存档需要加载") GraphicsWindow.DrawText(280,190,"请耐心等候") showfirstgameload=Shapes.AddText("已加载"+firstgameload+"%") Shapes.Move(showfirstgameload,270,230) mex=Math.Floor(worldwidth/2)+1 mey=Math.Floor(worldlength/2)+1 For i=1 To worldlength For j=1 To worldwidth If i=mex And j=mey Then thing[i][j]=120 ElseIf i=mex-1 And j=mey Then thing[i][j]=120 ElseIf i=mex-2 And j=mey Then thing[i][j]=120 Else thing[i][j]=Math.GetRandomNumber(120) EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,(i-1)*worldwidth+j+1,thing[i][j]) firstgameload=Math.Round((i*100+j)/worldlength-1)/2 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") EndFor EndFor For i=1 To allcheck ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+i,0) firstgameload=50+Math.Round(50/allcheck)*i-1 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") EndFor For i=1 To 6 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,0) EndFor ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+8+allcheck,1) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+9+allcheck,mex) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+10+allcheck,mey) For i=1 To 12 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+10+allcheck+i,0) EndFor ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+23+allcheck,10) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+24+allcheck,10) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+25+allcheck,0) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+26+allcheck,0) firstgameload=100 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") screen=4 drawscreen() ElseIf screen=3 Then GraphicsWindow.Clear() willgetthing=0 gameload=0 GraphicsWindow.PenWidth=4 GraphicsWindow.DrawLine(0,451,700,451) GraphicsWindow.DrawLine(451,0,451,451) GraphicsWindow.PenWidth=4 GraphicsWindow.FontSize=14 GraphicsWindow.BrushColor="Black" seesight=Shapes.AddRectangle(450,450) exchangerdaytime=daytime-300 If exchangerdaytime>0 Then exchangerdaytime=Math.Abs(exchangerdaytime-150)/150*90 Else exchangerdaytime=0 EndIf Shapes.SetOpacity(seesight,90-exchangerdaytime) For i=1 To 6 If holdeasybag=i Then GraphicsWindow.PenColor="Red" showholdeasybag1=Shapes.AddRectangle(2,40) showholdeasybag2=Shapes.AddRectangle(2,40) showholdeasybag3=Shapes.AddRectangle(60,2) showholdeasybag4=Shapes.AddRectangle(60,2) Shapes.Move(showholdeasybag1,19+(i-1)*70,486) Shapes.Move(showholdeasybag2,80+(i-1)*70,486) Shapes.Move(showholdeasybag3,20+(i-1)*70,485) Shapes.Move(showholdeasybag4,20+(i-1)*70,526) GraphicsWindow.PenColor="Black" EndIf GraphicsWindow.DrawRectangle(20+(i-1)*70,486,60,40) GraphicsWindow.DrawText(22+(i-1)*70,486,bagthing[easybag[i]]) GraphicsWindow.DrawText(22+(i-1)*70,506,"x"+bagnum[easybag[i]]) EndFor GraphicsWindow.PenWidth=2 GraphicsWindow.FontSize=22 GraphicsWindow.DrawText(10,456,"血量值:"+exchangerblood[blood]) GraphicsWindow.DrawText(300,456,"饥饿值:"+exchangerhung[hunger]) For i=mex-4 To mex+4 For j=mey-4 To mey+4 instead=thing[i][j] If instead<=18 Then '水 GraphicsWindow.BrushColor="CornFlowerBlue" GraphicsWindow.FillRectangle((i-mex+4)*50,(j-mey+4)*50,50,50) Else GraphicsWindow.BrushColor="ForestGreen" GraphicsWindow.FillRectangle((i-mex+4)*50,(j-mey+4)*50,50,50) EndIf If instead>18 And instead<=28 Then '树木 GraphicsWindow.BrushColor="DarkGreen" GraphicsWindow.FillRectangle((i-mex+4)*50+12.5,(j-mey+4)*50,25,50) GraphicsWindow.FillRectangle((i-mex+4)*50,(j-mey+4)*50+12.5,50,25) ElseIf instead>30 And instead<=35 Then '石头 GraphicsWindow.BrushColor="Gray" GraphicsWindow.FillRectangle((i-mex+4)*50+15,(j-mey+4)*50+15,20,20) ElseIf instead=30 Then '蘑菇 GraphicsWindow.BrushColor="Purple" GraphicsWindow.FillEllipse((i-mex+4)*50+19,(j-mey+4)*50+12,12,12) GraphicsWindow.FillRectangle((i-mex+4)*50+21.5,(j-mey+4)*50+22,7,10) ElseIf instead=29 Then '南瓜 GraphicsWindow.BrushColor="Gold" GraphicsWindow.FillRectangle((i-mex+4)*50+20,(j-mey+4)*50+15,10,8) GraphicsWindow.FillEllipse((i-mex+4)*50+15,(j-mey+4)*50+22,20,20) ElseIf instead=46 Then '猪 GraphicsWindow.BrushColor="PeachPuff" GraphicsWindow.FillRectangle((i-mex+4)*50+18,(j-mey+4)*50+10,14,20) GraphicsWindow.FillRectangle((i-mex+4)*50+21,(j-mey+4)*50+30,8,8) ElseIf instead=47 Then '牛 GraphicsWindow.BrushColor="Peru" GraphicsWindow.FillRectangle((i-mex+4)*50+18,(j-mey+4)*50+10,14,20) GraphicsWindow.FillRectangle((i-mex+4)*50+21,(j-mey+4)*50+30,8,8) EndIf If i=mex And j=mey Then '我 GraphicsWindow.BrushColor="SaddleBrown" GraphicsWindow.FillRectangle((i-mex+4)*50+20,(j-mey+4)*50+10,10,10) GraphicsWindow.BrushColor="Blue" GraphicsWindow.FillRectangle((i-mex+4)*50+20,(j-mey+4)*50+20,10,18) EndIf EndFor EndFor ElseIf screen=4 Then GraphicsWindow.Clear() GraphicsWindow.FontSize=25 GraphicsWindow.DrawText(240,150,"正在载入游戏......") GraphicsWindow.DrawText(280,190,"请耐心等候") showfirstgameload=Shapes.AddText("已加载"+firstgameload+"%") Shapes.Move(showfirstgameload,270,230) ' The following line could be harmful and has been automatically commented. ' mex=File.ReadLine(path,worldlength*worldwidth+9+allcheck) ' The following line could be harmful and has been automatically commented. ' mey=File.ReadLine(path,worldlength*worldwidth+10+allcheck) For i=1 To worldlength For j=1 To worldwidth ' The following line could be harmful and has been automatically commented. ' thing[i][j]=File.ReadLine(path,(i-1)*worldwidth+j+1) If thing[i][j]>=46 And thing[i][j]<=49 Then aniblood[i][j]=haveblood[thing[i][j]] EndIf firstgameload=Math.Round((i*100+j)/worldlength-1)/2 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") EndFor EndFor For i=1 To allcheck ' The following line could be harmful and has been automatically commented. ' bagnum[i]=File.ReadLine(path,worldlength*worldwidth+1+i) firstgameload=50+Math.Round(50/allcheck)*i-1 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") EndFor For i=1 To 12 ' The following line could be harmful and has been automatically commented. ' baglong[i+13]=File.ReadLine(path,worldlength*worldwidth+10+allcheck+i) EndFor For i=1 To 6 ' The following line could be harmful and has been automatically commented. ' easybag[i]=File.ReadLine(path,worldlength*worldwidth+1+allcheck+i) EndFor ' The following line could be harmful and has been automatically commented. ' holdeasybag=File.ReadLine(path,worldlength*worldwidth+8+allcheck) ' The following line could be harmful and has been automatically commented. ' blood=File.ReadLine(path,worldlength*worldwidth+23+allcheck) ' The following line could be harmful and has been automatically commented. ' hunger=File.ReadLine(path,worldlength*worldwidth+24+allcheck) ' The following line could be harmful and has been automatically commented. ' nofood=File.ReadLine(path,worldlength*worldwidth+25+allcheck) ' The following line could be harmful and has been automatically commented. ' daytime=File.ReadLine(path,worldlength*worldwidth+26+allcheck) firstgameload=100 Shapes.SetText(showfirstgameload,"已加载"+firstgameload+"%") screen=3 Timer.Tick=timecounter Timer.Interval=1000 drawscreen() ElseIf screen=5 Then GraphicsWindow.Clear() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 GraphicsWindow.DrawRectangle(20,20,660,490) GraphicsWindow.DrawText(30,30,"背包物品:"+bagthing[check]) GraphicsWindow.DrawText(30,60,"物品编号:"+check) GraphicsWindow.DrawText(30,90,"物品数量:"+bagnum[check]) GraphicsWindow.DrawText(30,130,"放入快捷包:") GraphicsWindow.FontSize=22 For i=1 To 6 putinto[i]=Controls.AddButton(i+"号",30+(i-1)*85,160) Controls.SetSize(putinto[i],80,35) EndFor GraphicsWindow.DrawText(30,220,"制作材料1:"+bagthing[bagmake1[check]]+" X"+bagmake1num[check]+" , 拥有"+bagnum[bagmake1[check]]) GraphicsWindow.DrawText(30,250,"制作材料2:"+bagthing[bagmake2[check]]+" X"+bagmake2num[check]+" , 拥有"+bagnum[bagmake2[check]]) GraphicsWindow.DrawText(30,280,"制作材料3:"+bagthing[bagmake3[check]]+" X"+bagmake3num[check]+" , 拥有"+bagnum[bagmake3[check]]) GraphicsWindow.DrawText(30,320,"制作后可得到:"+bagthing[check]+" X"+bagmakeget[check]) makething=Controls.AddButton("制作1个",30,350) If check>=14 And check<=25 Then GraphicsWindow.DrawText(30,400,"剩余耐久度:"+baglong[check]) EndIf findinbagwri=Controls.AddTextBox(380,28) Controls.SetSize(findinbagwri,180,40) findinbagbut=Controls.AddButton("查找",570,28) Controls.SetSize(findinbagbut,80,40) If bagblood[check]>0 Or baghunger[check]>0 Then bageat=Controls.AddButton("食用1个",30,400) EndIf EndIf EndSub Sub buttonclicked If screen=1 And Controls.LastClickedButton=startplaygame Then path=Controls.GetTextBoxText(enterkeypath) ' The following line could be harmful and has been automatically commented. ' If File.ReadLine(path,1)="" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,1,1) screen=2 drawscreen() Else screen=4 drawscreen() EndIf ElseIf screen=5 Then If bagnum[check]>0 Then For i=1 To 6 If Controls.LastClickedButton=putinto[i] Then For j=1 To 6 If i<>j And easybag[j]=check Then easybag[j]=0 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,check) EndIf EndFor easybag[i]=check ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,check) EndIf EndFor EndIf If Controls.LastClickedButton=makething Then If bagnum[bagmake1[check]]>=bagmake1num[check] And bagnum[bagmake2[check]]>=bagmake2num[check] Then If bagnum[bagmake3[check]]>=bagmake3num[check] Then bagnum[bagmake1[check]]=bagnum[bagmake1[check]]-bagmake1num[check] bagnum[bagmake2[check]]=bagnum[bagmake2[check]]-bagmake2num[check] bagnum[bagmake3[check]]=bagnum[bagmake3[check]]-bagmake3num[check] bagnum[check]=bagnum[check]+bagmakeget[check] If bagnum[bagmake1[check]]=0 Then For i=1 To 6 If easybag[i]=bagmake1[check] Then easybag[i]=0 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,0) EndIf EndFor EndIf If bagnum[bagmake2[check]]=0 Then For i=1 To 6 If easybag[i]=bagmake2[check] Then easybag[i]=0 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,0) EndIf EndFor EndIf If bagnum[bagmake3[check]]=0 Then For i=1 To 6 If easybag[i]=bagmake3[check] Then easybag[i]=0 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+allcheck+i,0) EndIf EndFor EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+bagmake1[check],bagnum[bagmake1[check]]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+bagmake2[check],bagnum[bagmake2[check]]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+bagmake3[check],bagnum[bagmake3[check]]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+check,bagnum[check]) If check>=14 And check<=25 And bagnum[check]=1 Then baglong[check]=baghavelong[check] ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+10+allcheck+easybag[holdeasybag],baglong[easybag[holdeasybag]]) EndIf EndIf EndIf drawscreen() ElseIf Controls.LastClickedButton=findinbagbut Then findinbagname=Controls.GetTextBoxText(findinbagwri) For i=1 To allcheck If findinbagname=bagthing[i] Or i=findinbagname Then check=i EndIf EndFor drawscreen() ElseIf Controls.LastClickedButton=bageat Then bagnum[check]=bagnum[check]-1 blood=blood+bagblood[check] hunger=hunger+baghunger[check] If blood>10 Then blood=10 EndIf If hunger>10 Then hunger=10 EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+24+allcheck,hunger) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+check,bagnum[check]) drawscreen() EndIf EndIf EndSub Sub keydown If GraphicsWindow.LastKey="Escape" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+26+allcheck,daytime) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+25+allcheck,nofood) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+23+allcheck,blood) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+9+allcheck,mex) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+10+allcheck,mey) Program.End() EndIf If screen=3 Then If GraphicsWindow.LastKey="W" Or GraphicsWindow.LastKey="Up" Then If mey>1 And thing[mex][mey-1]>29 And thing[mex][mey-1]<=45 Then mey=mey-1 drawscreen() EndIf If mey>1 And thing[mex][mey-1]>47 Then mey=mey-1 drawscreen() EndIf ElseIf GraphicsWindow.LastKey="A" Or GraphicsWindow.LastKey="Left" Then If mex>1 And thing[mex-1][mey]>29 And thing[mex-1][mey]<=45 Then mex=mex-1 drawscreen() EndIf If mex>1 And thing[mex-1][mey]>47 Then mex=mex-1 drawscreen() EndIf ElseIf GraphicsWindow.LastKey="S" Or GraphicsWindow.LastKey="Down" Then If mey29 And thing[mex][mey+1]<=45 Then mey=mey+1 drawscreen() EndIf If mey47 Then mey=mey+1 drawscreen() EndIf ElseIf GraphicsWindow.LastKey="D" Or GraphicsWindow.LastKey="Right" Then If mex29 And thing[mex+1][mey]<=45 Then mex=mex+1 drawscreen() EndIf If mex47 Then mex=mex+1 drawscreen() EndIf ElseIf GraphicsWindow.LastKey="E" Then screen=5 drawscreen() EndIf For i=1 To 6 If GraphicsWindow.LastKey="D"+i Then holdeasybag=i Shapes.Move(showholdeasybag1,19+(i-1)*70,486) Shapes.Move(showholdeasybag2,80+(i-1)*70,486) Shapes.Move(showholdeasybag3,20+(i-1)*70,485) Shapes.Move(showholdeasybag4,20+(i-1)*70,526) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+8+allcheck,holdeasybag) EndIf EndFor ElseIf screen=5 Then If GraphicsWindow.LastKey="W" Or GraphicsWindow.LastKey="Up" Then If check>1 Then check=check-1 Else check=allcheck EndIf drawscreen() ElseIf GraphicsWindow.LastKey="S" Or GraphicsWindow.LastKey="Down" Then If check=14 And easybag[holdeasybag]<=19 Then gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=7 ElseIf thing[mx][my]>18 And thing[mx][my]<29 Then '树木 gameload=10 If easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=1 ElseIf thing[mx][my]>=31 And thing[mx][my]<=35 Then '石头 If easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then gameload=5 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=4 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]>=36 And thing[mx][my]<=38 Then '铁 If easybag[holdeasybag]>=15 And easybag[holdeasybag]<=19 Then gameload=6 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=10 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]>38 And thing[mx][my]<41 Then '黄金 If easybag[holdeasybag]>=16 And easybag[holdeasybag]<=19 Then gameload=6 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=11 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]=41 Then '钻石 If easybag[holdeasybag]>=17 And easybag[holdeasybag]<=19 Then gameload=8 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=12 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]=42 Then '黑曜石 If easybag[holdeasybag]>=18 And easybag[holdeasybag]<=19 Then gameload=9 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=13 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]>=43 And thing[mx][my]<=45 Then '煤 If easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then gameload=4 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=9 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]=29 Then '南瓜 If easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then gameload=6 gameload=gameload-bagspeed[easybag[holdeasybag]] If gameload<=0 Then gameload=1 EndIf GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showpickcomplete=Shapes.AddText("采集剩余时间:"+gameload+"秒") Shapes.Move(showpickcomplete,460,10) willgetthing=8 Else GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("太硬了,挖不动") Shapes.Move(showmessage,460,70) EndIf ElseIf thing[mx][my]=46 Then '猪 hard=2 do2() Sound.PlayClick() If aniblood[mx][my]<=0 Then bagnum[26]=bagnum[26]+Math.GetRandomNumber(2) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+27,bagnum[26]) GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showgetbagthing=Shapes.AddText("获得物品:生猪肉") ElseIf Math.GetRandomNumber(8)=1 Then blood=blood-1 drawscreen() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage2=Shapes.AddText("遭到反抗,扣了血") Shapes.Move(showmessage2,460,100) EndIf ElseIf thing[mx][my]=47 Then '牛 hard=3 do2() Sound.PlayClick() If aniblood[mx][my]<=0 Then bagnum[28]=bagnum[28]+Math.GetRandomNumber(2) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+29,bagnum[28]) GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showgetbagthing=Shapes.AddText("获得物品:生牛肉") ElseIf Math.GetRandomNumber(5)=1 Then blood=blood-1 drawscreen() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage2=Shapes.AddText("遭到反抗,扣了血") Shapes.Move(showmessage2,460,100) EndIf If Math.GetRandomNumber(5)=1 Then blood=blood-1 drawscreen() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage2=Shapes.AddText("遭到反抗,扣了血") Shapes.Move(showmessage2,460,100) EndIf EndIf If thing[mx][my]>=46 And thing[mx][my]<=49 Then If broken=1 Then GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 showmessage=Shapes.AddText("攻击损坏了工具") Shapes.Move(showmessage,460,70) EndIf broken=0 Shapes.Move(showgetbagthing,460,40) EndIf EndIf EndIf ElseIf Mouse.IsRightButtonDown="True" Then If mx<450 And my<450 Then mx=Math.Floor(mx/50)-4+mex my=Math.Floor(my/50)-4+mey If Math.Abs(mex-mx)<=1 And Math.Abs(mey-my)<=1 Then EndIf EndIf EndIf EndSub Sub timecounter nofood=nofood+1 If nofood=200 Then nofood=0 hunger=hunger-1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+24+allcheck,hunger) drawscreen() EndIf daytime=daytime+1 If daytime=600 Then daytime=0 EndIf If Math.Remainder(daytime,60)=0 And screen=3 And gameload=0 Then drawscreen() EndIf digger() EndSub Sub digger If gameload>0 Then gameload=gameload-1 Shapes.SetText(showpickcomplete,"采集剩余时间:"+gameload+"秒") EndIf If gameload=0 Then If willgetthing=7 Then Shapes.HideShape(showpickcomplete) bagnum[7]=bagnum[7]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+8,bagnum[7]) hard=1 do1() showgetbagthing=Shapes.AddText("获得物品:蘑菇") ElseIf willgetthing=1 Then Shapes.HideShape(showpickcomplete) bagnum[1]=bagnum[1]+Math.GetRandomNumber(2)+2 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+2,bagnum[1]) bagnum[3]=bagnum[3]+Math.GetRandomNumber(3) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+4,bagnum[3]) hard=10 do1() showgetbagthing=Shapes.AddText("获得物品:树叶、木块") ElseIf willgetthing=4 Then Shapes.HideShape(showpickcomplete) bagnum[4]=bagnum[4]+Math.GetRandomNumber(2) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+5,bagnum[4]) hard=3 do1() showgetbagthing=Shapes.AddText("获得物品:石头") ElseIf willgetthing=10 Then Shapes.HideShape(showpickcomplete) bagnum[10]=bagnum[10]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+11,bagnum[10]) hard=5 do1() showgetbagthing=Shapes.AddText("获得物品:铁") ElseIf willgetthing=11 Then Shapes.HideShape(showpickcomplete) bagnum[11]=bagnum[11]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+12,bagnum[11]) hard=5 do1() showgetbagthing=Shapes.AddText("获得物品:黄金") ElseIf willgetthing=12 Then Shapes.HideShape(showpickcomplete) bagnum[12]=bagnum[12]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+13,bagnum[12]) hard=7 do1() showgetbagthing=Shapes.AddText("获得物品:钻石") ElseIf willgetthing=13 Then Shapes.HideShape(showpickcomplete) bagnum[13]=bagnum[13]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+14,bagnum[13]) hard=8 do1() showgetbagthing=Shapes.AddText("获得物品:黑曜石") ElseIf willgetthing=9 Then Shapes.HideShape(showpickcomplete) bagnum[9]=bagnum[9]+Math.GetRandomNumber(2) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+10,bagnum[9]) hard=3 do1() showgetbagthing=Shapes.AddText("获得物品:煤炭") ElseIf willgetthing=8 Then Shapes.HideShape(showpickcomplete) bagnum[8]=bagnum[8]+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldwidth*worldlength+9,bagnum[8]) hard=5 do1() showgetbagthing=Shapes.AddText("获得物品:南瓜") EndIf willgetthing=0 If broken=1 Then showmessage=Shapes.AddText("挖掘损坏了工具") Shapes.Move(showmessage,460,70) EndIf broken=0 Shapes.Move(showgetbagthing,460,40) EndIf EndSub Sub do2 If easybag[holdeasybag]>=20 And easybag[holdeasybag]<=25 Then aniblood[mx][my]=aniblood[mx][my]-baghurt[easybag[holdeasybag]] baglong[easybag[holdeasybag]]=baglong[easybag[holdeasybag]]-hard ElseIf easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then aniblood[mx][my]=aniblood[mx][my]-1 baglong[easybag[holdeasybag]]=baglong[easybag[holdeasybag]]-hard*2 Else aniblood[mx][my]=aniblood[mx][my]-1 EndIf If baglong[easybag[holdeasybag]]<=0 And easybag[holdeasybag]>=14 And easybag[holdeasybag]<=25 Then bagnum[easybag[holdeasybag]]=bagnum[easybag[holdeasybag]]-1 If bagnum[easybag[holdeasybag]]>0 Then baglong[easybag[holdeasybag]]=baghavelong[easybag[holdeasybag]] EndIf broken=1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+easybag[holdeasybag],bagnum[easybag[holdeasybag]]) EndIf redo2: If aniblood[mx][my]<=0 Then drawnewx=Math.GetRandomNumber(worldlength) drawnewy=Math.GetRandomNumber(worldwidth) If thing[drawnewx][drawnewy]>49 And thing[drawnewx][drawnewy]<=120 Then thing[drawnewx][drawnewy]=thing[mx][my] thing[mx][my]=120 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,(mx-1)*worldwidth+my+1,120) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,(drawnewx-1)*worldwidth+drawnewy+1,thing[drawnewx][drawnewy]) Else Goto redo2 EndIf drawscreen() EndIf EndSub Sub do1 If easybag[holdeasybag]>=14 And easybag[holdeasybag]<=19 Then baglong[easybag[holdeasybag]]=baglong[easybag[holdeasybag]]-hard ElseIf easybag[holdeasybag]>=20 And easybag[holdeasybag]<=25 Then baglong[easybag[holdeasybag]]=baglong[easybag[holdeasybag]]-hard/2 EndIf If baglong[easybag[holdeasybag]]<=0 And easybag[holdeasybag]>=14 And easybag[holdeasybag]<=25 Then bagnum[easybag[holdeasybag]]=bagnum[easybag[holdeasybag]]-1 If bagnum[easybag[holdeasybag]]>0 Then baglong[easybag[holdeasybag]]=baghavelong[easybag[holdeasybag]] EndIf broken=1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth+1+easybag[holdeasybag],bagnum[easybag[holdeasybag]]) EndIf ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,worldlength*worldwidth-3+allcheck+easybag[holdeasybag],baglong[easybag[holdeasybag]]) redo1: drawnewx=Math.GetRandomNumber(worldlength) drawnewy=Math.GetRandomNumber(worldwidth) If thing[drawnewx][drawnewy]>49 And thing[drawnewx][drawnewy]<=120 Then thing[drawnewx][drawnewy]=thing[mx][my] thing[mx][my]=120 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,(mex-1)*worldwidth+mey+1,120) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(path,(drawnewx-1)*worldwidth+drawnewy+1,thing[drawnewx][drawnewy]) Else Goto redo1 EndIf drawscreen() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=25 EndSub Sub baginformation allcheck=33 bagthing[1]="木块" bagthing[2]="木板" bagthing[3]="树叶" bagthing[4]="石头" bagthing[5]="石块" bagthing[6]="木棍" bagthing[7]="蘑菇" bagthing[8]="南瓜" bagthing[9]="煤炭" bagthing[10]="铁" bagthing[11]="黄金" bagthing[12]="钻石" bagthing[13]="黑曜石" bagthing[14]="木镐" bagthing[15]="石镐" bagthing[16]="铁镐" bagthing[17]="黄金镐" bagthing[18]="钻石镐" bagthing[19]="黑曜石镐" bagthing[20]="木剑" bagthing[21]="石剑" bagthing[22]="铁剑" bagthing[23]="黄金剑" bagthing[24]="钻石剑" bagthing[25]="黑曜石剑" bagthing[26]="生猪肉" bagthing[27]="熟猪肉" bagthing[28]="生牛肉" bagthing[29]="熟牛肉" bagthing[30]="鸡蛋" bagthing[31]="小麦" bagthing[32]="牛奶" bagthing[33]="蛋糕" bagmake1[2]=1 bagmake1num[2]=1 bagmakeget[2]=4 bagmake1[5]=4 bagmake1num[5]=2 bagmakeget[5]=1 bagmake1[6]=2 bagmake1num[6]=2 bagmakeget[6]=4 bagmake1[14]=2 bagmake1num[14]=3 bagmake2[14]=6 bagmake2num[14]=2 bagmakeget[14]=1 bagmake1[15]=5 bagmake1num[15]=3 bagmake2[15]=6 bagmake2num[15]=2 bagmakeget[15]=1 bagmake1[16]=10 bagmake1num[16]=3 bagmake2[16]=6 bagmake2num[16]=2 bagmakeget[16]=1 bagmake1[17]=11 bagmake1num[17]=3 bagmake2[17]=6 bagmake2num[17]=2 bagmakeget[17]=1 bagmake1[18]=12 bagmake1num[18]=3 bagmake2[18]=6 bagmake2num[18]=2 bagmakeget[18]=1 bagmake1[19]=13 bagmake1num[19]=3 bagmake2[19]=6 bagmake2num[19]=2 bagmakeget[19]=1 bagmake1[20]=2 bagmake1num[20]=3 bagmake2[20]=6 bagmake2num[20]=2 bagmakeget[20]=1 bagmake1[21]=5 bagmake1num[21]=3 bagmake2[21]=6 bagmake2num[21]=2 bagmakeget[21]=1 bagmake1[22]=10 bagmake1num[22]=3 bagmake2[22]=6 bagmake2num[22]=2 bagmakeget[22]=1 bagmake1[23]=11 bagmake1num[23]=3 bagmake2[23]=6 bagmake2num[23]=2 bagmakeget[23]=1 bagmake1[24]=12 bagmake1num[24]=3 bagmake2[24]=6 bagmake2num[24]=2 bagmakeget[24]=1 bagmake1[25]=13 bagmake1num[25]=3 bagmake2[25]=6 bagmake2num[25]=2 bagmakeget[25]=1 bagmake1[27]=26 bagmake1num[27]=1 bagmake2[27]=9 bagmake2num[27]=2 bagmakeget[27]=1 bagmake1[29]=28 bagmake1num[29]=1 bagmake2[29]=9 bagmake2num[29]=2 bagmakeget[29]=1 bagmake1[33]=30 bagmake1num[33]=3 bagmake2[33]=31 bagmake2num[33]=3 bagmake3[33]=32 bagmake3num[33]=3 bagmakeget[33]=1 baghavelong[14]=60 baghavelong[15]=80 baghavelong[16]=140 baghavelong[17]=100 baghavelong[18]=160 baghavelong[19]=180 baghavelong[20]=25 baghavelong[21]=35 baghavelong[22]=45 baghavelong[23]=40 baghavelong[24]=60 baghavelong[25]=70 bagspeed[14]=1 bagspeed[15]=2 bagspeed[16]=2 bagspeed[17]=3 bagspeed[18]=4 bagspeed[19]=4 baghurt[20]=2 baghurt[21]=2.5 baghurt[22]=4 baghurt[23]=4.5 baghurt[24]=5 baghurt[25]=6 bagblood[7]=1 baghunger[7]=0 bagblood[8]=3 baghunger[8]=3 bagblood[26]=2 baghunger[26]=3 bagblood[27]=3 baghunger[27]=3 bagblood[28]=3 baghunger[28]=3 bagblood[29]=3 baghunger[29]=4 bagblood[30]=0 baghunger[30]=1 bagblood[33]=4 baghunger[33]=5 EndSub Sub typerinformation exchangerblood[1]= "❤" exchangerblood[2]= "❤❤" exchangerblood[3]= "❤❤❤" exchangerblood[4]= "❤❤❤❤" exchangerblood[5]= "❤❤❤❤❤" exchangerblood[6]= "❤❤❤❤❤❤" exchangerblood[7]= "❤❤❤❤❤❤❤" exchangerblood[8]= "❤❤❤❤❤❤❤❤" exchangerblood[9]= "❤❤❤❤❤❤❤❤❤" exchangerblood[10]="❤❤❤❤❤❤❤❤❤❤" exchangerhung[1]= "★" exchangerhung[2]= "★★" exchangerhung[3]= "★★★" exchangerhung[4]= "★★★★" exchangerhung[5]= "★★★★★" exchangerhung[6]= "★★★★★★" exchangerhung[7]= "★★★★★★★" exchangerhung[8]= "★★★★★★★★" exchangerhung[9]= "★★★★★★★★★" exchangerhung[10]="★★★★★★★★★★" haveblood[46]=6 haveblood[47]=8 haveblood[48]=6 haveblood[49]=10 EndSub '地图分配 '1-18 水 '19-28 树木 '29 南瓜 '30 蘑菇 '31-35 石头 '36-38 铁 '39-40 黄金 '41 钻石 '42 黑曜石 '43-45 煤 '46 猪 '47 牛 '48 狼 '49 虎 End>RKD861.sb< Start>RKF190.sb< '************************************************************** ' Yet Another Maze Program - Author " Kensig " (J.K.Sigsworth) '************************************************************** 'This Small Basic program generates a "Simple" random maze 'i.e One which has 1 Entry point and 1 Exit point and only 1 possible 'path through with lots of Dead Ends but easy to find path through. 'Once the Maze has been generated, the user can then guide the Turtle 'through the Maze using EITHER the Keyboard or the Mouse. 'I created this program purely as an exercise to "ease" myself back 'into basic programming after quite a long absence. Also to try and 'stop my tired old brain turning to "mush" ;) 'The program itself does not present much of a challenge as a Game 'but can be quite interesting to watch as the maze is being generated 'especially when the generation is slowed down. 'The default settings provide a maze of 23 rows by 35 columns (805 cells) 'at a cell size of 25 pix with no delay (taking around 0.5 secs) 'The "Control Panel" allows the user to switch between Keyboard and Mouse 'for controlling the turtle and displays the time taken to navigate the Maze 'as well as the number of times the Turtle hits a wall. 'The time really is a bit pointless as every Maze is random so time taken can vary 'by quite a lot. 'When the maze has been navigated through, the user can change either or both, 'the size of maze and also speed of generation. 'NOTE: Due to the "Turtle Bug" I have replaced the Turtle with a "Blob" 'Also, this has been created using the "vanilla" SB program i.e No extensions. '**************************************************************************** 'First run entry point '**************************************************************************** dosplash() Program.Delay(1000) firstrun = "true" Turtle.Speed = 8 Turtle.Hide() setmazedata() 'This sets the 6 predefined maze sizes & speed delays. '********************************************* 'Restart point after a maze has been navigated '********************************************** restart: initwindow() If firstrun = "true" then defaults() Else defaults2() EndIf '********************************************** 'Main setup section '********************************************** initindex() start() '********************************************** ' Setup events handlers '********************************************** Controls.ButtonClicked = onbutton GraphicsWindow.KeyUp = onkey timer.Interval = 1000 timer.Tick = dotime Timer.Pause() setcontrols() '********************************************* 'Wait in this loop until the user has navigated 'through the maze. '********************************************* While exitflag = "false" 'Wait for navigation to finish Endwhile Timer.Pause() ' Finished so stop Timer Sound.PlayChimeAndWait() firstrun = "false" Program.Delay(2000) GraphicsWindow.ShowMessage("Close this messagebox & choose new Maze size.","New Maze") doptions() GraphicsWindow.ShowMessage("Are you Ready to play the New Maze?","New Maze") Goto restart '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 'Subroutines below Here '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Sub dotime seconds = seconds + 1 Shapes.SetText(navtime,seconds + " Secs") EndSub Sub dowallhit whits = whits + 1 Shapes.SetText(wallhits,whits) EndSub '=============================================== 'Set up Initial Window '=============================================== Sub initwindow dww = Desktop.Width gww = 920 'My Window Width gwh = 710 'My Window Height GraphicsWindow.Clear() GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gww GraphicsWindow.Height = gwh GraphicsWindow.Left = (dww /2) - (gww / 2) GraphicsWindow.Top = 20 GraphicsWindow.BackgroundColor = "limegreen" GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(0,gwh - 105,gww,gwh - 105) gwtitle = "Yet Another Maze Program (v 1.0) Maze Size = " GraphicsWindow.Title = gwtitle GraphicsWindow.PenWidth = 2 exitflag = "false" EndSub '============================================ 'Set index reference point for cell creation and to sync with turtle '============================================ Sub initindex x = (gww - (columns * size)) / 2 - size y = ((gwh - 100) - (rows * size)) / 2 - size txpos = x + (size / 2) typos = y + (size / 2) Turtle.X = txpos + (1 * size) Turtle.Y = typos + (1 * size) EndSub '============================================ 'First run defaults for maze size and generation speed '============================================ Sub defaults speed = mazedata[7][1] rows = mazedata[3][2] columns = mazedata[3][3] size = mazedata[3][1] tspeed = speed trows = rows tcols = columns tsize = size EndSub '=========================================== 'Reflects user changes '=========================================== Sub defaults2 rows = trows columns = tcols size = tsize speed = tspeed EndSub '============================================= 'The main maze creation entry point. '============================================= Sub start GraphicsWindow.Title = gwtitle + "Rows " + rows + " Columns " + columns + " Cells " + rows * columns dogrid() mode = 0 dostartposition() 'Maze Entry Point 'startime = Clock.ElapsedMilliseconds mainmaze() 'endtime = Clock.ElapsedMilliseconds 'lapsedtime = (endtime - startime) / 1000 'GraphicsWindow.DrawText(10, 620,lapsedtime) 'Time taken to generate the maze for checking. EndSub '====================================== 'Maze generation entry point '====================================== Sub mainmaze finishflag = "false" While finishflag = "false" trytomove() If stuckflag = "true" then findourway() If tryflag = "false" then dobacktrack() EndIf EndIf EndWhile mode = 1 dostartposition() 'Exit point EndSub Sub trytomove movecount = 0 While movecount < 4 stuckflag = "true" getdirection() If boxes[rowpos2][colpos2][1] = 9 Then 'Good, we can move domove() stuckflag = "false" movecount = 4 Else movecount = movecount + 1 EndIf EndWhile EndSub '============================================= ' We are stuck so try to find a way out '============================================= Sub findourway trywest() If tryflag = "true" Then domove() Else trynorth() If tryflag = "true" Then domove() Else trysouth() If tryflag = "true" Then domove() Else tryeast() If tryflag = "true" Then domove() EndIf EndIf EndIf EndIf EndSub '============================================ 'Routines to test For a valid move in specIfic direction '============================================ Sub trynorth tryflag = "false" direction = 1 checkbounds() If bflag = "true" Then If boxes[rowpos2][colpos2][1] = 9 Then tryflag = "true" EndIf EndIf EndSub Sub tryeast tryflag = "false" direction = 2 checkbounds() If bflag = "true" Then If boxes[rowpos2][colpos2][1] = 9 Then tryflag = "true" EndIf EndIf EndSub Sub trysouth tryflag = "false" direction = 4 checkbounds() If bflag = "true" Then If boxes[rowpos2][colpos2][1] = 9 Then tryflag = "true" EndIf EndIf EndSub Sub trywest tryflag = "false" direction = 3 checkbounds() If bflag = "true" Then If boxes[rowpos2][colpos2][1] = 9 Then tryflag = "true" EndIf EndIf EndSub '================================================ ' Down a blind alley so backtrack '================================================ Sub dobacktrack backtrackloop: direction = boxes[rowpos][colpos][1] If direction = 8 Then finishflag = "true" Else boxes[rowpos][colpos][1] = 0 'Sweep up Breadcrumbs checkbounds() domove2() findourway() If tryflag = "false" Then Goto backtrackloop EndIf EndIf EndSub '=================================================== ' Used by backtrack routine to follow "Breadcrumbs" '=================================================== Sub domove2 If direction = 1 Then rowpos = rowpos - 2 ElseIf direction = 2 then colpos = colpos + 2 ElseIf direction = 3 then colpos = colpos - 2 ElseIf direction = 4 then rowpos = rowpos + 2 EndIf rowpos2 = rowpos colpos2 = colpos EndSub ' ================================================== ' Can only come here If we can make a valid move so make path. '================================================== Sub domove Shapes.HideShape(boxes[rowpos2][colpos2][0]) boxes[rowpos2][colpos2][1] = 5 - direction 'Drop our "Breadcrumbs" If direction = 1 Then Shapes.HideShape(boxes[rowpos2 + 1][colpos2][0]) boxes[rowpos2 + 1][colpos2][1] = 0 ElseIf direction = 2 then Shapes.HideShape(boxes[rowpos2][colpos2 - 1][0]) boxes[rowpos2][colpos2 - 1][1] = 0 ElseIf direction = 3 then Shapes.HideShape(boxes[rowpos2][colpos2 + 1][0]) boxes[rowpos2][colpos2 + 1][1] = 0 ElseIf direction = 4 then Shapes.HideShape(boxes[rowpos2 - 1][colpos2][0]) boxes[rowpos2 - 1][colpos2][1] = 0 EndIf rowpos = rowpos2 colpos = colpos2 Program.Delay(speed) EndSub '================================================== 'Get a Random direction and check bounds '================================================== Sub getdirection checkloop: direction = Math.GetRandomNumber(4) checkbounds() If bflag = "false" Then 'No good - Go back and try again. goto checkloop EndIf EndSub '============================================== 'Check that the direction of a move will still be within main area '============================================== Sub checkbounds bflag = "false" If direction = 1 And rowpos >= 4 Then 'North bflag = "true" rowpos2 = rowpos - 2 colpos2 = colpos ElseIf direction = 2 and colpos <= (columns - 3) then 'East bflag = "true" colpos2 = colpos + 2 rowpos2 = rowpos ElseIf direction = 4 and rowpos <= (rows - 3) then 'South bflag = "true" rowpos2 = rowpos + 2 colpos2 = colpos ElseIf direction = 3 and colpos >= 4 then 'West bflag = "true" colpos2 = colpos - 2 rowpos2 = rowpos EndIf EndSub '============================================== 'Get a random start position (Mode 0 )on left side of grid 'and exit position (Mode 1) on right side of grid ' Has got to be on an even row number '============================================== Sub dostartposition temp = Math.GetRandomNumber((rows-2) + 1) remainder = Math.Remainder(temp,2) 'If not an even number make it so If remainder <> 0 Then temp = temp + 1 EndIf If mode = 0 Then startrow = temp startcol = 1 Shapes.HideShape(boxes[startrow][startcol][0]) Shapes.HideShape(boxes[startrow][startcol + 1][0]) boxes[startrow][startcol + 1][1] = 8 rowpos = startrow colpos = startcol + 1 ElseIf mode = 1 then endrow = temp endcol = columns Shapes.HideShape(boxes[endrow][endcol][0]) boxes[endrow][endcol][1] = 7 EndIf EndSub '=============================================== 'Create the grid on screen '=============================================== Sub dogrid GraphicsWindow.PenWidth = .5 GraphicsWindow.PenColor = "black" For r = 1 To rows For c = 1 To columns If r = 1 Or r = rows Or c = 1 Or c = columns Then GraphicsWindow.BrushColor = "Red" 'Boundry Walls Else GraphicsWindow.BrushColor = "gray" 'Main Grid Area EndIf boxes[r][c][0] = Shapes.AddRectangle(size, size) boxes[r][c][1] = 9 'Not visited Code Shapes.Move(boxes[r][c][0], x + c * size, y + r * size) EndFor EndFor EndSub '================================================ 'Set up and position Turtle in the right place. 'Included a "Blob" to solve the dissappearing Turtle Bug. '================================================ Sub doturtle GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 4 Turtle.Angle = 90 Turtle.X = txpos + (startcol * size) turtlecol = startcol Turtle.Y = typos + (startrow * size) turtlerow = startrow Turtle.Move(size) turtlecol = turtlecol + 1 GraphicsWindow.PenColor = "black" GraphicsWindow.PenWidth = 1 myblob = Shapes.AddEllipse(size * .6,size * .6) GraphicsWindow.PenColor = "red" GraphicsWindow.BrushColor = "red" GraphicsWindow.PenWidth = 4 Shapes.Move(myblob,Turtle.X - (size / 4),Turtle.y - (size / 4)) whits = -1 turtleburp() pulseblob() seconds = 0 Timer.Resume() 'showstatus() =======For Debug purposes EndSub Sub pulseblob For z = 1 To 4 Step .1 Shapes.Zoom(myblob,z,z) Program.Delay(20) EndFor For z= 4 To 1 Step -.1 Shapes.Zoom(myblob,z,z) Program.Delay(20) EndFor EndSub '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Sub turtleburp dowallhit() Sound.PlayMusic("O6 F16 C16") 'Sound.PlayBellRing() EndSub '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Sub setcontrols GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 2 GraphicsWindow.BrushColor = "red" GraphicsWindow.FontSize = 14 buttonright = Controls.AddButton("Right", 840,gwh - 70) buttonleft = Controls.AddButton("Left", 710,gwh - 70) buttonup = Controls.AddButton("Up", 775,gwh - 95) buttondown = Controls.AddButton("Down", 775,gwh - 50) buttonmode = Controls.AddButton("Keyboard", 585,gwh - 65) Controls.SetSize(buttonmode,80,40) Controls.SetSize(buttonright, 60,40) Controls.SetSize(buttonleft, 60,40) Controls.SetSize(buttonup, 60,40) Controls.SetSize(buttondown, 60,40) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(gww - 345,gwh - 90,"Turtle Control") GraphicsWindow.DrawText(gww - 840,gwh - 90,"Maze Size") GraphicsWindow.DrawText(gww - 640,gwh - 90,"Generation Delay") GraphicsWindow.PenWidth = 4 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawRectangle(gww - 230,gwh - 100,230,100) GraphicsWindow.DrawRectangle(gww - 360,gwh - 100,130,100) GraphicsWindow.DrawRectangle(gww - gww,gwh - 100,230,100) GraphicsWindow.DrawRectangle(gww - 690,gwh - 100,230,100) GraphicsWindow.DrawRectangle(gww - 460,gwh - 100,100,100) GraphicsWindow.DrawLine(gww - 460,gwh - 50,gww - 360,gwh - 50) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(gww - 450,gwh - 95,"Time(Secs)") GraphicsWindow.DrawText(gww - 440,gwh - 45,"Wall Hits") navtime = Shapes.AddText("0") Shapes.Move(navtime,gww - 430,635) wallhits = Shapes.AddText("0 ") Shapes.Move(wallhits,gww - 420,685) GraphicsWindow.BrushColor = "red" Controls.AddButton(mazedata[8][1],10,645) Controls.AddButton(mazedata[8][2],10,675) Controls.AddButton(mazedata[8][3],80,645) Controls.AddButton(mazedata[8][4],80,675) Controls.AddButton(mazedata[8][5],150,645) Controls.AddButton(mazedata[8][6],150,675) Controls.AddButton(mazedata[9][1],240,645) Controls.AddButton(mazedata[9][2],240,675) Controls.AddButton(mazedata[9][3],310,645) Controls.AddButton(mazedata[9][4],310,675) Controls.AddButton(mazedata[9][5],380,645) Controls.AddButton(mazedata[9][6],380,675) cover = Shapes.AddRectangle(240,100) cover2 = Shapes.AddRectangle(230,100) cover3 = Shapes.AddRectangle(230,100) Shapes.SetOpacity(cover,60) Shapes.SetOpacity(cover2,60) Shapes.SetOpacity(cover3,60) Shapes.Move(cover,gww - 230,gwh - 100) Shapes.Move(cover2,0,gwh - 100) Shapes.Move(cover3,230,gwh - 100) coverflag = "Closed" coverflag2 = "Closed" coverflag3 = "Closed" doturtle() EndSub '================================================== 'Button Handler '================================================== Sub onbutton If Controls.LastClickedButton = buttonmode Then If Controls.GetButtonCaption(buttonmode) = "Mouse" Then Controls.SetButtonCaption(buttonmode, "Keyboard") docover() Else Controls.SetButtonCaption(buttonmode, "Mouse") docover() EndIf Goto onbuttonexit Else If Controls.LastClickedButton = buttonup Then Turtle.Angle = 0 ElseIf Controls.LastClickedButton = buttondown Then Turtle.Angle = 180 ElseIf Controls.LastClickedButton = buttonleft Then Turtle.Angle = 270 ElseIf Controls.LastClickedButton = buttonright Then Turtle.Angle = 90 EndIf 'TextWindow.WriteLine(" Button = " + Controls.LastClickedButton) '=======For Debug purposes checkmoveturtle() EndIf onbuttonexit: EndSub Sub onkey If Controls.GetButtonCaption(buttonmode) = "Keyboard" Then navkey = GraphicsWindow.LastKey If navkey = "Up" Or navkey = "Down" Or navkey = "Left" Or navkey = "Right" Then onkey2() EndIf EndIf EndSub Sub onkey2 If GraphicsWindow.LastKey = "Up" Then Turtle.Angle = 0 ElseIf GraphicsWindow.LastKey = "Down" Then Turtle.Angle = 180 ElseIf GraphicsWindow.LastKey = "Left" Then Turtle.Angle = 270 ElseIf GraphicsWindow.LastKey = "Right" Then Turtle.Angle = 90 EndIf checkmoveturtle() EndSub Sub checkmoveturtle 'showstatus() =======For Debug purposes moveflag = "False" If Turtle.Angle = 0 And boxes[turtlerow - 1][turtlecol][1] <> 9 Then moveflag = "true" turtlerow = turtlerow - 2 ElseIf Turtle.Angle = 90 And boxes[turtlerow][turtlecol + 1][1] <> 9 Then moveflag = "true" turtlecol = turtlecol + 2 ElseIf Turtle.Angle = 180 And boxes[turtlerow + 1][turtlecol][1] <> 9 Then moveflag = "true" turtlerow = turtlerow + 2 ElseIf Turtle.Angle = 270 And boxes[turtlerow][turtlecol - 1][1] <> 9 Then moveflag = "true" turtlecol = turtlecol - 2 EndIf If moveflag = "true" Then Turtle.Move(size * 2) Shapes.Move(myblob,Turtle.X - (size /4),Turtle.y - (size /4)) If turtle.Angle = 90 And boxes[turtlerow][turtlecol - 1][1] = 7 Then exitflag = "true" 'showstatus() =====For Debug purposes EndIf Else turtleburp() EndIf EndSub '========================================================= 'Routine to open and close covers over Control Buttons '========================================================= Sub docover If coverflag = "Closed" Then Shapes.Animate(cover, gww - 10,gwh - 100,1500) coverflag = "Open" Else Shapes.Animate(cover, gww - 230,gwh - 100,1500) coverflag = "Closed" EndIf EndSub Sub docover2 If coverflag2 = "Closed" Then Shapes.Animate(cover2, 0,gwh - 5,1500) coverflag2 = "Open" Else Shapes.Animate(cover2, 0,gwh - 100,1500) coverflag2 = "Closed" EndIf EndSub Sub docover3 If coverflag3 = "Closed" Then Shapes.Animate(cover3, 230,gwh - 5,1500) coverflag3 = "Open" Else Shapes.Animate(cover3, 230,gwh - 100,1500) coverflag3 = "Closed" EndIf EndSub ' '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ' Just a debug routine for the Turtle movement. '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Sub showstatus TextWindow.BackgroundColor = "cyan" TextWindow.ForegroundColor = "black" TextWindow.Clear() TextWindow.WriteLine("Row = " + turtlerow + " Col = " + turtlecol) TextWindow.WriteLine("") TextWindow.WriteLine("North = " + boxes[turtlerow - 1][turtlecol][1]) TextWindow.WriteLine("South = " + boxes[turtlerow + 1][turtlecol][1]) TextWindow.WriteLine("East = " + boxes[turtlerow][turtlecol + 1][1]) TextWindow.WriteLine("West = " + boxes[turtlerow][turtlecol - 1][1]) TextWindow.WriteLine("") EndSub '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ '=========================================================== 'The Startup Splash Screen Routine '=========================================================== Sub dosplash dtw = Desktop.Width dth = Desktop.Height GraphicsWindow.FontSize = 36 GraphicsWindow.BrushColor = "red" titletext = "YAMP" GraphicsWindow.Left = ((dtw - GraphicsWindow.Width) / 2) GraphicsWindow.Top = ((dth - GraphicsWindow.Height) / 2) GraphicsWindow.BackgroundColor = "Lime" GraphicsWindow.Title = "Y.A.M.P. v1.0 Author Kensig" GraphicsWindow.CanResize = "false" GraphicsWindow.Show() For x = 1 to 4 titlechar[x] = Shapes.AddText(text.GetSubText(titletext,x,1)) y = 20 If x = 4 Then y = 28 EndIf Shapes.Move(titlechar[x],(200 + (x * 30) + y),20) Program.Delay(1000) endfor Program.Delay(2000) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = 24 GraphicsWindow.DrawText(150,112," et nother aze rogram.") Program.Delay(1000) shapespos() yp = Stack.PopValue("ms") For x = 1 To 4 xp = Stack.PopValue("ms") Shapes.Animate(titlechar[x],xp,yp,1000) Program.Delay(1000) EndFor prompt = Shapes.AddText("Please take your pick") Shapes.Move(prompt,180,290) Program.Delay(500) Controls.AddButton("EXIT",220,338) Controls.AddButton("Start",320,338) buttonclicked = "false" promptflag = "true" While buttonclicked = "false" clicked = Controls.LastClickedButton If clicked = "Button1" Then Program.End() Else If clicked = "Button2" Then Sound.PlayChimeAndWait() buttonclicked = "true" EndIf EndIf Program.Delay(500) If promptflag = "true" Then Shapes.HideShape(prompt) promptflag = "false" Else Shapes.ShowShape(prompt) promptflag = "true" EndIf EndWhile EndSub Sub shapespos Stack.PushValue("ms",400) Stack.PushValue("ms",305) Stack.PushValue("ms",190) Stack.PushValue("ms",135) Stack.PushValue("ms",100) EndSub '======================================================= 'Had to do this lot because of problems (bugs?) I was having with Textwindow 'trying to use it to input options crashed the program. '======================================================= Sub setmazedata mdata = "401321301929252335202943153757105787000010025050100200" mdata2 = "13 x 2119 x 2923 x 3529 x 4337 x 5757 x 87" mdata3 = "000 ms010 ms025 ms050 ms100 ms200 ms" For j = 1 To 6 For k = 1 To 3 mazedata[j][k] = Text.GetSubText(mdata,(j * 6) + (k * 2) - 7,2) EndFor EndFor For k = 1 To 6 mazedata[7][k] = Text.GetSubText(mdata,(37 + (k * 3)) - 3,3) EndFor For k = 1 To 6 mazedata[8][k] = Text.GetSubText(mdata2,(k * 7) - 6,7) EndFor For k = 1 To 6 mazedata[9][k] = Text.GetSubText(mdata3,(k * 6) - 5,6) EndFor EndSub '=========================================== 'Get options from the user for maze size and generation speed '=========================================== Sub doptions docover2() j1 = 8 getoptions() option1 = option docover2() GraphicsWindow.ShowMessage("Close this messagebox & choose new Speed.","New Maze") docover3() j1 = 9 getoptions() option2 = option docover3() tspeed = mazedata[7][option2] trows = mazedata[option1][2] tcols = mazedata[option1][3] tsize = mazedata[option1][1] EndSub sub getoptions selectflag = "false" while selectflag = "false" clicked = Controls.LastClickedButton For j = 1 To 6 If Controls.GetButtonCaption(clicked) = mazedata[j1][j] Then option = j selectflag = "true" EndIf EndFor EndWhile EndSub End>RKF190.sb< Start>RKF483.sb< 'size the sindow GraphicsWindow.Width = 640 GraphicsWindow.Height = 480 GraphicsWindow.Left = (Desktop.Width - 640) / 2 'position the window GraphicsWindow.Top = (Desktop.Height - 480) / 2 GraphicsWindow.CanResize = "False" 'resizing won't be necessary GraphicsWindow.Title = "Texas Lottery(Using Control Buttons)" 'add some text into the title bar GraphicsWindow.BackgroundColor = "DarkBlue" 'color the background GraphicsWindow.BrushColor = "Yellow" 'color the text output GraphicsWindow.FontName = "Veranda" 'specify the font GraphicsWindow.FontSize = 14 'size the font GraphicsWindow.show() 'show the window GraphicsWindow.Clear() 'clear the window x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY xPos = 0 yPos = 0 string1 = "And for your PowerBall you drew a" string2 = "And for your MegaBall you drew a" string3 = "And for your BonusBall you drew a" 'START BUTTON PRESS EVENT clicked = "" Controls.ButtonClicked = OnButtonClicked 'GraphicsWindow.DrawText(X, Y, "TEXT") 'RanNum = Math.GetRandomNumber(maxNum) 'returns a number between 1 & maxNum (inclusive) tag01 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\PowerBall.png" tag02 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\MegaMillions.png" tag03 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\LottoTexas.png" tag04 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Cash5.png" tag05 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Daily4.png" tag06 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Pick3.png" tag07 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Texas2Step.png" tag08 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\QuitProgram.png" tag09 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Yes.png" tag10 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\No.png" tag11 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\No - Copy.png" tag12 = "C:\Users\Albert\Programming\Small Basic\Saved Projects\Small Lotto\Images\Yes - Copy.png" Menu() ' INFINITE GAME LOOP While ("True") If (clicked <> "") Then 'Something clicked 'Do something depending on the button - first find which button it was If clicked = buttonPowerBall then PowerBall() EndIf If clicked = buttonMegamillions then MegaMillions() EndIf If clicked = buttonLottoTexas then LottoTexas() EndIf If clicked = buttonCash5 then Cash5() EndIf If clicked = buttonDaily4 then Daily4() EndIf If clicked = buttonPick3 then Pick3() EndIf If clicked = buttonTexas2Step then Texas2Step() EndIf If clicked = buttonQuitProgram then QuitProgram() EndIf clicked = "" 'Reset waiting for next click EndIf Program.Delay(20) ' Don't mash cpu when nothing happening EndWhile Sub Menu'####################################################### GraphicsWindow.Clear() buttonPowerBall = Controls.AddButton("PowerBall", 64, 31) Controls.SetSize(buttonPowerBall, 223, 87) LDShapes.SetImage(buttonPowerBall,tag01) buttonMegaMillions = Controls.AddButton("MegaMillions", 351, 31) Controls.SetSize(buttonMegaMillions, 223, 87) LDShapes.SetImage(buttonMegaMillions,tag02) buttonLottoTexas = Controls.AddButton("LottoTexas", 64, 142) Controls.SetSize(buttonLottoTexas, 223, 87) LDShapes.SetImage(buttonLottoTexas,tag03) buttonCash5 = Controls.AddButton("Cash5", 351, 142) Controls.SetSize(buttonCash5, 223, 87) LDShapes.SetImage(buttonCash5,tag04) buttonDaily4 = Controls.AddButton("Daily4", 64, 253) Controls.SetSize(buttonDaily4, 223, 87) LDShapes.SetImage(buttonDaily4,tag05) buttonPick3 = Controls.AddButton("Pick3", 351, 253) Controls.SetSize(buttonPick3, 223, 87) LDShapes.SetImage(buttonPick3,tag06) buttonTexas2Step = Controls.AddButton("Texas2Step", 64, 364) Controls.SetSize(buttonTexas2Step, 223, 87) LDShapes.SetImage(buttonTexas2Step,tag07) buttonQuitProgram = Controls.AddButton("QuitProgram", 351, 364) Controls.SetSize(buttonQuitProgram, 223, 87) LDShapes.SetImage(buttonQuitProgram,tag08) EndSub'Menu########################################################### Sub PowerBall'######################################################### GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag01, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 5 'THANKS GOTOLOOP FOR THIS CODE SNIPPET For noEscape = 0 To 0 Step 0 ' Sets an infinite loop making Step = zero noEscape = 1 ' if this loop reaches its end while noEscape > 0, loop breaks free ranNum = Math.GetRandomNumber(58) ' Pick a random number ' Checks whether array already contains latest picked random number: If Array.ContainsValue(array, ranNum) Then noEscape = 0 ' If found so, do not let loop break free by setting noEscape back to zero EndIf EndFor array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor PB = Math.GetRandomNumber(34) 'draw the numbers xPos = 254 yPos = 152 For Index = 1 To 5 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 208 yPos = 188 GraphicsWindow.DrawText(xPos, yPos, string1) xPos = 312 yPos = 224 GraphicsWindow.DrawText(xPos, yPos, PB) xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub 'Powerball########################################## Sub MegaMillions'########################################### GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag02, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 5 'THANKS GOTOLOOP FOR THIS CODE SNIPPET For noEscape = 0 To 0 Step 0 ' Sets an infinite loop making Step = zero noEscape = 1 ' if this loop reaches its end while noEscape > 0, loop breaks free ranNum = Math.GetRandomNumber(56) ' Pick a random number ' Checks whether array already contains latest picked random number: If Array.ContainsValue(array, ranNum) Then noEscape = 0 ' If found so, do not let loop break free by setting noEscape back to zero EndIf EndFor array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor MB = Math.GetRandomNumber(46) 'draw the numbers xPos = 254 yPos = 152 For Index = 1 To 5 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 208 yPos = 188 GraphicsWindow.DrawText(xPos, yPos, string2) xPos = 312 yPos = 224 GraphicsWindow.DrawText(xPos, yPos, MB) xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'MegaMillions####################################### Sub LottoTexas'############################################ GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag03, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 6 'THANKS GOTOLOOP FOR THIS CODE SNIPPET For noEscape = 0 To 0 Step 0 ' Sets an infinite loop making Step = zero noEscape = 1 ' if this loop reaches its end while noEscape > 0, loop breaks free ranNum = Math.GetRandomNumber(54) ' Pick a random number ' Checks whether array already contains latest picked random number: If Array.ContainsValue(array, ranNum) Then noEscape = 0 ' If found so, do not let loop break free by setting noEscape back to zero EndIf EndFor array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor 'draw the numbers xPos = 234 yPos = 176 For Index = 1 To 6 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'LottoTexas############################################### Sub Cash5'##################################################### GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag04, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 5 'THANKS GOTOLOOP FOR THIS CODE SNIPPET For noEscape = 0 To 0 Step 0 ' Sets an infinite loop making Step = zero noEscape = 1 ' if this loop reaches its end while noEscape > 0, loop breaks free ranNum = Math.GetRandomNumber(37) ' Pick a random number ' Checks whether array already contains latest picked random number: If Array.ContainsValue(array, ranNum) Then noEscape = 0 ' If found so, do not let loop break free by setting noEscape back to zero EndIf EndFor array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor 'draw the numbers xPos = 246 yPos = 176 For Index = 1 To 5 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'Cash5####################################################### Sub Daily4'####################################################### GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag05, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers sumNum = 0 For index = 1 To 4 ranNum = (Math.GetRandomNumber(9) - 1) ' Pick a random number array[index] = ranNum sumNum = sumNum + array[index] EndFor 'draw the numbers xPos = 168 yPos = 176 For Index = 1 To 4 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor GraphicsWindow.DrawText((xPos + 32), yPos, "Sum it up equals " + sumNum) xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'Daily4########################################################### Sub Pick3'############################################################ GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag06, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 3 ranNum = (Math.GetRandomNumber(9) - 1)' Pick a random number array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor 'draw the numbers xPos = 292 yPos = 176 For Index = 1 To 3 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'Pick3######################################################### Sub Texas2Step'###################################################### GraphicsWindow.Clear() buttonYes = Controls.AddButton("Yes", 64, 364) Controls.SetSize(buttonYes, 223 87) LDShapes.SetImage(buttonYes,tag09) buttonNo = Controls.AddButton("No", 351, 364) Controls.SetSize(buttonNo, 223 87) LDShapes.SetImage(buttonNo,tag10) xPos = 96 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "These are your") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag07, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "numbers!") 'generate the numbers For index = 1 To 4 'THANKS GOTOLOOP FOR THIS CODE SNIPPET For noEscape = 0 To 0 Step 0 ' Sets an infinite loop making Step = zero noEscape = 1 ' if this loop reaches its end while noEscape > 0, loop breaks free ranNum = Math.GetRandomNumber(35) ' Pick a random number ' Checks whether array already contains latest picked random number: If Array.ContainsValue(array, ranNum) Then noEscape = 0 ' If found so, do not let loop break free by setting noEscape back to zero EndIf EndFor array[index] = ranNum ' Now we know for sure it's a unique drawn number EndFor BB = Math.GetRandomNumber(35) 'draw the numbers xPos = 254 yPos = 152 For Index = 1 To 4 GraphicsWindow.DrawText(xPos, yPos, Array[Index]) xPos = xPos + 32 EndFor xPos = 208 yPos = 188 GraphicsWindow.DrawText(xPos, yPos, string3) xPos = 312 yPos = 224 GraphicsWindow.DrawText(xPos, yPos, BB) xPos = 272 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Play again??!?") While ("True") If (clicked <> "") Then If clicked = buttonYes Then Menu() EndIf If clicked = buttonNo Then QuitProgram() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'Texas2Step############################################################# Sub QuitProgram'############################################################ GraphicsWindow.Clear() buttonNoCopy = Controls.AddButton("NoCopy", 64, 364) Controls.SetSize(buttonNoCopy, 223 87) LDShapes.SetImage(buttonNoCopy,tag11) buttonYesCopy = Controls.AddButton("YesCopy", 351, 364) Controls.SetSize(buttonYesCopy, 223 87) LDShapes.SetImage(buttonYesCopy,tag12) xPos = 126 yPos = 30 GraphicsWindow.DrawText(xPos, yPos, "This is the") xPos = 208 yPos = 30 GraphicsWindow.DrawImage(tag08, xPos, yPos) xPos = 448 yPos = 102 GraphicsWindow.DrawText(xPos, yPos, "routine.") xPos = 264 yPos = 330 GraphicsWindow.DrawText(xPos, yPos, "Quit!! Really??!?") While ("True") If (clicked <> "") Then If clicked = buttonNoCopy Then Menu() EndIf If clicked = buttonYesCopy Then Program.End() EndIf clicked = "" EndIf Program.Delay(20) EndWhile EndSub'QuitProgram##################################################################### 'HANDLE BUTTON CLICK EVENT Sub OnButtonClicked clicked = Controls.LastClickedButton 'Just set a flag for the button clicked we handle in game loop EndSub End>RKF483.sb< Start>RKG014.sb< ' Rotating a triangle using GraphicsWindow.FillTriangle command GraphicsWindow.BrushColor="Red" x="1=100;2=215;3=260" y="1=200;2=120;3=200" cx=(X[3]+x[1])/2 cy=(y[3]+y[2])/2 If x[2]>cx Then PMrad="1:-1=1;-1:-1=-1;-1:1=1;1:1=1" ' 1:2:3:4: Else PMrad="1:-1=-1;-1:-1=1;-1:1=-1;1:1=-1" ' 1:2:3:4: EndIf addrad="1:-1=0;-1:-1=0;-1:1=3.14;1:1=6.284" ' 1:2:3:4: For i=1 To 3 Quadrant=(x[i]-cx)/Math.Abs(x[i]-cx)+":"+(y[i]-cy)/Math.Abs(y[i]-cy) rad[i]=PMrad[Quadrant]*Math.ArcTan((cy-y[i])/(cx-x[i]))+addrad[Quadrant] Len[i]=Math.SquareRoot((x[i]-cx)*(x[i]-cx)+(y[i]-cy)*(y[i]-cy)) maxlen= Math.Max(maxlen,Len[i]) EndFor GraphicsWindow.FillTriangle(x[1],y[1],x[2],y[2],x[3],y[3]) GraphicsWindow.BrushColor="white" GraphicsWindow.FillEllipse(cx-2,cy-2,4,4) ' center position Program.Delay(500) drad= Math.GetRadians(2) While "True" For i=1 To 3 rad[i]=rad[i]+drad x[i]=Len[i]*Math.Cos(rad[i])+cx+200 ' shift +200 y[i]=Len[i]*Math.sin(rad[i])+cy EndFor GraphicsWindow.BrushColor="Red" GraphicsWindow.FillTriangle(x[1],y[1],x[2],y[2],x[3],y[3]) GraphicsWindow.BrushColor="white" GraphicsWindow.FillEllipse(cx-2+200,cy-2,4,4) ' center position Program.Delay(50) GraphicsWindow.BrushColor="White" GraphicsWindow.FillRectangle(cx-maxlen+200,cy-maxlen,2*maxlen,2*maxlen) EndWhile End>RKG014.sb< Start>RKG481.sb< ' abcdef/abcd+ BZP946 begin: TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine("______________________ S T A R T ____________________________ ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" 01= ") numI=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 02= ") numII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 03= ") numIII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 04= ") numIV=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 05= ") numV=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 06= ") numVI=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 07= ") numVII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 08= ") numVIII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 09= ") numIX=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 10= ") numX=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 11= ") numXI=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 12= ") numXII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 13= ") numXIII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 14= ") numXIV=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 15= ") numXV=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 16= ") numXVI=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 17= ") numXVII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 18= ") numXVIII=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 19= ") numXIX=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" 20= ") numXX=TextWindow.ReadNumber() TextWindow.WriteLine(" ") start0: TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" mod= ") mod=TextWindow.ReadNumber() TextWindow.WriteLine(" ") start: TextWindow.WriteLine("__________________________________________________________________________ ") TextWindow.WriteLine(" ") TextWindow.Write(" (A) B C (D) E F [1 + Enter] A B C D [Enter] ") abc=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine("__________________________________________________________________________ ") If abc=0 Then Goto hop EndIf '============================= abcdef TextWindow.WriteLine(" ") TextWindow.Write(" (A)= ") a0=TextWindow.ReadNumber()' attn idem (a-z) ! TextWindow.WriteLine(" ") If a0=0 Then Goto start0 EndIf TextWindow.WriteLine(" ") TextWindow.Write(" B* = ") b0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" C* = ") c0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" (D)= ") d0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" E* = ") e0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" F* = ") f0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") at0XX=Math.Remainder(a0,100) atX00=(a0-at0XX)/100 at0X=Math.Remainder(at0XX,10) atX0=(at0XX-at0X)/10 at=Math.Remainder((atX00+atX0+at0X),mod) bt0X=Math.Remainder(b0,10) btX0=(b0-bt0X)/10 bt=Math.Remainder((btX0+bt0X),mod) ct0X=Math.Remainder(c0,10) ctX0=(c0-ct0X)/10 ct=Math.Remainder((ctX0+ct0X),mod) dt0XX=Math.Remainder(d0,100) dtX00=(d0-dt0XX)/100 dt0X=Math.Remainder(dt0XX,10) dtX0=(dt0XX-dt0X)/10 dt=Math.Remainder((dtX00+dtX0+dt0X),mod) et0X=Math.Remainder(e0,10) etX0=(e0-et0X)/10 et=Math.Remainder((etX0+et0X),mod) ft0X=Math.Remainder(f0,10) ftX0=(f0-ft0X)/10 ft=Math.Remainder((ftX0+ft0X),mod) '>>>>>>>>=========== (A) B C (D) E F ========>>>>>>>>> rr1Am=b0 rr1Af=e0 rr2Am=b0 rr2Af=et rr3Am=c0 rr3Af=f0 rr4Am=c0 rr4Af=ft rr5Am=ct rr5Af=f0 rr6Am=ct rr6Af=ft rr7Am=Math.Remainder((b0+c0),mod) rr7Af=Math.Remainder((e0+f0),mod) rr8Am=Math.Remainder((b0+ct),mod) rr8Af=Math.Remainder((e0+ft),mod) rr9Am=Math.Remainder((bt+c0),mod) rr9Af=Math.Remainder((et+f0),mod) rr10Am=Math.Remainder((bt+ct),mod) rr10Af=Math.Remainder((e0+f0),mod) rr11Am=e0 rr11Af=f0 rr12Am=et rr12Af=ft rr13Am=at rr13Af=dt rr14Am=Math.Remainder((a0+ct),mod) rr14Af=Math.Remainder((d0+ft),mod) rr15Am=Math.Remainder((at+c0),mod) rr15Af=Math.Remainder((dt+f0),mod) rr16Am=Math.Remainder((at+ct),mod) rr16Af=Math.Remainder((dt+ft),mod) rr1Bm=b0 rr1Bf=c0 rr2Bm=b0 rr2Bf=ct 'rr3Bm= 'rr3Bf= rr4Bm=e0 rr4Bf=ft rr5Bm=et rr5Bf=f0 'rr6Bm= 'rr6Bf= rr7Bm=Math.Remainder((b0+e0),mod) rr7Bf=Math.Remainder((c0+f0),mod) rr8Bm=Math.Remainder((b0+et),mod) rr8Bf=Math.Remainder((c0+ft),mod) rr9Bm=Math.Remainder((bt+e0),mod) rr9Bf=Math.Remainder((ct+f0),mod) rr10Bm=Math.Remainder((bt+et),mod) rr10Bf=Math.Remainder((c0+f0),mod) 'rr11Bm= 'rr11Bf= 'rr12Bm= 'rr12fB= 'rr13Bm= 'rr13Bf= rr14Bm=Math.Remainder((a0+et),mod) rr14Bf=Math.Remainder((d0+ft),mod) rr15Bm=Math.Remainder((at+e0),mod) rr15Bf=Math.Remainder((dt+f0),mod) rr16Bm=Math.Remainder((at+et),mod) rr16Bf=Math.Remainder((dt+ft),mod) rr1Cm=b0 rr1Cf=f0 rr2Cm=b0 rr2Cf=ft rr3Cm=e0 rr3Cf=c0 rr4Cm=e0 rr4Cf=ct rr5Cm=et rr5Cf=c0 rr6Cm=et rr6Cf=ct 'rr7Cm=Math.Remainder((+),mod) 'rr7Cf=Math.Remainder((+),mod) rr8Cm=Math.Remainder((b0+et),mod) rr8Cf=Math.Remainder((f0+ct),mod) rr9Cm=Math.Remainder((bt+e0),mod) rr9Cf=Math.Remainder((ft+c0),mod) 'rr10Cm=Math.Remainder((+),mod) 'rr10Cf=Math.Remainder((+),mod) 'rr11Cm= 'rr11Cf= 'rr12Cm= 'rr12Cf= 'rr13Cm= 'rr13Cf= rr14Cm=Math.Remainder((a0+et),mod) rr14Cf=Math.Remainder((d0+ct),mod) rr15Cm=Math.Remainder((at+e0),mod) rr15Cf=Math.Remainder((dt+c0),mod) rr16Cm=Math.Remainder((at+et),mod) rr16Cf=Math.Remainder((dt+ct),mod) Goto hopla '<<<<<<<<===========(A) B C (D) E F ========<<<<<<<<< '------------------------------------------------------------------------------------ hop: TextWindow.WriteLine(" ") TextWindow.Write(" A = ") a0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") If a0=0 Then Goto start0 EndIf TextWindow.WriteLine(" ") TextWindow.Write(" B = ") b0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" C = ") c0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" D = ") d0=TextWindow.ReadNumber() TextWindow.WriteLine(" ") at0X=Math.Remainder(a0,10) atX0=(a0-at0X)/10 at=Math.Remainder((atX0+at0X),mod) bt0X=Math.Remainder(b0,10) btX0=(b0-bt0X)/10 bt=Math.Remainder((btX0+bt0X),mod) ct0X=Math.Remainder(c0,10) ctX0=(c0-ct0X)/10 ct=Math.Remainder((ctX0+ct0X),mod) dt0X=Math.Remainder(d0,10) dtX0=(d0-dt0X)/10 dt=Math.Remainder((dtX0+dt0X),mod) '>>>>>>>>=========== A B C D ========>>>>>>>>> r1Am=a0 r1Af=c0 r2Am=a0 r2Af=ct r3Am=b0 r3Af=d0 r4Am=b0 r4Af=dt r5Am=bt r5Af=d0 r6Am=bt r6Af=dt r7Am=Math.Remainder((a0+b0),mod) r7Af=Math.Remainder((c0+d0),mod) r8Am=Math.Remainder((a0+bt),mod) r8Af=Math.Remainder((c0+dt),mod) r9Am=Math.Remainder((at+b0),mod) r9Af=Math.Remainder((ct+d0),mod) r10Am=Math.Remainder((at+bt),mod) r10Af=Math.Remainder((c0+d0),mod) r11Am=c0 r11Af=d0 r12Am=ct r12Af=dt r1Bm=a0 r1Bf=b0 r2Bm=a0 r2Bf=bt 'r3Bm= 'r3Bf= r4Bm=c0 r4Bf=dt r5Bm=ct r5Bf=d0 'r6Bm= 'r6Bf= r7Bm=Math.Remainder((a0+c0),mod) r7Bf=Math.Remainder((b0+d0),mod) r8Bm=Math.Remainder((a0+ct),mod) r8Bf=Math.Remainder((b0+dt),mod) r9Bm=Math.Remainder((at+c0),mod) r9Bf=Math.Remainder((bt+d0),mod) r10Bm=Math.Remainder((at+ct),mod) r10Bf=Math.Remainder((b0+d0),mod) 'r11Bm= 'r11Bf= 'r12Bm= 'r12Bf= r1Cm=a0 r1Cf=d0 r2Cm=a0 r2Cf=dt r3Cm=c0 r3Cf=b0 r4Cm=c0 r4Cf=bt r5Cm=ct r5Cf=b0 r6Cm=ct r6Cf=bt 'r7Cm=Math.Remainder((+),mod) 'r7Cf=Math.Remainder((+),mod) r8Cm=Math.Remainder((a0+ct),mod) r8Cf=Math.Remainder((d0+bt),mod) r9Cm=Math.Remainder((at+c0),mod) r9Cf=Math.Remainder((dt+b0),mod) 'r10Cm=Math.Remainder((+),mod) 'r10Cf=Math.Remainder((+),mod) 'r11Cm= 'r11Cf= 'r12Cm= 'r12Cf= hopla: '<<<<<<<<=========== A B C D ========<<<<<<<<< krok=-1 start1: '----------------------------------------------------- 'a=0 'b=0 'c=0 'd=0 'e=0 'f=0 'g=0 'h=0 'i=0 'j=0 'k=0 'l=0 'm=0 'n=0 'o=0 'p=0 'q=0 'r=0 's=0 't=0 'u=0 'v=0 'w=0 'x=0 'y=0 'z=0 'yy=0 'zz=0 '----------------------------------------------------- GrandAd=1000000000 nr=0 nbre=0 krok=krok+1 TextWindow.ForegroundColor="white" If abc=1 then 'TextWindow.WriteLine("[1= new 20 N°] [2= new 4/6 N°] ******* (A) B C (D) E F ******* [step "+krok+"/77]") TextWindow.Write("[1= new 20 N°] [2= new 4/6 N°] ***") TextWindow.ForegroundColor="darkcyan" TextWindow.Write(" ("+a0+")") res=b0 dix() TextWindow.Write(" "+b0) res=c0 dix() TextWindow.Write(" "+c0) TextWindow.Write(" ("+d0+")") res=e0 dix() TextWindow.Write(" "+e0) res=f0 dix() TextWindow.Write(" "+f0) TextWindow.ForegroundColor="white" TextWindow.WriteLine(" *** [step "+krok+"/76]") end= TextWindow.ReadNumber() Goto abcRR else 'TextWindow.WriteLine("[1= new 20 N°] [2= new 4/6 N°] ******* A - B - C - D ******* [step "+krok+"/57]") TextWindow.Write("[1= new 20 N°] [2= new 4/6 N°] ***") TextWindow.ForegroundColor="darkcyan" res=a0 dix() TextWindow.Write(" "+a0) res=b0 dix() TextWindow.Write(" "+b0) res=c0 dix() TextWindow.Write(" "+c0) res=d0 dix() TextWindow.Write(" "+d0) TextWindow.ForegroundColor="white" TextWindow.WriteLine(" *** [step "+krok+"/56]") end= TextWindow.ReadNumber() Goto abcR endif 'If end=1 then 'Goto begin 'EndIf '///////////////////////////////////////////////// M = > F= > /////// selon "abc" ^^^^ ////////////////////////////////////////////// abcRR: If end=1 then Goto begin EndIf If end=2 then Goto start endif If krok=0 then mm=rr1Am ff=rr1Af endif If krok=1 then mm=ff ff=mm endif If krok=2 then mm=rr2Am ff=rr2Af endif If krok=3 then mm=ff ff=mm endif If krok=4 then mm=rr3Am ff=rr3Af endif If krok=5 then mm=ff ff=mm endif If krok=6 then mm=rr4Am ff=rr4Af endif If krok=7 then mm=ff ff=mm endif If krok=8 then mm=rr5Am ff=rr5Af endif If krok=9 then mm=ff ff=mm endif If krok=10 then mm=rr6Am ff=rr6Af endif If krok=11 then mm=ff ff=mm endif If krok=12 then mm=rr7Am ff=rr7Af endif If krok=13 then mm=ff ff=mm endif If krok=14 then mm=rr8Am ff=rr8Af endif If krok=15 then mm=ff ff=mm endif If krok=16 then mm=rr9Am ff=rr9Af endif If krok=17 then mm=ff ff=mm endif If krok=18 then mm=rr10Am ff=rr10Af endif If krok=19 then mm=ff ff=mm endif If krok=20 then mm=rr11Am ff=rr11Af endif If krok=21 then mm=ff ff=mm endif If krok=22 then mm=rr12Am ff=rr12Af endif If krok=23 then mm=ff ff=mm endif If krok=24 then mm=rr13Am ff=rr13Af endif If krok=25 then mm=ff ff=mm endif If krok=26 then mm=rr14Am ff=rr14Af endif If krok=27 then mm=ff ff=mm endif If krok=28 then mm=rr15Am ff=rr15Af endif If krok=29 then mm=ff ff=mm endif If krok=30 then mm=rr16Am ff=rr16Af endif If krok=31 then mm=ff ff=mm endif If krok=32 then mm=rr1Bm ff=rr1Bf endif If krok=33 then mm=ff ff=mm endif If krok=34 then mm=rr2Bm ff=rr2Bf endif If krok=35 then mm=ff ff=mm endif If krok=36 then mm=rr4Bm ff=rr4Bf endif If krok=37 then mm=ff ff=mm endif If krok=38 then mm=rr5Bm ff=rr5Bf endif If krok=39 then mm=ff ff=mm endif If krok=40 then mm=rr7Bm ff=rr7Bf endif If krok=41 then mm=ff ff=mm endif If krok=42 then mm=rr8Bm ff=rr8Bf endif If krok=43 then mm=ff ff=mm endif If krok=44 then mm=rr9Bm ff=rr9Bf endif If krok=45 then mm=ff ff=mm endif If krok=46 then mm=rr10Bm ff=rr10Bf endif If krok=47 then mm=ff ff=mm endif If krok=48 then mm=rr14Bm ff=rr14Bf endif If krok=49 then mm=ff ff=mm endif If krok=50 then mm=rr15Bm ff=rr15Bf endif If krok=51 then mm=ff ff=mm endif If krok=52 then mm=rr16Bm ff=rr16Bf endif If krok=53 then mm=ff ff=mm endif If krok=54 then mm=rr1Cm ff=rr1Cf endif If krok=55 then mm=ff ff=mm endif If krok=56 then mm=rr2Cm ff=rr2Cf endif If krok=57 then mm=ff ff=mm endif If krok=58 then mm=rr3Cm ff=rr3Cf endif If krok=59 then mm=ff ff=mm endif If krok=60 then mm=rr4Cm ff=rr4Cf endif If krok=61 then mm=ff ff=mm endif If krok=62 then mm=rr5Cm ff=rr5Cf endif If krok=63 then mm=ff ff=mm endif If krok=64 then mm=rr6Cm ff=rr6Cf endif If krok=65 then mm=ff ff=mm endif If krok=66 then mm=rr8Cm ff=rr8Cf endif If krok=67 then mm=ff ff=mm endif If krok=68 then mm=rr9Cm ff=rr9Cf endif If krok=69 then mm=ff ff=mm endif If krok=70 then mm=rr14Cm ff=rr14Cf endif If krok=71 then mm=ff ff=mm endif If krok=72 then mm=rr15Cm ff=rr15Cf endif If krok=73 then mm=ff ff=mm endif If krok=74 then mm=rr16Cm ff=rr16Cf endif If krok=75 then mm=ff ff=mm endif If krok=76 then Goto start endif Goto jump '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// abcR: If end=1 then Goto begin EndIf If end=2 then Goto start endif If krok=0 then mm=r1Am ff=r1Af endif If krok=1 then mm=ff ff=mm endif If krok=2 then mm=r2Am ff=r2Af endif If krok=3 then mm=ff ff=mm endif If krok=4 then mm=r3Am ff=r3Af endif If krok=5 then mm=ff ff=mm endif If krok=6 then mm=r4Am ff=r4Af endif If krok=7 then mm=ff ff=mm endif If krok=8 then mm=r5Am ff=r5Af endif If krok=9 then mm=ff ff=mm endif If krok=10 then mm=r6Am ff=r6Af endif If krok=11 then mm=ff ff=mm endif If krok=12 then mm=r7Am ff=r7Af endif If krok=13 then mm=ff ff=mm endif If krok=14 then mm=r8Am ff=r8Af endif If krok=15 then mm=ff ff=mm endif If krok=16 then mm=r9Am ff=r9Af endif If krok=17 then mm=ff ff=mm endif If krok=18 then mm=r10Am ff=r10Af endif If krok=19 then mm=ff ff=mm endif If krok=20 then mm=r11Am ff=r11Af endif If krok=21 then mm=ff ff=mm endif If krok=22 then mm=r12Am ff=r12Af endif If krok=23 then mm=ff ff=mm endif If krok=24 then mm=r1Bm ff=r1Bf endif If krok=25 then mm=ff ff=mm endif If krok=26 then mm=r2Bm ff=r2Bf endif If krok=27 then mm=ff ff=mm endif If krok=28 then mm=r4Bm ff=r4Bf endif If krok=29 then mm=ff ff=mm endif If krok=30 then mm=r5Bm ff=r5Bf endif If krok=31 then mm=ff ff=mm endif If krok=32 then mm=r7Bm ff=r7Bf endif If krok=33 then mm=ff ff=mm endif If krok=34 then mm=r8Bm ff=r8Bf endif If krok=35 then mm=ff ff=mm endif If krok=36 then mm=r9Bm ff=r9Bf endif If krok=37 then mm=ff ff=mm endif If krok=38 then mm=r10Bm ff=r10Bf endif If krok=39 then mm=ff ff=mm endif If krok=40 then mm=r1Cm ff=r1Cf endif If krok=41 then mm=ff ff=mm endif If krok=42 then mm=r2Cm ff=r2Cf endif If krok=43 then mm=ff ff=mm endif If krok=44 then mm=r3Cm ff=r3Cf endif If krok=45 then mm=ff ff=mm endif If krok=46 then mm=r4Cm ff=r4Cf endif If krok=47 then mm=ff ff=mm endif If krok=48 then mm=r5Cm ff=r5Cf endif If krok=49 then mm=ff ff=mm endif If krok=50 then mm=r6Cm ff=r6Cf endif If krok=51 then mm=ff ff=mm endif If krok=52 then mm=r8Cm ff=r8Cf endif If krok=53 then mm=ff ff=mm endif If krok=54 then mm=r9Cm ff=r9Cf endif If krok=55 then mm=ff ff=mm endif If krok=56 then Goto start endif '///////////////////////////////////////////////// M = < F= < ///////////////////////////////////////////////////////////////////////// jump: TextWindow.WriteLine(" ") 'TextWindow.WriteLine(" A B C D E F G H I J K L") TextWindow.WriteLine(" x o A B C D E F G H I J K L") TextWindow.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") '-------------------------------------------------- start2: nbre=nbre+1 '------------------------------------------------- a= Math.Remainder((mm+ff),mod) fft0XX=Math.Remainder(ff,100) fftX00=(ff-fft0XX)/100 fft0X=Math.Remainder(fft0XX,10) fftX0=(fft0XX-fft0X)/10 'ft1=Math.Remainder(ff,10) 'ft2=(ff-ft1)/10 'ft3= Math.Remainder((ft1+ft2),mod) graM() b=Math.Remainder((mm+ft3),mod) '------------------------------------------------ at1=Math.Remainder(a,10) at2=(a-at1)/10 'at3=Math.Remainder((at1+at2),mod) graF() c=Math.Remainder((b+at3),mod) '------------------------------------------------ d=Math.Remainder((b+c),mod) '************************************** tA - tB - tC - tD ************************** t1A=Math.Remainder(a,10) t2A=(a-t1A)/10 tA= Math.Remainder((t1A+t2A),mod) '------------------------------------------------ t1B=Math.Remainder(b,10) t2B=(b-t1B)/10 tB= Math.Remainder((t1B+t2B),mod) '------------------------------------------------ t1C=Math.Remainder(c,10) t2C=(c-t1C)/10 tC= Math.Remainder((t1C+t2C),mod) '------------------------------------------------ t1D=Math.Remainder(d,10) t2D=(d-t1D)/10 tD= Math.Remainder((t1D+t2D),mod) '--------------------------------------- ligne a-b --------- e=Math.Remainder(a + c,mod) f=Math.Remainder(a + tC,mod) g=Math.Remainder(tA + c,mod) h=Math.Remainder(tA + tC,mod) i=Math.Remainder(a + b,mod) j=Math.Remainder(a + tB,mod) k=Math.Remainder(tA + b,mod) l=Math.Remainder(tA + tB,mod) m=Math.Remainder(a + d,mod) n=Math.Remainder(a + tD,mod) o=Math.Remainder(tA + d,mod) p=Math.Remainder(tA + tD,mod) '---------------------------------------- ligne c-d -------- q=Math.Remainder(b + d,mod) r=Math.Remainder(b + tD,mod) s=Math.Remainder(tB + d,mod) t=Math.Remainder(tB + tD,mod) u=Math.Remainder(c + d,mod) v=Math.Remainder(c + tD,mod) w=Math.Remainder(tC + d,mod) x=Math.Remainder(tC + tD,mod) y=Math.Remainder(b + c,mod) z=Math.Remainder(b + tC,mod) yy=Math.Remainder(tB + c,mod) zz=Math.Remainder(tB + tC,mod) '***************************************************************************** '------------- IF a-b-c-d = IDEM------->>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> idem1=100+a idem2=100+b idem3=100+c idem4=100+d Ad=1000000000*idem1+1000000*idem2+1000*idem3+idem4 If Text.IsSubText(GrandAd,Ad)="true" then Goto start1 endif GrandAd=Text.Append(GrandAd,Ad) '--------------IF a-b-c-d =IDEM-------<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< nr=nr+1 TextWindow.ForegroundColor="cyan" If nr<10 then TextWindow.Write(" ") EndIf TextWindow.Write(nr+". ") res=a coul() TextWindow.Write(a+" ") res=b coul() TextWindow.Write(b+" ") '******************************************************************************* res=e coul() TextWindow.Write(e +" ") res=f coul() TextWindow.Write(f +" ") res=g coul() TextWindow.Write(g +" ") res=h coul() TextWindow.Write(h +" ") res=i coul() TextWindow.Write(i +" ") res=j coul() TextWindow.Write(j +" ") res=k coul() TextWindow.Write(k +" ") res=l coul() TextWindow.Write(l +" ") res=m coul() TextWindow.Write(m +" ") res=n coul() TextWindow.Write(n +" ") res=o coul() TextWindow.Write(o +" ") res=p coul() TextWindow.WriteLine(p) TextWindow.WriteLine(" ") '******************************************************************************* nr=nr+1 TextWindow.ForegroundColor="cyan" If nr<10 then TextWindow.Write(" ") EndIf TextWindow.Write(nr+". ") res=c coul() TextWindow.Write(c+" ") res=d coul() TextWindow.Write(d+" ") '******************************************************************************* res=q coul() TextWindow.Write(q +" ") res=r coul() TextWindow.Write(r +" ") res=s coul() TextWindow.Write(s +" ") res=t coul() TextWindow.Write(t +" ") res=u coul() TextWindow.Write(u +" ") res=v coul() TextWindow.Write(v +" ") res=w coul() TextWindow.Write(w +" ") res=x coul() TextWindow.Write(x +" ") res=y coul() TextWindow.Write(y +" ") res=z coul() TextWindow.Write(z +" ") res=yy coul() TextWindow.Write(yy +" ") res=zz coul() TextWindow.WriteLine(zz) '******************************************************************************* TextWindow.WriteLine(" ") '------------------------------------------------ mm=c ff=d '----------------------------------------------- If nbre<15 Then Goto start2 Else TextWindow.ForegroundColor="white" Goto start1 EndIf '---------------------------------------------------- Sub graM If mm<10 Then ft3=mm Else 'ft3= Math.Remainder((ft1+ft2),mod) ft3=Math.Remainder((fftX00+fftX0+fft0X),mod) EndIf EndSub '============== Sub graF If ff<10 Then at3=ff Else at3=Math.Remainder((at1+at2),mod) EndIf EndSub '=================================== Sub coul dix() If res=numI Then TextWindow.ForegroundColor="yellow" Else TextWindow.ForegroundColor="white" If res=numII Or res=numIII Or res=numIV Or res=numV Or res=numVI Or res=numVII Or res=numVIII Or res=numIX Or res=numX Or res=numXI Or res=numXII Or res=numXIII Or res=numXIV Or res=numXV Or res=numXVI Or res=numXVII Or res=numXVIII Or res=numXIX Or res=numXX Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="white" EndIf EndIf EndSub '==================================== Sub dix If res<10 Then TextWindow.Write(" ") EndIf EndSub '==================================== End>RKG481.sb< Start>RKG853.sb< start: TLCH=0 TLFR=0 TLHUM=0 TLSEC=0 chf=0 suite=0 countMod=0 For king=1 To mod bis[king]=0 EndFor TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine("*****************************************************************************") iter=0 TextWindow.Write(" A = ") n1= TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" B = ") n2= TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" C = ") n3= TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" D = ") n4= TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" mod = ") mod= TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine("_____________________________________________________________________________ ") TextWindow.Write(" [TEL-QUEL] = Enter [plus 1] = 1 & Enter [moins 1] = 2 & Enter ") plusmin=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.Write(" [REAL]= 1 + Enter [VERIF]= Enter ") vr=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If vr=1 Then Goto go EndIf TextWindow.Write(" Enter RES: (No. 1): > ") nr1=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 2): > ") nr2=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 3): > ") nr3=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 4): > ") nr4=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 5): > ") nr5=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 6): > ") nr6=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 7): > ") nr7=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 8): > ") nr8=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No. 9): > ") nr9=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.10): > ") nr10=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.11): > ") nr11=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.12): > ") nr12=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.13): > ") nr13=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.14): > ") nr14=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.15): > ") nr15=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.16): > ") nr16=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.17): > ") nr17=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.18): > ") nr18=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.19): > ") nr19=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.Write(" (No.20): > ") nr20=TextWindow.ReadNumber() TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") go: TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") iter=iter+1 If plusmin=0 Then Goto plusmin0 EndIf If plusmin=1 Then Goto plusmin1 EndIf If plusmin=2 Then Goto plusmin2 EndIf '////////////////////////// T.Q. ///////////////////////////////////////// plusmin0: a=Math.Remainder((n1 +n2 ),mod) If a=0 Then a=mod EndIf b=Math.Remainder((n2 +n3 ),mod) If b=0 Then b=mod EndIf c=Math.Remainder((n3 +n4 ),mod) If c=0 Then c=mod EndIf d=Math.Remainder((n4 +n1 ),mod) If d=0 Then d=mod EndIf e=Math.Remainder((n1 +n2 ),9) If e=0 Then e=9 EndIf f=Math.Remainder((n2 +n3 ),9) If f=0 Then f=9 EndIf g=Math.Remainder((n3 +n4 ),9) If g=0 Then g=9 EndIf h=Math.Remainder((n4 +n1 ),9) If h=0 Then h=9 EndIf i=Math.Remainder((a +e ),mod) If i=0 Then i=mod EndIf j=Math.Remainder((b +f ),mod) If j=0 Then j=mod EndIf k=Math.Remainder((c +g ),mod) If k=0 Then k=mod EndIf l=Math.Remainder((d +h ),mod) If l=0 Then l=mod EndIf m=Math.Remainder((l +i ),mod) If m=0 Then m=mod EndIf n=Math.Remainder((i +j ),mod) If n=0 Then n=mod EndIf o=Math.Remainder((j +k ),mod) If o=0 Then o=mod EndIf p=Math.Remainder((k +l ),mod) If p=0 Then p=mod EndIf q=Math.Remainder((m +n ),mod) If q=0 Then q=mod EndIf r=Math.Remainder((n +o ),mod) If r=0 Then r=mod EndIf s=Math.Remainder((o +p ),mod) If s=0 Then s=mod EndIf t=Math.Remainder((p +m ),mod) If t=0 Then t=mod EndIf u=Math.Remainder((t +q ),mod) If u=0 Then u=mod EndIf v=Math.Remainder((q +r ),mod) If v=0 Then v=mod EndIf w=Math.Remainder((r +s ),mod) If w=0 Then w=mod EndIf x=Math.Remainder((s +t ),mod) If x=0 Then x=mod EndIf y=Math.Remainder((n +p ),mod) If y=0 Then y=mod EndIf z=Math.Remainder((v +x ),mod) If z=0 Then z=mod EndIf Goto hop '======================================== moins 1 ========== plusmin2: TextWindow.ForegroundColor="magenta" TextWindow.WriteLine(" ////////////////// V A L E U R S moins 1 //////////////////////") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") a=Math.Remainder((n1 +n2 +mod-1 ),mod) If a=0 Then a=mod EndIf b=Math.Remainder((n2 +n3 +mod-1 ),mod) If b=0 Then b=mod EndIf c=Math.Remainder((n3 +n4 +mod-1 ),mod) If c=0 Then c=mod EndIf d=Math.Remainder((n4 +n1 +mod-1 ),mod) If d=0 Then d=mod EndIf e=Math.Remainder((n1 +n2 +mod-1 ),9) If e=0 Then e=9 EndIf f=Math.Remainder((n2 +n3 +mod-1 ),9) If f=0 Then f=9 EndIf g=Math.Remainder((n3 +n4 +mod-1 ),9) If g=0 Then g=9 EndIf h=Math.Remainder((n4 +n1 +mod-1 ),9) If h=0 Then h=9 EndIf i=Math.Remainder((a +e +mod-1 ),mod) If i=0 Then i=mod EndIf j=Math.Remainder((b +f +mod-1 ),mod) If j=0 Then j=mod EndIf k=Math.Remainder((c +g +mod-1 ),mod) If k=0 Then k=mod EndIf l=Math.Remainder((d +h +mod-1 ),mod) If l=0 Then l=mod EndIf m=Math.Remainder((l +i +mod-1 ),mod) If m=0 Then m=mod EndIf n=Math.Remainder((i +j +mod-1 ),mod) If n=0 Then n=mod EndIf o=Math.Remainder((j +k +mod-1 ),mod) If o=0 Then o=mod EndIf p=Math.Remainder((k +l +mod-1 ),mod) If p=0 Then p=mod EndIf q=Math.Remainder((m +n +mod-1 ),mod) If q=0 Then q=mod EndIf r=Math.Remainder((n +o +mod-1 ),mod) If r=0 Then r=mod EndIf s=Math.Remainder((o +p +mod-1 ),mod) If s=0 Then s=mod EndIf t=Math.Remainder((p +m +mod-1 ),mod) If t=0 Then t=mod EndIf u=Math.Remainder((t +q +mod-1 ),mod) If u=0 Then u=mod EndIf v=Math.Remainder((q +r +mod-1 ),mod) If v=0 Then v=mod EndIf w=Math.Remainder((r +s +mod-1 ),mod) If w=0 Then w=mod EndIf x=Math.Remainder((s +t +mod-1 ),mod) If x=0 Then x=mod EndIf y=Math.Remainder((n +p +mod-1 ),mod) If y=0 Then y=mod EndIf z=Math.Remainder((v +x +mod-1 ),mod) If z=0 Then z=mod EndIf Goto hop '======================================== plus 1 =========== plusmin1: TextWindow.ForegroundColor="cyan" TextWindow.WriteLine(" ////////////////////// V A L E U R S plus 1 /////////////////////// ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") a=Math.Remainder((n1 +n2 +1),mod) If a=0 Then a=mod EndIf b=Math.Remainder((n2 +n3 +1),mod) If b=0 Then b=mod EndIf c=Math.Remainder((n3 +n4 +1 ),mod) If c=0 Then c=mod EndIf d=Math.Remainder((n4 +n1 +1 ),mod) If d=0 Then d=mod EndIf e=Math.Remainder((n1 +n2 +1 ),9) If e=0 Then e=9 EndIf f=Math.Remainder((n2 +n3 +1 ),9) If f=0 Then f=9 EndIf g=Math.Remainder((n3 +n4 +1 ),9) If g=0 Then g=9 EndIf h=Math.Remainder((n4 +n1 +1 ),9) If h=0 Then h=9 EndIf i=Math.Remainder((a +e +1 ),mod) If i=0 Then i=mod EndIf j=Math.Remainder((b +f +1 ),mod) If j=0 Then j=mod EndIf k=Math.Remainder((c +g +1 ),mod) If k=0 Then k=mod EndIf l=Math.Remainder((d +h +1 ),mod) If l=0 Then l=mod EndIf m=Math.Remainder((l +i +1 ),mod) If m=0 Then m=mod EndIf n=Math.Remainder((i +j +1 ),mod) If n=0 Then n=mod EndIf o=Math.Remainder((j +k +1 ),mod) If o=0 Then o=mod EndIf p=Math.Remainder((k +l +1 ),mod) If p=0 Then p=mod EndIf q=Math.Remainder((m +n +1 ),mod) If q=0 Then q=mod EndIf r=Math.Remainder((n +o +1 ),mod) If r=0 Then r=mod EndIf s=Math.Remainder((o +p +1 ),mod) If s=0 Then s=mod EndIf t=Math.Remainder((p +m +1 ),mod) If t=0 Then t=mod EndIf u=Math.Remainder((t +q +1 ),mod) If u=0 Then u=mod EndIf v=Math.Remainder((q +r +1 ),mod) If v=0 Then v=mod EndIf w=Math.Remainder((r +s +1 ),mod) If w=0 Then w=mod EndIf x=Math.Remainder((s +t +1 ),mod) If x=0 Then x=mod EndIf y=Math.Remainder((n +p +1 ),mod) If y=0 Then y=mod EndIf z=Math.Remainder((v +x +1 ),mod) If z=0 Then z=mod EndIf '======================================== ici fin plus 1======== hop: If nr1=u Or nr2 =u Or nr3=u Or nr4=u Or nr5=u Or nr6=u Or nr7=u Or nr8=u Or nr9=u Or nr10=u Or nr11=u Or nr12 =u Or nr13=u Or nr14=u Or nr15=u Or nr16=u Or nr17=u Or nr18=u Or nr19=u Or nr20=u Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+u) If nr1=q Or nr2 =q Or nr3=q Or nr4=q Or nr5=q Or nr6=q Or nr7=q Or nr8=q Or nr9=q Or nr10=q Or nr11=q Or nr12 =q Or nr13=q Or nr14=q Or nr15=q Or nr16=q Or nr17=q Or nr18=q Or nr19=q Or nr20=q Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+q) If nr1=v Or nr2 =v Or nr3=v Or nr4=v Or nr5=v Or nr6=v Or nr7=v Or nr8=v Or nr9=v Or nr10=v Or nr11=v Or nr12 =v Or nr13=v Or nr14=v Or nr15=v Or nr16=v Or nr17=v Or nr18=v Or nr19=v Or nr20=v Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+v) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=m Or nr2 =m Or nr3=m Or nr4=m Or nr5=m Or nr6=m Or nr7=m Or nr8=m Or nr9=m Or nr10=m Or nr11=m Or nr12 =m Or nr13=m Or nr14=m Or nr15=m Or nr16=m Or nr17=m Or nr18=m Or nr19=m Or nr20=m Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+m) If nr1=i Or nr2 =i Or nr3=i Or nr4=i Or nr5=i Or nr6=i Or nr7=i Or nr8=i Or nr9=i Or nr10=i Or nr11=i Or nr12 =i Or nr13=i Or nr14=i Or nr15=i Or nr16=i Or nr17=i Or nr18=i Or nr19=i Or nr20=i Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+i) If nr1=n Or nr2 =n Or nr3=n Or nr4=n Or nr5=n Or nr6=n Or nr7=n Or nr8=n Or nr9=n Or nr10=n Or nr11=n Or nr12=n Or nr13=n Or nr14=n Or nr15=n Or nr16=n Or nr17=n Or nr18=n Or nr19=n Or nr20=n Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+n) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=e Or nr2 =e Or nr3=e Or nr4=e Or nr5=e Or nr6=e Or nr7=e Or nr8=e Or nr9=e Or nr10=e Or nr11=e Or nr12 =e Or nr13=e Or nr14=e Or nr15=e Or nr16=e Or nr17=e Or nr18=e Or nr19=e Or nr20=e Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+e) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=a Or nr2=a Or nr3=a Or nr4=a Or nr5=a Or nr6=a Or nr7=a Or nr8=a Or nr9=a Or nr10=a Or nr11=a Or nr12=a Or nr13=a Or nr14=a Or nr15=a Or nr16=a Or nr17=a Or nr18=a Or nr19=a Or nr20=a Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+a) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=t Or nr2=t Or nr3=t Or nr4=t Or nr5=t Or nr6=t Or nr7=t Or nr8=t Or nr9=t Or nr10=t Or nr11=t Or nr12=t Or nr13=t Or nr14=t Or nr15=t Or nr16=t Or nr17=t Or nr18=t Or nr19=t Or nr20=t Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+t) If nr1=l Or nr2=l Or nr3=l Or nr4=l Or nr5=l Or nr6=l Or nr7=l Or nr8=l Or nr9=l Or nr10=l Or nr11=l Or nr12=l Or nr13=l Or nr14=l Or nr15=l Or nr16=l Or nr17=l Or nr18=l Or nr19=l Or nr20=l Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+l) If nr1=h Or nr2=h Or nr3=h Or nr4=h Or nr5=h Or nr6=h Or nr7=h Or nr8=h Or nr9=h Or nr10=h Or nr11=h Or nr12=h Or nr13=h Or nr14=h Or nr15=h Or nr16=h Or nr17=h Or nr18=h Or nr19=h Or nr20=h Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+h) If nr1=d Or nr2=d Or nr3=d Or nr4=d Or nr5=d Or nr6=d Or nr7=d Or nr8=d Or nr9=d Or nr10=d Or nr11=d Or nr12=d Or nr13=d Or nr14=d Or nr15=d Or nr16=d Or nr17=d Or nr18=d Or nr19=d Or nr20=d Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+d) If nr1=b Or nr2=b Or nr3=b Or nr4=b Or nr5=b Or nr6=b Or nr7=b Or nr8=b Or nr9=b Or nr10=b Or nr11=b Or nr12=b Or nr13=b Or nr14=b Or nr15=b Or nr16=b Or nr17=b Or nr18=b Or nr19=b Or nr20=b Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+b) If nr1=f Or nr2=f Or nr3=f Or nr4=f Or nr5=f Or nr6=f Or nr7=f Or nr8=f Or nr9=f Or nr10=f Or nr11=f Or nr12=f Or nr13=f Or nr14=f Or nr15=f Or nr16=f Or nr17=f Or nr18=f Or nr19=f Or nr20=f Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+f) If nr1=j Or nr2=j Or nr3=j Or nr4=j Or nr5=j Or nr6=j Or nr7=j Or nr8=j Or nr9=j Or nr10=j Or nr11=j Or nr12=j Or nr13=j Or nr14=j Or nr15=j Or nr16=j Or nr17=j Or nr18=j Or nr19=j Or nr20=j Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+j) If nr1=r Or nr2=r Or nr3=r Or nr4=r Or nr5=r Or nr6=r Or nr7=r Or nr8=r Or nr9=r Or nr10=r Or nr11=r Or nr12=r Or nr13=r Or nr14=r Or nr15=r Or nr16=r Or nr17=r Or nr18=r Or nr19=r Or nr20=r Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+r) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=c Or nr2=c Or nr3=c Or nr4=c Or nr5=c Or nr6=c Or nr7=c Or nr8=c Or nr9=c Or nr10=c Or nr11=c Or nr12=c Or nr13=c Or nr14=c Or nr15=c Or nr16=c Or nr17=c Or nr18=c Or nr19=c Or nr20=c Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+c) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=g Or nr2=g Or nr3=g Or nr4=g Or nr5=g Or nr6=g Or nr7=g Or nr8=g Or nr9=g Or nr10=g Or nr11=g Or nr12=g Or nr13=g Or nr14=g Or nr15=g Or nr16=g Or nr17=g Or nr18=g Or nr19=g Or nr20=g Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+g) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=p Or nr2=p Or nr3=p Or nr4=p Or nr5=p Or nr6=p Or nr7=p Or nr8=p Or nr9=p Or nr10=p Or nr11=p Or nr12=p Or nr13=p Or nr14=p Or nr15=p Or nr16=p Or nr17=p Or nr18=p Or nr19=p Or nr20=p Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+p) If nr1=k Or nr2=k Or nr3=k Or nr4=k Or nr5=k Or nr6=k Or nr7=k Or nr8=k Or nr9=k Or nr10=k Or nr11=k Or nr12=k Or nr13=k Or nr14=k Or nr15=k Or nr16=k Or nr17=k Or nr18=k Or nr19=k Or nr20=k Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+k) If nr1=o Or nr2=o Or nr3=o Or nr4=o Or nr5=o Or nr6=o Or nr7=o Or nr8=o Or nr9=o Or nr10=o Or nr11=o Or nr12=o Or nr13=o Or nr14=o Or nr15=o Or nr16=o Or nr17=o Or nr18=o Or nr19=o Or nr20=o Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+o) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") If nr1=x Or nr2=x Or nr3=x Or nr4=x Or nr5=x Or nr6=x Or nr7=x Or nr8=x Or nr9=x Or nr10=x Or nr11=x Or nr12=x Or nr13=x Or nr14=x Or nr15=x Or nr16=x Or nr17=x Or nr18=x Or nr19=x Or nr20=x Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+x) If nr1=s Or nr2=s Or nr3=s Or nr4=s Or nr5=s Or nr6=s Or nr7=s Or nr8=s Or nr9=s Or nr10=s Or nr11=s Or nr12=s Or nr13=s Or nr14=s Or nr15=s Or nr16=s Or nr17=s Or nr18=s Or nr19=s Or nr20=s Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+s) If nr1=w Or nr2=w Or nr3=w Or nr4=w Or nr5=w Or nr6=w Or nr7=w Or nr8=w Or nr9=w Or nr10=w Or nr11=w Or nr12=w Or nr13=w Or nr14=w Or nr15=w Or nr16=w Or nr17=w Or nr18=w Or nr19=w Or nr20=w Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" "+w) TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.ForegroundColor="white" preIter=iter-1 TextWindow.Write(" this: ["+preIter+"]") TextWindow.WriteLine(" next: ["+iter+"]") '/////////////////////////////////////////////////////////////////////////// TextWindow.Write(" ") If nr1=y Or nr2=y Or nr3=y Or nr4=y Or nr5=y Or nr6=y Or nr7=y Or nr8=y Or nr9=y Or nr10=y Or nr11=y Or nr12=y Or nr13=y Or nr14=y Or nr15=y Or nr16=y Or nr17=y Or nr18=y Or nr19=y Or nr20=y Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.Write(" ("+y) If nr1=z Or nr2=z Or nr3=z Or nr4=z Or nr5=z Or nr6=z Or nr7=z Or nr8=z Or nr9=z Or nr10=z Or nr11=z Or nr12=z Or nr13=z Or nr14=z Or nr15=z Or nr16=z Or nr17=z Or nr18=z Or nr19=z Or nr20=z Then TextWindow.ForegroundColor="red" Else TextWindow.ForegroundColor="yellow" EndIf TextWindow.WriteLine("/"+z+")") '/////////////////////////////////////////////////////////////////////////// n1orig=n1 n2orig=n2 n3orig=n3 n4orig=n4 n1=u n2=v n3=w n4=x TextWindow.ForegroundColor="black" TextWindow.BackgroundColor="white" TextWindow.Write(" A-B-C-D : "+n1orig) TextWindow.Write(" "+n2orig) TextWindow.Write(" "+n3orig) TextWindow.Write(" "+n4orig) TextWindow.Write(" >>> ") TextWindow.Write("A-B-C-D : "+n1) TextWindow.Write(" "+n2) TextWindow.Write(" "+n3) TextWindow.Write(" "+n4+" ") TextWindow.BackgroundColor="black" TextWindow.ForegroundColor="white" TextWindow.WriteLine(" ") 'TextWindow.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ") nbre=26 TextWindow.WriteLine(" ") For xi= 1 To nbre No[1]=a No[2]=b No[3]=c No[4]=d No[5]=e No[6]=f No[7]=g No[8]=h No[9]=i No[10]=j No[11]=k No[12]=l No[13]=m No[14]=n No[15]=o No[16]=p No[17]=q No[18]=r No[19]=s No[20]=t No[21]=u No[22]=v No[23]=w No[24]=x No[25]=y No[26]=z EndFor TextWindow.WriteLine(" ") For xi=1 To nbre-1 For xj= nbre-1 To xi Step-1 If No [xj+1]No[xi+1] Then suite=suite+1 EndIf '***************************************************************************************** ! ! ! sumNew !!! prov coef=0 coef1=0 coef2=0 coef3=0 ' coef1=Math.Power(sumNew,2)/show ' coef2=Math.Power(sumNew,2)/suite 'coef3=Math.SquareRoot(Math.Power(coef1,2)+Math.Power(coef2,2))/sumNew 'coef3=coef1/coef2 '******************************************************************************************* TextWindow.ForegroundColor="blue" If No[xi]<>No[xi+1] Then TextWindow.Write(" "+show) TextWindow.ForegroundColor="cyan" TextWindow.Write(" "+suite) TextWindow.ForegroundColor="red" '----------------------------------------------------------------------------------------------------------------------- If No[xi]=1 Then bon1=bon1+1+newIx TextWindow.Write(" "+bon1+"x") ElseIf No[xi]=2 Then bon2=bon2+1+newIx TextWindow.Write(" "+bon2+"x") ElseIf No[xi]=3 Then bon3=bon3+1+newIx TextWindow.Write(" "+bon3+"x") ElseIf No[xi]=4 Then bon4=bon4+1+newIx TextWindow.Write(" "+bon4+"x") ElseIf No[xi]=5 Then bon5=bon5+1+newIx TextWindow.Write(" "+bon5+"x") ElseIf No[xi]=6 Then bon6=bon6+1+newIx TextWindow.Write(" "+bon6+"x") ElseIf No[xi]=7 Then bon7=bon7+1+newIx TextWindow.Write(" "+bon7+"x") ElseIf No[xi]=8 Then bon8=bon8+1+newIx TextWindow.Write(" "+bon8+"x") ElseIf No[xi]=9 Then bon9=bon9+1+newIx TextWindow.Write(" "+bon9+"x") ElseIf No[xi]=10 Then bon10=bon10+1+newIx TextWindow.Write(" "+bon10+"x") ElseIf No[xi]=11 Then bon11=bon11+1+newIx TextWindow.Write(" "+bon11+"x") ElseIf No[xi]=12 Then bon12=bon12+1+newIx TextWindow.Write(" "+bon12+"x") ElseIf No[xi]=13 Then bon13=bon13+1+newIx TextWindow.Write(" "+bon13+"x") ElseIf No[xi]=14 Then bon14=bon14+1+newIx TextWindow.Write(" "+bon14+"x") ElseIf No[xi]=15 Then bon15=bon15+1+newIx TextWindow.Write(" "+bon15+"x") ElseIf No[xi]=16 Then bon16=bon16+1+newIx TextWindow.Write(" "+bon16+"x") ElseIf No[xi]=17 Then bon17=bon17+1+newIx TextWindow.Write(" "+bon17+"x") ElseIf No[xi]=18 Then bon18=bon18+1+newIx TextWindow.Write(" "+bon18+"x") ElseIf No[xi]=19 Then bon19=bon19+1+newIx TextWindow.Write(" "+bon19+"x") ElseIf No[xi]=20 Then bon20=bon20+1+newIx TextWindow.Write(" "+bon20+"x") ElseIf No[xi]=21 Then bon21=bon21+1+newIx TextWindow.Write(" "+bon21+"x") ElseIf No[xi]=22 Then bon22=bon22+1+newIx TextWindow.Write(" "+bon22+"x") ElseIf No[xi]=23 Then bon23=bon23+1+newIx TextWindow.Write(" "+bon23+"x") ElseIf No[xi]=24 Then bon24=bon24+1+newIx TextWindow.Write(" "+bon24+"x") ElseIf No[xi]=25 Then bon25=bon25+1+newIx TextWindow.Write(" "+bon25+"x") ElseIf No[xi]=26 Then bon26=bon26+1+newIx TextWindow.Write(" "+bon26+"x") ElseIf No[xi]=27 Then bon27=bon27+1+newIx TextWindow.Write(" "+bon27+"x") ElseIf No[xi]=28 Then bon28=bon28+1+newIx TextWindow.Write(" "+bon28+"x") ElseIf No[xi]=29 Then bon29=bon29+1+newIx TextWindow.Write(" "+bon29+"x") ElseIf No[xi]=30 Then bon30=bon30+1+newIx TextWindow.Write(" "+bon30+"x") ElseIf No[xi]=31 Then bon31=bon31+1+newIx TextWindow.Write(" "+bon31+"x") ElseIf No[xi]=32 Then bon32=bon32+1+newIx TextWindow.Write(" "+bon32+"x") ElseIf No[xi]=33 Then bon33=bon33+1+newIx TextWindow.Write(" "+bon33+"x") ElseIf No[xi]=34 Then bon34=bon34+1+newIx TextWindow.Write(" "+bon34+"x") ElseIf No[xi]=35 Then bon35=bon35+1+newIx TextWindow.Write(" "+bon35+"x") ElseIf No[xi]=36 Then bon36=bon36+1+newIx TextWindow.Write(" "+bon36+"x") ElseIf No[xi]=37 Then bon37=bon37+1+newIx TextWindow.Write(" "+bon37+"x") ElseIf No[xi]=38 Then bon38=bon38+1+newIx TextWindow.Write(" "+bon38+"x") ElseIf No[xi]=39 Then bon39=bon39+1+newIx TextWindow.Write(" "+bon39+"x") ElseIf No[xi]=40 Then bon40=bon40+1+newIx TextWindow.Write(" "+bon40+"x") ElseIf No[xi]=41 Then bon41=bon41+1+newIx TextWindow.Write(" "+bon41+"x") ElseIf No[xi]=42 Then bon42=bon42+1+newIx TextWindow.Write(" "+bon42+"x") ElseIf No[xi]=43 Then bon43=bon43+1+newIx TextWindow.Write(" "+bon43+"x") ElseIf No[xi]=44 Then bon44=bon44+1+newIx TextWindow.Write(" "+bon44+"x") ElseIf No[xi]=45 Then bon45=bon45+1+newIx TextWindow.Write(" "+bon45+"x") ElseIf No[xi]=46 Then bon46=bon46+1+newIx TextWindow.Write(" "+bon46+"x") ElseIf No[xi]=47 Then bon47=bon47+1+newIx TextWindow.Write(" "+bon47+"x") ElseIf No[xi]=48 Then bon48=bon48+1+newIx TextWindow.Write(" "+bon48+"x") ElseIf No[xi]=49 Then bon49=bon49+1+newIx TextWindow.Write(" "+bon49+"x") ElseIf No[xi]=50 Then bon50=bon50+1+newIx TextWindow.Write(" "+bon50+"x") ElseIf No[xi]=51 Then bon51=bon51+1+newIx TextWindow.Write(" "+bon51+"x") ElseIf No[xi]=52 Then bon52=bon52+1+newIx TextWindow.Write(" "+bon52+"x") ElseIf No[xi]=53 Then bon53=bon53+1+newIx TextWindow.Write(" "+bon53+"x") ElseIf No[xi]=54 Then bon54=bon54+1+newIx TextWindow.Write(" "+bon54+"x") ElseIf No[xi]=55 Then bon55=bon55+1+newIx TextWindow.Write(" "+bon55+"x") ElseIf No[xi]=56 Then bon56=bon56+1+newIx TextWindow.Write(" "+bon56+"x") ElseIf No[xi]=57 Then bon57=bon57+1+newIx TextWindow.Write(" "+bon57+"x") ElseIf No[xi]=58 Then bon58=bon58+1+newIx TextWindow.Write(" "+bon58+"x") ElseIf No[xi]=59 Then bon59=bon59+1+newIx TextWindow.Write(" "+bon59+"x") ElseIf No[xi]=60 Then bon60=bon60+1+newIx TextWindow.Write(" "+bon60+"x") ElseIf No[xi]=61 Then bon61=bon61+1+newIx TextWindow.Write(" "+bon61+"x") ElseIf No[xi]=62 Then bon62=bon62+1+newIx TextWindow.Write(" "+bon62+"x") ElseIf No[xi]=63 Then bon63=bon63+1+newIx TextWindow.Write(" "+bon63+"x") ElseIf No[xi]=64 Then bon64=bon64+1+newIx TextWindow.Write(" "+bon64+"x") ElseIf No[xi]=65 Then bon65=bon65+1+newIx TextWindow.Write(" "+bon65+"x") ElseIf No[xi]=66 Then bon66=bon66+1+newIx TextWindow.Write(" "+bon66+"x") ElseIf No[xi]=67 Then bon67=bon67+1+newIx TextWindow.Write(" "+bon67+"x") ElseIf No[xi]=68 Then bon68=bon68+1+newIx TextWindow.Write(" "+bon68+"x") ElseIf No[xi]=69 Then bon69=bon69+1+newIx TextWindow.Write(" "+bon69+"x") ElseIf No[xi]=70 Then bon70=bon70+1+newIx TextWindow.Write(" "+bon70+"x") ElseIf No[xi]=71 Then bon71=bon71+1+newIx TextWindow.Write(" "+bon71+"x") ElseIf No[xi]=72 Then bon72=bon72+1+newIx TextWindow.Write(" "+bon72+"x") ElseIf No[xi]=73 Then bon73=bon73+1+newIx TextWindow.Write(" "+bon73+"x") ElseIf No[xi]=74 Then bon74=bon74+1+newIx TextWindow.Write(" "+bon74+"x") ElseIf No[xi]=75 Then bon75=bon75+1+newIx TextWindow.Write(" "+bon75+"x") ElseIf No[xi]=76 Then bon76=bon76+1+newIx TextWindow.Write(" "+bon76+"x") ElseIf No[xi]=77 Then bon77=bon77+1+newIx TextWindow.Write(" "+bon77+"x") ElseIf No[xi]=78 Then bon78=bon78+1+newIx TextWindow.Write(" "+bon78+"x") ElseIf No[xi]=79 Then bon79=bon79+1+newIx TextWindow.Write(" "+bon79+"x") ElseIf No[xi]=80 Then bon80=bon80+1+newIx TextWindow.Write(" "+bon80+"x") EndIf TextWindow.WriteLine(" ") EndIf '------------------------------------------------------------------------------------------- newIx=Math.Max(newI,(newI+1))-1 If newI>0 Then TextWindow.ForegroundColor="magenta" TextWindow.Write("+("+newI+")") TextWindow.ForegroundColor="cyan" EndIf '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! EndFor ' pour "For xi=1 To nbre" après bubbelsorting '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TextWindow.WriteLine(" ") TextWindow.ForegroundColor="white" TextWindow.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") TextWindow.ForegroundColor="darkred" TextWindow.WriteLine(" ") TextWindow.Write("feu: ") TextWindow.ForegroundColor="red" TextWindow.Write(ignis) modIgnis=Math.Remainder(ignis,mod) TextWindow.Write(" ("+modIgnis+ ")") TextWindow.ForegroundColor="darkgreen" TextWindow.Write(" air: ") TextWindow.ForegroundColor="green" TextWindow.Write(aer) modAer=Math.Remainder(aer,mod) TextWindow.Write(" ("+modAer+ ")") TextWindow.ForegroundColor="darkcyan" TextWindow.Write(" eau: ") TextWindow.ForegroundColor="cyan" TextWindow.Write(aqua) modAqua=Math.Remainder(aqua,mod) TextWindow.Write(" ("+modAqua+ ")") TextWindow.ForegroundColor="darkyellow" TextWindow.Write(" terre: ") TextWindow.ForegroundColor="yellow" TextWindow.Write(terra) modTerra=Math.Remainder(terra,mod) TextWindow.Write(" ("+modTerra+")") TextWindow.WriteLine(" ") TextWindow.ForegroundColor="darkcyan" TextWindow.WriteLine("______________________________________________________________________________ ") TextWindow.ForegroundColor="white" ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: For bing=1 To mod bon[1]=bon1 bon[2]=bon2 bon[3]=bon3 bon[4]=bon4 bon[5]=bon5 bon[6]=bon6 bon[7]=bon7 bon[8]=bon8 bon[9]=bon9 bon[10]=bon10 bon[11]=bon11 bon[12]=bon12 bon[13]=bon13 bon[14]=bon14 bon[15]=bon15 bon[16]=bon16 bon[17]=bon17 bon[18]=bon18 bon[19]=bon19 bon[20]=bon20 bon[21]=bon21 bon[22]=bon22 bon[23]=bon23 bon[24]=bon24 bon[25]=bon25 bon[26]=bon26 bon[27]=bon27 bon[28]=bon28 bon[29]=bon29 bon[30]=bon30 bon[31]=bon31 bon[32]=bon32 bon[33]=bon33 bon[34]=bon34 bon[35]=bon35 bon[36]=bon36 bon[37]=bon37 bon[38]=bon38 bon[39]=bon39 bon[40]=bon40 bon[41]=bon41 bon[42]=bon42 bon[43]=bon43 bon[44]=bon44 bon[45]=bon45 bon[46]=bon46 bon[47]=bon47 bon[48]=bon48 bon[49]=bon49 bon[50]=bon50 bon[51]=bon51 bon[52]=bon52 bon[53]=bon53 bon[54]=bon54 bon[55]=bon55 bon[56]=bon56 bon[57]=bon57 bon[58]=bon58 bon[59]=bon59 bon[60]=bon60 bon[61]=bon61 bon[62]=bon62 bon[63]=bon63 bon[64]=bon64 bon[65]=bon65 bon[66]=bon66 bon[67]=bon67 bon[68]=bon68 bon[69]=bon69 bon[70]=bon70 bon[71]=bon71 bon[72]=bon72 bon[73]=bon73 bon[74]=bon74 bon[75]=bon75 bon[76]=bon76 bon[77]=bon77 bon[78]=bon78 bon[79]=bon79 bon[80]=bon80 EndFor ' ! ! ! ( * For king=1 To mod For bing=1 To mod king=bing If bon[bing]>bis[king] Then countMod=Math.Remainder((countMod+1),mod) countNul=mod-countMod bis[king]=2*bon[bing] EndIf EndFor EndFor TextWindow.Write(bon)'impossible changer graphisme /couleur TextWindow.WriteLine(bon[bing]) 'impossible changer graphisme /couleur ' (* : 'EndFor <<< !!! SI <<< E n d F o r ici= tout autant de fois que MOD TextWindow.ForegroundColor="darkcyan" TextWindow.WriteLine("_____________________________________________________________________________") '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: For bon=1 To mod For xi=1 To mod-1 For xj= mod-1 To xi Step-1 If No [xj+1]") If No[bon-3]=No[bon] Or No[bon-4]= No[bon] Then TextWindow.ForegroundColor="magenta" TextWindow.Write(" <"+No[bon]+"> ") If No[bon-5]=No[bon] Or No[bon-6]=No[bon] Or No[bon-7]=No[bon] Then TextWindow.ForegroundColor="white" TextWindow.Write(" !!! "+No[bon]+" !!! ") EndIf EndIf EndIf EndIf EndFor TextWindow.WriteLine(" ") ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: TextWindow.ForegroundColor="darkcyan" TextWindow.WriteLine("______________________________________________________________________________ ") TextWindow.WriteLine(" ") sumIter=iter*26 TextWindow.Write("TL= "+sumIter+" Nos. /") TextWindow.Write("multi= "+sumNew) TextWindow.Write(" COEF1 = "+coef1) TextWindow.Write(" COEF2 = "+coef2) TextWindow.WriteLine(" COEF3 = "+coef3) TextWindow.WriteLine("______________________________________________________________________________ ") TextWindow.ForegroundColor="white" TextWindow.Write(" MOD ["+mod+"] :") TextWindow.Write(" "+countMod+" / ") TextWindow.WriteLine(countNul) TextWindow.WriteLine(" ") TextWindow.WriteLine(" GO ON = Enter STOP = any number") gs= TextWindow.ReadNumber() If gs=0 Then Goto go Else '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Goto start EndIf End>RKG853.sb< Start>RKJ527.sb< 'Small Basic challenge of the month February 2019 ' Make a smoothly scrolling text banner for the GraphicsWindow. ' Try using different font styles, colours, transparency and other effects to make the scrolling effect as fun as possible. ' Consider using Shapes or Controls, with Move or Animate. 'CONFIG content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ut vulputate urna. In tempor ultricies dui vitae sagittis. Nunc aliquam dui in vestibulum ultricies. Nulla viverra metus non lorem lacinia, ut fringilla justo commodo. Nunc auctor iaculis nisl, ac blandit sem laoreet quis." delay = 160 * Text.GetLength(content) ContentWidth = -61 * Text.GetLength(content) - gw 'INIT GRAPHICS GraphicsWindow.Hide() gw = Desktop.Width - 30 gh = 200 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = 15 GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "Scrolling Banner" GraphicsWindow.BackgroundColor = "Black" 'INIT SHAPES GraphicsWindow.BrushColor = "Lime" GraphicsWindow.FontItalic = "True" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 150 GraphicsWindow.FontName = "Calibri" banner = Shapes.AddText(content) Shapes.Move(banner,gw,5) GraphicsWindow.Show() 'MAIN While "True" Shapes.Animate(banner,ContentWidth,5,delay) Program.Delay(delay) Shapes.Move(banner,gw,5) EndWhile End>RKJ527.sb< Start>RKK326.sb< ' This is a work inprogress, By Chaosdesign. ' Fullscreen not garented to fit all desktops. ' Change Url Before testing or all you will get is "Goggle.com" ' ' I urge you to test and give any sugestions you may have. ' http://social.msdn.microsoft.com/Forums/en-US/user?user=nzsammy ' dh = Desktop.Height dw = Desktop.Width t = 500 GraphicsWindow.Width = (dw - 7) '-7px for thickness of window border GraphicsWindow.Height = (dh - 55) ' -55px, 7 for window border & 48 for taskbar. GraphicsWindow.CanResize = "False" GraphicsWindow.Left=0 GraphicsWindow.Top=0 FCControls.LoadTheme("XPRoyale") Web = FCControls.AddWebBrowser(GraphicsWindow.Width, GraphicsWindow.Height) Controls.Move(web, 0, 0) FCExtensions.SetInterval("UpdateT", 500, -1) FCControls.SetUrlOfWebBrowser(Web, "google.com") ' sample webpage CanUpdateT = "True" Sub UpdateT If FCControls.IsFocused(t) Then CanUpdateT = "False" Else If CanUpdateT = "True" Then FCControls.SetText(t, FCControls.GetUrlOfWebBrowser(web)) Else CanUpdateT = "True" EndIf EndIf EndSub End>RKK326.sb< Start>RKN465.sb< VERSION 5.00 Begin VB.Form cmd60frm Appearance = 0 'Flat BackColor = &H00FFFFFF& Caption = "VB Source Code Control Demos" ClientHeight = 9000 ClientLeft = 630 ClientTop = 2040 ClientWidth = 9705 FillColor = &H00FFFFFF& FillStyle = 0 'Solid BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& LinkTopic = "Form1" PaletteMode = 1 'UseZOrder ScaleHeight = 9000 ScaleWidth = 9705 WindowState = 2 'Maximized Begin VB.CommandButton Command4 Caption = "Slider Source Code Demo" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 6240 TabIndex = 35 Top = 5880 Width = 2895 End Begin VB.CommandButton Command3 Caption = "Scheduler Source Code Demo" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 6240 TabIndex = 34 Top = 4920 Width = 2895 End Begin VB.CommandButton Command2 Caption = "Clock Source Code Demo" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 6240 TabIndex = 33 Top = 5400 Width = 2895 End Begin VB.CommandButton Command1 Caption = "Calendar Source Code Demo" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 6240 TabIndex = 32 Top = 4440 Width = 2895 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00C0C0C0& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 495 Index = 0 Left = 720 ScaleHeight = 465 ScaleWidth = 1305 TabIndex = 0 Top = 2760 Width = 1335 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00FFFFFF& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 735 Index = 1 Left = 600 Picture = "cmd60frm.frx":0000 ScaleHeight = 705 ScaleWidth = 1545 TabIndex = 1 Top = 3420 Width = 1575 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00C0C0C0& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 495 Index = 3 Left = 720 ScaleHeight = 465 ScaleWidth = 1305 TabIndex = 2 Top = 5040 Width = 1335 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00C0C0C0& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 495 Index = 4 Left = 720 ScaleHeight = 465 ScaleWidth = 1305 TabIndex = 3 Top = 5640 Width = 1335 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00C0C0C0& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 540 Index = 2 Left = 720 ScaleHeight = 510 ScaleWidth = 1290 TabIndex = 4 Top = 4320 Width = 1320 End Begin VB.PictureBox Picture1 Appearance = 0 'Flat AutoRedraw = -1 'True BackColor = &H00C0C0C0& FillColor = &H00FFFF00& FillStyle = 0 'Solid BeginProperty Font Name = "Times New Roman" Size = 9.75 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 1215 Index = 5 Left = 840 ScaleHeight = 1185 ScaleWidth = 1065 TabIndex = 5 Top = 6360 Width = 1095 End Begin VB.Frame fr Appearance = 0 'Flat BackColor = &H80000005& Caption = "Properties" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 4335 Index = 1 Left = 2520 TabIndex = 12 Top = 3240 Width = 2895 Begin VB.TextBox tx Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Left = 1320 TabIndex = 23 Top = 1320 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 1 Left = 1320 Style = 2 'Dropdown List TabIndex = 22 Top = 240 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 2 Left = 1320 Style = 2 'Dropdown List TabIndex = 21 Top = 600 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 3 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 20 Top = 960 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 4 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 19 Top = 1680 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 5 Left = 1320 Style = 2 'Dropdown List TabIndex = 18 Top = 2040 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 6 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 17 Top = 2400 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 7 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 16 Top = 2760 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 8 Left = 1320 Style = 2 'Dropdown List TabIndex = 15 Top = 3120 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 9 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 14 Top = 3480 Width = 1455 End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 10 Left = 1320 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 13 Top = 3840 Width = 1455 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Align - Horz." BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 1 Left = 120 TabIndex = 6 Top = 240 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Size" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 2 Left = 120 TabIndex = 7 Top = 3120 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Bold" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 3 Left = 120 TabIndex = 8 Top = 1680 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Italic" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 4 Left = 120 TabIndex = 9 Top = 2400 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Underline" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 5 Left = 120 TabIndex = 10 Top = 3480 Width = 1215 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Color" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 6 Left = 120 TabIndex = 29 Top = 2040 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Font Name" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 7 Left = 120 TabIndex = 28 Top = 2760 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Align - Vert." BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 8 Left = 120 TabIndex = 27 Top = 600 Width = 975 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Caption" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 9 Left = 120 TabIndex = 26 Top = 1320 Width = 735 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Multi-line" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 10 Left = 120 TabIndex = 25 Top = 3840 Width = 855 End Begin VB.Label lb Appearance = 0 'Flat BackColor = &H80000005& Caption = "Bevel" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 270 Index = 0 Left = 120 TabIndex = 24 Top = 960 Width = 615 End End Begin VB.ComboBox cb Appearance = 0 'Flat BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 0 Left = 2520 Sorted = -1 'True Style = 2 'Dropdown List TabIndex = 11 Top = 2760 Width = 2895 End Begin VB.Label lb Alignment = 2 'Center Appearance = 0 'Flat BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = $"cmd60frm.frx":2A0A BeginProperty Font Name = "Times New Roman" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 1215 Index = 11 Left = 720 TabIndex = 36 Top = 600 Width = 8415 End Begin VB.Line Line1 X1 = 6000 X2 = 9360 Y1 = 4320 Y2 = 4320 End Begin VB.Label lb Alignment = 2 'Center Appearance = 0 'Flat BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = "Other Source Code Controls available at: http://www.wolfebyte.com." BeginProperty Font Name = "Arial" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 3135 Index = 13 Left = 6000 TabIndex = 31 Top = 3360 Width = 3375 End Begin VB.Label lb Alignment = 2 'Center Appearance = 0 'Flat BackColor = &H00FFFFFF& Caption = "VB Button v1.1 Source Code Samples" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 375 Index = 12 Left = 600 TabIndex = 30 Top = 2280 Width = 4935 End Begin VB.Label Label1 Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 1 'Fixed Single BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 5655 Left = 480 TabIndex = 37 Top = 2160 Width = 5175 End Begin VB.Menu mnu Caption = "Exit!" Index = 1 End Begin VB.Menu mnu Caption = "" Enabled = 0 'False Index = 2 Visible = 0 'False End Begin VB.Menu mnu Caption = "Order Info" Index = 3 End Begin VB.Menu mnu Caption = "" Enabled = 0 'False Index = 4 Visible = 0 'False End Begin VB.Menu mnu Caption = "About" Index = 5 End End Attribute VB_Name = "cmd60frm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub cb_Click(Index As Integer) 'All of the code below is for demo purposes only Dim idx% idx = Val(Trim(Right(cb(0), 2))) Select Case Index Case 0 Picture1(idx).SetFocus Select Case LCase(cmdBtn(idx).cmdHAlign) Case "left" cb(1).ListIndex = 0 Case "center" cb(1).ListIndex = 1 Case "right" cb(1).ListIndex = 2 End Select Select Case LCase(cmdBtn(idx).cmdVAlign) Case "top" cb(2).ListIndex = 0 Case "center" cb(2).ListIndex = 1 Case "bottom" cb(2).ListIndex = 2 End Select cb(3).ListIndex = cmdBtn(idx).cmdBevel - 1 tx = cmdBtn(idx).cmdText If cmdBtn(idx).cmdFont.ftBold Then cb(4).ListIndex = 1 Else cb(4).ListIndex = 0 End If Select Case cmdBtn(idx).cmdFont.ftColor Case QBColor(0) cb(5).ListIndex = 0 Case QBColor(1) cb(5).ListIndex = 1 Case QBColor(2) cb(5).ListIndex = 2 Case QBColor(3) cb(5).ListIndex = 3 Case QBColor(4) cb(5).ListIndex = 4 Case QBColor(5) cb(5).ListIndex = 5 Case QBColor(6) cb(5).ListIndex = 6 Case QBColor(7) cb(5).ListIndex = 7 Case QBColor(8) cb(5).ListIndex = 8 Case QBColor(9) cb(5).ListIndex = 9 Case QBColor(10) cb(5).ListIndex = 10 Case QBColor(11) cb(5).ListIndex = 11 Case QBColor(12) cb(5).ListIndex = 12 Case QBColor(13) cb(5).ListIndex = 13 Case QBColor(14) cb(5).ListIndex = 14 Case QBColor(15) cb(5).ListIndex = 15 End Select If cmdBtn(idx).cmdFont.ftItalic Then cb(6).ListIndex = 1 Else cb(6).ListIndex = 0 End If Select Case cmdBtn(idx).cmdFont.ftName Case "Courier" cb(7).ListIndex = 0 Case "MS Sans Serif" cb(7).ListIndex = 1 Case "Times New Roman" cb(7).ListIndex = 2 End Select Select Case cmdBtn(idx).cmdFont.ftSize Case 8.25 cb(8).ListIndex = 0 Case 10 cb(8).ListIndex = 1 Case 12 cb(8).ListIndex = 2 Case 16 cb(8).ListIndex = 3 End Select If cmdBtn(idx).cmdFont.ftUnderline Then cb(9).ListIndex = 1 Else cb(9).ListIndex = 0 End If If cmdBtn(idx).cmdMultiline Then cb(10).ListIndex = 1 Else cb(10).ListIndex = 0 End If Case 1 cmdBtn(idx).cmdHAlign = cb(1) Case 2 cmdBtn(idx).cmdVAlign = cb(2) Case 3 cmdBtn(idx).cmdBevel = Val(cb(3)) Case 4 cmdBtn(idx).cmdFont.ftBold = cb(4).ItemData(cb(4).ListIndex) Case 5 cmdBtn(idx).cmdFont.ftColor = QBColor(cb(5).ListIndex) Case 6 cmdBtn(idx).cmdFont.ftItalic = cb(6).ItemData(cb(6).ListIndex) Case 7 cmdBtn(idx).cmdFont.ftName = cb(7) Case 8 cmdBtn(idx).cmdFont.ftSize = Val(cb(8)) Case 9 cmdBtn(idx).cmdFont.ftUnderline = cb(9).ItemData(cb(9).ListIndex) Case 10 cmdBtn(idx).cmdMultiline = cb(10).ItemData(cb(10).ListIndex) End Select DrawCmdBtn cmdBtn(idx), Picture1(idx) End Sub Private Sub Command1_Click() MsgBox "Please visit http://www.wolfebyte.com" & Chr(13) & "for product ordering information.", 0, "VB Calendar Control v1.6 Info" End Sub Private Sub Command2_Click() MsgBox "Please visit http://www.wolfebyte.com" & Chr(13) & "for product ordering information.", 0, "VB Clock Control v1.2 Info" End Sub Private Sub Command3_Click() MsgBox "Please visit http://www.wolfebyte.com" & Chr(13) & "for product ordering information.", 0, "VB Scheduler Control v2.0 Info" End Sub Private Sub Command4_Click() MsgBox "Please visit http://www.wolfebyte.com" & Chr(13) & "for product ordering information.", 0, "VB Slider Control v1.1 Info" End Sub Private Sub form_Load() 'Assign properties for the cmdBtn(s) and then draw each one DefineCmdBtn0 Picture1(0) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(0), Picture1(0) 'cmdBtn (user defined record type) and picturebox passed in DefineCmdBtn1 Picture1(1) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(1), Picture1(1) 'cmdBtn (user defined record type) and picturebox passed in DefineCmdBtn2 Picture1(2) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(2), Picture1(2) 'cmdBtn (user defined record type) and picturebox passed in DefineCmdBtn3 Picture1(3) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(3), Picture1(3) 'cmdBtn (user defined record type) and picturebox passed in DefineCmdBtn4 Picture1(4) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(4), Picture1(4) 'cmdBtn (user defined record type) and picturebox passed in DefineCmdBtn5 Picture1(5) 'Picturebox passed in and button is setup DrawCmdBtn cmdBtn(5), Picture1(5) 'cmdBtn (user defined record type) and picturebox passed in 'Code below is for demo purposes only cb(0).AddItem "Button 0" cb(0).AddItem "Button 1" cb(0).AddItem "Button 2" cb(0).AddItem "Button 3" cb(0).AddItem "Button 4" cb(0).AddItem "Button 5" cb(1).AddItem "Left" cb(1).AddItem "Center" cb(1).AddItem "Right" cb(2).AddItem "Top" cb(2).AddItem "Center" cb(2).AddItem "Bottom" cb(3).AddItem "1" cb(3).AddItem "2" cb(3).AddItem "3" cb(3).AddItem "4" cb(3).AddItem "5" cb(4).AddItem "True" cb(4).ItemData(cb(4).NewIndex) = -1 cb(4).AddItem "False" cb(4).ItemData(cb(4).NewIndex) = 0 cb(5).AddItem "Black" cb(5).AddItem "Blue" cb(5).AddItem "Green" cb(5).AddItem "Cyan" cb(5).AddItem "Red" cb(5).AddItem "Magenta" cb(5).AddItem "Yellow" cb(5).AddItem "White" cb(5).AddItem "Gray" cb(5).AddItem "Light Blue" cb(5).AddItem "Light Green" cb(5).AddItem "Light Cyan" cb(5).AddItem "Light Red" cb(5).AddItem "Light Magenta" cb(5).AddItem "Light Yellow" cb(5).AddItem "Bright White" cb(6).AddItem "True" cb(6).ItemData(cb(6).NewIndex) = -1 cb(6).AddItem "False" cb(6).ItemData(cb(6).NewIndex) = 0 cb(7).AddItem "MS Sans Serif" cb(7).AddItem "Courier" cb(7).AddItem "Times New Roman" cb(8).AddItem "8.25" cb(8).AddItem "10" cb(8).AddItem "12" cb(8).AddItem "16" cb(9).AddItem "True" cb(9).ItemData(cb(9).NewIndex) = -1 cb(9).AddItem "False" cb(4).ItemData(cb(9).NewIndex) = 0 cb(10).AddItem "True" cb(10).ItemData(cb(10).NewIndex) = -1 cb(10).AddItem "False" cb(10).ItemData(cb(10).NewIndex) = 0 cmd60frm.Show cb(0).ListIndex = 0 End Sub Private Sub mnu_Click(Index As Integer) Dim msgstr$, r% Select Case Index Case 1 End Case 3 msgstr = "Please visit http://www.wolfebyte.com" & Chr(13) msgstr = msgstr & "for product ordering information." MsgBox msgstr, 0, "VB Button Control v1.1 Info" Case 5 msgstr = "VB Button Control v1.1 for Visual Basic 3.0-6.0" & Chr(13) & Chr(13) msgstr = msgstr & "Property of WolfeByte Solutions 1995-2002" & Chr(13) & Chr(13) msgstr = msgstr & "This program is protected by and subject to all" & Chr(13) msgstr = msgstr & "Federal copyright laws governing the duplication" & Chr(13) msgstr = msgstr & "and distribution of authored software." & Chr(13) & Chr(13) msgstr = msgstr & "For more information on this control or other VB" & Chr(13) msgstr = msgstr & "coded products such as Schedulers, Calendars," & Chr(13) msgstr = msgstr & "Clocks or Sliders, contact WolfeByte Solutions at" & Chr(13) msgstr = msgstr & "http://www.wolfebyte.com." MsgBox msgstr, 0, "VB Button Control v1.1 Info" End Select End Sub Private Sub Picture1_Click(Index As Integer) 'Click event code should be placed in the mouse_up event because you probably 'don't want action if there is a mouse_down over a button but the mouse_up 'occurs off from the button. End Sub Private Sub Picture1_DblClick(Index As Integer) 'Double click will always set button to raised position cmdBtn(Index).cmdState = 0 DrawCmdBtn cmdBtn(Index), Picture1(Index) End Sub Private Sub Picture1_GotFocus(Index As Integer) 'Draw the button with focus outline cmdBtn(Index).cmdFocus = True DrawCmdBtn cmdBtn(Index), Picture1(Index) End Sub Private Sub Picture1_LostFocus(Index As Integer) 'Draw button without focus outline cmdBtn(Index).cmdFocus = False DrawCmdBtn cmdBtn(Index), Picture1(Index) End Sub Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) 'Draw button with focus and button down features Picture1(Index).Refresh cmdBtn(Index).cmdState = 0 DrawCmdBtn cmdBtn(Index), Picture1(Index) End Sub Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) 'Set button state to up or down for a mousedown and then move off/on picturebox If Button = 1 And (X < 2 Or X > Picture1(Index).ScaleWidth - 3 Or Y < 2 Or Y > Picture1(Index).ScaleHeight - 3) Then Picture1(Index).Refresh cmdBtn(Index).cmdState = -1 DrawCmdBtn cmdBtn(Index), Picture1(Index) ElseIf Button = 1 And (X >= 2 Or X <= Picture1(Index).ScaleWidth - 3 Or Y >= 2 Or Y <= Picture1(Index).ScaleHeight - 3) Then Picture1(Index).Refresh cmdBtn(Index).cmdState = 0 DrawCmdBtn cmdBtn(Index), Picture1(Index) End If End Sub Private Sub Picture1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) 'Draw button without focus and button up features If cmdBtn(Index).cmdState = 0 Then Picture1(Index).Refresh cmdBtn(Index).cmdState = -1 DrawCmdBtn cmdBtn(Index), Picture1(Index) 'Enter code inside this if/then that would normally 'be your click event for the button 'Code below for demo purposes only Screen.MousePointer = 11 DoEvents If cb(0).ListIndex <> Index Then cb(0).ListIndex = Index Screen.MousePointer = 0 End If End Sub Private Sub tx_Change() Dim idx% idx = Val(Trim(Right(cb(0), 2))) cmdBtn(idx).cmdText = tx DrawCmdBtn cmdBtn(idx), Picture1(idx) End Sub End>RKN465.sb< Start>RKR553.sb< Not= "False=true;true=false GraphicsWindow.backgroundcolor= "teal GraphicsWindow.Width = 1080 GraphicsWindow.Height = 420 GraphicsWindow.PenWidth=0 GraphicsWindow.Title="Animated Eyes rcx="1=604;2=604;3=604;4=604;5=604;6=603.2;7=603.2;8=602.4;9=598.4;10=595.2;11=590.4;12=584.8;13=578.4;14=573.6;15=570.4;16=576.8;17=584.8;18=600.8;19=620.8;20=646.4;21=683.2;22=724.8;23=745.6;24=771.2;25=780.8;26=789.6;27=796;28=800;29=804.8;30=804.8;31=804.8;32=804.8;33=803.2;34=800;35=795.2;36=790.4;37=783.2;38=770.4;39=752;40=728;41=700;42=672.8;43=639.2;44=598.4;45=558.4;46=508;47=477.6;48=432.8;49=392.8;50=361.6;51=332;52=321.6;53=316.8;54=316.8;55=316.8;56=316.8;57=316.8;58=316.8;59=316.8;60=316.8;61=316.8;62=318.4;63=322.4;64=328.8;65=336;66=346.4;67=365.6;68=407.2;69=472.8;70=557.6;71=667.2;72=766.4;73=832.8;74=861.6;75=864.8;76=863.2;77=861.6;78=861.6;79=861.6;80=861.6;81=861.6;82=861.6;83=861.6;84=860.8;85=860;86=860;87=859.2;88=854.4;89=848;90=841.6;91=829.6;92=805.6;93=781.6;94=759.2;95=737.6;96=712;97=684;98=649.6;99=603.2;100=548;101=495.2;102=424.8;103=380.8;104=324.8;105=289.6;106=265.6;107=261.6;108=261.6;109=261.6;110=261.6;111=261.6;112=261.6;113=261.6;114=261.6;115=261.6;116=261.6;117=261.6;118=261.6;119=261.6;120=261.6;121=261.6;122=261.6;123=262.4;124=269.6;125=280.8;126=295.2;127=325.6;128=370.4;129=431.2;130=492;131=558.4;132=632.8;133=687.2;134=723.2;135=748;136=753.6;137=753.6;138=753.6;139=753.6;140=756.8;141=756.8;142=756.8;143=757.6;144=759.2;145=760;146=760;147=760;148=760;149=760;150=760.8;151=761.6;152=761.6;153=761.6;154=758.4;155=752;156=744;157=728.8;158=706.4;159=679.2;160=646.4;161=603.2;162=559.2;163=499.2;164=463.2;165=400;166=359.2;167=318.4;168=289.6;169=277.6;170=267.2;171=262.4;172=269.6;173=287.2;174=315.2;175=340;176=372;177=403.2;178=425.6;179=446.4;180=468.8;181=495.2;182=517.6;183=536;184=550.4;185=564.8;186=576.8;187=584.8;188=591.2;189=598.4;190=605.6;191=612;192=618.4;193=624.8;194=634.4;195=642.4;196=656.8;197=672;198=689.6;199=710.4;200=741.6;201=780;202=815.2;203=849.6;204=877.6;205=898.4;206=911.2;207=921.6;208=928;209=929.6;210=925.6;211=911.2;212=889.6;213=868;214=838.4;215=807.2;216=780;217=746.4;218=720.8;219=691.2;220=678.4;221=663.2;222=648.8;223=635.2;224=623.2;225=619.2;226=615.2;227=610.4;228=604.8;229=598.4;230=592;231=585.6;232=579.2;233=569.6;234=551.2;235=521.6;236=479.2;237=431.2;238=375.2;239=324;240=292;241=270.4;242=259.2;243=260.8;244=270.4;245=281.6;246=300.8;247=320.8;248=320.8;249=320.8;250=320.8;251=401.6;252=421.6;253=445.6;254=472;255=493.6;256=514.4;257=533.6;258=552;259=567.2;260=576;261=584.8;262=591.2;263=597.6;264=604;265=609.6;266=614.4;267=617.6;268=625.6;269=639.2;270=667.2;271=688.8;272=721.6;273=762.4;274=788;275=833.6;276=865.6;277=895.2;278=917.6;279=932;280=938.4;281=941.6;282=936.8;283=928.8;284=918.4;285=910.4;286=894.4;287=871.2;288=848;289=832;290=832;291=832;292=832;293=832;294=832;295=832;296=832;297=832;298=467.2;299=437.6;300=413.6;301=385.6;302=368;303=360.8;304=359.2;305=356.8;306=354.4;307=352.8;308=346.4;309=342.4;310=344;311=352;312=372;313=405.6;314=430.4;315=488;316=536.8;317=576.8;318=620;319=662.4;320=700;321=735.2;322=761.6;323=788;324=805.6;325=814.4;326=816;327=808;328=797.6;329=785.6;330=766.4;331=740;332=721.6;333=703.2;334=680;335=645.6;336=605.6;337=564.8;338=524.8;339=480;340=443.2;341=417.6;342=393.6;343=376.8;344=367.2;345=360;346=365.6;347=386.4;348=415.2;349=448.8;350=486.4;351=524;352=563.2;353=613.6;354=648.8;355=708.8;356=739.2;357=770.4;358=788.8;359=796.8;360=803.2;361=808;362=804.8;363=791.2;364=765.6;365=737.6;366=712.8;367=684;368=642.4;369=603.2;370=560.8;371=525.6;372=504.8;373=488;374=469.6;375=450.4;376=432;377=420;378=415.2;379=415.2;380=423.2;381=439.2;382=459.2;383=481.6;384=511.2;385=544.8;386=577.6;387=611.2;388=641.6;389=681.6;390=713.6;391=740.8;392=763.2;393=773.6;394=776;395=777.6;396=778.4;397=777.6;398=773.6;399=770.4;400=769.6;401=770.4;402=775.2;403=777.6;404=784;405=785.6;406=785.6;407=785.6;408=785.6;409=785.6;410=785.6;411=785.6;412=785.6;413=785.6;414=785.6;415=785.6;416=785.6;417=785.6;418=785.6;419=785.6;420=785.6;421=784.8;422=783.2;423=782.4;424=781.6 rcy="1=344.8;2=344;3=344;4=344;5=344;6=344;7=344;8=344;9=343.2;10=343.2;11=343.2;12=344;13=344.8;14=347.2;15=356;16=369.6;17=378.4;18=384.8;19=388;20=388.8;21=384.8;22=376.8;23=367.2;24=345.6;25=334.4;26=312.8;27=294.4;28=280;29=269.6;30=268.8;31=268.8;32=269.6;33=277.6;34=285.6;35=293.6;36=302.4;37=312.8;38=320.8;39=330.4;40=336.8;41=340.8;42=346.4;43=352.8;44=354.4;45=355.2;46=347.2;47=347.2;48=350.4;49=349.6;50=348.8;51=348;52=348;53=348;54=348.8;55=348.8;56=348.8;57=348.8;58=348.8;59=348.8;60=348.8;61=349.6;62=350.4;63=352;64=354.4;65=356.8;66=360.8;67=368;68=378.4;69=386.4;70=400.8;71=408.8;72=407.2;73=404.8;74=400;75=399.2;76=397.6;77=397.6;78=397.6;79=397.6;80=397.6;81=397.6;82=397.6;83=397.6;84=397.6;85=397.6;86=397.6;87=397.6;88=400.8;89=404.8;90=409.6;91=413.6;92=415.2;93=414.4;94=416.8;95=417.6;96=416;97=412.8;98=408;99=400;100=394.4;101=387.2;102=381.6;103=377.6;104=377.6;105=375.2;106=373.6;107=372;108=372;109=372;110=372;111=372;112=372;113=372;114=372;115=372;116=372;117=372;118=372;119=372;120=372;121=372;122=372;123=372;124=372;125=371.2;126=372;127=377.6;128=377.6;129=381.6;130=385.6;131=389.6;132=392.8;133=392.8;134=390.4;135=389.6;136=388;137=388;138=388;139=387.2;140=385.6;141=385.6;142=385.6;143=385.6;144=385.6;145=385.6;146=385.6;147=385.6;148=385.6;149=385.6;150=385.6;151=385.6;152=385.6;153=387.2;154=391.2;155=395.2;156=400;157=405.6;158=408.8;159=406.4;160=404.8;161=400;162=397.6;163=390.4;164=384;165=372;166=357.6;167=336;168=309.6;169=291.2;170=241.6;171=193.6;172=149.6;173=112.8;174=80.8;175=58.4;176=40.8;177=34.4;178=34.4;179=40.8;180=53.6;181=72;182=92.8;183=112.8;184=128.8;185=143.2;186=156;187=170.4;188=186.4;189=202.4;190=217.6;191=236.8;192=256;193=274.4;194=295.2;195=308.8;196=323.2;197=332;198=338.4;199=344.8;200=344.8;201=340;202=332;203=320.8;204=304.8;205=280.8;206=253.6;207=224.8;208=197.6;209=158.4;210=115.2;211=76.8;212=48.8;213=32.8;214=24.8;215=18.4;216=17.6;217=22.4;218=29.6;219=49.6;220=63.2;221=89.6;222=112.8;223=128.8;224=156;225=171.2;226=196;227=215.2;228=238.4;229=262.4;230=284;231=302.4;232=320;233=339.2;234=354.4;235=360.8;236=358.4;237=342.4;238=317.6;239=288;240=256;241=220;242=180;243=131.2;244=84.8;245=48.8;246=22.4;247=2.4;248=2.4;249=2.4;250=2.4;251=1.6;252=7.2;253=21.6;254=36.8;255=45.6;256=56;257=67.2;258=82.4;259=99.2;260=116.8;261=135.2;262=153.6;263=174.4;264=197.6;265=221.6;266=246.4;267=271.2;268=293.6;269=313.6;270=342.4;271=352;272=359.2;273=364;274=364;275=362.4;276=352;277=328;278=300;279=263.2;280=223.2;281=186.4;282=157.6;283=121.6;284=94.4;285=71.2;286=50.4;287=28;288=10.4;289=0;290=0;291=0;292=0;293=0;294=0;295=0;296=0;297=0;298=1.6;299=15.2;300=33.6;301=52.8;302=70.4;303=89.6;304=107.2;305=117.6;306=126.4;307=136.8;308=161.6;309=177.6;310=203.2;311=231.2;312=268.8;313=300;314=312;315=335.2;316=351.2;317=355.2;318=361.6;319=356.8;320=350.4;321=342.4;322=330.4;323=307.2;324=281.6;325=255.2;326=222.4;327=185.6;328=156.8;329=133.6;330=114.4;331=103.2;332=96.8;333=89.6;334=83.2;335=76.8;336=65.6;337=60.8;338=59.2;339=59.2;340=65.6;341=76.8;342=96;343=117.6;344=147.2;345=184.8;346=219.2;347=251.2;348=280;349=301.6;350=316;351=324;352=329.6;353=329.6;354=324.8;355=305.6;356=296.8;357=280.8;358=258.4;359=236.8;360=196.8;361=162.4;362=132.8;363=108;364=84;365=70.4;366=64;367=57.6;368=53.6;369=52;370=48.8;371=52.8;372=59.2;373=65.6;374=80.8;375=105.6;376=133.6;377=162.4;378=190.4;379=222.4;380=253.6;381=284;382=309.6;383=328.8;384=343.2;385=350.4;386=358.4;387=358.4;388=351.2;389=338.4;390=322.4;391=304;392=280.8;393=255.2;394=222.4;395=195.2;396=173.6;397=154.4;398=135.2;399=118.4;400=106.4;401=96;402=88;403=84;404=79.2;405=77.6;406=77.6;407=77.6;408=77.6;409=77.6;410=77.6;411=77.6;412=77.6;413=77.6;414=77.6;415=77.6;416=77.6;417=77.6;418=77.6;419=77.6;420=77.6;421=78.4;422=81.6;423=83.2;424=83.2 ox[1] = 529 oy[1] = 195 ox[5] = 681 oy[5] = 195 bc =LDText.Split( "blue yellow blue yellow" " ") sz =LDText.Split( "150 110 80 50" " ") For i = 5 To 8 sz[i] = sz[i - 4] bc[i] = bc[i - 4] EndFor mx = (ox[1] + ox[5]) / 2 my = (oy[1] + oy[5]) / 2 GraphicsWindow.BrushColor = bc[1] ell[1] = Shapes.AddEllipse(sz[1], sz[1]) Shapes.Move(ell[1],ox[1] - sz[1] / 2, oy[1] - sz[1] / 2) ell[5] = Shapes.AddEllipse(sz[5], sz[5]) Shapes.Move(ell[5],ox[5] - sz[5] / 2, oy[5] - sz[5] / 2) For i = 2 To 4 GraphicsWindow.BrushColor = bc[i] qq=LDMath.Convert2Radial(ox[1] oy[1] mx my) d = qq[1] If ((d < (sz[1] / 2)) And (d < (sz[1] - sz[i]))) Then r = d / 2 Else r = (sz[1] - sz[i]) / 2 EndIf ox[i] = ox[1] + r * ldMath.Cos(qq[2]) oy[i] = oy[1] - r * ldMath.sin(qq[2]) ell[i] = Shapes.AddEllipse(sz[i], sz[i]) Shapes.Move(ell[i], ox[i] - sz[i] / 2, oy[i] - sz[i] / 2) GraphicsWindow.BrushColor = bc[i + 4] qq=LDMath.Convert2Radial(ox[5] oy[5] mx my) d = qq[1] If ((d < (sz[5] / 2)) And (d < (sz[5] - sz[i + 4]))) Then r = d / 2 Else r = (sz[5] - sz[i + 4]) / 2 EndIf ox[i + 4] = ox[5] + r * ldMath.Cos(qq[2]) oy[i + 4] = oy[5] - r * ldMath.sin(qq[2]) ell[i + 4] = Shapes.AddEllipse(sz[i + 4], sz[i + 4]) Shapes.Move(ell[i + 4], ox[i + 4] - sz[i + 4] / 2, oy[i + 4] - sz[i + 4] / 2) EndFor While 1=1 For f=1 To Array.GetItemCount(rcx) mx=rcx[f] my=rcy[f] ply() Program.Delay(33) EndFor EndWhile Sub ply For i = 2 To 4 qq=LDMath.Convert2Radial(ox[1] oy[1] mx my) d = qq[1] If (d < sz[1] / 2) And (d < (sz[1] - sz[i])) Then r = d / 2 Else r = (sz[1] - sz[i]) / 2 EndIf _a = Math.GetRadians(qq[2]) ox[i] = ox[1] + r * ldMath.Cos(qq[2]) oy[i] = oy[1] + r * ldMath.sin(qq[2]) Shapes.Move(ell[i], ox[i] - sz[i] / 2, oy[i] - sz[i] / 2) qq=LDMath.Convert2Radial(ox[5] oy[5] mx my) d = qq[1] If (d < sz[5] / 2) And (d < (sz[5] - sz[i + 4])) Then r = d / 2 Else r = (sz[5] - sz[i + 4]) / 2 EndIf ox[i + 4] = ox[5] + r * ldMath.Cos(qq[2]) oy[i + 4] = oy[5] + r * ldMath.sin(qq[2]) Shapes.Move(ell[i + 4], ox[i + 4] - sz[i + 4] / 2, oy[i + 4] - sz[i + 4] / 2) EndFor EndSub End>RKR553.sb< Start>RLB426.sb< ''countchar WhTurner 2012-11-02 '' text challenge 1 , november 2012 ''============================= TextWindow.WriteLine("==== C O U N T I N G O F C H A R A C T E R S =====") TextWindow.WriteLine("") TextWindow.Write("Do you want to input text from the keyboard or from a file? K / F ") ans= Text.ConvertToUpperCase(TextWindow.Readkey()) If ans="F" then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Give the name of the file (in "+Program.Directory+")") TextWindow.WriteLine(" or full qualified path+name (with diskletter)") TextWindow.WriteLine("") TextWindow.Write("----> ") FIL=TextWindow.Read() If Text.GetSubText(FIL,2,1)<>":" Then FIL=program.Directory+"\"+FIL EndIf ' The following line could be harmful and has been automatically commented. ' r= File.ReadContents(FIL) elseif ans ="K" then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("Enter the text (multiple lines), end with an empty line") inp="x" while inp<>"" inp= TextWindow.Read() r=r+inp endwhile Else Program.End() endif l=text.GetLength(r) TextWindow.WriteLine("length is: "+l) For i=1 To l c= text.GetCharacterCode(Text.getSubText(r,i,1)) alf[c]=alf[c]+1 EndFor TextWindow.WriteLine("Char UPPER lower Total") max=0 for i1=65 To 91 i2=i1+32 If alf[i1]<>"" or alf[i2]<>"" Then v1=" "+text.GetCharacter(i1)+" " formI="9d%"+alf[i1] Format() v1= v1+formO formI="9d%"+alf[i2] Format() v1=v1+formO sum=alf[i1]+alf[i2] formI="9d%"+sum Format() v1=v1+formO TextWindow.WriteLine(v1) If maxRLB426.sb< Start>RLB652.sb< 'Solution to Euler Problems 30; http://projecteuler.net 'Find the sum of all numbers where: 'the sum of the fifth power of their digits is equal to that number 'Example: 4150 = 4^5 + 1^5 + 5^5 + 0^5 'author: Matthew L. Parets total = 0 For a = 2 to 354294 'The maximum possible solution is: 6 * 9^5 findFifthSum() If c = a Then 'If current value qualifies TextWindow.WriteLine("") TextWindow.WriteLine(c) total = total + c EndIf If Math.Remainder(a,10000) = 0 Then 'let user know we are still alive TextWindow.Write(".") EndIf Endfor TextWindow.Write("The total is: ") TextWindow.WriteLine(total) 'Sum the fifth power of each digit Sub findFifthSum c = 0 For i = 0 To Text.GetLength(a)-1 b = Text.GetSubText(a,i,1) c = c + Math.Power(b,5) EndFor EndSub End>RLB652.sb< Start>RLB718.sb< key_enabled = "FALSE" setEventHander() setVariables() readSettingFile() readDataFile() prepareWindow() showTitleWindow() 'showUserWindow() Sub executeGames current_score = 0 For i = 1 To number_of_answer EndFor executeOneGame() EndSub Sub executNextGame clearCorrectAnswer() clearHint() clearTryBox() Shapes.SetText(border_text,"") executeOneGame() EndSub Sub executeOneGame 'set answer index_history = 0 hint_is_used = "FALSE" Controls.ShowControl(hint_button) chooseWord() showGameWindow() EndSub Sub examineTryWord flag_empty = "FALSE" j = 0 For i = 1 To theAnswer_length try_character_i = Text.ConvertToLowerCase(tryCharacter[i]) answer_character_i = Text.ConvertToLowerCase(theAnswer_character[i]) If (try_character_i = "") Then flag_empty = "TRUE" EndIf If (try_character_i <> answer_character_i) Then j = j + 1 rest_tryCharacter[j] = try_character_i rest_answerCharacter[j] = answer_character_i EndIf EndFor If (flag_empty = "TRUE") Then Shapes.SetText(border_text,"fill word!") Shapes.ShowShape(border_text) Else If (j = 0) Then winOneGame() Else number_of_hit = theAnswer_length - j number_of_blow = 0 number_of_rest_tryCharacter = j number_of_rest_answerCharacter = j For i = 1 To j target_character = rest_tryCharacter[i] For k = 1 To number_of_rest_answerCharacter If (target_character = rest_answerCharacter[k]) Then number_of_blow = number_of_blow + 1 'remove rest_answerCharacter[k] from array For l = k + 1 To number_of_rest_answerCharacter rest_answerCharacter[l-1] = rest_answerCharacter[l] EndFor number_of_rest_answerCharacter = number_of_rest_answerCharacter - 1 Goto EXIT_INNER_FOR_LOOP EndIf EndFor EXIT_INNER_FOR_LOOP: EndFor nextTry() EndIf EndIf EndSub Sub winOneGame current_score = current_score + point If (current_score > HighScore[index_user]) Then HighScore[index_user] = current_score EndIf writeSettingFile() hideHistory() showScore() Controls.HideControl(hint_button) Controls.HideControl(button_try) Shapes.SetText(border_text,"You Win!") Shapes.ShowShape(border_text) showCorrectAnswer() Controls.ShowControl(nextgame_button) EndSub Sub loseOneGame hideHistory() Controls.HideControl(hint_button) Controls.HideControl(button_try) Shapes.SetText(border_text,"You Lose") Shapes.ShowShape(border_text) showCorrectAnswer() Controls.ShowControl(nextgame_button) EndSub Sub nextTry 'TextWindow.WriteLine(index_history) If (index_history = number_of_history) Then loseOneGame() Else index_history = index_history + 1 For i = 1 To theAnswer_length historyCharacter[index_history][i] = tryCharacter[i] hit_history[index_history] = number_of_hit blow_history[index_history] = number_of_blow EndFor showScore() showHistory() EndIf EndSub Sub showCorrectAnswer hideButtons() For i = 1 To theAnswer_length left_position = (i-1)*(width_box + width_box_margin) + left_answer_area Shapes.SetText(answer_text[i],theAnswer_character[i]) Shapes.ShowShape(answer_text[i]) Shapes.Move(answer_text[i],left_position+width_adjust_text,top_answer_area+height_adjust_text) For level_opacity = 1 to 10 Shapes.SetOpacity(rectangle_answer[index_column], (11-level_opacity)*10) Program.Delay(50) EndFor Shapes.HideShape(rectangle_answer[i]) EndFor showButtons() EndSub Sub clearCorrectAnswer For i = 1 To max_word_length Shapes.SetText(answer_text[i],"") Shapes.HideShape(answer_text[i]) EndFor EndSub Sub showGameWindow showScore() showAnswer() showHint() showTryBox() hideHistory() key_enabled = "TRUE" EndSub Sub hideGameWindow key_enabled = "FALSE" hideScore() hideAnswer() clearCorrectAnswer() clearHint() clearTryBox() Shapes.SetText(border_text,"") Shapes.HideShape(border_text) Controls.HideControl(nextgame_button) hideHint() hideTryBox() hideHistory() EndSub Sub showScore If (index_history = 0) Then point = 20 Else point = 10 - (index_history-1)*2 EndIf If (hint_is_used = "TRUE") Then point = point/2 EndIf Controls.ShowControl(userselect_button) Shapes.SetText(current_user,Name[index_user]) Shapes.ShowShape(current_user) Shapes.ShowShape(current_score_title) Shapes.ShowShape(high_score_title) Shapes.SetText(current_score_text,current_score) Shapes.ShowShape(current_score_text) Shapes.SetText(high_score_text,HighScore[index_user]) Shapes.ShowShape(high_score_text) Shapes.ShowShape(point_title) Shapes.SetText(point_text,point) Shapes.ShowShape(point_text) EndSub Sub hideScore Controls.HideControl(userselect_button) Shapes.HideShape(current_user) Shapes.HideShape(current_score_title) Shapes.HideShape(high_score_title) Shapes.HideShape(current_score_text) Shapes.HideShape(high_score_text) Shapes.HideShape(point_title) Shapes.HideShape(point_text) EndSub Sub showAnswer hideButtons() For index_column = 1 To theAnswer_length Shapes.SetOpacity(rectangle_answer[index_column], 0) Shapes.ShowShape(rectangle_answer[index_column]) For level_opacity = 1 to 10 Shapes.SetOpacity(rectangle_answer[index_column], level_opacity*10) Program.Delay(50) EndFor EndFor showButtons() 'TextWindow.WriteLine(theAnswer_index) EndSub Sub showButtons Controls.ShowControl(userselect_button) Controls.ShowControl(hint_button) EndSub Sub hideButtons Controls.HideControl(userselect_button) Controls.HideControl(hint_button) EndSub Sub hideAnswer For index_column = 1 To max_word_length Shapes.HideShape(rectangle_answer[index_column]) EndFor EndSub Sub showHint Shapes.ShowShape(hintbox) text_data = csv_data[theAnswer_index][2] If (hint_is_used = "TRUE") Then text_data = text_data + " " + csv_data[theAnswer_index][3] EndIf Shapes.SetText(hint,text_data) Shapes.ShowShape(hint) EndSub Sub hideHint Shapes.HideShape(hintbox) Shapes.HideShape(hint) EndSub Sub clearHint Shapes.SetText(hint,"") EndSub Sub showTryBox For index_column = 1 To theAnswer_length Shapes.ShowShape(rectangle_try[index_column]) Shapes.ShowShape(textbox_try[index_column]) EndFor Shapes.ShowShape(rectangle_try_current) index_character = 1 moveChracterBackground() Controls.ShowControl(button_try) Controls.ShowControl(set_button) EndSub Sub hideTryBox For index_column = 1 To max_word_length Shapes.HideShape(rectangle_try[index_column]) Shapes.HideShape(textbox_try[index_column]) EndFor Shapes.HideShape(rectangle_try_current) Controls.HideControl(button_try) Controls.HideControl(set_button) EndSub Sub clearTryBox For index_column = 1 To max_word_length Shapes.SetText(textbox_try[index_column],"") Shapes.HideShape(rectangle_try[index_column]) Shapes.HideShape(textbox_try[index_column]) EndFor Shapes.HideShape(rectangle_try_current) EndSub Sub showHistory Shapes.ShowShape(hit_title) Shapes.ShowShape(blow_title) '----- show history text For index_row = 1 To index_history i = index_history - index_row + 1 For index_column = 1 To theAnswer_length Shapes.SetText(text_history[index_row][index_column],historyCharacter[i][index_column]) Shapes.ShowShape(text_history[index_row][index_column]) EndFor Shapes.SetText(hit_history_text[index_row],hit_history[i]) Shapes.ShowShape(hit_history_text[index_row]) Shapes.SetText(blow_history_text[index_row],blow_history[i]) Shapes.ShowShape(blow_history_text[index_row]) Shapes.SetText(length_history_text[index_row],"/"+theAnswer_length) Shapes.ShowShape(length_history_text[index_row]) EndFor EndSub Sub hideHistory Shapes.HideShape(hit_title) Shapes.HideShape(blow_title) '----- hide history text For index_row = 1 To number_of_history For index_column = 1 To max_word_length Shapes.HideShape(text_history[index_row][index_column]) Shapes.HideShape(hit_history_text[index_row]) Shapes.HideShape(blow_history_text[index_row]) Shapes.HideShape(length_history_text[index_row]) EndFor EndFor EndSub Sub prepareWindow '----- draw graphic window GraphicsWindow.BackgroundColor = "White" GraphicsWindow.Title = "Master Word" GraphicsWindow.Width = window_width GraphicsWindow.Height = window_height GraphicsWindow.Show() prepareUserWindow() prepareGameWindow() EndSub Sub showTitleWindow ' ----- draw TITLE line GraphicsWindow.BrushColor = "OliveDrab" GraphicsWindow.FillRectangle(left_title_area-width_box_margin,top_title_area+height_title_area-5,width_title_area+width_box_margin*2,5) ' ----- draw TITLE animation GraphicsWindow.FontName = "Meiryo" GraphicsWindow.FontSize = 24 font_height = 30 font_width = 20 GraphicsWindow.BrushColor = "Green" title_char[1] = "M" title_char[2] = "A" title_char[3] = "S" title_char[4] = "T" title_char[5] = "E" title_char[6] = "R" title_char[7] = "W" title_char[8] = "O" title_char[9] = "R" title_char[10] = "D" For index_row = 1 To 10 left_position = (index_row-1) * 30 + left_title_area If (index_row > 6) Then left_position = left_position + 40 EndIf title_text[index_row] = Shapes.AddText(title_char[index_row]) For top_position = 0 To top_title_area Shapes.Move(title_text[index_row], left_position,top_position) Program.Delay(10) EndFor EndFor ' ----- draw description GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = FontSize_medium description = Controls.AddMultiLineTextBox(left_main_area,top_main_area) Controls.SetSize(description,width_main_area,height_main_area) Controls.SetTextBoxText(description,description_text) ' ----- draw start_button GraphicsWindow.FontSize = FontSize_small start_button = Controls.AddButton("Start",left_handler_area,top_handler_area+height_adjust_button) EndSub Sub hideDescription Controls.HideControl(description) Controls.HideControl(start_button) EndSub Sub prepareUserWindow ' ----- draw title newuser GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.BrushColor = "Gray" title_newuser = Shapes.AddText("") Shapes.Move(title_newuser,left_hint_area,top_hint_area) Shapes.HideShape(title_newuser) Shapes.SetText(title_newuser,"新規ユーザー登録(名前を入力)") ' ----- draw newuser textbox GraphicsWindow.FontSize = FontSize_big GraphicsWindow.BrushColor = "Black" newuser = Controls.AddTextBox(left_try_area,top_try_area) Controls.HideControl(newuser) Controls.SetSize(newuser,width_try_area,height_try_area) GraphicsWindow.FontSize = FontSize_small newuser_button = Controls.AddButton("登録",left_handler_area,top_try_area) Controls.HideControl(newuser_button) ' ----- draw title userlist GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.BrushColor = "Gray" title_userlist = Shapes.AddText("") Shapes.Move(title_userlist,left_main_area,top_border_area) Shapes.HideShape(title_userlist) Shapes.SetText(title_userlist,"") ' ----- draw userlist GraphicsWindow.BrushColor = "Black" For i = 1 To number_of_history GraphicsWindow.FontSize = FontSize_big top_position = top_history_area + (i-1)*(height_box+height_box_margin) userlist[i] = Shapes.AddText("") Shapes.Move(userlist[i],left_main_area,top_position) Shapes.HideShape(userlist[i]) GraphicsWindow.FontSize = FontSize_small userlist_button[i] = Controls.AddButton("選択",left_handler_area,top_position+height_adjust_button) Controls.HideControl(userlist_button[i]) userlist_button_delete[i] = Controls.AddButton("削除",left_handler_area+width_box*2+width_box_margin,top_position+height_adjust_button) Controls.HideControl(userlist_button_delete[i]) EndFor EndSub Sub showUserWindow checkUserList() ' ----- show newuser If (Number_of_registered_user < number_of_history) Then Shapes.ShowShape(title_newuser) Controls.ShowControl(newuser) Controls.ShowControl(newuser_button) Else Shapes.HideShape(title_newuser) Controls.HideControl(newuser) Controls.HideControl(newuser_button) EndIf ' ----- show title If (Number_of_registered_user <> 0) Then Shapes.SetText(title_userlist,"ユーザー選択 (ハイスコア)") Shapes.ShowShape(title_userlist) ' ----- show userlist For i = 1 To number_of_history If (Name[i] = "") Then Shapes.SetText(userlist[i],i+":(未登録)") Controls.HideControl(userlist_button[i]) Controls.HideControl(userlist_button_delete[i]) Else Shapes.SetText(userlist[i],i+": "+Name[i]+"("+HighScore[i]+")") Controls.ShowControl(userlist_button[i]) Controls.ShowControl(userlist_button_delete[i]) EndIf Shapes.ShowShape(userlist[i]) EndFor Else Shapes.HideShape(title_userlist) For i = 1 To number_of_history Shapes.HideShape(userlist[i]) Controls.HideControl(userlist_button[i]) Controls.HideControl(userlist_button_delete[i]) EndFor EndIf EndSub Sub hideUserWindow Shapes.HideShape(title_newuser) Controls.HideControl(newuser) Controls.HideControl(newuser_button) Shapes.HideShape(title_userlist) For i = 1 To number_of_history Shapes.HideShape(userlist[i]) Controls.HideControl(userlist_button[i]) Controls.HideControl(userlist_button_delete[i]) EndFor EndSub Sub prepareGameWindow ' ----- draw userselect_button GraphicsWindow.FontSize = FontSize_small GraphicsWindow.BrushColor = "Black" userselect_button = Controls.AddButton("Back",left_help_area+width_box*3,top_help_area-20) Controls.HideControl(userselect_button) ' ----- draw user_name GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.BrushColor = "Black" current_user = Shapes.AddText("") Shapes.Move(current_user,left_help_area,top_help_area+hight_font_medium) Shapes.HideShape(current_user) ' ----- draw Score / High Score GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.BrushColor = current_score_color current_score_title = Shapes.AddText("SCORE") Shapes.Move(current_score_title,left_handler_area,top_handler_area) Shapes.HideShape(current_score_title) current_score_text = Shapes.AddText("") Shapes.Move(current_score_text,left_handler_area,top_handler_area+hight_font_medium) Shapes.HideShape(current_score_text) GraphicsWindow.BrushColor = high_score_color high_score_title = Shapes.AddText("HIGH") Shapes.Move(high_score_title,left_handler_area+width_box*3,top_handler_area) Shapes.HideShape(high_score_title) high_score_text = Shapes.AddText("") Shapes.Move(high_score_text,left_handler_area+width_box*3,top_handler_area+hight_font_medium) Shapes.HideShape(high_score_text) ' ----- draw point GraphicsWindow.BrushColor = point_color point_title = Shapes.AddText("POINT") Shapes.Move(point_title,left_handler_area,top_hint_area) Shapes.HideShape(point_title) point_text = Shapes.AddText("") Shapes.Move(point_text,left_handler_area,top_hint_area+hight_font_medium+hight_font_medium_margin) Shapes.HideShape(point_text) ' ----- draw use hint GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = FontSize_small hint_button = Controls.AddButton("Hint",left_handler_area+width_box*3,top_hint_area+height_adjust_button) Controls.HideControl(hint_button) ' ----- draw answer GraphicsWindow.FontSize = FontSize_big GraphicsWindow.PenColor = pen_color_answer For index_column = 1 to max_word_length GraphicsWindow.BrushColor = brush_color_answer left_position = (index_column-1)*(width_box + width_box_margin) + left_answer_area rectangle_answer[index_column] = Shapes.AddRectangle(width_box, height_box) Shapes.Move(rectangle_answer[index_column], left_position, top_answer_area) Shapes.HideShape(rectangle_answer[index_column]) answer_text[index_column] = Shapes.AddText("") Shapes.Move(answer_text[index_column],left_position+width_adjust_text,top_answer_area+height_adjust_text) Shapes.HideShape(answer_text[index_column]) EndFor ' ----- draw hint box GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "White" hintbox = Shapes.AddRectangle(width_hint_area,height_hint_area) Shapes.Move(hintbox,left_hint_area,top_hint_area) Shapes.HideShape(hintbox) GraphicsWindow.BrushColor = "Black" hint = Shapes.AddText("") Shapes.Move(hint,left_hint_area+width_adjust_text,top_hint_area+height_adjust_text) Shapes.HideShape(hint) ' ----- draw try box GraphicsWindow.FontSize = FontSize_small GraphicsWindow.BrushColor = "Black" set_button = Controls.AddButton("",left_try_area-width_box,top_try_area+height_adjust_button) Controls.HideControl(set_button) GraphicsWindow.PenColor = pen_color_try GraphicsWindow.BrushColor = brush_color_try For index_column = 1 to max_word_length left_position = (index_column-1)*(width_box + width_box_margin) + left_try_area rectangle_try[index_column] = Shapes.AddRectangle(width_box, height_box) Shapes.Move(rectangle_try[index_column], left_position, top_try_area) Shapes.HideShape(rectangle_try[index_column]) EndFor GraphicsWindow.PenColor = pen_color_current GraphicsWindow.BrushColor = brush_color_current rectangle_try_current = Shapes.AddRectangle(width_box,height_box) Shapes.Move(rectangle_try_current,left_try_area,top_try_area) Shapes.HideShape(rectangle_try_current) '----- draw try text GraphicsWindow.FontSize = FontSize_big GraphicsWindow.BrushColor = "Black" For index_column = 1 To max_word_length left_position = (index_column-1)*(width_box+width_box_margin) + left_try_area textbox_try[index_column] = Shapes.AddText("") Shapes.Move(textbox_try[index_column],left_position+width_adjust_text,top_try_area+height_adjust_text) Shapes.HideShape(textbox_try[index_column]) EndFor ' [ draw try_button ] GraphicsWindow.FontSize = FontSize_small GraphicsWindow.BrushColor = "Black" button_try = Controls.AddButton(" Try! ",left_handler_area,top_try_area+height_adjust_button) Controls.HideControl(button_try) ' [ draw nextgame_button ] nextgame_button = Controls.AddButton("next",left_handler_area+width_box*2,top_try_area+height_adjust_button) Controls.HideControl(nextgame_button) ' ----- draw border_text GraphicsWindow.FontSize = FontSize_big GraphicsWindow.BrushColor = "Red" border_text = Shapes.AddText("") Shapes.Move(border_text,left_border_area,top_border_area) Shapes.HideShape(border_text) '----- draw hit/blow title GraphicsWindow.FontSize = FontSize_big GraphicsWindow.BrushColor = brush_color_hit hit_title = Shapes.AddText("Hit") Shapes.Move(hit_title,left_handler_area,top_border_area) Shapes.HideShape(hit_title) GraphicsWindow.BrushColor = brush_color_blow blow_title = Shapes.AddText("Blow") Shapes.Move(blow_title,left_handler_area+width_box*2,top_border_area) Shapes.HideShape(blow_title) '----- draw history text For index_row = 1 To number_of_history GraphicsWindow.FontSize = FontSize_big GraphicsWindow.BrushColor = brush_color_history[index_row] top_position = (index_row-1)*(height_box+height_box_margin)+top_history_area For index_column = 1 To max_word_length left_position = (index_column-1)*(width_box+width_box_margin)+left_history_area text_history[index_row][index_column] = Shapes.AddText("") Shapes.Move(text_history[index_row][index_column],left_position+width_adjust_text,top_position+height_adjust_text) Shapes.HideShape(text_history[index_row][index_column]) EndFor GraphicsWindow.BrushColor = brush_color_hit hit_history_text[index_row] = Shapes.AddText("") Shapes.Move(hit_history_text[index_row],left_handler_area,top_position) Shapes.HideShape(hit_history_text[index_row]) GraphicsWindow.BrushColor = brush_color_blow blow_history_text[index_row] = Shapes.AddText("") Shapes.Move(blow_history_text[index_row],left_handler_area+width_box*2,top_position) Shapes.HideShape(blow_history_text[index_row]) GraphicsWindow.FontSize = FontSize_medium GraphicsWindow.BrushColor = "Black" length_history_text[index_row] = Shapes.AddText("") Shapes.Move(length_history_text[index_row],left_handler_area+width_box*4,top_position+5) Shapes.HideShape(length_history_text[index_row]) EndFor EndSub Sub chooseWord 'TextWindow.WriteLine(number_of_answer) theAnswer_index = Math.GetRandomNumber(number_of_answer) + 1 'TextWindow.WriteLine(theAnswer_index) theAnswer = csv_data[theAnswer_index][1] 'TextWindow.WriteLine(theAnswer) theAnswer_length = Text.GetLength(theAnswer) For i = 1 To theAnswer_length theAnswer_character[i] = Text.GetSubText(theAnswer,i,1) EndFor EndSub Sub readSettingFile ' The following line could be harmful and has been automatically commented. ' masterword_settingfile = File.GetSettingsFilePath() ' The following line could be harmful and has been automatically commented. ' txt_buffer = File.ReadContents(masterword_settingfile) If (Text.GetLength(txt_buffer)=0) Then For i = 1 To number_of_history Name[i] = "" HighScore[i] = 0 EndFor writeSettingFile() Else For i = 1 To number_of_history ' The following line could be harmful and has been automatically commented. ' Name[i] = File.ReadLine(masterword_settingfile,2*i-1) ' The following line could be harmful and has been automatically commented. ' HighScore[i] = File.ReadLine(masterword_settingfile,2*i) EndFor EndIf checkUserList() EndSub Sub checkUserList Number_of_registered_user = 0 index_newuser = 0 For i = 1 To number_of_history If (Name[i] = "") Then If (index_newuser = 0) Then index_newuser = i EndIf Else Number_of_registered_user = Number_of_registered_user + 1 EndIf EndFor EndSub Sub addNewuser newuser_name = Controls.GetTextBoxText(newuser) If (newuser_name <> "") Then Name[index_newuser] = newuser_name HighScore[index_newuser] = 0 writeSettingFile() showUserWindow() EndIf EndSub Sub deleteUser If (index_deleteuser <= number_of_history) Then Name[index_deleteuser] = "" HighScore[index_deleteuser] = "" writeSettingFile() showUserWindow() EndIf EndSub Sub writeSettingFile ' The following line could be harmful and has been automatically commented. ' masterword_settingfile = File.GetSettingsFilePath() For i = 1 To number_of_history ' The following line could be harmful and has been automatically commented. ' File.WriteLine(masterword_settingfile,2*i-1,Name[i]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(masterword_settingfile,2*i,HighScore[i]) EndFor EndSub Sub readDataFile path = Program.Directory masterword_dataFile = path + "\data.csv" ' The following line could be harmful and has been automatically commented. ' txt_buffer = File.ReadContents(masterword_dataFile) If (Text.GetLength(txt_buffer)=0) Then game_mode = "MASTER MIND" Else game_mode = "MASTER WORD" readCSVData() EndIf EndSub Sub readCSVData '----- read row csv_index_row = 1 ' The following line could be harmful and has been automatically commented. ' csv_line = File.ReadLine(masterword_dataFile, csv_index_row) While (csv_line <> "") '----- read line comma_index = Text.GetIndexOf(csv_line,",") csv_index_column = 1 While(comma_index > 0) csv_data[csv_index_row][csv_index_column] = Text.GetSubText(csv_line,1,comma_index-1) csv_line = Text.GetSubTextToEnd(csv_line,comma_index+1) comma_index = Text.GetIndexOf(csv_line,",") csv_index_column = csv_index_column + 1 EndWhile csv_data[csv_index_row][csv_index_column] = csv_line csv_index_row = csv_index_row + 1 ' The following line could be harmful and has been automatically commented. ' csv_line = File.ReadLine(masterword_dataFile, csv_index_row) EndWhile csv_number_of_row = csv_index_row - 1 csv_number_of_column = csv_index_column - 1 number_of_answer = csv_number_of_row - 1 'For i = 1 To csv_number_of_row ' TextWindow.Write("[") ' For j = 1 To csv_number_of_column ' TextWindow.Write(csv_data[i][j] + ",") ' EndFor ' TextWindow.WriteLine("]") 'EndFor EndSub Sub setVariables ' global game_mode = "MASTER MIND" ' ----- window design ' [general] max_word_length = 12 number_of_history = 5 height_box = 40 height_box_margin = 10 width_box = 28 width_box_margin = 7 width_main = max_word_length*width_box + (max_word_length-1)*width_box_margin width_handler = (width_box*2)*2 + width_box_margin width_window_margin = 40 height_window_margin = 30 width_area_margin = 20 height_area_margin = 20 height_adjust_button = 5 width_adjust_text = 5 height_adjust_text = 5 FontSize_big = 24 ' font_height = 30, font_width = 20 FontSize_medium = 18 FontSize_small = 12 hight_font_medium = 20 hight_font_medium_margin = 5 ' FontName_title = "Meiryo" FontSize_title = 24 ' font_height = 30, font_width = 20 FontColor_title = "Green" left_title_area = width_window_margin top_title_area = height_window_margin width_title_area = width_main height_title_area = 30 ' { left_help_area = left_title_area + width_title_area + width_area_margin top_help_area = top_title_area width_help_area = width_handler height_help_area = height_title_area '} ' { left_main_area = left_title_area top_main_area = top_title_area + height_title_area + height_area_margin width_main_area = width_main height_main_area = 0 ' -> answer_area <- { left_answer_area = left_main_area top_answer_area = top_main_area width_answer_area = width_main height_answer_area = height_box height_main_area = height_main_area + height_answer_area + height_area_margin pen_color_answer = "Indigo" brush_color_answer = "DarkViolet" '} ' -> hint_area <- { left_hint_area = left_main_area top_hint_area = top_answer_area + height_answer_area + height_area_margin width_hint_area = width_main height_hint_area = height_box height_main_area = height_main_area + height_hint_area + height_area_margin '} ' -> try_area <- { left_try_area = left_main_area top_try_area = top_hint_area + height_hint_area + height_area_margin width_try_area = width_main height_try_area = height_box height_main_area = height_main_area + height_try_area + height_area_margin pen_color_try = "Gray" brush_color_try = "White" pen_color_current = "Gray" brush_color_current = "LightCyan" '} ' -> border_area <- { left_border_area = left_main_area top_border_area = top_try_area + height_try_area + height_area_margin width_border_area = width_main height_border_area = height_box height_main_area = height_main_area + height_border_area + height_area_margin '} ' -> history_area <- { left_history_area = left_main_area top_history_area = top_border_area + height_border_area + height_area_margin width_history_area = width_main height_history_area = number_of_history*height_box + (number_of_history-1)*height_box_margin height_main_area = height_main_area + height_history_area' + height_area_margin brush_color_history[1] = "Navy" brush_color_history[2] = "SteelBlue" brush_color_history[3] = "LightSteelBlue" brush_color_history[4] = "SkyBlue" brush_color_history[5] = "LightBlue" brush_color_hit = "Red" brush_color_blow = "Blue" '} '} ' { left_handler_area = left_main_area + width_main_area + width_area_margin top_handler_area = top_main_area width_handler_area = width_handler height_handler_area = height_main_area ' -> result_history_area <- { left_result_history_area = left_handler_area top_result_history_area = top_history_area width_result_history_area = width_handler height_result_history_area = height_history_area '} '} ' [window] window_width = width_window_margin*2 + width_main + width_area_margin + width_handler window_height = height_window_margin*2 + height_title_area + height_area_margin + height_main_area ' Score current_score_color = "Red" high_score_color = "Green" point_color = "Blue" crlf = Text.GetCharacter(13)+Text.GetCharacter(10) description_text = "・単語を問題として出します。"+crlf description_text = description_text+"・文字を入力して回答してください(Try!)"+crlf+crlf description_text = description_text+"Hit :文字種も位置も当たっています"+crlf description_text = description_text+"Blow:文字種は当たっていますが位置が違います"+crlf+crlf description_text = description_text+"・答えを推理して5回以内に当ててください"+crlf description_text = description_text+"・回数が増える毎に点数が減ります"+crlf description_text = description_text+"・Hintを使うと文字の読み方が与えられます"+crlf description_text = description_text+" しかし点数が半分になります"+crlf+crlf description_text = description_text+"・答えはキーボードで入力して下さい"+crlf description_text = description_text+" (←,→,delete,BackSpaceも使えます)"+crlf description_text = description_text+" (入力できないときは空ボタンを押してください)"+crlf EndSub Sub moveChracterBackground left_position = Shapes.GetLeft(rectangle_try_current) top_position = Shapes.GetTop(rectangle_try_current) left_position_to_go = (index_character-1)*(width_box + width_box_margin)+left_try_area Shapes.Move(rectangle_try_current, left_position_to_go, top_position) EndSub Sub setEventHander Controls.ButtonClicked = eventButtonClicked GraphicsWindow.KeyDown = eventKeyDown EndSub Sub eventButtonClicked If (Controls.LastClickedButton = button_try) Then examineTryWord() EndIf If (Controls.LastClickedButton = newuser_button) Then addNewuser() EndIf If (Controls.LastClickedButton = userlist_button_delete[1]) Then index_deleteuser = 1 deleteUser() EndIf If (Controls.LastClickedButton = userlist_button_delete[2]) Then index_deleteuser = 2 deleteUser() EndIf If (Controls.LastClickedButton = userlist_button_delete[3]) Then index_deleteuser = 3 deleteUser() EndIf If (Controls.LastClickedButton = userlist_button_delete[4]) Then index_deleteuser = 4 deleteUser() EndIf If (Controls.LastClickedButton = userlist_button_delete[5]) Then index_deleteuser = 5 deleteUser() EndIf If (Controls.LastClickedButton = userlist_button[1]) Then index_user = 1 hideUserWindow() executeGames() EndIf If (Controls.LastClickedButton = userlist_button[2]) Then index_user = 2 hideUserWindow() executeGames() EndIf If (Controls.LastClickedButton = userlist_button[3]) Then index_user = 3 hideUserWindow() executeGames() EndIf If (Controls.LastClickedButton = userlist_button[4]) Then index_user = 4 hideUserWindow() executeGames() EndIf If (Controls.LastClickedButton = userlist_button[5]) Then index_user = 5 hideUserWindow() executeGames() EndIf If (Controls.LastClickedButton = hint_button) Then Controls.HideControl(hint_button) hint_is_used = "TRUE" showHint() showScore() EndIf If (Controls.LastClickedButton = start_button) Then hideDescription() showUserWindow() EndIf If (Controls.LastClickedButton = userselect_button) Then writeSettingFile() hideGameWindow() showUserWindow() EndIf If (Controls.LastClickedButton = nextgame_button) Then Controls.HideControl(nextgame_button) executNextGame() EndIf EndSub Sub eventKeyDown character = GraphicsWindow.LastKey If (character = "A") Then eventAlphabetInput() EndIf If (character = "B") Then eventAlphabetInput() EndIf If (character = "C") Then eventAlphabetInput() EndIf If (character = "D") Then eventAlphabetInput() EndIf If (character = "E") Then eventAlphabetInput() EndIf If (character = "F") Then eventAlphabetInput() EndIf If (character = "G") Then eventAlphabetInput() EndIf If (character = "H") Then eventAlphabetInput() EndIf If (character = "I") Then eventAlphabetInput() EndIf If (character = "J") Then eventAlphabetInput() EndIf If (character = "K") Then eventAlphabetInput() EndIf If (character = "L") Then eventAlphabetInput() EndIf If (character = "M") Then eventAlphabetInput() EndIf If (character = "N") Then eventAlphabetInput() EndIf If (character = "O") Then eventAlphabetInput() EndIf If (character = "P") Then eventAlphabetInput() EndIf If (character = "Q") Then eventAlphabetInput() EndIf If (character = "R") Then eventAlphabetInput() EndIf If (character = "S") Then eventAlphabetInput() EndIf If (character = "T") Then eventAlphabetInput() EndIf If (character = "U") Then eventAlphabetInput() EndIf If (character = "V") Then eventAlphabetInput() EndIf If (character = "W") Then eventAlphabetInput() EndIf If (character = "X") Then eventAlphabetInput() EndIf If (character = "Y") Then eventAlphabetInput() EndIf If (character = "Z") Then eventAlphabetInput() EndIf If (character = "Back") Then eventDeleteCharacter() EndIf If (character = "Delete") Then eventDeleteCharacter() EndIf If (character = "Left") Then eventBackCharacter() EndIf If (character = "Right") Then eventForwardCharacter() EndIf EndSub Sub eventAlphabetInput If (key_enabled = "TRUE") Then If (flag_empty = "TRUE") Then Shapes.SetText(border_text,"") flag_empty = "FALSE" EndIf If (index_character <> 1) Then character = Text.ConvertToLowerCase(character) EndIf Shapes.SetText(textbox_try[index_character],character) tryCharacter[index_character] = character If (index_character = theAnswer_length) Then index_character = 1 Else index_character = index_character + 1 EndIf moveChracterBackground() EndIf 'TextWindow.Write(key_enabled + ":" + character) EndSub Sub eventDeleteCharacter If (key_enabled = "TRUE") Then If (flag_empty = "TRUE") Then Shapes.SetText(border_text,"") flag_empty = "FALSE" EndIf Shapes.SetText(textbox_try[index_character],"") tryCharacter[index_character] = "" EndIf EndSub Sub eventForwardCharacter If (key_enabled = "TRUE") Then If (flag_empty = "TRUE") Then Shapes.SetText(border_text,"") flag_empty = "FALSE" EndIf If (index_character = theAnswer_length) Then index_character = 1 Else index_character = index_character + 1 EndIf moveChracterBackground() EndIf EndSub Sub eventBackCharacter If (key_enabled = "TRUE") Then If (flag_empty = "TRUE") Then Shapes.SetText(border_text,"") flag_empty = "FALSE" EndIf If (index_character = 1) Then index_character = theAnswer_length Else index_character = index_character - 1 EndIf moveChracterBackground() EndIf EndSub End>RLB718.sb< Start>RLD546.sb< TextWindow.WriteLine ("Prime Minister" ) WaitEnter () TextWindow.ForegroundColor = "Yellow" Popularity = 55 Population = 14.98 Adults = 9.985 EducationBudget = 300 HealthBudget = 300 HousingBudget = 85 DefenceBudget = 85 OtherCosts = 170 OtherExpenses = 0 Wage = 300 UnemployedPay = 100 Pension = 100 Exports = 200 Imports = 200 EmployedPrivate = 6.99 EmployedGovt = 2 Unemployed = 0.5 OnPension = 0.495 InflationRate = 3 InterestRate = 5 Borrowed = 0 Loans = 0 OverseasInvestVariable = 0 ExchangeRate = 0.90 CompanyTax = 2000 IncomeTaxRate = 0.25 GSTRate = 0.1 CompanyTaxRate = 0.37 GovtMajority = 5 Week = 0 Acontrol = 0 Bcontrol = 0 Ccontrol = 0 Dcontrol = 0 Econtrol = 0 Fcontrol = 0 Gcontrol = 0 Hcontrol = 0 Icontrol = 0 Jcontrol = 0 Kcontrol = 0 Lcontrol = 0 Mcontrol = 0 Ncontrol = 0 Ocontrol = 0 Pcontrol = 0 Qcontrol = 0 Rcontrol = 0 Scontrol = 0 Tcontrol = 0 Ucontrol = 0 Vcontrol = 0 Wcontrol = 0 Xcontrol = 0 Ycontrol = 0 Zcontrol = 0 Acontrol1 = 0 Bcontrol1 = 0 Ccontrol1 = 0 Dcontrol1 = 0 Econtrol1 = 0 Fcontrol1 = 0 Gcontrol1 = 0 For weeks = 1 to 53 If weeks > 52 Then TextWindow.WriteLine ("Game Over" ) EndIf Statistics () For events = 1 To 3 issues = Math.GetRandomNumber (33) If issues = 1 And Acontrol = 0 then Acontrol = 1 Disaster () EndIf If issues = 2 And Bcontrol = 0 Then Bcontrol = 1 Wages () EndIf If issues = 3 And Ccontrol = 0 Then Ccontrol = 1 Recession () EndIf If issues = 4 And Dcontrol = 0 Then Dcontrol = 1 Building () EndIf If issues = 5 And Econtrol = 0 Then Econtrol = 1 Dole () EndIf If issues = 6 And Fcontrol = 0 Then Fcontrol = 1 Pension () EndIf If issues = 7 And Gcontrol = 0 Then Gcontrol = 1 Defence () EndIf If issues = 8 And Hcontrol = 0 Then Hcontrol = 1 Diplomacy () EndIf If issues = 9 And Icontrol = 0 Then Icontrol = 1 Imports () EndIf If issues = 10 And Jcontrol = 0 Then Jcontrol = 1 Health () EndIf If issues = 11 And Kcontrol = 0 Then Kcontrol = 1 PrivateSector () EndIf If issues = 12 And Lcontrol = 0 Then Lcontrol = 1 InterestRates () EndIf If issues = 13 And Mcontrol = 0 Then Mcontrol = 1 OverseasInvestment () EndIf If issues = 14 And Ncontrol = 0 Then Ncontrol = 1 Exports () EndIf If issues = 15 And Ocontrol = 0 Then Ocontrol = 1 Inflation () EndIf If issues = 16 And Pcontrol = 0 Then Pcontrol = 1 Unemployment () EndIf If issues = 17 And Qcontrol = 0 Then Qcontrol = 1 UrgentProblems () EndIf If issues = 18 And Rcontrol = 0 Then Rcontrol = 1 ByElection () EndIf If issues = 19 And Scontrol = 0 Then Scontrol = 1 ExchangeRate () EndIf If issues = 20 And Tcontrol = 0 Then Tcontrol = 1 BudgetIncomeTax () EndIf If issues = 21 And Ucontrol = 0 Then Ucontrol = 1 BudgetGST () EndIf If issues = 22 And Vcontrol = 0 Then Vcontrol = 1 BudgetCompanyTax () EndIf If issues = 23 And Wcontrol = 0 Then Wcontrol = 1 Education () EndIf If issues = 24 And Xcontrol = 0 Then Xcontrol = 1 OpinionPoll () EndIf If issues = 25 And Ycontrol = 0 Then Ycontrol = 1 MattersForAction () EndIf If issues = 26 And Zcontrol = 0 Then Zcontrol = 1 Immigration () EndIf If issues = 27 And Acontrol1 = 0 Then Acontrol1 = 1 ShareMarket () EndIf If issues = 28 And Bcontrol1 = 0 Then Bcontrol1 = 1 OverseasTrade () EndIf If issues = 29 And Ccontrol1 = 0 Then Ccontrol1 = 1 OlympicGames () EndIf If issues = 30 And Dcontrol1 = 0 Then Dcontrol1 = 1 LuckyDay () EndIf If issues = 31 And Econtrol1 = 0 Then Econtrol1 = 1 BudgetTime () EndIf If issues = 32 And Fcontrol1 = 0 Then Fcontrol1 = 1 NoConfidence () EndIf If issues = 33 And Gcontrol1 = 0 Then Gcontrol1 = 1 MajorProject () EndIf If events = 3 Then Acontrol = 0 Bcontrol = 0 Ccontrol = 0 Dcontrol = 0 Econtrol = 0 Fcontrol = 0 Gcontrol = 0 Hcontrol = 0 Icontrol = 0 Jcontrol = 0 Kcontrol = 0 Lcontrol = 0 Mcontrol = 0 Ncontrol = 0 Ocontrol = 0 Pcontrol = 0 Qcontrol = 0 Rcontrol = 0 Scontrol = 0 Tcontrol = 0 Ucontrol = 0 Vcontrol = 0 Wcontrol = 0 Xcontrol = 0 Ycontrol = 0 Zcontrol = 0 Acontrol1 = 0 Bcontrol1 = 0 Ccontrol1 = 0 Dcontrol1 = 0 Fcontrol1 = 0 Gcontrol1 = 0 EndIf EndFor EndFor Sub Disaster catastrophe = Math.GetRandomNumber (5) If catastrophe = 1 Then name = "Cyclone" EndIf If catastrophe = 2 Then name = "Bushfire" EndIf If catastrophe = 3 Then name = "Floods" EndIf If catastrophe = 4 Then name = "Earthquake" EndIf If catastrophe = 5 Then name = "Terrorist Bomber attacks" EndIf TextWindow.WriteLine(name + ". Disaster Relief urgently needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Provide $400 Million relief" ) TextWindow.WriteLine ("2. Provide $200 Million relief" ) TextWindow.WriteLine ("3. Provide no relief" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$400 Million provided" ) TextWindow.WriteLine ("Government Popularity Up" ) OtherExpenses = OtherExpenses + 400 Popularity = Popularity + 5 EndIf If choice = 2 Then TextWindow.WriteLine ("$200 Million provided" ) TextWindow.WriteLine ("Government Popularity Steady" ) OtherExpenses = OtherExpenses + 200 Popularity = Popularity + 2 EndIf If choice = 3 Then TextWindow.WriteLine ("No Aid provided" ) TextWindow.WriteLine ("Government Popularity Down" ) Popularity = Popularity - 5 EndIf WaitEnter() EndSub Sub Wages TextWindow.WriteLine ("Wage Demand. Workers want $30 Pay Rise" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Award them $30 rise" ) TextWindow.WriteLine ("2. Compromise. Award them $15" ) TextWindow.WriteLine ("3. Give them no extra money" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$30 pay rise awarded" ) TextWindow.WriteLine ("Employment down by 10,000" ) TextWindow.WriteLine ("Government Popularity Up" ) Wage = Wage + 30 Popularity = Popularity + 3 InflationRate = InflationRate + 0.5 EmployedPrivate = EmployedPrivate - 0.01 EndIf If choice = 2 Then TextWindow.WriteLine ("$15 rise awarded" ) TextWindow.WriteLine ("Government Popularity drifts" ) Wage = Wage + 15 Popularity = Popularity - 1 InflationRate = InflationRate + 0.25 EndIf If choice = 3 Then TextWindow.WriteLine ("Workers Strike" ) TextWindow.WriteLine ("$20 million lost in overseas trade balance" ) TextWindow.WriteLine ("Government Popularity falls" ) Popularity = Popularity - 5 Imports = Imports + 10 Exports = Exports - 10 EndIf WaitEnter() EndSub Sub Recession TextWindow.WriteLine ("Recession threatens jobs - Government support needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Give $1000 million tax rebate" ) TextWindow.WriteLine ("2. Provide $500 million rebate" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$1000 million rebate provided" ) TextWindow.WriteLine ("40,000 new jobs provided" ) TextWindow.WriteLine ("Government Popularity Up" ) OtherExpenses = OtherExpenses + 1000 Popularity = Popularity + 5 InflationRate = InflationRate + 1 EmployedPrivate = EmployedPrivate + 0.04 EndIf If choice = 2 Then TextWindow.WriteLine ("$500 million rebate provided" ) TextWindow.WriteLine ("10,000 new jobs created" ) TextWindow.WriteLine ("Government Popularity improves" ) OtherExpenses = OtherExpenses + 500 Popularity = Popularity + 2 InflationRate = InflationRate + 0.25 EmployedPrivate = EmployedPrivate + 0.01 EndIf If choice = 3 Then TextWindow.WriteLine ("Ignore Problem" ) TextWindow.WriteLine ("100,000 workers sacked" ) TextWindow.WriteLine ("Government Popularity plummets" ) Popularity = Popularity - 4 EmployedPrivate = EmployedPrivate - 0.1 InterestRate = InterestRate + 1 InflationRate = InflationRate - 0.5 EndIf WaitEnter() EndSub Sub Building TextWindow.WriteLine ("Building Industry slumps - Government assistance needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Provide $500 million subsidy" ) TextWindow.WriteLine ("2. Add $30 million to budget" ) TextWindow.WriteLine ("3. Do nothing" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Spend $500 million on Housing" ) TextWindow.WriteLine ("Government Popularity Up" ) OtherExpenses = OtherExpenses + 500 Popularity = Popularity + 3 EndIf If choice = 2 Then TextWindow.WriteLine ("Add $30 million to budget" ) TextWindow.WriteLine ("Government Popularity improves" ) HousingBudget = HousingBudget + 30 Popularity = Popularity + 2 EndIf If choice = 3 Then TextWindow.WriteLine ("No assistance for Housing" ) TextWindow.WriteLine ("Unemployed up by 20,000" ) TextWindow.WriteLine ("Government Popularity drops" ) Popularity = Popularity - 3 EmployedPrivate = EmployedPrivate - 0.2 InterestRate = InterestRate + 0.5 InflationRate = InflationRate -0.5 EndIf WaitEnter() EndSub Sub Dole TextWindow.WriteLine ("Pressure to raise unemployment benefits" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Increase benefit by $10" ) TextWindow.WriteLine ("2. Award extra $5 benefit" ) TextWindow.WriteLine ("3. Give them no extra money" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$10 increase awarded" ) TextWindow.WriteLine ("Government Popularity Up" ) UnemployedPay = UnemployedPay + 10 Popularity = Popularity + 1 EndIf If choice = 2 Then TextWindow.WriteLine ("Award extra $5 benefit" ) TextWindow.WriteLine ("Government Popularity wavers" ) UnemployedPay = UnemployedPay + 5 Popularity = Popularity - 1 EndIf If choice = 3 Then TextWindow.WriteLine ("No extra benefit" ) TextWindow.WriteLine ("Government Popularity drops" ) Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub Pension TextWindow.WriteLine ("Pensioners below poverty line. $10 increase needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Add $10 to pension" ) TextWindow.WriteLine ("2. Compromise. Add $5" ) TextWindow.WriteLine ("3. Give them no increase" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$10 increase awarded" ) TextWindow.WriteLine ("Government Popularity Up" ) Pension = Pension + 10 Popularity = Popularity + 1 EndIf If choice = 2 Then TextWindow.WriteLine ("$5 pension increase awarded" ) Pension = Pension + 5 EndIf If choice = 3 Then TextWindow.WriteLine ("No increase awarded" ) TextWindow.WriteLine ("Government Popularity down" ) Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub Defence TextWindow.WriteLine ("Defence scare. Community demands action" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Spend $400 million on defence" ) TextWindow.WriteLine ("2. Add $30 million to defence budget" ) TextWindow.WriteLine ("3. Ignore community views" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Spend $400 million on defence" ) TextWindow.WriteLine ("Government Popularity Up" ) OtherExpenses = OtherExpenses + 400 InflationRate = InflationRate + 0.5 Popularity = Popularity + 2 EndIf If choice = 2 Then TextWindow.WriteLine ("Add $30 million to defence budget" ) TextWindow.WriteLine ("Government Popularity Improves" ) DefenceBudget = DefenceBudget + 30 InterestRate = InterestRate + 0.25 Popularity = Popularity + 1 EndIf If choice = 3 Then TextWindow.WriteLine ("No action on defence" ) TextWindow.WriteLine ("Government Popularity slides" ) InflationRate = InflationRate - 0.5 InterestRate = InterestRate + 0.25 Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub Diplomacy trade = Math.GetRandomNumber (7) If trade = 1 Then name1 = "China" EndIf If trade = 2 Then name1 = "Japan" EndIf If trade = 3 Then name1 = "Taiwan" EndIf If trade = 4 Then name1 = "India" EndIf If trade = 5 Then name1 = "South Africa" EndIf If trade = 6 Then name1 = "Indonesia" EndIf If trade = 7 Then name1 = "Chile" EndIf TextWindow.WriteLine("Your itinerary is too busy to do all you should" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Visit U.S. President" ) TextWindow.WriteLine ("2. Address United Nations" ) TextWindow.WriteLine ("3. Make trade mission to " + name1) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Visit U.S. President" ) TextWindow.WriteLine ("You both predict a rosy future" ) InterestRate = InterestRate - 1 EmployedPrivate = EmployedPrivate + 0.02 OverseasInvestVariable = OverseasInvestVariable + 20 EndIf If choice = 2 Then TextWindow.WriteLine ("Address United Nations" ) TextWindow.WriteLine ("Government popularity Climbs" ) OverseasInvestVariable = OverseasInvestVariable + 10 Popularity = Popularity + 3 EndIf If choice = 3 Then TextWindow.WriteLine ("New trade deal with " + name1) TextWindow.WriteLine ("Government popularity rises" ) Exports = Exports + 40 Imports = Imports - 40 Popularity = Popularity + 1 EndIf WaitEnter() EndSub Sub Imports TextWindow.WriteLine ("Imports flood in. Trade balance needs adjustment" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Raise all import duty" ) TextWindow.WriteLine ("2. Raise some import duties" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Duty imposed. Imports reduced" ) TextWindow.WriteLine ("Government popularity down" ) Imports = Imports - 20 Exports = Exports + 20 OtherExpenses = OtherExpenses - 50 InterestRate = InterestRate + 0.5 Popularity = Popularity - 2 EndIf If choice = 2 Then TextWindow.WriteLine ("Some import duties imposed" ) TextWindow.WriteLine ("Government popularity slips" ) Imports = Imports - 10 Exports = Exports + 10 OtherExpenses = OtherExpenses - 25 InterestRate = InterestRate + 0.25 Popularity = Popularity - 1 EndIf If choice = 3 Then TextWindow.WriteLine ("Imports continue to flood in" ) TextWindow.WriteLine ("Government popularity up" ) Imports = Imports + 30 Exports = Exports + 30 EmployedPrivate = EmployedPrivate - 0.1 InflationRate = InflationRate + 0.25 InterestRate = InterestRate + 0.25 Popularity = Popularity + 1 EndIf WaitEnter() EndSub Sub Health TextWindow.WriteLine ("Health services inadequate - more money needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Spend $500 million on health" ) TextWindow.WriteLine ("2. Add $30 million to health budget" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Spend $500 million on health" ) TextWindow.WriteLine ("Government popularity rises" ) OtherExpenses = OtherExpenses + 500 EmployedPrivate = EmployedPrivate + 0.2 Popularity = Popularity + 2 EndIf If choice = 2 Then TextWindow.WriteLine ("Health budget increased" ) TextWindow.WriteLine ("Government popularity improves" ) HealthBudget = HealthBudget + 30 Popularity = Popularity + 1 EndIf If choice = 3 Then TextWindow.WriteLine ("No extra money for health" ) TextWindow.WriteLine ("Government popularity drops" ) EmployedPrivate = EmployedPrivate - 0.3 Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub PrivateSector TextWindow.WriteLine ("Private sector needs growth. Government assistance needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Reduce company tax" ) TextWindow.WriteLine ("2. Reduce interest rates" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Company tax reduced" ) TextWindow.WriteLine ("Employment up 20,000" ) TextWindow.WriteLine ("Government popularity up" ) SalesTaxVariable = SalesTaxVariable - 15 CompanyTaxVariable = CompanyTaxVariable + 0.05 EmployedPrivate = EmployedPrivate + 0.2 Popularity = Popularity + 2 EndIf If choice = 2 Then TextWindow.WriteLine ("$200 million interest subsidy" ) TextWindow.WriteLine ("Employment up 10,000" ) InterestRate = InterestRate - 0.5 EmployedPrivate = EmployedPrivate + 0.1 OtherExpenses = OtherExpenses + 200 EndIf If choice = 3 Then TextWindow.WriteLine ("Company profits down" ) TextWindow.WriteLine ("Government popularity down" ) EmployedPrivate = EmployedPrivate - 0.2 CompanyTaxVariable = CompanyTaxVariable - 0.005 Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub InterestRates TextWindow.WriteLine ("Interest rates climb. Government intervention needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Provide $400 million subsidy" ) TextWindow.WriteLine ("2. Provide $200 million subsidy" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$400 million interest subsidy" ) TextWindow.WriteLine ("Interest rate reduced" ) TextWindow.WriteLine ("Government popularity up slightly" ) InterestRate = InterestRate - 1.5 OtherExpenses = OtherExpenses + 400 Popularity = Popularity + 1 EndIf If choice = 2 Then TextWindow.WriteLine ("$200 million interest subsidy" ) TextWindow.WriteLine ("Interest rate held" ) InterestRate = InterestRate - 0.25 OtherExpenses = OtherExpenses + 200 EndIf If choice = 3 Then TextWindow.WriteLine ("Interest rates up" ) TextWindow.WriteLine ("Government popularity down" ) InterestRate = InterestRate + 1 Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub OverseasInvestment TextWindow.WriteLine ("Overseas investment down. Funds dry up" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Increase interest rates" ) TextWindow.WriteLine ("2. Stimulate exports" ) TextWindow.WriteLine ("3. Hope situation will improve" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Increase interest rates" ) TextWindow.WriteLine ("Overseas investment up" ) OverseasInvestVariable = OverseasInvestVariable + 30 InterestRate = InterestRate + 1 InflationRate = InflationRate + 0.5 EndIf If choice = 2 Then TextWindow.WriteLine ("Subsidise exports by $50 million" ) TextWindow.WriteLine ("Government popularity up" ) Exports = Exports + 25 Imports = Imports - 25 Popularity = Popularity + 1 OtherExpenses = OtherExpenses + 50 EndIf If choice = 3 Then TextWindow.WriteLine ("Overseas investment down" ) TextWindow.WriteLine ("Government popularity down" ) OverseasInvestVariable = OverseasInvestVariable - 40 Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub Exports TextWindow.WriteLine ("Overseas investment down. Funds dry up" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Subsidise exports by $500 million" ) TextWindow.WriteLine ("2. Subsidise exports by $200 million" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$500 million export subsidy provided" ) TextWindow.WriteLine ("Exports up" ) TextWindow.WriteLine ("Government popularity jumps" ) Exports = Exports + 30 Imports = Imports - 30 OtherExpenses = OtherExpenses + 500 Popularity = Popularity + 3 EndIf If choice = 2 Then TextWindow.WriteLine ("$200 million subsidy provided" ) TextWindow.WriteLine ("Exports improve" ) Exports = Exports + 10 Imports = Imports - 10 OtherExpenses = OtherExpenses + 200 Popularity = Popularity + 1 EndIf If choice = 3 Then TextWindow.WriteLine ("Employment down by 20,000" ) TextWindow.WriteLine ("Government popularity down" ) Exports = Exports - 30 Imports = Imports + 30 EmployedPrivate = EmployedPrivate -0.2 Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub Inflation TextWindow.WriteLine ("Inflation growing rapidly. Government action needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Cut government spending" ) TextWindow.WriteLine ("2. Restrain private sector" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Cut government programs" ) TextWindow.WriteLine ("Inflation rate reduced" ) TextWindow.WriteLine ("Government popularity plummets" ) DefenceBudget = DefenceBudget - 10 HousingBudget = HousingBudget - 10 EducationBudget = EducationBudget - 10 HealthBudget = HealthBudget - 10 InflationRate = InflationRate - 2 Popularity = Popularity - 4 EndIf If choice = 2 Then TextWindow.WriteLine ("Increase income tax rate" ) TextWindow.WriteLine ("Inflation rate held" ) TextWindow.WriteLine ("Government popularity on the skids" ) IncomeTax = IncomeTax + 50 InflationRate = InflationRate - 1 Popularity = Popularity - 5 EndIf If choice = 3 Then TextWindow.WriteLine ("Inflation rate up" ) TextWindow.WriteLine ("Government popularity down" ) InflationRate = InflationRate + 1 Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub Unemployment TextWindow.WriteLine ("Unemployment increasing. Government action needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Stimulate economy" ) TextWindow.WriteLine ("2. Add government jobs" ) TextWindow.WriteLine ("3. Hope things will improve" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Reduce income tax" ) TextWindow.WriteLine ("Employment up by 20,000" ) TextWindow.WriteLine ("Government popularity rises" ) EmployedPrivate = EmployedPrivate + 0.02 IncomeTaxVariable = IncomeTaxVariable - 50 Popularity = Popularity + 2 EndIf If choice = 2 Then TextWindow.WriteLine ("Add 10,000 government employees" ) TextWindow.WriteLine ("Government popularity improves" ) EmployedGovt = EmployedGovt + 0.01 Popularity = Popularity + 1 EndIf If choice = 3 Then TextWindow.WriteLine ("50,000 employees sacked" ) TextWindow.WriteLine ("Government popularity drops" ) EmployedPrivate = EmployedPrivate - 0.05 Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub UrgentProblems TextWindow.WriteLine ("Urgent problems need your attention" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Sack problem minister" ) TextWindow.WriteLine ("2. Appoint a Royal Commission" ) TextWindow.WriteLine ("3. Hold Premiers Conference" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then problem1 = Math.GetRandomNumber (2) If problem1 = 1 Then name2 = "and goes quietly" EndIf If problem1 = 2 Then name2 = "but attacks your decision in the media" EndIf TextWindow.WriteLine ("Minister sacked " + name2 ) If problem1 = 1 Then TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 1 EndIf If problem1 = 2 Then TextWindow.WriteLine ("Government popularity drops" ) Popularity = Popularity - 2 EndIf EndIf If choice = 2 Then TextWindow.WriteLine ("Royal Commission appointed. Cost $100 million" ) TextWindow.WriteLine ("Government popularity improves" ) OtherExpenses = OtherExpenses + 100 Popularity = Popularity + 1 EndIf If choice = 3 Then problem1 = Math.GetRandomNumber (5) name3 = 100 * problem1 TextWindow.WriteLine ("Organise Premiers Conference" ) TextWindow.WriteLine ("Allocate extra $" + name3 + " million to states" ) TextWindow.WriteLine ("Government popularity up" ) OtherExpenses = OtherExpenses + name3 InflationRate = InflationRate + 0.25 Popularity = Popularity + 2 EndIf WaitEnter() EndSub Sub ByElection TextWindow.WriteLine ("BY-ELECTION NECESSARY" ) TextWindow.WriteLine ("Prepare campaign platform " ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Wage increase. Extra spending on housing" ) TextWindow.WriteLine ("2. Unemployed benefit increase. More money for local government" ) TextWindow.WriteLine ("3. Pension increase. Stand on your government record" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Wages up $20 per week" ) TextWindow.WriteLine ("Housing budget up $50 million" ) Wage = Wage + 20 HousingBudget = HousingBudget + 50 VoteVariable = 1 EndIf If choice = 2 Then TextWindow.WriteLine ("Unemployment Benefit up $10" ) TextWindow.WriteLine ("Spend $50 million on local government" ) UnemployedPay = UnemployedPay + 10 OtherExpenses = OtherExpenses + 50 VoteVariable = 2 EndIf If choice = 3 Then TextWindow.WriteLine ("Pension up $10" ) Pension = Pension + 10 VoteVariable = 3 EndIf WaitEnter () ByElectionResult () EndSub Sub ExchangeRate TextWindow.WriteLine ("Exchange Rate falling. Government needs to support $A" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Prop up $A. Cost $250 million" ) TextWindow.WriteLine ("2. Introduce government controls" ) TextWindow.WriteLine ("3. Let $A float" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Exchange Rate up" ) TextWindow.WriteLine ("Government popularity rises" ) OtherExpenses = OtherExpenses + 250 InflationRate = InflationRate + 0.5 ExchangeRate = ExchangeRate + 2 Popularity = Popularity + 1 EndIf If choice = 2 Then TextWindow.WriteLine ("Exchange Rate stabilised" ) TextWindow.WriteLine ("Inflation up. Exports down" ) InflationRate = InflationRate + 0.5 Exports = Exports - 20 Imports = Imports + 20 Popularity = Popularity - 1 EndIf If choice = 3 Then TextWindow.WriteLine ("Exchange Rate falls" ) TextWindow.WriteLine ("Exports up. Interest Rates up" ) InterestRate = InterestRate + 0.5 Exports = Exports + 20 Imports = Imports - 20 ExchangeRate = ExchangeRate - 2 Popularity = Popularity - 1 EndIf WaitEnter() EndSub Sub BudgetIncomeTax TextWindow.WriteLine ("Prepare for Budget. Option to vary Income Tax rate" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Increase Income Tax" ) TextWindow.WriteLine ("2. Reduce government spending" ) TextWindow.WriteLine ("3. Reduce Income Tax" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Income Tax increased" ) TextWindow.WriteLine ("Add 10,000 government employees" ) TextWindow.WriteLine ("Government popularity hit" ) EmployedGovt = EmployedGovt + 0.01 IncomeTaxVariable = IncomeTaxVariable + 50 Popularity = Popularity - 5 EndIf If choice = 2 Then TextWindow.WriteLine ("Government spending reduced" ) TextWindow.WriteLine ("Government popularity down" ) HousingBudget = HousingBudget - 10 DefenceBudget = DefenceBudget - 10 Popularity = Popularity - 3 EndIf If choice = 3 Then TextWindow.WriteLine ("Income Tax reduced" ) TextWindow.WriteLine ("Government popularity up" ) InflationRate = InflationRate + 1 IncomeTaxVariable = IncomeTaxVariable - 50 EmployedGovt = EmployedGovt - 0.01 Popularity = Popularity + 4 EndIf WaitEnter() EndSub Sub BudgetGST TextWindow.WriteLine ("Prepare for Budget. Consider change to Goods and Services Tax" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Increase GST" ) TextWindow.WriteLine ("2. Reduce government spending" ) TextWindow.WriteLine ("3. Reduce GST" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("GST increased" ) TextWindow.WriteLine ("Government popularity slides" ) InflationRate = InflationRate + 0.5 GSTVariable = GSTVariable + 30 Popularity = Popularity - 4 EndIf If choice = 2 Then TextWindow.WriteLine ("Government spending reduced" ) TextWindow.WriteLine ("Government popularity down" ) InflationRate = InflationRate - 0.5 EmployedGovt = EmployedGovt - 0.01 Popularity = Popularity - 3 EndIf If choice = 3 Then TextWindow.WriteLine ("GST reduced" ) TextWindow.WriteLine ("Government popularity up" ) GSTVariable = GSTVariable - 30 Popularity = Popularity + 2 EndIf WaitEnter() EndSub Sub BudgetCompanyTax TextWindow.WriteLine ("Prepare for Budget. Proposal to change Company Tax" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Increase Company Tax" ) TextWindow.WriteLine ("2. Reduce government spending" ) TextWindow.WriteLine ("3. Reduce Company Tax" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Company Tax increased" ) TextWindow.WriteLine ("20,000 workers sacked" ) TextWindow.WriteLine ("Government popularity down" ) EmployedPrivate = EmployedPrivate - 0.02 CompanyTaxVariable = CompanyTaxVariable -15 Popularity = Popularity - 3 EndIf If choice = 2 Then TextWindow.WriteLine ("Cut Government spending" ) TextWindow.WriteLine ("Government popularity down" ) InterestRate = InterestRate + 0.25 EmployedGovt = EmployedGovt - 0.01 Popularity = Popularity - 1 EndIf If choice = 3 Then TextWindow.WriteLine ("Company Tax reduced" ) TextWindow.WriteLine ("Government popularity up" ) CompanyTaxVariable = CompanyTaxVariable - 15 EmployedPrivate = EmployedPrivate + 0.01 InflationRate = InflationRate + 0.5 Popularity = Popularity + 3 EndIf WaitEnter() EndSub Sub Education TextWindow.WriteLine ("Education system inadequate. More money needed" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Spend $500 million" ) TextWindow.WriteLine ("2. Add $30 million to budget" ) TextWindow.WriteLine ("3. Take no action" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("$500 million spent on Education" ) TextWindow.WriteLine ("Government popularity up" ) EmployedPrivate = EmployedPrivate + 0.02 OtherExpenses = OtherExpenses + 500 Popularity = Popularity + 2 EndIf If choice = 2 Then TextWindow.WriteLine ("Education budget increased" ) TextWindow.WriteLine ("Government popularity edges up" ) EducationBudget = EducationBudget + 30 Popularity = Popularity + 1 EndIf If choice = 3 Then TextWindow.WriteLine ("No extra money for Education" ) TextWindow.WriteLine ("Government popularity slumps" ) EmployedPrivate = EmployedPrivate - 0.03 Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub OpinionPoll TextWindow.WriteLine ("Opinion Poll imminent. Government needs a boost" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Golf with Opposition Leader" ) TextWindow.WriteLine ("2. Take walk in your Electorate" ) TextWindow.WriteLine ("3. Make impassioned plea on Television" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then option1 = Math.GetRandomNumber (3) If option1 = 1 Then TextWindow.WriteLine ("You win at golf" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 3 EndIf If option1 = 2 Then TextWindow.WriteLine ("Rain washes out play. You Shout Greg Norman a drink" ) TextWindow.WriteLine ("Government popularity holds" ) Popularity = Popularity + 1 EndIf If option1 = 3 Then TextWindow.WriteLine ("Opposition Leader thrashes you" ) TextWindow.WriteLine ("Government popularity down" ) Popularity = Popularity - 3 EndIf EndIf If choice = 2 Then option1 = Math.GetRandomNumber (3) If option1 = 1 Then TextWindow.WriteLine ("Voters turn out in force. You kiss all their babies" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 3 EndIf If option1 = 2 Then TextWindow.WriteLine ("Miserable turnout of voters" ) TextWindow.WriteLine ("Government popularity unchanged" ) EndIf If option1 = 3 Then TextWindow.WriteLine ("Opponents start a riot. You are lucky to escape" ) TextWindow.WriteLine ("Government popularity down" ) Popularity = Popularity - 3 EndIf EndIf If choice = 3 Then option1 = Math.GetRandomNumber (3) If option1 = 1 Then TextWindow.WriteLine ("You give brilliant TV showing" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 4 EndIf If option1 = 2 Then TextWindow.WriteLine ("Nobody watches your TV program" ) TextWindow.WriteLine ("Government popularity unchanged" ) EndIf If option1 = 3 Then TextWindow.WriteLine ("Makeup runs all down your shirt" ) TextWindow.WriteLine ("Government popularity down" ) Popularity = Popularity - 4 EndIf EndIf WaitEnter() EndSub Sub MattersForAction option2 = Math.GetRandomNumber (3) If option2 = 1 Then name5 = "British" EndIf If option2 = 2 Then name5 = "French" EndIf If option2 = 3 Then name5 = "Chinese" EndIf TextWindow.WriteLine ("Some matters for action" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Call Ministerial Meeting" ) TextWindow.WriteLine ("2. Call Press Conference" ) TextWindow.WriteLine ("3. Call " + name5 + " Ambassador" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("Ministerial meeting held" ) option1 = Math.GetRandomNumber (2) If option1 = 1 Then TextWindow.WriteLine ("You survive leadership challenge" ) TextWindow.WriteLine ("Government popularity suffers" ) Popularity = Popularity - 1 EndIf If option1 = 2 Then TextWindow.WriteLine ("Your vision plan for the future is approved" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 2 EndIf EndIf If choice = 2 Then option1 = Math.GetRandomNumber (2) If option1 = 1 Then TextWindow.WriteLine ("Press Conference held. Journalists ask nasty questions" ) TextWindow.WriteLine ("Government popularity dips" ) Popularity = Popularity - 2 EndIf If option1 = 2 Then TextWindow.WriteLine ("Press Conference held. You 'dob in' opposition member" ) TextWindow.WriteLine ("Government popularity rises" ) Popularity = Popularity + 2 EndIf EndIf If choice = 3 Then option3 = Math.GetRandomNumber (3) If option3 = 1 Then TextWindow.WriteLine ( name5 + " Ambassador calls" ) TextWindow.WriteLine ("You both call for world peace" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 2 EndIf If option3 = 2 Then TextWindow.WriteLine ( name5 + " Ambassador calls" ) TextWindow.WriteLine ("You argue over nuclear waste dumps" ) TextWindow.WriteLine ("Government popularity down" ) Popularity = Popularity - 2 EndIf If option3 = 3 Then TextWindow.WriteLine ( name5 + " Ambassador calls" ) TextWindow.WriteLine ("You discuss trade issues" ) TextWindow.WriteLine ("Government popularity lifts" ) Popularity = Popularity + 1 EndIf EndIf WaitEnter() EndSub Sub Immigration TextWindow.WriteLine ("Review Immigration policy" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Allow 40,000 immigrants" ) TextWindow.WriteLine ("2. Let 20,000 immigrants in" ) TextWindow.WriteLine ("3. Suspend immigration" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then TextWindow.WriteLine ("40,000 immigrants arrive. Strain on employment" ) TextWindow.WriteLine ("Government popularity down" ) EmployedPrivate = EmployedPrivate + 0.02 NewArrivals = NewArrivals + 0.04 Popularity = Popularity - 2 EndIf If choice = 2 Then TextWindow.WriteLine ("20,000 immigrants arrive. Unemployment up" ) TextWindow.WriteLine ("Government popularity down" ) NewArrivals = NewArrivals + 0.02 Popularity = Popularity - 1 EndIf If choice = 3 Then TextWindow.WriteLine ("Immigration suspended" ) EndIf WaitEnter() EndSub Sub ShareMarket TextWindow.WriteLine ("Share Market active. Instability threatens policies" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Place controls on market" ) TextWindow.WriteLine ("2. Let market forces prevail" ) TextWindow.WriteLine ("3. Hold a government enquiry" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 or choice = 2 Then issue3 = Math.GetRandomNumber (5) If issue3 = 1 or issue3 = 4 Then TextWindow.WriteLine ("Stock Market boom. Place special tax on shares" ) TextWindow.WriteLine ("Government popularity dips" ) OtherExpenses = OtherExpenses - 200 Popularity = Popularity - 1 EndIf If issue3 = 2 or issue3 = 5 Then TextWindow.WriteLine ("Stock Market levels out" ) EndIf If issue3 = 3 Then TextWindow.WriteLine ("Stock Market crashes" ) TextWindow.WriteLine ("Government popularity crashes" ) OtherExpenses = OtherExpenses - 200 Popularity = Popularity - 5 EndIf EndIf If choice = 3 Then TextWindow.WriteLine ("Enquiry costs $10 million. Share Market goes wild" ) TextWindow.WriteLine ("Government popularity down" ) OtherExpenses = OtherExpenses - 3 InflationRate = InflationRate + 1 InterestRate = InterestRate + 1 Popularity = Popularity - 3 EndIf WaitEnter() EndSub Sub OverseasTrade catastrophe1 = Math.GetRandomNumber (5) If catastrophe1 = 1 Then TextWindow.WriteLine ("Drought. Exports drop by $40 million" ) Exports = Exports - 20 Imports = Imports + 20 EndIf If catastrophe1 = 2 Then TextWindow.WriteLine ("Floods. Exports drop by $20 million" ) Exports = Exports - 10 Imports = Imports + 10 EndIf If catastrophe1 = 3 Then TextWindow.WriteLine ("Wheat prices up. Exports up by $30 million" ) Exports = Exports + 15 Imports = Imports - 15 EndIf If catastrophe1 = 4 Then TextWindow.WriteLine ("Mineral prices up. Exports up by $40 million" ) Exports = Exports + 20 Imports = Imports - 20 EndIf If catastrophe1 = 5 Then TextWindow.WriteLine ("Disturbance in Middle East. Oil prices cause concern" ) Popularity = Popularity - 1 EndIf WaitEnter() EndSub Sub OlympicGames issues8 = Math.GetRandomNumber (5) If issues8 = 1 Then TextWindow.WriteLine ("Bid for next Olympic Games" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 3 EndIf If issues8 = 2 Then TextWindow.WriteLine ("Cut financial grants to states. Premiers angry" ) TextWindow.WriteLine ("Government popularity down" ) OtherExpenses = OtherExpenses - 50 Popularity = Popularity - 2 EndIf If issues8 = 3 Then TextWindow.WriteLine ("Appoint ex-Minister as High Court judge. Public outcry" ) TextWindow.WriteLine ("Government popularity down" ) Popularity = Popularity - 3 EndIf If issues8 = 4 Then TextWindow.WriteLine ("Opposition Leader makes major gaffe" ) TextWindow.WriteLine ("Government popularity up" ) Popularity = Popularity + 3 EndIf If issues8 = 5 Then TextWindow.WriteLine ("Take the day off" ) EndIf WaitEnter() EndSub Sub LuckyDay TextWindow.WriteLine ("Your Lucky Day. Opposition Parties in turmoil" ) TextWindow.WriteLine ("Your popularity soars" ) Popularity = Popularity + 5 WaitEnter() EndSub Sub BudgetTime TextWindow.WriteLine ("IT'S BUDGET TIME" ) TextWindow.WriteLine ("Your Decision?" ) TextWindow.WriteLine ("1. Severe Budget" ) TextWindow.WriteLine ("2. Middle-of-the-road" ) TextWindow.WriteLine ("3. Soft Budget" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) TextWindow.WriteLine ("1. Increased Tax package" ) TextWindow.WriteLine ("2. Reduced expenditure package" ) TextWindow.WriteLine ("3. Mixed package" ) TextWindow.Write ("Select <1> <2> or <3> then Enter: " ) choice2 = TextWindow.ReadNumber () TextWindow.WriteLine (" " ) If choice = 1 Then If choice2 = 1 Then TextWindow.WriteLine ("Income Tax up. GST Up. Company Tax up" ) TextWindow.WriteLine ("Government popularity slumps" ) IncomeTaxVariable = IncomeTaxVariable + 50 GSTVariable = GSTVariable + 50 CompanyTaxVariable = CompanyTaxVariable + 100 Popularity = Popularity - 6 EndIf If choice2 = 2 Then TextWindow.WriteLine ("Income Tax up. GST Up." ) TextWindow.WriteLine ("Government popularity drops" ) IncomeTaxVariable = IncomeTaxVariable + 30 GSTVariable = GSTVariable + 60 Popularity = Popularity - 4 EndIf If choice2 = 3 Then TextWindow.WriteLine ("Income Tax up. Company Tax Up." ) TextWindow.WriteLine ("Government popularity down" ) IncomeTaxVariable = IncomeTaxVariable + 30 CompanyTaxVariable = CompanyTaxVariable + 30 Popularity = Popularity - 2 EndIf EndIf If choice = 2 Then If choice2 = 1 Then TextWindow.WriteLine ("Health budget cut. Education budget cut. Defence budget cut" ) TextWindow.WriteLine ("Government popularity cut" ) HealthBudget = HealthBudget - 60 EducationBudget = EducationBudget - 60 DefenceBudget = DefenceBudget - 60 Popularity = Popularity - 6 EndIf If choice2 = 2 Then TextWindow.WriteLine ("Health budget cut. Housing budget cut. Defence budget cut" ) TextWindow.WriteLine ("Government popularity falls" ) HealthBudget = HealthBudget - 40 HousingBudget = HousingBudget - 40 DefenceBudget = DefenceBudget - 40 Popularity = Popularity - 4 EndIf If choice2 = 3 Then TextWindow.WriteLine ("Housing budget cut. Government employees reduced" ) TextWindow.WriteLine ("Government popularity slides" ) HousingBudget = HousingBudget - 20 EmployedGovt = EmployedGovt - 0.02 Popularity = Popularity - 2 EndIf EndIf If choice = 3 Then If choice2 = 1 Then TextWindow.WriteLine ("Income Tax up. GST up. Education budget down " ) TextWindow.WriteLine ("Government popularity cut" ) IncomeTaxVariable = IncomeTaxVariable + 50 EducationBudget = EducationBudget - 60 Popularity = Popularity - 6 EndIf If choice2 = 2 Then TextWindow.WriteLine ("IncomeTax up. Housing budget cut. Defence budget cut" ) TextWindow.WriteLine ("Government popularity falls" ) IncomeTaxVariable = IncomeTaxVariable + 70 HousingBudget = HousingBudget - 40 DefenceBudget = DefenceBudget - 40 Popularity = Popularity - 4 EndIf If choice2 = 3 Then TextWindow.WriteLine ("Company Tax up. Health budget reduced. Special Tax levied" ) TextWindow.WriteLine ("Government popularity slips" ) CompanyTaxVariable = CompanyTaxVariable + 30 HealthBudget = HealthBudget - 20 OtherExpenses = OtherExpenses - 30 Popularity = Popularity - 2 EndIf EndIf WaitEnter() EndSub Sub NoConfidence TextWindow.WriteLine ("SHATTERING NEWS" ) TextWindow.WriteLine ("Vote of NO CONFIDENCE in you during parliamentary debate" ) TextWindow.WriteLine ("Ballot is now being taken" ) Program.Delay (5000) Vote2 = Math.GetRandomNumber (8) If Vote2 = 6 or GovtMajority < 0 Then TextWindow.WriteLine ("YOU LOSE. That's the end" ) Else TextWindow.WriteLine ("You just scrape in. Be more careful " ) EndIf WaitEnter() EndSub Sub MajorProject option6 = Math.GetRandomNumber (7) If option6 = 1 Then name6 = " Canberra" EndIf If option6 = 2 Then name6 = " Darwin" EndIf If option6 = 3 Then name6 = " Brisbane" EndIf If option6 = 4 Then name6 = " Geelong" EndIf If option6 = 5 Then name6 = " North Coburg" EndIf If option6 = 6 Then name6 = " Launceston" EndIf If option6 = 7 Then name6 = " Dandenong" EndIf option7 = Math.GetRandomNumber (7) If option7 = 1 Then name7 = "Mining under" EndIf If option7 = 2 Then name7 = "Bridge over river near" EndIf If option7 = 3 Then name7 = "Freeway through" EndIf If option7 = 4 Then name7 = "Tunnel under" EndIf If option7 = 5 Then name7 = "Skyscrapers in" EndIf If option7 = 6 Then name7 = "Waste Dump in" EndIf If option7 = 7 Then name7 = "Refugee Camp in" EndIf TextWindow.WriteLine ("Introduce important Bill to allow " + name7 + name6 ) option8 = Math.GetRandomNumber (5) Program.Delay (3000) TextWindow.WriteLine ("Your handling of the debate is .." ) If option8 = 1 Then TextWindow.WriteLine ("FANTASTIC. Government popularity up" ) Popularity = Popularity + 2 EndIf If option8 = 2 Then TextWindow.WriteLine ("Excellent. Government popularity improves" ) Popularity = Popularity + 1 EndIf If option8 = 3 Then TextWindow.WriteLine ("Fair. Government popularity unchanged" ) EndIf If option8 = 4 Then TextWindow.WriteLine ("Poor. Government popularity down" ) Popularity = Popularity - 1 EndIf If option8 = 5 Then TextWindow.WriteLine ("DISASTROUS. Government popularity drops" ) Popularity = Popularity - 2 EndIf WaitEnter() EndSub Sub ByElectionResult Vote1 = Math.GetRandomNumber (4) + 3 Vote2 = Math.GetRandomNumber (9) Vote3 = Vote1 + Vote2 / 10 TextWindow.WriteLine ("VOTES NOW BEING COUNTED. Please wait" ) Program.Delay (5000) If VoteVariable = 1 Then Vote3 = Vote3 * 10 + 0.5 EndIf If VoteVariable = 2 Then Vote3 = Vote3 * 10 + 0.1 EndIf If VoteVariable = 3 Then Vote3 = Vote3 * 10 - 0.5 EndIf If Vote3 < 50 Then TextWindow.WriteLine ("Election Lost. Government popularity drops" ) TextWindow.Writeline ("Share of vote " + Vote3 + "% ") Popularity = Popularity - 3 GovtMajority = GovtMajority - 1 If Vote3 < 40 Then Popularity = Popularity - 2 EndIf EndIf If Vote3 > 49.9 Then TextWindow.WriteLine ("Election Won. Government popularity up" ) TextWindow.Writeline ("Share of vote " + Vote3 + "% ") GovtMajority = GovtMajority + 1 If Vote3 > 64.9 Then Popularity = Popularity + 5 EndIf If Vote3 < 65 Then Popularity = Popularity + 3 EndIf EndIf WaitEnter () EndSub Sub WaitEnter TextWindow.WriteLine (" ") TextWindow.Write ("Press to proceed: " ) TextWindow.WriteLine (" ") choice = TextWindow.ReadNumber () EndSub Sub Statistics Employed = EmployedPrivate + EmployedGovt Adults = Employed + Unemployed + OnPension OverseasInvest = (Employed * 2) * InterestRate + OverseasInvestVariable - (Unemployed * 53) * InflationRate TotalOSInvest = TotalOSInvest + OverseasInvest InterestPayout = (TotalOSInvest/50) * (InterestRate/100) Borrowed = Borrowed + Loans LoanInterest = (Borrowed/50) * (InterestRate/100) If ExchangeRate < 0.86 Then OverseasInvest = OverseasInvest - 20 Endif If ExchangeRate > 0.94 Then OverseasInvest = OverseasInvest + 20 EndIf If OverseasInvest < 0 Then OverseasInvest = 0 EndIf If Exports < 0 Then Exports = 0 EndIf If Imports < 0 Then Imports = 0 EndIf TradeBalance = Exports - Imports IncomeTax = (Employed * Wage) * IncomeTaxRate GST = (Employed * (Wage * 8 / 10)) * GSTRate CompanyTax = CompanyTax * CompanyTaxRate WeeklyIncome = IncomeTax + GST + CompanyTax + OverseasInvest + Borrowed + TradeBalance WagesPlus = (Wage * EmployedGovt) + (UnemployedPay * Unemployed) + (Pension * OnPension) OtherCosts = OtherCosts + OtherExpenses + InterestPayout WeeklyCosts = EducationBudget + HealthBudget + DefenceBudget + HousingBudget + WagesPlus + OtherCosts WeeklyTotal = WeeklyIncome - WeeklyCosts If WeeklyTotal <0 Then name9 = "LOSS" Else name9 = "PROFIT" EndIf Week = Week + 1 TextWindow.ForegroundColor = "Cyan" TextWindow.WriteLine ("WEEK " + week ) TextWindow.ForegroundColor = "White" TextWindow.WriteLine (" Million $ Per Week $ Million") TextWindow.ForegroundColor = "Yellow" TextWindow.Writeline ("Population " + Population + " Wage " + Wage + " Overseas Invest " + OverseasInvest ) TextWindow.WriteLine ("Adults " + Adults + " Unemployed Pay " + UnemployedPay + " Total O/S Invest " + TotalOSInvest ) TextWindow.WriteLine ("Employed " + Employed + " Pension " + Pension + " Interest Payout " + InterestPayout ) TextWindow.WriteLine ("Private " + EmployedPrivate + " Funds Borrowed " + Loans ) TextWindow.WriteLine ("Govt " + EmployedGovt + " Total Borrowed " + Borrowed ) TextWindow.WriteLine ("Unemployed " + Unemployed + " Interest Rate " + InterestRate + " % InterestPaid " + LoanInterest ) TextWindow.WriteLine ("On Pensions " + OnPension + " Inflation Rate " + InflationRate + " % " ) TextWindow.WriteLine (" Exchange Rate Exports " + Exports ) TextWindow.WriteLine (" $US = $A" + ExchangeRate + " Imports " + Imports ) TextWindow.WriteLine (" Trade Balance " + TradeBalance ) TextWindow.ForegroundColor = "White" TextWindow.WriteLine ("INCOME $ Million EXPENSES $ Million" ) TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine ("Income Tax " + IncomeTax + " Education " + EducationBudget + " Govt Approval " + Popularity + " %" ) TextWindow.WriteLine ("GST " + GST + " Health " + HealthBudget + " Govt Majority " + GovtMajority ) TextWindow.WriteLine ("Company Tax " + CompanyTax + " Defence " + DefenceBudget ) TextWindow.WriteLine ("O/S Invest " + OverseasInvest + " Housing " + HousingBudget ) TextWindow.WriteLine ("Borrowings " + Borrowed + " Govt Wages etc " + WagesPlus + " Weekly " + name9 ) TextWindow.WriteLine (" Other Costs " + OtherCosts + " $ " + WeeklyTotal + " million") TextWindow.WriteLine ("TOTAL INCOME " + WeeklyIncome + " TOTAL EXPENSES " + WeeklyCosts ) Loans = 0 If name9 = "LOSS" Then TextWindow.ForegroundColor = "Red" TextWindow.WriteLine ("You must borrow funds to remain solvent" ) TextWindow.ForegroundColor = "Yellow" WaitEnter () Borrowing () EndIf OtherExpenses = 0 WaitEnter () EndSub Sub Borrowing TextWindow.WriteLine ("You must borrow enough cash to cover loss" ) TextWindow.Write ("Select amount required then Enter: " ) choice10 = TextWindow.ReadNumber () If choice10 + WeeklyTotal < 0 Then choice10 = WeeklyCosts - WeeklyIncome EndIf Loans = Loans + choice10 WaitEnter () EndSub End>RLD546.sb< Start>RLG928.sb< GraphicsWindow.BrushColor="teal GraphicsWindow.Title="Trainspotting... GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width=1200 GraphicsWindow.Height =700 GraphicsWindow.MouseMove=mww For x=0 To 7 w[x]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[x] x) t=x+34 w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[t] 350+x*45 420) t=24-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[x] 350+x*45 400) Shapes.Move (w[t] 350+x*45 35) EndFor pl=Shapes.AddRectangle (45 10) Shapes.Move (pl 350 320) LDShapes.SetShapeEvent (pl) LDDialogs.ToolTip (pl "Closed") LDShapes.RotateAbout (pl 350 320, 45) p350=650 pl1=Shapes.AddRectangle (45 10) Shapes.Move (pl1 p350 320) LDShapes.SetShapeEvent (pl1) LDDialogs.ToolTip (pl1 "Closed") LDShapes.BrushColour (pl1 "Red") 'LDShapes.RotateAbout (pl1 350 320, 45) cl=1 LDShapes.ShapeEvent=see f10=15 f90=90 For x=2 To 10 t=18-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[18-x] 620+LDMath.Cos(x*f10-f90)*195 LDMath.sin(x*f10-f90)*195+220 ) Shapes .Rotate (w[18-x] x*f10) EndFor For x=2 To 10 t=35-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[t] 400+LDMath.Cos(x*f10+f90)*195 LDMath.sin(x*f10+f90)*195+220 ) Shapes .Rotate (w[t] x*f10) EndFor x=0 For y=1 to 3 cp[y]= y-1 endfor ac="true While "true For y=1 to 3 If ac then cp[y]= cp[y]+1 endif If y=3 And cp[y]=33 Then 'sw=math.GetRandomNumber (2) ' GraphicsWindow.Title=">>> "+sw endif If sw=1 Then LDShapes.RotateAbout (pl 350 320, 45) if cp[y]>41 Then If cl=1 then t=42-y ac="false else ac="true t=8 endif else t=Math.Remainder (cp[y] 42) endif Else LDShapes.RotateAbout (pl 350 320, 0) t=Math.Remainder (cp[y] 34) endif cp[y]=t LDShapes.BrushColour (w[t] "red") EndFor Program.Delay (250) For y=1 to 3 t=cp[y] LDShapes.BrushColour (w[t] "teal") EndFor endwhile Sub see If LDShapes.LastEventType="MouseDown" then If LDShapes.LastEventShape=pl then sw=1-sw If sw=1 then LDDialogs.ToolTip (pl "Open") LDShapes.RotateAbout (pl 350 320, 45) Else LDDialogs.ToolTip (pl "Closed") LDShapes.RotateAbout (pl 350 320, 0) EndIf ElseIf LDShapes.LastEventShape=pl1 then cl=1-cl If cl=0 then LDDialogs.ToolTip (pl1 "Open") LDShapes.RotateAbout (pl1 p350 320, -45) LDShapes.BrushColour (pl1 "Lime") ac="true Else LDDialogs.ToolTip (pl1 "Closed") LDShapes.RotateAbout (pl1 p350 320, 0) LDShapes.BrushColour (pl1 "Red") EndIf endif endif EndSub Sub mww ' GraphicsWindow.Title=GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY EndSub End>RLG928.sb< Start>RLH504-0.sb< '5 balls for testing Ball_Amount = 5 Ball_Radius = 25 Ball_Diameter = Ball_Radius * 2 Game_Width = 600 Game_Height = 600 GraphicsWindow.Width = Game_Width GraphicsWindow.Height = Game_Height GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "#55FFAA" GraphicsWindow.PenColor = "Red" 'GraphicsWindow.BrushColor GraphicsWindow.PenWidth = 5 For i = 1 To Ball_Amount Ball[i] = Shapes.AddEllipse(Ball_Diameter,Ball_Diameter) Ball_X[i] = Math.GetRandomNumber(Game_Width - Ball_Diameter) + Ball_Radius Ball_Y[i] = Math.GetRandomNumber(Game_Height - Ball_Diameter) + Ball_Radius Ball_WX[i] = Math.GetRandomNumber(100) - 50 Ball_WY[i] = Math.GetRandomNumber(100) - 50 endfor 'Moved outside main loop - these are constant Game_Width = GraphicsWindow.Width Game_Height = GraphicsWindow.Height While "True" CheckCollisions() Program.Delay(15) endwhile Sub CheckCollisions For i = 1 To Ball_Amount For j = i+1 to Ball_Amount Distance_X = Ball_X[i] - Ball_X[j] Distance_Y = Ball_Y[i] - Ball_Y[j] Distance_XY = Math.SquareRoot(Distance_X * Distance_X + Distance_Y * Distance_Y) If Distance_XY <= Ball_Diameter Then 'WXi = Ball_WX[i] 'WYi = Ball_WY[i] 'WXj = Ball_WX[j] 'WYj = Ball_WY[j] 'Ball_WX[i] = WXi + WXj 'Ball_WY[i] = WYi + WYj 'Ball_WX[j] = WXi + WXj 'Ball_WY[j] = WYi + WYj 'too many collisions causes this to crash 'Sound.PlayClick() 'this is the main collision bit using vectors to estimate bounce velocity 'Unit vector Distance_X = Distance_X/Distance_XY Distance_Y = Distance_Y/Distance_XY 'Dot product of unit vector between balls with ball velocity nDOTi = Math.Abs(Ball_WX[i]*Distance_X + Ball_WY[i]*Distance_Y) 'Rebound velocity can be calculated from vector component along ball centres (draw a diagram) Ball_WX[i] = Ball_WX[i] + 2*nDOTi*Distance_X Ball_WY[i] = Ball_WY[i] + 2*nDOTi*Distance_Y nDOTj = Math.Abs(Ball_WX[j]*Distance_X + Ball_WY[j]*Distance_Y) Ball_WX[j] = Ball_WX[j] - 2*nDOTj*Distance_X Ball_WY[j] = Ball_WY[j] - 2*nDOTj*Distance_Y 'Add rebound friction Ball_WX[i] = 0.995*Ball_WX[i] Ball_WY[i] = 0.995*Ball_WY[i] Ball_WX[j] = 0.995*Ball_WX[j] Ball_WY[j] = 0.995*Ball_WY[j] 'This code changes WX, then uses it for WX and WY 'Ball_WX[i] = Ball_WX[i]*0.5 - Ball_WX[j]*0.5 + Distance_X *0.25 'Ball_WY[i] = Ball_WY[i]*0.5 - Ball_WY[j]*0.5 + Distance_Y *0.25 'Ball_WX[j] = Ball_WX[i]*0.5 + Ball_WX[j]*0.5 - Distance_X *0.25 'Ball_WY[j] = Ball_WY[i]*0.5 + Ball_WY[j]*0.5 - Distance_Y *0.25 'Ball_X[i] = Ball_X[j] - Distance_X/2 'Ball_Y[i] = Ball_Y[j] - Distance_Y/2 'Ball_X[j] = Ball_X[i] - Distance_X/2 'Ball_Y[j] = Ball_Y[i] - Distance_Y/2 EndIf endfor 'No gravity for testing 'Ball_WY[i] = Ball_WY[i] + 1 Ball_X[i] = Ball_X[i] + Ball_WX[i] Ball_Y[i] = Ball_Y[i] + Ball_WY[i] Bounce() Shapes.Move(Ball[i],Ball_X[i]-Ball_Radius,Ball_Y[i]-Ball_Radius) EndFor endsub Sub Bounce 'Friction for X and Y directions Ball_WX[i] = Ball_WX[i]*0.995 Ball_WY[i] = Ball_WY[i]*0.995 If Ball_X[i] > Game_Width - Ball_Radius Then Ball_WX[i] = Ball_WX[i]*-0.8 Ball_X[i] = Game_Width - Ball_Radius ElseIf Ball_X[i] < Ball_Radius Then Ball_X[i] = Ball_Radius Ball_WX[i] = Ball_WX[i]*-0.8 endif If Ball_Y[i] > Game_Height - Ball_Radius Then Ball_Y[i] = Game_Height - Ball_Radius Ball_WY[i] = Ball_WY[i]*-0.8 ElseIf Ball_Y[i] < Ball_Radius Then Ball_Y[i] = Ball_Radius Ball_WY[i] = Ball_WY[i]*-0.8 endif EndSub End>RLH504-0.sb< Start>RLH504.sb< Ball_Amount = 2 Ball_Radius = 25 Ball_Diameter = Ball_Radius * 2 Game_Width = 600 Game_Height = 600 GraphicsWindow.Width = Game_Width GraphicsWindow.Height = Game_Height GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "#55FFAA" GraphicsWindow.PenColor = "Red" 'GraphicsWindow.BrushColor GraphicsWindow.PenWidth = 5 For i = 1 To Ball_Amount Ball[i] = Shapes.AddEllipse(Ball_Diameter,Ball_Diameter) Ball_X[i] = Math.GetRandomNumber(Game_Width - Ball_Diameter) + Ball_Radius Ball_Y[i] = Math.GetRandomNumber(Game_Height - Ball_Diameter) + Ball_Radius Ball_WX[i] = Math.GetRandomNumber(100) - 50 Ball_WY[i] = Math.GetRandomNumber(100) - 50 endfor While "True" Game_Width = GraphicsWindow.Width Game_Height = GraphicsWindow.Height CheckCollisions() Program.Delay(15) endwhile Sub CheckCollisions For i = 1 To Ball_Amount For j = i+1 to Ball_Amount Distance_X = Ball_X[i] - Ball_X[j] Distance_Y = Ball_Y[i] - Ball_Y[j] Distance_XY = Math.SquareRoot(Distance_X * Distance_X + Distance_Y * Distance_Y) If Distance_XY <= Ball_Diameter Then 'WXi = Ball_WX[i] 'WYi = Ball_WY[i] 'WXj = Ball_WX[j] 'WYj = Ball_WY[j] 'Ball_WX[i] = WXi + WXj 'Ball_WY[i] = WYi + WYj 'Ball_WX[j] = WXi + WXj 'Ball_WY[j] = WYi + WYj Sound.PlayClick() Ball_WX[i] = Ball_WX[i]*0.5 - Ball_WX[j]*0.5 + Distance_X *0.25 Ball_WY[i] = Ball_WY[i]*0.5 - Ball_WY[j]*0.5 + Distance_Y *0.25 Ball_WX[j] = Ball_WX[i]*0.5 + Ball_WX[j]*0.5 - Distance_X *0.25 Ball_WY[j] = Ball_WY[i]*0.5 + Ball_WY[j]*0.5 - Distance_Y *0.25 'Ball_X[i] = Ball_X[j] - Distance_X/2 'Ball_Y[i] = Ball_Y[j] - Distance_Y/2 'Ball_X[j] = Ball_X[i] - Distance_X/2 'Ball_Y[j] = Ball_Y[i] - Distance_Y/2 EndIf endfor Ball_WY[i] = Ball_WY[i] + 1 Ball_X[i] = Ball_X[i] + Ball_WX[i] Ball_Y[i] = Ball_Y[i] + Ball_WY[i] Bounce() Shapes.Move(Ball[i],Ball_X[i]-Ball_Radius,Ball_Y[i]-Ball_Radius) EndFor endsub Sub Bounce Ball_WX[i] = Ball_WX[i]*0.995 If Ball_X[i] > Game_Width - Ball_Radius Then Ball_WX[i] = Ball_WX[i]*-0.8 Ball_X[i] = Game_Width - Ball_Radius ElseIf Ball_X[i] < Ball_Radius Then Ball_X[i] = Ball_Radius Ball_WX[i] = Ball_WX[i]*-0.8 endif If Ball_Y[i] > Game_Height - Ball_Radius Then Ball_Y[i] = Game_Height - Ball_Radius Ball_WY[i] = Ball_WY[i]*-0.8 ElseIf Ball_Y[i] < Ball_Radius Then Ball_Y[i] = Ball_Radius Ball_WY[i] = Ball_WY[i]*-0.8 endif EndSub End>RLH504.sb< Start>RLJ564-1.sb< ancho = 620 alto = 450 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = ancho GraphicsWindow.Height = alto GraphicsWindow.Top = (Desktop.Height-alto) / 2 GraphicsWindow.Left = (Desktop.Width-ancho) / 2 GraphicsWindow.Show() GraphicsWindow.Title = "Eventos e interactividad" InterfazUsuario() Controls.ButtonClicked = AcciónMouse GraphicsWindow.MouseMove=ArrastrarMouse Sub InterfazUsuario GraphicsWindow.DrawRectangle(10, 10, 600, 320) GraphicsWindow.DrawRectangle(10, 340, 200, 100) GraphicsWindow.DrawRectangle(10, 340, 600, 100) GraphicsWindow.DrawRectangle(370, 340, 150, 100) Triángulo = Controls.AddButton("Triángulo", 40, 345) Controls.SetSize(Triángulo, 120, 30) Rectángulo = Controls.AddButton("Rectángulo",40,375) Controls.SetSize(Rectángulo, 120, 30) Círculo = Controls.AddButton("Círculo", 40, 405) Controls.SetSize(Círculo, 120, 30) Rotar = Controls.AddButton("Rotar", 230, 360) Controls.SetSize(Rotar, 60, 60) Zoom = Controls.AddButton("Zoom", 290, 360) Controls.SetSize(Zoom, 60, 60) FreeHand = Controls.AddButton("Dibujar", 390, 360) Controls.SetSize(FreeHand, 60, 60) Borrar = Controls.AddButton("Borrar", 450, 360) Controls.SetSize(Borrar, 60, 60) Salir = Controls.AddButton("Salir", 530, 360) Controls.SetSize(Salir, 60, 60) EndSub Sub AcciónMouse name=controls.LastClickedButton 'Last button ' No:27 nm=controls.GetButtonCaption(name) ' Button's caption ' No:24 GraphicsWindow.PenWidth = 5 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.penColor = GraphicsWindow.GetRandomColor() If nm="Triángulo" Then dibujar = 0 j = 0 z = 1 Shapes.Remove(tri) tri = Shapes.AddTriangle(20, 20, 100, 100, 150, 20) Shapes.Move(tri, 80, 100) elseIf nm="Rectángulo" Then dibujar = 0 j = 0 z = 2 Shapes.Remove(rect) rect = Shapes.AddRectangle(100, 100) Shapes.Move(rect, 250, 150) elseIf nm="Círculo" Then dibujar = 0 j = 0 z = 3 Shapes.Remove(circ) circ = Shapes.AddEllipse(100, 100) Shapes.Move(circ, 400, 150) elseIf nm="Rotar" Then dibujar = 0 If z = 1 Then Shapes.Rotate(tri, 30 + m) Else If z = 2 Then Shapes.Rotate(rect,30 + m) Else If z = 3 Then Shapes.Rotate(circ, 30 + m) Endif Endif Endif m = m + 30 elseIf nm="Zoom" Then dibujar = 0 i = 0.1 + j If i < 0.4 Then If z = 1 Then Shapes.Zoom(tri, 1 + i, 1 + i) Else If z = 2 Then Shapes.Zoom(rect, 1 + i, 1 + i) Else If z = 3 Then Shapes.Zoom(circ, 1 + i, 1 + i) EndIf EndIf EndIf j = j + 0.1 EndIf elseIf nm="Dibujar" Then dibujar = 1 ArrastrarMouse() elseIf nm="Borrar" Then dibujar = 0 j = 0 GraphicsWindow.Clear() GraphicsWindow.BrushColor = "Blue" InterfazUsuario() dibujar = 0 elseIf nm="Salir" Then dibujar = 0 Program.End() EndIf EndSub Sub ArrastrarMouse If dibujar = 1 Then x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If x > 10 And x < 600 And y > 10 And y < 320 Then If Mouse.IsLeftButtonDown Then GraphicsWindow.DrawLine(OrgX, OrgY, x, y) EndIf EndIf OrgX = x OrgY = y EndIf EndSub End>RLJ564-1.sb< Start>RLK168-0.sb< args=0 txmm="false lwq="1=1\=# $ w w $ #\;2\=# $ #\;3\=# #\;4\=# #\;5\=# *$ * #\;6\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=~~~~\\\=~~~~\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;7\=# $#\;8\=#\\\=\\\=\\\= #\;9\=# 1 ### * #\;10\=#\\\=\\\=\\\=\\\= -------------------- #\;11\=# \\\=\\\=#\;12\=# #\;13\=# * ###~~~~~\\\=\\\=\\\=#\;14\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= EE#\;15\=# EE#\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Central Cavern L01\;18\=~\;19\=~\;20\=~\;;2=1\=# #############\;2\=# $ $ *#\;3\=# #\;4\=# ~~~\\\= #\;5\=# 1 #\;6\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= # #\;7\=# \\\=\\\=\\\=\\\=#~~# #\;8\=#\\\=~~~~~ #$ # #\;9\=# #~~# #\;10\=# $ \\\=\\\=\\\=\\\=\\\=\\\=\\\= #~~# #\;11\=# ~~~~ #~~# #\;12\=# ---- #~~# #\;13\=# \\\=\\\=\\\=\\\= $ #~~# #\;14\=# ~~~~ EE#\;15\=# 2 EE#\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Cold Room L02\;18\=~\;19\=~\;20\=~\;;3=1\=0;4=1\=#$ * ##################\;2\=# $ $ EE#\;3\=# EE#\;4\=# \\\=\\\=\\\=\\\=\\\=\\\= #\;5\=# \\\=\\\=\\\=\\\=#\;6\=#\\\= \\\= \\\= #\;7\=# \\\=\\\= $ \\\=\\\=\\\= $#\;8\=#~~~ #\;9\=# \\\=\\\= \\\=\\\=\\\= #\;10\=# \\\=\\\=\\\= #\;11\=#--- \\\=#\;12\=# \\\=\\\=\\\= \\\=\\\=\\\= #\;13\=# \\\=\\\= * \\\=\\\=\\\=#\;14\=# \\\=\\\= #\;15\=# 1 2 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Abandoned Uranium Wrkngs L04\;18\=~\;19\=~\;20\=~\;;5=1\=0;6=1\=# EE#\;2\=# EE#\;3\=# #\;4\=# #\;5\=# * #\;6\=# \\\=\\\=\\\= \\\=\\\= \\\=\\\=\\\=\\\=\\\= #\;7\=# \\\=\\\= $#$ \\\=\\\=\\\=#\;8\=# # $#\;9\=# \\\=\\\=\\\=\\\=\\\= #\;10\=#\\\=\\\= 1 2 #\;11\=#$ \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #\;12\=# $ #* #\;13\=# * # \\\=\\\=\\\=#\;14\=# ---- \\\=\\\= #\;15\=# 3 4 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Processing Plant L06\;18\=~\;19\=~\;20\=~\;;7=1\=# ##################\;2\=# #\;3\=# 2 #\;4\=# \\\=\\\=#@@@@@@@@@@@@$#\;5\=# #@@@@@@@@@@@@@#\;6\=# ----- \\\=\\\=\\\=#@@@@@@@@@@*@@#\;7\=#\\\=\\\=\\\= #@@$@@@@@@@@@@#\;8\=# #@@@@@@@@@$@@@#\;9\=#\\\= #@@@@@*@@@@@@@#\;10\=# 1 \\\=\\\=\\\=#@@@@@@@@@@@@@#\;11\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #@$@@@@@@@@*@@#\;12\=# #@@@@@@@@@@@@$#\;13\=# ####@@@@@*@@@@@@@#\;14\=# \\\=\\\=\\\= #EE #\;15\=# #EE 3 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=##################\;17\= The Vat L07\;18\=~\;19\=~\;20\=~\;;8=1\=0;9=1\=#EE# #\;2\=#EE $ #\;3\=# #\;4\=# #\;5\=# 5 #\;6\=#\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\= #\;7\=# #\;8\=# \\\=\\\=#\;9\=# \\\=\\\= \\\=\\\=\\\= -------- #\;10\=# \\\=\\\=\\\= \\\=\\\= #\;11\=#\\\=\\\= #\;12\=# 6 #\;13\=# \\\=\\\=11\\\=\\\=\\\=22\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=33\\\=\\\=\\\=44\\\=\\\= #\;14\=# \\\=\\\=#\;15\=# #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Wacky Amoebatrons L09\;18\=~\;19\=~\;20\=~\;;10=1\=0;11=1\=####### | $ #\;2\=#EE * $#\;3\=#EE #\;4\=# #\;5\=#$ 5 #\;6\=# \\\=\\\=\\\=\\\=\\\=\\\= 22 \\\=\\\=_______\\\=\\\= #\;7\=# $ | 44 \\\=\\\=#\;8\=# | #\;9\=#\\\=\\\= -- 6 | \\\=\\\=#\;10\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= * #\;11\=# | | \\\= #\;12\=# ~~~\\\= | * #\;13\=# * 33 \\\=\\\=\\\=#\;14\=#\\\=\\\=11 \\\=\\\=\\\= $#\;15\=# 7 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\=Attck of The Mutant Telephns L11\;18\=~\;19\=~\;20\=~\;;12=1\=# w j w #j # #\;2\=# #\;3\=# ~~ #\;4\=# $ #\;5\=# #\;6\=#\\\=\\\=\\\= ~~~~~# #~~~~~~\\\=\\\=$ #\;7\=# $ # # \\\=#\;8\=# \\\=\\\= # $# 3 #\;9\=# \\\= # # \\\=\\\=\\\=\\\=\\\=\\\=#\;10\=# \\\=\\\=\\\=\\\=# # #\;11\=# \\\= #\\\=\\\=\\\= #\;12\=# # \\\=\\\= #\;13\=#\\\=\\\=\\\=\\\=\\\=\\\= 2 # * * #\;14\=# \\\=\\\=\\\=#EE#-----------$ #\;15\=# 1 #EE# #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=####\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\=Ret. of the Alien Kong Beast L12\;18\=~\;19\=~\;20\=~\;;13=1\=################################\;2\=# H #\;3\=# H 2 #\;4\=# H \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= $\\\=\\\=\\\=\\\=#\;5\=# H #\;6\=# H 3 #\;7\=# H \\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=#\;8\=# H #\;9\=# H 4 #\;10\=# H \\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= $\\\=\\\=\\\=\\\=\\\= $\\\=\\\=\\\=\\\=#\;11\=# H 1 #\;12\=# H 5 #\;13\=# H \\\=\\\=\\\= $\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=#\;14\=#EEH #\;15\=#EEH #\;16\=#\\\=\\\=--------------------------\\\=\\\=#\;17\= Ore Refinery L13\;18\=~\;19\=~\;20\=~\;;14=1\=0;15=1\=# ## ##\;2\=# #\;3\=# $ #\;4\=#EE ----------------\\\=\\\=\\\=\\\=\\\= #\;5\=#EE | | #\;6\=#\\\=\\\=\\\=\\\=\\\= * | #\;7\=# $ \\\=\\\= | #\;8\=# \\\= \\\=\\\= | #\;9\=# \\\=\\\= \\\=\\\= | #\;10\=# \\\=\\\= | #\;11\=#\\\=\\\= \\\=\\\= * #\;12\=# \\\=\\\= #\;13\=# \\\=\\\=\\\= \\\=\\\= #\;14\=# \\\=\\\= #\;15\=# $ #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Bank L15\;18\=~\;19\=~\;20\=~\;;16=1\=#$ #\;2\=# #\;3\=# $#\;4\=# #\;5\=# #\;6\=#\\\= \\\= #EE# \\\=\\\=\\\= #\;7\=# #EE## 1#\;8\=# \\\= # $### \\\=\\\=\\\=\\\=\\\=\\\=#\;9\=# # #### 2 #\;10\=#~~------------------------ #\;11\=# $ #\;12\=# 3 ##\\\=\\\= \\\= #\;13\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #\;14\=# \\\= \\\= #\;15\=# 4 *** #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The 16th Cavern L16\;18\=~\;19\=~\;20\=~\;;17=1\=0;18=1\=# #EE#\;2\=# $ EE#\;3\=# #\;4\=# #\;5\=# 5 #\;6\=# \\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=#\;7\=# #\;8\=#\\\=\\\= 6 #\;9\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\= #\;10\=# \\\=\\\= \\\=\\\=\\\= #\;11\=# \\\=\\\=#\;12\=# 7 #\;13\=# \\\=\\\=11\\\=\\\=\\\=22\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=33\\\=\\\=\\\=44\\\=\\\= #\;14\=#\\\=\\\= #\;15\=# 8 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Amoebatrons Revenge L18\;18\=~\;19\=~\;20\=~\;;19=1\=0;20=1\=,`````,((((( (((((. .(((((#\;2\=,`````,(( (( (((((: :(((**#\;3\=,``F`,...... .+.+.: : **#\;4\=(,,F,........(((,,,,,,:::: (*#\;5\=( (F(........,,,################\;6\=(,,F,........'#####EE# $ #\;7\=###################EE# $#\;8\=################### # #\;9\=# \\\=\\\=#\;10\=# #\;11\=#---------------------- 1 ~ #\;12\=# *$ * $ * $ * \\\= #\;13\=#\\\=\\\= #\;14\=# \\\=\\\= #\;15\=# 2 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Final Barrier L20\;18\=~\;19\=~\;20\=~\;; ii=ImageList.LoadImage("e:\mmin.png") LDImage.MakeTransparent(II "BLACK") Mmc=LDImage.SplitImage(ii 16 9) II=ImageList.LoadImage("E:\mmn\man_pu.png") LDImage.MakeTransparent(ii "black") mmp=LDImage.SplitImage(ii 1 20) II=ImageList.LoadImage("E:\mmn\mm_tiles.png") LDImage.MakeTransparent(ii "black") mm=LDImage.SplitImage(ii 8 20) chr[1][1]="9;1 chr[2][1]="6;2 chr[2][2]="7;2 chr[4][1]="4;3 chr[4][2]="5;3 for f=2 to 5 chr[13][F]="16;6 EndFor chr[13][1]="11;6 chr[20][1]="11;6 chr[20][2]="5;5 Sub fset ' The following line could be harmful and has been automatically commented. ' ln=lwq[args[1]]'File.ReadContents(args[1]) If txmm Then wll="▓" mss="▒" lll="▀" ff=LDText.Replace(ff "#" wll) ff=LDText.Replace(ff "E" "░") ff=LDText.Replace(ff "=" lll) ff=LDText.Replace(ff "@" mss) 'ff=LDText.Replace(ff "%" "$") ff=LDText.Replace(ff "-" "▬") ff=LDText.Replace(ff "~" "▼") EndIf ' ln=LDText.Split(ff Text.GetCharacter(13)+Text.GetCharacter(10)) EndSub If txmm Then TextWindow.BackgroundColor="darkblue TextWindow.Clear() LDTextWindow.Encoding="Unicode" EndIf Sub drawbb cl=TextWindow.CursorLeft For x=1 To 16 For d=1 To 2 For c=1 To 32 TextWindow.BackgroundColor="darkblue TextWindow.ForegroundColor="white cc=text.GetSubText (ln[x] c 1) If d=2 and (cc=lll or cc="▬" or cc="▼") Then cc=" " EndIf If cc=wll Then TextWindow.ForegroundColor="blue TextWindow.BackgroundColor="cyan ElseIf cc=mss or cc="$" Then TextWindow.ForegroundColor="red ElseIf cc=lll Then TextWindow.ForegroundColor="yellow EndIf TextWindow.Write(cc) TextWindow.Write(cc) EndFor TextWindow.CursorTop=TextWindow.CursorTop+1 TextWindow.CursorLeft=cl EndFor EndFor TextWindow.CursorLeft=cl+2 TextWindow.CursorTop=TextWindow.CursorTop-1 TextWindow.Write(ln[17]) EndSub ww=LDText.Split("20 01 02 04 06 07 09 11 12 13 15 16 18" " ") rw=1 ct=0 While rw<= Array.GetItemCount(ww) llw=ww[rw] LDCall.Function("fset" llw*1) If txmm Then TextWindow.CursorTop=ct TextWindow.CursorLeft=5 drawbb() rw=rw+1 LDCall.Function("fset" "E:\mmn\L"+llw+".txt") TextWindow.CursorTop=ct TextWindow.CursorLeft=75 drawbb() ct=ct+34 Else GraphicsWindow.Clear() ldrw() GraphicsWindow.ShowMessage(ln[17] "lvl:"+llw ) EndIf rw=rw+1 EndWhile Sub ldrw GraphicsWindow.BackgroundColor="teal GraphicsWindow.Width=800 GraphicsWindow.Height=500 GraphicsWindow.Left=5 GraphicsWindow.Top=5 lm=llw*1 GraphicsWindow.BrushColor="midnightblue GraphicsWindow.FillRectangle(40 20 30*20 320) bb=LDImage.Copy( mm[4][lm]) LDImage.ReplaceColour(bb "white" "gold" 20) bb1=LDImage.Copy( mm[2][lm]) LDImage.ReplaceColour(bb1 "white" "red" 20) bb2=LDImage.Copy( mm[3][lm]) LDImage.ReplaceColour(bb2 "white" "darkred" 20) bb6=LDImage.Copy( mm[8][lm]) LDImage.ReplaceColour(bb2 "white" "gold" 20) bb5=LDImage.Copy( mm[7][lm]) LDImage.ReplaceColour(bb5 "white" LDColours.HSLtoRGB(180 .8 .7) 20) bb3=LDImage.Copy( mm[5][lm]) LDImage.ReplaceColour(bb3 "white" "cyan" 20) bbx=LDImage.Copy( mm[4][15]) bb4=LDImage.Copy( mm[6][lm]) LDImage.ReplaceColour(bb4 "white" "lime" 20) For y=1 To 16 For c=1 To 32 ch=Text.GetSubText(ln[y] c 1) If ch="#" Then GraphicsWindow.BrushColor="darkred GraphicsWindow.FillRectangle(c*20 y*20 20 20) GraphicsWindow.DrawResizedImage(bb c*20 y*20 20 20) ElseIf ch="=" Then GraphicsWindow.DrawResizedImage(bb1 c*20 y*20 20 20) ElseIf ch="-" Then GraphicsWindow.DrawResizedImage(bb3 c*20 y*20 20 20) ElseIf ch="~" or ch="@" Then GraphicsWindow.DrawResizedImage(bb2 c*20 y*20 20 20) ElseIf ch="w" Then GraphicsWindow.DrawResizedImage(bb5 c*20 y*20 20 20) ElseIf ch="j" or ch="H" Then GraphicsWindow.DrawResizedImage(bb6 c*20 y*20 20 20) ElseIf ch="$" Then GraphicsWindow.DrawResizedImage(mmp[1][lm] c*20 y*20 15 15) ElseIf ch="*" Then GraphicsWindow.DrawResizedImage(bb4 c*20 y*20 20 20) ElseIf ch="E" Then GraphicsWindow.DrawResizedImage(bbx c*20 y*20 20 20) ElseIf ch*1>=1 Then lv=LDText.Split(chr[lm][ch*1] ";") GraphicsWindow.DrawResizedImage(mmc[lv[1]][lv[2]] c*20 y*20-20 40 40) EndIf EndFor EndFor EndSub End>RLK168-0.sb< Start>RLK168-1.sb< args=0 txmm="false lwq="1=1\=# $ w w $ #\;2\=# $ #\;3\=# #\;4\=# #\;5\=# *$ * #\;6\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=~~~~\\\=~~~~\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;7\=# $#\;8\=#\\\=\\\=\\\= #\;9\=# 1 ### * #\;10\=#\\\=\\\=\\\=\\\= -------------------- #\;11\=# \\\=\\\=#\;12\=# #\;13\=# * ###~~~~~\\\=\\\=\\\=#\;14\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= EE#\;15\=# EE#\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Central Cavern L01\;18\=~\;19\=~\;20\=~\;;2=1\=# #############\;2\=# $ $ *#\;3\=# #\;4\=# ~~~\\\= #\;5\=# 1 #\;6\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= # #\;7\=# \\\=\\\=\\\=\\\=#~~# #\;8\=#\\\=~~~~~ #$ # #\;9\=# #~~# #\;10\=# $ \\\=\\\=\\\=\\\=\\\=\\\=\\\= #~~# #\;11\=# ~~~~ #~~# #\;12\=# ---- #~~# #\;13\=# \\\=\\\=\\\=\\\= $ #~~# #\;14\=# ~~~~ EE#\;15\=# 2 EE#\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Cold Room L02\;18\=~\;19\=~\;20\=~\;;3=1\=# $ w $ j $ w #\;2\=# w #\;3\=# #\;4\=# #\;5\=# 1 2 #\;6\=#\\\=\\\=\\\=\\\=~~~~~~~~~~~~~~~~~~~~~~~~~~#\;7\=# $ $#\;8\=#\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\=#\;9\=#j #\;10\=#j ------ #\;11\=#j \\\=\\\=\\\=\\\=\\\=\\\=#\;12\=#w \\\=\\\=\\\=\\\=\\\= EE#\;13\=# \\\=\\\=\\\=\\\=\\\=\\\= EE#\;14\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;15\=# 3 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Menagerie L03\;18\=~\;19\=~\;20\=~\;;4=1\=#$ w ##################\;2\=# $ $ EE#\;3\=# EE#\;4\=# \\\=\\\=\\\=\\\=\\\=\\\= #\;5\=# \\\=\\\=\\\=\\\=#\;6\=#\\\= \\\= \\\= #\;7\=# \\\=\\\= $ \\\=\\\=\\\= $#\;8\=#~~~ #\;9\=# \\\=\\\= \\\=\\\=\\\= #\;10\=# \\\=\\\=\\\= #\;11\=#--- \\\=#\;12\=# \\\=\\\=\\\= \\\=\\\=\\\= #\;13\=# \\\=\\\= w \\\=\\\=\\\=#\;14\=# \\\=\\\= #\;15\=# 1 2 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Abandoned Uranium Wrkngs L04\;18\=~\;19\=~\;20\=~\;;5=1\=0;6=1\=# EE#\;2\=# EE#\;3\=# #\;4\=# #\;5\=# w #\;6\=# \\\=\\\=\\\= \\\=\\\= \\\=\\\=\\\=\\\=\\\= #\;7\=# \\\=\\\= $#$ \\\=\\\=\\\=#\;8\=# # $#\;9\=# \\\=\\\=\\\=\\\=\\\= #\;10\=#\\\=\\\= 1 2 #\;11\=#$ \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #\;12\=# $ #w #\;13\=# * # \\\=\\\=\\\=#\;14\=# ---- \\\=\\\= #\;15\=# 3 4 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Processing Plant L06\;18\=~\;19\=~\;20\=~\;;7=1\=# ##################\;2\=# #\;3\=# 2 #\;4\=# \\\=\\\=#@@@@@@@@@@@@$#\;5\=# #@@@@@@@@@@@@@#\;6\=# ----- \\\=\\\=\\\=#@@@@@@@@@@*@@#\;7\=#\\\=\\\=\\\= #@@$@@@@@@@@@@#\;8\=# #@@@@@@@@@$@@@#\;9\=#\\\= #@@@@@*@@@@@@@#\;10\=# 1 \\\=\\\=\\\=#@@@@@@@@@@@@@#\;11\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #@$@@@@@@@@*@@#\;12\=# #@@@@@@@@@@@@$#\;13\=# ####@@@@@*@@@@@@@#\;14\=# \\\=\\\=\\\= #EE #\;15\=# #EE 3 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=##################\;17\= The Vat L07\;18\=~\;19\=~\;20\=~\;;8=1\=# w j w #j # #\;2\=# 1 # # #\;3\=# $ \\\=\\\=# \\\=\\\=#\;4\=# # #\;5\=# # #\;6\=#\\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\=\\\= #\\\=\\\= #\;7\=# $ # \\\=\\\=\\\=\\\= \\\=#\;8\=# \\\=\\\=\\\= # \\\= #\;9\=# $ \\\=\\\=\\\= # 2 #\;10\=# #\\\=\\\=\\\=\\\=\\\= #\;11\=#\\\= \\\=\\\=\\\= # \\\=\\\=\\\=\\\=#\;12\=# \\\=\\\= # #\;13\=# \\\=\\\= 3 # \\\=\\\=\\\=\\\=\\\= #\;14\=# ---#EE#\\\=\\\= $ #\;15\=# 4 #EE# * #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\=Min.Willy meets theKongBeast L08\;18\=~\;19\=~\;20\=~\;;9=1\=#EE# #\;2\=#EE $ #\;3\=# #\;4\=# #\;5\=# 5 #\;6\=#\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\= #\;7\=# #\;8\=# \\\=\\\=#\;9\=# \\\=\\\= \\\=\\\=\\\= -------- #\;10\=# \\\=\\\=\\\= \\\=\\\= #\;11\=#\\\=\\\= #\;12\=# 6 #\;13\=# \\\=\\\=11\\\=\\\=\\\=22\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=33\\\=\\\=\\\=44\\\=\\\= #\;14\=# \\\=\\\=#\;15\=# #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Wacky Amoebatrons L09\;18\=~\;19\=~\;20\=~\;;10=1\=# w \\\=\\\=\\\=# w w\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;2\=# $ # w $#\;3\=#\\\=\\\=\\\=\\\=\\\=\\\= # $ \\\=\\\=\\\=\\\=#\;4\=# w # #\;5\=# #\\\=\\\=\\\=\\\= #\;6\=# \\\=~~~~~~~# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;7\=#\\\=\\\=\\\=\\\= $ # 3 #\;8\=# #\\\=\\\=\\\=\\\=\\\=\\\=\\\=~~~ #\;9\=#\\\=\\\=\\\=\\\=\\\= 1 # #\;10\=#w \\\=\\\=\\\=\\\=\\\=\\\=\\\=# \\\=\\\=#\;11\=#\\\=\\\=\\\=\\\=~~ #\\\=\\\=\\\=\\\=\\\=\\\=\\\= w#\;12\=# 2 # w~~~ #\;13\=# HHHHHHHHHH #\;14\=#\\\=\\\=\\\= EE \\\=\\\=\\\=#\;15\=# EE #\;16\=HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\;17\= The Endorian Forest L10\;18\=~\;19\=~\;20\=~\;;11=1\=####### | $ #\;2\=#EE * $#\;3\=#EE #\;4\=# #\;5\=#$ 5 #\;6\=# \\\=\\\=\\\=\\\=\\\=\\\= 22 \\\=\\\=_______\\\=\\\= #\;7\=# $ | 44 \\\=\\\=#\;8\=# | #\;9\=#\\\=\\\= -- 6 | \\\=\\\=#\;10\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= * #\;11\=# | | \\\= #\;12\=# ~~~\\\= | * #\;13\=# * 33 \\\=\\\=\\\=#\;14\=#\\\=\\\=11 \\\=\\\=\\\= $#\;15\=# 7 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\=Attck of The Mutant Telephns L11\;18\=~\;19\=~\;20\=~\;;12=1\=# w j w #j # #\;2\=# #\;3\=# ~~ #\;4\=# $ #\;5\=# #\;6\=#\\\=\\\=\\\= ~~~~~# #~~~~~~\\\=\\\=$ #\;7\=# $ # # \\\=#\;8\=# \\\=\\\= # $# 3 #\;9\=# \\\= # # \\\=\\\=\\\=\\\=\\\=\\\=#\;10\=# \\\=\\\=\\\=\\\=# # #\;11\=# \\\= #\\\=\\\=\\\= #\;12\=# # \\\=\\\= #\;13\=#\\\=\\\=\\\=\\\=\\\=\\\= 2 # * * #\;14\=# \\\=\\\=\\\=#EE#-----------$ #\;15\=# 1 #EE# #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=####\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\=Ret. of the Alien Kong Beast L12\;18\=~\;19\=~\;20\=~\;;13=1\=################################\;2\=# H #\;3\=# H 2 #\;4\=# H \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= $\\\=\\\=\\\=\\\=#\;5\=# H #\;6\=# H 3 #\;7\=# H \\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=#\;8\=# H #\;9\=# H 4 #\;10\=# H \\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= $\\\=\\\=\\\=\\\=\\\= $\\\=\\\=\\\=\\\=#\;11\=# H 1 #\;12\=# H 5 #\;13\=# H \\\=\\\=\\\= $\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=\\\=\\\= \\\=\\\=#\;14\=#EEH #\;15\=#EEH #\;16\=#\\\=\\\=--------------------------\\\=\\\=#\;17\= Ore Refinery L13\;18\=~\;19\=~\;20\=~\;;14=1\=0;15=1\=# ## ##\;2\=# #\;3\=# $ #\;4\=#EE ----------------\\\=\\\=\\\=\\\=\\\= #\;5\=#EE | | #\;6\=#\\\=\\\=\\\=\\\=\\\= * | #\;7\=# $ \\\=\\\= | #\;8\=# \\\= \\\=\\\= | #\;9\=# \\\=\\\= \\\=\\\= | #\;10\=# \\\=\\\= | #\;11\=#\\\=\\\= \\\=\\\= * #\;12\=# \\\=\\\= #\;13\=# \\\=\\\=\\\= \\\=\\\= #\;14\=# \\\=\\\= #\;15\=# $ #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Bank L15\;18\=~\;19\=~\;20\=~\;;16=1\=#$ #\;2\=# #\;3\=# $#\;4\=# #\;5\=# #\;6\=#\\\= \\\= #EE# \\\=\\\=\\\= #\;7\=# #EE## 1#\;8\=# \\\= # $### \\\=\\\=\\\=\\\=\\\=\\\=#\;9\=# # #### 2 #\;10\=#~~------------------------ #\;11\=# $ #\;12\=# 3 ##\\\=\\\= \\\= #\;13\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= #\;14\=# \\\= \\\= #\;15\=# 4 *** #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The 16th Cavern L16\;18\=~\;19\=~\;20\=~\;;17=1\=0;18=1\=# #EE#\;2\=# $ EE#\;3\=# #\;4\=# #\;5\=# 5 #\;6\=# \\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\=\\\=\\\=#\;7\=# #\;8\=#\\\=\\\= 6 #\;9\=# \\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\= \\\=\\\=\\\= \\\=\\\= #\;10\=# \\\=\\\= \\\=\\\=\\\= #\;11\=# \\\=\\\=#\;12\=# 7 #\;13\=# \\\=\\\=11\\\=\\\=\\\=22\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=33\\\=\\\=\\\=44\\\=\\\= #\;14\=#\\\=\\\= #\;15\=# 8 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= Amoebatrons Revenge L18\;18\=~\;19\=~\;20\=~\;;19=1\=0;20=1\=,`````,((((( (((((. .(((((#\;2\=,`````,(( (( (((((: :(((**#\;3\=,``F`,...... .+.+.: : **#\;4\=(,,F,........(((,,,,,,:::: (*#\;5\=( (F(........,,,################\;6\=(,,F,........'#####EE# $ #\;7\=###################EE# $#\;8\=################### # #\;9\=# \\\=\\\=#\;10\=# #\;11\=#---------------------- 1 ~ #\;12\=# *$ * $ * $ * \\\= #\;13\=#\\\=\\\= #\;14\=# \\\=\\\= #\;15\=# 2 #\;16\=#\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=\\\=#\;17\= The Final Barrier L20\;18\=~\;19\=~\;20\=~\;; ii=ImageList.LoadImage("e:\mmin.png") LDImage.MakeTransparent(II "BLACK") Mmc=LDImage.SplitImage(ii 16 9) II=ImageList.LoadImage("E:\mmn\man_pu.png") LDImage.MakeTransparent(ii "black") mmp=LDImage.SplitImage(ii 1 20) II=ImageList.LoadImage("E:\mmn\mm_tiles.png") LDImage.MakeTransparent(ii "black") mm=LDImage.SplitImage(ii 8 20) chr[1][1]="9;1 chr[2][1]="6;2 chr[2][2]="7;2 chr[4][1]="4;3 chr[4][2]="5;3 for f=2 to 5 chr[13][F]="16;6 EndFor chr[13][1]="11;6 chr[20][1]="11;6 chr[20][2]="5;5 Sub fset ' The following line could be harmful and has been automatically commented. ' ln=lwq[args[1]]'File.ReadContents(args[1]) If txmm Then wll="▓" mss="▒" lll="▀" ff=LDText.Replace(ff "#" wll) ff=LDText.Replace(ff "E" "░") ff=LDText.Replace(ff "=" lll) ff=LDText.Replace(ff "@" mss) 'ff=LDText.Replace(ff "%" "$") ff=LDText.Replace(ff "-" "▬") ff=LDText.Replace(ff "~" "▼") EndIf ' ln=LDText.Split(ff Text.GetCharacter(13)+Text.GetCharacter(10)) EndSub If txmm Then TextWindow.BackgroundColor="darkblue TextWindow.Clear() LDTextWindow.Encoding="Unicode" EndIf '19 5 14 17 Sub drawbb cl=TextWindow.CursorLeft For x=1 To 16 For d=1 To 2 For c=1 To 32 TextWindow.BackgroundColor="darkblue TextWindow.ForegroundColor="white cc=text.GetSubText (ln[x] c 1) If d=2 and (cc=lll or cc="▬" or cc="▼") Then cc=" " EndIf If cc=wll Then TextWindow.ForegroundColor="blue TextWindow.BackgroundColor="cyan ElseIf cc=mss or cc="$" Then TextWindow.ForegroundColor="red ElseIf cc=lll Then TextWindow.ForegroundColor="yellow EndIf TextWindow.Write(cc) TextWindow.Write(cc) EndFor TextWindow.CursorTop=TextWindow.CursorTop+1 TextWindow.CursorLeft=cl EndFor EndFor TextWindow.CursorLeft=cl+2 TextWindow.CursorTop=TextWindow.CursorTop-1 TextWindow.Write(ln[17]) EndSub ww=LDText.Split("01 02 03 04 06 07 08 09 10 11 12 13 15 16 18 20" " ") rw=1 ct=0 While rw<= Array.GetItemCount(ww) llw=ww[rw] LDCall.Function("fset" llw*1) If txmm Then TextWindow.CursorTop=ct TextWindow.CursorLeft=5 drawbb() rw=rw+1 LDCall.Function("fset" "E:\mmn\L"+llw+".txt") TextWindow.CursorTop=ct TextWindow.CursorLeft=75 drawbb() ct=ct+34 Else GraphicsWindow.Clear() ldrw() GraphicsWindow.ShowMessage(ln[17] "lvl:"+llw ) EndIf rw=rw+1 EndWhile Sub ldrw GraphicsWindow.BackgroundColor="teal GraphicsWindow.Width=800 GraphicsWindow.Height=500 GraphicsWindow.Left=5 GraphicsWindow.Top=5 lm=llw*1 GraphicsWindow.BrushColor="midnightblue GraphicsWindow.FillRectangle(20 20 640 320) bb=LDImage.Copy( mm[4][lm]) LDImage.ReplaceColour(bb "white" "gold" 20) bb1=LDImage.Copy( mm[2][lm]) LDImage.ReplaceColour(bb1 "white" "red" 20) bb2=LDImage.Copy( mm[3][lm]) LDImage.ReplaceColour(bb2 "white" "darkred" 20) bb6=LDImage.Copy( mm[8][lm]) LDImage.ReplaceColour(bb2 "white" "gold" 20) bb5=LDImage.Copy( mm[7][lm]) LDImage.ReplaceColour(bb5 "white" LDColours.HSLtoRGB(180 .8 .7) 20) bb3=LDImage.Copy( mm[5][lm]) LDImage.ReplaceColour(bb3 "white" "cyan" 20) bbx=LDImage.Copy( mm[4][15]) bb4=LDImage.Copy( mm[6][lm]) LDImage.ReplaceColour(bb4 "white" "lime" 20) For y=1 To 16 For c=1 To 32 ch=Text.GetSubText(ln[y] c 1) If ch="#" Then GraphicsWindow.BrushColor="darkred GraphicsWindow.FillRectangle(c*20 y*20 20 20) GraphicsWindow.DrawResizedImage(bb c*20 y*20 20 20) ElseIf ch="=" Then GraphicsWindow.DrawResizedImage(bb1 c*20 y*20 20 20) ElseIf ch="-" Then GraphicsWindow.DrawResizedImage(bb3 c*20 y*20 20 20) ElseIf ch="~" or ch="@" Then GraphicsWindow.DrawResizedImage(bb2 c*20 y*20 20 20) ElseIf ch="w" Then GraphicsWindow.DrawResizedImage(bb5 c*20 y*20 20 20) ElseIf ch="j" or ch="H" Then GraphicsWindow.DrawResizedImage(bb6 c*20 y*20 20 20) ElseIf ch="$" Then GraphicsWindow.DrawResizedImage(mmp[1][lm] c*20 y*20 15 15) ElseIf ch="*" Then GraphicsWindow.DrawResizedImage(bb4 c*20 y*20 20 20) ElseIf ch="E" Then GraphicsWindow.DrawResizedImage(bbx c*20 y*20 20 20) ElseIf ch*1>=1 Then lv=LDText.Split(chr[lm][ch*1] ";") GraphicsWindow.DrawResizedImage(mmc[lv[1]][lv[2]] c*20 y*20-20 40 40) EndIf EndFor EndFor EndSub End>RLK168-1.sb< Start>RLL644.sb< b=600 GraphicsWindow.Width =600 GraphicsWindow .Height =600 GraphicsWindow.Title ="Resonancy" GraphicsWindow.BackgroundColor="DarkBlue for x=1 To 16 cc[x]= LDColours.HSLtoRGB (x*20,0.8,0.6) EndFor GraphicsWindow.PenWidth =3 FOR x=0 TO b-1 Step 3 FOR y=0 TO b-1 Step 3 qx=x/b qy=y/b FOR n=6 TO 0 Step -1 FOR m=6 TO 0 Step -1 IF n>0 OR m>0 then nn=n*qx+m*qy IF math.ABS(nn-LDMath.Truncate (nn))<0.1/(n+m+1) then 'COLOR col(n%+m%) 'GraphicsWindow.SetPixel (x,y,cc[n+m]) GraphicsWindow.PenColor= cc[n+m] GraphicsWindow.DrawLine (x,y,x+2,y) fl=1 ENDIF ENDIF IF fl Then Goto xxx endif EndFor IF fl Then Goto xxx endif EndFor xxx: fl="FALSE EndFor EndFor End>RLL644.sb< Start>RLL741.sb< ' program by Yled 'to compute auto loan amount and monthly payment 'program no : XKB866 ' program no: GraphicsWindow.Clear() ' cls GraphicsWindow.Title = "Automobile Loan Calculator" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 768 GraphicsWindow.Width = 1366 navyblue=GraphicsWindow.GetColorFromRGB(0,0,75) GraphicsWindow.BackgroundColor=navyblue image1=ImageList.LoadImage("http://www.clker.com/cliparts/6/6/f/5/1236268464831552175yves_guillou_sport_car_1.svg.hi.png") GraphicsWindow.DrawImage(image1, 20, 50) GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "darkgray" GraphicsWindow.DrawText(50, 650, "Program by Yled @ 2016") buttonclicked = 0 title[1]="Auto loan amount" title[2]="Auto loan term in years" title[3]="Interest rate per year" title[4]="bi-monthly payment ? (y) or (n)" GraphicsWindow.FontSize = 20 For t=1 to 4 GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawBoundText(150, 375+k, 600, title[t]) GraphicsWindow.BrushColor = "blue" box[t] = Controls.AddTextBox(500, 375+k) Controls.SetSize(box[t],200,40) Controls.SetTextBoxText(box[t],0) k=k+50 endfor GraphicsWindow.FontSize = 16 GraphicsWindow.BrushColor = "darkred" button = Controls.AddButton("Compute Car payment", 300,600) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(850,5," Amortization Schedule ") GraphicsWindow.BrushColor = "black" Controls.ButtonClicked = Click Sub Click principal = Controls.GetTextBoxText(box[1]) term = Controls.GetTextBoxText(box[2]) interest = Controls.GetTextBoxText(box[3]) bi_monthly=Controls.GetTextBoxText(box[4]) If interest=0 Then interest = 0.000000001 EndIf If bi_monthly="y" Then term = term*26 rate = interest/100/26 else term=term*12 rate = interest/100/12 EndIf ' **************************** annuity formula ****************************************************** ' m = [P × i] / [1−(1 + i)−n] ' https://en.wikipedia.org/wiki/Amortization_calculator payment = (principal*rate) / (1-(math.Power((1+rate),-term))) ' **It is important that the rate per period and number of periods match. (e.g., If monthly, use the effective monthly rate.) ' alternative formula in 2 steps 'x=1/ Math.Power((1+rate),term) 'payment=(principal*rate)/(1-x) payment=(math.Round(payment*100))/100 balance = payment*term GraphicsWindow.FontSize = 9 GraphicsWindow.BrushColor = "black" If Controls.LastClickedButton = button Then If bi_monthly="y" Then two_weeks() Else monthly() EndIf buttonclicked = 1 EndIf EndSub buttonloop: If buttonclicked = 0 Then Goto buttonloop Else buttonclicked = 0 EndIf GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = "lime" If bi_monthly="y" Then GraphicsWindow.DrawText(350, 240, "bi-Monthly payment $ "+ payment) else GraphicsWindow.DrawText(350, 240, "Monthly payment $ "+ payment) endif GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(350, 300,"Total Cost $ "+payment*term) sub monthly For N = 2 To 45 balance = balance - payment balance=math.Round(balance*100)/100 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(875,30+z," Month: ") GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(925,30+z,N-1) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(950,30+z," $ "+balance) z=z+15 EndFor z=0 For N =46 To term balance = balance - payment balance=math.Round(balance*100)/100 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(1050,30+z," Month: ") GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(1100,30+z,N-1) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(1125,30+z," $ "+balance) z=z+15 EndFor EndSub Sub two_weeks For N = 2 To 45 balance = balance - payment balance=math.Round(balance*100)/100 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(800,30+z," Payment: ") GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(850,30+z,N-1) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(875,30+z," $ "+balance) z=z+15 EndFor z=0 For N =46 To 90 balance = balance - payment balance=math.Round(balance*100)/100 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(975,30+z," Payment: ") GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(1025,30+z,N-1) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(1050,30+z," $ "+balance) z=z+15 EndFor z=0 For N =91 To term balance = balance - payment balance=math.Round(balance*100)/100 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.DrawText(1150,30+z," Payment: ") GraphicsWindow.BrushColor = "magenta" GraphicsWindow.DrawText(1200,30+z,N-1) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(1225,30+z," $ "+balance) z=z+15 EndFor EndSub End>RLL741.sb< Start>RLM785-0.sb< init() SlideNewEvent_Create() Controls.ButtonClicked=global_click sub global_click button_clicked=Controls.LastClickedButton nm=Controls.GetButtonCaption(button_clicked) m=1 ' for m=1 to 4 if change[m]=button_clicked Then ''when event # button clicked Shapes.Move(smsg,PX,-50) t=500 Shapes.Animate(backbone,32,y-48-y_change,t) Shapes.Animate(box[1],x_tbs,y-y_change,t) Shapes.Animate(box[2],x_tbs,y2-y_change,t) Shapes.Animate(box[3],x_tbs+110,y2-y_change,t) '<----------------- Shapes.Animate(month_select,x_tbs+110,y2-y_change,t) Shapes.Animate(box[4],x_tbs+220,y2-y_change,t) Shapes.Animate(box[5],x_tbs,y3-y_change,t) Shapes.Animate(btn,x_tbs,y4-y_change,t) Shapes.Animate(ne_name,x_tbs-64,y-y_change,t) Shapes.Animate(ne_date,x_tbs-64,y2-y_change,t) Shapes.Animate(ne_details,x_tbs-64,y3-y_change,t) Controls.ShowControl(month_select) ElseIf month_select=button_clicked then Controls.HideControl(month_select) For j= 1 to 12 Controls.ShowControl(month_bet[j]) EndFor elseif Text.IsSubText(months,nm)="True" then ' gets Month name controls.SetTextBoxText(box[3],nm) ElseIf btn=button_clicked then 'WHEN SAVE BUTTON IS CLICKED k=5 'Must always be the last number (i) gets to. Notes[m]="" For i=1 To k ' For Textboxes 1 to 5 Notes[m]= Notes[m]+Controls.GetTextBoxText(box[i])+"," ' connect data like csv data Controls.SetTextBoxText(box[i],"") EndFor ' The following line could be harmful and has been automatically commented. ' File.AppendContents(Calendar_Storage,Notes[m]) ' Appends data in the File For j= 1 to 12 controls.HideControl(month_bet[j]) EndFor PX=10+math.GetRandomNumber(700) 'Animation at end which shows that the data is saved. Shapes.Animate(smsg,PX,800,4000) Shapes.Animate(backbone,32,y-48+y_change,t) 'Here it allows for the "sliding box" to slide into thin air. Neat ha. Shapes.Animate(box[1],x_tbs,y+y_change,t) Shapes.Animate(box[2],x_tbs,y2+y_change,t) Shapes.Animate(box[3],x_tbs+110,y2+y_change,t) Shapes.Animate(box[4],x_tbs+220,y2+y_change,t) Shapes.Animate(box[5],x_tbs,y3+y_change,t) Shapes.Animate(btn,x_tbs,y4+y_change,t) Controls.hideControl(month_select) Shapes.Animate(ne_name,x_tbs-64,y+y_change,t) Shapes.Animate(ne_date,x_tbs-64,y2+y_change,t) Shapes.Animate(ne_details,x_tbs-64,y3+y_change,t) EndIf ' EndFor EndSub Sub SlideNewEvent_Create y_change=400 y=464 y2=y+48 y3=y2+48 y4=y3+172 x_tbs=150 GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(128,100,162) backbone=Shapes.AddRectangle(1140,480) Shapes.Move(backbone,32,y-48) GraphicsWindow.BrushColor="Navy" ne_name=shapes.AddText("Name:") 'Textbox names written beside relevant boxes Shapes.Move(ne_name,x_tbs-64,y) ne_date=shapes.AddText("Date:") Shapes.Move(ne_date,x_tbs-64,y2) ne_details=shapes.AddText("Details:") Shapes.Move(ne_details,x_tbs-64,y3) box[1]=Controls.AddTextBox(x_tbs,y) Controls.SetSize(box[1],400,32) box[2]=Controls.AddTextBox(x_tbs,y2) Controls.SetSize(box[2],100,32) box[3]=Controls.AddTextBox(x_tbs+110,y2) ' <------- Hiden by "Month ?" Controls.SetSize(box[3],100,32) month_select=Controls.AddButton("Month ?",x_tbs+110,y2) Controls.SetSize(month_select,100,32) ' <------- box[4]=Controls.AddTextBox(x_tbs+220,y2) Controls.SetSize(box[4],100,32) box[5]=Controls.AddMultiLineTextBox(x_tbs,y3) Controls.SetSize(box[5],400,150) btn= Controls.AddButton("Save",150,y4) ' Save Button added Controls.SetSize(btn,400,32) evb_w=96 evb_start=64 evb_dis_a=12 For l=1 To 4 change[l]= Controls.AddButton("Event "+l,evb_start+((l-1)*(evb_w+evb_dis_a)),32) ' Event buttons added Controls.SetSize(change[l],evb_w,32) EndFor x_months_start=52 monthsw=82 monthbet=12 months="JanFebMarAprMayJunJulAugSepOctNovDec" ' Month Name List For j= 1 to 12 month=Text.GetSubText(Months,1+3*(j-1),3) ' Get Month Name month_bet[j]=controls.AddButton(month,x_months_start + (monthsw+monthbet)*(j-1) ,GraphicsWindow.Height/2+80) Controls.HideControl(month_bet[j]) ' hide them first EndFor smsg= Shapes.AddText(" Saved ") ' Text which verifies the Save of Data by swipping across the screen Shapes.Move(smsg,0,-50) EndSub Sub init GraphicsWindow.Clear() 'GraphicsWindow.CanResize="false" GraphicsWindow.top=50 GraphicsWindow.Left=50 GraphicsWindow.Width=1200 GraphicsWindow.Height=650 GraphicsWindow.Show() GraphicsWindow.BackgroundColor="Lightcyan" Calendar_Storage=Program.Directory+"\gcf.rmr" 'Where all events are stored GraphicsWindow.FontSize=18 EndSub End>RLM785-0.sb< Start>RLM785.sb< init() SlideNewEvent_Create() Controls.ButtonClicked=global_click Sub init GraphicsWindow.Clear() 'GraphicsWindow.CanResize="false" GraphicsWindow.top=50 GraphicsWindow.Left=50 GraphicsWindow.Width=1200 GraphicsWindow.Height=650 GraphicsWindow.Show() GraphicsWindow.BackgroundColor="Lightcyan" Calendar_Storage=Program.Directory+"\gcf.rmr" 'Where all events are stored GraphicsWindow.FontSize=18 EndSub Sub SlideNewEvent_Create y_change=400 y=664 y2=y+48 y3=y2+48 y4=y3+172 x_tbs=150 GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(128,100,162) backbone=Shapes.AddRectangle(1140,480) Shapes.Move(backbone,32,y-48) GraphicsWindow.BrushColor="Navy" ne_name=shapes.AddText("Name:") 'Textbox names written beside relevant boxes Shapes.Move(ne_name,x_tbs-64,y) ne_date=shapes.AddText("Date:") Shapes.Move(ne_date,x_tbs-64,y2) ne_details=shapes.AddText("Details:") Shapes.Move(ne_details,x_tbs-64,y3) box[1]=Controls.AddTextBox(x_tbs,y) Controls.SetSize(box[1],400,32) box[2]=Controls.AddTextBox(x_tbs,y2) Controls.SetSize(box[2],100,32) month_select=Controls.AddButton("Month ?",x_tbs+110,y2) Controls.SetSize(box[3],100,32) box[4]=Controls.AddTextBox(x_tbs+220,y2) Controls.SetSize(box[4],100,32) box[5]=Controls.AddMultiLineTextBox(x_tbs,y3) Controls.SetSize(box[5],400,150) btn= Controls.AddButton("Save",150,y4) ' Save Button added Controls.SetSize(btn,400,32) evb_w=96 evb_start=64 evb_dis_a=12 For l=1 To 4 change[l]= Controls.AddButton("Event "+l,evb_start+((l-1)*(evb_w+evb_dis_a)),32) ' Event buttons added Controls.SetSize(change[l],evb_w,32) EndFor smsg= Shapes.AddText(" Saved ") ' Text which verifies the Save of Data by swipping across the screen Shapes.Move(smsg,0,-50) EndSub sub global_click button_clicked=Controls.LastClickedButton For m=1 To 4 If change[m]=button_clicked Then ''when event # button clicked Shapes.Move(smsg,PX,-50) t=500 Shapes.Animate(backbone,32,y-48-y_change,t) Shapes.Animate(box[1],x_tbs,y-y_change,t) Shapes.Animate(box[2],x_tbs,y2-y_change,t) Shapes.Animate(month_select,x_tbs+110,y2-y_change,t) Shapes.Animate(box[4],x_tbs+220,y2-y_change,t) Shapes.Animate(box[5],x_tbs,y3-y_change,t) Shapes.Animate(btn,x_tbs,y4-y_change,t) Shapes.Animate(ne_name,x_tbs-64,y-y_change,t) Shapes.Animate(ne_date,x_tbs-64,y2-y_change,t) Shapes.Animate(ne_details,x_tbs-64,y3-y_change,t) ElseIf month_select=button_clicked then x_months_start=32 months_w=92 month_bet=12 Controls.Remove(month_select) jan=controls.AddButton("Jan",x_months_start+((months_w*0)+month_bet),GraphicsWindow.Height/2) feb=controls.AddButton("Feb",x_months_start+((months_w*1)+month_bet),GraphicsWindow.Height/2) mar=controls.AddButton("Mar",x_months_start+((months_w*2)+month_bet),GraphicsWindow.Height/2) apr=controls.AddButton("Apr",x_months_start+((months_w*3)+month_bet),GraphicsWindow.Height/2) may=controls.AddButton("May",x_months_start+((months_w*4)+month_bet),GraphicsWindow.Height/2) jun=controls.AddButton("Jun",x_months_start+((months_w*5)+month_bet),GraphicsWindow.Height/2) jul=controls.AddButton("Jul",x_months_start+((months_w*6)+month_bet),GraphicsWindow.Height/2) aug=controls.AddButton("Aug",x_months_start+((months_w*7)+month_bet),GraphicsWindow.Height/2) sep=controls.AddButton("Sep",x_months_start+((months_w*8)+month_bet),GraphicsWindow.Height/2) oct=controls.AddButton("Oct",x_months_start+((months_w*9)+month_bet),GraphicsWindow.Height/2) nov=controls.AddButton("Nov",x_months_start+((months_w*10)+month_bet),GraphicsWindow.Height/2) dec=controls.AddButton("Dec",x_months_start+((months_w*11)+month_bet),GraphicsWindow.Height/2) ElseIf btn=button_clicked then 'WHEN SAVE BUTTON IS CLICKED k=5 'Must always be the last number (i) gets to. For i=1 To k ' For Textboxes 1 to 5 If i=1 Then ' Each textbox (i) corrosponds to a seperate detail of an event. Here we give the textboxes a name. name="name_event" Elseif i=2 then name="day" ElseIf i=3 then name="month" ElseIf i=4 then name="year" Elseif i=5 then name="details" Endif Notes[m][name]=Controls.GetTextBoxText(box[i]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Calendar_Storage,(k*m)+i,Notes[m][name]) Controls.SetTextBoxText(box[i],"") EndFor PX=10+math.GetRandomNumber(700)'Animation at end which shows that the data is saved. Shapes.Animate(smsg,PX,800,4000) Shapes.Animate(backbone,32,y-48+y_change,t) 'Here it allows for the "sliding box" to slide into thin air. Neat ha. Shapes.Animate(box[1],x_tbs,y+y_change,t) Shapes.Animate(box[2],x_tbs,y2+y_change,t) Shapes.Animate(box[3],x_tbs+110,y2+y_change,t) Shapes.Animate(box[4],x_tbs+220,y2+y_change,t) Shapes.Animate(box[5],x_tbs,y3+y_change,t) Shapes.Animate(btn,x_tbs,y4+y_change,t) Shapes.Animate(ne_name,x_tbs-64,y+y_change,t) Shapes.Animate(ne_date,x_tbs-64,y2+y_change,t) Shapes.Animate(ne_details,x_tbs-64,y3+y_change,t) EndIf EndFor EndSub End>RLM785.sb< Start>RLM979.sb< GraphicsWindow.Height = 1000 GraphicsWindow.Width = 1000 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawBoundText(10,10 50,"Press L for Colors!") GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.KeyDown = OnKeyDown Sub OnKeyDown If GraphicsWindow.LastKey = "L" Then Sound.PlayClick() GraphicsWindow.ShowMessage("Press. C for Cyan. T for Teal. O for Orange. R for Red. G for Green. B for Blue. M for Megenta. W for White", "Colors") EndIf If (GraphicsWindow.LastKey) = "T" Then Sound.PlayClick() GraphicsWindow.PenColor = "Teal" EndIF If (GraphicsWindow.LastKey) = "C" Then Sound.PlayClick() GraphicsWindow.PenColor = "Cyan" EndIF If (GraphicsWindow.LastKey) = "O" Then Sound.PlayClick() GraphicsWindow.PenColor = "Orange" EndIF If (GraphicsWindow.LastKey) = "M" Then Sound.PlayClick() GraphicsWindow.PenColor = "Magenta" EndIF If (GraphicsWindow.LastKey) = "R" Then Sound.PlayClick() GraphicsWindow.PenColor = "Red" EndIf If GraphicsWindow.LastKey = "G" Then Sound.PlayClick() GraphicsWindow.PenColor = "Green" EndIf If GraphicsWindow.LastKey = "Y" Then Sound.PlayClick() GraphicsWindow.PenColor = "Yellow" EndIf If GraphicsWindow.LastKey = "B" Then Sound.PlayClick() GraphicsWindow.PenColor = "Blue" EndIf If GraphicsWindow.LastKey = "W" Then Sound.PlayClick() GraphicsWindow.PenColor = "White" EndIf EndSub Sub OnMouseDown prevx = GraphicsWindow.MouseX prevy = GraphicsWindow.MouseY EndSub Sub OnMouseMove x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown) Then GraphicsWindow.DrawLine(prevx, prevy, x, y) EndIf prevx = x prevy = y EndSub End>RLM979.sb< Start>RLN596.sb< TextWindow.BackgroundColor = "Magenta" TextWindow.Clear() TextWindow.ForegroundColor= "Black" TextWindow.Write("Welcome to North Shore High, freshman! I'm Damian. What's your name? ") name= TextWindow.Read() TextWindow.WriteLine("Ok, "+name+". If you want to survive here, you're going to have to hang out with the right people.") textwindow.WriteLine("Are you ready to enter girl world? Welcome to Mean Girls: The Game") Program.Delay(5000) TextWindow.WriteLine("The rules of the game are simple: use the keyboard to guide yourself around North Shore.") TextWindow.WriteLine("Be careful of the Plastics! They're everywhere, and they can ruin your high school experience forever!") Program.Delay(10000) TextWindow.WriteLine("There's Karen Smith. She's one of the dumbest girls you'll ever meet. Last year, in English, she asked me how to spell orange.") TextWindow.WriteLine("Next, there's Gretchen Wieners. She's totally rich because her dad invented Toaster Streudels. She knows everything about everyone; that's why her hair is so big.") TextWindow.WriteLine("Lastly, there's Regina George. Don't be fooled, because she may seem like your typical selfish, back-stabbing queen bee, but in reality, she's so much more than that.") TextWindow.WriteLine("Avoid these girls at all costs. Get through lunch by getting to your freshman table without making a scene with the Plastics and the other students at North Shore.") TextWindow.WriteLine("You can't leave the cafeteria for any reason either. That's like social suicide. You can't go over your own trail either, because people will think you're so not fetch!") TextWindow.WriteLine("Your table will be blue.") Program.Delay(20000) TextWindow.Write("Do you understand? ") answer= TextWindow.Read() If (Text.StartsWith(answer, "N") Or Text.StartsWith(answer, "n") ) Then TextWindow.WriteLine("Too bad! You'll learn soon enough! Would you like to be helped by Janis, Cady, or me (Damian)?") person= TextWindow.Read() Else TextWindow.WriteLine("Ok then, let's get started! Would you like to be helped by Janis, Cady, or me (Damian)?") person= TextWindow.Read() endif Janis= "http://3.bp.blogspot.com/_sEFA_MEG_UI/S_lbEwKpYUI/AAAAAAAAA04/kYcWHl6D80w/s1600/Janis+Ian1.JPG" Damian= "http://24.media.tumblr.com/tumblr_m7njs7vTAe1rwmjrxo2_500.jpg" Cady= "http://www.brooklynpaper.com/assets/photos/30/43/30_43_lindsaymean_i.jpg" If (Text.StartsWith(person, "J") Or Text.StartsWith(person, "j") ) Then person= Janis ImageList.LoadImage(Janis) ElseIf (Text.StartsWith(person, "C") Or Text.StartsWith(person, "c") ) Then person= Cady ImageList.LoadImage(Cady) Else person= Damian ImageList.LoadImage(Damian) EndIf TextWindow.WriteLine("Watch out please! Fresh meat coming through!") Program.Delay(1000) TextWindow.Hide() '------------------------------------------------------------------------------------------------------------------------------------------------------------ GraphicsWindow.Show() GraphicsWindow.Height= 650 GraphicsWindow.Width= 1000 GraphicsWindow.Left= 5 GraphicsWindow.Top= 5 GraphicsWindow.BackgroundColor= "black" GraphicsWindow.PenColor= "white" GraphicsWindow.KeyDown= MoveCycle level=1 Begin() Start: While "true" Moving() Program.Delay(50) WinGame() If crashed="true" Then Shapes.Remove(player) Program.Delay(500) Begin() EndIf endwhile Sub Begin GraphicsWindow.Clear() delXY="X=1;Y=0" player= Shapes.AddImage(person) Shapes.Rotate(player,90) crashed="false" AddObstacles() TimePlayed=clock.ElapsedMilliseconds endsub Sub AddObstacles GraphicsWindow.BrushColor="Blue" winx= Math.GetRandomNumber(980) winy= Math.GetRandomNumber(630) table= Shapes.AddRectangle(50,50) Shapes.Move(table,winx,winy) For i= 1 To level retry: GraphicsWindow.BrushColor=GraphicsWindow.GetRandomColor() locationx= Math.GetRandomNumber(900) locationy= Math.GetRandomNumber(550) recsize= 30+Math.GetRandomNumber(70) If (locationx<40 and locationy<15) Or (math.Abs(locationx-winx)1001 then X=1001 elseif Y<0 then Y=-1 elseif y>650 then Y=651 endif Shapes.Move(player,x,y) ClockCount= Math.Floor((Clock.ElapsedMilliseconds-TimePlayed)/100)/10 If (GraphicsWindow.GetPixel(x+40/2+delXY["X"],y+40/2+delXY["Y"]) <> "#000000") Then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" ElseIf (x>1000 or x<0) then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" ElseIf (y>650 or y<0) then GraphicsWindow.ShowMessage("You have crashed, and are banished from Kyragetron!", name+", YOU ARE BANISHED!") crashed="true" EndIf GraphicsWindow.BrushColor= "magenta" GraphicsWindow.FillRectangle(x +15/4-1, y + 40/3+2, 12, 12) EndSub Sub MoveCycle key= GraphicsWindow.LastKey If (key= "Right") Then delXY="X=12;Y=0;rot=1" ElseIf (key= "Left") Then delXY="X=-12;Y=0;rot=1" ElseIf (key= "Down") Then delXY="X=0;Y=12;rot=0" ElseIf (key= "Up") Then delXY="X=0;Y=-12;rot=0" EndIf Shapes.Rotate(player,delxy["rot"]*90) EndSub Sub WinGame If (math.Abs(x-winx)<20 and math.Abs(y-winy)<30) Then If (level=50) Then GraphicsWindow.ShowMessage("You have won the game of Kyragetron, and are welcome in our land! Play again to reinforce your skills.", name+" YOU ARE OUR VICTOR") level= 1 Goto Start EndIf GraphicsWindow.ShowMessage("Congrats! You have completed Level "+level+", and live to see another day. Good luck on the next level!", "Good Job") level= level +1 Begin() EndIf EndSub End>RLN596.sb< Start>RLR450.sb< ' June Challenge 2016, keyboard on screen ' yled program no; RKD135 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 = 20 Then GraphicsWindow.BrushColor="green" GraphicsWindow.DrawText(50+s,100,"é") GraphicsWindow.BrushColor="white" endif 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]) n=math.GetRandomNumber(7) Sound.PlayMusic ("O7L32"+note[n]) 'GraphicsWindow.ShowMessage(touche[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 n=math.GetRandomNumber(7) GraphicsWindow.DrawText(60+s,90,touche[t]) Sound.PlayMusic ("O6L32"+note[n]) 'GraphicsWindow.ShowMessage(touche[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 n=math.GetRandomNumber(7) GraphicsWindow.DrawText(40+s,150,touche[t]) Sound.PlayMusic ("O5L32"+note[n]) 'GraphicsWindow.ShowMessage(touche[t],"you have press") EndIf s=s+60 EndFor If mx > 510 And mx< 550 and my > 200 and my < 240 Then GraphicsWindow.ShowMessage(touche[36],"you have press MAIL") Sound.PlayChime() EndIf If mx > 570 And mx< 610 and my > 200 and my < 240 Then GraphicsWindow.ShowMessage(touche[37],"you have press Ctrl") Sound.PlayChime() EndIf EndSub Sub defin touche[1]="Q" touche[2]="W" touche[3]="E" touche[4]="R" touche[5]="T" touche[6]="Y" touche[7]="U" touche[8]="I" touche[9]="O" touche[10]="P" touche[11]="A" touche[12]="S" touche[13]="D" touche[14]="F" touche[15]="G" touche[16]="H" touche[17]="J" touche[18]="K" touche[19]="L" ' à 32 commence les codes de caracteres commencant par ! xx=Text.GetCharacter(34) touche[20]=xx touche[21]="⏎" touche[22]="Z" touche[23]="X" touche[24]="C" touche[25]="V" touche[26]="B" touche[27]="N" touche[28]="M" touche[29]=";" touche[30]=":" touche[31]="!" touche[32]="⇧" touche[33]="℮" touche[34]="alt" touche[35]=" " touche[36]="✉" touche[37]="Ctrl" note[1]="C" note[2]="D" note[3]="E" note[4]="F" note[5]="G" note[6]="A" note[7]="B" endsub End>RLR450.sb< Start>RLS680.sb< 'FloodFill example - for some theory see http://en.wikipedia.org/wiki/Flood_fill 'Draw regions with left mouse button and fill with right mouse button gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp mouseMove = 0 mouseDown = 0 rightClick = 0 While ("True") If (mouseDown = 1 And mouseMove = 1) Then xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY GraphicsWindow.DrawLine(xMLast,yMLast,xM,yM) xMLast = xM yMLast = yM mouseMove = 0 ElseIf (rightClick = 1) Then fillRegion() rightClick = 0 EndIf Program.Delay(20) EndWhile Sub fillRegion Stack.PushValue("X",xMLast) Stack.PushValue("Y",yMLast) colOld = GraphicsWindow.GetPixel(xMLast,yMLast) colFill = GraphicsWindow.PenColor While (Stack.GetCount("X") > 0) x = Stack.PopValue("X") y = Stack.PopValue("Y") If (GraphicsWindow.GetPixel(x,y) <> colFill) Then 'We could have multiple entries in the stack at x,y so only process those we haven't dealt with GraphicsWindow.SetPixel(x,y,colFill) If (x > 0) Then If (GraphicsWindow.GetPixel(x-1,y) = colOld) Then Stack.PushValue("X",x-1) Stack.PushValue("Y",y) EndIf EndIf If (x < gw-1) Then 'X pixels go from 0 to gw-1 If (GraphicsWindow.GetPixel(x+1,y) = colOld) Then Stack.PushValue("X",x+1) Stack.PushValue("Y",y) EndIf EndIf If (y > 0) Then If (GraphicsWindow.GetPixel(x,y-1) = colOld) Then Stack.PushValue("X",x) Stack.PushValue("Y",y-1) EndIf EndIf If (y < gh-1) Then ''Y pixels go from 0 to gh-1 If (GraphicsWindow.GetPixel(x,y+1) = colOld) Then Stack.PushValue("X",x) Stack.PushValue("Y",y+1) EndIf EndIf EndIf EndWhile EndSub Sub OnMouseMove mouseMove = 1 EndSub Sub OnMouseDown GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() xMLast = GraphicsWindow.MouseX yMLast = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown) Then mouseDown = 1 ElseIf (Mouse.IsRightButtonDown) Then rightClick = 1 EndIf EndSub Sub OnMouseUp mouseDown = 0 EndSub End>RLS680.sb< Start>RLV240.sb< 'GUI Design, by Airwaves! GraphicsWindow.Show() GraphicsWindow.Title = "GUI Designer" dialog_filepath = Program.Directory + "\" 'your program filepath with extension (.smallbasic) 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") currentselected = "" stuff() Sub addbutton buttonnumber = buttonnumber + 1 button[buttonnumber] = FCControls.AddButton(80, 30, "Button " + buttonnumber) FCControls.RegisterMouseDownEvent(button[buttonnumber], "setselected") 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") FCControls.Move(x_box, GraphicsWindow.Width - 190, 5) FCControls.Move(y_box, GraphicsWindow.Width - 95, 5) FCControls.Move(register_box, GraphicsWindow.Width - 190, 35) FCControls.RegisterKeyDownEvent(x_box, "setposition") FCControls.RegisterKeyDownEvent(y_box, "setposition") FCControls.RegisterKeyDownEvent(register_box, "setregister") 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(button) buttonleft = FCControls.GetLeft(button[i]) buttonright = FCControls.GetRight(button[i]) buttontop = FCControls.GetTop(button[i]) buttonbottom = FCControls.GetBottom(button[i]) If mX>buttonleft And mXbuttontop And mYRLV240.sb< Start>RLV949.sb< Largest = 999999999999999 TextWindow.WriteLine(Largest) Largest = Largest - 1 TextWindow.WriteLine(Largest) Largest = Largest + 2 TextWindow.WriteLine(Largest) For a = 1 To 13 Largest = Largest * 10 TextWindow.WriteLine(Largest) EndFor TextWindow.WriteLine("123456789012345678901234567890") 'My conclusions are that the largest number Small Basic will accept as input 'is 15 digits :- 999,999,999,999,999. But it appears to write up to 29 digits as a 'result of calculations. Therefor my GUESS is that the answer to the challenge is '99,999,999,999,999,999,999,999,999,999. I don't know any way to cope with a 'run-time error in Small Basic, so this is also a request for any help with that. I would 'like to set the test going with a high number and add one until the limit was reached. 'If I increase the a loop above to 14 the program crashes, so I assume 30 digits are too many. End>RLV949.sb< Start>RMC264.sb< '********************************************* '* MUSICPLAYER: Play all MP3-Files in Path * '* Microsoft Small Basic v0.8 * '********************************************* 'Martin Menze 'Mailing to martmen@gmx.de '********************************************* 'Errors in Sub OnKeyDown '1. Press Key Pause '2 Press Key F1 '********************************************* 'Path = "Z:\Alle Titel\" Path = "C:\Users\Public\Music\Aerosmith\Aerosmith - Just Push Play\" GraphicsWindow.KeyDown = OnKeyDownEvent KeyDownEvent = 0 Sub OnKeyDownEvent KeyDownEvent = 1 EndSub LP = Text.GetLength(Path) S = LP + 1 GraphicsWindow.Title = Path GraphicsWindow.BackgroundColor = "Ivory" GraphicsWindow.BrushColor = "Black" GraphicsWindow.Height = 40 GraphicsWindow.Width = 640 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.DrawBoundText(0, 0, 500, "Pause = Pause on/off, F1 = Next, F5 = Random on/off, F9 = End") Pause = 0 Random = 1 SchowDo() GraphicsWindow.DrawBoundText(560, 0, 80, "SEARCHING") ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' DN = File.GetFiles(Path) Index = 0 IC = Array.GetItemCount(DN) playing = 0 While IC >= Index If (playing = 0) Then Sound.Stop(LPath) PlaySong() playing = 1 start = Clock.ElapsedMilliseconds EndIf If (Clock.ElapsedMilliseconds-start > 3*60*1000) Then playing = 0 EndIf If (KeyDownEvent = 1) Then OnKeyDown() KeyDownEvent = 0 EndIf Program.Delay(100) EndWhile Program.End() '********************************************************************************* Sub PlaySong If Random = 1 then Index = Math.GetRandomNumber(IC) Else Index = Index + 1 If Index > IC then Index = 1 Endif EndIf LPath = DN[Index] SchowDo() LE = Text.GetLength(LPath) L = LE - LP Titel = Text.GetSubText(LPath, S, L) GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.FillRectangle(0, 20, 640, 15) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(0, 20, 640, Titel) Program.Delay(1000) Sound.Play(LPath) Program.Delay(1000) EndSub Sub OnKeyDown T = GraphicsWindow.LastKey If T = "Pause" Then If Pause = 0 then Pause = 1 GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.FillRectangle(0, 20, 640, 15) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(0, 20, 640, "Pause") Program.Delay(1000) Sound.Pause(LPath) Program.Delay(1000) Else Pause = 0 GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.FillRectangle(0, 20, 640, 15) GraphicsWindow.BrushColor = "Black" LE = Text.GetLength(LPath) L = LE - LP Titel = Text.GetSubText(LPath, S, L) GraphicsWindow.DrawBoundText(0, 20, 640, Titel) Program.Delay(1000) Sound.Play(LPath) Program.Delay(1000) EndIf Elseif T = "F1" then Sound.Stop(LPath) GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.FillRectangle(0, 20, 640, 15) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(0, 20, 640, "Suche nächsten Song") Program.Delay(1000) PlaySong() Elseif T = "F5" then if Random = 1 then Random = 0 else Random = 1 endif Elseif T = "F9" then Program.End() EndIf SchowDo() EndSub Sub SchowDo GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.FillRectangle(510, 0, 130, 15) GraphicsWindow.BrushColor = "Black" If Pause = 0 then If Random = 0 then GraphicsWindow.DrawBoundText(510, 0, 130, "RD off ") else GraphicsWindow.DrawBoundText(510, 0, 130, "RD on ") endif else If Random = 0 then GraphicsWindow.DrawBoundText(510, 0, 130, "RD off Pause") else GraphicsWindow.DrawBoundText(510, 0, 130, "RD on Pause") endif endif EndSub End>RMC264.sb< Start>RMD848.sb< ballspeed = 10 removecount = 0 linelength = 0 roundnumber = 1 shots = 0 par = 1 totalscore = 0 obstacleplaced = "false" numberofobstacles = 0 ballbouncedleft = "true" ballbounceddown = "true" ballbouncedup = "true" ballbouncedright = "true" lastballdirectx = "" lastballdirecty = "" GraphicsWindow.BackgroundColor = "lightBlue" GraphicsWindow.BrushColor = "Green" GraphicsWindow.Title="MiniGolf" button = Controls.AddButton("Restart Hole", 405,0) Controls.ButtonClicked = buttonclicked round[roundnumber] = Shapes.AddRectangle(200, 400) roundheight = 400 roundwidth = 200 Shapes.Move(round[roundnumber], 200, 20) GraphicsWindow.BrushColor = "White" ball = Shapes.AddEllipse(20,20) ballstartx = 290 ballstarty = 390 Shapes.Move(ball, ballstartx, ballstarty) GraphicsWindow.BrushColor = "Black" hole = Shapes.AddEllipse(25,25) Shapes.Move(hole, 290, 60) GraphicsWindow.Mousedown = mousedown GraphicsWindow.MouseUp = mouseup textbox = Controls.AddTextBox(0,0) textboxr = Controls.AddTextBox(0,20) textboxs = Controls.AddTextBox(0,40) textboxp = Controls.AddTextBox(0,60) textboxtot = Controls.AddTextBox(0,80) Controls.SetTextBoxText(textbox, "Power: " + linelength) Controls.SetTextBoxText(textboxs, "Shots: " + shots) Controls.SetTextBoxText(textboxp, "Par: " + par) Controls.SetTextBoxText(textboxr, "Hole Number: " + roundnumber) Controls.SetTextBoxText(textboxtot, "Total Score: " + totalscore) GraphicsWindow.ShowMessage("Welcome to MiniGolf! In this fun game your goal is to get the ball in the hole in as few shots as possible! By clicking on a location on the screen you will hit your ball there! The further you click from the ball, the more power you will use! Watch out for obstacles! You can bounce off of obstacles and the border! How much power you use will determine how much you bounce! You can restart each hole if you want! Have Fun!", "MiniGolf") loop: moveball() Goto loop Sub checkball   roundtopborder = Shapes.GetTop(round[roundnumber])   roundbottomborder = Shapes.GetTop(round[roundnumber]) + roundheight   roundleftborder = Shapes.Getleft(round[roundnumber])   roundrightborder = Shapes.Getleft(round[roundnumber]) + roundwidth   balltopborder = Shapes.GetTop(ball)   ballbottomborder = Shapes.GetTop(ball) + 20   ballleftborder = Shapes.Getleft(ball)   ballrightborder = Shapes.Getleft(ball) + 20   ballmiddlex = Shapes.Getleft(ball) + 10   ballmiddley = Shapes.Gettop(ball) + 10   holetopborder = Shapes.GetTop(hole)   holebottomborder = Shapes.GetTop(hole) + 25   holeleftborder = Shapes.Getleft(hole)   holerightborder = Shapes.Getleft(hole) + 25   If (ballleftborder = roundleftborder) Or (ballleftborder < roundleftborder) then     ballbouncedright = "false"    ballmoved = "true"    bounceright()   endif   If (ballrightborder = roundrightborder) Or (ballrightborder > roundrightborder) then     ballbouncedleft = "false"    ballmoved = "true"    bounceleft()   endif   If (balltopborder = roundtopborder) Or (balltopborder < roundtopborder) then     ballbounceddown = "false"    ballmoved = "true"    bouncedown()   endif  ��If (ballbottomborder = roundbottomborder) Or (ballbottomborder > roundbottomborder) then     ballbouncedup = "false"    ballmoved = "true"    bounceup()   endif   If (ballmiddlex > holeleftborder) And (ballmiddlex < holerightborder) And (ballmiddley > holetopborder) And (ballmiddley < holebottomborder)  then     Shapes.Remove(ball)     Shapes.Remove(round[roundnumber])     Shapes.Remove(hole)     For nmbr = 0 To 10       Shapes.Remove(obstacle[nmbr])     EndFor     roundnumber = roundnumber + 1     score = shots - par     GraphicsWindow.ShowMessage("Congratulations! You scored a " + score + " this round!", "Congratulations!")     Program.Delay(500)     totalscore = totalscore + score     Controls.SetTextBoxText(textboxtot, "Total Score: " + totalscore)     if roundnumber = 2 Then       newround2()     EndIf     If roundnumber = 3 Then       newround3()     endif     If roundnumber = 4 Then       newround4()     endif     If roundnumber = 5 Then       newround5()     endif     If roundnumber = 6 Then       newround6()     endif     If roundnumber = 7 Then       newround7()     endif If roundnumber = 8 Then       newround8()     endif If roundnumber = 9 Then       newround9()     endif     If roundnumber = 10 Then       GraphicsWindow.ShowMessage("Congratulations! You scored " + totalscore + " this game!", "Congratulations!")       Program.End()     endif   EndIf   If obstacleplaced = "true" then     For rn = 0 to numberofobstacles       obstacleleft = Shapes.GetLeft(obstacle[rn])       obstacleright = Shapes.GetLeft(obstacle[rn]) + obstaclewidth       obstacletop = Shapes.Gettop(obstacle[rn])       obstaclebottom = Shapes.Gettop(obstacle[rn]) + obstacleheight       If (ballrightborder = obstacleleft) And (balltopborder > obstacletop) And (ballbottomborder < obstaclebottom) and (ballleftborder < obstacleleft) or (ballrightborder > obstacleleft) And (balltopborder > obstacletop) And (ballbottomborder < obstaclebottom) and (ballleftborder < obstacleleft) Then     ballbouncedleft = "false"   ballmoved = "true"   bounceleft()       endif       If (ballrightborder = obstacleleft) And (balltopborder < obstaclebottom) And (balltopborder > obstacletop) and (ballleftborder < obstacleleft) And (ballbottomborder > obstacletop) or (ballrightborder > obstacleleft) And (balltopborder < obstaclebottom) And (balltopborder < obstacletop) and (ballleftborder < obstacleleft) And (ballbottomborder > obstacletop) Then   ballbouncedleft = "false"  ballmoved = "true"  bounceleft() endif      If (ballrightborder = obstacleleft) And (ballbottomborder > obstaclebottom) And (balltopborder < obstaclebottom) and (ballleftborder < obstacleleft) or (ballrightborder > obstacleleft) And (ballbottomborder > obstaclebottom) And (balltopborder < obstaclebottom) and (ballleftborder < obstacleleft) Then  If (lastballdirectx = "right") And (lastballdirecty <> "up") then  ballbouncedleft = "false"    ballmoved = "true"   bounceleft() endif       endif       If (balltopborder = obstaclebottom) And (ballrightborder < obstacleright) And (ballleftborder > obstacleleft) And (ballbottomborder > obstaclebottom) or (balltopborder < obstaclebottom) And (ballrightborder < obstacleright) And (ballleftborder > obstacleleft) And (ballbottomborder > obstaclebottom) then         ballbounceddown = "false"    ballmoved = "true"    bouncedown()       endif       If (balltopborder = obstaclebottom) And (ballleftborder < obstacleright) And (ballrightborder > obstacleleft) And (ballbottomborder > obstaclebottom) or (balltopborder < obstaclebottom) And (ballleftborder < obstacleright) And (ballrightborder > obstacleleft) And (ballbottomborder > obstaclebottom) then         ballbounceddown = "false"    ballmoved = "true"    bouncedown()      endif If (balltopborder = obstaclebottom) And (ballleftborder < obstacleleft) And (ballrightborder > obstacleleft) And (ballbottomborder > obstaclebottom) or (balltopborder < obstaclebottom) And (ballleftborder < obstacleleft) And (ballrightborder > obstacleleft) And (ballbottomborder > obstaclebottom) then      If (lastballdirecty = "up") And (lastballdirectx <> "right") then   ballbounceddown = "false"    ballmoved = "true"    bouncedown() endif      endif     EndFor   EndIf endsub Sub mousedown   linecount = linecount + 1   bx = Shapes.Getleft(ball) + 10   by = Shapes.Gettop(ball) + 10   mx = GraphicsWindow.MouseX   my = GraphicsWindow.MouseY   line[linecount] = Shapes.AddLine(bx, by, mx, my)   calculatelinelength() endsub Sub calculatelinelength   xdif1 = bx - mx   ydif1 = by - my   xdif = Math.abs(xdif1)   ydif = Math.abs(ydif1)   xpwr = Math.Power(xdif, 2)   ypwr = Math.Power(ydif, 2)   pwrdif = xpwr + ypwr   pwrdif = Math.round(pwrdif)   linelengthprelim = Math.SquareRoot(pwrdif)   linelength = Math.Round(linelengthprelim)   Controls.SetTextBoxText(textbox, "Power: " + linelength) EndSub Sub mouseup   If (linecount = 1) Or (linecount > 1) Then     removecount = removecount + 1     Shapes.remove(line[removecount])     Controls.SetTextBoxText(textbox, "Power: 0")   endif   ballx = GraphicsWindow.MouseX - 10   bally = GraphicsWindow.MouseY - 10   movecount = 0   ballmoved = "false"   shots = shots + 1   Controls.SetTextBoxText(textboxs, "Shots: " + shots) EndSub Sub buttonclicked Sound.PlayClick() shots = 0 Shapes.Move(ball, ballstartx, ballstarty) Controls.SetTextBoxText(textboxs, "Shots: " + shots) EndSub Sub moveball   While (movecount < 100) And (ballmoved = "false")     ballxinit = Shapes.GetLeft(ball)     ballyinit = Shapes.Gettop(ball)     movecount  = movecount + 1     Program.Delay(ballspeed)     xdif = Math.Abs(xdif)     newxdif = xdif / 100     If ballx > ballxinit then lastballdirectx = "right"       ballxdet = Shapes.GetLeft(ball) + newxdif     Else lastballdirectx = "left"       ballxdet = Shapes.GetLeft(ball) - newxdif     endif     ydif = Math.Abs(ydif)     newydif = ydif / 100     If bally > ballyinit then lastballdirecty = "down"       ballydet = Shapes.Gettop(ball) + newydif     Else lastballdirecty = "up"       ballydet = Shapes.Gettop(ball) - newydif     endif     Shapes.Move(ball, ballxdet, ballydet)     checkball()   endwhile   If movecount = 100 then     ballmoved  = "true"     movecount = 0   endif endsub Sub newround2   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 5   roundheight = 200   roundwidth = 400   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)      GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(400, 200)   Shapes.Move(round[roundnumber], 100, 110)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 420, 200)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 120 ballstarty = 200 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "red"   obstacle[1] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[1], 180, 120)   obstacle[2] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[2], 180, 200)   obstacle[3] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[3], 240, 160)   obstacle[4] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[4], 240, 240) obstacle[5] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[5], 300, 120)   obstacle[6] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[6], 300, 200) obstacle[7] = Shapes.AddRectangle(10, 35)   Shapes.Move(obstacle[7], 330, 260)   obstacleplaced = "true"   numberofobstacles = 7   obstacleheight = 35   obstaclewidth = 10 endsub Sub��newround3   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 3   roundheight = 400   roundwidth = 200   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)   GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(200, 400)   Shapes.Move(round[roundnumber], 200, 20)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25) Shapes.Move(hole, 290, 60)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 280 ballstarty = 390 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "orange"   obstacle[1] = Shapes.AddRectangle(40, 10)   Shapes.Move(obstacle[1], 220, 140)   obstacle[2] = Shapes.AddRectangle(40, 10)   Shapes.Move(obstacle[2], 280, 200)   obstacle[3] = Shapes.AddRectangle(40, 10)   Shapes.Move(obstacle[3], 320, 260)   obstacleplaced = "true"   numberofobstacles = 3   obstacleheight = 10   obstaclewidth = 40 endsub Sub newround4   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 4   roundheight = 400   roundwidth = 200   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)   GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(200, 400)   Shapes.Move(round[roundnumber], 200, 20)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 340, 60)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 290 ballstarty = 400 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "pink"   obstacle[1] = Shapes.AddRectangle(60, 10)   Shapes.Move(obstacle[1], 325, 100)   obstacle[2] = Shapes.AddRectangle(60, 10)   Shapes.Move(obstacle[2], 240, 200)   obstacle[3] = Shapes.AddRectangle(60, 10)   Shapes.Move(obstacle[3], 320, 260)   obstacleplaced = "true"   numberofobstacles = 3   obstacleheight = 10   obstaclewidth = 60 endsub Sub newround5   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 4   roundheight = 200   roundwidth = 400   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)   GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(400, 200)   Shapes.Move(round[roundnumber], 100, 110)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 465, 120)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 120 ballstarty = 200 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "blue"   obstacle[1] = Shapes.AddRectangle(60, 60)   Shapes.Move(obstacle[1], 180, 135)   obstacle[2] = Shapes.AddRectangle(60, 60)   Shapes.Move(obstacle[2], 270, 200)   obstacle[3] = Shapes.AddRectangle(60, 60)   Shapes.Move(obstacle[3], 380, 160)   obstacleplaced = "true"   numberofobstacles = 3   obstacleheight = 60   obstaclewidth = 60 endsub Sub newround6   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 5   roundheight = 200   roundwidth = 400   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)   GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(400, 200)   Shapes.Move(round[roundnumber], 100, 110)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 390, 180)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 120 ballstarty = 200 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "yellow"   obstacle[1] = Shapes.AddRectangle(10, 100)   Shapes.Move(obstacle[1], 175, 110)   obstacle[2] = Shapes.AddRectangle(10, 100)   Shapes.Move(obstacle[2], 250, 210)   obstacle[3] = Shapes.AddRectangle(10, 100)   Shapes.Move(obstacle[3], 380, 140)   obstacleplaced = "true"   numberofobstacles = 3   obstacleheight = 100   obstaclewidth = 10 endsub Sub newround7   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 3   roundheight = 400   roundwidth = 200   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)       GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(200, 400)   Shapes.Move(round[roundnumber], 200, 20)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 220, 40)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 290 ballstarty = 400 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "purple"   obstacle[1] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[1], 350, 130)   obstacle[2] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[2], 220, 210)   obstacle[3] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[3], 320, 260)   obstacle[4] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[4], 230, 80)   obstacle[5] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[5], 270, 320)   obstacle[6] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[6], 300, 60)   obstacle[7] = Shapes.AddRectangle(20, 20)   Shapes.Move(obstacle[7], 285, 155)   obstacleplaced = "true"   numberofobstacles = 7   obstacleheight = 20   obstaclewidth = 20 endsub Sub newround8   GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 4   roundheight = 200   roundwidth = 400   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)   GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(400, 200)   Shapes.Move(round[roundnumber], 100, 110)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 430, 220)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 120 ballstarty = 200 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "gray"   obstacle[1] = Shapes.AddRectangle(10, 40)   Shapes.Move(obstacle[1], 175, 110)   obstacle[2] = Shapes.AddRectangle(10, 40)   Shapes.Move(obstacle[2], 250, 210)   obstacle[3] = Shapes.AddRectangle(10, 40)   Shapes.Move(obstacle[3], 380, 140) obstacle[4] = Shapes.AddRectangle(10, 40) Shapes.Move(obstacle[4], 200, 180) obstacle[5] = Shapes.AddRectangle(10, 40) Shapes.Move(obstacle[5], 330, 240) obstacle[6] = Shapes.AddRectangle(10, 40)  Shapes.Move(obstacle[6], 420, 215)   obstacle[7] = Shapes.AddRectangle(10, 40)   Shapes.Move(obstacle[7], 175, 270) obstacle[8] = Shapes.AddRectangle(10, 40)   Shapes.Move(obstacle[8], 330, 160)   obstacleplaced = "true"   numberofobstacles = 8   obstacleheight = 40   obstaclewidth = 10 endsub Sub newround9  GraphicsWindow.BackgroundColor = "lightblue"   shots = 0   par = 6   roundheight = 400   roundwidth = 200   Controls.SetTextBoxText(textboxs, "Shots: " + shots)   Controls.SetTextBoxText(textboxp, "Par: " + par)   Controls.SetTextBoxText(textboxr, "Round: " + roundnumber)     GraphicsWindow.BrushColor = "green"   round[roundnumber] = Shapes.AddRectangle(200, 400)   Shapes.Move(round[roundnumber], 200, 20)   GraphicsWindow.BrushColor = "black"   hole = Shapes.AddEllipse(25,25)   Shapes.Move(hole, 210, 70)   GraphicsWindow.BrushColor = "white"   ball = Shapes.AddEllipse(20,20)   ballstartx = 280 ballstarty = 390 Shapes.Move(ball, ballstartx, ballstarty)   GraphicsWindow.BrushColor = "orange"   obstacle[1] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[1], 220, 250)   obstacle[2] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[2], 200, 310)   obstacle[3] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[3], 320, 310) obstacle[4] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[4], 320, 210) obstacle[5] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[5], 200, 100) obstacle[6] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[6], 280, 100) obstacle[7] = Shapes.AddRectangle(80, 10)   Shapes.Move(obstacle[7], 220, 170)   obstacleplaced = "true"   numberofobstacles = 7   obstacleheight = 10   obstaclewidth = 80 endsub Sub bounceleft bouncepower = linelength / 100   While (movecount2 < 10) And (ballbouncedleft = "false")     ballxinit2 = Shapes.GetLeft(ball) - bouncepower     ballyinit2 = Shapes.Gettop(ball)     movecount2  = movecount2 + 1     Program.Delay(10) Shapes.Move(ball, ballxinit2, ballyinit2) checkball() EndWhile   If movecount2 = 10 then     ballbouncedleft  = "true"     movecount2 = 0   endif endsub Sub bounceright bouncepower = linelength / 100   While (movecount5 < 10) And (ballbouncedright = "false")     ballxinit5 = Shapes.GetLeft(ball) + bouncepower     ballyinit5 = Shapes.Gettop(ball)     movecount5  = movecount5 + 1     Program.Delay(10) Shapes.Move(ball, ballxinit5, ballyinit5) checkball() EndWhile   If movecount5 = 10 then     ballbouncedright  = "true"     movecount5 = 0   endif endsub Sub bouncedown bouncepower = linelength / 100   While (movecount3 < 10) And (ballbounceddown = "false")     ballxinit3 = Shapes.GetLeft(ball)     ballyinit3 = Shapes.Gettop(ball) + bouncepower     movecount3  = movecount3 + 1     Program.Delay(10) Shapes.Move(ball, ballxinit3, ballyinit3) checkball() EndWhile   If movecount3 = 10 then     ballbounceddown  = "true"     movecount3 = 0   endif endsub Sub bounceup bouncepower = linelength / 100   While (movecount4 < 10) And (ballbouncedup = "false")     ballxinit4 = Shapes.GetLeft(ball)     ballyinit4= Shapes.Gettop(ball) - bouncepower     movecount4  = movecount4 + 1     Program.Delay(10) Shapes.Move(ball, ballxinit4, ballyinit4) checkball() EndWhile   If movecount4 = 10 then     ballbouncedup  = "true"     movecount4 = 0   endif endsub End>RMD848.sb< Start>RMJ088.sb< 'ProH! Scare 3.0 'by Jardel UAC 'Data Inicial: 24/11/09 'Hora 17:25 'ProH! Scare 3.0( SE II i); KerCmd 2.0; Inclusão entre Interface grafica 'com a Interface de caracteres. 'ProH! Root; Base de desenvolvimento do Programa pondendo ser utilizado em outras aplicações. 'O Ph! Root é responsavel pelas principais funções do programa. 'Versão do Ph! Root: 1.0.0 'Informações detalhadas do projeto em: 'Projeto ProH! Scare 3.0.doc '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 'Ph! Root - Adapitado //////////////////////// a = 0 Response = "" KerCmd2() Sub Var For b = 1 to 20 ' The following line could be harmful and has been automatically commented. ' data[b] = File.ReadLine(Program.Directory + "\Data.DLL",b) EndFor VROOT = data[1] BUILD = "0262.2.ph!root.2009Fev13-2135" config = Program.Directory + data[3] FundametalTexto = Program.Directory + data[4] LHELP[1] = Program.Directory + data[5] + "GW" LHELP[2] = Program.Directory + data[5] + "TX" VERSION = data[6] BUILDF = "0320" BUILDS = BUILDF + ".0.ph!SEIIi.2010Abr05-2228" STRING = VERSION + "." + BUILDS ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory + "\Data.DLL", 7, BUILDS) PackLing = Program.Directory + data[8] NameProgTitle = "ProH! Scare 3.0 Avanced Plus - " TitleText = Program.Directory + data[9] Careta[1] = Program.Directory + data[10] Careta[2] = Program.Directory + data[15] Interface = Program.Directory + data[16] Diretori2 = Program.Directory + data[17] For i = 1 to 4 ' The following line could be harmful and has been automatically commented. ' msg[i] = File.ReadLine(Diretori2, i) EndFor ' The following line could be harmful and has been automatically commented. ' speed = File.ReadLine(config, 2) buton = "false" WebBlog = "Acesse http://prohblog.wordpress.com" blogConp = Text.GetLength(WebBlog) DirError = Program.Directory + "\Errors.phf" c = 0 EndSub Sub KerCmd2 'Algoritmo nucleo. Ele cotrola todo o Programa If (a = 0) then Var() ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "GW" Or File.ReadLine(config, 1) = "GWTX" ) Then InterfaceGraf() EndIf InfoBasic() Play() ElseIf (Response = "Cmd" or Response = "cmd" or Response = "Control" Or Response = "Controle" Or Response = "Central") then CmdCentral() ElseIf (Response = "Exit" or Response = "exit" Or Response = "EXIT" Or Response = "Fechar" Or Response = "fechar" Or Response = "FECHAR" Or Response = "Sair" Or Response = "sair" Or Response = "SAIR") then ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(FundametalTexto, 4)) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(FundametalTexto, 5)) Program.End() ElseIf (Response = "Ajuda" or Response = "ajuda" or Response = "AJUDA" or Response = "Help" or Response = "help" or Response = "HELP") then Ajuda() Elseif (Response = "Restart" or Response = "Reiniciar" Or Response = "restart" Or Response = "reiniciar" or Response = "712893") Then ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then TextWindow.Clear() a = 0 KerCmd2() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then GraphicsWindow.Clear() a = 0 KerCmd2() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then TextWindow.Clear() GraphicsWindow.Clear() a = 0 KerCmd2() EndIf ElseIf (Response = "Iniciar" And a = 2 Or Response = "iniciar" And a = 2 Or Response = "INICIAR" And a = 2 ) then Datas() ServerUp() Format() EndJoke() ElseIf (Response = "Info" Or Response = "info" Or Response = "INFO") Then InfoProhS() ElseIf (Response = "Dados" And a = 1 Or Response = "dados" And a = 1 Or Response = "DADOS" And a = 1 Or Response = "Data" And a = 1 Or Response = "data" And a = 1 Or Response = "DATA" And a = 1 Or Response = "712814") Then Datas() CmdCentral() ElseIf (Response = "Servidor" And a = 1 Or Response = "servidor" And a = 1 Or Response = "SERVIDOR" And a = 1 Or Response = "Server" And a = 1 Or Response = "server" And a = 1 Or Response = "SERVER" And a = 1 Or Response = "712815") Then ServerUp() CmdCentral() ElseIf (Response = "Formatar" And a = 1 Or Response = "formatar" And a = 1 Or Response = "FORMATAR" And a = 1 Or Response = "Format" And a = 1 Or Response = "format" And a = 1 Or Response = "FORMAT" And a = 1 Or Response = "712816") Then Format() CmdCentral() ElseIf (Response = "Brinc" And a = 1 Or Response = "brinc" And a = 1 Or Response = "BRINC" And a = 1 Or Response = "Joke" And a = 1 Or Response = "joke" And a = 1 Or Response = "JOKE" And a = 1 Or Response = "712817") Then EndJoke() CmdCentral() ElseIf (Response = "MsgFinal" Or Response = "msgfinal" Or Response = "MSGFINAL") Then SentenceEnd() ElseIf (Response = "BarConfig" Or Response = "barconfig" Or Response = "BARCONFIG") Then BarConfig() XWhat() else error = "x0001" Erro() EndIf EndSub Sub InfoBasic 'Informações Basicas do Program ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then InfoBasicCarct() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then InfoBasicGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then InfoBasicGraf() InfoBasicCarct() EndIf EndSub Sub CmdCentral 'Central de Comandos a = 1 ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then CmdCentralCarct() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then CmdCentralGrafc() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then CmdCentralGrafc() CmdCentralCarct() EndIf EndSub Sub Erro 'Central de Erros NumLine=1 While i <> "//End Error Msg//" ' The following line could be harmful and has been automatically commented. ' i = File.ReadLine(DirError,NumLine) NumLine = NumLine + 1 EndWhile For FE = 1 to NumLine ' The following line could be harmful and has been automatically commented. ' terro["x000" + FE] = File.ReadLine(DirError,FE) EndFor ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText,12) TextWindow.WriteLine(terro[error]) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.ShowMessage(terro[error],NameProgTitle + File.ReadLine(TitleText,12)) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + NameProgTitle + File.ReadLine(TitleText,12) TextWindow.WriteLine(terro[error]) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.ShowMessage(terro[error],NameProgTitle + File.ReadLine(TitleText,12)) Else If (error = "") then error = "x00010" EndIf GraphicsWindow.Hide() ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.ShowMessage(terro[error],NameProgTitle + File.ReadLine(TitleText,12)) error = "x00011" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.ShowMessage(terro[error],NameProgTitle + File.ReadLine(TitleText,12)) Program.End() EndIf XWhat() EndSub Sub Ajuda 'Ajuda ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then AjudaCarct() XWhat() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then AjudaGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then AjudaCarct() AjudaGraf() EndIf EndSub Sub XWhat If (a = 1) Then CmdCentral() ElseIf (a = 2) then Play() ElseIf (a = 4) then Datas() ElseIf (a = 5) then ServerUp() ElseIf (a = 6) then Format() ElseIf (a = 7) then EndJoke() ElseIf (a = 8) then SentenceEnd() ElseIf (a = 9) then BarConfig() EndIf EndSub '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// '______________________________________________________________________________________________ ' 'Central de Comandos '______________________________________________________________________________________________ ' Sub CmdCentralGrafc x1 = 20 x2 = 300 y = 115 For ii = 0 to 10 ' The following line could be harmful and has been automatically commented. ' tii[ii] =File.ReadLine(PackLing, ii+90) cii[ii] =Text.GetLength(tii[ii]) CPi[ii] =cii[ii]*7 Endfor ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 3) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y, File.ReadLine(TitleText, 3)) GraphicsWindow.DrawText(x1, y + 30, tii[0]) GraphicsWindow.DrawText(x2, y + 30, tii[1]) GraphicsWindow.DrawText(x1, y + 50, tii[2]) GraphicsWindow.DrawText(x2, y + 50, tii[3]) GraphicsWindow.DrawText(x1, y + 70, tii[4]) GraphicsWindow.DrawText(x2, y + 70, tii[5]) GraphicsWindow.DrawText(x1, y + 90, tii[6]) GraphicsWindow.DrawText(x2, y + 90, tii[7]) GraphicsWindow.DrawText(x1, y + 110,tii[8]) GraphicsWindow.DrawText(x2, y + 110,tii[9]) GraphicsWindow.MouseDown = OnMouseDown EndSub Sub CmdCentralCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 3) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(TitleText, 3)) TextWindow.WriteLine("-----------------------------------------------") TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.Write(File.ReadLine(FundametalTexto,2)) Response = TextWindow.Read() KerCmd2() EndSub Sub AjudaGraf ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 9) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" GraphicsWindow.FontBold = "true" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 115, File.ReadLine( TitleText, 9)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 145, File.ReadContents(LHELP[1])) EndSub Sub AjudaCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 9) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(TitleText, 9)) TextWindow.WriteLine("-----------------------------------------------") TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadContents(LHELP[2])) EndSub '_____________________________________________________________________________________________________ 'Players de Inicialisão '_____________________________________________________________________________________________________ Sub PlayGraf GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.DrawImage(Interface + "start.png",10,10) GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove EndSub Sub PlayCarct TextWindow.ForegroundColor = "Yellow" ' The following line could be harmful and has been automatically commented. ' TextWindow.Write(File.ReadLine(PackLing, 5)) Response = TextWindow.Read() KerCmd2() EndSub '_____________________________________________________________________________________________________ 'Informações sobre o Programa '_____________________________________________________________________________________________________ Sub InfoProhSGraf x1=20 x2=300 y=240 z=0 ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 2) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" GraphicsWindow.DrawImage(Interface + "logo ph!scare3.png",0,100) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y-30, File.ReadLine(TitleText, 2)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y, File.ReadLine(PackLing,110)) GraphicsWindow.DrawText(x2, y, VERSION) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+20, File.ReadLine(PackLing,111)) GraphicsWindow.DrawText(x2, y+20 BUILDS) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+40, File.ReadLine(PackLing,112)) GraphicsWindow.DrawText(x2, y+40, STRING) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+60, File.ReadLine(PackLing,113)) GraphicsWindow.DrawText(x2, y+60, "ProH! Root 1.0.0" ) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+80, File.ReadLine(PackLing,114)) GraphicsWindow.DrawText(x2, y+80, VROOT) GraphicsWindow.DrawImage(Interface + "outer.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(465, 360, File.ReadLine(PackLing,120)) EndSub Sub InfoProhSGrafN x1=20 x2=300 y=240 z=1 GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" GraphicsWindow.DrawImage(Interface + "logo ph!scare3.png",0,100) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y-30, File.ReadLine(TitleText, 2)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y, File.ReadLine(PackLing,115)) GraphicsWindow.DrawText(x2, y, BUILD) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+20, File.ReadLine(PackLing,116)) GraphicsWindow.DrawText(x2, y+20, "Small Basic 0.8 ") ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+40, File.ReadLine(PackLing,117)) GraphicsWindow.DrawText(x2, y+40, "6 de 6 ") ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+60, File.ReadLine(PackLing,118)) GraphicsWindow.DrawText(x2, y+60, "29 de Novembro de 2009 ") ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(x1, y+80, File.ReadLine(PackLing,119)) GraphicsWindow.DrawText(x2, y+80, "X") GraphicsWindow.DrawImage(Interface + "outer.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(470, 360, File.ReadLine(PackLing,121)) EndSub Sub InfoProhSCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 2) TextWindow.ForegroundColor = "white" TextWindow.WriteLine(" SSSSSS") TextWindow.WriteLine(" SSSSSSSSSS") TextWindow.WriteLine(" SSSS SSSS cccccccc aaaaaa rrrr rrrr eeeeee ") TextWindow.WriteLine(" SSSS cccccccccc aaaaa aaaa rrrrrrrrrrrrrr eeeeeeeeee ") TextWindow.WriteLine(" SSSSSSSS cccc aaa aaaa rrrrrr rrrr eeee eeee ") TextWindow.WriteLine(" SSSSSSSS cccc aaaaaaaaa rrrr eeeeeeeeeeeeeee") TextWindow.WriteLine(" SSSS cccc aaaa aaaa rrrr eeeeeeeeeeeeeee ") TextWindow.WriteLine(" SSSS SSSS cccc aaaa aaaa rrrr eeee ") TextWindow.WriteLine(" SSSSSSSSSS cccccccccc aaaaaaaaaaaaa rrrr eeeeeeeeeeee") TextWindow.WriteLine(" SSSSSS cccccccc aaaaaaaaa aa rrrr eeeeeeeee ") TextWindow.WriteLine("") TextWindow.WriteLine(" P r o H ! S c a r e 3 . 0") TextWindow.WriteLine("") TextWindow.ForegroundColor = "gray" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(TitleText, 2)) TextWindow.WriteLine("-----------------------------------------------") TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,110) + " " + VERSION) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,111) + " " + BUILDS) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,112) + " " + STRING) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,113) + " ProH! Root " + VROOT) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,114) + " " + VROOT) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,115) + " " + BUILD) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,116) + " Small Basic 0.8") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,117) + " 6 de 6") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,118) + " 29 de Novembro de 2009") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing,119) + " 05 de Abril de 2010") XWhat() EndSub '_____________________________________________________________________________________________________ 'Informações Basicas sobre o Programa '_____________________________________________________________________________________________________ Sub InfoBasicGraf ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 1) GraphicsWindow.DrawText(100, 15, "by Baby - PMPJ") GraphicsWindow.DrawText(275, 15, "Todos os Direitos Reservados") GraphicsWindow.DrawText(100, 30, file.ReadLine(PackLing,2) + VERSION) GraphicsWindow.DrawText(275, 30, "Build:" + BUILDF) GraphicsWindow.DrawText(200-(175/2),385, WebBlog) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(485,385, File.ReadLine(PackLing,7)) EndSub Sub InfoBasicCarct TextWindow.Show() ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 1) TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(WebBlog) TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("------------------------------------------------------------------------------") TextWindow.WriteLine("by Baby - PMPJ Todos os Direitos Reservados") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 2) + VERSION + " Build: " + BUILDF) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(FundametalTexto, 6)) TextWindow.WriteLine("------------------------------------------------------------------------------") TextWindow.WriteLine("") EndSub '_____________________________________________________________________________________________________ 'Coleta de Dados Falsa do Programa '_____________________________________________________________________________________________________ Sub DataGraf ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 4) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawBoundText(20,200, 550, File.ReadLine(PackLing, 11)) EndSub Sub DataCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 4) TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 11)) EndSub '_____________________________________________________________________________________________________ 'Nova Barra de Processo '_____________________________________________________________________________________________________ Sub NewBarProcess ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then For i = 1 to 100 Step 2 Program.Delay(speed) TextWindow.ForegroundColor = "white" TextWindow.Write("|") EndFor TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then For i = 1 To 500 step 5 Program.Delay(speed) GraphicsWindow.DrawRectangle(20,220,495,20) GraphicsWindow.FillRectangle(20, 220, i, 20) EndFor ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then For i = 1 to 100 step 2 Program.Delay(speed) TextWindow.ForegroundColor = "white" TextWindow.Write("|") GraphicsWindow.DrawRectangle(20,220,495,20) GraphicsWindow.FillRectangle(20, 220, i * 5, 20) EndFor TextWindow.WriteLine("") EndIf EndSub '_____________________________________________________________________________________________________ 'Conecção Falsa com Servidor '_____________________________________________________________________________________________________ Sub ServerUpGraf ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 5) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawBoundText(20,200, 550, File.ReadLine(PackLing, 20)) EndSub Sub ServerUpCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 5) TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 20)) EndSub '_____________________________________________________________________________________________________ 'Formatação Falsa '_____________________________________________________________________________________________________ Sub FormatGraf ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText, 6) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" GraphicsWindow.DrawText(20, 100, msg[1]) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20,200, File.ReadLine(PackLing, 30)) EndSub Sub FormatCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 6) TextWindow.ForegroundColor = "Red" TextWindow.WriteLine(msg[1]) TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 30)) EndSub '_____________________________________________________________________________________________________ 'Final da Brincadeira '_____________________________________________________________________________________________________ Sub EndJokeGraf Program.Delay(1500) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.title = NameProgTitle + File.ReadLine(TitleText, 7) GraphicsWindow.DrawImage(Careta[2], 60, 140) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.ShowMessage(File.ReadLine(PackLing, 40), NameProgTitle + File.ReadLine(TitleText, 6)) EndSub Sub EndJokeCarct Program.Delay(1500) ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 7) TextWindow.ForegroundColor = "Yellow" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 40)) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadContents(Careta[1])) EndSub '_____________________________________________________________________________________________________ 'Editor de menssagens de aviso finais - Avanced '_____________________________________________________________________________________________________ Sub SentenceEndGraf GraphicsWindow.ShowMessage("Em Desenvlvimento!", "MsgFinal") EndSub Sub SentenceEndCarct ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 8) TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(TitleText, 8)) TextWindow.WriteLine("-----------------------------------------------") TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 50)) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 51) + " 1- " + msg[1]) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 51) + " 2- " + msg[2]) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 51) + " 3- " + msg[3]) TextWindow.WriteLine("nº 4- " + msg[4]) TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 52)) Response = TextWindow.Read() If (Response = 1 Or Response = 2 Or Response = 3) Then ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 53)) If ( Response = 1) Then msg = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' ReportErro = File.WriteLine(Diretori2, 1, msg) ElseIf (Response = 2) Then msg = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' ReportErro = File.WriteLine(Diretori2, 2, msg) ElseIf (Response = 3) Then msg = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' ReportErro = File.WriteLine(Diretori2, 3, msg) EndIf ElseIf (Response = 4) then For j = 5 to 7 ' The following line could be harmful and has been automatically commented. ' msg[j] = File.ReadLine(Diretori2, j) EndFor For k = 1 to 3 ' The following line could be harmful and has been automatically commented. ' ReportErro = File.WriteLine(Diretori2, k , msg[k + 4]) endFor If (ReportErro = "SUCCESS") Then TextWindow.WriteLine("Salvo Com Sucesso") XWhat() Else error = "x00012" Erro() EndIf ' The following line could be harmful and has been automatically commented. ' ElseIf( Response = "close" And File.ReadLine(config, 1) = "GW" Or Response = "Close" And File.ReadLine(config, 1) = "GW" Or Response = "CLOSE" And File.ReadLine(config, 1) = "GW") then TextWindow.Hide() CmdCentral() Else KerCmd2() EndIf EndSub '_____________________________________________________________________________________________________ 'Configurações da Barra de Processo - Avanced '_____________________________________________________________________________________________________ Sub BarConfigGraf SPd = speed / 100 ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.Title = NameProgTitle + File.ReadLine(TitleText,10) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,90) GraphicsWindow.BrushColor = "Back" ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 115, File.ReadLine(TitleText,10)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 145, File.ReadLine(PackLing, 74)) ss = 0 For r= 1 To 10 If (r = SPd) Then GraphicsWindow.BrushColor = "Blue" Else GraphicsWindow.BrushColor = "Back" EndIf ss = ss + 40 GraphicsWindow.DrawText(ss , 165, r) EndFor GraphicsWindow.DrawImage(Interface + "outer.png",400,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(420, 240, File.ReadLine(PackLing, 75)) GraphicsWindow.DrawImage(Interface + "outer.png",310,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(330, 240, File.ReadLine(PackLing, 76)) EndSub Sub BarConfigCartc SPd = speed / 100 ' The following line could be harmful and has been automatically commented. ' TextWindow.Title = NameProgTitle + File.ReadLine(TitleText, 10) TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 70)) TextWindow.WriteLine("--------------------------------------------") TextWindow.WriteLine("") ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 71) + " " + SPd) ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 72)) Response = TextWindow.Read() If (Response > 0 And Response < 11) Then speed = Response speed = speed * 100 ' The following line could be harmful and has been automatically commented. ' ReportErro = File.WriteLine(config, 2, speed) If (ReportErro = "SUCCESS") Then TextWindow.WriteLine("Salvo Com Sucesso") XWhat() Else error = "x00012" Erro() EndIf ElseIf (Response = "test" or Response = "TEST" or Response = "Test") then For i = 1 to 100 Step 2 Program.Delay(speed) TextWindow.ForegroundColor = "white" TextWindow.Write("|") EndFor TextWindow.WriteLine("") XWhat() Else KerCmd2() EndIf EndSub '_____________________________________________________________________________________________________ 'Update '_____________________________________________________________________________________________________ 'XXX '_____________________________________________________________________________________________________ 'Controlador de Eventos 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 'Interface Sub InterfaceGraf GraphicsWindow.Show() GraphicsWindow.Width = "550" GraphicsWindow.Height = "400" GraphicsWindow.CanResize = "False" GraphicsWindow.DrawImage(Interface + "fundo.png", 0, 0) GraphicsWindow.DrawImage(Interface + "Cabecalho.png", 0, 0) GraphicsWindow.BrushColor = "SteelBlue" EndSub 'Mouse Sub OnMouseDown mouX = GraphicsWindow.MouseX mouY = GraphicsWindow.MouseY If (mouX >=10 And mouX <= 55 And mouY >= 10 And mouY <=60 And a = 2) Then buton = "true" GraphicsWindow.DrawImage(Interface + "start2.png",10,10) Response = "Iniciar" KerCmd2() ElseIf (mouX >=485 And mouX <= 535 + blogConp And mouY >= 385 And mouY <=395 Or mouX >=300 And mouX <= 300+CPi[9] And mouY >= 225 And mouY <=235 And a = 1) Then Response = "Ajuda" KerCmd2() ElseIf(mouX >=20 And mouX <= 20+CPi[0] And mouY >= 145 And mouY <=155 And a = 1 ) Then Response = "Exit" KerCmd2() ElseIf(mouX >=300 And mouX <= 300+CPi[1] And mouY >= 145 And mouY <=155 And a = 1 ) Then Response = "Restart" KerCmd2() ElseIf(mouX >=20 And mouX <= 20+CPi[2] And mouY >= 165 And mouY <=175 And a = 1 ) Then Response = "Info" KerCmd2() ElseIf(mouX >=300 And mouX <= 300+CPi[3] And mouY >= 165 And mouY <=175 And a = 1 ) Then Response = "Data" KerCmd2() ElseIf(mouX >=20 And mouX <= 20+CPi[4] And mouY >= 185 And mouY <=195 And a = 1 ) Then Response = "Server" KerCmd2() ElseIf(mouX >=300 And mouX <= 300+CPi[5]And mouY >= 185 And mouY <=195 And a = 1 ) Then Response = "Format" KerCmd2() ElseIf(mouX >=20 And mouX <= 20+CPi[6] And mouY >= 205 And mouY <=215 And a = 1 ) Then Response = "Joke" KerCmd2() ElseIf(mouX >=300 And mouX <= 300+CPi[7] And mouY >= 205 And mouY <=215 And a = 1 ) Then Response = "MsgFinal" KerCmd2() ElseIf(mouX >=20 And mouX <= 20+CPi[8] And mouY >= 225 And mouY <=235 And a = 1 ) Then Response = "BarConfig" KerCmd2() ElseIf(mouY >= 165 And mouY<=175 And a = 9) then '- Avanced If(mouX >=40 And mouX <= 45 ) Then SPd = 1 ElseIf(mouX >=80 And mouX <= 85) Then SPd = 2 ElseIf(mouX >=120 And mouX <= 125 ) Then SPd = 3 ElseIf(mouX >=160 And mouX <= 165 ) Then SPd = 4 ElseIf(mouX >=200 And mouX <= 205 ) Then SPd = 5 ElseIf(mouX >=240 And mouX <= 245 ) Then SPd = 5 ElseIf(mouX >=280 And mouX <= 285 ) Then SPd = 6 ElseIf(mouX >=320 And mouX <= 325 ) Then SPd = 7 ElseIf(mouX >=360 And mouX <= 365 ) Then SPd = 8 ElseIf(mouX >=400 And mouX <= 405 ) Then SPd = 9 ElseIf(mouX >=440 And mouX <= 445 ) Then SPd = 10 EndIf ElseIf(mouX >=400 And mouX <= 480 And mouY >= 230 And mouY <=260 And a = 9 ) Then GraphicsWindow.DrawImage(Interface + "outer2.png",400 ,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(420, 235, File.ReadLine(PackLing, 75)) speed = SPd * 100 ' The following line could be harmful and has been automatically commented. ' re= File.WriteLine(config, 2, speed) If (re = "SUCCESS") Then GraphicsWindow.ShowMessage("Salvo Com Sucesso","Salvo") XWhat() Else error = "x00012" Erro() EndIf ElseIf(mouX >=310 And mouX <= 390 And mouY >= 230 And mouY <=260 And a = 9 ) Then GraphicsWindow.DrawImage(Interface + "outer2.png",310 ,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(330, 240, File.ReadLine(PackLing, 76)) GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle(19,265,500,60) GraphicsWindow.BrushColor = "black" spdtest = SPd*100 For i = 1 To 500 step 5 Program.Delay(spdtest) GraphicsWindow.DrawRectangle(20,280,495,20) GraphicsWindow.FillRectangle(20, 280, i, 20) EndFor ElseIf(mouX >=450 And mouX <= 530 And mouY >= 350 And mouY <=380 And c = 1 and z = 0 ) Then GraphicsWindow.DrawImage(Interface + "outer2.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(470, 360, File.ReadLine(PackLing,120)) InfoProhSGrafN() ElseIf(mouX >=450 And mouX <= 530 And mouY >= 350 And mouY <=380 And c = 1 and z = 1 ) Then GraphicsWindow.DrawImage(Interface + "outer2.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(470, 360, File.ReadLine(PackLing,121)) InfoProhSGraf() EndIf EndSub Sub OnMouseMove mouX = GraphicsWindow.MouseX mouY = GraphicsWindow.MouseY If (mouX >=10 And mouX <= 55 And mouY >= 10 And mouY <=60 And buton ="false") Then GraphicsWindow.DrawImage(Interface + "start1.png",10,10) ElseIf ( buton = "false") Then GraphicsWindow.DrawImage(Interface + "start.png",10,10) ElseIf(mouX >=400 And mouX <= 480 And mouY >= 230 And mouY <=260 And a = 9 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",400,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(420, 240, File.ReadLine(PackLing, 75)) ElseIf(mouX >=310 And mouX <= 390 And mouY >= 230 And mouY <=260 And a = 9 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",310,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(330, 240, File.ReadLine(PackLing, 76)) ElseIF(a = 9) Then GraphicsWindow.DrawImage(Interface + "outer.png",400,230) GraphicsWindow.DrawImage(Interface + "outer.png",310,230) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(420, 240, File.ReadLine(PackLing, 75)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(330, 240, File.ReadLine(PackLing, 76)) ElseIf(mouX >=300 And mouX <= 380 And mouY >= 360 And mouY <=380 And b = 1 and z = 0 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",300,360) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(310, 370, File.ReadLine(PackLing,120)) ElseIf(mouX >=300 And mouX <= 380 And mouY >= 360 And mouY <=380 And b = 1 and z = 1 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",300,360) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(310, 370, File.ReadLine(PackLing,121)) ElseIf (c = 1 and z = 0 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(465, 360, File.ReadLine(PackLing,120)) ElseIf (c = 1 and z = 1 ) Then GraphicsWindow.DrawImage(Interface + "outer1.png",450,350) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(470, 360, File.ReadLine(PackLing,121)) EndIf EndSub 'Atalhos do Teclado Sub OnKeyDown donwKey = GraphicsWindow.LastKey If (donwKey = "F1") Then Ajuda() KerCmd2() ElseIf (donwKey = "F2" ) Then Response = "info" KerCmd2() ElseIf (donwKey = "F4" ) Then Response = "exit" KerCmd2() ElseIf (donwKey ="F12" ) Then Response = "cmd" KerCmd2() EndIf EndSub 'fechar programa ou continuar Sub CloseCont TextWindow.Write("") Response = TextWindow.Read() If (Response = "" ) Then Response = "Exit" KerCmd2() Else Response = "Restart" KerCmd2() EndIf EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 'Configurações de Exibiç��o '------------------------------------------------------------------------------------------------------------ Sub Play a = 2 error = "x0002" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then PlayCarct() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then PlayGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then PlayGraf() PlayCarct() Else Erro() EndIf EndSub Sub InfoProhS c=1 error = "x0003" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then InfoProhSCarct() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then InfoProhSGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then InfoProhSGraf() InfoProhSCarct() Else Erro() EndIf EndSub Sub Datas a = 4 error = "x0004" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then DataCarct() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 12)) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then DataGraf() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 12)) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then DataGraf() DataCarct() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 12)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 12)) Else Erro() EndIf EndSub Sub ServerUp a =5 error = "x0005" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then ServerUpCarct() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 21)) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then ServerUpGraf() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 21)) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then ServerUpGraf() ServerUpCarct() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 21)) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 21)) Else Erro() EndIf EndSub Sub Format a =6 error = "x0006" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then FormatCarct() NewBarProcess() TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 31)) TextWindow.WriteLine(msg[2]) TextWindow.WriteLine(msg[3]) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then FormatGraf() NewBarProcess() ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 31)) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,100) GraphicsWindow.BrushColor = "Back" GraphicsWindow.DrawText(20, 100, msg[2]) GraphicsWindow.DrawText(20, 115, msg[3]) ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then FormatGraf() FormatCarct() NewBarProcess() TextWindow.ForegroundColor = "green" ' The following line could be harmful and has been automatically commented. ' TextWindow.WriteLine(File.ReadLine(PackLing, 31)) TextWindow.WriteLine(msg[2]) TextWindow.WriteLine(msg[3]) ' The following line could be harmful and has been automatically commented. ' GraphicsWindow.DrawText(20, 250, File.ReadLine(PackLing, 31)) GraphicsWindow.DrawImage(Interface + "fundo2.png",0,100) GraphicsWindow.BrushColor = "Back" GraphicsWindow.DrawText(20, 100, msg[2]) GraphicsWindow.DrawText(20, 115, msg[3]) Else Erro() EndIf EndSub Sub EndJoke a =7 error = "x0007" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then EndJokeCarct() CloseCont() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then EndJokeGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then EndJokeCarct() EndJokeGraf() Else Erro() EndIf buton = "false" EndSub Sub SentenceEnd a = 8 error = "x0008" For i = 1 to 4 ' The following line could be harmful and has been automatically commented. ' msg[i] = File.ReadLine(Diretori2, i) EndFor ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX" Or File.ReadLine(config, 1) = "GW" Or File.ReadLine(config, 1) = "GWTX") Then SentenceEndCarct() ' The following line could be harmful and has been automatically commented. ' 'ElseIf (File.ReadLine(config, 1) = "GW") Then ' SentenceEndGraf() ' The following line could be harmful and has been automatically commented. ' 'ElseIf (File.ReadLine(config, 1) = "GWTX") Then ' SentenceEndCarct() 'SentenceEndGraf() Else Erro() EndIf XWhat() EndSub Sub BarConfig a = 9 error = "x0009" ' The following line could be harmful and has been automatically commented. ' If (File.ReadLine(config, 1) = "TX") Then BarConfigCartc() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GW") Then BarConfigGraf() ' The following line could be harmful and has been automatically commented. ' ElseIf (File.ReadLine(config, 1) = "GWTX") Then BarConfigGraf() BarConfigCartc() Else Erro() EndIf EndSub '---------------------------------------------------------------------------------------------------------------------------- End>RMJ088.sb< Start>RMJ514.sb< GraphicsWindow.Clear() GraphicsWindow.Title="Macron 64-bit" Controls.ButtonClicked=buttonclick GraphicsWindow.CanResize="False" GraphicsWindow.BackgroundColor="LightGreen" GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=15 GraphicsWindow.Clear() GraphicsWindow.DrawText(5,1,"Welcome! Please type in a username!") loginbox=Controls.AddMultiLineTextBox(5,20) login=Controls.AddButton("Login",5,100) Sub buttonclick If Controls.LastClickedButton=login Then doLogin() endif If Controls.LastClickedButton=continue1 Then doDesktop() endif If Controls.LastClickedButton=exit Then GraphicsWindow.Clear() Program.End() endif If Controls.LastClickedButton=wordmachine Then doWordMachine() endif If Controls.LastClickedButton=savedoc Then recallsave=Controls.GetTextBoxText(wordbox) endif If Controls.LastClickedButton=loaddoc Then Controls.SetTextBoxText(wordbox,recallsave) endif If Controls.LastClickedButton=exitdoc Then doDesktop() endif endsub Sub doDesktop GraphicsWindow.Clear() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=30 GraphicsWindow.DrawText(5,2,name+"'s Desktop") GraphicsWindow.FontSize=15 wordmachine=Controls.AddButton("Macron Word 2013",5,40) calculator=Controls.AddButton("Macron Calculator 2013",5,80) game=Controls.AddButton("Macron Game 2013",5,120) dictionary=Controls.AddButton("Macron Dictionary 2013",5,160) exit=Controls.AddButton("Exit",5,200) EndSub Sub doWordMachine GraphicsWindow.Clear() GraphicsWindow.FontSize=30 GraphicsWindow.DrawText(5,1,"Macron Word 2013") wordbox=Controls.AddMultiLineTextBox(5,45) GraphicsWindow.FontSize=15 Controls.SetSize(wordbox,500,380) savedoc=Controls.AddButton("Save",520,45) loaddoc=Controls.AddButton("Load",520,85) exitdoc=Controls.AddButton("Exit",520,125) EndSub Sub doLogin name=Controls.GetTextBoxText(loginbox) GraphicsWindow.Clear() GraphicsWindow.DrawText(10,10,"Welcome to Macron 64,"+" "+name+"!") continue1=Controls.AddButton("Continue",5,30) EndSub End>RMJ514.sb< Start>RMJ565.sb< GraphicsWindow.Title = "TEST" GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 ON = Controls.AddButton("ON",1,1) OFF = Controls.AddButton("OFF",1,27) Controls.ButtonClicked = buttonclicked Ende = 0 While Ende = 0 If BC = 1 Then BC = 0 lastbutton = Controls.LastClickedButton If lastbutton = OFF Then     Ende = 1 ElseIf lastbutton = On Then GraphicsWindow.ShowMessage("You pressed ON!", "Answer")   EndIf EndIf EndWhile Program.End() Sub buttonclicked BC = 1  EndSub End>RMJ565.sb< Start>RMK449.sb< ''' The Pirate Interpreter by joeydoa 11/2003 '' Written over a period of 2-3 months (120-200 hours) '' If you like this port I really need some cash! '' I''m a former P/A, getting my second degree to be a '' public school teacher and have been unemployed for two years. '' So, a mealsey $3 to show your appreciation would help me out! '' Simply dash a check to: '' Joseph Whitton '' 1360 Azalea Road '' Mobile, AL 36693 '' and THANK YOU! '' Now the History: '' Derived from the BASIC listing by Scott Adams published in Byte '' As well as the dissasembly of the TRS-80 Adams Interpreter. '' Pirate''s Adventure #2 is built-in! If you want to play the other '' Scott Adams adventures you need to download this file: '' -> ftp://ftp.ifarchive.org/if-archive/scott-adams/AdamsGames.zip '' unzip it and send it to the ram of your ebookman, palm or PDA '' Also, you can play Brian Howarth''s adventures, same process -> '' download this file from: '' -> ftp://ftp.ifarchive.org/if-archive/scott-adams/mysterious.tar.gz '' unzip and send it to the RAM of your device. '' *SAVE & LOAD are fully supported. This is version 1.0 '' *SINCE SCROLL AND WINDOWING IS NOT SUPPORTED SIMPLY HIT ENTER '' TO REDISLAY THE SCREEN! '' *The wraparound is set at 39 characters (for the ebookman but can '' be easily changed in the MSGROUTINE.) '' Have FUN and enjoy/RELIVE the golden days of 8 bit adventuring! '' *BTW THE QUEST1.DAT & QUEST2.DAT (QUESTPROBE SCOTT ADAMS) & '' ADV13.DAT HAVE BEEN FORMATTED INCORRECTLY AND WILL NOT RUN! '' ***I WILL REFORMAT THESE AND REUP THEM TO IF-ARCHIVE - I''LL POST '' A NOTE WHEN THEY ARE AVAILABLE! THX. '' Any comments/bugs report to joeydoa@yahoo.com (thank you) '' HEADER '' 0 UNKNOWN '' 1 NUMBER OF ITEMS '' 2 NUMBER OF ACTIONS '' 3 NUMBER OF NOUNS AND VERBS (ONE LIST IS PADDED) '' 4 NUMBER OF ROOMS '' 5 MAXIMUM A PLAYER CAN CARRY '' 6 STARTING ROOM '' 7 TOTAL TREASURES (*) '' 8 WORD LENGTH (ONLY SEEN 3,4 OR 5) '' 9 TIME LIGHT SOURCE LASTS. THIS COUNTS DOWN EVERY TIME ITEM 9 IS '' IN GAME. BRIAN HOWARTHS GAMES ALLOW -1 FOR NEVER RUN DOWN. WHEN '' IT RUNS OUT THE LIGHT ITEM (9) IS DUMPED IN ROOM 0 AND A LOOK '' DONE. MESSAGES VARY BETWEEN INTERPRETERS AND INCLUDE THINGS '' LIKE ''YOUR LIGHT IS FLICKERING AND DYING'' AS WELL AS '' ''LIGHT RUNS OUT IN %D TURNS''. '' 10 NUMBER OF MESSAGES '' 11 ROOM YOU MUST PUT TREASURE IN TO SCORE POINTS. NOT ALL GAMES USE '' THE TREASURE SYSTEM FOR SCORING '' ???? 12 UNKNOWN '' ITEM IN INVENTORY Const CARRIED=255 Const DARKBIT=15 Const LIGHTOUTBIT=16 '' CARRYING NOTHING WEIGHT=0 Dim SIT(500),COND(500,5),ACT(500,2),NNVERB(200,1) Dim MAP(100,6),DESC(200),MESS(200),ITEM(200),ITEMLOC(200) Dim ITEMSYM(200), ACTCODE(4) Dim PARAM(10),BITFLAG(100),ACTCODE(4),NT$(2),NV(2) Dim FULLNOUN(1),RFLAG(2) Const LIGHTREFILL=XLIGHT '' DON''T KNOW HOW USED YET Dim ROOMSAVE(100),COUNTERS(100) CCOUNTER = 90 Cls Print " ";CAT(1);"THE PIRATE INTERPRETER";CAT(0) Print Print " DERIVED FROM" Print " THE SCOTT ADAMS INTERPRETER" ?:? " ";CAT(3);"PORTED BY JOEYDOA";CAT(0) ? " NOVEMBER 2003" ?:? ?"DO YOU WISH TO PLAY THE BUILT-IN" Input " PIRATE''S ADVENTURE";IP IF LEFT(UCASE$(IP),1)="Y" Then ADVNAME="adv02.dat" GAMENAME="adv02.sav" Input "DO YOU WISH TO LOAD A SAVED GAME";DYP GoSub GAMEINIT If LOWER(DYP)="y" Then If !EXIST(GAMENAME) Then GoTo GAMELOADED ENDIF LOADGAME Else GoTo GAMELOADED ENDIF ENDIF LABEL RETRYADV: ? "WHICH SCOTT ADAMS ADVENTURE?":? ? Files("adv*.dat") ? Files("quest*.dat") ? Files("sampl*.dat") ?:? "OR BRIAN HOWARTH ADVENTURE?":? ? Files("?_*.dat") ?:INPUT "WHICH ADVENTURE";IP FHAND=FREEFILE ADVNAME=IP If !EXIST(ADVNAME) Then GoTo RETRYADV Open ADVNAME FOR INPUT AS #FHAND ''HEADER INPUT #FHAND;UNK INPUT #FHAND;XITEM INPUT #FHAND;XACT INPUT #FHAND;XNV INPUT #FHAND;XROOM INPUT #FHAND;XCARRY INPUT #FHAND;SROOM INPUT #FHAND;XTRES INPUT #FHAND;WORDLEN INPUT #FHAND;XLIGHT LANTERN=XLIGHT INPUT #FHAND;XMESS INPUT #FHAND;XTRESRM ''ACTIONS FOR I=0 TO XACT INPUT #FHAND;SIT(I) FOR II=0 TO 4 INPUT #FHAND;COND(I,II) NEXT II INPUT #FHAND;ACT(I,0) Input #FHAND;ACT(I,1) NEXT I ''NOUNS AND VERBS FOR X =0 TO XNV FOR Y=0 TO 1 INPUT #FHAND;NNVERB(X,Y) TEMPLEN=Len(NNVERB(X,Y)) TEMP=NNVERB(X,Y) NNVERB(X,Y)=Mid(TEMP,2,TEMPLEN-2) NEXT Y NEXT X '' ROOM DESCRIPTIONS AND EXITS FOR I=0 TO XROOM FOR II=0 TO 5 INPUT #FHAND;MAP(I,II) NEXT II INPUT #FHAND;DESC(I) TEMPLEN=Len(DESC(I)) TEMP=DESC(I) DESC(I)=Mid(TEMP,2,TEMPLEN-2) XT=Chr(13) TEMP=TRANSLATE(DESC(I),XT," ") DESC(I)=TEMP NEXT I ''MESSAGES FOR I=0 TO XMESS INPUT #FHAND;MESS(I) TEMPLEN=Len(MESS(I)) TEMP=MESS(I) MESS(I)=Mid(TEMP,2,TEMPLEN-2) XT=Chr(13) TEMP=TRANSLATE(MESS(I),XT," ") MESS(I)=TEMP NEXT X ''ITEMS & LOCATIONS For I=0 TO XITEM Input #FHAND;ITEM(I)," ",ITEMLOC(I) TEMPLEN=Len(Item(I)) TEMP=Item(I) Item(I)=Mid(TEMP,2,TEMPLEN-2) XT=Chr(13) TEMP=TRANSLATE(Item(I),XT," ") Item(I)=TEMP NEXT I CLOSE #FHAND Input "DO YOU WISH TO LOAD A SAVED GAME";DYW If LOWER(Left(DYW,1))="y" Then TEMP=Len(ADVNAME) GAMENAME=Mid(ADVNAME,1,TEMP-4) GAMENAME=GAMENAME+".sav" If !EXIST(GAMENAME) Then MYLOC=SROOM GoTo GAMELOADED ENDIF LOADGAME Else ''STARTING LOCATION MYLOC=SROOM GoTo GAMELOADED ENDIF LABEL GAMEINIT: '' HEADER STATEMENT READ UNK,XITEM,XACT,XNV,XROOM,XCARRY,SROOM,XTRES,WORDLEN,XLIGHT,XMESS,XTRESRM ''DATA 5724,66,177,79,26,6,1,2,3,150,88,1 DATA 5724,66,177,79,26,6,1,2,3,30,88,1 LANTERN=XLIGHT For I=0 TO XACT READ SIT(I) FOR II=0 TO 4 READ COND(I,II) NEXT II READ ACT(I,0),ACT(I,1) Next I DATA 80,422,342,420,340,0,16559,8850 DATA 80,462,482,460,0,0,15712,1705 DATA 100,521,552,540,229,220,203,8700 DATA 3,483,0,0,0,0,15712,0 DATA 100,284,308,0,0,0,8626,0 DATA 100,28,663,403,40,0,8700,0 DATA 100,48,20,660,740,220,9055,10902 DATA 100,28,20,0,0,0,3810,0 DATA 100,8,700,720,0,0,10868,0 DATA 100,48,40,640,400,300,9055,8305 DATA 19,524,0,0,0,0,9778,9450 DATA 40,104,886,0,0,0,4411,0 DATA 80,242,502,820,80,240,9321,10109 DATA 100,8,140,80,500,0,10262,8850 DATA 25,421,846,420,200,0,5162,0 DATA 100,129,120,0,0,0,6508,0 DATA 50,242,982,820,440,240,9321,8850 DATA 35,483,69,0,0,0,15705,0 DATA 7,483,249,0,0,0,15706,0 DATA 50,484,1073,1086,0,0,17661,9150 DATA 50,204,1086,0,0,0,16711,0 DATA 10,209,1040,1060,300,1100,10872,10050 DATA 10,208,1040,1060,89,0,10867,0 DATA 100,483,8,0,0,0,15719,10200 DATA 100,8,0,0,0,0,10200,0 DATA 100,104,308,0,0,0,8626,0 DATA 80,462,282,280,1160,0,1422,0 DATA 80,342,482,480,260,0,18725,9300 DATA 30,483,1212,252,480,1200,18825,0 DATA 20,483,1203,0,0,0,18900,0 DATA 25,1234,483,63,0,0,15733,0 DATA 100,328,1260,180,320,0,10860,11400 DATA 1223,107,100,61,0,0,10507,8164 DATA 7530,404,242,63,903,0,2829,0 DATA 5570,163,203,160,180,0,10870,1264 DATA 6170,183,180,160,0,0,10914,11400 DATA 6300,104,0,0,0,0,900,0 DATA 1529,442,465,440,0,0,7914,0 DATA 1529,442,462,0,0,0,760,9150 DATA 183,322,180,0,0,0,8170,9600 DATA 1538,262,242,0,0,0,1800,0 DATA 1538,262,245,260,0,0,7914,0 DATA 5888,262,242,0,0,0,1800,0 DATA 5888,262,245,0,0,0,1950,0 DATA 6188,262,245,541,260,560,2155,7950 DATA 5888,261,0,0,0,0,2400,0 DATA 4088,561,0,0,0,0,2400,0 DATA 4088,263,0,0,0,0,2713,0 DATA 4088,562,580,109,100,249,2303,8700 DATA 4088,249,562,108,900,240,6203,8700 DATA 4088,248,562,0,0,0,6600,0 DATA 4068,103,69,0,0,0,646,0 DATA 4068,103,68,0,0,0,6600,0 DATA 5887,342,0,0,0,0,2550,0 DATA 5887,362,0,0,0,0,2713,0 DATA 5887,382,0,0,0,0,2100,0 DATA 159,382,320,0,0,0,8170,9600 DATA 6187,342,362,0,0,0,2550,0 DATA 6187,345,362,541,360,380,8303,10164 DATA 3461,503,0,0,0,0,19051,3300 DATA 3750,0,0,0,0,0,9900,0 DATA 1528,0,0,0,0,0,9900,0 DATA 4108,1143,1012,0,0,0,646,0 DATA 1271,0,0,0,0,0,2853,0 DATA 4510,66,0,0,0,0,2720,0 DATA 4950,0,0,0,0,0,9750,0 DATA 5114,0,0,0,0,0,10650,0 DATA 7092,592,0,0,0,0,2745,0 DATA 185,284,140,0,0,0,8156,10564 DATA 4098,1054,0,0,0,0,647,17550 DATA 4098,1053,0,0,0,0,647,17400 DATA 4083,322,0,0,0,0,647,0 DATA 4095,762,0,0,0,0,647,0 DATA 195,782,921,0,0,0,2727,0 DATA 195,762,261,0,0,0,2727,0 DATA 6900,0,0,0,0,0,9450,0 DATA 1526,602,0,0,0,0,2723,0 DATA 1541,621,602,640,520,600,7853,8364 DATA 195,782,661,0,0,0,2727,0 DATA 7092,623,583,303,643,20,8700,0 DATA 7092,0,0,0,0,0,3750,0 DATA 200,722,220,0,0,0,10554,9600 DATA 195,762,61,0,0,0,2727,0 DATA 1223,104,120,61,0,0,10507,8164 DATA 1526,523,520,0,0,0,7914,0 DATA 195,762,340,0,0,0,8126,8464 DATA 195,782,360,0,0,0,8157,10564 DATA 7530,404,242,1053,89,0,17250,0 DATA 0,0,0,0,0,0,0,0 DATA 5868,103,200,69,60,0,4553,8700 DATA 5868,68,0,0,0,0,494,0 DATA 1546,146,0,0,0,0,4800,0 DATA 1546,802,141,140,840,0,8302,17100 DATA 2746,841,840,140,0,0,8302,4950 DATA 3496,802,0,0,0,0,811,0 DATA 3496,841,840,140,0,0,811,8302 DATA 7366,822,820,240,400,0,5305,9300 DATA 5861,503,0,0,0,0,2100,0 DATA 8411,503,500,140,0,0,5433,10800 DATA 192,742,400,0,0,0,8170,9600 DATA 201,404,88,420,240,242,8170,8071 DATA 201,404,89,120,0,0,8170,9600 DATA 7530,404,245,0,0,0,2737,0 DATA 7530,404,912,0,0,0,2738,0 DATA 7530,404,89,80,740,420,10539,8762 DATA 7530,404,88,80,740,120,10539,9062 DATA 7671,0,0,0,0,0,6000,0 DATA 4553,903,0,0,0,0,6300,0 DATA 1350,0,0,0,0,0,6000,0 DATA 1510,62,60,0,0,0,7914,0 DATA 5860,63,1254,1240,0,0,8064,4500 DATA 201,404,88,420,0,0,8170,9600 DATA 218,284,360,0,0,0,8170,9600 DATA 1539,482,242,0,0,0,1800,0 DATA 1539,482,480,0,0,0,7904,16800 DATA 194,682,300,0,0,0,8170,9600 DATA 174,140,464,0,0,0,8751,0 DATA 174,140,0,0,0,0,9051,0 DATA 7800,444,940,921,954,0,10548,8014 DATA 3495,1203,0,0,0,0,19050,0 DATA 7800,424,994,980,921,0,10553,7264 DATA 8250,104,0,0,0,0,10505,9150 DATA 7800,464,148,1140,921,1154,10553,7264 DATA 1541,643,640,0,0,0,7914,0 DATA 163,104,40,0,0,0,8170,9600 DATA 6300,44,0,0,0,0,15456,0 DATA 4534,583,0,0,0,0,4650,0 DATA 6187,702,541,0,0,0,2713,16050 DATA 5887,702,0,0,0,0,2713,0 DATA 5887,0,722,0,0,0,2100,0 DATA 198,1022,480,0,0,0,8170,9600 DATA 216,2,24,40,0,0,8170,9600 DATA 1510,44,60,40,80,85,7801,10800 DATA 1532,302,208,300,0,0,7914,0 DATA 1532,302,209,0,0,0,2813,0 DATA 1532,305,0,0,0,0,10518,7564 DATA 8411,843,840,140,0,0,10914,0 DATA 165,1122,500,0,0,0,8170,9600 DATA 1392,0,0,0,0,0,6000,0 DATA 6300,284,0,0,0,0,16350,0 DATA 8582,0,0,0,0,0,17700,0 DATA 7800,921,209,302,200,0,8814,0 DATA 7950,0,0,0,0,0,2700,0 DATA 5908,621,1143,1000,0,0,4553,0 DATA 5266,0,0,0,0,0,1800,0 DATA 6300,342,0,0,0,0,18450,0 DATA 1200,0,0,0,0,0,17185,450 DATA 6300,124,0,0,0,0,16350,0 DATA 9450,208,1040,1060,0,0,10919,0 DATA 6300,184,242,0,0,0,3600,0 DATA 7800,921,140,0,0,0,7410,0 DATA 6300,24,0,0,0,0,18300,0 DATA 158,82,60,0,0,0,8170,9600 DATA 4510,63,0,0,0,0,300,0 DATA 3450,0,0,0,0,0,2700,0 DATA 6300,0,0,0,0,0,450,0 DATA 163,22,100,0,0,0,8170,9600 DATA 8100,0,0,0,0,0,2836,0 DATA 4650,0,0,0,0,0,128,0 DATA 1538,563,560,0,0,0,7914,0 DATA 5860,1253,63,1220,1234,0,17153,4500 DATA 4060,63,0,0,0,0,730,6900 DATA 4574,1223,0,0,0,0,18000,0 DATA 4103,903,0,0,0,0,730,0 DATA 4575,1243,0,0,0,0,10631,0 DATA 5860,1233,63,0,0,0,494,0 DATA 4125,1243,0,0,0,0,730,0 DATA 2550,0,0,0,0,0,2700,0 DATA 8850,0,0,0,0,0,2832,0 DATA 4063,22,0,0,0,0,647,0 DATA 4092,742,0,0,0,0,647,0 DATA 9676,0,0,0,0,0,20163,0 DATA 5250,0,0,0,0,0,2832,0 DATA 1578,462,0,0,0,0,760,9150 DATA 10063,0,0,0,0,0,2837,0 DATA 8250,0,0,0,0,0,17103,0 DATA 9450,209,1040,1060,300,1100,10872,17100 DATA 4050,0,0,0,0,0,11514,20250 '' VERB/NOUN PAIRING For X=0 TO XNV For Y=0 TO 1 READ NNVERB(X,Y) Next Y Next X '' ADDED SPACE TO NULL DATA "AUT","ANY","GO","NORTH","*CLI","SOUTH","*WAL","EAST" DATA "*RUN","WEST","*ENT","UP","*PAC","DOWN","*FOL","." DATA "SAY","PAS","SAI","HAL","GET","BOO","*TAK","BOT" DATA "*CAT","*RUM","*PIC","WIN","*REM","GAM","*WEA","MON" DATA "*PUL","PIR","FLY","ARO","DRO","BAG","*REL","*DUF" DATA "*THR","TOR","*LEA","OFF","*GIV","MAT","DRI","YOH" DATA "*EAT","30","INV","LUM","SAI","RUG","LOO","KEY" DATA "*EXA","INV","*WAT","DUB","REA","SAI","LIS","FIS" DATA ".","ANC","SCO","SHA","SAV","PLA","KIL","CAV" DATA "*ATT","SIG","LIG","DOO",".","CHE","OPE","PAR" DATA "*SHA","HAM","UNL","NAI","HEL","BOA",".","*SHI" DATA ".","SHE","SWI","CRA","QUI","WAT","BUI","*SAL" DATA "*MAK","LAG","WAK","*TID","SET","PIT","CAS","SHO" DATA "DIG","*BEA","BUR","MAP","FIN","PAC","JUM","BON" DATA "EMP","HOL","WEI","SAN"," ","BOX","BRE","SNE" DATA "*SMA","CRA",".","*SAC"," ","PIE","WAI","KEE" DATA "FEE","FLO"," ","*JET"," ","STA","CLO","*UPS" DATA "*SHU","PAT"," ","*HIL"," ","YOH"," ","AWA" DATA " ","*BUN"," ","PIE"," ","NOT"," ","FLY" DATA " ","DES"," ","CRO"," ","SNA"," ","TRE" '' ROOMS FOR I=0 TO XROOM FOR II=0 TO 5 READ MAP(I,II) NEXT II READ DESC(I) NEXT I DATA 0,0,0,0,0,0," " DATA 0,0,0,0,0,0,"FLAT IN LONDON" DATA 0,0,0,0,0,1,"ALCOVE" DATA 0,0,4,2,0,0,"SECRET PASSAGEWAY" DATA 0,0,0,3,0,0,"MUSTY ATTIC" DATA 0,0,0,0,0,0,"*I''M OUTSIDE AN OPEN WINDOW ON THE LEDGE OF A VERY TALL BUILDING" DATA 0,0,8,0,0,0,"SANDY BEACH ON A TROPICAL ISLE" DATA 0,12,13,14,0,11,"MAZE OF CAVES" DATA 0,0,14,6,0,0,"MEADOW" DATA 0,0,0,8,0,0,"GRASS SHACK" DATA 10,24,10,10,0,0,"*I''M IN THE OCEAN" DATA 0,0,0,0,7,0,"PIT" DATA 7,0,14,13,0,0,"MAZE OF CAVES" DATA 7,14,12,19,0,0,"MAZE OF CAVES" DATA 0,0,0,8,0,0,"*I''M AT THE FOOT OF A CAVE RIDDEN HILL, A PATHWAY LEADS ON UP TO THE TOP" DATA 17,0,0,0,0,0,"TOOL SHED" DATA 0,0,17,0,0,0,"LONG HALLWAY" DATA 0,0,0,16,0,0,"LARGE CAVERN" DATA 0,0,0,0,0,14,"*I''M ON TOP OF A HILL. BELOW IS PIRATES ISLAND. ACROSS THE SEA WAY OFF IN THE DISTANCE I SEE TREASURE ISLAND" DATA 0,14,14,13,0,0,"MAZE OF CAVES" DATA 0,0,0,0,0,0,"*I''M ABOARD PIRATE SHIP ANCHORED OFF SHORE" DATA 0,22,0,0,0,0,"*I''M ON THE BEACH AT *TREASURE* ISLAND" DATA 21,0,23,0,0,0,"SPOOKY OLD GRAVEYARD FILLED WITH PILES OF EMPTY AND BROKEN RUM BOTTLES" DATA 0,0,0,22,0,0,"LARGE BARREN FIELD" DATA 10,6,6,6,0,0,"SHALLOW LAGOON. TO THE NORTH IS THE OCEAN" DATA 0,0,0,23,0,0,"SACKED AND DESERTED MONASTARY" DATA 0,0,0,0,0,0,"*WELCOME TO NEVER NEVER LAND" '' MESSAGES FOR I=0 TO XMESS READ MESS(I) NEXT I DATA "" DATA "THERE''S A STRANGE SOUND" DATA "THE BOOK IS IN BAD CONDTION BUT I CAN MAKE OUT THE TITLE: `TREASURE ISLAND`. THERE''S A WORD WRITTEN IN BLOOD IN THE FLYLEAF: `YOHO` AND A MESSAGE: `LONG JOHN SILVER LEFT 2 TREASURES ON TREASURE ISLAND`" DATA "NOTHING HAPPENS" DATA "THERE''S SOMETHING THERE ALL RIGHT. MAYBE I SHOULD" DATA "THAT''S NOT VERY SMART" DATA "I MAY NEED TO SAY A MAGIC WORD HERE!" DATA "EVERYTHING SPINS AROUND AND SUDDENLY I''M ELSEWHERE..." DATA "TORCH IS LIT" DATA "I WAS WRONG, I GUESS ITS NOT A MONGOOSE CAUSE THE SNAKES BIT IT!" DATA "I''M SNAKE BIT" DATA "PARROT ATTACKS SNAKES AND DRIVES THEM OFF" DATA "PIRATE WON''T LET ME" DATA "ITS LOCKED" DATA "ITS OPEN" DATA "THERE ARE A SET OF PLANS IN IT" DATA "NOT WHILE I''M CARRYING IT" DATA "CROCS STOP ME" DATA "SORRY I CAN''T" DATA "WRONG GAME YOU SILLY GOOSE!" DATA "I DON''T HAVE IT" DATA "PIRATE GRABS RUM AND SCUTTLES OFF CHORTLING" DATA "...I THINK ITS ME, HEE HEE." DATA "ITS NAILED TO THE FLOOR!" DATA "YOHO HO AND A ..." DATA "NO, SOMETHING IS MISSING!" DATA "IT WAS A TIGHT SQUEEZE!" DATA "SOMETHING WON''T FIT" DATA "SINCE NOTHING IS HAPPENING" DATA "I SLIPPED AND FELL..." DATA "SOMETHING FALLS OUT" DATA "THEY''RE PLANS TO BUILD THE JOLLY ROGER (A PIRATE SHIP!) YOU''LL NEED: HAMMER, NAILS, LUMBER, ANCHOR, SAILS, AND A KEEL." DATA "I''VE NO CONTAINER" DATA "IT SOAKS INTO THE GROUND" DATA "TOO DRY, FISH VANISH." DATA "PIRATE AWAKENS AND SAYS `AYE MATEY WE BE CASTING OFF SOON` HE THEN VANISHES!" DATA "WHAT A WASTE..." DATA "I''VE NO CREW" DATA "PIRATE SAYS: `AYE MATEY WE BE NEEDING A MAP FIRST`." DATA "AFTER A DAY AT SEA WE SET ANCHOR OFF OF A SANDY BEACH. ALL ASHORE WHO''S GOING ASHORE..." DATA "TRY: `WEIGH ANCHOR`" DATA "THERE''S A MAP IN IT" DATA "ITS A MAP TO TREASURE ISLAND. AT THE BOTTOM IT SAYS: `30 PACES THEN DIG!`" DATA "* WELCOME TO ADVENTURE NUMBER 2: `PIRATE ADVENTURE` BY ALEXIS & SCOTT ADAMS, DEDICATED: TED HEEREN & PAUL SHARLAND. REMEMBER YOU CAN ALWAYS ASK FOR `HELP`." DATA "ITS EMPTY" DATA "I''VE NO PLANS!" DATA "OPEN IT?" DATA "GO THERE?" DATA "I FOUND SOMETHING!" DATA "I DIDN''T FIND ANYTHING" DATA "I DON''T SEE IT HERE" DATA "OK I WALKED OFF 30 PACES." DATA "CONGRATULATIONS !!! BUT YOUR ADVENTURE IS NOT OVER YET..." DATA "READING EXPANDS THE MIND" DATA "THE PARROT CRYS:" DATA "`CHECK THE BAG MATEY`" DATA "`CHECK THE CHEST MATEY`" DATA "FROM THE OTHER SIDE!" DATA "OPEN THE BOOK!" DATA "THERE''S MULTIPLE EXITS HERE!" DATA "CROCS EAT FISH AND LEAVE" DATA "I''M UNDERWATER, I GUESS I DON''T SWIM WELL. BLUB BLUB..." DATA "`PIECES OF EIGHT`" DATA "ITS STUCK IN THE SAND" DATA "OK" DATA "PIRATE SAYS: `AYE ME BUCKEROO, WE BE WAITING FOR THE TIDE TO COME IN!`" DATA "THE TIDE IS OUT" DATA "THE TIDE IS COMING IN" DATA "ABOUT 20 POUNDS. TRY: `SET SAIL`" DATA "`TIDES BE A CHANGING MATEY`" DATA "NOTE HERE SAYS: `I BE LIKING PARROTS, THEY BE SMART MATEY!`" DATA "PIRATE FOLLOWS ME ASHORE AS IF EXPECTING SOMETHING" DATA "CLIMB STAIRS..." DATA "GOT ANYTHING TO EAT MATEY?" DATA "PARROT ATTACKS CROCS BUT IS BEATEN OFF" DATA "BIRD FLYS OFF LOOKING VERY UNHAPPY" DATA "PARROT ATE A CRACKER." DATA "YUMMY" DATA "I HEAR NOTHING NOW" DATA "PIRATE SAYS: `FIRST YEE BE GETTING THAT ACCURSED THING OFF ME SHIP!`" DATA "READ IT?" DATA "ASK FOR ADVENTURE NUMBER 3: `MISSION IMPOSSIBLE` AT YOUR FAVORITE COMPUTER DEALER. IF THEY DON''T CARRY `ADVENTURE` HAVE THEM CALL: 1-305-862-6917 TODAY! `ADVENTURE` ALSO SUPPORTS LOWER CASE!" DATA "I''M NOT FEELING DESTRUCTIVE!" DATA "`CHECK THE BOOK, MATEY!`" DATA "ALL RIGHT, POOF THE GAME IS DESTROYED!" DATA "I SEE NOTHING SPECIAL" DATA "I DON''T KNOW WHERE TO LOOK!" DATA "ITS STUCK" DATA "" '' ITEMS: TEXT/LOCATION FOR I=0 TO XITEM READ ITEM(I),ITEMLOC(I) NEXT I CONST LIGHTSRC=9 DATA "FLIGHT OF STAIRS",1 DATA "OPEN WINDOW",2 DATA "BOOKS IN A BOOKCASE",2 DATA "LARGE BLOOD SOAKED BOOK/BOO/",0 DATA "BOOKCASE WITH SECRET PASSAGE BEYOND",0 DATA "PIRATE''S DUFFEL BAG/BAG/",4 DATA "SIGN SAYS: ''BRING *TREASURES* HERE, SAY: SCORE''",1 DATA "EMPTY BOTTLE/BOT/",0 DATA "UNLIT TORCH/TOR/",4 DATA "LIT TORCH/TOR/",0 DATA "MATCHES/MAT/",0 DATA "SMALL SHIP''S KEEL AND MAST",6 DATA "WICKED LOOKING PIRATE",9 DATA "TREASURE CHEST/CHE/",9 DATA "MONGOOSE/MON/",8 DATA "RUSTY ANCHOR/ANC/",24 DATA "GRASS SHACK",8 DATA "MEAN AND HUNGRY LOOKING CROCODILES",11 DATA "LOCKED DOOR",11 DATA "OPEN DOOR WITH HALL BEYOND",0 DATA "PILE OF SAILS/SAI/",17 DATA "FISH/FIS/",10 DATA "*DUBLEONS*/DUB/",25 DATA "DEADLY MAMBA SNAKES",25 DATA "PARROT/PAR/",9 DATA "BOTTLE OF RUM/BOT/",1 DATA "RUG/RUG/",0 DATA "RING OF KEYS/KEY/",0 DATA "OPEN TREASURE CHEST/CHE/",0 DATA "SET OF PLANS/PLA/",0 DATA "RUG",1 DATA "CLAW HAMMER/HAM/",15 DATA "NAILS/NAI/",0 DATA "PILE OF PRECUT LUMBER/LUM/",17 DATA "TOOL SHED",17 DATA "LOCKED DOOR",16 DATA "OPEN DOOR WITH PIT BEYOND",0 DATA "PIRATE SHIP",0 DATA "ROCK WALL WITH NARROW CRACK IN IT",18 DATA "NARROW CRACK IN THE ROCK",17 DATA "SALT WATER",10 DATA "SLEEPING PIRATE",0 DATA "BOTTLE OF SALT WATER/BOT/",0 DATA "RUM BOTTLE SMASHED INTO PIECES. SIGN ''OPPOSITE OF LIGHT IS UNLIGHT''",4 DATA "SAFETY SNEAKERS/SNE/",1 DATA "MAP/MAP/",0 DATA "SHOVEL/SHO/",15 DATA "MOULDY OLD BONES/BON/",0 DATA "SAND/SAN/",6 DATA "BOTTLES OF RUM/BOT/",0 DATA "*RARE STAMPS*/STA/",0 DATA "LAGOON",6 DATA "THE TIDE IS OUT",24 DATA "THE TIDE IS COMING IN",0 DATA "WATER WINGS/WIN/",15 DATA "FLOTSAM AND JETSAM",0 DATA "MONASTARY",23 DATA "WOODEN BOX/BOX/",0 DATA "DEAD SQUIRREL",0 DATA "SIGN IN THE SAND SAYS: ''WELCOME TO PIRATES ISLAND, WATCH OUT FOR THE TIDE!''",6 DATA "SACK OF CRACKERS/CRA/",1 DATA "NOTE/NOT/",0 DATA "SMALL ADVERTISING FLYER/FLY/",0 DATA "BURNT OUT TORCH/TOR/",0 DATA "",0 DATA "",0 DATA "",0 ''STARTING LOCATION MYLOC=SROOM Return '' VERSION / ADVENTURE # / MAGIC # '' DATA 408,2,828 LABEL GAMELOADED: '' SEPARATE SYNONYM FROM ITEM DESCRIPTION For I=0 TO XITEM For II=1 TO Len(ITEM(I)) If MID$(ITEM(I),II,1)="/" THEN ITEMSYM(I)=UCASE$(MID$(ITEM(I),II+1,Len(ITEM(I))-II-1)) ITEM(I)=LEFT$(ITEM(I),II-1) ENDIF Next II Next I ''CURSOR=0 '' DISPLAY Dim ITEMSG(50) CT=0 GAMESTART=1 GoSub LOOK LABEL PARSING: While TRUE LABEL GETINPUT: '' FOR CORRECT TAKE/DROP DONEACT=0 '' TP$ HOLDS RAW INPUT '' NT$(0)=VERB, NT$(1)=VERB '' WAKE UP IF ASLEEP TKS=TICKSPERSEC Input"TELL ME WHAT TO DO";TP$ TP$=UCASE$(TP$) '' HACK FOR REDISLAY WITH EMPTY RETURN FOR EBBOOKMAN '' SINCE THE CHARACTOR POSITION LOCATOR AND VIEWPORTS '' DON''T WORK If Len(TP$)="" Then GoSub LOOK GoTo GETINPUT ENDIF K=0:NT$(0)="":NT$(1)="" '' DO LENGTH OF STRING '' K$ EQUALS NEXT STRING CHARACTER: '' IF SPACE SET K TO 1 AND DO NEXT WORD For X=1 TO Len(TP$) WORD$=MID$(TP$,X,1) If WORD$=" " Then K=1 GoTo NXTLBL1 ENDIF '' FILL VERB OR NOUN IF K IS 0 OR 1 FULLNOUN(K)=NT$(K)+WORD$ NT$(K)=LEFT$(NT$(K)+WORD$,WORDLEN) '' GOT BOTH WORDS NOW, RUN THRU EM LABEL NXTLBL1: Next X For X=0 to 1 NV(X)=0 If NT$(X)="" Then GoTo NXTLBL3 '' XNV = TOTAL # OF VERBS AND NOUNS '' CHECK EACH WORD AGAINST LIST '' CHOP OFF ASTERIK For Y=0 to XNV K$=NNVERB(Y,X) If LEFT$(K$,1)="*" Then K$=Mid(K$,2) ''IF ITS A GO DIRECTION THEN CHOP OFF WORDLEN If X=1 and Y<7 Then K$=LEFT$(K$,WORDLEN) '' GET THE VALUE OF THE WORD If NT$(X)=K$ Then NV(X)=Y GoTo NXTLBL2 ENDIF Next Y GoTo NXTLBL3 '' MATCHING UP ACTION WORD PAIR ALL *WORDS ARE CHAINED '' TO AN ORIGIN WORD LABEL NXTLBL2: If LEFT$(NNVERB(NV(X),X),1)="*" Then NV(X)=NV(X)-1 GoTo NXTLBL2 ENDIF LABEL NXTLBL3: Next X '' CHECK FOR NONSENSE INPUT '' IF 1) NO VERB MATCH OR '' 2) NO NOUN MATCH THEN SET F For II=0 TO 1 RFLAG(II)=0 Next II RFLAG(0)=NV(0)<1 RFLAG(1)=Len(NT$(1))>0 and NV(1)<1 '' LIGHT ROUTINE If DWALK Then If ITEMLOC(9)<>CARRIED AND ITEMLOC(9)<>MYLOC Then PRINT"I CAN''T SEE, ITS TOO DARK!" ENDIF '' RESET NOUN VERB HOLDER NT$(X) / NV(0)=VERB NV(1)=NOUN ''XXXXXXXXXXXXXXXXX ''GO HACK ''If NV(0)=1 and NV(1)<7 Then '' GoTo GOHACK '' F=0 GH=0 If NT$(0) = "N" OR NT$(0) = "NOR" THEN IF NT$(1) = "" THEN NV(0) = 1 NV(1) = 1 GH=1 ENDIF ENDIF IF NT$(0) = "S" OR NT$(0) = "SOU" THEN IF NT$(1) = "" THEN NV(0) = 1 NV(1) = 2 GH=1 ENDIF EndIF If NT$(0) = "E" OR NT$(0) = "EAS" THEN IF NT$(1) = "" THEN NV(0) = 1 NV(1) = 3 GH=1 ENDIF ENDIF If NT$(0) = "W" OR NT$(0) = "WES" THEN IF NT$(1) = "" THEN NV(0) = 1 NV(1) = 4 GH=1 ENDIF ENDIF If NT$(0) = "U" OR NT$(0) = "UP" THEN IF NT$(1) = "" THEN NV(0) = 1 NV(1) = 5 GH=1 ENDIF ENDIF If NT$(0) = "D" OR NT$(0) = "DOW" THEN If NT$(1) = "" THEN NV(0) = 1 NV(1) = 6 GH=1 ENDIF ENDIF If BITFLAG(DARKBIT)=1 THEN IF ITEMLOC(9)<>MYLOC AND ITEMLOC(9)<>CARRIED THEN IF NV(0) = 1 AND NV(1) > 0 AND NV(1) < 7 THEN IF DWALK > 0 THEN PRINT "I FELL DOWN AND BROKE MY NECK." PRINT PRINT "GAME OVER." END ELSE DWALK = 1 PRINT "DANGEROUS TO MOVE IN THE DARK!" TIMING PRINT "OK. " TIMING ENDIF ENDIF ENDIF ENDIF If GH=1 Then GoTo GOHACK If (NV(0)>=0 AND NV(1)=0) OR (NV(0)>0 AND NV(1)>0) Then GOSUB VERBACTION FF=0 ENDIF ''GO ROUTINE HACK LABEL GOHACK: FLAGDIR=0 If NV(0) = 1 THEN IF NV(1) > 0 AND NV(1) < 7 THEN SAVEROOM = 1000 IF NV(1) = 1 AND MAP(MYLOC, 0) > 0 THEN SAVEROOM=MAP(MYLOC, 0):FLAGDIR=1 IF NV(1) = 2 AND MAP(MYLOC, 1) > 0 THEN SAVEROOM=MAP(MYLOC, 1):FLAGDIR=1 IF NV(1) = 3 AND MAP(MYLOC, 2) > 0 THEN SAVEROOM=MAP(MYLOC, 2):FLAGDIR=1 IF NV(1) = 4 AND MAP(MYLOC, 3) > 0 THEN SAVEROOM=MAP(MYLOC, 3):FLAGDIR=1 IF NV(1) = 5 AND MAP(MYLOC, 4) > 0 THEN SAVEROOM=MAP(MYLOC, 4):FLAGDIR=1 IF NV(1) = 6 AND MAP(MYLOC, 5) > 0 THEN SAVEROOM=MAP(MYLOC, 5):FLAGDIR=1 If FLAGDIR=1 Then IF SWAPROOM <> 1000 THEN MYLOC = SAVEROOM CDONE = 1 DONEACT=1 VBFND = 0 NNFND = 0 PRINT "OK." GoSub VERBACTION GoSub LOOK FF=0 FLAGDIR=0 If DONEACT=1 Then GOSUB AUTOMATIC GoTo GETINPUT ENDIF Else PRINT "I CAN''T GO IN THAT DIRECTION" GoTo GETINPUT ENDIF ENDIF ENDIF ''If FF=0 AND CONCHECK=1 AND !RFLAG(0) AND GH=0 Then If FF=0 AND CONCHECK=0 AND !RFLAG(0) AND GH=0 Then If NV(0) <> 10 AND NV(0) <> 18 Then PRINT "I CAN''T DO THAT...YET" GoTo GETINPUT ENDIF ENDIF If RFLAG(0) AND RFLAG(1) THEN If NV(0) <> 10 AND NV(0) <> 18 Then PRINT "I MUST BE STUPID,":?"I JUST DON''T UNDERSTAND WHAT YOU MEAN." GoTo GETINPUT ENDIF ENDIF ''If RFLAG(0) AND NV(1)<1 '' Print "HUH?" '' GoTo GETINPUT If RFLAG(1) AND !RFLAG(0) Then Print "I DON''T KNOW WHAT ";CHR(132);FULLNOUN(1);CHR(132);" IS" GoTo GETINPUT ElseIf RFLAG(0) Print "I DON''T KNOW HOW TO ";CHR(132);FULLNOUN(0);CHR(132);" SOMETHING" ''Print "YOU USE WORD(S) I DON''T KNOW!" GoTo GETINPUT ENDIF ''ENDIF If NV(0) = 10 AND DONEACT = 0 THEN GOSUB TAKEOBJ If NV(0) = 18 AND DONEACT = 0 THEN GOSUB DROPOBJ If DONEACT=1 Then GOSUB AUTOMATIC Wend LABEL LOOK: Cls ''LIGHT HOUSEKEEPING IF BITFLAG(DARKBIT)=0 OR ITEMLOC(9)=MYLOC OR ITEMLOC(9)=CARRIED THEN DWALK = 0 ENDIF ''TRACK CHARACTER POSITION CHARPOS=0 ''LINE POSITION LNPOS=0 ''RESET DISPLAY FLAG REDRAW=0 If BITFLAG(DARKBIT)=1 AND ITEMLOC(9)!=255 AND ITEMLOC(9)!=MYLOC THEN Print "IT''S TOO DARK TOO SEE." LNPOS=LNPOS+1 GoTo LOOKRET ENDIF If Len(DESC(MYLOC))>0 Then TEMP=UCASE$(MID$(DESC(MYLOC),1,1)) Else TEMP=" " ENDIF If TEMP<>"*" THEN MSG="I''M IN A " MSGXFER=MSG+DESC(MYLOC)+". " CHARPOS=Len(MSGXFER) If CHARPOS>39 Then MSGROUTINE Else Print MSGXFER; CHARPOS=CHARPOS+Len(MSGXFER) ENDIF ElseIf TEMP="*" THEN MSGXFER=MID$(DESC(MYLOC),2,Len(DESC(MYLOC))-1)+". " CHARPOS=Len(MSGXFER) If CHARPOS>39 Then MSGROUTINE Else Print MSGXFER; CHARPOS=CHARPOS+Len(MSGXFER) ENDIF ENDIF LNPOS=LNPOS+1 MSG="VISIBLE ITEMS:" VI=1 CHARPOS=CHARPOS+Len(MSG) If CHARPOS>40 THEN PRINT LNPOS=LNPOS+1 CHARPOS=0 ENDIF Print MSG Print LNPOS=LNPOS+2 II=0 MSGXFER="" While (II<=XITEM) If ITEMLOC(II)=MYLOC Then MSGXFER=MSGXFER+Item(II)+". " ENDIF II=II+1 Wend If Len(MSGXFER)<>0 Then MSGROUTINE ENDIF ''If CHARPOS>0 Then '' LNPOS=LNPOS+1 ''ENDIF FF=0 For I=0 TO 5 If MAP(MYLOC,I)<>0 Then FF=1 Next I If FF<>0 THEN If CHARPOS=0 THEN Print:Print Tab(5); LNPOS=LNPOS+2 Else Print:Print:Print Tab(5); LNPOS=LNPOS+3 ENDIF Print "SOME OBVIOUS EXITS ARE: " Print Tab(10); CHARPOS=0 ELSE GoTo LOOKRET ENDIF If MAP(MYLOC, 0) <> 0 Then PRINT "NORTH "; ''CHARPOS=CHARPOS+6 ENDIF If MAP(MYLOC, 1) <> 0 Then Print "SOUTH "; ''CHARPOS=CHARPOS+6 ENDIF If MAP(MYLOC, 2) <> 0 Then Print "EAST "; ''CHARPOS=CHARPOS+5 ENDIF If MAP(MYLOC, 3) <> 0 Then Print "WEST "; ''CHARPOS=CHARPOS+5 ENDIF If MAP(MYLOC, 4) <> 0 Then Print "UP "; ''CHARPOS=CHARPOS+3 ENDIF If MAP(MYLOC, 5) <> 0 Then Print "DOWN"; ''CHARPOS=CHARPOS+4 ENDIF If CHARPOS>0 Then ''LNPOS=LNPOS+1 ? ENDIF LABEL LOOKRET: '' TRS-80 BAR '' ADJUST ''LNPOS=LNPOS+1 YWAY=LNPOS*9 For I=0 TO 6 LINE 0,YWAY+I,199,YWAY+I COLOR 0 NEXT I ''MOVE CURSOR ?:?:? If GAMESTART=1 Then GAMESTART=0 NV(0)=0 NV(1)=0 GoSub AUTOMATIC ENDIF Return LABEL AUTOMATIC: For Y=0 TO XITEM CT=Y IF INT(SIT(Y)\150)=0 THEN RANDOMIZE TIMER RVAL=INT(RND*100) IF INT(SIT(Y) MOD 150)>RVAL THEN GOSUB MESSAGING ENDIF ENDIF NEXT Y If LANTERN=1 THEN BITFLAG(LIGHTOUTBIT)=1 If LANTERN>0 AND LANTERN<25 Then If ITEMLOC(9)=MYLOC OR ITEMLOC(9)=CARRIED THEN PRINT "YOUR LIGHT IS FLICKERING..."; LANTERN; " MORE MOVES":?"UNTIL IT GOES OUT." ''TIMING ''GoSub LOOK EndIF If ITEMLOC(9)=CARRIED OR ITEMLOC(9)=MYLOC THEN LANTERN=LANTERN-1 If LANTERN<0 Then LANTERN=0 BITFLAG(DARKBIT)=1 GoSub LOOK ENDIF ''GOSUB LOOK RETURN LABEL MESSAGING: CONT=0 LABEL CONTLOOP: For I=0 TO 9 PARAM(I)=0 Next I CDONE=1 CPTR=0 AC=0 While (AC<5) '''''''''''''''''''' FOUR ACTION LOOP THING CV=Int(COND(CT,AC) MOD 20) DV=Int(COND(CT,AC)\20) If CV=0 Then PARAM(CPTR)=DV CPTR=CPTR+1 ENDIF If CV=1 THEN If ITEMLOC(DV)!=CARRIED Then CDONE=0 ''Return ENDIF ENDIF If CV=2 THEN If ITEMLOC(DV)!=MYLOC THEN CDONE=0 ''Return ENDIF ENDIF If CV=3 Then If ITEMLOC(DV)!=CARRIED && ITEMLOC(DV)!=MYLOC Then CDONE=0 ''Return ENDIF ENDIF If CV=4 Then If MYLOC!=DV Then CDONE=0 ''Return ENDIF ENDIF If CV=5 Then If ITEMLOC(DV)=MYLOC Then CDONE=0 ''Return ENDIF ENDIF If CV=6 Then If ITEMLOC(DV)=CARRIED Then CDONE=0 ''Return ENDIF ENDIF If CV=7 Then If MYLOC=DV Then CDONE=0 ''Return ENDIF ENDIF If CV=8 Then If BITFLAG(DV)=0 Then CDONE=0 ''Return ENDIF ENDIF If CV=9 Then If BITFLAG(DV)=1 Then CDONE=0 ''Return ENDIF ENDIF If CV=10 Then CNTCARRY If WEIGHT=0 Then CDONE=0 ''Return ENDIF ENDIF If CV=11 Then CNTCARRY If WEIGHT<>0 Then CDONE=0 ''Return ENDIF ENDIF If CV=12 Then If (ITEMLOC(DV)=CARRIED) OR (ITEMLOC(DV)=MYLOC) Then CDONE=0 ''Return ENDIF ENDIF If CV=13 Then If ITEMLOC(DV)=0 Then CDONE=0 ''Return ENDIF ENDIF If CV=14 THEN If ITEMLOC(DV)<>0 Then CDONE=0 ''Return ENDIF ENDIF If CV=15 THEN If CCOUNTER>DV THEN CDONE=0 ''Return ENDIF ENDIF If CV=16 THEN If CCOUNTER<=DV THEN CDONE=0 ''Return ENDIF ENDIF If CV=17 THEN If ITEMLOC(DV)!=ITEM(DV) Then CDONE=0 ''Return ENDIF ENDIF If CV=18 THEN If ITEMLOC(DV)=ITEM(DV) THEN CDONE=0 ''Return ENDIF ENDIF '' FOR BRIAN HOWARTH ADVENTURES If CV=19 THEN If CCOUNTER!=DV THEN CDONE=0 ''Return ENDIF ENDIF AC=AC+1 Wend If CDONE=1 Then GoSub ACTIONS DONEACT=1 ENDIF If CONT>0 THEN IF INT(SIT(CT+1)\150)=0 THEN IF INT(SIT(CT+1) MOD 150)=0 THEN CONT=2 CT=CT+1 Else CONT=0 ENDIF Else CONT=0 ENDIF ENDIF IF CONT>1 Then GOTO CONTLOOP Return LABEL ACTIONS: ''ACTION ALGORITHM CALC ACTCODE(0) = Int(ACT(CT,0) \ 150) ACTCODE(1) = Int(ACT(CT,0) MOD 150) ACTCODE(2) = Int(ACT(CT,1) \ 150) ACTCODE(3) = Int(ACT(CT,1) MOD 150) AC=0 PPTR=0 While (AC<4) If (ACTCODE(AC)>=1 && ACTCODE(AC)<52) Then MSGXFER=MESS(ACTCODE(AC)) If Len(MSGXFER)>39 Then MSGROUTINE Else Print MESS(ACTCODE(AC)) ENDIF TIMING ElseIf (ACTCODE(AC)>101) MSGXFER=MESS(ACTCODE(AC)-50) If Len(MSGXFER)>39 Then MSGROUTINE Else Print MESS(ACTCODE(AC)-50) ENDIF TIMING Else ''If ACTCODE(AC)=0 Then '' AC=AC ''ENDIF IF ACTCODE(AC)=52 Then CNTCARRY IF WEIGHT=XCARRY THEN PRINT "I''VE TOO MUCH TO CARRY." PRINT "TRY -TAKE INVENTORY-" Else ''IF ITEMLOC(PARAM(PPTR))=MYLOC THEN ITEMLOC(PARAM(PPTR))=CARRIED CNTCARRY PPTR=PPTR+1 REDRAW=1 ENDIF ENDIF If ACTCODE(AC)=53 Then REDRAW=1 ITEMLOC(PARAM(PPTR))=MYLOC PPTR=PPTR+1 ENDIF If ACTCODE(AC)=54 Then REDRAW=1 MYLOC=PARAM(PPTR) PPTR=PPTR+1 ENDIF If ACTCODE(AC)=55 Then '' If ITEMLOC(PARAM(PPTR))=MYLOC Then ITEMLOC(PARAM(PPTR))=0 REDRAW=1 PPTR=PPTR+1 '' ENDIF ENDIF If ACTCODE(AC)=56 Then BITFLAG(DARKBIT)=1 ENDIF If ACTCODE(AC)=57 Then BITFLAG(DARKBIT)=0 ENDIF If ACTCODE(AC)=58 Then BITFLAG(PARAM(PPTR))=1 PPTR=PPTR+1 ENDIF If ACTCODE(AC)=59 Then '' If ITEMLOC(PARAM(PPTR))=MYLOC Then ITEMLOC(PARAM(PPTR))=0 REDRAW=1 PPTR=PPTR+1 '' ENDIF ENDIF If ACTCODE(AC)=60 Then BITFLAG(PARAM(PPTR))=0 PPTR=PPTR+1 ENDIF If ACTCODE(AC)=61 Then Print "I AM DEAD." TIMING BITFLAG(DARKBIT)=0 MYLOC=XROOM GoSub AUTOMATIC GoSUB LOOK ENDIF If ACTCODE(AC)=62 Then '' I=PARAM(PPTR) '' PPTR=PPTR+1 '' ITEMLOC(PARAM(PPTR))=PARAM(PPTR+1) ITEMLOC(PARAM(PPTR))=PARAM(PPTR+1) REDRAW=1 PPTR=PPTR+2 ENDIF If ACTCODE(AC)=63 THEN Print "THE GAME IS NOW OVER." TIMING GoTo ADVEXIT ENDIF If ACTCODE(AC)=64 Then GoSub LOOK ENDIF If ACTCODE(AC)=65 Then GoSub CALCSCORE Print "I''VE STORED ";SCORE;" TREASURES." Print "ON A SCALE OF 0 TO 100, THAT RATES "; Print Int((SCORE*100)/XTRES) If SCORE=XTRES Then Print "WELL DONE." GoTo ADVEXIT '' goto doneit ENDIF ENDIF If ACTCODE(AC)=66 Then II=0 FF=0 Print "I AM CARRYING THE FOLLOWING:" MSGXFER="" While (II<=XITEM) If ITEMLOC(II)=CARRIED Then MSGXFER=MSGXFER+Item(II)+". " FF=1 ENDIF II=II+1 Wend If (FF=0) Then Print "NOTHING." Else MSGROUTINE PRINT ENDIF ENDIF If ACTCODE(AC)=67 Then BITFLAG(0)=1 ENDIF If ACTCODE(AC)=68 Then BITFLAG(0)=0 ENDIF If ACTCODE(AC)=69 Then XLIGHT=LIGHTREFILL If (ITEM(LIGHTSRC)=MYLOC) Then REDRAW=1 ITEM(LIGHTSRC)=CARRIED LANTERN=XLIGHT BITFLAG(LIGHTOUTBIT)=0 ENDIF ENDIF If ACTCODE(AC)=70 THEN ''Cls ENDIF If ACTCODE(AC)=71 Then TEMP=Len(ADVNAME) GAMENAME=Mid(ADVNAME,1,TEMP-4) GAMENAME=GAMENAME+".sav" SAVEGAME Print "OK." EndIF If ACTCODE(AC)=72 Then ''SWAP1=ITEMLOC(PPTR) ''SWAP2=ITEMLOC(PPTR+1) ''If (ITEMLOC(SWAP1)=MYLOC || ITEMLOC(SWAP2)=MYLOC) Then SWAP ITEMLOC(PARAM(PPTR)),ITEMLOC(PARAM(PPTR+1)) REDRAW=1 PPTR=PPTR+2 ENDIF If ACTCODE(AC)=73 THEN CONT=1 ENDIF If ACTCODE(AC)=74 THEN If (ITEMLOC(PARAM(PPTR))=MYLOC) Then REDRAW=1 ITEMLOC(PARAM(PPTR))=CARRIED PPTR=PPTR+1 ENDIF ENDIF ''CHANGED If ACTCODE(AC)=75 Then I1=PARAM(PPTR) I2=PARAM(PPTR+1) If (ITEMLOC(PARAM(PPTR))=MYLOC) Then REDRAW=1 ITEMLOC(I1)=ITEMLOC(I2) If (ITEMLOC(I1)=MYLOC) Then REDRAW=1 ENDIF PPTR=PPTR+2 ENDIF ENDIF If ACTCODE(AC)=76 Then GoSub LOOK ENDIF If ACTCODE(AC)=77 THEN If (CCOUNTER>=0) Then CCOUNTER=CCOUNTER-1 ENDIF ENDIF If ACTCODE(AC)=78 Then Print CCOUNTER ENDIF If ACTCODE(AC)=79 Then CCOUNTER=PARAM(PPTR) PPTR=PPTR+1 ENDIF If ACTCODE(AC)=80 Then SWAP MYLOC,ROOMSAVE(35) ''T=MYLOC ''MYLOC=SAVEROOM ''SAVEROOM=T REDRAW=1 ENDIF If ACTCODE(AC)=81 THEN T=PARAM(PPTR) C1=CCOUNTER CCOUNTER=COUNTERS(T) COUNTERS(T)=C1 PPTR=PPTR+1 ENDIF If ACTCODE(AC)=82 Then CCOUNTER=CCOUNTER+PARAM(PPTR) PPTR=PPTR+1 ENDIF If ACTCODE(AC)=83 Then CCOUNTER=CCOUNTER-PARAM(PPTR) If (CCOUNTER< -1) Then CCOUNTER=-1 ENDIF PPTR=PPTR+1 ENDIF If ACTCODE(AC)=84 Then Print FULLNOUN(1) ENDIF If ACTCODE(AC)=85 THEN Print FULLNOUN(1) ENDIF If ACTCODE(AC)=86 Then Print ENDIF If ACTCODE(AC)=87 Then ''Changed this to swap location<->roomflag(x) ''not roomflag 0 and x SWAP MYLOC,ROOMSAVE(PARAM(PPTR)) REDRAW=1 PPTR=PPTR+1 ENDIF If ACTCODE(AC)=88 THEN TIMING ENDIF If ACTCODE(AC)=89 Then PPTR=PPTR+1 ''SAGA draw picture n ''Spectrum Seas of Blood - start combat ? ''Poking this into older spectrum games causes a crash ENDIF ENDIF AC=AC+1 Wend If REDRAW=1 Then GoSub LOOK REDRAW=0 ENDIF Return LABEL VERBACTION: CT = -1 CONCHECK=0 While CT CT=CT+1 '' NORMAL VERBS IF Int(SIT(CT) \ 150) = NV(0) THEN IF Int(SIT(CT) MOD 150) = NV(1) THEN CONCHECK=1 GOSUB MESSAGING ENDIF EndIF Wend '' ANY VERBS If DONEACT = 0 Then CT=-1 While CT CT=CT+1 IF Int(SIT(CT) \ 150) = NV(0) THEN IF Int(SIT(CT) MOD 150) = 0 Then GoSub MESSAGING ENDIF ENDIF Wend ENDIF RETURN LABEL TAKEOBJ: ITEMTAKEN=0 FOR X=0 TO XITEM IF ITEMLOC(X)=MYLOC THEN TEMPOBJ=UCASE$(ITEM(X)) CP=INSTR(TEMPOBJ,NT$(1)) IF CP>0 THEN TEMPWORD=MID(TEMPOBJ,CP,3) ENDIF IF TEMPWORD=NT$(1) AND LEN(ITEMSYM(X)) > 1 OR NT$(1)=ITEMSYM(X) THEN IF CP>0 Then CNTCARRY IF WEIGHT THEN ITEMLOC(X)=CARRIED PRINT "OK." TIMING CNTCARRY DONEACT=1 ITEMTAKEN=1 Exit ENDIF IF WEIGHT=XCARRY THEN ITEMTAKEN=2 EXIT ENDIF ENDIF ENDIF IF TEMPWORD = NT$(1) AND LEN(ITEMSYM(X)) = 1 THEN ITEMTAKEN = 3 ENDIF NEXT X IF ITEMTAKEN=3 Then If FF=0 AND CONCHECK=1 AND !RFLAG(0) AND !RFLAG(1) AND GH=0 Then PRINT "I CAN''T DO THAT...YET" Else Print "IT IS BEYOND MY POWER TO DO THAT." ENDIF ENDIF IF ITEMTAKEN=2 THEN PRINT "I AM ALREADY CARRYING TOO MUCH." IF ITEMTAKEN=0 THEN PRINT "I DON''T SEE THAT HERE." RETURN LABEL DROPOBJ: CARRYING=0 TEMPWORD="" FOR X=0 TO XITEM IF ITEMLOC(X)=CARRIED Then TEMPOBJ=UCASE$(Item(X)) CP=InStr(TEMPOBJ,NT$(1)) If CP>0 Then TEMPWORD=Mid(TEMPOBJ,CP,3) If TEMPWORD=NT$(1) AND LEN(ITEMSYM(X))>1 OR NT$(1)=ITEMSYM(X) Then If CP>0 Then NT$(1)=ITEMSYM(X) ITEMLOC(X)=MYLOC Print "OK." ''GOSUB CALCSCORE DONEACT=1 CNTCARRY CARRYING=1 TIMING Exit Else IF TEMPWORD=NT$(1) AND LEN(ITEMSYM(X))=0 THEN PRINT "IT IS BEYOND MY POWER TO DO THAT." CARRYING=1 ENDIF ENDIF ENDIF TEMPWORD="" ENDIF If CARRYING=1 THEN Exit NEXT X IF CARRYING=0 THEN PRINT "I AM NOT CARRYING THAT." ENDIF Return LABEL CALCSCORE: II=0 SCORE=0 While (II<=XITEM) If (ITEMLOC(II)=XTRESRM) && (LEFT$(ITEM(II))="*") Then SCORE=SCORE+1 ENDIF II=II+1 Wend Return LABEL ADVEXIT: PAUSE FUNC TIMING() A=TIMER WHILE TIMER RECT 189,0,199,15,0 FILLED RECT 189,0,199,15,15 FILLED Wend END End FUNC CNTCARRY() CC=0 WEIGHT=0 While CC<=XITEM If ITEMLOC(CC)=CARRIED Then WEIGHT=WEIGHT+1 ENDIF CC=CC+1 Wend End FUNC MSGROUTINE() DIM MLINE(500) MSGLN=LEN(MSGXFER) For I=1 TO MSGLN MLINE(I)=MID(MSGXFER,I,1) Next I EPOS=39 SPOS=1 MSGTRUE=1 WHILE MSGTRUE=1 While MLINE(EPOS)<>" " EPOS=EPOS-1 WEND FOR I=SPOS TO EPOS If MLINE(I)=Chr(10) Then MLINE(I)=Chr(32) ENDIF PRINT MLINE(I); NEXT I Print LNPOS=LNPOS+1 EPOS=EPOS+1 SPOS=EPOS EPOS=EPOS+39 IF EPOS>=MSGLN THEN FOR II=SPOS TO MSGLN PRINT MLINE(II); NEXT II Print LNPOS=LNPOS+1 MSGTRUE=0 ENDIF Wend CHARPOS=0 End FUNC LOADGAME FHAND=FreeFile Open GAMENAME For Input AS #FHAND For SG=0 TO 100 INPUT #FHAND;ROOMSAVE(SG) Next SG For SG=0 TO 100 INPUT #FHAND;COUNTERS(SG) Next SG For SG=0 TO 100 INPUT #FHAND;BITFLAG(SG) Next SG For SG=0 TO 200 INPUT #FHAND;ITEMLOC(SG) Next SG INPUT #FHAND;CCOUNTER INPUT #FHAND;WEIGHT INPUT #FHAND;SAVEROOM INPUT #FHAND;MYLOC Input #FHAND;LANTERN Close #FHAND GoTo GAMELOADED End FUNC SAVEGAME FHAND=FreeFile If EXIST(GAMENAME) Then Kill GAMENAME ENDIF Open GAMENAME For OUTPUT AS #FHAND For SG=0 TO 100 Print #FHAND,ROOMSAVE(SG) Next SG For SG=0 TO 100 Print #FHAND,COUNTERS(SG) Next SG For SG=0 TO 100 Print #FHAND,BITFLAG(SG) Next SG For SG=0 TO 200 Print #FHAND,ITEMLOC(SG) Next SG Print #FHAND,CCOUNTER Print #FHAND,WEIGHT Print #FHAND,SAVEROOM Print #FHAND,MYLOC Print #FHAND,LANTERN Close #FHAND End ' End>RMK449.sb< Start>RMK765.sb< LDGraphicsWindow.Closing = OnGWClosing T = "True" F = "False" GraphicsWindow.Show() LDGraphicsWindow.ExitOnClose = F Sub OnGWClosing DPE = LDDialogs.Confirm("Es können Daten verlohren gehen. Trotzdem Programm beenden?", "Programm beenden") If DPE = "No" Or DPE = "Cancel" Then LDGraphicsWindow.CancelClose = T EndIf EndSub 'OnGWClosing End>RMK765.sb< Start>RML443.sb< TextWindow.WriteLine("enter month: ") month = TextWindow.Read() TextWindow.WriteLine("How many liters of oil occurred in the month of: " + month) liters = TextWindow.Read() TextWindow.WriteLine(" on june produced " + liters + " liters of oil") diameter = 60 height = 92 total_capacity_cm3 = (Math.Pi * Math.Power(30,2) * height) total_capacity_cm3 = Math.Round(total_capacity_cm3) TextWindow.WriteLine(" Total capacity in cm3 per barrel is: " + total_capacity_cm3) net_capacity_cm3 = (Math.Pi * Math.Power(30,2) * (height - 10)) net_capacity_cm3 = Math.Round(net_capacity_cm3) TextWindow.WriteLine(" Net capacity in cm3 per barrel is : " + net_capacity_cm3) net_capacity_lit = (net_capacity_cm3 / 1000) net_capacity_lit = Math.Round(net_capacity_lit) TextWindow.WriteLine(" Net capacity in liters per barrel is: " + net_capacity_lit) TextWindow.WriteLine(" each barrel can contain: " + net_capacity_lit + "liters") net_vol = liters / net_capacity_lit net_vol = Math.Round(net_vol) TextWindow.WriteLine(" needed barrels: " + net_vol) End>RML443.sb< Start>RMN315.sb< init() txx=LDText.Split(" 10 input a; 20 input b; 30 print a+b; 40 print a-b;110 input a;120 input b;130 print a+b;140 print a-b;210 input a;220 input b;230 print a+b;240 print a-b;310 input a;320 input b;330 print a+b;340 print a-b;410 input a;420 input b;430 print a+b;440 print a-b;510 input a;520 input b;530 print a+b;540 print a-b;600 input a;605 input b;610 input c;620 poke a,b;630 poke c,d;640 peek b,c;650 ld a,b;700 input a;705 input b;710 input c;720 poke a,b;730 poke c,d;740 peek b,c;750 ld a,b;760 and a;770 rra;780 scf;800 input a;805 input b;810 input c;820 poke a,b;830 poke c,d;840 peek b,c;850 ld a,b;900 input a;905 input b;910 input c;920 poke a,b;930 poke c,d;940 peek b,c;950 ld l,h; " ";") ltx=Array.GetItemCount(txx) GraphicsWindow.KeyDown=kyy For xx=1 To Array.GetItemCount(txx) oxx=(xx-1)*40 txx[xx]=Text.GetSubText(txx[xx]+" ",1 40) tof=xx+off For m=1 To 40 sss[oxx+m]=text.GetSubText( txx[tof] m 1) If m<5 Then att[oxx+m]=3 Else att[oxx+m]=2 EndIf EndFor EndFor Goto cct iii: ox=880 cct: kkk="true If ox>0 Then For qa=1 To 22 For ww=1 To Array.GetItemCount(sss)-40 LDArray.SetValue(as1 ww ldarray.GetValue (as1 ww+40)) LDArray.SetValue(aa1 ww ldarray.GetValue (aa1 ww+40)) EndFor For ww= Array.GetItemCount(sss)-39 To Array.GetItemCount(sss) LDArray.SetValue(as1 ww " ") LDArray.SetValue(aa1 ww 2) EndFor printbuf() 'Program.Delay(8) EndFor LDCall.Function5("print2" 1 22 " " "" "2222222222222222222222222222222222222222222222222222222") Else as1=LDArray.CreateFromValues(sss) aa1=LDArray.CreateFromValues(att) printbuf() EndIf LDCall.Function5("print2" 1 24 "Scroll?" "" "2444442") fft="true While kkk fx=1 yy=1 rrr=rrr+1 printbuf() Program.Delay(333) printbufi() Program.Delay(333) EndWhile LDCall.Function5("print2" 1 24 " " "" "222222222") off=off+880 If off>Array.GetItemCount(sss) Then ox=0 off=0 goto cct EndIf Goto iii Sub kyy kkk="false EndSub 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 Scroll LDUtilities.ShowErrors="false not="true=false;false=true ix="ABCDEFIOUGHJSQZTLNMKPRVWXY[1289563074>=+-:,`$/()^?*!@#&% " args=0 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 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 printbuf yy=0 fx=1 For f=1 To 920 qw=ldarray.GetValue( as1 f) c1=LDArray.GetValue( aa1 f) If qw=" " Then jm=jj[" "] Else 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 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 printbufi yy=0 fx=1 For f=1 To 920 qw=ldarray.GetValue( as1 f) c1=LDArray.GetValue( aa1 f) If qw=" " Then jm=jj[" "] Else If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=jj[qw] EndIf 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 print2b fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1s=args[5] For f=1 To Text.GetLength(tt) ix=fx+yy*40 args[4][ix]=text.GetSubText(tu f 1) args[5][ix]=text.GetSubText(c1s f 1) EndFor fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf 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 qw=" " Then jm=jj[" "] Else 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 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 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>RMN315.sb< Start>RMP814.sb< ' Full House Simulator 0.3 ' Copyright (c) 2012-2014 Nonki Takahashi. All rights reserved. ' ' History : ' 0.3 2014-01-06 Rewrote to check full house probability. () ' 0.2 2013-04-04 Modified for Challenge of the Month. (CZJ358-0) ' 0.1 2012-08-21 Created. (CZJ358) ' GraphicsWindow.Title = "Full House Simulator 0.3" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "Black" param = "left=80;top=10;caption=Times;cc=White;offset=60;length=4;" Controls_AddTextBox() tboxTry = retval Controls.SetTextBoxText(tboxTry, 100) GraphicsWindow.BrushColor = "White" txtResult = Shapes.AddText("Result") Shapes.Move(txtResult, 80, 40) txtResult = Shapes.AddText("") Shapes.Move(txtResult, 140, 40) GraphicsWindow.BrushColor = "Black" buttonTry = Controls.AddButton("Try", 220, 40) Cards_Init() ideck = 0 clicked = "False" Controls.ButtonClicked = OnButtonClicked While "True" If clicked Then clicked = "False" nTry = Controls.GetTextBoxText(tboxTry) nFullHouse = 0 For iTry = 1 To nTry RecombineCards() col = 1 row = 2 ShuffleCards() DrawCards() CheckCards() Shapes.SetText(txtResult, nFullHouse + "/" + iTry) If fullhouse Then nFullHouse = nFullHouse + 1 Program.Delay(1500) Else Program.Delay(50) EndIf EndFor EndIf EndWhile Sub OnButtonClicked clicked = "True" EndSub Sub DrawCards For i = 1 To 5 If ideck < nSuites * nNumbers Then ideck = ideck + 1 index = deck[ideck] field[i] = index Cards_Move() Cards_Open() col = col + 1 If nNumbers < col Then col = 1 row = row + 1 EndIf EndIf EndFor EndSub Sub CheckCards fullhouse = "False" kind = "" For i = 1 To 5 num = Math.Remainder(field[i] - 1, 13) + 1 kind[num] = kind[num] + 1 EndFor nKind = Array.GetItemCount(kind) iKind = Array.GetAllIndices(kind) If nKind = 2 And (kind[iKind[1]] = 2 Or kind[iKind[1]] = 3) Then fullhouse = "True" EndIf EndSub Sub RecombineCards col = 1 row = 1 For index = 1 To nSuites * nNumbers Cards_Close() Cards_Move() EndFor EndSub Sub ShuffleCards ' Shuffle cards For i = 1 To nSuites * nNumbers / 2 i1 = Math.GetRandomNumber(nSuites * nNumbers) i2 = Math.GetRandomNumber(nSuites * nNumbers) Cards_Swap() EndFor ideck = 1 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 pattern = "color=DarkBlue;code=2591;" 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 = "MS UI Gothic" 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 deck[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.Move(cards[index]["oCard"], x, y) Shapes.Move(cards[index]["oSuite"], x + cards["xs"], y + cards["ys"]) Shapes.Move(cards[index]["oNumber"], x + cards["xn"], y + cards["yn"]) Shapes.Move(cards[index]["oCard2"], x, y) Shapes.Move(cards[index]["oPattern"], x + cards["xn"], y + cards["yn"]) EndSub Sub Cards_Swap ' param i1, i2 - indices of two cards index = deck[i1] deck[i1] = deck[i2] deck[i2] = index 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 Sub Controls_AddTextBox ' Controls | Add text box with caption ' param["left"] - the x co-ordinate of the text box caption ' param["top"] - the y co-ordinate of the text box ' param["caption"] - caption of the text box ' param["offset"] - optional offset for the text box from the left ' param["length"] - optional character length for the text box ' param["cc"] - optional caption color ' return retval - the text box just added fs = GraphicsWindow.FontSize len = Text.GetLength(param["caption"]) If param["cc"] <> "" Then bc = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = param["cc"] EndIf tboxCaption = Shapes.AddText(param["caption"]) Shapes.Move(tboxCaption, param["left"], param["top"] + fs * 0.2) If param["cc"] <> "" Then GraphicsWindow.BrushColor = bc EndIf offset = param["offset"] If offset = "" Then offset = len * fs * 0.9 EndIf retval = Controls.AddTextBox(param["left"] + offset, param["top"]) tboxLen = param["length"] If tboxLen <> "" Then tboxWidth = (tboxLen + 1) * fs * 0.9 tboxHeight = fs * 2 Controls.SetSize(retval, tboxWidth, tboxHeight) EndIf EndSub End>RMP814.sb< Start>RMQ470.sb< init() input() Sub init TextWindow.Title = "Word counter" separator = " " 'a space. infinity = 12548547896547548798554 ' :D dir = Program.Directory txtExt = ".txt" EndSub Sub input txtFileName = "" txtfiles = "" files = "" filecount = 1 TextWindow.WriteLine("Select a file number to count words.") ' The following line could be harmful and has been automatically commented. ' files = File.GetFiles(dir) For i = 1 To Array.GetItemCount(files) If Text.IsSubText(files[i],txtExt) Then txtfiles[filecount] = files[i] filecount = filecount + 1 EndIf EndFor For i = 1 To Array.GetItemCount(txtfiles) j = Text.GetLength(txtfiles[i]) char = "" While char <> "\" char = Text.GetSubText(txtfiles[i],j,1) If char <> "\" Then txtFileName[i] = Text.Append(char,txtFileName[i]) EndIf j = j - 1 EndWhile TextWindow.WriteLine(i+">"+txtFileName[i]) EndFor fileSelection = TextWindow.ReadNumber() If fileSelection > Array.GetItemCount(txtFileName) Or fileSelection < 1 Then TextWindow.WriteLine("Wrong Selection... Please Try again with correct file number.") IntractWithUser() Else ' The following line could be harmful and has been automatically commented. ' textString = File.ReadContents(txtfiles[fileSelection]) EndIf TextWindow.WriteLine("___________________________________________") wordCount() EndSub Sub wordCount count = 0 index = infinity While index <> 0 index = Text.GetIndexOf(textString,separator) If index = 1 Then While index = 1 index = Text.GetIndexOf(textString,separator) textString = Text.GetSubTextToEnd(textString,index+1) EndWhile Else textString = Text.GetSubTextToEnd(textString,index+1) EndIf count = count + 1 EndWhile printResult() EndSub Sub printResult TextWindow.WriteLine(" ") TextWindow.WriteLine("There are "+count+" word in your text file. ["+txtFileName[fileSelection]+"]") IntractWithUser() EndSub Sub IntractWithUser TextWindow.WriteLine(" ") TextWindow.WriteLine("Do you want to count words in another text file?") TextWindow.WriteLine("Press [Y] for yes [N] for no.") TextWindow.WriteLine(" ") userInput = TextWindow.ReadKey() If userInput = "n" Or userInput = "N" Then TextWindow.WriteLine("Good Bye...!!!") ElseIf userInput = "y" or userInput = "Y" Then input() Else TextWindow.WriteLine("Are you drunked..? Try again if it was a mistake.") IntractWithUser() EndIf EndSub End>RMQ470.sb< Start>RMR079.sb< 'Window GraphicsWindow.Hide() GraphicsWindow.Width = 800 GraphicsWindow.Height = 500 GraphicsWindow.Left = (Desktop.Width - 800) / 2 GraphicsWindow.Top = (Desktop.Height - 574) / 2 GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "Basic Challenges" GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(50, 50, 50) GraphicsWindow.FontBold = "False" GraphicsWindow.FontName = "Microsoft Sans Serif" GraphicsWindow.PenWidth = 1 'Variables CurrentMenu = "" CountValue = 10 PbZoomLevel = 1.0 LsPbWidth = 0 TwCursorLeft = 0 TwCursorTop = 0 MsgHighlightShown = "False" 'Colors BasicDark = GraphicsWindow.GetColorFromRGB(50, 50, 50) TextLightDark = GraphicsWindow.GetColorFromRGB(200, 200, 200) BackgroundLightDark = GraphicsWindow.GetColorFromRGB(100, 100, 100) BorderDark = GraphicsWindow.GetColorFromRGB(150, 150, 150) 'Main GraphicsWindow.Show() AddLoadingScreen() 'Images Load_ImgBtnBack = ImageList.LoadImage("https://account.windowsazure.com/Content/5.15.0.82-.307108.160119-1818/aux-pre/images/button-back.png") AddProgressLsPb() Load_ImgArrow = ImageList.LoadImage("http://iconizer.net/files/Gloss_Basic_Icons/orig/arrow-up.png") AddProgressLsPb() Load_ImgLeftArrow = ImageList.LoadImage("http://www.theozoneradio.com/SeniorProject/img/computer_key_Arrow_Left.png") AddProgressLsPb() Load_ImgRightArrow = ImageList.LoadImage("http://www.theozoneradio.com/SeniorProject/img/computer_key_Arrow_Right.png") AddProgressLsPb() Load_ImgDice = ImageList.LoadImage("http://cliparts.co/cliparts/rcj/rao/rcjraoqoi.png") AddProgressLsPb() Load_ImgWSAD = ImageList.LoadImage("http://s3.amazonaws.com/gifpumper/ui/wasd.png") AddProgressLsPb() Load_ImgExit = ImageList.LoadImage("http://iconizer.net/files/realistiK_Reloaded/orig/exit.png") AddProgressLsPb() Load_ImgActive = ImageList.LoadImage("http://megaicons.net/static/img/icons_title/64/160/title/0007-tick-icon.png") AddProgressLsPb() Load_ImgInactive = ImageList.LoadImage("https://cdn2.iconfinder.com/data/icons/function_icon_set/cancel_48.png") AddProgressLsPb() Controls.SetSize(LsProgressB, 498, 6) Program.Delay(500) GraphicsWindow.Clear() AddMainMenu() 'Subroutines - Custom '******************** 'AddLoadingScreen Sub AddLoadingScreen CurrentMenu = "LoadingScreen" Load_ImgData = ImageList.LoadImage("http://www.design.ddarsow.com/images/recover.png") GraphicsWindow.DrawResizedImage(Load_ImgData, 300, 30, 200, 200) GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark BorderInfoBox = Shapes.AddRectangle(300, 30) Shapes.Move(BorderInfoBox, 250, 252) GraphicsWindow.BrushColor = TextLightDark LabelInfo = Shapes.AddText("Loading resources") Shapes.Move(LabelInfo, 345, 260) GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark LsPbBack = Shapes.AddRectangle(500, 8) Shapes.Move(LsPbBack, 150, 300) GraphicsWindow.PenColor = TextLightDark GraphicsWindow.BrushColor = TextLightDark LsProgressB = Shapes.AddRectangle(0, 6) Shapes.Move(LsProgressB, 151, 301) EndSub 'AddProgressLsPb Sub AddProgressLsPb LsPbWidth = LsPbWidth + 55.5 Controls.SetSize(LsProgressB, LsPbWidth, 6) EndSub 'AddMainMenu Sub AddMainMenu CurrentMenu = "MainMenu" GraphicsWindow.BackgroundColor = BasicDark GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark BorderTitle = Shapes.AddRectangle(300, 30) Shapes.Move(BorderTitle, 250, 117) GraphicsWindow.BrushColor = TextLightDark TitleMainMenu = Shapes.AddText("Select a program") Shapes.Move(TitleMainMenu, 350, 125) GraphicsWindow.BrushColor = "Black" For Times = 1 To 4 BtnMainMenu[Times] = Controls.AddButton("", 300, 150 + Times * 40) Controls.SetSize(BtnMainMenu[Times], 200, 25) EndFor CaptionsBtnMM = "1=Countdown;2=Background color;3=Move X;4=Shapes;" For Times = 1 To Array.GetItemCount(CaptionsBtnMM) Controls.SetButtonCaption(BtnMainMenu[Times], CaptionsBtnMM[Times]) EndFor BtnExit = Controls.AddButton("", 375, 370) Controls.SetSize(BtnExit, 50, 50) Shapes.SetOpacity(BtnExit, 0) GraphicsWindow.DrawResizedImage(Load_ImgExit, 375, 370, 50, 50) GraphicsWindow.BrushColor = TextLightDark MmTooltip = Shapes.AddText("Exit") Shapes.Move(MmTooltip, 390, 425) Shapes.HideShape(MmTooltip) EndSub 'LoadCountdownSoft Sub LoadCountdownSoft CurrentMenu = "Countdown" ImportBtnBack() GraphicsWindow.PenColor = BackgroundLightDark GraphicsWindow.BrushColor = BasicDark PbBackground = Shapes.AddRectangle(800, 7) Shapes.Move(PbBackground, 0, 246) GraphicsWindow.BrushColor = BackgroundLightDark PbCountdown = Shapes.AddRectangle(800, 5) Shapes.Move(PbCountdown, 0, 247) GraphicsWindow.BrushColor = "LightGreen" GraphicsWindow.FontSize = 50 LabelCount = Shapes.AddText("10") Shapes.Move(LabelCount, 385, 180) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 12 BtnStartTimer = Controls.AddButton("Start", 350, 280) Controls.SetSize(BtnStartTimer, 100, 25) EndSub 'ResetCountdown Sub ResetCountdown Shapes.SetText(LabelCount, 10) Shapes.Zoom(PbCountdown, 1, 1) Shapes.ShowShape(PbCountdown) CountValue = 10 PbZoomLevel = 1.0 EndSub 'LoadBackgroundClrSoft Sub LoadBackgroundClrSoft CurrentMenu = "BackgroundColor" ImportBtnBack() GraphicsWindow.PenColor = "Black" For Times = 1 To 17 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(80 + Times * 40, 5, 30, 30) RectangleColors[Times] = Shapes.AddRectangle(30, 30) Shapes.Move(RectangleColors[Times], 80 + Times * 40, 5) EndFor ImgArrow = Shapes.AddImage(Load_ImgArrow) Shapes.Move(ImgArrow, 119, 40) ScannedPixel = GraphicsWindow.GetPixel(140, 30) GraphicsWindow.BackgroundColor = ScannedPixel GraphicsWindow.DrawResizedImage(Load_ImgLeftArrow, 175, 250, 200, 200) GraphicsWindow.DrawResizedImage(Load_ImgRightArrow, 425, 250, 200, 200) GraphicsWindow.BrushColor = BasicDark GraphicsWindow.DrawBoundText(225, 300, 100, "Press the left arrow key to scroll left.") GraphicsWindow.DrawBoundText(475, 300, 100, "Press the right arrow key to scroll right.") GraphicsWindow.DrawResizedImage(Load_ImgDice, 350, 100, 100, 100) Line1 = Shapes.AddRectangle(150, 1) Shapes.Move(Line1, 325, 75) Line2 = Shapes.AddRectangle(150, 1) Shapes.Move(Line2, 325, 225) Line3 = Shapes.AddRectangle(1, 150) Shapes.Move(Line3, 325, 75) Line4 = Shapes.AddRectangle(1, 150) Shapes.Move(Line4, 475, 75) BtnRollDice = Controls.AddButton("", 325, 75) Controls.SetSize(BtnRollDice, 150, 150) Shapes.SetOpacity(BtnRollDice, 30) GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark BackLabelInfo = Shapes.AddRectangle(70, 30) Shapes.Move(BackLabelInfo, 45, 5) GraphicsWindow.BrushColor = TextLightDark LabelInfo = Shapes.AddText("Colors:") Shapes.Move(LabelInfo, 60, 13) EndSub 'LoadMoveAnXSoft Sub LoadMoveAnXSoft CurrentMenu = "MoveAnX" ImportBtnBack() GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark BackImgWSAD = Shapes.AddRectangle(400, 300) Shapes.Move(BackImgWSAD, 200, 100) ImgWSAD = Shapes.AddImage(Load_ImgWSAD) Shapes.Move(ImgWSAD, 250, 150) TextWindow.Title = "Move an X" TextWindow.Left = 0 TextWindow.Top = 0 GraphicsWindow.BrushColor = TextLightDark GraphicsWindow.DrawText(265, 80, "Use these keys to move the X in the TextWindow") GraphicsWindow.BrushColor = "Black" BtnActivateKeys = Controls.AddButton("Activate keys", 325, 410) Controls.SetSize(BtnActivateKeys, 150, 25) ImgInactive = Shapes.AddImage(Load_ImgInactive) Shapes.Move(ImgInactive, 485, 400) UpdateXPos() EndSub 'ActivateWSADKeys Sub ActivateWSADKeys Shapes.Remove(ImgInactive) Shapes.SetOpacity(BtnActivateKeys, 50) GraphicsWindow.DrawImage(Load_ImgActive, 485, 400) Controls.SetButtonCaption(BtnActivateKeys, "Activated") EndSub 'UpdateXPos Sub UpdateXPos If TwCursorLeft = -1 Then TwCursorLeft = 0 UpdateXPos() ElseIf TwCursorTop = -1 Then TwCursorTop = 0 UpdateXPos() ElseIf TwCursorLeft = 79 Then TwCursorLeft = 78 UpdateXPos() ElseIf TwCursorTop = 299 Then TwCursorTop = 288 UpdateXPos() Else TextWindow.Clear() TextWindow.CursorLeft = TwCursorLeft TextWindow.CursorTop = TwCursorTop TextWindow.WriteLine("X") EndIf EndSub 'LoadShapesAndFileSoft Sub LoadShapesAndFileSoft CurrentMenu = "ShapesAndFile" ResetShapeValues() ImportBtnBack() GraphicsWindow.BrushColor = "Black" TbMain = Controls.AddMultiLineTextBox(0, 40) Controls.SetSize(TbMain, 400, 460) GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark RectangleWorkspace = Shapes.AddRectangle(400, 460) Shapes.Move(RectangleWorkspace, 400, 40) GraphicsWindow.BrushColor = "Black" BtnDefault = Controls.AddButton("Default", 45, 7) Controls.SetSize(BtnDefault, 100, 25) BtnClear = Controls.AddButton("Clear", 155, 7) Controls.SetSize(BtnClear, 100, 25) If MsgHighlightShown = "False" Then GraphicsWindow.ShowMessage("Highlight effect has been removed from Back button to prevent crash.", "Information") MsgHighlightShown = "True" EndIf EndSub 'ResetShapeValues Sub ResetShapeValues DataLine[1] = "#Rectangle" DataLine[2] = "Width = 100" DataLine[3] = "Height = 100" DataLine[4] = "Left = 10" DataLine[5] = "Top = 10" DataLine[6] = "Pen color = LightGray" DataLine[7] = "Brush color = RoyalBlue" ' The following line could be harmful and has been automatically commented. ' FilePath = File.GetTemporaryFilePath() + "Document.txt" For Times = 1 To Array.GetItemCount(DataLine) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(FilePath, Times, DataLine[Times]) EndFor EndSub 'DrawShapesLayout Sub DrawShapesLayout TxtShapes = Controls.GetTextBoxText(TbMain) GraphicsWindow.PenColor = BorderDark GraphicsWindow.BrushColor = BackgroundLightDark RectangleWorkspace = Shapes.AddRectangle(400, 460) Shapes.Move(RectangleWorkspace, 400, 40) If TxtShapes = "" Then GraphicsWindow.ShowMessage("There are no shapes to be drawn.", "Information") Else ' The following line could be harmful and has been automatically commented. ' File.WriteContents(FilePath, TxtShapes) ' The following line could be harmful and has been automatically commented. ' Shape_Type = Text.GetSubTextToEnd(File.ReadLine(FilePath, 1), 2) ' The following line could be harmful and has been automatically commented. ' Shape_Width = Text.GetSubTextToEnd(File.ReadLine(FilePath, 2), 9) ' The following line could be harmful and has been automatically commented. ' Shape_Height = Text.GetSubTextToEnd(File.ReadLine(FilePath, 3), 10) ' The following line could be harmful and has been automatically commented. ' Shape_Left = Text.GetSubTextToEnd(File.ReadLine(FilePath, 4), 8) ' The following line could be harmful and has been automatically commented. ' Shape_Top = Text.GetSubTextToEnd(File.ReadLine(FilePath, 5), 7) ' The following line could be harmful and has been automatically commented. ' Shape_PenColor = Text.GetSubTextToEnd(File.ReadLine(FilePath, 6), 13) ' The following line could be harmful and has been automatically commented. ' Shape_BrushColor = Text.GetSubTextToEnd(File.ReadLine(FilePath, 7), 15) GraphicsWindow.PenColor = Shape_PenColor GraphicsWindow.BrushColor = Shape_BrushColor If Shape_Type = "Rectangle" Then VisibleShape = Shapes.AddRectangle(Shape_Width, Shape_Height) ElseIf Shape_Type = "Ellipse" Then VisibleShape = Shapes.AddEllipse(Shape_Width, Shape_Height) ElseIf Shape_Type = "Triangle" Then VisibleShape = Shapes.AddTriangle(0, 100, 75, 0, 150, 100) Controls.SetSize(VisibleShape, Shape_Width, Shape_Height) EndIf If Shape_Left < 1 Or Shape_Left > 400 - Shape_Width Then Shapes.Move(VisibleShape, 401, Shape_Top + 40) ElseIf Shape_Top < 1 Or Shape_Top > 460 - Shape_Height Then Shapes.Move(VisibleShape, Shape_Left + 400, 41) ElseIf Shape_Left = 0 Then Shapes.Move(VisibleShape, 400, Shape_Top + 40) ElseIf Shape_Top = 0 Then Shapes.Move(VisibleShape, Shape_Left + 400, 40) Else Shapes.Move(VisibleShape, Shape_Left + 400, Shape_Top + 40) EndIf EndIf EndSub 'ImportBtnBack Sub ImportBtnBack GraphicsWindow.BrushColor = TextLightDark EffectImgBtnBack = Shapes.AddEllipse(30, 30) Shapes.Move(EffectImgBtnBack, 5, 5) Shapes.HideShape(EffectImgBtnBack) ImgBtnBack = Shapes.AddImage(Load_ImgBtnBack) Shapes.Move(ImgBtnBack, 5, 5) BtnBack = Controls.AddButton("", 5, 5) Controls.SetSize(BtnBack, 30, 30) Shapes.SetOpacity(BtnBack, 0) EndSub 'Subroutines - System '******************** 'ButtonClicked Controls.ButtonClicked = ButtonClicked Sub ButtonClicked LastBtn = Controls.LastClickedButton If LastBtn = BtnMainMenu[1] Then GraphicsWindow.Clear() LoadCountdownSoft() ElseIf LastBtn = BtnMainMenu[2] Then GraphicsWindow.Clear() LoadBackgroundClrSoft() ElseIf LastBtn = BtnMainMenu[3] Then GraphicsWindow.Clear() LoadMoveAnXSoft() ElseIf LastBtn = BtnMainMenu[4] Then GraphicsWindow.Clear() LoadShapesAndFileSoft() ElseIf LastBtn = BtnExit Then Program.End() ElseIf LastBtn = BtnStartTimer Then If Controls.GetButtonCaption(BtnStartTimer) = "Start" Then Controls.SetButtonCaption(BtnStartTimer, "Pause") ResetCountdown() Timer.Resume() ElseIf Controls.GetButtonCaption(BtnStartTimer) = "Resume" Then Timer.Resume() Controls.SetButtonCaption(BtnStartTimer, "Pause") Else Timer.Pause() Controls.SetButtonCaption(BtnStartTimer, "Resume") EndIf ElseIf LastBtn = BtnBack Then If CurrentMenu = "MoveAnX" Then TextWindow.Hide() TwCursorLeft = 0 TwCursorTop = 0 EndIf GraphicsWindow.Clear() ResetCountdown() Timer.Pause() AddMainMenu() ElseIf LastBtn = BtnRollDice Then Sound.PlayClick() For Times = 1 To 17 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(80 + Times * 40, 5, 30, 30) RectangleColors[Times] = Shapes.AddRectangle(30, 30) Shapes.Move(RectangleColors[Times], 80 + Times * 40, 5) EndFor PointerLeft = Shapes.GetLeft(ImgArrow) CurrentPixel = GraphicsWindow.GetPixel(PointerLeft + 15, 30) GraphicsWindow.BackgroundColor = CurrentPixel ElseIf LastBtn = BtnActivateKeys Then ActivateWSADKeys() ElseIf LastBtn = BtnDefault Then ResetShapeValues() ' The following line could be harmful and has been automatically commented. ' FileContents = File.ReadContents(FilePath) Controls.SetTextBoxText(TbMain, FileContents) DrawShapesLayout() ElseIf LastBtn = BtnClear Then Controls.SetTextBoxText(TbMain, "") EndIf EndSub 'MouseDown GraphicsWindow.MouseDown = MouseDown Sub MouseDown MouseX = GraphicsWindow.MouseX MouseY = GraphicsWindow.MouseY If CurrentMenu = "BackgroundColor" Then If MouseY > 0 And MouseY < 45 Then CurrentPixel = GraphicsWindow.GetPixel(MouseX, MouseY) If CurrentPixel = "#000000" Then Else Sound.PlayClick() GraphicsWindow.BackgroundColor = CurrentPixel For Times = 140 To 800 ScannedPixel = GraphicsWindow.GetPixel(Times, 30) If ScannedPixel = CurrentPixel Then Shapes.Move(ImgArrow, Times - 30, 40) EndIf EndFor EndIf EndIf EndIf EndSub 'MouseMove GraphicsWindow.MouseMove = MouseMove Sub MouseMove MouseX = GraphicsWindow.MouseX MouseY = GraphicsWindow.MouseY If CurrentMenu = "MainMenu" Then If MouseX > 375 And MouseX < 425 And MouseY > 370 And MouseY < 420 Then Shapes.ShowShape(MmTooltip) Else Shapes.HideShape(MmTooltip) EndIf ElseIf CurrentMenu = "ShapesAndFile" Then Else If MouseX > 5 And MouseX < 35 And MouseY > 5 And MouseY < 35 Then Shapes.ShowShape(EffectImgBtnBack) Else Shapes.HideShape(EffectImgBtnBack) EndIf EndIf EndSub 'KeyDown GraphicsWindow.KeyDown = KeyDown Sub KeyDown LastKey = GraphicsWindow.LastKey If CurrentMenu = "BackgroundColor" Then PointerLeft = Shapes.GetLeft(ImgArrow) If LastKey = "Left" Then If PointerLeft > 140 Then Shapes.Move(ImgArrow, PointerLeft - 40, 40) CurrentPixel = GraphicsWindow.GetPixel(PointerLeft - 10, 30) GraphicsWindow.BackgroundColor = CurrentPixel EndIf ElseIf LastKey = "Right" Then If PointerLeft < 740 Then Shapes.Move(ImgArrow, PointerLeft + 40, 40) CurrentPixel = GraphicsWindow.GetPixel(PointerLeft + 50, 30) GraphicsWindow.BackgroundColor = CurrentPixel EndIf EndIf EndIf If CurrentMenu = "MoveAnX" Then If LastKey = "D" Then TwCursorLeft = TwCursorLeft + 1 UpdateXPos() ElseIf LastKey = "A" Then TwCursorLeft = TwCursorLeft - 1 UpdateXPos() ElseIf LastKey = "W" Then TwCursorTop = TwCursorTop - 1 UpdateXPos() ElseIf LastKey = "S" Then TwCursorTop = TwCursorTop + 1 UpdateXPos() EndIf If TwCursorLeft > 0 Or TwCursorTop > 0 Then ActivateWSADKeys() EndIf EndIf EndSub 'TextTyped Controls.TextTyped = TextTyped Sub TextTyped DrawShapesLayout() EndSub 'Timer Timer.Tick = Tick Timer.Interval = 1000 Timer.Pause() Sub Tick Sound.PlayClick() CountValue = CountValue - 1 PbZoomLevel = PbZoomLevel - 0.1 Shapes.SetText(LabelCount, CountValue) Shapes.Zoom(PbCountdown, PbZoomLevel, 1) If CountValue = 0 Then Shapes.HideShape(PbCountdown) Controls.SetButtonCaption(BtnStartTimer, "Start") Timer.Pause() EndIf EndSub End>RMR079.sb< Start>RMR774.sb< args=0 cmd=0 mod=1 g0x=550 g0y=350 zz=1 GraphicsWindow.KeyDown =kdd GraphicsWindow.KeyUp=kuu GraphicsWindow.BackgroundColor="DarkGray GraphicsWindow.left=20 GraphicsWindow.top=20 GraphicsWindow .Width =900 GraphicsWindow .Height =950 GraphicsWindow.MouseMove=mww LDEvents.MouseWheel=www GraphicsWindow.BrushColor ="gray Ldcall.Function5 ("dRect" 300,600,700,500 0) Ldcall.Function5 ("dRect" 0,0,900,400 0) Ldcall.Function5 ("dRect" 0,200,900,50,1000) Ldcall.Function5 ("dRect", -300,600,420,500,0) GraphicsWindow.BrushColor ="green Ldcall.Function5 ("dRect" 400,700,700,500,0) Ldcall.Function5 ("dRect",-300,700,320,500,0) Ldcall.Function5 ("dRect" 0,0,900,300,0) tr=Shapes.AddTriangle(g0x-300,g0y ,g0x-200,g0y,g0x-250,g0y-80) tr1=Shapes.AddTriangle(0,0,80,0,40,60) 'LDShapes.ZIndex (tr 1000) LDShapes.ZIndex (tr1 1000) LDShapes.BrushColour(tr,"white") LDShapes.PenColour(tr,"Red") LDShapes.PenWidth (tr,7) LDShapes.Centre (tr,g0x+48,g0y-10) LDShapes.BrushColour(tr1,"white") LDShapes.PenColour(tr1,"Red") LDShapes.PenWidth (tr1,7) Shapes.HideShape(tr) GraphicsWindow.BrushColor ="White For x=1 to 8 Step 2 Ldcall.Function4 ("dRect" x*20+119,680,20,90) Ldcall.Function4 ("dRect" 450,400+x*22,90,20) endfor Ldcall.Function4 ("dRect" 210,800,90,25) g3x=30 g3y=780 g2x=450 g2y=300 g1x=350 g1y=680 GraphicsWindow.BrushColor="Darkblue" Ldcall.Function4 ("dRect" g1x-5,g1y,10,200) Ldcall.Function4 ("dRect" g0x+90,g0y-5,100,10) Ldcall.Function4 ("dRect" g2x-5,g2y,10,100) Ldcall.Function4 ("dRect" g3x+40,g3y-5,50,10) LDShapes.Centre (tr1,g1x,g1y-30) LDCall.Function4("tlmp",0,g1x+32,g1y+3*32,1) st=Shapes.AddText("→") LDShapes.Font(st,"Arial",55,"True","False") LDShapes.PenColour(st,"Black") LdShapes.Centre(st,g1x+15,g1y+91) rd1=LDControls.AddRadioButton("Normal","g1") rd2=LDControls.AddRadioButton("Train","g1") rd3=LDControls.AddRadioButton("Flash","g1") LDControls.RadioButtonSet(rd1) LDControls.RadioButtonClicked=rcc Shapes.Move (rd1,10,10) Shapes.Move (rd2,10,40) Shapes.Move (rd3,10,70) LDShapes.PenColour (rd1,"Cyan") LDShapes.PenColour (rd2,"Cyan") LDShapes.PenColour (rd3,"Cyan") For r=1 to 3 LDCall.Function4("tlmp",r,g1x,g1y+r*32,4-r) LDCall.Function4("tlmp",r+3,g0x+r*32,g0y,4-r) endfor LDCall.Function4("tlmp",10,g2x,g2y,3) LDCall.Function4("tlmp",11,g2x,g2y+32,1) LDCall.Function4("tlmp",13,g3x,g3y,3) LDCall.Function4("tlmp",14,g3x+32,g3y,1) Shapes.SetOpacity(bb[14][2],20) Shapes.SetOpacity(bb[11][2],20) Shapes.SetOpacity(bb[0][2],20) For x=1 to 100 If mod=3 Then'---------------flashing Shapes.SetOpacity(bb[0][2],20) For x=1 To 2 LDCall.Function2("setlmp","0 1 0",4) LDCall.Function2("setlmp","0 1 0",1) Program.Delay (250) LDCall.Function2("setlmp","0 0 0",4) LDCall.Function2("setlmp","0 0 0",1) Program.Delay (200) EndFor Program.Delay(400) ElseIf mod=2 then'-----------------------train dotrain() else'--------------------------------------------------------------------mode 1 norm Shapes.SetOpacity(bb[0][2],20) LDCall.Function2("setlmp","1 0 0",4) LDCall.Function2("setlmp","1 0 0",1) LDCall.Function2("setlmp","0 1",10)'----------pdest. go LDCall.Function2("setlmp","1 0",13)'----------pdest1. halt ldcall.function("idle",4000) LDCall.Function2("setlmp","1 1 0",1) ldcall.function("idle",2000) LDCall.Function2("setlmp","0 0 1",1) ldcall.function("idle",8000) LDCall.Function2("setlmp","0 1 0",1) ldcall.function("idle",3000) LDCall.Function2("setlmp","0 1",13)'----------pdest1. go LDCall.Function2("setlmp","1 0 0",1) LDCall.Function2("setlmp","1 0 0",4) ldcall.function("idle",7000) LDCall.Function2("setlmp","1 1 0",4) Shapes.SetOpacity(bb[0][2],100) LDCall.Function2("setlmp","1 0",10)'----------pdest. halt LDCall.Function2("setlmp","1 0",13)'----------pdest1. halt ldcall.function("idle",2000) LDCall.Function2("setlmp","0 0 1",4) ldcall.function("idle",8000) LDCall.Function2("setlmp","0 1 0",4) ldcall.function("idle",3000) endif endfor Sub dotrain Shapes.SetOpacity(bb[0][2],20) Shapes.ShowShape (tr) Shapes.HideShape(bb[6][1]) Shapes.HideShape(bb[6][2]) Shapes.HideShape(bb[5][1]) Shapes.HideShape(bb[4][1]) Shapes.SetOpacity (bb[4][2],100) Shapes.SetOpacity (bb[5][2],100) rm=Shapes.AddRectangle (15,190) pl=Shapes.GetLeft (tr)+g0x+20 pt= Shapes.GetTop (tr)+90 Shapes.Move(rm,pl,pt) ldShapes.BrushColour (bb[5][2],"red") aa=0 For x=1 to 15 For y=1 to 8 aa=aa+1 If aa>90 then aa=90 endif Program.Delay(50) ldShapes.BrushColour (bb[4][2],"black") ldShapes.BrushColour (bb[5][2],"red") LDShapes.RotateAbout (rm,pl,pt+180,-aa) endfor For y=1 to 8 aa=aa+1 If aa>90 then aa=90 endif Program.Delay(50) ldShapes.BrushColour (bb[5][2],"black") ldShapes.BrushColour (bb[4][2],"red") LDShapes.RotateAbout (rm,pl,pt+180,-aa) EndFor EndFor ldShapes.BrushColour (bb[5][2],"black") ldShapes.BrushColour (bb[4][2],"black") For x=1 to 30 LDShapes.RotateAbout (rm,pl,pt+180,-aa) Program.Delay (50) aa=aa-3 EndFor Program.Delay(5550) Shapes.HideShape (tr) ldShapes.BrushColour (bb[5][2],"Yellow") ldShapes.BrushColour (bb[4][2],"red") Shapes.showShape(bb[6][1]) Shapes.showShape(bb[6][2]) Shapes.showShape(bb[5][1]) Shapes.showShape(bb[4][1]) Shapes.Remove(rm) endsub Sub tlmp cc=args[1] cx=args[2] cy=args[3] cs=args[4] bb[cc][1]=Shapes.AddRectangle (32,32) bb[cc][2]=Shapes.AddEllipse (25,25) bb[cc][3]=cs For f=1 To 2 LDShapes.Centre(bb[cc][f],cx,cy) endfor LDShapes.BrushColour (bb[cc][1],"black") If cs=2 Then LDShapes.BrushColour (bb[cc][2],"yellow") elseIf cs=1 Then LDShapes.BrushColour (bb[cc][2],"#00ff00") else LDShapes.BrushColour (bb[cc][2],"red") EndIf endsub Sub setlmp ls=ldtext.split(args[1]," ") lc=args[2] Shapes.SetOpacity(bb[lc][2],ls[1]*80+20) Shapes.SetOpacity(bb[lc+1][2],ls[2]*80+20) Shapes.SetOpacity(bb[lc+2][2],ls[3]*80+20) EndSub Sub rcc lr= LDControls.RadioButtonGet (rd1 ) if lr Then mod=1 ElseIf LDControls.RadioButtonGet (rd2 ) then mod=2 Else mod=3 endIf endsub Sub idle For xy=1 To args[1] Step 50 Program.Delay (50) If mod<>1 Then goto xxx EndIf EndFor xxx: EndSub Sub mww GraphicsWindow.Title= "Traffic ligts V0.2"'GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY EndSub Sub www If ctt Then zz=zz+ldevents.LastMouseWheelDelta/10 else qq=qq+ LDEvents.LastMouseWheelDelta*5 EndIf LDGraphicsWindow.Reposition (zz zz 0 0 qq) EndSub Sub drect ll=Shapes.AddRectangle (args[3] args[4]) shapes.Move(ll args[1] args[2]) if args[5]<>0 then LDShapes.ZIndex (ll args[5]) endif EndSub Sub kdd kk =GraphicsWindow.LastKey If Text.IsSubText (kk, "Ctrl") Then ctt="true endif EndSub Sub kuu kk =GraphicsWindow.LastKey If Text.IsSubText (kk, "Ctrl") Then ctt="false endif EndSub End>RMR774.sb< Start>RMV445.sb< ''Lottery draw demo (20 unique numbers) '' WhTurner 2012-10-29 ''============================= speed=400 number=20 ''max 20 GraphicsWindow.Top=10 GraphicsWindow.Left=10 GraphicsWindow.Height=540 GraphicsWindow.Width=620 GraphicsWindow.Title="Demo lottery intro() GraphicsWindow.BackgroundColor="limegreen" GraphicsWindow.BrushColor="blue" r1= Shapes.AddEllipse(20,20) GraphicsWindow.FontSize=15 For i=1 To number ''numbers Set[i]=i If i<10 Then ii=text.Append(" ",i) Else ii=i EndIf GraphicsWindow.BrushColor="yellow" b[i]=shapes.AddEllipse(30,30) Shapes.Move(b[i],30*i-20,320) GraphicsWindow.BrushColor="black" c[i]=shapes.Addtext(ii) Shapes.Move(c[i],30*i-16,325) EndFor GraphicsWindow.DrawText(350,450,"Number of right draws") GraphicsWindow.DrawText(340,480,"Number of wrong draws") tt=Shapes.AddText(0) Shapes.Animate(tt,550,450,1) tw=Shapes.AddText(0) Shapes.Animate(tw,550,480,1) GraphicsWindow.PenColor="gray" For i=1 To number GraphicsWindow.DrawLine(270+3*i,40,30*i-5,310) GraphicsWindow.DrawLine(30*i-5,310,30*i-5,320) endfor GraphicsWindow.KeyDown=keys pau=1 While pau<>0 While pau<2 ''wait for spacekey Program.Delay(300) endwhile if pau=2 Then Shapes.Animate(r1,0,0,10) Program.Delay(speed) ElseIf pau=3 then shapes.Animate(r1,290,0,speed) Program.Delay(speed) EndIf draw= Math.GetRandomNumber(number) ''DRAW shapes.Animate(r1,290,0,speed) Program.Delay(speed) Shapes.Animate(r1,30*draw-15,300,speed) Program.Delay(100) pau=1+pau0 If Set[draw]<>" " then ''DRAW OK Set[draw]=" " Program.Delay(speed) Iset=Iset+1 Shapes.Animate(b[draw],Iset*30-25,400,speed) Shapes.Animate(c[draw],Iset*30-20,405,speed) Shapes.Animate(tt,666,450,1) tt=Shapes.AddText(Iset) Shapes.Animate(tt,550,450,1) If Iset>=number then GraphicsWindow.FontSize=100 GraphicsWindow.BrushColor="red" GraphicsWindow.DrawText(100,100,"R E A D Y") GraphicsWindow.FontSize=20 GraphicsWindow.DrawText(180,270,"Press Q to quit") pau=0 EndIf Else ''DRAW not OK pau=3 Iwrng=Iwrng+1 Shapes.Animate(tw,666,480,1) tw=Shapes.AddText(Iwrng) Shapes.Animate(tw,550,480,1) Program.Delay(speed) EndIf endwhile Sub keys key=GraphicsWindow.LastKey If Key="Space" then pau=2 ElseIf Key="Right" then If speed>100 then speed=speed-100 EndIf elseif Key="Left" then If speed<1000 then speed=speed+100 EndIf elseif Key="A" then pau=2 pau0=1 elseif Key="Q" then Program.End() endif endsub Sub intro GraphicsWindow.BrushColor="yellow" GraphicsWindow.BackgroundColor="steelblue" GraphicsWindow.FontSize=16 GraphicsWindow.DrawText(140,10,"Amimated simulation of a lottery with 20 numbers") GraphicsWindow.DrawText(10,40,"After the start pushing the spacebar draws a (unique) number") GraphicsWindow.DrawText(10,70," at any time key A let the program run Automatic to the end") GraphicsWindow.DrawText(10,160," the rigth arrow inceases the speed") GraphicsWindow.DrawText(10,180," the left arrow decreases the speed") GraphicsWindow.DrawText(10,230," key Q quits the animation") GraphicsWindow.ShowMessage("click OK to start","continue") GraphicsWindow.Clear() EndSub End>RMV445.sb< Start>RMW724.sb< gh = 700 gw = 700 GraphicsWindow.Height = gh GraphicsWindow.Width = gw Mouse.HideCursor() GraphicsWindow.BackgroundColor = "black" 'koridor dolen GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(50,600,600,50) 'dqsno GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(600,550,50,50) 'koridor sreden GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(50,500,600,50) 'lqvo GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(50,300,50,200) 'koridor goren GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(50,250,300,50) 'malko 1 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(350,250,36,12) 'malko 2 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(374,202,12,48) 'malko 3 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(338,190,48,12) 'malko 4 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(338,166,12,24) 'malko5 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(338,154,48,12) 'malko 6 GraphicsWindow.BrushColor = "cyan" GraphicsWindow.FillRectangle(374,130,12,24) '4erveno GraphicsWindow.BrushColor = "red" GraphicsWindow.FillRectangle(355,50,50,80) 'obekt-object GraphicsWindow.BrushColor ="blue" GraphicsWindow.PenColor = "blue" Object = Shapes.AddRectangle(9,9) GraphicsWindow.MouseMove = OnMouseMove Controls.ButtonClicked = OnButtonClicked 'deistvie na butona - button action button = Controls.AddButton("start",100,610) btncl = Controls.LastClickedButton Sub OnButtonClicked for btncl = button To 1 Controls.HideControl(button) OnMouseMove() endfor endsub 'na4alna poziciq - initial location Shapes.Move(Object,100,630) 'mestene na obekta s mishkata - mouse move Sub OnMouseMove ObjectX = GraphicsWindow.MouseX Shapes.Move(Object,ObjectY,ObjectX) ObjectY = GraphicsWindow.MouseY Shapes.Move(Object,ObjectX,ObjectY) EndSub End>RMW724.sb< Start>RNC789.sb< 'Declare/Initialize some variables hostPort = 4000 buffer = "" 'Initializes a server socket with a listening port. TCPServer.InitializeServer(hostPort) 'Attempts to start listening, if the function returns "1", it was succesful. If (TCPServer.Listen() = 1) Then TextWindow.WriteLine("Server listening on port " + hostPort + ".") TextWindow.Title = "Listening..." Else TextWindow.WriteLine("Unable to start server.") TextWindow.Pause() Program.End() EndIf 'The main infinite loop. Constantly polls a sub that checks for new data. While ("True") CheckForData() Program.Delay(1) EndWhile Sub CheckForData 'If the server receives new data, the NewData function will return 1. 'Sets the variable "buffer" equal to the data that was sent. 'Calls the HandleData sub to literally handle that data. If (TCPServer.NewData() = 1) Then buffer = TCPServer.GetBuffer() HandleData() EndIf EndSub Sub HandleData 'If the data sent is equal to "Ping!": 'notify the server and send the client a "Pong!" If (buffer = "Ping!") Then TextWindow.WriteLine("Client sent: " + buffer) TCPServer.SendDataToAll("Pong!") TextWindow.WriteLine("Server sent: Pong!") EndIf buffer = "" EndSub End>RNC789.sb< Start>RNF195.sb< ' Init Data Extension DataExtension.Init() ' Check for controller CFC = GameController.IsConnected If CFC = "True" Then Goto Begin ElseIf CFC = "False" Then ' DataExtension.ThrowException("Could not find any connnected controller, please exit this program and reconnect the controller.") ' USE ' IF NEEDED EndIf Begin: ' Init GameWindow and variables PicLink = "http://upload.wikimedia.org/" InfoPic = "wikipedia/commons/thumb/2/2c/360_controller.svg/500px-360_controller.svg.png" Pic = (PicLink + InfoPic) gw = 860 gh = 600 GameWindow.CanResize = "False" GameWindow.WindowStyle = "3DBorder" GameWindow.Title = "XBox to PC Controls! ~acenomad" GameWindow.BackgroundColor = "Honeydew" GameWindow.Width = gw GameWindow.Height = gh GameWindow.Left = (Desktop.Width - gw) / 2 GameWindow.Top = (Desktop.Height - gh) / 2 ' Init text boxes and GUI setup ' Init Shapes GameWindow.BrushColor = "Brown" GameControls.AddRectangle(860,0,240,560) ' Text Boxes GameWindow.BrushColor = "Black" A = GameControls.AddTextBox("A",40,20,100,20) ' A Button B = GameControls.AddTextBox("B",40,50,100,20) ' B Button X = GameControls.AddTextBox("X",40,80,100,20) ' X Button Y = GameControls.AddTextBox("Y",40,110,100,20) ' Y Button Bk = GameControls.AddTextBox("Q",40,140,100,20) ' Back Button St = GameControls.AddTextBox("W",40,170,100,20) ' Start Button RB = GameControls.AddTextBox("E",40,200,100,20) ' Right Bumper Button RT = GameControls.AddTextBox("R",40,230,100,20) ' Right Trigger Button LB = Gamecontrols.Addtextbox("T",40,260,100,20) ' Left Bumper Button LT = Gamecontrols.Addtextbox("U",40,290,100,20) ' Left Trigger Button LSU = GameControls.AddTextBox("I",40,320,100,20) ' Left Stick Up LSL = GameControls.AddTextBox("O",40,350,100,20) ' Left Stick Left LSD = GameControls.AddTextBox("P",40,380,100,20) ' Left Stick Down LSR = GameControls.AddTextBox("S",40,410,100,20) ' Left Stick Right DPU = GameControls.AddTextBox("D",40,440,100,20) ' D-Pad Up DPL = GameControls.AddTextBox("F",40,470,100,20) ' D-Pad Left DPD = GameControls.AddTextBox("G",40,500,100,20) ' D-Pad Down DPR = GameControls.AddTextBox("H",40,530,100,20) ' D-Pad Right RSU = GameControls.AddTextBox("J",400,20,100,20) ' Right Stick Up RSL = GameControls.AddTextBox("K",400,50,100,20) ' Right Sick Left RSD = GameControls.AddTextBox("L",400,80,100,20) ' Right Stick Down RSR = GameControls.AddTextBox("M",400,110,100,20) ' Right Stick Right GUD = GameControls.AddTextBox("N",400,140,100,20) ' Guide Button ViBR = GameControls.AddTextBox("0",400,170,100,20) ' Vibration Settings(Right) ViBL = GameControls.AddTextBox("0",400,200,100,20) ' Vibration Settings(Left) LSP = GameControls.AddTextBox("V",400,230,100,20) ' Left Stick Push Down RSP = GameControls.AddTextBox("C",400,260,100,20) ' Right Stick Push Down BaTB = GameControls.AddTextBox("N/A",990,30,100,20) ' Battery Level Text Box BaLB = GameControls.AddTextBox("N/A",990,60,100,20) ' Battery Type Text Box CCeB = GameControls.AddTextBox("N/A",990,90,100,20) ' Controller connected Text Box ViBBR = GameControls.AddTextBox("0",1035,120,60,20) ' Controller Vibration Text Box(Right) ViBBL = GameControls.AddTextBox("0",1035,150,60,20) ' Controller Vibration Text Box(Left) ' Draw Image(s) GameControls.AddImage(Pic,320,300) ' USE "Apostrophe( ' )" FOR FASTER LOADING ' Load text GameWindow.BrushColor = "Navy" GameControls.AddText("Legend:",500,280,"ComicSans",20,"False","True") GameControls.AddText("....A Button",150,20,"ComicSans",20,"False","True") Gamecontrols.addtext("....B Button",150,50,"ComicSans",20,"False","True") GameControls.AddText("....X Button",150,80,"ComicSans",20,"False","True") GameControls.AddText("....Y Button",150,110,"ComicSans",20,"False","True") GameControls.AddText("....Back Button",150,140,"ComicSans",20,"False","True") GameControls.AddText("....Start Button",150,170,"ComicSans",20,"False","True") GameControls.AddText("....Right Bumper Button",150,200,"ComicSans",20,"False","True") GameControls.AddText("....Right Trigger Button",150,230,"ComicSans",20,"False","True") GameControls.AddText("....Left Bumper Button",150,260,"ComicSans",20,"False","True") GameControls.AddText("....Left Trigger Button",150,290,"ComicSans",20,"False","True") GameControls.AddText("....Left Stick Up",150,320,"ComicSans",20,"False","True") GameControls.AddText("....Left Stick Left",150,350,"ComicSans",20,"False","True") GameControls.AddText("....Left Stick Down",150,380,"ComicSans",20,"False","True") GameControls.AddText("....Left Stick Right",150,410,"ComicSans",20,"False","True") GameControls.AddText("....D-Pad Up",150,440,"ComicSans",20,"False","True") GameControls.AddText("....D-Pad Left",150,470,"ComicSans",20,"False","True") GameControls.AddText("....D-Pad Down",150,500,"ComicSans",20,"False","True") GameControls.AddText("....D-Pad Right",150,530,"ComicSans",20,"False","True") GameControls.AddText("....Right Stick Up",510,20,"ComicSans",20,"False","True") GameControls.AddText("....Right Sick Right",510,50,"ComicSans",20,"False","True") GameControls.AddText("....Right Stick Down",510,80,"ComicSans",20,"False","True") GameControls.AddText("....Right Stick Right",510,110,"ComicSans",20,"False","True") GameControls.AddText("....Vibration levels(0-100)(Right)",510,170,"ComicSans",20,"False","True") GameControls.AddText("....Vibration Levels(0-100)(Left)",510,200,"ComicSans",20,"False","True") GameControls.AddText("....Guide Button",510,140,"ComicSans",20,"False","True") GameControls.AddText("....Left Stick Pushed Down",510,230,"ComicSans",20,"False","True") GameControls.AddText("....Right Stick Pushed Down",510,260,"ComicSans",20,"False","True") GameControls.AddText("Controller Info:",865,5,"ComicSans",20,"False","True") GameControls.AddText("Battery Level:",865,30,"ComicSans",20,"False","True") GameControls.AddText("Battery Type:",865,60,"ComicSans",20,"False","True") GameControls.AddText("Connected?",865,90,"ComicSans",20,"False","True") GameControls.AddText("(R)Vibration(0-100)",865,120,"ComicSans",20,"False","True") GameControls.AddText("(L)Vibration(0-100)",865,150,"ComicSans",20,"False","True") Gamecontrols.AddText("Image thanks to Wikipedia, 'XBox to PC controls' made by acenomad!",0,560,"ComicSans",8,"False","False") ' Init Buttons SCI = GameControls.AddButton("Show Controller Info >>",700,50,140,30) SCIF = GameControls.AddButton("Hide Controller Info <<",700,50,140,30) Save = GameControls.AddButton("Save Buttons",702,0,140,30) GameControls.SetVisibility(SCIF,"False") ' Init Subs GameControls.RegisterMouseDownEvent(SCI,"SCIs") GameControls.RegisterMouseDownEvent(SCIF,"SCIFs") GameControls.RegisterMouseDownEvent(Save,"Saves") GameWindow.Show() ' Show the controller info Sub SCIs For i = gw To 1100 Step 3 GameWindow.Width = i GameWindow.Left = (Desktop.Width - i) / 2 EndFor GameControls.SetVisibility(SCI,"False") GameControls.SetVisibility(SCIF,"True") ' Set Vars for battery info BaL = GameController.BatteryLevel BaT = GameController.BatteryType CCe = GameController.IsConnected GameControls.SetValue(BatB,Bat) GameControls.SetValue(BaLB,BaL) GameControls.SetValue(CCeB,CCe) EndSub ' Hide the controller info Sub SCIFs For u = 1100 To gw Step -3 GameWindow.Width = u GameWindow.Left = (Desktop.Width - u) / 2 EndFor GameControls.SetVisibility(SCIF,"False") GameControls.SetVisibility(SCI,"True") EndSub Sub Saves AF = GameControls.GetText(A) BF = GameControls.GetText(B) XF = GameControls.GetText(X) YF = GameControls.GetText(Y) BkF = GameControls.GetText(Bk) StF = GameControls.GetText(St) DPDF = GameControls.GetText(DPD) DPLF = GameControls.GetText(DPL) DPRF = GameControls.GetText(DPR) DPUF = GameControls.GetText(DPU) LBF = GameControls.GetText(LB) LTF = GameControls.GetText(LT) LSPF = GameControls.GetText(LSP) RBF = GameControls.GetText(RB) RTF = GameControls.GetText(RT) RSPF = GameControls.GetText(RSP) LSUF = GameControls.GetText(LSU) LSRF = GameControls.GetText(LSR) LSLF = GameControls.GetText(LSL) LSDF = GameControls.GetText(LSDF) RSUF = GameControls.GetText(RSU) RSRF = GameControls.GetText(RSR) RSLF = GameControls.GetText(RSL) RSDF = GameControls.GetText(RSD) ViBRF = GameControls.GetText(ViBBR) ViBLF = GameControls.GetText(ViBBR) GameController.SetVibratation(ViBLF,ViBRF) GameWindow.BrushColor = "Black" Rect = GameControls.AddRectangle(0,0,1100,gh) GameControls.SetOpacity(Rect,85) GameWindow.BrushColor = "Blue" GameControls.AddText("Controls configured, please keep this program running to convert controls.",gw/100,gh/2,"ComicSans",23,"True","False") ' GameControls.AddText("This messages will cloes in 10 seconds, after that you can use your Controller",gw/100,gh/1.5,"ComicSans",23,"True","False") GameWindow.ShowInTaskbar = "False" If GameController.IsButtonDown("A") = "True" Then GameKeyboard.LastKey = AF ElseIf GameController.IsButtonDown("B") = "True" Then GameKeyboard.LastKey = BF ElseIf GameController.IsButtonDown("X") = "True" Then GameKeyboard.LastKey = XF ElseIf GameController.IsButtonDown("Y") = "True" Then GameKeyboard.LastKey = YF ElseIf GameController.IsButtonDown("Back") = "True" Then GameKeyboard.LastKey = BkF ElseIf GameController.IsButtonDown("Start") = "True" Then GameKeyboard.LastKey = StF ElseIf GameController.IsButtonDown("DPadDown") = "True" Then GameKeyboard.LastKey = DPDF ElseIf GameController.IsButtonDown("DPadLeft") = "True" Then GameKeyboard.LastKey = DPLF ElseIf GameController.IsButtonDown("DPadRight") = "True" Then GameKeyboard.LastKey = DPRF ElseIf GameController.IsButtonDown("DPadUp") = "True" Then GameKeyboard.LastKey = DPUF ElseIf GameController.IsButtonDown("LB") = "True" Then GameKeyboard.LastKey = LBF ElseIf GameController.IsButtonDown("LT") = "True" Then GameKeyboard.LastKey = LTF ElseIf GameController.IsButtonDown("LS") = "True" Then GameKeyboard.LastKey = LSPF ElseIf GameController.IsButtonDown("RB") = "True" Then GameKeyboard.LastKey = RBF ElseIf GameController.IsButtonDown("RT") = "True" Then GameKeyboard.LastKey = RTF ElseIf GameController.IsButtonDown("RS") = "True" Then GameKeyboard.LastKey = RSPF ElseIf GameController.IsButtonDown("LeftStickDown") = "True" Then GameKeyboard.LastKey = LSDF ElseIf GameController.IsButtonDown("LeftStickLeft") = "True" Then GameKeyboard.LastKey = LSLF ElseIf GameController.IsButtonDown("LeftStickRight") = "True" Then GameKeyboard.LastKey = LSRF ElseIf GameController.IsButtonDown("LeftStickUp") = "True" Then GameKeyboard.LastKey = LSUF ElseIf GameController.IsButtonDown("RighStickDown") = "True" Then GameKeyboard.LastKey = RSDF ElseIf GameController.IsButtonDown("RightStickLeft") = "True" Then GameKeyboard.LastKey = RSLF ElseIf GameController.IsButtonDown("RightStickRight") = "True" Then GameKeyboard.LastKey = RSRF ElseIf GameController.IsButtonDown("RightStickUp") = "True" Then GameKeyboard.LastKey = RSUF EndIf EndSub End>RNF195.sb< Start>RNH445.sb< Turtleapp: 'Set up of program GraphicsWindow.Height = Desktop.Height - 300 GraphicsWindow.Width = Desktop.Width - 300 Turtle.Show() 'Program logic TextWindow.WriteLine("Turtle App") TextWindow.WriteLine("") TextWindow.WriteLine("Commands: Turn Left, Turn Right, Move, Move Back, Turn Angle, Random, End. Is case sensitive.") Sub TurnLeft Turtle.TurnLeft() EndSub Sub TurnRight Turtle.TurnRight() EndSub Sub Move TextWindow.Write("Distance: ") dist = TextWindow.ReadNumber() Turtle.Move(dist) EndSub Sub MoveBack TextWindow.Write("Distance: ") back = TextWindow.ReadNumber() Turtle.Move(back - back*2) EndSub Sub TurnAngle TextWindow.Write("Angle: ") angle = TextWindow.Read() TextWindow.Write("Left or Right: ") x = TextWindow.Read() If (x = "Left") Then Turtle.Turn(angle - angle*2) Endif If (x = "Right") Then Turtle.Turn(angle) EndIf EndSub Sub Random lor = Math.GetRandomNumber(2) direct = Math.GetRandomNumber(360) am = Math.GetRandomNumber(300) If (lor = 1) Then Turtle.Angle = direct - direct*2 Turtle.Move(am) Endif If (lor = 2) Then Turtle.Angle = direct Turtle.Move(am) EndIf EndSub Sub Main TextWindow.Write("Command: ") cmd = TextWindow.Read() If cmd = "Turn Left" Then TurnLeft() Main() EndIf If cmd = "Turn Right" Then TurnRight() Main() Endif If cmd = "Move" Then Move() Main() Endif If cmd = "Move Back" Then MoveBack() Main() Endif If cmd = "Turn Angle" Then TurnAngle() Main() Endif If cmd = "Random" Then Random() Main() EndIf EndSub Main() End>RNH445.sb< Start>RNH977.sb< ' January 14th 2017 ' orbit drawing ' using Newton's law ' program no: ' Newton's formulas suggested by litdev ' with orbital velocity display ' with years counter for each planets ' planetarium version 2.02 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.height=768 GraphicsWindow.width=1366 GraphicsWindow.backgroundcolor="#000022" GraphicsWindow.brushcolor="#3344bb" GraphicsWindow.fontsize=14 dgray = GraphicsWindow.GetColorFromRGB(70,70,70) GraphicsWindow.brushcolor="white" oppos = Shapes.AddText("") Shapes.Move(oppos,800, 475) init_earth() init_mars() init_jupiter() init_sun() While 1=1 earth() Shapes.SetText(E_y,"Earth Years : "+Earth_year) Shapes.SetText(EV_o,"Orbital velocity : "+Evo+ " km/s") mars() Shapes.SetText(M_y,"Mars Years : "+Mars_year) Shapes.SetText(MV_o,"Orbital velocity : "+Mvo+ " km/s") jupiter() Shapes.SetText(J_y,"Jupiter Years : "+Jupiter_year) Shapes.SetText(Jv_o,"Orbital velocity : "+Jvo+ " km/s") Program.Delay(50) EndWhile Sub init_earth ert= ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/988778") GraphicsWindow.DrawresizedImage(ert,100,200,50,50) GraphicsWindow.brushcolor="#00aaff" earth=shapes.AddEllipse(10,10) E_y = Shapes.AddText("") Shapes.Move(E_y,200, 200) GraphicsWindow.brushcolor="#ccccff" Ev_o = Shapes.addtext("") Shapes.Move(Ev_o,200, 225) θ=0 ' starting Earth position ' Eccentricity 0.01670 ' Semi-major axis 149,598,023 km (1.000 001 018 AU ' Average orbital speed 29.78 km/s ecc_e=0.01670 a=100 b=math.Round(a/(1+ecc_e)) EndSub Sub init_mars mar= ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/988777") GraphicsWindow.DrawresizedImage(mar,100,300,45,40) GraphicsWindow.brushcolor="#bb0000" mars=shapes.AddEllipse(8,8) M_y = Shapes.AddText("") Shapes.Move(M_y,200, 300) GraphicsWindow.brushcolor="#ddaa88" Mv_o = Shapes.addtext("") Shapes.Move(Mv_o,200, 325) θ1=0 ' ' starting Mars position ' Eccentricity 0.0934 ' Semi-major axis 1.523679 AU ' Average orbital speed 24.077 km/s ecc_m=0.0934 a1=152 b1=math.Round(a1/(1+ecc_m)) EndSub Sub init_jupiter jup= ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/988779") GraphicsWindow.DrawresizedImage(jup,80,400,80,80) GraphicsWindow.brushcolor="#bbaa22" jupiter=shapes.AddEllipse(20,20) J_y = Shapes.AddText("") Shapes.Move(J_y,200, 400) GraphicsWindow.brushcolor="#dddd77" Jv_o = Shapes.addtext("") Shapes.Move(Jv_o,200, 425) θ2=0 ' ' starting Jupiter position ' Eccentricity 0.0484 ' Semi-major axis 5.202 60 AU ' Perihelion 4.950 29 AU 'Average orbital speed 13.07 km ecc_J=0.0484 a2=520 b2=math.Round(a2/(1+ecc_J)) EndSub Sub init_sun GraphicsWindow.brushcolor="yellow" sun=shapes.AddEllipse(40,40) Cx=625 Cy=325 F=Math.SquareRoot((a*a)-(b*b)) Shapes.Move(sun, Cx-F-20,Cy-20) EndSub sub earth ' get the correct speed effect by updating θ proportionally by 1/(r.sqrt(r)) each time step θ=θ+v x=Cx+a*(math.Cos(θ)) y=Cy+b*(math.sin(θ)) dx = Cx-F-x dy = Cy-y r=Math.SquareRoot(dx*dx+dy*dy) ' update r distance sun-earth orbit v=50/r/Math.SquareRoot(r) 'TextWindow.WriteLine(r+" : "+v) ' to test output value is v , yes it increase near the sun and then decrease z=math.Round(x*1000) If z > 724980 THEN Earth_year=Earth_year+1 EndIf Evo=math.Round(v*10000/1.897)/10 Shapes.Move(earth,x-5,y-5) GraphicsWindow.SetPixel(x,y,dgray) endsub Sub mars θ1=θ1+v1 x1=Cx+a1*(math.Cos(θ1)) y1=Cy+b1*(math.sin(θ1)) dx1 = Cx-F-x1 dy1 = Cy-y1 r1=Math.SquareRoot(dx1*dx1+dy1*dy1) v1=50/r1/Math.SquareRoot(r1) z1=math.Round(x1*1000) If z1 > 776990 THEN Mars_year=Mars_year+1 EndIf Mvo=math.Round(v1*10000/1.145)/10 Shapes.Move(mars,x1-4,y1-4) GraphicsWindow.SetPixel(x1,y1,dgray) endsub Sub jupiter θ2=θ2+v2 x2=Cx+a2*(math.Cos(θ2)) y2=Cy+b2*(math.sin(θ2)) dx2 = Cx-F-x2 dy2 = Cy-y2 r2=Math.SquareRoot(dx2*dx2+dy2*dy2) v2=50/r2/Math.SquareRoot(r2) z2=math.Round(x2*100000) If z2 > 114499897 THEN Jupiter_year=Jupiter_year+1 EndIf Jvo=math.Round(v2*100000/3.25)/10 Shapes.Move(jupiter,x2-10,y2-10) GraphicsWindow.SetPixel(x2,y2,dgray) endsub End>RNH977.sb< Start>RNJ467.sb< ' some values to symbolise True and False true = 1 false = 0 'offset so we don't cover the display text box BUTTON_START = 30 ' the gap between buttons and between the sides GAP = 5 GRID_HEIGHT = 4 GRID_WIDTH = 4 'resize all the buttons using these values BUTTON_WIDTH = 50 BUTTON_HEIGHT = 50 ' Total width of all the buttons + gaps so when changing the button sizes we don't have to fiddle with the graphics window sizes TOTAL_BUTTON_WIDTH = (GRID_WIDTH * BUTTON_WIDTH) + (GRID_WIDTH * (GAP)) + GAP 'Total height of all the buttons + gaps TOTAL_BUTTON_HEIGHT = (GRID_HEIGHT * BUTTON_HEIGHT) + (GRID_HEIGHT * (GAP)) + GAP initCalc() sub initCalc ' init some variables to help with the position of buttons in the button array initButtonHelpers() 'set the graphics window properties initGraphicsWindow() 'draw the display text box DrawDisplay() 'draw the buttons DrawButtons() ' set up the event handlers initEvents() endsub Sub initGraphicsWindow GraphicsWindow.Width = TOTAL_BUTTON_WIDTH - 10 ' minus 10 when using canResize = false as its not the right size! GraphicsWindow.Height = TOTAL_BUTTON_HEIGHT + BUTTON_START - 10 ' minus 10 when using canResize = false as its not the right size! GraphicsWindow.Title = "Calculator" GraphicsWindow.CanResize = false endsub Sub drawDisplay display = Controls.AddTextBox(GAP,GAP) Controls.SetSize(display, GraphicsWindow.Width - (GAP * 2), 25) endsub Sub DrawButtons k = 0 For i = 0 To GRID_WIDTH - 1 For j = 0 To GRID_HEIGHT - 1 If caption[k] <> "!" then ' if the button caption is ! then we ignore the button from the grid (see captions at bottom) 'position the button btn[k] = Controls.AddButton(caption[k],GAP + (j * (BUTTON_WIDTH + GAP) ),BUTTON_START + GAP + (i * (BUTTON_HEIGHT + GAP) ) ) 'resize the button Controls.SetSize(btn[k],BUTTON_WIDTH,BUTTON_HEIGHT) endif 'increment the array position k = k + 1 EndFor EndFor EndSub Sub initEvents Controls.ButtonClicked = buttonClickedEvent endsub Sub buttonClickedEvent lastClicked = Controls.LastClickedButton ' if we click button one then append 1 to the current text If ( lastClicked = btn[BTN_1] ) then Controls.SetTextBoxText(display,text.Append(Controls.GetTextBoxText(display), 1 )) endif 'if we click button two then append 2 to the current text If ( lastClicked = btn[BTN_2] ) then Controls.SetTextBoxText(display,text.Append(Controls.GetTextBoxText(display), 2 )) endif 'etc... endsub Sub initButtonHelpers 'the btn array contains all the buttons 'these variables define where the index for the buttons are 'and what caption is at that position. BTN_0 = 13 BTN_1 = 0 BTN_2 = 1 BTN_3 = 2 BTN_4 = 4 BTN_5 = 5 BTN_6 = 6 BTN_7 = 8 BTN_8 = 9 BTN_9 = 10 BTN_PLUS = 3 BTN_MINUS = 7 BTN_MULTI = 11 BTN_DIV = 15 caption[0] = "1" caption[1] = "2" caption[2] = "3" caption[3] = "+" caption[4] = "4" caption[5] = "5" caption[6] = "6" caption[7] = "-" caption[8] = "7" caption[9] = "8" caption[10] = "9" caption[11] = "*" caption[12] = "+/-" caption[13] = "0" caption[14] = "!" ' we ignore ! mark button caption[15] = "/" EndSub End>RNJ467.sb< Start>RNL706.sb< TextWindow.Hide() TextWindow.Show() title = "The Macbeth Effect!" TextWindow.Title = title nv_neutral = 0 nv_rogue = 0 nv_hero = 0 mloop = 1 main = 1 start_message = 1 conv_1 = 1 conv_2 = 1 conv_3 = 1 conv_4 = 1 conv_5 = 1 conv_6 = 1 conv_7 = 1 conv_8 = 1 conv_9 = 1 conv_10 = 1 conv_11 = 1 conv_12 = 1 conv_13 = 1 conv_14 = 1 conv_15 = 1 conv_16 = 1 conv_17 = 1 conv_18 = 1 colour_end = 1 final_end = 1 credits = 1 save_true = 0 load_check = 0 ' The following line could be harmful and has been automatically commented. ' auto_save = File.GetSettingsFilePath() ' Start Of Looping for whole program' //////////////////////////////////////////////////////////////////////////////////////////////////////////////// While mloop = 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 1, "The Cake is A Lie... And the answer is also 42") ' The following line could be harmful and has been automatically commented. ' save_true = File.ReadLine(auto_save, 2) While main = 1 If save_true = "" Or save_true = 0 Then TextWindow.Write("Start Adventure? Y|N: ") read = TextWindow.Read() If read = "Y" Or read = "y" Then TextWindow.Clear() TextWindow.Write("Welcome to Scotland") For x = 1 To 3 Program.Delay(1000) TextWindow.Write(" .") EndFor Program.Delay(2000) main = 2 ElseIf read = "N" or read = "n" Then TextWindow.Clear() TextWindow.WriteLine("Are you sure?") Else TextWindow.Write("Bad Input - ") EndIf ElseIf save_true = 1 Then TextWindow.Write("You have a save file! Want to continue? Y|N: ") read = TextWindow.Read() If read = "y" Or read = "Y" Then main = 2 start_message = 2 conv_1 = 2 conv_2 = 2 conv_3 = 2 conv_4 = 2 conv_5 = 2 conv_6 = 2 conv_7 = 2 conv_8 = 2 conv_9 = 2 conv_10 = 2 conv_11 = 2 conv_12 = 2 conv_13 = 2 conv_14 = 2 conv_15 = 2 conv_16 = 2 conv_17 = 2 ' The following line could be harmful and has been automatically commented. ' nv_hero = File.ReadLine(auto_save, 3) ' The following line could be harmful and has been automatically commented. ' nv_neutral = File.ReadLine(auto_save, 4) ' The following line could be harmful and has been automatically commented. ' nv_rogue = File.ReadLine(auto_save, 5) ' The following line could be harmful and has been automatically commented. ' conv_code = File.ReadLine(auto_save, 6) ElseIf read = "n" Or read = "N" Then ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(auto_save) TextWindow.Clear() TextWindow.Write("Welcome to Scotland") For x = 1 To 3 Program.Delay(1000) TextWindow.Write(" .") EndFor Program.Delay(2000) main = 2 Else TextWindow.Write("Bad Input - ") EndIf EndIf EndWhile 'Starting Message' While start_message = 1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 1, "The Cake is A Lie... And the answer is also 42") TextWindow.Clear() TextWindow.WriteLine("Hello Adventurer! Welcome to Scotland! You're playing "+title) TextWindow.WriteLine("In this text based adventure you will be playing as Macbeth!") TextWindow.WriteLine("Your adventure awaits you!") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then start_message = 2 Else start_message = 2 EndIf EndWhile 'Conversation Break' //////////////////////////////////////////////////////////////////////////// While conv_1 = 1 Or conv_code = 1 check = 1 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 2, 1) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 1) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[Narrator] Your adventure starts!") TextWindow.WriteLine("[Narrator] You've been awarded a new title for your heroic actions!") TextWindow.WriteLine("[The people] Hail Macbeth! Thane Of Glamis and Thane of Cawdor!") TextWindow.WriteLine("[King Duncan] Macbeth! I am indebted to you.") TextWindow.WriteLine("[King Duncan] Your service to King and country will not be forgotten") TextWindow.WriteLine(" A. Thank Duncan for such an honor") TextWindow.WriteLine(" B. [Say Nothing]") TextWindow.WriteLine(" C. I don't need you to patronize me") TextWindow.Write("Choose your dialogue option: ") read = TextWindow.Read() If read = "a" Or "A" Then nv_hero = nv_hero + 1 TextWindow.Clear() TextWindow.WriteLine("Thank you my leige. It is an honor to receive such praise.") TextWindow.WriteLine("[King Duncan] Gracious as always Macbeth.") conv_1 = 2 ElseIf read = "b" Or "B" Then nv_neutral = nv_neutral + 1 TextWindow.Clear() For x = 1 To 3 Program.Delay(1000) TextWindow.Write(". ") EndFor TextWindow.WriteLine("[King Duncan] As always your silence is taken as thanks.") ElseIf read = "c" Or read = "C" Then nv_rogue = nv_rogue + 1 TextWindow.Clear() TextWindow.WriteLine("I don't need your compliments (under breath) your time is short") TextWindow.WriteLine("[King Duncan] Remember your place Macbeth. I am your King") Else check = 2 EndIf If check = 1 Then TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_1 = 2 Else conv_1 = 2 EndIf EndIf EndWhile 'Conversation Break' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_2 = 1 Or conv_code = 2 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 2) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[King Duncan] You are to seek your personal gaurd Banquo wherever he may be.") TextWindow.WriteLine("[King Duncan] When you find him bring him to your castle.") TextWindow.WriteLine("[King Duncan] I will be waiting for you there.") TextWindow.WriteLine("[King Duncan] Your actions need to be recognized formally at your castle.") TextWindow.Write("[Narrator] And so Macbeth left in search of his friend.") For x = 1 To 3 Program.Delay(1000) TextWindow.Write(" .") EndFor TextWindow.WriteLine(" ") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_2 = 2 Else conv_2 = 2 EndIf EndWhile 'Conversation Break //////////////////////////////////////////////////////////////////////////////////////////////////////' While conv_3 = 1 Or conv_code = 3 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 3) 'AUTO SAVE' If conv_3_clear <> 2 Then TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth knew not where Banquo was as they were seperated.") TextWindow.WriteLine("[Narrator] His search led him to many towns and villages.") TextWindow.WriteLine("[Narrator] This hunt for his friend and gaurd went on for some time until...") TextWindow.WriteLine("{Macbeth enters the town he is visiting and looks around}") EndIf If conv_3_clear = 2 Then TextWindow.Clear() EndIf TextWindow.WriteLine(" A. Visit the Inn") TextWindow.WriteLine(" B. Visit the Hospital") TextWindow.WriteLine(" C. Visit the soldiers encampment") TextWindow.Write("Choose where to go: ") read = TextWindow.Read() If read = "a" Or read = "A" Then conv_3 = 2 ElseIf read = "b" Or read = "B" Then If conv_3_check <> 2 Then TextWindow.Clear() TextWindow.WriteLine("[Nurse] Ahh! Thane! Is there something you need?") TextWindow.WriteLine("{You ask about Banquo}") TextWindow.WriteLine("[Nurse] Sorry... There is no one here by the name of Banquo") TextWindow.WriteLine("[Nurse] However! You should ask the soldiers! They might know.") TextWindow.WriteLine("{You thank her and leave}") conv_3_clear = 2 TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then TextWindow.Clear() Else TextWindow.Clear() EndIf ElseIf conv_3_check = 2 Then TextWindow.Clear() If conv_3_nurse <> 2 Then TextWindow.WriteLine("[Nurse] Thane! You're back! Is there something else you need?") TextWindow.WriteLine("{You ask about Banquo again but mention what the Officer said}") TextWindow.WriteLine("[Nurse] OH! My Lord, forgive me.") TextWindow.WriteLine("[Nurse] Now that you mention it there was a Banquo here...") ElseIf conv_3_nurse = 2 Then TextWindow.WriteLine("[Nurse] Ahh! Thane! Is there something you need?") TextWindow.WriteLine("{You ask about Banquo and tell her what the Officer said}") TextWindow.WriteLine("[Nurse] Ah! Yes. There was a Banquo here.") EndIf TextWindow.WriteLine("[Nurse] Check the town Inn!") conv_3_clear = 2 'conv_4_check = 2' / ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 2) 'conv_4_check = 2' / TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then TextWindow.Clear() Else TextWindow.Clear() EndIf EndIf ElseIf read = "c" Or read = "C" Then TextWindow.Clear() TextWindow.WriteLine("[Officer] {Salutes} My Lord! What brings you here?") TextWindow.WriteLine("{You ask about Banquo}") TextWindow.WriteLine("[Officer] Sorry my Lord Macbeth... Banquo is not here") TextWindow.WriteLine("[Officer] Although. Ahh! Lord! Check the Hospital!") TextWindow.WriteLine("[Officer] I seem to remember a man named Banquo being treated for wounds") TextWindow.WriteLine("{You thank the Officer and leave}") conv_3_check = 2 conv_3_clear = 2 conv_3_nurse = 2 TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then TextWindow.Clear() Else TextWindow.Clear() EndIf Else TextWindow.WriteLine(" ") EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 4) 'AUTO SAVE' While conv_4 = 1 Or conv_code = 4 'loadcheck' If load_check = 0 Then ' The following line could be harmful and has been automatically commented. ' conv_4_check = File.ReadLine(auto_save, 7) load_check = 1 EndIf 'loadcheck' check = 1 TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth Enters the Inn") TextWindow.WriteLine("[Bartender] My Lord! It is an honour!") TextWindow.WriteLine("[Bartender] I'm sorry for our disheveled Inn, I...") If conv_4_check <> 2 Then TextWindow.WriteLine("{Interrupting} It's quite alright Sir.") TextWindow.WriteLine("Now, I'm looking for a man named Banquo.") ElseIf conv_4_check = 2 Then TextWindow.WriteLine("{Interrupting} It's fine.") TextWindow.WriteLine("I was told a man named Banquo was here") EndIf TextWindow.WriteLine("He is my friend and my personal gaurd.") TextWindow.WriteLine("I owe him my life, he saved me on the battlefield.") TextWindow.WriteLine("[Bartender] Oh! Yes! A man named Banquo is staying here.") TextWindow.WriteLine("[Bartender] Let me get him for you!") TextWindow.WriteLine(" A. Thank him and wait") TextWindow.WriteLine(" B. Nod and wait") TextWindow.WriteLine(" C. Hurry up peasant") TextWindow.Write("Choose your dialogue option: ") read = TextWindow.Read() If read = "a" Or read = "A" Then nv_hero = nv_hero + 1 TextWindow.Clear() TextWindow.WriteLine("[Bartender] Thank you for your patience") TextWindow.WriteLine("{Goes to fetch Banquo}") ElseIf read = "b" Or read = "B" Then nv_neutral = nv_neutral + 1 TextWindow.Clear() TextWindow.WriteLine("{Goes to fetch Banquo}") ElseIf read = "c" Or read = "C" Then nv_rogue = nv_rogue + 1 TextWindow.Clear() TextWindow.WriteLine("[Bartender] Yes my Lord {annoyed}") TextWindow.WriteLine("{Goes to fetch Banquo}") Else check = 2 EndIf If check = 1 Then conv_4 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_5 = 1 Or conv_code = 5 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 5) 'AUTO SAVE' TextWindow.WriteLine("[Banquo] Macbeth! Friend! I'm so glad you've found me!") TextWindow.WriteLine("[Banquo] Sorry I was seperated from you on the battlefield.") TextWindow.WriteLine("[Banquo] After I saved you I took an arrow to the knee...") TextWindow.WriteLine("[Banquo] That's how we were seperated.") TextWindow.WriteLine("Banquo, think nothing of it. I'm just glad that you are alright.") TextWindow.WriteLine("King Duncan has ordered us back to my castle. We must be off to Dunsinane") TextWindow.WriteLine("[Banquo] Off we go.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_5 = 2 Else conv_5 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_6 = 1 Or conv_code = 6 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 6) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth and Banquo are on the way to Dunsinane castle...") TextWindow.WriteLine("[Banquo] Hey, Macbeth! I know a short cut. Let's go through this forest here.") TextWindow.WriteLine("[Banquo] It'll cut our journey in half.") TextWindow.WriteLine("Hmm? Is that so, well, it wouldn't hurt. Alright, let's go this way.") TextWindow.WriteLine("[Narrator] Macbeth and Banquo set their eyes on a shorter journey.") TextWindow.WriteLine("[Narrator] They began to venture into the forrest.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_6 = 2 Else conv_6 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_7 = 1 Or conv_code = 7 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 7) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[Narrator] Both Macbeth and Banquo venture through the forrest for some time.") TextWindow.WriteLine("[Narrator] This walk is uneventful, but they notice that the air is foul.") TextWindow.WriteLine("Banquo, do you smell the air? It is stale and unmoving.") TextWindow.WriteLine("[Banquo] I hear you; ever since we entered something has been amiss.") TextWindow.WriteLine("[Banquo] It would do us well if we hastened our pace...") TextWindow.WriteLine("[Narrator] Macbeth and Banquo quicken their pace but to no avail.") TextWindow.WriteLine("[Narrator] They have already fallen victim of a devious scheme.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_7 = 2 Else conv_7 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////// While conv_8 = 1 For x = 1 To 6 For y = 1 to 2 TextWindow.Clear() TextWindow.BackgroundColor = "white" TextWindow.Write("") Program.Delay(250) EndFor For y = 1 to 2 TextWindow.Clear() TextWindow.BackgroundColor = "blue" TextWindow.Write("") EndFor EndFor TextWindow.BackgroundColor = "black" conv_8 = 2 EndWhile While conv_9 = 1 Or conv_code = 9 TextWindow.Clear() 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 9) 'AUTO SAVE' TextWindow.WriteLine("[Witch] {Cackles} Ahh, someone has fallen into my trap.") TextWindow.WriteLine("[Witch] Hmm? What's this? Two men? Strong Macbeth?!") TextWindow.WriteLine("[Witch] {Cackles} And his loyal servant Banquo?!") TextWindow.WriteLine("[Banquo] Get back! {Draws Sword} I must defend you!") TextWindow.WriteLine("{The witch waves her hand and the sword breaks") TextWindow.WriteLine("[Banquo] What? What is this. Macbeth, come! We must...") TextWindow.WriteLine("[Witch] Ahaha! Not so fast!") TextWindow.WriteLine("{Walls of thorns form, trapping Macbeth and Banquo}") TextWindow.WriteLine("Lady, what is it you want? It is clear we cannot match you") TextWindow.WriteLine("I have money I can give you, let us go.") TextWindow.WriteLine("[Witch] Ah no Thane of Glamis and Thane of Cawdor.") TextWindow.WriteLine("[Witch] I am not here to harm or hurt you.") TextWindow.WriteLine("[Witch] I simply wish to deliver a message.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_9 = 2 Else conv_9 = 2 EndIf EndWhile 'Conversation Break //////////////////////////////////////////////////////////////////////////////////////////////////// While conv_10 = 1 Or conv_code = 10 TextWindow.Clear() 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 10) 'AUTO SAVE' TextWindow.WriteLine("[Banquo] Begone! Demon! Witch!") TextWindow.WriteLine("Silence Banquo. Let her speak.") TextWindow.WriteLine("[Witch] Ah, a man of reason...") TextWindow.WriteLine("[Witch] Fair is foul and foul is fair.") TextWindow.WriteLine("[Witch] Thane of Cawdor, Thane of Glamis.") TextWindow.WriteLine("[Witch] You're soon to be king, ruler and lord.") TextWindow.WriteLine("[Witch] Through evil, passive or heroic means.") TextWindow.WriteLine("[Witch] You will be king of this land") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_10 = 2 Else conv_10 = 2 EndIf EndWhile While conv_11 = 1 TextWindow.Clear() TextWindow.Write("{The witch vanishes}") For x = 1 To 3 Program.Delay(1000) TextWindow.Write(". ") EndFor Program.Delay(500) For x = 1 To 4 For y = 1 to 2 TextWindow.Clear() TextWindow.BackgroundColor = "white" TextWindow.Write("") Program.Delay(250) EndFor For y = 1 to 2 TextWindow.Clear() TextWindow.BackgroundColor = "blue" TextWindow.Write("") EndFor EndFor TextWindow.BackgroundColor = "black" conv_11 = 2 EndWhile While conv_12 = 1 Or conv_code = 12 TextWindow.Clear() 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 12) 'AUTO SAVE' TextWindow.WriteLine("[Banquo] She vanished! And look! We've left the forrest!?") TextWindow.WriteLine("It seems the witch has worked her craft, we must advance.") TextWindow.WriteLine("[Narrator] Banquo and Macbeth ventured onward.") TextWindow.WriteLine("[Narrator] They both thought silently to themselves.") TextWindow.WriteLine("[Narrator] Unwilling to discuss the events past") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_12 = 2 Else conv_12 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_13 = 1 Or conv_code = 13 TextWindow.Clear() 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 13) 'AUTO SAVE' TextWindow.WriteLine("[Narrator] Macbeth and Banquo, after venturing for sometime...") TextWindow.WriteLine("We've arrived Banquo. It's good to be home...") TextWindow.WriteLine("[Guards] Hail! Macbeth! Lord!") TextWindow.WriteLine("[Guards] We're opening the gate!") TextWindow.WriteLine("[Narrator] Macbeth and Banquo ventured into Dunsinane.") TextWindow.WriteLine("Guards! Send out a message immediately!") TextWindow.WriteLine("We must call for the King!") TextWindow.WriteLine("[Guards] What do you wish to say in the letter m'lord?") TextWindow.WriteLine(" A. Praise the King and tell him i've arrived") TextWindow.WriteLine(" B. Tell the King i've arrived") TextWindow.WriteLine(" C. Send for the King, ask him to hurry") TextWindow.Write("Choose your dialogue option: ") read = TextWindow.Read() If read = "a" Or read = "A" Then 'conv_14_check' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 1) nv_hero = nv_hero + 1 ElseIf read = "b" Or "B" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 2) nv_neutral = nv_neutral + 1 ElseIf read = "c" Or read = "C" Then ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 3) nv_rogue = nv_rogue + 1 Else TextWindow.WriteLine(" ") EndIf TextWindow.Clear() TextWindow.WriteLine("[Guard] The message will be sent!") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_13 = 2 Else conv_13 = 2 EndIf EndWhile 'Conversation Break //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// load_check = 0 While conv_14 = 1 Or conv_code = 14 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 14) 'AUTO SAVE' If load_check = 0 Then ' The following line could be harmful and has been automatically commented. ' conv_14_check = File.ReadLine(auto_save, 7) load_check = 1 EndIf TextWindow.Clear() TextWindow.WriteLine("[Royal Guard] King Duncan has arrived!") TextWindow.WriteLine("[King Duncan] I received your letter.") If conv_14_check = 1 Then TextWindow.WriteLine("[King Duncan] Thank you Macbeth for your kindess!") TextWindow.WriteLine("[King Duncan] Your service will not be forgotten.") ElseIf conv_14_check = 2 Then TextWindow.WriteLine("[King Duncan] Thank you for notifying me.") ElseIf conv_14_check = 3 Then TextWindow.WriteLine("[King Duncan] You really shouldn't hurry an old man.") EndIf TextWindow.WriteLine("[King Duncan] Tommorrow we recognize your achievments! My loyal Thane.") TextWindow.WriteLine(" A. Thank the King for such an honour") TextWindow.WriteLine(" B. Nod") TextWindow.WriteLine(" C. Ensure him you don't need to be patronized") TextWindow.Write("Choose your dialogue option: ") read = TextWindow.Read() If read = "a" Or read = "A" Then nv_hero = nv_hero + 1 TextWindow.Clear() TextWindow.WriteLine("Thank you for the honour my King.") TextWindow.WriteLine("[King Duncan] You're very welcome") ElseIf read = "b" Or read = "B" Then nv_neutral = nv_neutral + 1 TextWindow.Clear() TextWindow.WriteLine("{Nod}") TextWindow.WriteLine("[King Duncan] I'll take that as thanks.") ElseIf read = "c" Or read = "C" Then nv_rogue = nv_rogue + 1 TextWindow.Clear() TextWindow.WriteLine("I don't need patronizing. Sir.") TextWindow.WriteLine("[King Duncan] A smart man knows when to accept praise.") Else TextWindow.WriteLine(" ") EndIf TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_14 = 2 Else conv_14 = 2 EndIf EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_15 = 1 Or conv_code = 15 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 15) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[King Duncan] Now, it's gotten late. I think you should rest Macbeth") TextWindow.WriteLine("[King Duncan] You wouldn't want to be tired for tommorrow.") TextWindow.WriteLine("[King Duncan] I'm off to bed as well.") TextWindow.WriteLine("Good night m'lord, you're right i'm off to rest my weary head.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_15 = 2 Else conv_15 = 2 EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_16 = 1 Or conv_code = 16 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 16) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[Banquo] Ah! Macbeth, off to bed I see?") TextWindow.WriteLine("[Banquo] Do not dwell on what the witch said. Heed my warning") TextWindow.WriteLine(" A. Don't worry friend, I won't.") TextWindow.WriteLine(" B. Alright") TextWindow.WriteLine(" C. Be quiet, don't worry about me.") TextWindow.Write("Choose your dialogue option: ") read = TextWindow.Read() If read = "a" Or read = "A" Then nv_hero = nv_hero + 1 TextWindow.Clear() TextWindow.WriteLine("Don't worry Banquo, i've already forgotten.") ElseIf read = "b" Or read = "B" Then nv_neutral = nv_neutral + 1 TextWindow.Clear() TextWindow.WriteLine("Alright, i've already forgotten.") ElseIf read = "c" Or read = "C" Then nv_rogue = nv_rogue + 1 TextWindow.Clear() TextWindow.WriteLine("Silence, I won't dwell on it.") Else TextWindow.WriteLine(" ") EndIf TextWindow.WriteLine("[Banquo] I'm warning you Lord, good night.") TextWindow.WriteLine("Good night Banquo.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_16 = 2 Else conv_16 = 2 EndIf EndWhile 'Conversation Break //////////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_17 = 1 Or conv_code = 17 'AUTO SAVE' ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 3, nv_hero) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 4, nv_neutral) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 5, nv_rogue) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 6, 17) 'AUTO SAVE' TextWindow.Clear() TextWindow.WriteLine("[Narrator] The warning Banquo offered had no effect") TextWindow.WriteLine("[Narrator] Macbeth lay in his bed thinking, ploting, scheming.") TextWindow.WriteLine("[Narrator] King? He asked this repeatedly.") TextWindow.WriteLine("[Narrator] What would he do?") TextWindow.WriteLine(" A. Warn Duncan about what the witch said") TextWindow.WriteLine(" B. Don't do anything") TextWindow.WriteLine(" C. Kill Duncan to assume the throne") TextWindow.Write("Choose your path wisely: ") read = TextWindow.Read() If read = "a" Or read = "A" Then nv_hero = nv_hero + 3 TextWindow.Clear() TextWindow.WriteLine("I need to warn my king!") ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 1) ElseIf read = "b" Or read = "B" Then nv_neutral = nv_neutral + 3 TextWindow.Clear() TextWindow.WriteLine("There's nothing to be worried about.") ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 2) ElseIf read = "c" Or read = "C" Then nv_rogue = nv_rogue + 3 TextWindow.Clear() TextWindow.WriteLine("I will take my promised position by force") TextWindow.WriteLine("I must kill Duncan") ' The following line could be harmful and has been automatically commented. ' File.WriteLine(auto_save, 7, 3) Else TextWindow.WriteLine(" ") EndIf TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then conv_17 = 2 Else conv_17 = 2 EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////////////////////////// While conv_18 = 1 ' The following line could be harmful and has been automatically commented. ' conv_18_check = File.ReadLine(auto_save, 7) If conv_18_check = 1 Then final_1 = 1 final_2 = 2 final_3 = 2 ElseIf conv_18_check = 2 Then final_1 = 2 final_2 = 1 final_3 = 2 ElseIf conv_18_check = 3 Then final_1 = 2 final_2 = 2 final_3 = 1 EndIf conv_18 = 2 EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////////////// While final_1 = 1 TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth knew that his duty to country was paramount.") TextWindow.WriteLine("[Narrator] He went to warn his king about the witches prophecy.") TextWindow.WriteLine("King Duncan!") TextWindow.WriteLine("[Guards] Halt! The King asked to not be disturbed.") TextWindow.WriteLine("Guards! Please! We must warn the King!") TextWindow.WriteLine("[Narrator] Macbeth told the guards of what the witches said...") TextWindow.WriteLine("That's why we must warn the King!") TextWindow.WriteLine("{The guards open the door to the Kings quarters...}") TextWindow.WriteLine("{Guards and Macbeth} The King... He's dead!") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then final_1 = 2 Else final_1 = 2 EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////////////// While final_2 = 1 TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth did nothing as he was indecisive.") TextWindow.WriteLine("[Narrator] He woke in the morning to loud noises.") TextWindow.WriteLine("[Banquo] Macbeth! The king is dead!") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then final_2 = 2 Else final_2 = 2 EndIf EndWhile 'Conversation Break /////////////////////////////////////////////////////////////////////////////////////////// While final_3 = 1 TextWindow.Clear() TextWindow.WriteLine("[Narrator] Macbeth sought power and the easiest way was to kill the King") TextWindow.WriteLine("[Narrator] He took his knife and went to take what was his.") TextWindow.WriteLine("[Guards] Halt! Macbeth. What is your...") TextWindow.WriteLine("[Narrator] Macbeth took out the guards with his dual throwing knifes") TextWindow.WriteLine("[Narrator] He bloodied their daggers and made it look as if they fought.") TextWindow.WriteLine("Now! I will take my rightful place as King!") TextWindow.WriteLine("{Macbeth opens the door and walks into the Kings room}") TextWindow.WriteLine("[King Duncan] Macbeth? What are you..") TextWindow.WriteLine("Silence you fool. {thrusts dagger into heart} I am King now.") TextWindow.Write("Press enter to continue ") read = TextWindow.Read() If read = " " Then final_3 = 2 Else final_3 = 2 EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////////// While colour_end = 1 For x = 1 To 12 TextWindow.Clear() TextWindow.BackgroundColor = "red" TextWindow.Write("") Program.Delay(500) EndFor TextWindow.BackgroundColor = "black" colour_end = 2 EndWhile 'Conversation Break ////////////////////////////////////////////////////////////////////////////////////////// While final_end = 1 TextWindow.Clear() TextWindow.WriteLine("To be continued...") TextWindow.Write("Press enter ") read = TextWindow.Read() If read = " " Then final_end = 2 Else final_end = 2 EndIf EndWhile 'Conversation Break ///////////////////////////////////////////////////////////////////////////////////// While credits = 1 TextWindow.Clear() If nv_hero > nv_neutral And nv_hero > nv_rogue Then TextWindow.WriteLine("You were overwhelmingly good!") ElseIf nv_neutral > nv_hero And nv_neutral > nv_rogue Then TextWindow.WriteLine("You were overwhelmingly unimpressive.") TextWindow.WriteLine("Be more decisive") ElseIf nv_rogue > nv_hero And nv_rogue > nv_neutral Then TextWindow.WriteLine("You were a terrible person.") TextWindow.WriteLine("Seriously.") EndIf TextWindow.WriteLine("You had "+nv_hero+" hero points.") TextWindow.WriteLine("You had "+nv_neutral+" neutral points.") TextWindow.WriteLine("You had "+nv_rogue+" rogue points.") TextWindow.WriteLine("Game written by Jordan") TextWindow.WriteLine("Story done by Connor") TextWindow.WriteLine("We hope you enjoyed our game!") ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(auto_save) TextWindow.Write("Press enter ") read = TextWindow.Read() If read = " " Then Program.End() Else Program.End() EndIf EndWhile EndWhile 'Bottom of program' End>RNL706.sb< Start>RNM395.sb< Menu() Sub Menu TextWindow.Title = "Jango" TextWindow.Clear() TextWindow.WriteLine(" | ") TextWindow.WriteLine(" |,---.,---.,---.,---.") TextWindow.WriteLine(" |,---|| || || |") TextWindow.WriteLine("`---'`---^` '`---|`---'") TextWindow.WriteLine(" `---' ") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Peamenüü :") TextWindow.WriteLine("") TextWindow.Write("[") TextWindow.ForegroundColor = "Yellow" TextWindow.Write("1") TextWindow.ForegroundColor = "White" TextWindow.WriteLine("] Alusta mängu") TextWindow.Write("[") TextWindow.ForegroundColor = "Yellow" TextWindow.Write("2") TextWindow.ForegroundColor = "White" TextWindow.WriteLine("] Jätka mängu") TextWindow.Write("[") TextWindow.ForegroundColor = "Yellow" TextWindow.Write("3") TextWindow.ForegroundColor = "White" TextWindow.WriteLine("] Tiitrid") TextWindow.Write("[") TextWindow.ForegroundColor = "Yellow" TextWindow.Write("4") TextWindow.ForegroundColor = "White" TextWindow.WriteLine("] Välju") a = TextWindow.ReadKey() If a = 1 Then tutorial() ElseIf a = 2 then konami() elseif a = 3 then credits() elseif a = 4 then Program.End() EndIf Menu() EndSub Sub credits TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Green" TextWindow.Clear() TextWindow.WriteLine(" Programmerija :") TextWindow.ForegroundColor = "Blue" TextWindow.WriteLine(" Janar Velleste") TextWindow.WriteLine(" << Mis mu tsitaat küll võiks olla... >>") TextWindow.WriteLine("") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" Disainer :") TextWindow.ForegroundColor = "Red" TextWindow.WriteLine(" Taago Terestal") TextWindow.WriteLine(" << Ma ei tea, pane midagi suvakat. >>") TextWindow.WriteLine("") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" Juhendaja :") TextWindow.ForegroundColor = "Black" TextWindow.WriteLine(" Vilve Roosioks") TextWindow.WriteLine(" << ... >>") TextWindow.Pause() TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" TextWindow.Clear() Menu() EndSub Sub tutorial TextWindow.Clear() TextWindow.WriteLine("Tere tulemast õpetusse!") TextWindow.Readkey() TextWindow.WriteLine("") TextWindow.WriteLine("Menüü kasutamine :") TextWindow.Write("•Kui näed tekstis ") TextWindow.ForegroundColor = "Green" TextWindow.Write("►") TextWindow.ForegroundColor = "White" TextWindow.WriteLine(" märki, siis viib klahvivajutus sind edasi. ►") TextWindow.Readkey() TextWindow.WriteLine("") TextWindow.WriteLine("•Tekstis saab ka teha valikvastuseid.") TextWindow.WriteLine(" Kui näed valikuid siis vajuta vastavat esitähte/numbrit. ►") TextWindow.Readkey() Valik() TextWindow.WriteLine("•Vahetevahel on vaja vastus kirjutada sisse pikalt.") TextWindow.WriteLine(" Siis kirjuta vastus ja vajuta ENTER klahvi. ►") TextWindow.Readkey() Num() TextWindow.WriteLine("Oled õnnelikult läbinud õpetuse! ►") TextWindow.Readkey() TextWindow.WriteLine("Su laadimiskood on : UP LEFT DOWN RIGHT A A") TextWindow.WriteLine("") TextWindow.WriteLine("Jäta meelde ka üks lause :") TextWindow.WriteLine("") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine("Kindlasti otsi nuppude abil minu imet.") TextWindow.ForegroundColor = "White" TextWindow.Readkey() TextWindow.Clear() Algus() EndSub Sub Valik TextWindow.Clear() TextWindow.WriteLine("Kas said aru?") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("JAH või EI") a = TextWindow.Readkey() TextWindow.ForegroundColor = "White" If a = "j" Then TextWindow.WriteLine("Tore!") TextWindow.Readkey() TextWindow.Clear() Else tutorial() EndIf EndSub Sub Num TextWindow.Clear() TextWindow.WriteLine("Number on 268. Mis on number?") TextWindow.ForegroundColor = "Green" a = TextWindow.ReadNumber() TextWindow.ForegroundColor = "White" If a = "268" Then TextWindow.WriteLine("Hea töö!") TextWindow.Readkey() TextWindow.Clear() Else Num() EndIf EndSub Sub Algus TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓ ▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓▓▓▓ ▓ ▓ ▓▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓ ▓ ▓▓▓ ▓▓▓ ▓▓ ▓ ▓ ▓ ▓▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓ ▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓▓") TextWindow.readkey() TextWindow.Clear() TextWindow.ForegroundColor = "White" TextWindow.WriteLine("...") TextWindow.Readkey() TextWindow.WriteLine("...") TextWindow.Readkey() TextWindow.WriteLine("Ärka üles!") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine(" __ ") TextWindow.WriteLine(" / \ see oli ühe vapra mehe maja... üks maja kuhu ") TextWindow.WriteLine(" |XX| sa ilma loata minna ei taha. ►") TextWindow.WriteLine("--==--") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("Marten: Meil on sulle ülesanne!") TextWindow.WriteLine("Kas oled nõus? ►") TextWindow.readkey() TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("JAH või EI?") TextWindow.ForegroundColor = "White" ValikJvE() TextWindow.Clear() TextWindow.WriteLine("Marten: Sinu nimi saab olema teada kõigile! ►") TextWindow.readkey() TextWindow.WriteLine("Oota... Mis su nimi üldse on?") TextWindow.WriteLine("") TextWindow.Write("Su nimi : ") Nimi = TextWindow.Read() TextWindow.BackgroundColor = "Blue" TextWindow.Clear() TextWindow.WriteLine("Te liigute lossi poole... ►") TextWindow.readkey() TextWindow.WriteLine("Valvur: Kes te olete? ►") TextWindow.readkey() TextWindow.WriteLine("Marten: Mina olen Marten ja tema on...") TextWindow.WriteLine(" ...Jaan vist. ►") TextWindow.Readkey() TextWindow.WriteLine("Sina: Tegelikult olen ma " + Nimi + ". ►") TextWindow.Readkey() TextWindow.WriteLine("Valvur: Huvitav nimi... " + Nimi + " " + Nimi + ". Kus ma seda kuulnud olen?") TextWindow.WriteLine(" Ära puutu midagi! Siin on kõik vana ja haruldane! ►") TextWindow.Readkey() TextWindow.ForegroundColor = "Black" TextWindow.BackgroundColor = "White" TextWindow.Clear() TextWindow.WriteLine("Kuninga juures:") TextWindow.WriteLine("Kuningas Peeter II: Kuidas käbar käib siis ka?!? ►") TextWindow.Readkey() TextWindow.WriteLine("Sina: Mida?") TextWindow.WriteLine("Kuningas: Aga mis siin ikka... meil on sulle ülesanne!") TextWindow.readkey() TextWindow.WriteLine(" Meilt rööviti Südamekristall!") TextWindow.WriteLine(" Tänu sellele oli meie elu tervislik!") TextWindow.WriteLine(" Üks valvuritest ütles, et varas tundus olevat Britteni moodi. ►") TextWindow.Readkey() TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" TextWindow.Clear() TextWindow.WriteLine("Kuningas: Me anname sulle ühe kristalli... ►") TextWindow.Readkey() TextWindow.WriteLine(" Mingi ennustaja ütles,et see päästab kellegi nimega") TextWindow.WriteLine(" " + Nimi + " ja ma usun selliseid kutte alati! ►") TextWindow.WriteLine("") TextWindow.WriteLine("Sinu laadimiskood on B A DOWN DOWN UP B.") TextWindow.Readkey() TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓ ▓▓▓▓") TextWindow.WriteLine(" ▓▓▓ ▓▓▓") Sound.PlayChimeAndWait() star = 1 TextWindow.Readkey() TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" kodu() EndSub Sub ValikJvE a = TextWindow.readkey() If a = "j" Then TextWindow.WriteLine("Tore!") TextWindow.readkey() Else TextWindow.WriteLine("Kas tõesti? Mõtle ümber...") TextWindow.readkey() ValikJvE() EndIf EndSub Sub kodu TextWindow.Clear() TextWindow.WriteLine("Oled kodus. (kirjuta sisse enda valik)") TextWindow.WriteLine("[Vaata ringi] [Välju] [Puhka]") a = TextWindow.Read() If a = "Välju" Then TextWindow.WriteLine("Sa väljud majast ja tunned, et täht tõmbub kergelt purskkaevu poole.") ElseIf a = "Puhka" then TextWindow.WriteLine("Viskad end voodisse, aga tahe minna seiklusele on liiga suur.") elseIf a = "Vaata ringi" then TextWindow.WriteLine("Siin on üpris väike ja värsket õhku on puudu.") endif TextWindow.WriteLine("Sa liigud purskkaevu poole... ►") TextWindow.Readkey() TextWindow.WriteLine("Aga täht lendab su käest purskkaevu olevasse auku.") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine(" | ") TextWindow.WriteLine(" ▓ ") TextWindow.WriteLine(" ▓ ") TextWindow.WriteLine(" ▓▓▓▓▓ ") TextWindow.WriteLine(" ____▓▓▓____ ") TextWindow.Write("| ▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.Write("0") TextWindow.ForegroundColor = "White" TextWindow.Write("▓") If star >= 2 then TextWindow.ForegroundColor = "Green" TextWindow.Write("0") TextWindow.ForegroundColor = "White" Else TextWindow.Write("0") EndIf TextWindow.Write("▓") If star >= 3 Then TextWindow.ForegroundColor = "Blue" TextWindow.Write("0") TextWindow.ForegroundColor = "White" Else TextWindow.Write("0") EndIf TextWindow.WriteLine("▓▓ |") TextWindow.WriteLine("|___________|") TextWindow.readkey() If star = 1 Then PT1() EndIf If star = 2 Then PT2() EndIf If star = 3 Then Boss() EndIf EndSub Sub Kodu2 TextWindow.WriteLine("Oled kodus.") TextWindow.WriteLine("[Vaata ringi] [Välju] [Puhka]") TextWindow.Read() TextWindow.WriteLine("Sina: Oota nüüd sellega! Enne vehkis ta lihtsalt kätega...") TextWindow.WriteLine(" Aga nüüd pole mul enam tähti!!") Program.Delay(2000) TextWindow.WriteLine("Kuid seeeest on mul mu mälestused, mu telefon ja-") TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Britten: On ainult 1 viis neist lahti saamiseks!!! ►") TextWindow.Readkey() END() EndSub Sub PT1 TextWindow.WriteLine("Sa lähed tähte sealt eemaldama, aga see ei tule välja. ►") TextWindow.Readkey() TextWindow.WriteLine("Kaevust hakkab rohkem vett purskama!") TextWindow.WriteLine("Vett pritsib kõikjale! Sa ei näe midagi! ►") TextWindow.Readkey() TextWindow.WriteLine("Kui sa olid vee näost ära pühkinud,") TextWindow.WriteLine(" tundus maailm kuidagi teistmoodi. ►") TextWindow.Readkey() TextWindow.Clear() TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ��▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓ ▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓ ▓▓▓ ▓ ▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓") TextWindow.Readkey() TextWindow.ForegroundColor = "White" TextWindow.WriteLine("Su laadimiskood on B RIGHT A LEFT UP B") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("???: KUIDAS SA SIIA SAID?!?") TextWindow.WriteLine("Sina: Aga kuidas SINA siia tekkisid? ►") TextWindow.Readkey() TextWindow.WriteLine("???: Mõlemad küsimused on head.") TextWindow.WriteLine(" Kahju, et kumbki ei saa vastust. ►") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("Niisiis.. Minu nimi on Marten Jr.Jr.Jr.Jr...(jne.).") TextWindow.WriteLine(" Aga mis on sinu nimi? ►") TextWindow.Readkey() TextWindow.WriteLine("Sina : " + Nimi + ".") TextWindow.WriteLine(" Kas sa saaksid öelda, mis kuupäev täna on? ►") TextWindow.Readkey() TextWindow.WriteLine("Marten Jr: Täna on 20. mai 2031.") TextWindow.WriteLine("Sina: Kas ma olen siis mitusada aastat tulevikus?!? ►") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("Marten Jr: Ma ei usu seda, aga teeskleme, et see on nii...") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" Mis telefon sul on?") TextWindow.Read() TextWindow.ForegroundColor = "White" TextWindow.WriteLine("MISASJA? Sellist vastust poleks ma küll oodanud!") TextWindow.WriteLine(" Me peame sulle uue telefoni ostma! ►") TextWindow.Readkey() TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Blue" TextWindow.Clear() TextWindow.WriteLine("Tere tulemast Soneerasse.") TextWindow.WriteLine("Marten Jr: Arvestades sinu niinimetatud ajareisi pole sul vist raha...") TextWindow.WriteLine(" Ma võin sulle paari sendi eest osta ülimalt vana telefoni. ►") TextWindow.Readkey() TextWindow.WriteLine(" •amsung Galaxy S 15") TextWindow.WriteLine(" •uawei C 84") TextWindow.WriteLine(" •okia Lumia 2050") TextWindow.WriteLine(" •g L 27 II") TextWindow.Readkey() TextWindow.WriteLine("Ega neil tegelikult vahet pole...") TextWindow.WriteLine(" Kõigil on sees 1 Gigaentsüklopeedia, infi-Aku 2.4,") TextWindow.WriteLine(" aga sellepärast vana ekraan ja klahvid. ►") TextWindow.Readkey() TextWindow.BackgroundColor = "Green" TextWindow.ForegroundColor = "Black" TextWindow.Clear() TextWindow.WriteLine("UUS VÕIME!") TextWindow.WriteLine("Vajuta nuppu, et aktiveerida Tark mees taskus! ►") a = TextWindow.Readkey() If a = ("t") Then TextWindow.BackgroundColor = "Blue" TextWindow.ForegroundColor = "White" TextWindow.WriteLine("Kuna sa ei saanud aru misasi see telefon on______") TextWindow.WriteLine(" või mis neil markidel vahet on, siis otsustasid") TextWindow.WriteLine("anda mulle hüüdnime Tark mees taskus. ►__________") TextWindow.Readkey() EndIf TextWindow.ForegroundColor = "White" TextWindow.BackgroundColor = "Black" TextWindow.Clear() TextWindow.WriteLine("Kuidas me nüüd selle kristalli leiame? ►") TextWindow.BackgroundColor = "Blue" TextWindow.Readkey() TextWindow.WriteLine("Minust võib olla kasu... ") TextWindow.WriteLine(" Mulle on sisse ehitatud kõigeradar,") TextWindow.WriteLine("aga selline soov nõuab turvakoodi! ►") TextWindow.Readkey() TextWindow.BackgroundColor = "Black" TextWindow.WriteLine("Marten Jr: Tänapäeval on kõik koodid matemaatilised tehted.") TextWindow.WriteLine(" Sest keegi ei kasuta enam matemaatikat. ►") TextWindow.Readkey() Algus = 0 Matem() EndSub Sub konami TextWindow.WriteLine(" UP") TextWindow.WriteLine(" LEFT RIGHT") TextWindow.WriteLine(" DOWN A B") konami = TextWindow.Read() If konami = ("UPUPDOWNDOWNLEFTRIGHTLEFTRIGHTBA") Then lvl() ElseIf konami = ("UP LEFT DOWN RIGHT A A") then TextWindow.Clear() Algus() ElseIf konami = ("B A DOWN DOWN UP B") then TextWindow.WriteLine("Nimi:") Nimi = TextWindow.Read() TextWindow.Clear() kodu() elseif konami = ("B RIGHT A LEFT UP B") then TextWindow.WriteLine("Nimi:") Nimi = TextWindow.Read() star = 1 TextWindow.Clear() PT1() elseif konami = ("DOWN RIGHT A B DOWN RIGHT") then TextWindow.WriteLine("Nimi:") Nimi = TextWindow.Read() TextWindow.Clear() Algus = 11 Matem() elseif konami = ("LEFT B UP UP A RIGHT") then TextWindow.WriteLine("Nimi:") Nimi = TextWindow.Read() TextWindow.Clear() star = 2 PT2() elseif konami = ("A A UP B LEFT LEFT") then TextWindow.WriteLine("Nimi:") Nimi = TextWindow.Read() TextWindow.Clear() star = 3 Boss() EndIf EndSub Sub lvl TextWindow.Write("Nimi: ") Nimi = TextWindow.Read() TextWindow.Write("Tutorial tehtud(1/0): ") a = TextWindow.ReadNumber() If a = 0 Then tutorial() EndIf TextWindow.Write("Algus Tehtud: ") a = TextWindow.ReadNumber() If a = 0 Then Algus() EndIf TextWindow.Write("Tähtede arv(1-3): ") star = TextWindow.ReadNumber() kodu() EndSub Sub Matem TextWindow.BackgroundColor = "Blue" TextWindow.ForegroundColor = "White" TextWindow.Clear() If Algus = 11 Then Goto Mat11 EndIf TextWindow.WriteLine("Kas oled valmis? J/E") a = TextWindow.Readkey() If a = "j" Then TextWindow.WriteLine("ALUSTAME!") Else PT1() EndIf TextWindow.WriteLine("Esimesena lihtne värk") TextWindow.WriteLine("Kirjuta sisse vastus või et saada abi ►") TextWindow.Readkey() TextWindow.Clear() Mat1: TextWindow.Write("5+5 = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Liitmine on tegevus kus sa võtad") TextWindow.WriteLine("ühe koguse pulki ja teise koguse pulki") TextWindow.WriteLine("ning loed need üle!") Goto Mat1 ElseIf a = 10 then TextWindow.Clear() TextWindow.WriteLine("EDASI!") Else Goto Mat1 EndIf Mat2: TextWindow.Write("5-5 = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Võtad ühest pulkade hulgast") TextWindow.WriteLine("teise pulkade hulga") Goto Mat2 ElseIf a = 0 then TextWindow.Clear() Else Goto Mat2 EndIf Mat3: TextWindow.Write("7*6 = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Liidad A iseendaga B arv kordi.") TextWindow.WriteLine("N: 2*3 = 2+2+2 = 3+3 = 6") Goto Mat3 ElseIf a = 42 then TextWindow.Clear() Else Goto Mat3 EndIf Mat4: TextWindow.Write("54/9 = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Vaatad mitu korda 1 arv mahub teise.") Goto Mat4 ElseIf a = 6 then TextWindow.Clear() Else Goto Mat4 EndIf Mat5: TextWindow.Write("1² = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Ruutu võtmine = arv korrutatud iseendaga.") TextWindow.WriteLine("N: 1² = 1*1 , 2² = 2*2 , 3² = 3*3") Goto Mat5 ElseIf a = 1 then TextWindow.Clear() Else Goto Mat5 EndIf Mat6: TextWindow.Write("Ruutjuur 9 = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Ruutjuur: Leia mille ruut on arv.") TextWindow.WriteLine("N: Ruutjuur 4 = 2 kuna 2² = 4") Goto Mat6 ElseIf a = 3 then TextWindow.Clear() Else Goto Mat6 EndIf Mat7: TextWindow.Write("4² = ") a = TextWindow.ReadNumber() If a = 16 Then TextWindow.Clear() Else Goto Mat7 EndIf Mat8: TextWindow.Write("2³ = ") a = TextWindow.Read() If a = "t" Then TextWindow.WriteLine("Kuup : nagu ruut aga 3 korda.") TextWindow.WriteLine("N: 1³ = 1*1*1, 2³ = 2*2*2") Goto Mat8 ElseIf a = 8 then TextWindow.Clear() Else Goto Mat8 EndIf Mat9: TextWindow.Write("Ruutjuur 25 = ") a = TextWindow.ReadNumber() If a = 5 Then TextWindow.Clear() Else Goto Mat9 EndIf Mat10: TextWindow.Write("3³ = ") a = TextWindow.ReadNumber() If a = 27 Then TextWindow.Clear() TextWindow.WriteLine("10 tehtud, siin on laadimiskood:") TextWindow.WriteLine("DOWN RIGHT A B DOWN RIGHT") Else Goto Mat10 EndIf Mat11: TextWindow.Write("7² = ") a = TextWindow.ReadNumber() If a = 49 Then TextWindow.Clear() Else Goto Mat11 EndIf Mat12: TextWindow.Write("Ruutjuur 121 = ") a = TextWindow.ReadNumber() If a = 11 Then TextWindow.Clear() Else Goto Mat12 EndIf Mat13: TextWindow.Write("5³ = ") a = TextWindow.ReadNumber() If a = 125 Then TextWindow.Clear() TextWindow.WriteLine("LÕPUSIRGE!") Else Goto Mat13 EndIf Mat14: TextWindow.Write("1*2 = ") a = TextWindow.ReadNumber() If a = 2 Then Sound.PlayChimes() Else Goto Mat14 EndIf Mat15: TextWindow.Write("2*2 = ") a = TextWindow.ReadNumber() If a = 4 Then Sound.PlayChimes() Else Goto Mat15 EndIf Mat16: TextWindow.Write("4*2 = ") a = TextWindow.ReadNumber() If a = 8 Then Sound.PlayChimes() Else Goto Mat16 EndIf Mat17: TextWindow.Write("8*2 = ") a = TextWindow.ReadNumber() If a = 16 Then Sound.PlayChimes() Else Goto Mat17 EndIf Mat18: TextWindow.Write("16*2 = ") a = TextWindow.ReadNumber() If a = 32 Then Sound.PlayChimes() Else Goto Mat18 EndIf Mat19: TextWindow.Write("32*2 = ") a = TextWindow.ReadNumber() If a = 64 Then Sound.PlayChimes() Else Goto Mat19 EndIf Mat20: TextWindow.Write("64*2 = ") a = TextWindow.ReadNumber() If a = 128 Then Sound.PlayChimes() Else Goto Mat20 EndIf Mat21: TextWindow.Write("128*2 = ") a = TextWindow.ReadNumber() If a = 256 Then Sound.PlayChimes() Else Goto Mat21 EndIf Mat22: TextWindow.Write("256*2 = ") a = TextWindow.ReadNumber() If a = 512 Then Sound.PlayChimes() Else Goto Mat22 EndIf Mat23: TextWindow.Write("512*2 =") a = TextWindow.ReadNumber() If a = 1024 Then Sound.PlayChimes() Else Goto Mat23 EndIf Mat24: TextWindow.Write("1024*2 = ") a = TextWindow.ReadNumber() If a = 2048 Then Sound.PlayChimes() Else Goto Mat24 EndIf Mat25: TextWindow.Write("2048*2 = ") a = TextWindow.ReadNumber() If a = 4096 Then Sound.PlayChimes() TextWindow.WriteLine("Lukk lahti! Otsin tähte...") Algus = 0 T2() Else Goto Mat25 EndIf EndSub Sub T2 If Algus = 1 Then Goto Kuju EndIf Program.Delay(500) TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Black" TextWindow.Clear() TextWindow.BackgroundColor = "Blue" TextWindow.ForegroundColor = "White" TextWindow.WriteLine("Täht on purskkaevu lähedal kuju sees.") TextWindow.ForegroundColor = "Black" TextWindow.BackgroundColor = "White" TextWindow.WriteLine("Marten Jr. Mul juhtumisi hea haamer kaasas.") TextWindow.WriteLine("Vajuta suvalisi nuppe, et lõhkuda kuju! ►") TextWindow.Readkey() a = 0 Algus = 1 Kuju: If a > 49 Then TextWindow.WriteLine("Seal see on!") TextWindow.Readkey() TextWindow.Readkey() TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓ ▓▓▓▓") TextWindow.WriteLine(" ▓▓▓ ▓▓▓") Sound.PlayChimeAndWait() TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" star = 2 TextWindow.Readkey() kodu() ElseIf a >= 40 then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓▓▓▓") Hit() elseif a >= 30 then TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓▓") TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine("▓ ▓▓▓▓▓") Hit() elseif a >= 20 then TextWindow.WriteLine("") TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓▓") TextWindow.WriteLine(" ▓▓") TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓ ▓") TextWindow.WriteLine("▓ ▓▓▓▓▓ ▓") Hit() elseif a >= 10 then TextWindow.WriteLine("") TextWindow.WriteLine(" ▓▓") TextWindow.WriteLine("▓▓▓▓▓▓") TextWindow.WriteLine("▓ ▓▓▓") TextWindow.WriteLine("▓ ��▓▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓▓▓ ▓") Hit() Else TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine("▓▓▓▓▓▓▓▓▓") TextWindow.WriteLine("▓ ▓▓▓ ▓") TextWindow.WriteLine("▓ ▓▓▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓ ▓") TextWindow.WriteLine(" ▓▓▓▓▓") Hit() EndIf EndSub Sub Hit TextWindow.Readkey() TextWindow.Clear() Sound.PlayClick() a = a + 1 T2() EndSub ' Ma jõudsin arusaamani, et proovisime teha Action-mängu tekstiga... Sub PT2 TextWindow.WriteLine("Vesi näkku jälle...") TextWindow.WriteLine("Seekord siis minevik... ►") TextWindow.Readkey() TextWindow.Clear() TextWindow.ForegroundColor = "Blue" TextWindow.WriteLine(" ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓ ▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓ ▓▓▓ ▓ ▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓") TextWindow.Readkey() TextWindow.ForegroundColor = "White" TextWindow.WriteLine("Su laadimiskood on LEFT B UP UP A RIGHT") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("Martenus: KUIDAS SA SIIA SAID?!?") TextWindow.WriteLine(" SA OLED VIST JUMAL!") TextWindow.WriteLine(" VÕTA MU SUURIM AARE! ►") TextWindow.Readkey() TextWindow.Clear() TextWindow.ForegroundColor = "Blue" TextWindow.WriteLine(" ▓") TextWindow.WriteLine(" ▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓ ▓▓▓▓") TextWindow.WriteLine(" ▓▓▓ ▓▓▓") Sound.PlayChimeAndWait() TextWindow.ForegroundColor = "White" star = 3 TextWindow.Readkey() kodu() EndSub Sub Boss TextWindow.WriteLine("Viimast korda seda purskkaevu kasutada.") TextWindow.WriteLine("Hoia alt Britten. Siit ma tulen! ►") TextWindow.Readkey() TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Red" TextWindow.Clear() TextWindow.WriteLine(" ▓ ▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓ ▓ ▓▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓ ▓▓▓▓ ▓▓▓ ▓▓ ▓ ▓ ▓ ▓▓▓") TextWindow.WriteLine(" ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓") TextWindow.WriteLine(" ▓▓▓ ▓▓▓▓ ▓ ▓▓▓ ▓ ▓▓ ▓▓▓") TextWindow.Readkey() TextWindow.ForegroundColor = "Black" TextWindow.WriteLine("Su laadimiskood on A A UP B LEFT LEFT") TextWindow.Readkey() TextWindow.Clear() TextWindow.WriteLine("Britten: Siin sa oled! Kümne minutiga siin... kiire.") TextWindow.WriteLine(" Aga miks sa mu kuju lõhkusid? ►") TextWindow.Readkey() TextWindow.WriteLine("Sina: See polnudki mingi mehe kuju?") TextWindow.Write("Britten: KAS ") Program.Delay(800) TextWindow.ForegroundColor = "Blue" TextWindow.Write("SA JUST ") Program.Delay(800) TextWindow.ForegroundColor = "Green" TextWindow.Write("SOLVASID") Program.Delay(800) TextWindow.ForegroundColor = "Red" TextWindow.WriteLine(" MIND?!? ►") TextWindow.ForegroundColor = "Black" TextWindow.Readkey() TextWindow.WriteLine(" Ma veel näitan sulle oma võimeid! Vaata pealkirja!") TextWindow.WriteLine("Sina: Millest sa räägid? ►") TextWindow.Readkey() TextWindow.Title = "Jango*" klikk() TextWindow.Title = "Jango**" klikk() TextWindow.Title = "Jango** *" klikk() TextWindow.Title = "Jango** **" klikk() TextWindow.Title = "Jango** ** *" klikk() TextWindow.Title = "Jango** ** **" klikk() TextWindow.Title = "Jango** ** ***" klikk() TextWindow.Title = "Jango** ** ****" klikk() TextWindow.Title = "Jango** ** *****" klikk() TextWindow.Title = "jangO** ** ***I*" klikk() TextWindow.Title = "jANgO** *N ***I*" klikk() TextWindow.Title = "jANgo** *n *A*i*" klikk() TextWindow.Title = "jaNGo*N *n *A*i*" klikk() TextWindow.Title = "JanGo*N *n Pa*I*" klikk() TextWindow.Title = "jango*N ON Pa*I*" klikk() TextWindow.Title = "jangoEn oN pA*i*" klikk() TextWindow.Title = "BangOEn on pa*i*" klikk() TextWindow.Title = "BAIgOEn on pA*I*" klikk() TextWindow.Title = "BAIgTeN On PA*I*" klikk() TextWindow.Title = "BaIgTen ON PARI*" klikk() TextWindow.Title = "bRiGTen ON PaRi*" klikk() TextWindow.Title = "bRiGTEN oN pARiM" klikk() TextWindow.Title = "BRITTEN ON PARIM" TextWindow.WriteLine(" Kas midagi juhtus?") TextWindow.WriteLine("Britten: Küll sa näed... ►") TextWindow.Readkey() TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" kilk() TextWindow.BackgroundColor = "Green" kilk() TextWindow.BackgroundColor = "Blue" kilk() TextWindow.BackgroundColor = "Red" kilk() TextWindow.WriteLine("Tahad veel näha? ►") TextWindow.Readkey() TextWindow.WriteLine("Sina: Sa oled ju lihtsalt kätega vehkinud...") TextWindow.WriteLine("Britten: Ma ei suuda sind enam võtta!") TextWindow.WriteLine(" Ainult üks trikk veel ja siis oled läinud. ►") TextWindow.Readkey() Desktop.SetWallPaper("http://www.electrum.ee/ul/Viimsi_kool.JPG") TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "White" TextWindow.Clear() Kodu2() EndSub Sub klikk Sound.PlayClick() Program.Delay(200) EndSub Sub kilk Sound.PlayBellRing() TextWindow.Clear() TextWindow.WriteLine("MUHAHAHA!") Program.Delay(500) EndSub Sub END TextWindow.Title = "CRASH" TextWindow.BackgroundColor = "Blue" TextWindow.ForegroundColor = "White" TextWindow.Clear() TextWindow.WriteLine("A problem has been detected and Windows has been shut down to prevent damage") TextWindow.WriteLine("to your computer") TextWindow.WriteLine("") TextWindow.WriteLine("MANUALLY_INITIATED_CRASH") TextWindow.WriteLine("") TextWindow.WriteLine("If this is the first time you've seen this Stop error screen,") TextWindow.WriteLine("restart your computer. If this screen appears again, follow") TextWindow.WriteLine("these steps:") TextWindow.WriteLine("") TextWindow.WriteLine("Check to make sure any new hardware or software is properly installed.") TextWindow.WriteLine("If this is a new installation, ask your hardware or software manufacturer") TextWindow.WriteLine("for any Windows updates you might need.") TextWindow.WriteLine("") TextWindow.WriteLine("If problems continue, disable or remove any newly installed hardware") TextWindow.WriteLine("or software. Disable BIOS memory options such as caching or shadowing.") TextWindow.WriteLine("If you need to use Safe Mode to remove or disable components, restart") TextWindow.WriteLine("your computer, press F8 to select Advanced Startup Options, and then") TextWindow.WriteLine("select Safe Mode.") TextWindow.WriteLine("") TextWindow.WriteLine("Technical information:") TextWindow.WriteLine("") TextWindow.WriteLine("*** STOP: 0x000000E2 (0x00000000,0x00000000,0x00000000,0x00000000)") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.Write("Collecting data for crash dump .") Program.Delay(500) TextWindow.Write(".") Program.Delay(500) TextWindow.WriteLine(".") Program.Delay(500) TextWindow.Write("Initializing disk for crash dump .") Program.Delay(500) TextWindow.Write(".") Program.Delay(500) TextWindow.WriteLine(".") Program.Delay(500) TextWindow.WriteLine("Physical memory dump complete.") TextWindow.WriteLine("Contact your system admin or technical support group for further assistance.") TextWindow.Readkey() TextWindow.Title = "Jango" TextWindow.BackgroundColor = "Black" TextWindow.ForegroundColor = "Red" TextWindow.Clear() TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine("") TextWindow.WriteLine(" ▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓") TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓ ▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓ ▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓ ▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Red" TextWindow.Write(" ▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.Write(" ▓") TextWindow.ForegroundColor = "Green" TextWindow.Write(" ▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.Write(" ▓▓▓") TextWindow.ForegroundColor = "Green" TextWindow.Write(" ▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓ ▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓▓▓ ▓▓▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓▓ ▓▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Blue" TextWindow.Write(" ▓") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓���▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "Yellow TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓") TextWindow.WriteLine(" ▓▓▓▓▓▓▓▓▓▓") TextWindow.ForegroundColor = "White" TextWindow.Write(" Microsoft®") TextWindow.ForegroundColor = "Yellow" TextWindow.WriteLine(" ▓▓▓▓▓") TextWindow.ForegroundColor = "White" TextWindow.Write(" __ ___ _ ") TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("XP") TextWindow.ForegroundColor = "White" TextWindow.WriteLine(" \ \ / (_)_ _ __| |_____ __ _____") TextWindow.WriteLine(" \ \/\/ /| | ' \/ _` / _ \ V V (_-<") TextWindow.WriteLine(" \_/\_/ |_|_||_\__,_\___/\_/\_//__/") TextWindow.Readkey() TextWindow.Clear() Algus() EndSub End>RNM395.sb< Start>RNM642.sb< GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.Width=800 GraphicsWindow.Height =800 GraphicsWindow.Title ="Mathflowers While "true for r25=5 to Math.GetRandomNumber (150) Step 2+Math.GetRandomNumber (5) GraphicsWindow.PenColor=LDColours.HSLtoRGB (math.Remainder (r25*3 360) 1 .6) for x=0 to 360 Step .1 cy=ldmath.Sin(x)*150+400+ldmath.Sin(x*10)*r25 cx=ldmath.cos(x)*150+400+ldmath.cos(x*10)*r25 If x>0 then GraphicsWindow.DrawLine (ox oy cx cy) endif ox=cx oy=cy EndFor EndFor ldGraphicsWindow.FloodFill (400 400 LDColours.HSLtoRGB (Math.GetRandomNumber (360) 0.7 0.4)) gr=LDShapes.BrushGradient ("2=Yellow;1=White","") LDShapes.BrushEllipse (gr 380 380 40 40) Program.Delay (3555) GraphicsWindow.Clear () EndWhile End>RNM642.sb< Start>RNN417.sb< ' program by parYvan Leduc March 15th, 2016 ' time 8 secondes for a full scan and results image=ImageList.LoadImage("http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001854.jpg") width=499 height=640 GraphicsWindow.Title = "Low and Hight pixels finder of an image " GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=680 GraphicsWindow.Width=1300 GraphicsWindow.BrushColor = "yellow" GraphicsWindow.FontSize = "25" GraphicsWindow.drawboundtext(600,50,1000,"Low and Hight pixels finder of an image") 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,"Apollo 12 Saturn V on Transporter at http://grin.hq.nasa.gov/IMAGES/SMALL/GPN-2000-001854.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) GraphicsWindow.BrushColor = "red" box2 = Controls.AddTextBox(800, 250) Pixels = LDImage.GetImagePixels(image) For y = 1 To height+10 For x= 1 To width+9 hex=Pixels[x][y] pixels_anaylse() Endfor EndFor image2 = LDImage.SetImagePixels(Pixels) GraphicsWindow.DrawresizedImage(image2,10,10,width,height) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = "16" GraphicsWindow.DrawBoundText (800,200,300,"255,255,255 white pixels ") GraphicsWindow.BrushColor = "red" GraphicsWindow.FontSize = "16" GraphicsWindow.DrawBoundText (800,300,300,"0,0,0 black pixels ") Sound.PlayBellRing() ' ******************************* end of program *************************************** sub pixels_anaylse ' determine white pixel 255,255,255 pure white ,over exposed pixels or highlight with no details or specular light 'TextWindow.WriteLine(hex) If hex = "#FFFFFFFF" Then whitepix=whitepix+1 Pixels[x][y] = "blue" Controls.SetTextBoxText(box1,whitepix) Endif ' determine black pixels 0,0,0 pure black ,under exposed pixels or shadows with no details If hex = "#FF000000" Then blackpix=blackpix+1 Pixels[x][y] = "red" Controls.SetTextBoxText(box2,blackpix) Endif EndSub End>RNN417.sb< Start>RNQ407.sb< ' SmallBasic Version 1.1 ' Program: RubberBand ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/a0e03c4d-a685-4b56-ab55-a4902fa20155/click-and-drag-to-make-rectangle ' ImportURL: http://smallbasic.com/program/? ' Extension: (LitDev, 3x LDCursors) ' Comment: ex. GWCapture.sb ' http://photographyblogger.net/beautiful-sunset-pictures/ ' Variables: dimensions of frame(x0,y0, w0,h0 | w,h) ' where x0;y0 is the current ancor point (left top) and ' w;h may be (+/-) signed, while w0;h0 are |absolute| ' x,y .. init ancor point of frame (from where began to enlarge 'in statu nascendi') ' ToDo: ' ================================================================================ img = "http://www.photographyblogger.net/wp-content/uploads/2010/10/sunset17.jpg" title = "Rubberband " gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.Title = title 'GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawResizedImage(img, 0,0, gw,gh) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "#40FFFF00" frame = Shapes.AddRectangle(0,0) GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp ' ////////// EVENTs \\\\\\\\\\ Sub OnMouseMove mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY '' Use of following 'If' branch: To continue frame usage after MouseUp outside of GW and back into again If Mouse.IsLeftButtonDown <> "True" Then OnMouseUp() EndIf If doResize Then w = mx-x h = my-y w0 = Math.Abs(w) h0 = Math.Abs(h) Controls.SetSize(frame, w0,h0) If (mx < x) And (my < y) Then ' II Shapes.Move(frame, mx,my) x0 = mx y0 = my ElseIf (mx < x) Then ' III Shapes.Move(frame, mx,y) x0 = mx ElseIf (my < y) Then ' I Shapes.Move(frame, x,my) y0 = my Else ' IV x0 = x y0 = y EndIf EndIf '' In this way, does'nt care if partly outside of GW If dragOn Then '' ... If fullyInsideGW ... Then ... x0 = mx-xOff y0 = my-yOff Shapes.Move(frame, x0,y0) '' ... Else (outside) ... Then ... EndIf EndIf UpdateTitle() EndSub Sub OnMouseDown x = mx y = my If (mx > x0 And mx < x0+w0) And (my > y0 And my < y0+h0) Then ' cursor inside frame LDCursors.SizeAll() xOff = mx-x0 yOff = my-y0 dragOn = "True" Else LDCursors.Cross() Shapes.Move(frame, x,y) doResize = "True" EndIf EndSub '' NOT recognized if happens outside of GW, so check back under 'OnMouseMove' Sub OnMouseUp LDCursors.Arrow() dragOn = "" doResize = "" EndSub ' ////////// SUBs \\\\\\\\\\ Sub UpdateTitle GraphicsWindow.Title = title + " x0;y0: "+ x0 +";"+ y0 +" | w;h: "+ w0 +";"+ h0 '+ " || " +mx+"|"+my '+ " || "+x+"|"+y+" | "+w+"|"+h EndSub End>RNQ407.sb< Start>RNQ519.sb< Play = ImageList.LoadImage("http://img42.imageshack.us/img42/6268/playj.png") Options = ImageList.LoadImage("http://img141.imageshack.us/img141/6408/optionsz.png") Load = ImageList.LoadImage("http://img208.imageshack.us/img208/6023/loadk.png") Play2 = ImageList.LoadImage("http://img208.imageshack.us/img208/9475/play2.png") GraphicsWindow.BackgroundColor = "Red" Penw = GraphicsWindow.PenWidth GraphicsWindow.Width = Desktop.Width-17 GraphicsWindow.Height = Desktop.Height-75 GraphicsWindow.Title = "Shark" GraphicsWindow.Left = .5 GraphicsWindow.Top = .5 GraphicsWindow.BackgroundColor = "red" GraphicsWindow.BrushColor = "gray" GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,20) GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawRectangle(1,1,GraphicsWindow.Width-2,20) GraphicsWindow.PenWidth = Penw GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(10,2,30, "File") GraphicsWindow.DrawBoundText(40,2,50, "Options") GraphicsWindow.DrawBoundText(95,2,30, "Help") Menu() Sub Menu PlayButton = Shapes.AddImage(Play) OptionsButton = Shapes.AddImage(Options) LoadButton = Shapes.AddImage(Load) Shapes.Move(LoadButton, 490, 490) Shapes.Move(PlayButton, 220,50) Shapes.Move(OptionsButton, 330, 300) EndSub End>RNQ519.sb< Start>RNQ739.sb< ' Fireworks ' Version 0.1 ' Copyright © 2017 Nonki Takahashi. The MIT License. GraphicsWindow.Title = "Fireworks" GraphicsWindow.BackgroundColor = "Black" Init() DrawStars() While "True" fire = "" x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh / 2) Shapes.Move(mask, x - mr, y - mr) Shapes.ShowShape(mask) r = Math.GetRandomNumber(3) * 10 + 50 n = 40 c1 = Math.GetRandomNumber(256) - 1 c2 = Math.GetRandomNumber(256) - 1 i = Math.GetRandomNumber(3) If i = 1 Then fc = GraphicsWindow.GetColorFromRGB(255, c1, c2) ElseIf i = 2 Then fc = GraphicsWindow.GetColorFromRGB(c1, 255, c2) Else fc = GraphicsWindow.GetColorFromRGB(c1, c2, 255) EndIf GraphicsWindow.PenColor = fc GraphicsWindow.BrushColor = fc a = 0 GraphicsWindow.PenWidth = 1 For i = 1 To n _a = Math.GetRadians(a) a = a + 9 _x = x + r * Math.Cos(_a) _y = y + r * Math.Sin(_a) GraphicsWindow.DrawLine(x, y, _x, _y) EndFor Shapes.HideShape(mask) a = 0 GraphicsWindow.PenWidth = 0 For k = 1 To 250 a = Math.GetRandomNumber(n) * 9 _a = Math.GetRadians(a) _r = Math.GetRandomNumber(r) fire[k] = Shapes.AddRectangle(1, 1) _x = x + _r * Math.Cos(_a) _y = y + _r * Math.Sin(_a) Shapes.Move(fire[k], _x, _y) EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x - mr, y - mr, 2 * mr, 2 * mr) For j = 1 To 20 n = Array.GetItemCount(fire) id = Array.GetAllIndices(fire) For i = 1 To n If fire[id[i]] <> "" Then rnd = Math.GetRandomNumber(4) If rnd = 1 Then Shapes.Remove(fire[id[i]]) fire[id[i]] = "" Else x = Shapes.GetLeft(fire[id[i]]) rnd = Math.GetRandomNumber(2) If rnd = 1 Then x = x - 1 Else x = x + 1 EndIf y = Shapes.GetTop(fire[id[i]]) Shapes.Move(fire[id[i]], x, y + 4) EndIf EndIF EndFor Program.Delay(50) EndFor n = Array.GetItemCount(fire) id = Array.GetAllIndices(fire) For i = 1 To n Shapes.Remove(fire[id[i]]) EndFor EndWhile Sub DrawStars GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#CCFFFFFF" For i = 1 To 500 x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh) star = Shapes.AddRectangle(1, 1) Shapes.Move(star, x, y) EndFor GraphicsWindow.BrushColor = "Black" mr = 90 mask = Shapes.AddEllipse(2 * mr, 2 * mr) Shapes.HideShape(mask) EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh EndSub End>RNQ739.sb< Start>RNS246.sb< 'Check if a provided file is in the current folder. Question answered by codingCat aka Matthew L. Parets :-) TextWindow.WriteLine("File search. Is the requested file in the default folder.") TextWindow.WriteLine("") path = Program.Directory ' The following line could be harmful and has been automatically commented. ' filelist = File.GetFiles(path) TextWindow.Write("Enter file to search for: ") filename = TextWindow.Read() filename = Text.ConvertToLowerCase(filename) cnt = Array.GetItemCount(filelist) TextWindow.WriteLine(cnt + " files in the current folder") TextWindow.WriteLine("") found = "False" For i = 1 To 14 TextWindow.Write(filelist[i]) checkfile = text.ConvertToLowerCase(filelist[i]) statusCheck = Text.IsSubText(checkfile,filename) If (statusCheck = "True") then TextWindow.ForegroundColor = "yellow" TextWindow.Write(" <---") TextWindow.ForegroundColor = "gray" found = "True" EndIf TextWindow.WriteLine("") EndFor TextWindow.WriteLine("") TextWindow.Write("Your file was ") If (found <> "True") Then TextWindow.Write("not ") EndIf TextWindow.WriteLine("found") End>RNS246.sb< Start>RNS835.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 pllw For y= 0 to 11 For x=-10 to 20 If x>0 And x<10 And y>1 And y<9 Then cc=LD3DView.AddCube (view3D 5 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*5+args[1], 75, -32.5+y*5+args[2]) LD3DView.AddImage (view3D cc "" ii[6] "D") elseIf x>0 And x<10 And (y=1 or y=11) then For f=0 to 5 cc=LD3DView.AddCube (view3D 5 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*5+args[1], 75+f, -32.5+y*5+args[2]) LD3DView.AddImage (view3D cc "" ii[2] "D") endfor else cc=LD3DView.AddCube (view3D 5 "beige" "D") LD3DView.TranslateGeometry (view3D cc 25+x*5+args[1], 80, -32.5+y*5+args[2]) LD3DView.AddImage (view3D cc "" ii[2] "D") endif endfor endfor EndSub cc=LD3DView.AddCube (view3D 55 "beige" "D") LD3DView.TranslateGeometry (view3D cc 0, 50, -2.5) LD3DView.AddImage (view3D cc "" ii[2] "D") LDCall.Function2 ("pllw" 0 0) cc=LD3DView.AddCube (view3D 55 "beige" "D") LD3DView.TranslateGeometry (view3D cc 100, 50, -2.5) LD3DView.AddImage (view3D cc "" ii[2] "D") tt="0:-15:11" For f=0 to 180 ss=ldmath.Sin(f)*11 sc=ldmath.cos(f)*11 tt=tt+":0:"+ss+":"+sc endfor tb=LD3DView.AddTube (view3D tt 3 20 "gray" "D") LD3DView.TranslateGeometry (view3D tb 50 95 5) f5=45 LDEvents.MouseWheel=mww ya=151 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>RNS835.sb< Start>RNT262.sb< ' Author: Carl Daniel ' Project Euler Problem 28 ' Compute the sum of the diagonals of a spiral of consequtive integers ' that has size 1001 x 1001 ' This solution calcuates the totals directly without any looping. ' Demonstrating that this solution is correct is left as an exercise for the student ' (hint: sum of squares and sum of integers are important formulas to know for solving this problem). Size = 501 DiagonalSum = 4*Size*(2*Size-1)*(2*Size+1)/3 - 6*Size*(Size-1) - 3 TextWindow.Write("For size ") TextWindow.Write(Size) TextWindow.Write(" the diagonal sum is ") TextWindow.WriteLine(DiagonalSum) End>RNT262.sb< Start>RNW591.sb< MAG = 200 WIDTH = MAG * 3 HEIGHT = MAG * 2 DIAMETER = HEIGHT * 3 / 5 GraphicsWindow.Title = "Japan" GraphicsWindow.Width = WIDTH GraphicsWindow.Height = HEIGHT GraphicsWindow.BrushColor = "#D7003A" x = (WIDTH - DIAMETER) / 2 y = (HEIGHT - DIAMETER) / 2 GraphicsWindow.FillEllipse(x, y, DIAMETER, DIAMETER) End>RNW591.sb< Start>RNX613.sb< Ball = Shapes.AddImage("http://sean.alyrica.net/crosshair.png") LDShapes.AnimationPause(Ball) Turrit = Shapes.AddImage("http://sean.alyrica.net/Turrit.png") Shapes.Move(Turrit,- 10, 200) GraphicsWindow.Show() GraphicsWindow.CanResize = "No" GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseUp = MouseUp GraphicsWindow.MouseMove = MouseMove Gravity = 0 Radius = 200 For i = 1 to 10 Tankx[i] = Math.GetRandomNumber(200) + GraphicsWindow.Width Tanky[i] = Math.GetRandomNumber(GraphicsWindow.Height - 20) Tank[i] = Shapes.AddImage(Program.Directory + "\Tank.bmp") Shapes.Move(Tank[i], Tankx[i], Tanky[i]) Shapes.Rotate(Tank[i] , 270) Endfor While 1 = 1 Program.Delay(5) Tx = Tx + .5 movetanks() Mousey = Mouse_Y - 210 Angle = Math.ArcTan(Mousey / Mouse_x) x = Radius * Math.Cos(Angle) y = Radius * Math.Sin(Angle) + 210 If Angle > 360 Then Angle = 0 EndIf Movemissile() Shapes.Rotate(Turrit , Math.GetDegrees(Angle)) Shapes.Move(Ball,x,y) EndWhile '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^Subroutines^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sub MouseDown If Mouse.IsLeftButtonDown = "True" Then I = I + 1 GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "Red" Missile[i] = Shapes.AddRectangle(10,5) LDShapes.AnimationSet(Ball,2) Vh[i] = Math.GetDegrees(Math.Cos(Angle)) * 10 Vv[i] = Math.GetDegrees(Math.Sin(Angle)) * 10 Timestart[i] = Clock.ElapsedMilliseconds / 1000 Shapes.Rotate(Missile[i] ,Math.GetDegrees(Angle)) EndIf EndSub Sub MouseUp LDShapes.AnimationSet(Ball,1) EndSub Sub MouseMove Mouse_x = GraphicsWindow.MouseX Mouse_Y = GraphicsWindow.MouseY EndSub Sub Movemissile Timenow[i] = Clock.ElapsedMilliseconds / 1000 - Timestart[i] Misslex[i] = Vh[i] * Timenow[i] + 20 Missiley[i] = Vv[i] * Timenow[i] + (Math.Power(Timenow[i],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[i], Misslex[i], Missiley[i] ) p = i - 1 Timenow[p] = Clock.ElapsedMilliseconds / 1000 - Timestart[p] Misslex[p] = Vh[p] * Timenow[p] + 20 Missiley[p] = Vv[p] * Timenow[p] + (Math.Power(Timenow[p],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[p], Misslex[p], Missiley[p] ) p1 = i - 2 Timenow[p1] = Clock.ElapsedMilliseconds / 1000 - Timestart[p1] Misslex[p1] = Vh[p1] * Timenow[p1] + 20 Missiley[p1] = Vv[p1] * Timenow[p1] + (Math.Power(Timenow[p1],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[p1], Misslex[p1], Missiley[p1] ) p2 = i - 3 Timenow[p2] = Clock.ElapsedMilliseconds / 1000 - Timestart[p2] Misslex[p2] = Vh[p2] * Timenow[p2] + 20 Missiley[p2] = Vv[p2] * Timenow[p2] + (Math.Power(Timenow[p2],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[p2], Misslex[p2], Missiley[p2] ) P3 = i - 4 Timenow[P3] = Clock.ElapsedMilliseconds / 1000 - Timestart[P3] Misslex[P3] = Vh[P3] * Timenow[P3] + 20 Missiley[P3] = Vv[P3] * Timenow[P3] + (Math.Power(Timenow[P3],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[P3], Misslex[P3], Missiley[P3] ) P4 = i - 5 Timenow[P4] = Clock.ElapsedMilliseconds / 1000 - Timestart[P4] Misslex[P4] = Vh[P4] * Timenow[P4] + 20 Missiley[P4] = Vv[P4] * Timenow[P4] + (Math.Power(Timenow[P4],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[P4], Misslex[P4], Missiley[P4] ) P5 = i - 6 Timenow[P5] = Clock.ElapsedMilliseconds / 1000 - Timestart[P5] Misslex[P5] = Vh[P5] * Timenow[P5] + 20 Missiley[P5] = Vv[P5] * Timenow[P5] + (Math.Power(Timenow[P5],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[P5], Misslex[P5], Missiley[P5] ) P6 = i - 7 Timenow[P6] = Clock.ElapsedMilliseconds / 1000 - Timestart[P6] Misslex[P6] = Vh[P6] * Timenow[P6] + 20 Missiley[P6] = Vv[P6] * Timenow[P6] + (Math.Power(Timenow[P6],2) * (Gravity / 2)) + 210 Shapes.Move(Missile[P6], Misslex[P6], Missiley[P6] ) EndSub Sub movetanks Shapes.Move(Tank[1], Tankx[1] - Tx, Tanky[1]) Shapes.Move(Tank[2], Tankx[2] - Tx, Tanky[2]) Shapes.Move(Tank[3], Tankx[3] - Tx, Tanky[3]) Shapes.Move(Tank[4], Tankx[4] - Tx, Tanky[4]) Shapes.Move(Tank[5], Tankx[5] - Tx, Tanky[5]) Shapes.Move(Tank[6], Tankx[6] - Tx, Tanky[6]) Shapes.Move(Tank[7], Tankx[7] - Tx, Tanky[7]) Shapes.Move(Tank[8], Tankx[8] - Tx, Tanky[8]) Shapes.Move(Tank[9], Tankx[9] - Tx, Tanky[9]) Shapes.Move(Tank[10], Tankx[10] - Tx, Tanky[10]) If Misslex[1] > Tankx - Tx And Misslex[1] < Tankx[1] - Tx + 40 And Missiley[1] > Tanky[1] And Missiley[1] < Tanky[1] + 20 Then Program.End() EndIf EndSub End>RNX613.sb< Start>RPB297-0.sb< ' Turtle Flower 4 ' Copyright © 2020 Nonki Takahashi. The MIT License. ' Program ID RPB297-0 title = "Turtle Flower" Init() Torus() GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Transparent" GraphicsWindow.BrushColor = "#99000000" g = 214 For j = 1 To 390 Turtle.PenUp() Turtle.Move(scale * _r) Turtle.PenDown() If j <= 240 Then Seed() ElseIf 351 <= j Then Petal() EndIf Turtle.Turn(angle) _r = _r + k _s = _s * ds EndFor Turtle.Hide() Sub Init gw = 300 gh = 300 GraphicsWindow.Width = gw GraphicsWindow.Height = gh Turtle.Speed = 10 Turtle.X = gw / 2 Turtle.Y = gh / 2 Turtle.Show() k = 144 / 55 angle = 360 / k GraphicsWindow.Title = title + " " + angle size = 150 scale = size / 1000 _s = 11 _r = 0 ds = 1.006 EndSub Sub Petal points = "" i = 0 s = 10 Turtle.Turn(-50) g = g + 1 color = GraphicsWindow.GetColorFromRGB(255, g, 0) GraphicsWindow.PenColor = color For a = s To 360 Step s Turtle.Move(s * (1 + LDMath.Sin(2*a)) / 2.6) Turtle.Turn(s) i = i + 1 points[i][1] = Turtle.X points[i][2] = Turtle.Y EndFor Turtle.Turn(50) GraphicsWindow.BrushColor = color LDShapes.AddPolygon(points) EndSub Sub Seed points = "" For i = 1 To 4 Turtle.Move(scale * _s) Turtle.Turn(90) points[i][1] = Turtle.X points[i][2] = Turtle.Y EndFor LDShapes.AddPolygon(points) EndSub Sub Torus GraphicsWindow.BrushColor = "Sienna" GraphicsWindow.PenColor = "LimeGreen" sepal = 10 GraphicsWindow.PenWidth = sepal Turtle.PenUp() Turtle.Move((size - sepal) / 2) Turtle.Turn(90) dc = (size - sepal) * Math.Pi / 360 Turtle.PenDown() For i = 1 To 360 Turtle.Move(dc) Turtle.Turn(1) points[i][1] = Turtle.X points[i][2] = Turtle.Y EndFor LDShapes.AddPolygon(points) Turtle.PenUp() Turtle.Turn(90) Turtle.Move((size - sepal) / 2) EndSub End>RPB297-0.sb< Start>RPC590.sb< ' Challenge of the Month - October 2014 // convert between Roman Numerals and numbers by NaochanON 'Roman Numerals is 1 to 3999. Over 4000 numbers are not available. '1 2 3 4 5 6 7 8 9 =I II III IV V VI VII VIII IX '10 20 30 40 50 60 70 80 90= X XX XXX XL L LX LXX LXXX XC '100 200 300 400 500 600 700 800 900= C CC CCC CD D DC DCC DCCC CM '1000 2000 3000= M MM MMM '11 = XI 12 = XII 14 = XIV 18 = XVIII 24 = XXIV 43 = XLIII 99 = XCIX 495 = CDXCV '1888 = MDCCCLXXXVIII 1945 = MCMXLV 3999 = MMMCMXCIX '--------------------------------------------------------------------------------------- Label[1]="1=I;2=II;3=III;4=IV;5=V;6=VI;7=VII;8=VIII;9=IX" Label[10]="1=X;2=XX;3=XXX;4=XL;5=L;6=LX;7=LXX;8=LXXX;9=XC" Label[100]="1=C;2=CC;3=CCC;4=CD;5=D;6=DC;7=DCC;8=DCCC;9=CM" Label[1000]="1=M;2=MM;3=MMM" div="1=1000;2=100;3=10;4=1" Controls.ButtonClicked=onclicked init() Sub onclicked If Controls.LastClickedButton=Btn1 Then RNMB="" DecNMB= Controls.GetTextBoxText(Decimal) ' If 0< DecNMB And DecNMB<4000 Then For i=1 To 4 D= Math.Floor(DecNMB/div[i]) RNMB=text.Append(RNMB, Label[div[i]][D]) DecNMB=Math.Remainder(DecNMB,div[i]) endfor Controls.SetTextBoxText(Roman,RNMB) Else Controls.SetTextBoxText(Roman,"Error. Input 1-3999 ") EndIf elseIf Controls.LastClickedButton=Btn2 Then RNMB= Controls.GetTextBoxText(Roman) decNMB=0 For i=1 To 4 For j= array.GetItemCount(Label[div[i]]) To 1 step -1 If Text.StartsWith(RNMB,Label[div[i]][j])="True" Then decNMB=decNMB+div[i]*j RNMB=text.GetSubTextToEnd(RNMB, Text.GetLength(Label[div[i]][j]) +1) j=0 EndIf EndFor EndFor Controls.SetTextBoxText(Decimal,decNMB) EndIf EndSub Sub init GraphicsWindow.BackgroundColor="Darkgreen" GraphicsWindow.Width=350 GraphicsWindow.Height=200 GraphicsWindow.FontSize=18 Decimal= Controls.AddTextBox(110,10) Controls.SetSize(Decimal,200,35) Roman= Controls.AddTextBox(110,50) Controls.SetSize(Roman,200,35) GraphicsWindow.FontSize=13 Btn1= Controls.AddButton("Decimal-->Roman",50,100) Btn2= Controls.AddButton("Roman-->Decimal",200,100) GraphicsWindow.FontSize=18 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawText(10,10,"Decimal") GraphicsWindow.DrawText(10,50,"Roman") GraphicsWindow.DrawText(5,150,"Input decimal number 1--3999,"+Text.GetCharacter(10)+" Roman number I--MMMCMXCIX ") EndSub End>RPC590.sb< Start>RPC846-0.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' RPC846-0 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 240 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 25 zoom = 4 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = MousePressed 'Timer Sub Animation Shapes.HideShape( sonic[idx] ) idx = idx + 1 If idx > hashIdx Then idx = 1 EndIf Shapes.ShowShape( sonic[idx] ) GraphicsWindow.Title = "Sonic " + (idx) EndSub 'Load all frames as images Sub LoadImages ImagePath() For idx = 1 To hashIdx GraphicsWindow.Title = "Sonic " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) If sonicWdhSzH < 5 Or sonicHgtSzH < 5 Then sonicWdhSzH = 14 sonicHgtSzH = 18 EndIf EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Pause by clicking Sub MousePressed KeyPressed() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code[1] = "msglqg" code[2] = "njztla" code[3] = "njypvw" code[4] = "njbzyw" code[5] = "msfvwq" code[6] = "msekzg" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846-0.sb< Start>RPC846-1.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' RPC846-1 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 320 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 20 zoom = 4 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes ImagePath() LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = MousePressed 'Timer Sub Animation Shapes.HideShape( sonic[idx] ) idx = idx + 1 If idx > hashIdx Then idx = 1 EndIf Shapes.ShowShape( sonic[idx] ) GraphicsWindow.Title = "Sonic " + idx EndSub 'Load all frames as images Sub LoadImages For idx = 1 To hashIdx GraphicsWindow.Title = "Loading " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) If sonicWdhSzH < 5 Or sonicHgtSzH < 5 Then sonicWdhSzH = 14 sonicHgtSzH = 18 EndIf EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Pause by clicking Sub MousePressed KeyPressed() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code[1] = "msglqg" code[2] = "njztla" code[3] = "njypvw" code[4] = "njbzyw" code[5] = "msfvwq" code[6] = "msekzg" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846-1.sb< Start>RPC846-2.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' RPC846-1 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 320 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 20 zoom = 4 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes ImagePath() LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = MousePressed 'Timer Sub Animation idx = idx + 1 Shapes.ShowShape(sonic[idx]) If idx > hashIdx Then idx = 1 Shapes.ShowShape(sonic[idx]) Shapes.HideShape(sonic[hashIdx]) Else Shapes.HideShape( sonic[idx-1] ) Endif GraphicsWindow.Title = "Sonic " + idx EndSub 'Load all frames as images Sub LoadImages For idx = 1 To hashIdx GraphicsWindow.Title = "Loading " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) If sonicWdhSzH < 5 Or sonicHgtSzH < 5 Then sonicWdhSzH = 14 sonicHgtSzH = 18 EndIf EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Pause by clicking Sub MousePressed KeyPressed() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code[1] = "msglqg" code[2] = "njztla" code[3] = "njypvw" code[4] = "njbzyw" code[5] = "msfvwq" code[6] = "msekzg" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846-2.sb< Start>RPC846-3.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' RPC846-3 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 240 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 30 zoom = 5 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes ImagePath() LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = MousePressed 'Timer Sub Animation idx = idx + 1 Shapes.ShowShape( sonic[idx] ) If idx > hashIdx Then idx = 1 Shapes.ShowShape( sonic[1] ) Shapes.HideShape( sonic[hashIdx] ) Else Shapes.HideShape( sonic[idx-1] ) EndIf GraphicsWindow.Title = "Sonic " + idx EndSub 'Load all frames as images Sub LoadImages For idx = 1 To hashIdx GraphicsWindow.Title = "Loading " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) If sonicWdhSzH < 5 Or sonicHgtSzH < 5 Then sonicWdhSzH = 14 sonicHgtSzH = 18 EndIf EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Pause by clicking Sub MousePressed KeyPressed() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code = "1=msglqg;2=njztla;3=njypvw;4=njbzyw;5=msfvwq;6=msekzg;" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846-3.sb< Start>RPC846-4.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' RPC846-4 ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 240 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 30 zoom = 5 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes ImagePath() LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = KeyPressed 'Timer Sub Animation idx = idx + 1 Shapes.ShowShape( sonic[idx] ) If idx > hashIdx Then idx = 1 Shapes.ShowShape( sonic[1] ) Shapes.HideShape( sonic[hashIdx] ) Else Shapes.HideShape( sonic[idx-1] ) EndIf GraphicsWindow.Title = "Sonic " + idx EndSub 'Load all frames as images Sub LoadImages For idx = 1 To hashIdx GraphicsWindow.Title = "Loading " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) If sonicWdhSzH < 5 Or sonicHgtSzH < 5 Then sonicWdhSzH = 14 sonicHgtSzH = 18 EndIf EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code = "1=msglqg;2=njztla;3=njypvw;4=njbzyw;5=msfvwq;6=msekzg;" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846-4.sb< Start>RPC846.sb< ' Sonic Animation Example ' by Mainchip (2012/Oct) ' modded by GoToLoop ' http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/94015515-5579-4463-b885-9d77ec11b2cb 'VarInit gw = 320 gh = 240 gwH = Math.Round(gw/2) ghH = Math.Round(gh/2) fps = 25 zoom = 4 isLocal = "False" 'Set GFX window GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "White" 'Load & create shapes LoadImages() CreateShapes() 'Set timer Timer.Interval = Math.Round( 1000/fps ) Timer.Tick = Animation 'Pause & exit GraphicsWindow.TextInput = KeyPressed GraphicsWindow.MouseDown = MousePressed 'Timer Sub Animation Shapes.HideShape( sonic[idx] ) idx = idx + 1 If idx > hashIdx Then idx = 1 EndIf Shapes.ShowShape( sonic[idx] ) GraphicsWindow.Title = "Sonic " + (idx) EndSub 'Load all frames as images Sub LoadImages ImagePath() For idx = 1 To hashIdx GraphicsWindow.Title = "Sonic " + idx If isLocal Then sonicImg[idx] = ImageList.LoadImage(local + file + idx + ext) Else sonicImg[idx] = ImageList.LoadImage(http + code[idx] + path + hash[idx] + file + idx + ext) EndIf Sound.PlayClick() EndFor sonicWdhSzH = Math.Round( ImageList.GetWidthOfImage ( sonicImg[1] ) / 2 ) sonicHgtSzH = Math.Round( ImageList.GetHeightOfImage( sonicImg[1] ) / 2 ) EndSub 'Load all images as shapes Sub CreateShapes For idx = 1 To hashIdx sonic[idx] = Shapes.AddImage( sonicImg[idx] ) Shapes.HideShape( sonic[idx] ) Shapes.Zoom( sonic[idx] zoom,zoom ) Shapes.Move( sonic[idx] gwH - sonicWdhSzH*zoom, ghH - sonicHgtSzH*zoom ) EndFor EndSub 'Pause or exit by key press Sub KeyPressed If GraphicsWindow.LastKey = "Escape" Then Sound.PlayChimeAndWait() Program.End() ElseIf isPaused Then isPaused = "False" Timer.Resume() Else isPaused = "True" Timer.Pause() EndIf Sound.PlayClick() EndSub 'Pause by clicking Sub MousePressed KeyPressed() EndSub 'Image URLs Sub ImagePath http = "http://" path = ".blu.livefilestore.com/" local = Program.Directory + "\Images\" file = "sonic" ext = ".png" code[1] = "msglqg" code[2] = "njztla" code[3] = "njypvw" code[4] = "njbzyw" code[5] = "msfvwq" code[6] = "msekzg" hash[1] = "y1mYVkmzkFIPUoi7nKSow1rLyiuML_0aN7-ysRFQoGHrn9ejyFwLcHmdyLswYr2mmmolISlSFanje5NzvUYZCychfMqGHRT3KWRRDqdPjoq7vdYSlD6JWpcWA/" hash[2] = "y1m_9F2M6eVmDSTtZVOy2A5pqnla06BlAJRq_PYJNu8coxiJoCS-lJQLfdDa47NY33Y4Oi7xi6vd7JU4Fzw6SwiwqV1nheRkbwrzeYq7aawvxKtPO_6dBgV8Q/" hash[3] = "y1m_9F2M6eVmDQsdJoGSefI_dFeHO0ZeU-JQK1eiXmAo53riD6zTAdgjz4U_nPdm6e9zJPHlei1N5SfFEW1phRCgt90Ni6uv92NLXM3gBH-hiljvdCgMi3fPQ/" hash[4] = "y1m_9F2M6eVmDRzEKv8Ui0GD00DVoW91q48S83o_K9HwoOcR2Ik2TtHJa8-cUmqv0nWQCDBBa_vqmu44AZF-2UNM7Kk6tAPOacU2z25TfZley1gA4WLzz3P0A/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[5] = "y1mTcPX35zs_Yk_-KZPvNDUJ7CMKxEHc84tuAaap1fi1oYgby2Qx-g8Y9WtFf_-P220SPg1d5WVdp_VAZwKHx-o-NZb8xKMvAQwgEI5q5HkHq5kwCnc6Z64ow/" hash[6] = "y1mTcPX35zs_Ylfl3bRoMzOa5UuWSRmKeWJ5Fp7IB2RFjMQfVEpugSLc0lCf31Y2oDtigVPMUCbg7J1TpizCaMopRuIewYlPRD8i_RX07b6_IYXt--xTvyrbw/" hashIdx = Array.GetItemCount(hash) EndSub End>RPC846.sb< Start>RPJ275.sb< InputAndValidation() 'UI. wip - customising the ReadNumber operation - got complicated '============================================================== 'SORT NUMBERS '============================================================== remainingItems = Array.GetItemCount(unsorted) 'precalc While remainingItems > 0 getIndices = Array.GetAllIndices(unsorted) 'get unsorted as a new array after removing the max num sorted[remainingItems] = unsorted[getIndices[1]] 'init sorted with the 1st num in unsorted (treat as current max) For i = 1 To remainingItems 'compare current max with each unsorted num sorted[remainingItems] = Math.Max(sorted[remainingItems], unsorted[getIndices[i]]) EndFor 'this assigns the max num in unsorted to sorted For i = 1 To remainingItems 'remove the max num from unsorted If unsorted[getIndices[i]] = sorted[remainingItems] Then unsorted[getIndices[i]] = "" i = remainingItems 'break to ensure removal of only 1 num EndIf EndFor remainingItems = remainingItems - 1 EndWhile '================================================================= 'INDEX ARRAYS FOR OUTPUT itemCount = Array.GetItemCount(sorted) For i = 1 To itemCount descendingOrder[i] = sorted[itemCount - i+1] ascendingOrder[i] = sorted[i] EndFor 'OUTPUT TextWindow.WriteLine(LF + "descendingOrder " + descendingOrder) TextWindow.WriteLine("ascendingOrder " + ascendingOrder) '================================================================== 'Input UI -WIP ISSUES , need b/space and redo option> '================================================================== Sub InputAndValidation LF = Text.GetCharacter(10) message = "You've made an invalid keystroke!" + LF + "You can only key in numbers, +, -, " message = message + LF + "and 1 decimal point!" + LF + LF + "A number must be entered!" GraphicsWindow.Hide() defaultForegroungColor = TextWindow.ForegroundColor TextWindow.WriteLine("Enter 5 numbers to sort in ascending/descending order") For i = 1 To 5 TextWindow.Write(LF + "Enter a number ") cursorLeft = TextWindow.CursorLeft cursorTop = TextWindow.CursorTop keying = "True" While keying key = TextWindow.ReadKey() If Text.GetCharacterCode(key) >= 48 And Text.GetCharacterCode(key) <= 57 Then 'numbers '57 48, 43+, 45-, 46dot unsorted[i] = Text.Append(unsorted[i], key) ElseIf Text.GetCharacterCode(key) = 46 And Text.IsSubText(unsorted[i], ".") <> "True" Then 'decimal point unsorted[i] = Text.Append(unsorted[i], key) ElseIf Text.GetCharacterCode(key) = 43 Then '+ plus explicitly positive unsorted[i] = Math.Abs(unsorted[i]) ElseIf Text.GetCharacterCode(key) = 45 Then '- minus toggles +/- unsorted[i] = unsorted[i] * -1 ElseIf Text.GetCharacterCode(key) = 13 And unsorted[i] <> "" Then 'enter & <> Empty keying = "False" TextWindow.ForegroundColor = defaultForegroungColor ElseIf Text.GetCharacterCode(key) = 8 Then 'backspace Else GraphicsWindow.ShowMessage(message, "Invalid keystroke") EndIf If unsorted[i] < 0 And Text.GetCharacterCode(key) <> 13 Then TextWindow.ForegroundColor = "Red" Else TextWindow.ForegroundColor = defaultForegroungColor EndIf If Text.GetCharacterCode(key) <> 13 Then ' <> enter WriteInput() EndIf EndWhile EndFor EndSub Sub WriteInput TextWindow.CursorLeft = cursorLeft TextWindow.CursorTop = cursorTop TextWindow.WriteLine(unsorted[i] + " ") ' + " " overwrites last character after minus is toggled off etc EndSub End>RPJ275.sb< Start>RPM049-2.sb< ' Moon Phase - June 2015 ' Copyright © 2012-2015 Nonki Takahashi. The MIT License. ' Last update 2015-06-04 ' Program ID RPM049-2 ' Version 0.4 - changed for Silverlight again ' Reference ' [1] すぐるゼミ 月齢方程式 http://www.suguru.jp/www.monjirou.net/rika/moon/age_of_the_moon.html ' GraphicsWindow.Title = "June 2015" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" lp = 0 ' lunar phase (days) yy = 2015 mm = 6 dd = 1 wk = 2 ' Monday days = 30 lp = Math.Remainder((yy - 2000) * 11 + mm + dd - 8, 30) ' [1] maxlp = 29.53 x0 = 40 ' left y0 = 60 ' top d = 46 ' diameter of moon GraphicsWindow.PenWidth = 0 wn = "1=SUN;2=MON;3=TUE;4=WED;5=THU;6=FRI;7=SAT;" GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FontSize = 20 GraphicsWindow.FontName = "Trebuchet MS" y = y0 - 44 For w = 1 To 7 x = x0 + Math.Remainder((w - 1), 7) * (d * 1.8) GraphicsWindow.DrawText(x, y, wn[w]) EndFor For day = 1 To days x = x0 + Math.Remainder((day - 2 + wk), 7) * (d * 1.8) y = y0 + Math.Floor((day - 2 + wk) / 7) * (d * 1.6) a = 0 ' area of crescent [%] If lp > 0 Then GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x, y, d, d) a = 100 ' area of crescent [%] EndIF GraphicsWindow.BrushColor = "Black" If 0 < lp And lp < maxlp / 2 Then GraphicsWindow.FillRectangle(x, y, d / 2, d) a = a - 50 ' area of crescent [%] ElseIf maxlp / 2 < lp And lp < maxlp Then GraphicsWindow.FillRectangle(x + d / 2, y, d / 2, d) a = a - 50 ' area of crescent [%] EndIF If 0 < lp And lp < maxlp / 4 Then s = Math.Cos(lp / maxlp * 2 * Math.Pi) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a - 50 * s ' area of crescent [%] ElseIf maxlp / 4 < lp And lp < maxlp / 2 Then s = Math.Sin((lp / maxlp - 1 / 4) * 2 * Math.Pi) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a + 50 * s ' area of crescent [%] ElseIf maxlp / 2 < lp And lp < maxlp * 3 / 4 Then s = Math.Cos((lp / maxlp - 1 / 2) * 2 * Math.Pi) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a + 50 * s ' area of crescent [%] ElseIf maxlp * 3 / 4 < lp And lp < maxlp Then s = Math.Sin((lp / maxlp - 3 / 4) * 2 * Math.Pi) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a - 50 * s ' area of crescent [%] EndIf GraphicsWindow.BrushColor = "White" el = Shapes.AddEllipse(d, d) Shapes.Move(el, x, y) Shapes.SetOpacity(el, 30) GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(x - d * 0.6, y - d * 0.4, day) Program.Delay(300) GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 12 GraphicsWindow.DrawText(x + d * 0.1, y - d * 0.3, lp) GraphicsWindow.BrushColor = "Black" pc = Shapes.AddText((Math.Floor(a * 10) / 10) + "%") Shapes.Move(pc, x + d * 0.1, y + d * 0.35) lp = lp + 1 If lp >= maxlp Then lp = lp - maxlp EndIf EndFor End>RPM049-2.sb< Start>RPM049-5.sb< GraphicsWindow.Title = "Moon Phases" GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 GraphicsWindow.BackgroundColor = "midnightblue dd = 1 lp = 1 maxlp = 29.53 x0 = 40 ' left y0 = 60 ' top d = 46 ' diameter of moon GraphicsWindow.PenWidth = 0 py=LDColours.LightYellow m2pi= 2 * Math.Pi For day = 1 To 29.5*4 x = 100 y = 100 If lp > 0 Then GraphicsWindow.BrushColor = py ss[day][0]=LDFastShapes.ShapeIndex(Shapes.AddEllipse (d d)) ldfastShapes.Move (ss[day][0] x, y) EndIF GraphicsWindow.BrushColor = "midnightblue If 0 < lp And lp < maxlp / 2 Then ss[day][1]=LDFastShapes.ShapeIndex(shapes.addRectangle( d / 2, d)) ldfastShapes.Move (ss[day][1] x y) ElseIf maxlp / 2 < lp And lp < maxlp Then ss[day][1]=LDFastShapes.ShapeIndex(shapes.addRectangle( d / 2, d)) ldfastShapes.Move(ss[day][1] x + d / 2, y) EndIF If 0 < lp And lp < maxlp / 4 Then s = Math.Cos(lp / maxlp *m2pi) GraphicsWindow.BrushColor = "midnightblue ss[day][2]=LDFastShapes.ShapeIndex(Shapes.AddEllipse (d * s, d)) ldfastShapes.Move (ss[day][2] x + d * (1 - s) / 2, y) ElseIf maxlp / 4 < lp And lp < maxlp / 2 Then s = Math.Sin((lp / maxlp - 1 / 4) *m2Pi ) GraphicsWindow.BrushColor = py ss[day][2]=LDFastShapes.ShapeIndex(Shapes.AddEllipse (d * s, d)) ldfastShapes.Move (ss[day][2] x + d * (1 - s) / 2, y) ElseIf maxlp / 2 < lp And lp < maxlp * 3 / 4 Then s = Math.Cos((lp / maxlp - 1 / 2) * m2Pi) GraphicsWindow.BrushColor = py ss[day][2]=LDFastShapes.ShapeIndex(Shapes.AddEllipse (d * s, d)) ldfastShapes.Move (ss[day][2] x + d * (1 - s) / 2, y) ElseIf maxlp * 3 / 4 < lp And lp < maxlp Then s = Math.Sin((lp / maxlp - 3 / 4) * m2pi) GraphicsWindow.BrushColor = "midnightblue ss[day][2]=LDFastShapes.ShapeIndex(Shapes.AddEllipse (d * s, d)) ldfastShapes.Move (ss[day][2] x + d * (1 - s) / 2, y) EndIf GraphicsWindow.BrushColor = py el[day] = LDFastShapes.ShapeIndex ( Shapes.AddEllipse(d, d)) ldfastShapes.Move(el[day], x, y) ldfastShapes.SetOpacity(el[day], 30) ldfastShapes.HideShape (el[day]) lp = lp + .25 If lp >= maxlp Then lp = lp - maxlp EndIf ldfastShapes.HideShape (ss[day][0]) ldfastShapes.HideShape (ss[day][1]) ldfastShapes.HideShape (ss[day][2]) LDFastShapes.Update () EndFor LDEvents.MouseWheel=www zz=6 www() Sub www zz=zz+ LDEvents.LastMouseWheelDelta /10 LDGraphicsWindow.Reposition (zz zz 30*zz 30*zz 0) EndSub While "true For day=1 To 29.5*4 'GraphicsWindow.Title=day ldfastShapes.ShowShape (ss[day][0]) ldfastShapes.ShowShape (ss[day][1]) ldfastShapes.ShowShape (ss[day][2]) ldfastShapes.showShape (el[day]) LDFastShapes.Update () Program.Delay (55) ldfastShapes.HideShape (ss[day][0]) ldfastShapes.HideShape (ss[day][1]) ldfastShapes.HideShape (ss[day][2]) ldfastShapes.hideShape (el[day]) LDFastShapes.Update () EndFor endwhile End>RPM049-5.sb< Start>RPM049.sb< ' Area of Crescent ' Copyright (c) 2012 Nonki Takahashi ' GraphicsWindow.Title = "Area of Crescent" GraphicsWindow.BackgroundColor = "Black" lp = 0 ' lunar phase (days) maxlp = 29.53 x0 = 110 ' left y0 = 40 ' top d = 50 ' diameter of moon GraphicsWindow.PenWidth = 0 For day = 1 To 31 x = x0 + Math.Remainder((day - 1), 7) * (d * 1.2) y = y0 + Math.Floor((day - 1) / 7) * (d * 1.5) a = 0 ' area of crescent [%] If lp > 0 Then GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x, y, d, d) a = 100 ' area of crescent [%] EndIF GraphicsWindow.BrushColor = "Black" If 0 < lp And lp < maxlp / 2 Then GraphicsWindow.FillRectangle(x, y, d / 2, d) a = a - 50 ' area of crescent [%] ElseIf maxlp / 2 < lp And lp < maxlp Then GraphicsWindow.FillRectangle(x + d / 2, y, d / 2, d) a = a - 50 ' area of crescent [%] EndIF If 0 < lp And lp < maxlp / 4 Then s = Math.Cos(lp / maxlp * 2 * Math.Pi) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a - 50 * s ' area of crescent [%] ElseIf maxlp / 4 < lp And lp < maxlp / 2 Then s = Math.Sin((lp / maxlp - 1 / 4) * 2 * Math.Pi) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a + 50 * s ' area of crescent [%] ElseIf maxlp / 2 < lp And lp < maxlp * 3 / 4 Then s = Math.Cos((lp / maxlp - 1 / 2) * 2 * Math.Pi) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a + 50 * s ' area of crescent [%] ElseIf maxlp * 3 / 4 < lp And lp < maxlp Then s = Math.Sin((lp / maxlp - 3 / 4) * 2 * Math.Pi) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x + d * (1 - s) / 2, y, d * s, d) a = a - 50 * s ' area of crescent [%] EndIf GraphicsWindow.BrushColor = "White" el = Shapes.AddEllipse(d, d) Shapes.Move(el, x, y) Shapes.SetOpacity(el, 30) GraphicsWindow.DrawText(x + d * 0.1, y - d * 0.3, lp) GraphicsWindow.BrushColor = "Black" pc = Shapes.AddText((Math.Floor(a * 10) / 10) + "%") Shapes.Move(pc, x + d * 0.1, y + d * 0.35) lp = lp + 1 If lp >= maxlp Then lp = lp - maxlp EndIf EndFor End>RPM049.sb< Start>RPT439.sb< ' PHOTOGRAM effect simulation ' programme par YLED 2016-09-14 ' program: GraphicsWindow.Title = "Photogram " GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=550 GraphicsWindow.width=950 GraphicsWindow.BackgroundColor="black" image=ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Lisc_lipy.jpg/507px-Lisc_lipy.jpg") GraphicsWindow.DrawresizedImage(image,50,50,200,200) film_strip() scissors() special_chars() ' time process : 1 minutes y=50 While y < 200+50 For x= 50 To 199+50 ' format hex pixel = #F1E1F5 color = GraphicsWindow.GetPixel(x,y) For N = 2 TO 6 hex_value = Text.GetSubText(color, N, 1) CONVERT() EndFor endfor y=y+1 ENDWHILE Sub CONVERT If hex_value > 3 Then GraphicsWindow.SetPixel(x,y,"white") Else GraphicsWindow.SetPixel(x,y,"black") EndIf ENDSUB Sub film_strip GraphicsWindow.DrawRectangle(0,300,600,120) GraphicsWindow.brushcolor="white" GraphicsWindow.FillRectangle(0,300,600,120) For hole =1 To 50 'up holes GraphicsWindow.DrawRectangle(0+space,305,10,10) GraphicsWindow.brushcolor="black" GraphicsWindow.fillRectangle(0+space,305,10,10) 'down holes GraphicsWindow.DrawRectangle(0+space,405,10,10) GraphicsWindow.brushcolor="black" GraphicsWindow.fillRectangle(0+space,405,10,10) space=space+20 EndFor EndSub Sub scissors GraphicsWindow.DrawEllipse(700-20,300-10,75,55) GraphicsWindow.brushcolor="white" GraphicsWindow.fillEllipse(700-20,300-10,75,55) GraphicsWindow.DrawEllipse(705-20,305-10,65,45) GraphicsWindow.brushcolor="black" GraphicsWindow.fillEllipse(705-20,305-10,65,45) GraphicsWindow.DrawEllipse(800+20,300-10,75,55) GraphicsWindow.brushcolor="white" GraphicsWindow.fillEllipse(800+20,300-10,75,55) GraphicsWindow.DrawEllipse(805+20,305-10,65,45) GraphicsWindow.brushcolor="black" GraphicsWindow.fillEllipse(805+20,305-10,65,45) GraphicsWindow.DrawTriangle(740,290,760,290,825,75) GraphicsWindow.brushcolor="white" GraphicsWindow.fillTriangle(740,290,760,290,825,75) GraphicsWindow.DrawTriangle(840,290,820,290,750,75) GraphicsWindow.brushcolor="white" GraphicsWindow.fillTriangle(840,290,820,290,750,75) EndSub Sub special_chars 'chars[1]="0xB5" watch=Text.GetCharacter("U+231A") watch="⌚" GraphicsWindow.FONTSIZE=75 GraphicsWindow.DrawText(600,50,watch) endsub End>RPT439.sb< Start>RPT809-0.sb< ' 2012/09/19 12:06:07 Generated ' by Shapes 1.12 ' 9/18/2012 4:37:19 PM Generated ' by Shapes Editor 0.9 ' ' initialize shapes Shapes_Init() ' add shapes scale = 1 Shapes_Add() angle = 0 Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 212 ' x offset shY = 51.000000000000 ' y offset shape = "" shape[1] = "func=rect;x=42.516662597656;y=113.800010681153;width=109;height=181;bc=#FF0000;pc=#FF000000;pw=2;" shape[2] = "func=tri;x=0;y=209.333335876465;x1=32;y1=0;x2=0;y2=74;x3=64;y3=74;angle=26;bc=#FFADAD;pc=#FF000000;pw=2;" shape[3] = "func=tri;x=132;y=207.333335876465;x1=31;y1=0;x2=0;y2=79;x3=62;y3=79;angle=337;bc=#FFADAD;pc=#FF000000;pw=2;" shape[4] = "func=line;x=97.366668701172;y=211.900016784668;x1=1.116668701172;y1=0.000000000000;x2=0.000000000000;y2=79.283325195313;pc=#FF000000;pw=2;" shape[5] = "func=tri;x=62.116668701172;y=293.716667175293;x1=36;y1=0;x2=0;y2=30;x3=72;y3=30;bc=#FFADAD;pc=#FF000000;pw=2;" shape[6] = "func=tri;x=35.783355712891;y=0.000000000000;x1=62;y1=0;x2=0;y2=115;x3=124;y3=115;bc=#FFADAD;pc=#FF000000;pw=2;" shape[7] = "func=ell;x=74.116668701172;y=329.283317565918;width=45;height=102;bc=#FF0700;pc=#FF000000;pw=2;" shape[8] = "func=ell;x=79.233337402344;y=341.333335876465;width=34;height=71;bc=#FF7E07;pc=#FF000000;pw=2;" shape[9] = "func=ell;x=86.533332824707;y=355.583335876465;width=19;height=42;bc=#FFFF00;pc=#FF000000;pw=2;" shape[10] = "func=rect;x=33;y=382.333335876465;width=141;height=43;bc=#FFFFFF;pc=#FFFFFF;pw=2;" EndSub Sub Shapes_Add ' Shapes | Add shapes as shapes data ' param shape - array of shapes ' param scale - to zoom ' return nShapes - number of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nShapes = Array.GetItemCount(shape) s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddRectangle(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddEllipse(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] x3 = shape[i]["x3"] y3 = shape[i]["y3"] shape[i]["obj"] = Shapes.AddTriangle(x1 * s, y1 * s, x2 * s, y2 * s, x3 * s, y3 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "line" Then x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] shape[i]["obj"] = Shapes.AddLine(x1 * s, y1 * s, x2 * s, y2 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) EndIf shape[i]["rx"] = x shape[i]["ry"] = y EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>RPT809-0.sb< Start>RPT809.sb< ' 9/18/2012 4:37:19 PM Generated ' by Shapes Editor 0.9 ' ' initialize shapes Shapes_Init() ' add shapes scale = 1 Shapes_Add() angle = 0 Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 234 ' x offset shY = 51.666664123535 ' y offset shape[1] = "func=rect;x=20.516662597656;y=113.800010681153;width=109;height=181;bc=#FF0000;pc=#FF000000;pw=2;" shape[2] = "func=tri;x=0;y=197.333335876465;x1=32;y1=0;x2=0;y2=74;x3=64;y3=74;angle=26;bc=#FFADAD;pc=#FF000000;pw=2;" shape[3] = "func=tri;x=97;y=219.333335876465;x1=31;y1=0;x2=0;y2=79;x3=62;y3=79;angle=337;bc=#FFADAD;pc=#FF000000;pw=2;" shape[4] = "func=line;x=75.366668701172;y=211.900016784668;x1=1.116668701172;y1=0.000000000000;x2=0.000000000000;y2=79.283325195313;pc=#FF000000;pw=2;" shape[5] = "func=tri;x=40.116668701172;y=293.716667175293;x1=36;y1=0;x2=0;y2=30;x3=72;y3=30;bc=#FFADAD;pc=#FF000000;pw=2;" shape[6] = "func=tri;x=13.783355712891;y=0.000000000000;x1=62;y1=0;x2=0;y2=115;x3=124;y3=115;bc=#FFADAD;pc=#FF000000;pw=2;" shape[7] = "func=ell;x=52.116668701172;y=329.283317565918;width=45;height=102;bc=#FF0700;pc=#FF000000;pw=2;" shape[8] = "func=ell;x=57.233337402344;y=341.333335876465;width=34;height=71;bc=#FF7E07;pc=#FF000000;pw=2;" shape[9] = "func=ell;x=64.533332824707;y=355.583335876465;width=19;height=42;bc=#FFFF00;pc=#FF000000;pw=2;" shape[10] = "func=rect;x=11;y=382.333335876465;width=141;height=43;bc=#FFFFFF;pc=#FFFFFF;pw=2;" EndSub Sub Shapes_Add ' Shapes | Add shapes as shapes data ' param shape - array of shapes ' param scale - to zoom ' 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 = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddRectangle(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddEllipse(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] x3 = shape[i]["x3"] y3 = shape[i]["y3"] shape[i]["obj"] = Shapes.AddTriangle(x1 * s, y1 * s, x2 * s, y2 * s, x3 * s, y3 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf ElseIf shape[i]["func"] = "line" Then x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] shape[i]["obj"] = Shapes.AddLine(x1 * s, y1 * s, x2 * s, y2 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) EndIf shape[i]["rx"] = x shape[i]["ry"] = y 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 ' return nShapes - number of shapes ' return shWidth, shHeight - total size of shapes nShapes = Array.GetItemCount(shape) For i = 1 To nShapes If shape[i]["func"] = "tri" Or shape[i]["func"] = "line" Then xmin = shape[i]["x1"] xmax = shape[i]["x1"] ymin = shape[i]["y1"] ymax = shape[i]["y1"] If shape[i]["x2"] < xmin Then xmin = shape[i]["x2"] EndIf If xmax < shape[i]["x2"] Then xmax = shape[i]["x2"] EndIf If shape[i]["y2"] < ymin Then ymin = shape[i]["y2"] EndIf If ymax < shape[i]["y2"] Then ymax = shape[i]["y2"] EndIf If shape[i]["func"] = "tri" Then If shape[i]["x3"] < xmin Then xmin = shape[i]["x3"] EndIf If xmax < shape[i]["x3"] Then xmax = shape[i]["x3"] EndIf If shape[i]["y3"] < ymin Then ymin = shape[i]["y3"] EndIf If ymax < shape[i]["y3"] Then ymax = shape[i]["y3"] EndIf EndIf shape[i]["width"] = xmax - xmin shape[i]["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shape[i]["x"] + shape[i]["width"] shHeight = shape[i]["y"] + shape[i]["height"] Else If shWidth < shape[i]["x"] + shape[i]["width"] Then shWidth = shape[i]["x"] + shape[i]["width"] EndIf If shHeight < shape[i]["y"] + shape[i]["height"] Then shHeight = shape[i]["y"] + shape[i]["height"] EndIf EndIf EndFor EndSub Sub Shapes_CalcRotatePos ' Shapes | Calculate position for rotated shape ' param x, y - position of a shape ' param width, height - size of a shape ' param cx, cy - center of shapes ' param shAngle - rotate angle ' 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) 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_Move ' Shapes | Move shapes ' param shape - array of shapes ' param scale - to zoom ' param x, y - position to move ' return shX, shY - new position of shapes Stack.PushValue("local", i) dx = x - shX dy = y - shY shX = x shY = y For i = 1 To nShapes _x = shape[i]["rx"] + dx _y = shape[i]["ry"] + dy Shapes.Move(shape[i]["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove ' Shapes | Remove shapes ' param shape - array of shapes Stack.PushValue("local", i) For i = 1 To nShapes Shapes.Remove(shape[i]["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate ' Shapes | Rotate shapes ' param shape - array of shapes ' param scale - to zoom ' param angle - to rotate Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) s = scale param["angle"] = angle param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 For i = 1 To nShapes param["x"] = shape[i]["x"] param["y"] = shape[i]["y"] param["width"] = shape[i]["width"] param["height"] = shape[i]["height"] Shapes_CalcRotatePos() shape[i]["rx"] = x shape[i]["ry"] = y Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shape[i]["obj"], shAngle + shape[i]["angle"]) EndFor y = Stack.PopValue("local") x = Stack.PopValue("local") i = 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 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>RPT809.sb< Start>RPW587.sb< GraphicsWindow.Title="Swarm Of Flies" Background=ImageList.LoadImage("http://www.reiselandbulgarien.de/wp-content/uploaded_images/2008/Evgeni/Lake_Vaya.jpg") GraphicsWindow.DrawImage(Background,0,0) GraphicsWindow.Height=imagelist.GetHeightOfImage(Background) GraphicsWindow.Width=imagelist.GetWidthOfImage(Background) Insect_Amount=200 GraphicsWindow.BrushColor="Black" For i = 1 To Insect_Amount Insect[i]=shapes.AddRectangle(5,5) endfor While "True" Mouse_X = GraphicsWindow.MouseX Mouse_Y = GraphicsWindow.MouseY For i = 1 To Insect_Amount Insect_GotoX[i] = Mouse_X + (math.GetRandomNumber(30.1) - 15.1)*20 Insect_GotoY[i] = Mouse_Y + math.GetRandomNumber(20)*-20+150 Shapes.Animate(Insect[i],Insect_GotoX[i],Insect_GotoY[i],400) endfor Program.Delay(20) EndWhile End>RPW587.sb< Start>RPW777.sb< Sound.PlayChimes() boja[1]="Black" GraphicsWindow.BrushColor =boja[13] GraphicsWindow.PenWidth=10 GraphicsWindow.DrawLine(10,240,10,300) GraphicsWindow.FillRectangle(5,500,80,10) GraphicsWindow.FillRectangle(1240,105,110,700) GraphicsWindow.DrawLine(0,5,1360,5) GraphicsWindow.DrawLine(0,0,0,750) Shapes.AddLine(0, 90 ,1360,90) Shapes.AddLine(90 , 90 ,90 ,720 ) GraphicsWindow.FillRectangle(5,100,80,600) dl=3' DEBLJINA LINIJE BUF=20 kont=0' kontrola 1 0 1 0 kop=0 kontrolarot=0 ruka=0 VEL=1 GraphicsWindow.CanResize = "false" GraphicsWindow.Height = 768 GraphicsWindow.Width = 1350 GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 2-20 GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width) / 2 GraphicsWindow.BackgroundColor ="Gray" GraphicsWindow.PenColor = "White"'**************************** GraphicsWindow.PenWidth=1 GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor = "Black" '=========== UCITAVANJE SLIKA ================== ' imagepath = "C:\SB\LIN1.jpg" image1=Shapes.AddImage(imagepath) Shapes.Move(image1, 0, 75) '=============================================== Program.Delay(1) Sound.PlayChimes() ' == MIS == TASTATURA MON. TASAT. === UNOS TEXT== BUTTON CONT ===== GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.TextInput = OnTextInput '______________D O D A V A Nj E T A S T E R A _______________________ ' textbox = Controls.AddTextBox(360, 75) GraphicsWindow.FontSize = 8 button150 = Controls.AddButton(" NOVI UPIS => ", 270, 75) button100 = Controls.AddButton("UPISI ", 535, 75) GraphicsWindow.BrushColor ="Red" button101 = Controls.AddButton("BRISI ", 585, 75) GraphicsWindow.BrushColor ="Black" GraphicsWindow.FontSize = 13 button9 = Controls.AddButton(" G R E C ", 395, 10) button2 = Controls.AddButton(" F I K S ", 10, 140) button4 = Controls.AddButton("_BR E_", 10, 175) button5 = Controls.AddButton("EK. KOND", 147, 10) button6 = Controls.AddButton("_ BRISI_", 10,210) button60 = Controls.AddButton("OTPORNIK", 61, 10) button50 = Controls.AddButton("O------ O ",10, 690) button7 = Controls.AddButton(" TRIJAK ", 226, 10) button8 = Controls.AddButton("SIJALICA ", 305, 10) button10 = Controls.AddButton(" T R A F O ", 470, 10) '--------------------- L E D ------------------------------------------ GraphicsWindow.BrushColor ="Red" button11 = Controls.AddButton("L", 910,10) Controls.SetSize(button11, 30, 30) GraphicsWindow.BrushColor ="Black" '----------------------------------------- GraphicsWindow.BrushColor ="Yellow" button12 = Controls.AddButton("L", 880,10) Controls.SetSize(button12, 30, 30) GraphicsWindow.BrushColor ="Black" '-------------------------------------------------------- GraphicsWindow.BrushColor ="Green" button13 = Controls.AddButton("L", 850,10) Controls.SetSize(button13, 30, 30) GraphicsWindow.BrushColor ="Black" '----------------------------------------------------------- GraphicsWindow.BrushColor ="Blue" button14 = Controls.AddButton("L", 820,10) Controls.SetSize(button14, 30, 30) GraphicsWindow.BrushColor ="Black" '------------------------------------------------------------ '------------------------ BATTON 2017 ---------------------------------------- button1710 = Controls.AddButton(" ",1250,110 ) Controls.SetSize(button1710, 95, 30) button1720 = Controls.AddButton("K R U G ",1250,142 ) Controls.SetSize(button1720, 95, 30) button1730 = Controls.AddButton("TROUGAO ", 1250,174 ) Controls.SetSize(button1730, 95, 30) button1740 = Controls.AddButton("K O P SLI ",1250,206 ) Controls.SetSize(button1740, 95, 30) button1750 = Controls.AddButton("DODAJ BOJE ", 1250,238 ) Controls.SetSize(button1750, 95, 30) button1760 = Controls.AddButton("UKLONI BOJE ", 1250,270 ) Controls.SetSize(button1760, 95, 30) button1770 = Controls.AddButton(" ", 1250,302 ) Controls.SetSize(button1770, 95, 30) button1780 = Controls.AddButton(" ", 1250,334 ) Controls.SetSize(button1780, 95, 30) button1790 = Controls.AddButton("DODAJ BOJE", 1250,366 ) Controls.SetSize(button1790, 95, 30) button1800 = Controls.AddButton("K V A D R AT", 1250,398 ) Controls.SetSize(button1800, 95, 30) button15 = Controls.AddButton(" P K 6 ", 558, 10) button16 = Controls.AddButton(" P K 2 ", 627, 10) button17 = Controls.AddButton(" D I J A K ",697, 10) button18 = Controls.AddButton(" P o ",776, 10) ' LINIJE DEBELE button19 = Controls.AddButton(" 1",10, 370) button20 = Controls.AddButton(" 3",10, 400) button21 = Controls.AddButton(" 5",10, 430) button22 = Controls.AddButton(" 7",10, 460) button23 = Controls.AddButton("10",10, 490) button24 = Controls.AddButton("15",10, 520) button25 = Controls.AddButton("20",10, 550) button45 = Controls.AddButton(" 0",10, 580) 'KONTROLA BOJA GraphicsWindow.BrushColor ="White" button26 = Controls.AddButton("[]",55, 370) GraphicsWindow.BrushColor ="Black" button27 = Controls.AddButton("[]",55, 400) GraphicsWindow.BrushColor ="Yellow" button28 = Controls.AddButton("[]",55, 430) GraphicsWindow.BrushColor ="Lime" button29 = Controls.AddButton("[]",55, 460) GraphicsWindow.BrushColor ="Red" button30 = Controls.AddButton("[]",55, 490) GraphicsWindow.BrushColor ="LightSkyBlue " button31 = Controls.AddButton("[]",55, 520) GraphicsWindow.BrushColor ="goldenrod" button32 = Controls.AddButton("[]",55, 550) GraphicsWindow.BrushColor ="Gray" button3 = Controls.AddButton("[]", 55, 580) GraphicsWindow.BrushColor ="Black" button33 = Controls.AddButton("ROTIRAJ",10, 620) button34 = Controls.AddButton(" - ",10, 655) button35 = Controls.AddButton(" BLOK K ", 943, 10) button36 = Controls.AddButton(" DIODA ", 7, 43) button37 = Controls.AddButton(" TRIMER ", 77, 43) button38 = Controls.AddButton(" + ",53, 655) button39 = Controls.AddButton(" TRANZIS ", 154, 43) button40 = Controls.AddButton(" R A I ", 777, 43) button41 = Controls.AddButton(" U S B ", 835, 43) button42 = Controls.AddButton(" D I N ", 895, 43) button43 = Controls.AddButton(" C I N C", 955, 43) GraphicsWindow.BrushColor ="Red" button44 = Controls.AddButton(" DODAJ EL", 4, 107) GraphicsWindow.BrushColor ="Black" GraphicsWindow.BrushColor ="Red" button70 = Controls.AddButton("LEM T", 7,10) GraphicsWindow.BrushColor ="Black" ' Exit = Controls.AddButton("O", 400, 50) ' Controls.SetSize(Exit, 30, 30) '////////// C R T A M R E Z U /////////////////////////////// GraphicsWindow.PenWidth=1 For vv1= 100 To 750 Step 20 For ly =100 To 1355 Step 20 GraphicsWindow.FillEllipse(ly-2,vv1-2, 5, 5) EndFor EndFor magepath = "C:\SB\LIN3.jpg" image2=Shapes.AddImage(imagepath) Shapes.Move(image2, 0, 723) '--------------------------------------------------------------- 'POTENCIRA KOORDINATE GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,300,80,50) GraphicsWindow.BrushColor = "Lime"'******************** GraphicsWindow.DrawText(10, 310,"x="+ rcx) GraphicsWindow.DrawText(10, 335,"y="+ rcy) '-[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ GraphicsWindow.BrushColor = "Lime" Ellipse3 =Shapes.AddEllipse( 10, 10) GraphicsWindow.BrushColor = "Red" Ellipse2 =Shapes.AddEllipse( 10, 10) GraphicsWindow.BrushColor = "Orange" Ellipse10 =Shapes.AddEllipse( 10, 10) Shapes.Move(Ellipse3,530,53) Shapes.Move(Ellipse2,510,53) Shapes.Move(Ellipse10,550,53) '************************************************************* ' UCITAVA S O U N D '************************************************************** pesmaA= ("F:\s.mp3") pesma= ("F:\Sound.wav") '********************************************** boja[5]="B E L A" DBL[1]="KLIK MIŠ ==>" OB[1]="<========" BOJA[10]="================" BOJA[10]="White" Controls.ButtonClicked=Etaster '==== KONTROLA = T A S T A R U R A ======================== lop: '================================================== '======================================================== Program.Delay(100) Shapes.ShowShape(Ellipse3) Shapes.ShowShape(Ellipse2) Shapes.ShowShape(Ellipse10) Program.Delay(100) '+++++++++++++++++++++++++++++++++++ GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(240,40,180,35) GraphicsWindow.BrushColor = "Aqua" GraphicsWindow.DrawText(245, 45,DBL[1]) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(420,40,180,35) GraphicsWindow.BrushColor = BOJA[10] GraphicsWindow.DrawText(425, 45,boja[5]) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(600,40,180,35) GraphicsWindow.BrushColor ="Magenta" GraphicsWindow.DrawText(605, 45,OB[1]) '===================== T I M E ===================== GraphicsWindow.FontSize = 35 GraphicsWindow.BrushColor = "white" GraphicsWindow.BrushColor = "White" Program.Delay(100) 'Shapes.Remove(PRIKA) 'PRIKA = Shapes.AddText( (Clock.Time) ) 'Shapes.Move(PRIKA, 1120, 20) GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" '=============== X kursor ================== GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIK) PRIK = Shapes.AddText("QX= "+(qx)) Shapes.Move(PRIK, 700, 722) '================= Y kursor ===================== GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRI) PRI = Shapes.AddText("QY= "+(Qy)) Shapes.Move(PRI, 800, 722) If GraphicsWindow.MouseY< 120 then GraphicsWindow.BrushColor =boja[gh] EndIf '************************************************************* '************************************************************* pesmaA= ("F:\s.mp3") Sub OnKeyDown GraphicsWindow.FontSize = 20 GraphicsWindow.Title = "'" + GraphicsWindow.LastKey + "' pressed" GraphicsWindow.Title =rcx Sound.PlayClick() z = GraphicsWindow.LastKey ' ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] '------------------------------------------------------------------------------------ If z = "Escape" Then Program.End() '--------------------------------------------------------------------------------------- ElseIf Z = "R" Then rotkop() '------------------------------------------------------------- ElseIf Z = "N" Then nt() '------------------------------------------------------------------- ElseIf Z = "I" Then Sound.Play(pesma) '--------------------------------------------------------------- ElseIf Z = "B" Then PIKSEL() '----------------------------------------------------------------- ElseIf Z = "C" Then rucnoc() '------------------------------------------------------------ ElseIf Z = "S" Then spoji() '--------------------------------------------------------- ElseIf Z = "U" Then sveboje() '-------------------------------------------------------- ElseIf Z= "Q" Then JN() ']]]]]]]]]]]]]]] F I N O P O D E S A V A Nj E ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ElseIf Z = "NumPad2" Then psy=psy-1 Shapes.Move(image,x-psx,y-psy) Shapes.Remove(T[BRT]) rcy=rcy+1 '------------------------------------------------------------- ElseIf Z = "NumPad6" Then psx=psx-1 Shapes.Move(image,x-psx,y-psy) Shapes.Remove(T[BRT]) rcx=rcx+1 '------------------------------------------------------------------ ElseIf Z = "NumPad8" Then psy=psy+1 Shapes.Move(image,x-psx,y-psy) Shapes.Remove(T[BRT]) rcy=rcy-1 '---------------------------------------------------------------- ElseIf Z = "NumPad4" Then psx=psx+1 Shapes.Move(image,x-psx,y-psy) Shapes.Remove(T[BRT]) rcx=rcx-1 '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ C R T A L I N I J E 20 [[[[[[[[[[[[[[[[[[[[ ElseIf Z = "Right" Then GraphicsWindow.BrushColor =(PRIKP[1]) GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("--- D E S N O") Shapes.Move(PRIKAZ, 400, 722) BRL= BRL+1 rcx=rcx+kont UKLONI[BRL]= Shapes.AddLine(rcx, rcy ,rcx+20,rcy) rcx=rcx+20 rcx=rcx kont=0 Shapes.Move(Ellipse3,rcx-5,rcy-5) OB[1]=("LIN "+ BRL) x=rcx '----------------------------------------------------------------------------- ElseIf Z = "Left"Then GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("--- L E V O") Shapes.Move(PRIKAZ, 400, 722) BRL=BRL+1 UKLONI[BRL]= Shapes.AddLine(rcx, rcy ,rcx-20,rcy) rcx=rcx-20 rcx=rcx Shapes.Move(Ellipse3,rcx-5,rcy-5) OB[1]=("LIN "+ BRL) x=rcx '------------------------------------------------------- ElseIf Z = "Down" Then GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("--- D O L E") Shapes.Move(PRIKAZ, 400, 722) BRL=BRL+1 UKLONI[BRL]= Shapes.AddLine(rcx, rcy ,rcx,rcy+20) rcy=rcy+20 rcy=rcy Shapes.Move(Ellipse3,rcx-5,rcy-5) OB[1]=("LIN "+ BRL) y=rcy '-------------------------------------------------------- ElseIf Z = "Up" Then GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("--- G O R E") Shapes.Move(PRIKAZ, 400, 722) BRL=BRL+1 UKLONI[BRL]= Shapes.AddLine(rcx, rcy ,rcx,rcy-20) rcy=rcy-20 rcy=rcy Shapes.Move(Ellipse3,rcx-5,rcy-5) OB[1]=("LIN "+ BRL) y=rcy '------------------------------------------------------------------------------ ElseIf Z = "NumPad0" Then Sound.PlayMusic("O8 c32 d32e32") Shapes.Move(image, rcx, rcy) ' kfy korekcija Shapes.Remove(T[BRT]) MPX=0 MPY=0 brisi=500 UM=0 'STORNIRA UMANJENJE UV=0 'STRORNIRA UVECANJE '++++++++++++++++++++++++++++++++++++ 'B E L E S L I K E Else ']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] EndIf '[[[[[[[[[[[[[[ K R A J [[[[[[[[[[[[[ GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,275,80,90) GraphicsWindow.BrushColor = "Lime" GraphicsWindow.DrawText(10, 310,"x="+ rcx) GraphicsWindow.DrawText(10, 335,"y="+ rcy) GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawText(10, 285,"Br.s "+ slika[S]) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,275,80,30) GraphicsWindow.BrushColor = BOJA[10] GraphicsWindow.DrawText(10, 285,"LIN "+ BRL) EndSub '============================================================== '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ M A U S E [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ '=================================================================== Sub OnKeyUp EndSub '=============== M A U S E =============================================== Sub OnMouseDown If Mouse.IsLeftButtonDown Then GraphicsWindow.Title = "Left button pressed" Sound.PlayClick() QX=Math.Round( GraphicsWindow.MouseX /20)*20 QY=Math.Round( GraphicsWindow.MouseY /20)*20 GraphicsWindow.Title =QX BRT=BRT+1 x=QX y=Qy pom=0 kontx=QX konty=QY rcx=QX rcy=QY Shapes.Move(Ellipse3,rcx-5,rcy-5) GraphicsWindow.BrushColor ="White" T[BRT] =Shapes.AddEllipse( 10, 10) OB[1]="C R T A Nj E" DBL[1]="C R T A Nj E" ' POZICIJA ELEMENTA Shapes.Remove(NT[10]) imgpx=Shapes.GetLeft(image) imgpy=Shapes.GetTop(image[s]) Shapes.Remove(NT[10]) NT[10]=(imgpx) nt() Sound.PlayChimes() 'Sound.PlayMusic("O8 c32 d32e32") '************** ISPIS KURSA *************************** GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("KURS A") Shapes.Move(PRIKAZ, 400, 722) OB[1]="T A C K A A " '========================================================= 'Mouse.IsRight R I G H T '========================================================= ElseIf Mouse.IsRightButtonDown Then GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("KURS B") Shapes.Move(PRIKAZ, 400, 722) GraphicsWindow.Title = "Right button pressed" Sound.PlayClick() prevX = Math.Round( GraphicsWindow.MouseX /20)*20 prevY = Math.Round( GraphicsWindow.MouseY /20)*20 Shapes.Move(Ellipse2,prevX-5,prevY-5) Sound.PlayMusic("O8 c32 d32e32") Sound.PlayMusic("O8 c32 d32e32") OB[1]="T A C K A B" DBL[1]="Ctrl SPAJA" EndIf GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,310,80,50) GraphicsWindow.BrushColor = "Lime" GraphicsWindow.DrawText(10, 310,"x="+ rcx) GraphicsWindow.DrawText(10, 335,"y="+ rcy) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,235,88,50) GraphicsWindow.DrawRectangle(8,248,75,25) EndSub '=================================================================== Sub OnMouseMove If (Mouse.IsLeftButtonDown) And FIKS=1 Then Shapes.Move(image, GraphicsWindow.MouseX, GraphicsWindow.MouseY) Shapes.Remove(T[BRT]) QX=Math.Round( GraphicsWindow.MouseX /20)*20 QY=Math.Round( GraphicsWindow.MouseY /20)*20 GraphicsWindow.Title =QX BRT=BRT+1 x=QX y=Qy Shapes.Move(image,QX,Qy) pom=0 kontx=QX konty=QY rcx=QX rcy=QY Shapes.Move(Ellipse3,rcx-5,rcy-5) '********************************************************** '************************************************************ GraphicsWindow.BrushColor ="White" GraphicsWindow.PenWidth = 3 Shapes.Remove(T[BRT]) Shapes.Remove(T[BRT]) brisi=500 GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("P O S T A V LJ E N O") Shapes.Move(PRIKAZ, 400, 722) EndIf '************************** UZIMA BOJE SA KOLOR LINIJE **************** If GraphicsWindow.MouseY>100 And GraphicsWindow.MouseY < 120 then GraphicsWindow.BrushColor =boja[gh] PRIKP[1]=GraphicsWindow.GetPixel(GraphicsWindow.MouseX,GraphicsWindow.MouseY) GraphicsWindow.Title =(PRIKP[1]) GraphicsWindow.PenColor =(PRIKP[1]) EndIf '**************************************************************************** EndSub '================================================================= Sub OnMouseUp EndSub '================================================================= Sub OnTextInput ' Code for text inputs goes here. EndSub '[[[[[[[[[[[[[[[[______ E ___T A S T E R I ________[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[==================== Sub Etaster Sound.PlayClick() FIKS=1 '-------------- K V A D R A T ------------------------------------ If Controls.LastClickedButton = button1800 Then If prevx34 Then 'S MORA BITI ZA 1 MANJI OD BROJA SLIKA S=0 EndIf If brisi <>500 Then Shapes.Remove(image) EndIf S=S+1 slika[S]=S letter[S] = Text.ConvertToUpperCase(S) FIKS=1 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,275,80,30) GraphicsWindow.BrushColor = "OrangeRed" GraphicsWindow.DrawText(10, 285,"Br.s "+ slika[S]) image[1]=("C:\SB\1.jpg" ) image[2]=("C:\SB\2.jpg" ) image[3]=("C:\SB\3.jpg" ) image[4]=("C:\SB\4.jpg" ) image[5]=("C:\SB\5.jpg" ) image[6]=("C:\SB\6.jpg" ) image[7]=("C:\SB\7.jpg" ) image[8]=("C:\SB\8.jpg" ) image[9]=("C:\SB\9.jpg" ) image[10]=("C:\SB\10.jpg" ) image[11]=("C:\SB\11.jpg" ) image[12]=("C:\SB\12.jpg" ) image[13]=("C:\SB\13.jpg" ) image[14]=("C:\SB\14.jpg" ) image[15]=("C:\SB\15.jpg" ) image[16]=("C:\SB\16.jpg" ) image[17]=("C:\SB\17.jpg" ) image[18]=("C:\SB\18.jpg" ) image[19]=("C:\SB\19.jpg" ) image[20]=("C:\SB\20.jpg" ) image[21]=("C:\SB\21.jpg" ) image[22]=("C:\SB\22.jpg" ) image[23]=("C:\SB\23.jpg" ) image[24]=("C:\SB\24.jpg" ) image[25]=("C:\SB\25.jpg" ) image[26]=("C:\SB\26.jpg" ) image[27]=("C:\SB\27.jpg" ) image[28]=("C:\SB\28.jpg" ) image[29]=("C:\SB\29.jpg" ) image[30]=("C:\SB\30.jpg" ) image[31]=("C:\SB\31.jpg" ) image[32]=("C:\SB\32.jpg" ) image[33]=("C:\SB\33.jpg" ) image[34]=("C:\SB\34.jpg" ) image=Shapes.AddImage(image[s]) Shapes.Move(image, 120,120) brisi=1000 Program.Delay(100) OB[1]="EL - IZBOR" '++++++++++++++++++++++++++++++++++++++++++++ 'L E M BRT=BRT+1 ElseIf Controls.LastClickedButton = button70 Then GraphicsWindow.BrushColor ="LightSteelBlue" GraphicsWindow.PenColor ="LightSteelBlue" T[BRT] =Shapes.AddEllipse( 10, 10) x=QX y=Qy pom=0 kontx=QX konty=QY rcx=QX rcy=QY FIKS=0 Shapes.Move(T[BRT],Qx-5,Qy-5) Shapes.Remove(NT[10]) NT[10]="LEMNA TACKA" nt() '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ 'P O S T A V I T E X T ElseIf Controls.LastClickedButton = button100 Then GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor ="White" text[1] = Controls.GetTextBoxText(POLJE_1) NAMESTI=Shapes.AddText(text[1]) Shapes.Move(NAMESTI, rcx, rcy) Sound.PlayMusic("O8 c32 d32e64") FIKS=0 rcx=0 rcy=0 BRL=0 Controls.Remove(POLJE_1) Sound.PlayMusic("O8 c32 d32e64") '----------------------------------------------------------------- 'N O V I U P I S ElseIf Controls.LastClickedButton = button150 Then GraphicsWindow.FontSize = 20 DBL[1]="UPISI TEXT" Sound.PlayMusic("O8 c32 d32e64") GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor ="Black" POLJE_1= Controls.AddTextBox(360, 75) Sound.PlayMusic("O8 c32 d32e64") FIKS=0 rcx=0 rcy=0 BRL=0 '---------------------------------------------------------------------- ElseIf Controls.LastClickedButton = button101 Then Shapes.Remove(NAMESTI) '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ 'OTPORNIK ElseIf Controls.LastClickedButton = button60 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\OTPORZ1.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 cslike = Shapes.GetTop(image) GraphicsWindow.Title =cslike imagepath1=imagepath Shapes.Remove(NT[10]) NT[10]="OTPORNIK" nt() '+++++++++++++++++++++++++++++++++++++++++++ 'D I O D A ElseIf Controls.LastClickedButton = button36 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\D2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="DIOD " nt() '++++++++++++++++++++++++ ++++++++++++++++ 'TRIMER ElseIf Controls.LastClickedButton = button37 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\TRIMER2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="TRIMER " nt() '+++++++++++++++++++++++++++++++++++++++++++++++++++++ ' TRANZISTOR ElseIf Controls.LastClickedButton = button39 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\TRAN2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="TRANZISTOR " nt() '+++++++++++++++++++++++++++++++++++++++++++++ 'R AUT IN ElseIf Controls.LastClickedButton = button40 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\RAUTIN.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) Shapes.Remove(NT[10]) NT[10]="R AUT IN " nt() '++++++++++++++++++++++++++++++++++++++++ 'U S B ElseIf Controls.LastClickedButton = button41 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\USB1.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="U S B" nt() '+++++++++++++++++++++++++++++++++++++++++ 'D I N ElseIf Controls.LastClickedButton = button42 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\DIN1.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="D I N " nt() '++++++++++++++++++++++++++++++++++++++++++++++++++ 'C I N C ElseIf Controls.LastClickedButton = button43 Then Sound.PlayMusic("O8 c32 d32e64") imagepath = "C:\SB\CINC2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="C I N C " nt() '+++++++++++++++++++++++++++++++++++++++++++++++ 'POSTAVI ElseIf Controls.LastClickedButton = button2 Then Sound.PlayMusic("O8 c32 d32e32") FIKS=0 Shapes.Move(image, rcx, rcy) ' kfy korekcija Shapes.Remove(T[BRT]) MPX=0 MPY=0 UM=0 'STORNIRA UMANJENJE UV=0 'STRORNIRA UVECANJE brisi=500 psx=0 psy=0 Shapes.Move(Ellipse3,rcx-8,rcy-8) OB[1]="EL - FIKSIRAN" '+++++++++++++++++++++++++++++++++++++++++++ ' KONDEMZATOR ElseIf Controls.LastClickedButton = button5 Then imagepath = "C:\SB\KD6.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="KONDENZATOR " nt() '+++++++++++++++++++++++++++++++++++++++++ 'T R I J A K ElseIf Controls.LastClickedButton = button7 Then imagepath = "C:\SB\TRI6.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image,120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="TRIJAK " nt() '+++++++++++++++++++++++++++++++++++++++++ 'SIJALICA ElseIf Controls.LastClickedButton = button8 Then imagepath = "C:\SB\SI2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=-8 Shapes.Remove(NT[10]) NT[10]="SIJALICA " nt() '+++++++++++++++++++++++++++++++++++++++++ 'G R E C ElseIf Controls.LastClickedButton = button9 Then imagepath = "C:\SB\GREC2.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="GREC " nt() '++++++++++++++++++++++++++++++++++++++++++++++++ 'T R A F O ElseIf Controls.LastClickedButton = button10 Then imagepath = "C:\SB\TRAFO.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="TRAFO " nt() '++++++++++++++++++++++++++++++++++++++++++++++++++ 'LED C ElseIf Controls.LastClickedButton = button11 Then imagepath = "C:\SB\LEDCR.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="LED C " nt() '+++++++++++++++++++++++++++++++++++++++++++++ 'LED ZU ElseIf Controls.LastClickedButton = button12 Then imagepath = "C:\SB\LEDZU.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120, 120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="LED ZU " nt() '+++++++++++++++++++++++++++++++++++++++++++ 'LED ZE ElseIf Controls.LastClickedButton = button13 Then imagepath = "C:\SB\LEDZ.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="LED ZE " nt() '++++++++++++++++++++++++++++++++++++++++++++++++ 'LED PLAVA ElseIf Controls.LastClickedButton = button14 Then imagepath = "C:\SB\LEDP.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image,120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="LED PLAVA " nt() '++++++++++++++++++++++++++++++++++++ 'P K 6 ElseIf Controls.LastClickedButton = button15 Then imagepath = "C:\SB\PK6B.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image,120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="PK 6 " nt() '++++++++++++++++++++++++++++++++++++ 'P K 2 ElseIf Controls.LastClickedButton = button16 Then imagepath = "C:\SB\PK2C.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image,120,120) MPX=0 MPY=5 Shapes.Remove(NT[10]) NT[10]="PK2 " nt() '+++++++++++++++++++++++++++++++++++ 'D I J A K ElseIf Controls.LastClickedButton = button17 Then imagepath = "C:\SB\DIJAK4.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image,120,120) MPX=0 MPY=2 Shapes.Remove(NT[10]) NT[10]="DIJAK " nt() '++++++++++++++++++++++++++++++++++++++ ' P O T 1 ElseIf Controls.LastClickedButton = button18 Then imagepath = "C:\SB\POT4.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=0 Shapes.Remove(NT[10]) NT[10]="POT 1 " nt() '++++++++++++++++++++++++++++++++++++++++++ 'BLOK K ElseIf Controls.LastClickedButton = button35 Then imagepath = "C:\SB\BLOKK.jpg" image=Shapes.AddImage(imagepath) Shapes.Move(image, 120,120) MPX=0 MPY=10 Shapes.Remove(NT[10]) NT[10]="BLOK K" nt() '================================================================= 'D E B L J I N A L I N I J E ElseIf Controls.LastClickedButton = button19 Then dl=1 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 1 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button20 Then dl=3 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 3 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button21 Then dl=5 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 5 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button22 Then dl=7 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 7 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button23 Then dl=10 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 10 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button24 Then dl=15 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 15 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button25 Then dl=20 GraphicsWindow.PenWidth=dl DBL[1]= "H LINIJE = 20 p" Sound.PlayMusic("O8 c32 d32e32") ElseIf Controls.LastClickedButton = button45 Then dl=0 GraphicsWindow.PenWidth=0 DBL[1]= "<= V O D I =>" Sound.PlayMusic("O8 c32 d32e32") Sound.PlayMusic("O8 c32 d32e32") FIKS=0 '============================================== ' B O J E ElseIf Controls.LastClickedButton = button26 Then GraphicsWindow.PenColor ="White " BOJA[10]="White " boja[5]="B E L A" ElseIf Controls.LastClickedButton = button27 Then GraphicsWindow.PenColor ="Black " boja[5]="C R N A" ElseIf Controls.LastClickedButton = button28 Then GraphicsWindow.PenColor ="Yellow" BOJA[10]="Yellow" boja[5]="Z U T A" ElseIf Controls.LastClickedButton = button29 Then GraphicsWindow.PenColor ="Lime " BOJA[10]="Lime " boja[5]="Z E L E N A" ElseIf Controls.LastClickedButton = button30 Then GraphicsWindow.PenColor ="Red " BOJA[10]="Red " boja[5]="C R V E N A" ElseIf Controls.LastClickedButton = button31 Then GraphicsWindow.PenColor ="LightSkyBlue " BOJA[10]="LightSkyBlue " boja[5]="P L A V A" ElseIf Controls.LastClickedButton = button32 Then GraphicsWindow.PenColor ="goldenrod" BOJA[10]="goldenrod" boja[5]="M E T A L" ElseIf Controls.LastClickedButton = button3 Then GraphicsWindow.PenColor = "Gray" BOJA[10]= "Gray" boja[5]="S I V A" '=============================================================== 'ROTIRA ElseIf Controls.LastClickedButton = button33 Then ROT=ROT+45 Shapes.Rotate(image,ROT) Shapes.Remove(NT[10]) NT[10]="ROTIRANO " nt() '-------------------------------------------------------------------------------------------- 'UMANJI ElseIf Controls.LastClickedButton = button34 Then UM=0.1 Shapes.Remove(T[BRT]) Shapes.Zoom(image,VEL- UM,VEL- UM) VEL=VEL-UM OB[1]="UMANJENO" Shapes.Remove(NT[10]) NT[10]="UMANJENO" nt() '--------------------------------------------------------------------- 'UVECA ElseIf Controls.LastClickedButton = button38 Then UM=0.1 Shapes.Remove(T[BRT]) Shapes.Zoom(image,VEL+ UM,VEL+ UM) VEL=VEL+UM OB[1]="UVECANO" Shapes.Remove(NT[10]) NT[10]="UVECANO " nt() '------------------------------------------------------------------------------------- 'BRISE ElseIf Controls.LastClickedButton = button6 Then Shapes.Remove(Line1) Shapes.Remove(T[BRT]) 'Shapes.Remove(Ellipse2) Shapes.Remove(UKLONI[BRL]) Shapes.Remove(kopija[kop]) Shapes.Remove(T[BRT]) tx=tx-1 Controls.Remove(text[tx]) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(10,275,80,30) GraphicsWindow.BrushColor = "Aqua" GraphicsWindow.DrawText(10, 285,"Br.L "+ BRL) OB[1]=("IZBRISANO "+BRL) BRL=BRL-1 BRT=BRT-1 kop=kop-1 Shapes.Remove(NT[10]) NT[10]="IZBRISANO " nt() '++++++++++++++++++++++++++++++++++++++++++++ ' BRISE SLIKE ElseIf Controls.LastClickedButton = button4 Then Shapes.Remove(image) y=Qy '+++++++++++++++++++++++++++++++++++++++++++ Shapes.Remove(NT[10]) NT[10]="BRISE SLIKU " nt() EndIf GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0,235,88,50) GraphicsWindow.DrawRectangle(8,248,75,25) EndSub Program.Delay(100) Shapes.HideShape(Ellipse3) Shapes.HideShape(Ellipse2) Shapes.HideShape(Ellipse10) Program.Delay(100) GraphicsWindow.PenWidth=dl kontrolarot =0 GraphicsWindow.BrushColor =(PRIKP[1]) GraphicsWindow.FillRectangle(9,249,70,22) Goto lop '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ Sub PIKSEL PRIKP[1]=GraphicsWindow.GetPixel(GraphicsWindow.MouseX,GraphicsWindow.MouseY) GraphicsWindow.Title =PRIKP[1] Sound.PlayMusic("O8 c32 d32e32") GraphicsWindow.PenColor =(PRIKP[1]) EndSub '///////////////////////////////////////////////// Sub spoji GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("S P O J E N O") Shapes.Move(PRIKAZ, 400, 722) Shapes.Remove(NT[10]) NT[10]="SPOJENO " nt() GraphicsWindow.PenWidth=dl Line1= Shapes.AddLine(x, y ,prevx,prevy) kontx=x konty=y OB[1]="NACRTANO" Sound.PlayAndwait(pesmaA) Sound.Stop(pesmaA) EndSub ']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] Sub rucnoc kop=kop+1 Shapes.Move(Ellipse10,rcx-5,rcy-5) imagepath1=imagepath image1=Shapes.AddImage(imagepath1) Shapes.Move(image1, QX,Qy) If imagepath1 = "C:\SB\LIN1.jpg" Then Shapes.Remove(image1) EndIf kopija[kop]=(image1) '********************* NATPIS ************************* GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("R z a r o t a c i j u") Shapes.Move(PRIKAZ, 400, 722) Sound.PlayMusic("O8 c32 d32e64") EndSub '**************** rotkop **************************** Sub rotkop ROT=ROT+90 Shapes.Rotate(image1,ROT) OB[1]="ROTIRA| GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ) PRIKAZ = Shapes.AddText("C z a k o p i r a nj e") Shapes.Move(PRIKAZ, 400, 722) Sound.PlayMusic("O8 c32 d32e64") EndSub Sub sveboje Shapes.Remove(NT[10]) NT[10]="LINIJA BOJA " nt() Program.Delay(100) boja[11 ]="IndianRed" boja[12 ]="LightCoral" boja[13 ]="Salmon" boja[14 ]="DarkSalmon" boja[15 ]="LightSalmon" boja[16 ]="Crimson" boja[17 ]="Red" boja[18 ]="FireBrick" boja[19 ]="DarkRed" boja[20 ]="Pink" boja[21 ]="LightPink" boja[22 ]="HotPink" boja[23 ]="DeepPink" boja[24 ]="MediumVioletRed" boja[25 ]="PaleVioletRed" boja[26 ]="LightSalmon" boja[27 ]="Coral" boja[28 ]="Tomato" boja[29 ]="OrangeRed" boja[30 ]="DarkOrange" boja[31 ]="Orange" boja[32 ]=" Gold" boja[33 ]="Yellow" boja[34 ]="LightYellow" boja[35 ]="LemonChiffon" boja[36 ]="LightGoldenrodYellow" boja[37 ]="PapayaWhip" boja[38 ]="Moccasin" boja[39 ]="PeachPuff" boja[40 ]="PaleGoldenrod" boja[41 ]="Khaki" boja[42 ]="DarkKhaki" boja[43 ]="Lavender" boja[44 ]="Thistle" boja[45 ]="Plum" boja[46 ]="Violet" boja[47 ]="Orchid" boja[48 ]="Fuchsia" boja[49 ]="Magenta" boja[50 ]="MediumOrchid" boja[51 ]="MediumPurple" boja[52 ]="BlueViolet" boja[53 ]="DarkViolet" boja[54 ]="DarkOrchid" boja[55 ]="DarkMagenta boja[56 ]="Purple" boja[57 ]="Indigo" boja[58 ]="SlateBlue" boja[59 ]="DarkSlateBlue" boja[60 ]="MediumSlateBlue" boja[61 ]="MediumSpringGreen" boja[62 ]="SpringGreen" boja[63 ]="MediumSeaGreen" boja[64 ]="SeaGreen" boja[65 ]="ForestGreen" boja[66 ]="Green" boja[67 ]="DarkGreen" boja[68 ]="YellowGreen" boja[69 ]="OliveDrab" boja[70 ]="Olive" boja[71 ]="DarkOliveGreen" boja[72 ]="MediumAquamarine" boja[73 ]="DarkSeaGreen" boja[74 ]="LightSeaGreen" boja[75 ]=" DarkCyan" boja[76 ]="Teal" boja[77 ]=" Aqua" boja[78 ]=" Cyan" boja[79 ]=" LightCyan" boja[80 ]="PaleTurquoise" boja[81 ]="Aquamarine" boja[82 ]="Turquoise" boja[83 ]=" MediumTurquoise" boja[84 ]=" DarkTurquoise" boja[85 ]="CadetBlue" boja[86 ]="SteelBlue" boja[87 ]="LightSteelBlue" boja[88 ]="PowderBlue" boja[89 ]="LightBlue" boja[90 ]="SkyBlue" boja[91 ]="GreenYellow" boja[92 ]="Chartreuse" boja[93 ]="LawnGreen" boja[94 ]="Lime" boja[95 ]="LimeGreen" boja[96 ]="PaleGreen" boja[97 ]="LightGreen" boja[98 ]="LightSkyBlue" boja[99 ]=" DeepSkyBlue" boja[100 ]="DodgerBlue" boja[101 ]="CornflowerBlue" boja[102 ]="MediumSlateBlue" boja[103 ]="RoyalBlue" boja[104 ]=" Blue" boja[105 ]="MediumBlue" boja[106 ]=" DarkBlue" boja[107 ]=" Navy" boja[108 ]="MidnightBlue" boja[109 ]=" White" boja[110 ]="Snow" boja[111 ]="Honeydew" boja[112 ]="MintCream" boja[113 ]="Azure" boja[114 ]="AliceBlue" boja[115 ]="GhostWhite" boja[116 ]="WhiteSmoke" boja[117 ]="Seashell" boja[118 ]="Beige" boja[119 ]="OldLace" boja[120 ]="FloralWhite" boja[121 ]="Ivory" boja[122 ]="AntiqueWhite" boja[123 ]="Linen" boja[124 ]="LavenderBlush" boja[125 ]="MistyRose" boja[126 ]="Cornsilk" boja[127 ]="BlanchedAlmond' boja[128 ]="Bisque" boja[129 ]="NavajoWhite" boja[130 ]="Wheat" boja[131 ]="BurlyWood" boja[132 ]="Tan" boja[133 ]="RosyBrown" boja[134 ]="SandyBrown" boja[134 ]="Goldenrod" boja[136 ]="DarkGoldenrod" boja[137 ]="Peru" boja[138 ]="Chocolate" boja[139 ]="SaddleBrown" boja[140 ]="Sienna" boja[141 ]="Brown" boja[142 ]="Maroon" boja[143 ]="Gainsboro" boja[144 ]="LightGray" boja[145 ]="Silver" boja[146 ]="DarkGray" boja[147 ]="Gray" boja[148 ]="DimGray" boja[149 ]="LightSlateGray" boja[150 ]="SlateGray" boja[151 ]="DarkSlateGray" boja[152 ]="Black" po=0 For gh = 11To 152 GraphicsWindow.brushcolor=boja[gh] po=po+8.5 GraphicsWindow.FillRectangle(88+po,100,20,20) 'GraphicsWindow.PenWidth=0 'boja[gh]=Shapes.AddRectangle(20,20) ' Shapes.move( boja[gh],100+po,100,) Endfor EndSub '******************************************************************************** Sub JN ' DA NE kont= kont+1 If kont>1 Then kont=0 EndIf FIKS=kont GraphicsWindow.BrushColor = "Black" Shapes.Remove(PRIKAZ1) PRIKAZ1 = Shapes.AddText( kont) Shapes.Move(PRIKAZ1, 300, 722) EndSub Sub kvadrat EndSub Sub nt GraphicsWindow.FontSize = 18 GraphicsWindow.BrushColor ="Red" GraphicsWindow.FillRectangle(1100,25,200,28) GraphicsWindow.BrushColor ="Black" NT[10]= Shapes.AddText(NT[10]) Shapes.Move(NT[10], 1120, 25) EndSub End>RPW777.sb< Start>RPW827.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) If R > 0 Then 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) EndIf 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>RPW827.sb< Start>RPX126.sb< ff=file.ReadContents ("e:\hi\si11.txt")'<<<------put ur srcfilepath here For r=1 To Text.GetLength(ff) c=Text.GetSubText (ff r 1) f1=text.Append (f1 (Text.GetCharacterCode (c)-1000)+" ") EndFor ' The following line could be harmful and has been automatically commented. ' File.WriteContents ("e:\serind.txt" f1)'<<<------put ur destfilepath here End>RPX126.sb< Start>RPX460-0.sb< ' Paracanthurus ' Version 0.3 ' Copyright © 2016-2019 Nonki Takahashi. The MIT License. ' 2016-08-06 1:57:23 Shapes generated by Shapes 2.2b. ' Last update 2019-03-11 ' Program ID RPX460-0 GraphicsWindow.Title = "Paracanthurus" SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#041E53" ' initialize shapes Shapes_Init() ' add shapes scale = 1 angle = 0 iMin = 1 iMax = Array.GetItemCount(shape) Shapes_Add() While "True" Program.Delay(3000) Shapes.HideShape(shape[16]["obj"]) Program.Delay(100) Shapes.ShowShape(shape[16]["obj"]) EndWhile Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 100 ' x offset shY = 135 ' y offset shape = "" shape[1] = "func=ell;x=27;y=0;width=339;height=172;bc=#000000;pw=0;" shape[2] = "func=ell;x=25;y=2;width=324;height=170;bc=#0A4ED6;pw=0;" shape[3] = "func=ell;x=55;y=22;width=301;height=105;angle=6;bc=#000000;pw=0;" shape[4] = "func=ell;x=58;y=44;width=64;height=64;bc=#0A4ED6;pw=0;" shape[5] = "func=tri;x=108;y=73;x1=20;y1=0;x2=0;y2=73;x3=40;y3=73;angle=112;bc=#0A4ED6;pw=0;" shape[6] = "func=ell;x=105;y=47;width=141;height=75;angle=8;bc=#000000;pw=0;" shape[7] = "func=ell;x=120;y=53;width=135;height=54;angle=7;bc=#0A4ED6;pw=0;" shape[8] = "func=tri;x=314;y=7;x1=36;y1=0;x2=0;y2=165;x3=73;y3=165;angle=271;bc=#000000;pw=0;" shape[9] = "func=tri;x=349;y=31;x1=26;y1=0;x2=0;y2=117;x3=52;y3=117;angle=271;bc=#F3FF0A;pw=0;" shape[10] = "func=tri;x=99;y=68;x1=23;y1=0;x2=0;y2=58;x3=46;y3=58;angle=51;bc=#F3FF0A;pw=0;" shape[11] = "func=tri;x=96;y=71;x1=21;y1=0;x2=0;y2=52;x3=42;y3=52;angle=52;bc=#000000;pw=0;" shape[12] = "func=tri;x=94;y=75;x1=18;y1=0;x2=0;y2=45;x3=37;y3=45;angle=52;bc=#0A4ED6;pw=0;" shape[13] = "func=ell;x=52;y=72;width=55;height=55;bc=#000000;pw=0;" shape[14] = "func=ell;x=45;y=68;width=59;height=58;bc=#0A4ED6;pw=0;" shape[15] = "func=ell;x=49;y=50;width=32;height=32;bc=#80A9F9;pc=#000000;pw=4;" shape[16] = "func=ell;x=56;y=57;width=18;height=18;bc=#000000;pw=0;" shape[17] = "func=tri;x=0;y=93;x1=31;y1=0;x2=0;y2=26;x3=63;y3=26;angle=254;bc=#0A4ED6;pw=0;" shape[18] = "func=tri;x=4;y=74;x1=25;y1=0;x2=0;y2=37;x3=51;y3=37;angle=239;bc=#0A4ED6;pw=0;" shape[19] = "func=tri;x=17;y=97;x1=2;y1=0;x2=0;y2=10;x3=5;y3=10;angle=108;bc=#F3FF0A;pw=0;" shape[20] = "func=tri;x=19;y=100;x1=2;y1=0;x2=0;y2=10;x3=5;y3=10;angle=36;bc=#F3FF0A;pw=0;" 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 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>RPX460-0.sb< Start>RPZ143-2.sb< ' Get Character from Unicode ' Copyright (c) 2014 Nonki Takahashi. MIT License. ' Program ID RPZ143-2 ' GraphicsWindow.Title = "Get Character from Unicode" Form() clicked = "False" Controls.ButtonClicked = OnButtonClicked While "True" If clicked Then lastFont = fontName fontName = Controls.GetTextBoxText(fontBox) If lastFont <> fontName Then GraphicsWindow.FontName = fontName Program.Delay(300) Controls.Remove(charBox) charBox = Controls.AddTextBox(80, 120) EndIf code = Controls.GetTextBoxText(codeBox) GetCharFromUnicode() Controls.SetTextBoxText(charBox, char) Shapes.SetText(code2Text, code2) clicked = "False" Else Program.Delay(300) EndIf EndWhile Sub OnButtonClicked clicked = "True" EndSub Sub Form GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(10, 10, "Font") fontBox = Controls.AddTextBox(80, 10 - 4) fontName = GraphicsWindow.FontName Controls.SetTextBoxText(fontBox, fontName) GraphicsWindow.DrawText(10, 40, "Code") codeBox = Controls.AddTextBox(80, 40 - 4) code = "U+0041" Controls.SetTextBoxText(codeBox, code) GetCharFromUnicode() code2Text = Shapes.AddText(dec) Shapes.Move(code2Text, 250, 40) Controls.AddButton("Get", 10, 70) GraphicsWindow.DrawText(10, 120, "Character") Program.Delay(300) GraphicsWindow.FontSize = 50 charBox = Controls.AddTextBox(80, 120 - 4) Controls.SetTextBoxText(charBox, char) EndSub Sub GetCharFromUnicode ' param code - U+xxxx or decimal for Unicode ' return char - the character for the code ' return code2 - oposite format of the code If Text.StartsWith(code, "U+") Then hex = Text.GetSubTextToEnd(code, 3) Math_Hex2Dec() code2 = dec Else dec = code Math_Dec2Hex() len = Text.GetLength(hex) code2 = "U+" + Text.GetSubTextToEnd("000", len) + hex EndIf char = Text.GetCharacter(dec) EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param hex - hexadecimal text ' return dec - decimal number dec = 0 iLen = Text.GetLength(hex) For iPtr = 1 To iLen dec = dec * 16 + Text.GetIndexOf("0123456789ABCDEF", Text.GetSubText(hex, iPtr, 1)) - 1 EndFor EndSub Sub Math_Dec2Hex ' Math | Convert decimal to hexadecimal ' param dec - decimal number ' return hex - hexadecimal text Stack.PushValue("local", dec) hex = "" While 0 < dec digit = Math.Remainder(dec, 16) dec = Math.Floor(dec / 16) hex = Text.Append(Text.GetSubText("0123456789ABCDEF", digit + 1, 1), hex) EndWhile If hex = "" Then hex = "0" EndIf dec = Stack.PopValue("local") EndSub End>RPZ143-2.sb< Start>RQB628.sb< ' Adding animation of the character and enemy GraphicsWindow.Hide() version = 1 versionpoint = 5 GraphicsWindow.Height = 400 GraphicsWindow.Width = 600 GraphicsWindow.Top = 300 GraphicsWindow.Left = 800 GraphicsWindow.Title = "FairyTail " + version + "." + versionpoint GraphicsWindow.CanResize = "False" TextWindow.Show() TextWindow.Top= 300 TextWindow.Left = 0 load() 'Loads the popup and the initizializers for display start() ' - loads the saves or makes them and gets the variables in them. options()'- loads the actions for going about the windows Sub picsmus Sound.Play("http://media.soundcloud.com/stream/ze3uwIMn5S0x.mp3") magnolia = "http://vignette3.wikia.nocookie.net/fairytail/images/9/9b/Magnolia_Town.jpg/revision/latest?cb=20100810081706" '169 x 298 Fairytailpic = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRETJJPULxP_cU9U7lLC5gtQZDiF5Uo-TVwEVXXz8-1w44AGW7b" '168 x 300' GraphicsWindow.DrawResizedImage(magnolia, 0,0, 610, 300) GraphicsWindow.DrawResizedImage("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRQHAgloSvIJBIrvBEQ9V5bcvfdvkcEoKwSx095ff7yZl-JxuIeEg", 0, 300, 600, 400) try = 12 fairytailpic1 = Shapes.AddImage(Fairytailpic) Shapes.Move(fairytailpic1, 150, -168) Shapes.Animate(fairytailpic1, 150, 116, 4000) Program.Delay(4000) For i = 100 To 0 Step -1 Shapes.SetOpacity(fairytailpic1, i ) Program.Delay(50) endfor endsub Sub intro GraphicsWindow.BrushColor = "white" backgroundshape = Shapes.AddRectangle(400, 180) Shapes.Move(backgroundshape, 100, 100) introscript[1] = "Welcome To Magnolia, home of wizards and witches." introscript[2] ="You will be enbarking on many quests defeating" introscript[3] = "evil as well as learning about you hidden powers." introscript[4] = "To learn more about your powers, you will level up and do quests." GraphicsWindow.BrushColor= "Red" introscript1 = Shapes.AddText(introscript[1]) Shapes.Move(introscript1, 100, 100) introscript2 = Shapes.AddText(introscript[2]) Shapes.Move(introscript2, 100, 120) introscript3 = Shapes.AddText(introscript[3]) Shapes.Move(introscript3, 100, 140) introscript4 = Shapes.AddText(introscript[4]) Shapes.Move(introscript4, 100, 160) Program.Delay(5000) Shapes.Remove(introscript1) Shapes.Remove(introscript2) Shapes.Remove(introscript3) Shapes.Remove(introscript4) Shapes.Remove(backgroundshape) endsub Sub Tries try = 12 tryagain: GraphicsWindow.BrushColor = "Black" TextWindow.WriteLine("you have: " + try + " tries left") magicnumber = Math.GetRandomNumber(5) If magicnumber = 1 Then player_magic_type = "Fire" ElseIf magicnumber = 2 Then player_magic_type = "Water" Elseif magicnumber = 3 Then player_magic_type = "Wind" Elseif magicnumber = 4 Then player_magic_type = "Lightning" elseif magicnumber = 5 then player_magic_type = "FDS" Endif TextWindow.WriteLine("Your magic type is " + player_magic_type) TextWindow.WriteLine("Do you like your magic?") answer = TextWindow.Read() If answer = "no" Then If try <> 0 then try = try - 1 TextWindow.Clear() Goto tryagain Else Goto stay EndIf ElseIf answer = "yes" then stay: TextWindow.WriteLine("As you level up you will gain more moves.") player_level = 0 player_level_health = 100 player_health = 100 player_magic_type = player_magic_type player_strength = 50 player_magic_strength = 100 magic_energy_take = 100 player_magic_energy = 300 player_exp = 0 player_exp_level = 1 player_magic_energy_limit = 300 speed = 2 EndIf endsub Sub start TextWindow.WriteLine("Do you have slow internet? 1 = yes/ 2 =no") lag = TextWindow.Readnumber() GraphicsWindow.Show() If lag = 2 Then picsmus() Else field() EndIf nowenergy = 0 o = 0 p= 0 init() TextWindow.WriteLine("Have you ever played before? yes/no") playedbefore = TextWindow.Read() If playedbefore = "yes" Then getsaves() showstats() display() Else intro() Tries() makesaves() getsaves() showstats() display() EndIf EndSub Sub field GraphicsWindow.BrushColor= "SkyBlue" GraphicsWindow.fillRectangle(0,0 610, 300) GraphicsWindow.BrushColor="brown" GraphicsWindow.fillRectangle(0, 300, 610, 400) GraphicsWindow.DrawLine(0, 333, 610,333) GraphicsWindow.DrawLine(0, 366, 610,366) startbrick = 0 startbrickdown = 300 For j = 1 to 10 Step 1 endbrick = startbrick endbrickdown = startbrickdown + 33 brick[j] = Shapes.AddLine(startbrick, startbrickdown, endbrick, endbrickdown) startbrick = endbrick + 60 EndFor startbrick = -30 startbrickdown = 333 For j = 1 to 11 Step 1 endbrick = startbrick endbrickdown = startbrickdown + 33 brick[j] = Shapes.AddLine(startbrick, startbrickdown, endbrick, endbrickdown) startbrick = endbrick + 60 EndFor startbrick = 0 startbrickdown = 366 For j = 1 to 10 Step 1 endbrick = startbrick endbrickdown = startbrickdown + 33 brick[j] = Shapes.AddLine(startbrick, startbrickdown, endbrick, endbrickdown) startbrick = endbrick + 60 EndFor endsub Sub load GraphicsWindow.ShowMessage("PLEASE WAIT WHILE ASSETS ARE LOADING!! GAME IS PRETTY FAST, IF YOU EXPEREINCE LAG, ITS YOUR INTERNET", "PLEASE WAIT") GraphicsWindow.ShowMessage("Developed by JetFire3201 and RussianBrain", "Devs") endsub Sub grassbattlefield ' changes background TextWindow.WriteLine("PLEASE WAIT WHILE WE GET THE IMAGE!!!") grassbattlefield = "http://stockarch.com/files/12/03/green_field_background.jpg" GraphicsWindow.DrawResizedImage(grassbattlefield, 0,0, 610, 410) endsub Sub fight If lag = 2 Then grassbattlefield() EndIf character() ' loads the character gui enemy() 'loads enemy gui eaction = 0 While enemyhealth > 0 and player_health > 0 display() enemydisplay() If player_magic_type= "Fire"Then fireanimation() ElseIf player_magic_type= "Water" then wateranimation() elseif player_magic_type = "Wind" then windanimation() elseif player_magic_type = "Lightning" then lightninganimation() EndIf If player_magic_type= "Fire" and magic = 4 Then probabilityofhitting = Math.Abs(speed/(speed+enemyspeed*4) * 100) ElseIf player_magic_type= "Water" and magic = 4 then probabilityofhitting = Math.Abs(speed/(speed+enemyspeed*4) * 100) elseif player_magic_type = "Wind" and magic = 4 then probabilityofhitting = Math.Abs(speed/(speed+enemyspeed*4) * 100) elseif player_magic_type = "Lightning" and magic = 4 then probabilityofhitting = Math.Abs(speed/(speed+enemyspeed) * 100) Elseif player_magic_type = "Lightning" and magic <> 4 then probabilityofhitting = Math.Abs(speed*4/(speed*4+enemyspeed) * 100) Else probabilityofhitting = Math.Abs(speed/(speed+enemyspeed) * 100) EndIf TextWindow.WriteLine("Probability of hitting for player = " + probabilityofhitting) probabilitynum = Math.GetRandomNumber(100) TextWindow.WriteLine("Your number was " + probabilitynum) If eaction=0 then playernowattacks() Else enemynowdefends() endif TextWindow.WriteLine("Enemy health is " + enemyhealth) display() ' remakes display If enemyhealth < 0 Or enemyhealth = 0 Then 'checks to see if you one ko the enemy Goto skip Else EndIf 'does enemy probablility now If magic = 1 Then probabilityofhitting = Math.Abs(enemyspeed/(speed+enemyspeed) * 100) ElseIf magic = 2 then probabilityofhitting = Math.Abs(enemyspeed/(speed+enemyspeed) * 100) elseif magic = 3 then probabilityofhitting = Math.Abs(enemyspeed/(speed+enemyspeed) * 100) elseif magic = 4 then probabilityofhitting = Math.Abs(enemyspeed*4/(speed+enemyspeed*4) * 100) EndIf TextWindow.WriteLine("Probablility of enemy hitting is = " + probabilityofhitting) ' if the enemy speed is 90 and your speed is 100, enemy has a 2 percent chance of hitting you probabilitynum = Math.GetRandomNumber(100) TextWindow.WriteLine("Enemy probability was " + probabilitynum) If magic = 1 then enemyfire() ' enemy turn TextWindow.WriteLine("enemy action was " +eaction) ElseIf magic = 2 then enemywater() TextWindow.WriteLine("enemy action was " +eaction) elseif magic = 3 then enemywind() TextWindow.WriteLine("enemy action was " +eaction) elseif magic = 4 then enemylightning() TextWindow.WriteLine("enemy action was " +eaction) endif playernowdefends() enemydisplay() ' shows enemy display skip: TextWindow.WriteLine("Player health is " + player_health) If enemyhealth < 0 Then GraphicsWindow.ShowMessage("You won", "Player won") display() expearnfromenemy() ElseIf player_health < 0 then GraphicsWindow.ShowMessage("You lost", "Player lost") EndIf TextWindow.Clear() EndWhile player_health = player_level_health Shapes.Remove(ehead) Shapes.Remove(eleg1) Shapes.Remove(eleg2) Shapes.Remove(emarm) Shapes.Remove(elarm) Shapes.Remove(etorso) Shapes.Remove(enemyhealthpic) display() dragonforce = "no" player_magic_strength = player_magic_strength / 10 speed = speed / 10 endsub sub playernowdefends ' player is now defending If probabilitynum <= probabilityofhitting Then If player_magic_type = "Fire" Then playerhasfiredefense() ElseIf player_magic_type = "Water" then playerhaswaterdefense() ElseIf player_magic_type = "Lightning" then playerhaslightningdefense() elseif player_magic_type = "Wind" then playerhaswinddefense() elseif player_magic_type = "FDS" then playerhasFDSdefense() EndIf endif EndSub Sub enemynowdefends If probabilitynum <= probabilityofhitting Then If magic = 1 Then ' enemy has fire enemyhasfiredefense() elseIf magic = 2 Then enemyhaswaterdefense() elseIf magic = 3 Then enemyhaswinddefense() elseIf magic = 4 Then enemyhaslightningdefense() EndIf endif endsub Sub playernowattacks If probabilitynum <= probabilityofhitting Then If player_magic_type = "Fire" Then playerhasfireattack() ElseIf player_magic_type = "Water" then playerhaswaterattack() ElseIf player_magic_type = "Lightning" then playerhaslightningattack() elseif player_magic_type = "Wind" then playerhaswindattack() elseif player_magic_type = "FDS" then playerhasFDSattack() EndIf endif EndSub Sub enemyhasfiredefense ' enemy has fire magic and is defending If player_magic_type = "Fire" Or player_magic_type = "Lightning" Then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf player_magic_type = "Water" then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif elseif player_magic_type = "Wind" then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif elseif player_magic_type="FDS" then If actionr = 1 then enemyhealth = enemyhealth-player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif EndIf EndSub Sub playerhasfireattack ' player has fire magic and is attacking If magic <> 2 or magic <> 3 then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf magic = 2 then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif ElseIf magic = 3 then If actionr = 1 then enemyhealth = enemyhealth- player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif EndIf EndSub Sub playerhasfiredefense ' player has fire magic and is now defending If magic = 1 Or magic = 4 Then If eaction = 1 Then player_health = player_health -enemy_strength ElseIf eaction = 2 then player_health = player_health - enemy_strength*2 ElseIf eaction = 3 then player_health = player_health - enemy_strength*3 EndIf ElseIf magic = 2 then If eaction = 1 Then player_health = player_health-enemy_strength*2 ElseIf eaction = 2 then player_health = player_health -enemy_strength*3 ElseIf eaction = 3 then player_health = player_health - enemy_strength*4 EndIf elseif magic = 3 then If eaction = 1 Then player_health = player_health ElseIf eaction = 2 then player_health = player_health -enemy_strength ElseIf eaction = 3 then player_health = player_health - enemy_strength*2 EndIf EndIf EndSub Sub playerhaswaterattack ' player has water and is attacking If magic = 2 Or magic = 3 then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf magic = 1 then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif elseif magic = 4 then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif EndIf EndSub Sub playerhaswaterdefense ' player has water and is defending If magic =2 Or magic = 3 then If eaction = 1 then player_health = player_health - enemy_strength elseIf eaction = 2 then player_health = player_health - enemy_strength *2 elseIf eaction = 3 then player_health = player_health - enemy_strength*3 endif ElseIf magic = 1 then If eaction = 1 then player_health = player_health elseIf eaction = 2 then player_health = player_health-enemy_strength elseIf eaction = 3 then player_health = player_health - enemy_strength*2 endif elseif magic = 4 then If eaction = 1 then player_health = player_health-enemy_strength*2 elseIf eaction = 2 then player_health = player_health - enemy_strength *3 elseIf eaction = 3 then player_health = player_health - enemy_strength*4 endif EndIf EndSub Sub enemyhaswaterdefense ' player has water and is defending If player_magic_type ="Water" Or player_magic_type = "Wind" then If actionr = 1 then enemy_health = enemy_health - player_magic_strength elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength *2 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*3 endif ElseIf player_magic_type= "Fire" then If actionr = 1 then enemy_health = enemy_health elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*2 endif elseif player_magic_type = "Lightning" then If actionr = 1 then enemy_health = enemy_health - player_magic_strength*2 elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength*3 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*4 endif elseif player_magic_type = "FDS" then If actionr = 1 then enemy_health = enemy_health - player_magic_strength elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength*2 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*3 endif EndIf EndSub Sub playerhaswindattack ' player has wind and is attacking If magic = 2 Or magic = 3 then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf magic = 1 then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif elseif magic = 4 then If actionr = 1 then enemyhealth = enemyhealth -player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif EndIf EndSub Sub playerhaswinddefense ' player has wind and is defending If magic =2 Or magic = 3 then If eaction = 1 then player_health = player_health - enemy_strength elseIf eaction = 2 then player_health = player_health - enemy_strength *2 elseIf eaction = 3 then player_health = player_health - enemy_strength*3 endif ElseIf magic = 1 then If eaction = 1 then player_health = player_health-enemy_strength*2 elseIf eaction = 2 then player_health = player_health - enemy_strength *3 elseIf eaction = 3 then player_health = player_health - enemy_strength*4 endif elseif magic = 4 then If eaction = 1 then player_health = player_health elseIf eaction = 2 then player_health = player_health - enemy_strength elseIf eaction = 3 then player_health = player_health - enemy_strength*2 endif EndIf EndSub Sub enemyhaswinddefense 'enemy has wind and is defending If player_magic_type ="Water" Or player_magic_type = "Wind" then If actionr = 1 then enemy_health = enemy_health - player_magic_strength elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength *2 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*3 endif ElseIf player_magic_type= "Fire" then If actionr = 1 then enemy_health = enemy_health - player_magic_strength*2 elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength*3 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*4 endif elseif player_magic_type = "Lightning" then If actionr = 1 then enemy_health = enemy_health elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*2 endif elseif player_magic_type = "FDS" then If actionr = 1 then enemy_health = enemy_health-player_magic_strength*3 elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength*4 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*5 endif EndIf EndSub Sub playerhaslightningattack ' player has lightning magic and is attacking If magic <> 2 Or magic <> 3 then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf magic = 2 then If actionr = 1 then enemyhealth = enemyhealth- player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif ElseIf magic = 3 then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*2 endif EndIf EndSub Sub playerhaslightningdefense ' player has lightning magic and is now defending If magic = 1 Or magic = 4 Then If eaction = 1 Then player_health = player_health -enemy_strength ElseIf eaction = 2 then player_health = player_health - enemy_strength*2 ElseIf eaction = 3 then player_health = player_health - enemy_strength*3 EndIf ElseIf magic = 2 then If eaction = 1 Then player_health = player_health ElseIf eaction = 2 then player_health = player_health -enemy_strength ElseIf eaction = 3 then player_health = player_health - enemy_strength*2 EndIf elseif magic = 3 then If eaction = 1 Then player_health = player_health - enemy_strength*2 ElseIf eaction = 2 then player_health = player_health -enemy_strength*3 ElseIf eaction = 3 then player_health = player_health - enemy_strength*4 EndIf EndIf EndSub Sub enemyhaslightningdefense ' enemy haslightning magic and is defending If player_magic_type = "Fire" or player_magic_type = "Lightning" Then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf player_magic_type = "Water" then If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif elseif player_magic_type = "Wind" then If actionr = 1 then enemyhealth = enemyhealth elseIf actionr = 2 then enemyhealth = enemyhealth- player_magic_strength elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif elseif player_magic_type = "FDS" then If actionr = 1 then enemy_health = enemy_health-player_magic_strength elseIf actionr = 2 then enemy_health = enemy_health - player_magic_strength*2 elseIf actionr = 3 then enemy_health = enemy_health - player_magic_strength*3 endif EndIf EndSub Sub playerhasFDSattack ' player hasFDS magic and is attacking If magic <> 2 Or magic <> 3 then 'enemy has fire or lightning If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*4 endif ElseIf magic = 2 then ' enemy has water If actionr = 1 then enemyhealth = enemyhealth- player_magic_strength elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*2 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*3 endif ElseIf magic = 3 then 'enemy has wind If actionr = 1 then enemyhealth = enemyhealth - player_magic_strength*3 elseIf actionr = 2 then enemyhealth = enemyhealth - player_magic_strength*4 elseIf actionr = 3 then enemyhealth = enemyhealth - player_magic_strength*5 endif EndIf EndSub Sub playerhasFDSdefense ' player has FDS magic and is now defending If magic = 1 Or magic = 4 Then 'enemy has fire or lightning If eaction = 1 Then player_health = player_health ElseIf eaction = 2 then player_health = player_health - enemy_strength ElseIf eaction = 3 then player_health = player_health - enemy_strength*2 EndIf ElseIf magic = 2 then 'enemy has water If eaction = 1 Then player_health = player_health - enemy_strength ElseIf eaction = 2 then player_health = player_health - enemy_strength*2 ElseIf eaction = 3 then player_health = player_health - enemy_strength*3 EndIf elseif magic = 3 then If eaction = 1 Then player_health = player_health ElseIf eaction = 2 then player_health = player_health ElseIf eaction = 3 then player_health = player_health - enemy_strength EndIf EndIf EndSub '-------------------------------------------------------------------------------- Sub FDS gain = "true" GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor="red" TextWindow.WriteLine("1. Fire Dragon Lungs") TextWindow.WriteLine("2. Iron Fist of the Fire Dragon") TextWindow.WriteLine("3. Roar of the Fire Dragon") TextWindow.WriteLine("4. Fire Dragon Force") TextWindow.WriteLine("5. Leave") actionr = TextWindow.Read() If actionr = 1 then If player_magic_energy < player_magic_energy_limit Then y1 = 230-190 y2 = 230-95 y3 = 230 y4 = 230+95 y5 = 230+190 wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("FIRE DRAGON LUNGS") Shapes.Move(word, 90, 180) Program.Delay(1000) For x = 300 To 135 Step -1 y1end = y1 y2end = y2 y3end = y3 y4end = y4 y5end = y5 lungs[1] = Shapes.AddLine(120, 230, x,y1end) lungs[2] = Shapes.AddLine(120, 230, x, y2end) lungs[3] = Shapes.AddLine(120, 230, x, y3end) lungs[4] = Shapes.AddLine(120, 230, x,y4end) lungs[5] = Shapes.AddLine(120, 230, x, y5end) y1 = y1 + 1 y2 = y2+0.5 y3 = y3 y4 = y4-0.5 y5 = y5-1 Program.Delay(40) Shapes.Remove(lungs[1]) Shapes.Remove(lungs[2]) Shapes.Remove(lungs[3]) Shapes.Remove(lungs[4]) Shapes.Remove(lungs[5]) EndFor player_magic_energy = player_magic_energy_limit else gain = "false" endif ElseIf actionr = 2 then If dragonforce = "yes" then elseif dragonforce <> "yes" and player_magic_energy >= 100 then player_magic_energy = player_magic_energy - 100 elseif player_magic_energy < 100 then TextWindow.WriteLine("you do not have enough energy") gain="false" Goto skiptonext EndIf wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Iron Fist of the FIre Dragon") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) Shapes.Remove(larm) Shapes.Remove(leg1) Shapes.Remove(leg2) marm = Shapes.AddLine(110, 245, 135, 245) larm = Shapes.AddLine(110, 245, 85, 255) leg1 = Shapes.AddLine(110, 270, 100, 300) leg2 = Shapes.AddLine(110,270, 110, 300) firefist = Shapes.AddEllipse(5, 5) Shapes.Move(firefist, 84, 255) For i = 1 to 5 step 1 Shapes.Zoom(firefist, i, i) Program.Delay(50) endfor Shapes.Move(firefist, 135, 245) For i = 1 to 350 step 1 Shapes.move(head, 100+i, 220) Shapes.move(larm, i, 0) Shapes.move(marm, i, 0) Shapes.move(leg1, i, 0) Shapes.move(leg2, i , 0) Shapes.Move(torso, i, 0) Shapes.Move(firefist, 135+i, 245) Program.Delay(10) endfor Shapes.Remove(marm) Shapes.Remove(larm) Shapes.Remove(leg1) Shapes.Remove(leg2) Shapes.Remove(torso) Shapes.Remove(head) Shapes.Remove(firefist) If player_magic_type = "Fire" Then GraphicsWindow.BrushColor ="Red" ElseIf player_magic_type = "Water" then GraphicsWindow.BrushColor ="Blue" ElseIf player_magic_type = "Wind" then GraphicsWindow.BrushColor ="White" elseif player_magic_type="Lightning" then GraphicsWindow.BrushColor = "Yellow" endif head = Shapes.AddEllipse(20, 20) 'head = x= 110, y = 120 Shapes.Move(head, 100, 220) If player_magic_type = "Fire" Then GraphicsWindow.penColor ="Red" ElseIf player_magic_type = "Water" then GraphicsWindow.penColor ="Blue" ElseIf player_magic_type = "Wind" then GraphicsWindow.penColor ="White" elseif player_magic_type="Lightning" then GraphicsWindow.penColor = "Yellow" endif torso = Shapes.AddLine(110, 240, 110, 270) leg1 = Shapes.AddLine(110, 270, 100, 300) leg2 = Shapes.AddLine(110,270, 120, 300) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) elseif actionr = 3 then If dragonforce = "yes" then elseIf dragonforce<> "yes" and player_magic_energy >= 200 and player_level >= 11 then player_magic_energy = player_magic_energy - 200 elseif player_magic_energy < 200 then TextWindow.WriteLine("you do not have enough energy") gain="false" Goto skiptonext EndIf wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Roar of the Fire Dragon") Shapes.Move(word, 90, 180) Program.Delay(1000) For i = 1 to 400 step 1 breath[i] = Shapes.AddLine(110+i, 230-(i/4), 110+i, 230+(i/4)) Program.Delay(20) endfor For i = 1 to 400 step 1 Shapes.Remove(breath[i]) endfor elseif actionr = 4 then If dragonforce = "yes" then elseif player_magic_energy >= 300 and player_level >= 30 then player_magic_energy = player_magic_energy - 300 elseif player_magic_energy < 300 then TextWindow.WriteLine("you do not have enough energy") Goto skiptonext EndIf wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("DRAGON FOOOOOOORRRCEEEE") Shapes.Move(word, 90, 180) Program.Delay(1000) dragonforce = "yes" player_magic_strength = player_magic_strength * 10 speed = speed * 10 For times = 1 to 20 step 1 For i = 1 to 7 step 1 rock[i] = Shapes.AddEllipse(10, 10) Shapes.Move(rock[i], 60+(i*15),300+Math.GetRandomNumber(30)) endfor For i = 1 to 7 step 1 Shapes.Animate(rock[i], 60+(i*15), Math.GetRandomNumber(30)+100, 500) endfor Program.Delay(500) For i = 1 to 7 step 1 Shapes.Remove(rock[i]) endfor endfor endif skiptonext: Shapes.Remove(word) Shapes.Remove(wordline) EndSub Sub windanimation gain = "true" GraphicsWindow.penColor ="White" GraphicsWindow.BrushColor="White" TextWindow.WriteLine("1. Wind shurikens") TextWindow.WriteLine("2.Wind Blast") TextWindow.WriteLine("3. Storm Bringer") TextWindow.WriteLine("4. Gather Energy") TextWindow.WriteLine("5. Leave") actionr = TextWindow.Read() If actionr = 1 then If player_magic_energy >= 100 then player_magic_energy = player_magic_energy -100 wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Wind Shurikens") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 245) firstwind = Shapes.addRectangle(2, 30) secondgust = Shapes.AddRectangle(30, 2) firstwind2 = Shapes.addRectangle(2, 30) secondgust2 = Shapes.AddRectangle(30, 2) Shapes.Move(firstwind, 150, 230) Shapes.Move(secondgust, 135, 245) Shapes.Move(firstwind2, 150, 255) Shapes.Move(secondgust2, 135, 270) Shapes.Animate(firstwind, 475, 230, 1000) Shapes.Animate(secondgust, 460, 245, 1000) Shapes.Animate(firstwind2, 490, 2555, 1000) Shapes.Animate(secondgust2, 475, 270, 1000) For i = 0 To 36000 Step 1 Shapes.Rotate(firstwind, i) Shapes.Rotate(secondgust, i) Shapes.Rotate(firstwind2, i) Shapes.Rotate(secondgust2, i) endfor For i = 100 To 0 step -1 Shapes.SetOpacity(firstwind, i) Shapes.SetOpacity(firstwind2, i) Shapes.SetOpacity(secondgust, i) Shapes.SetOpacity(secondgust2, i) Program.Delay(25) endfor Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("You do not have enough energy (100)") gain = "false" endif ElseIf actionr = 2 then If player_magic_energy >= 200 and player_level >= 11 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Wind Blast") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy -200 GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "white" windshell = Shapes.AddEllipse(100, 100) Shapes.HideShape(windshell) Shapes.SetOpacity(windshell, 0) Shapes.Move(windshell, 70, 210) Shapes.ShowShape(windshell) For i = 0 to 100 step 1 Shapes.SetOpacity(windshell, i) Program.Delay(45) endfor Shapes.Zoom(windshell,20, 20) For i = 100 to 0 step -1 Shapes.SetOpacity(windshell, i) Program.Delay(40) endfor TextWindow.Pause() Else TextWindow.WriteLine("You do not have enough energy (200) or you are not level 7") gain = "false" endif elseif actionr = 3 then If player_magic_energy >= 300 and player_level >= 30 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Wind Storm") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 300 Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245,100, 220) marm = Shapes.AddLine(110, 245, 120, 220) GraphicsWindow.PenColor="black" GraphicsWindow.BrushColor="white" For i = 1 To 20 Step 1 goingdown[i] = Shapes.AddEllipse(20+i, 10) Shapes.HideShape(goingdown[i]) Shapes.SetOpacity(goingdown[i], 40) endfor For i = 1 To 20 Step 1 move[i] = 500 - (i/2) Shapes.Move(goingdown[i], move[i], 0) endfor For i = 1 To 20 Step 1 k = k+6 Shapes.Move(goingdown[i], move[i], 190 + k) endfor For i = 1 To 20 Step 1 Shapes.ShowShape(goingdown[i]) Program.Delay(40) EndFor Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) For i = 1 to 20 Step 1 Shapes.Remove(goingdown[i]) endfor TextWindow.Pause() Else TextWindow.WriteLine("You do not have enough energy (300) or you are not level 30") gain = "false" endif elseif actionr = 4 then If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit Else player_magic_energy = player_magic_energy + 200 If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit endif TextWindow.Pause() display() EndIf elseif actionr = 5 then EndIf Shapes.Remove(word) Shapes.Remove(wordline) EndSub Sub enemywind eaction = Math.GetRandomNumber(2) If eaction = 1 then GraphicsWindow.PenColor = "Black" Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.PenColor= "black" firstwind = Shapes.addRectangle(2, 30) secondgust = Shapes.AddRectangle(30, 2) firstwind2 = Shapes.addRectangle(2, 30) secondgust2 = Shapes.AddRectangle(30, 2) Shapes.Move(firstwind, 485, 230) Shapes.Move(secondgust, 470, 245) Shapes.Move(firstwind2, 485, 255) Shapes.Move(secondgust2, 470, 270) Shapes.Animate(firstwind, 135, 230, 1000) Shapes.Animate(secondgust, 120, 245, 1000) Shapes.Animate(firstwind2, 120, 255, 1000) Shapes.Animate(secondgust2, 105, 270, 1000) For i = 0 To 36000 Step 1 Shapes.Rotate(firstwind, i) Shapes.Rotate(secondgust, i) Shapes.Rotate(firstwind2, i) Shapes.Rotate(secondgust2, i) endfor Program.Delay(3000) For i = 100 To 0 step -1 Shapes.SetOpacity(firstwind, i) Shapes.SetOpacity(firstwind2, i) Shapes.SetOpacity(secondgust, i) Shapes.SetOpacity(secondgust2, i) Program.Delay(25) endfor Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) ElseIf eaction = 2 then GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "Black" windshell = Shapes.AddEllipse(100, 100) Shapes.HideShape(windshell) Shapes.SetOpacity(windshell, 0) Shapes.Move(windshell, 470, 210) Shapes.ShowShape(windshell) For i = 0 to 100 step 1 Shapes.SetOpacity(windshell, i) Program.Delay(45) endfor Shapes.Zoom(windshell,20, 20) For i = 100 to 0 step -1 Shapes.SetOpacity(windshell, i) Program.Delay(40) endfor elseif eaction = 3 then GraphicsWindow.PenColor = "Black" Shapes.Remove(elarm) Shapes.Remove(emarm) elarm = Shapes.AddLine(510, 245, 500, 220) emarm = Shapes.AddLine(510, 245, 520, 220) GraphicsWindow.PenColor="black" GraphicsWindow.BrushColor="white" For i = 1 To 20 Step 1 goingdown[i] = Shapes.AddEllipse(20+i, 10) Shapes.HideShape(goingdown[i]) Shapes.SetOpacity(goingdown[i], 40) endfor For i = 1 To 20 Step 1 move[i] = 100 - (i/2) Shapes.Move(goingdown[i], move[i], 0) endfor For i = 1 To 20 Step 1 k = k+6 Shapes.Move(goingdown[i], move[i], 190 + k) endfor For i = 1 To 20 Step 1 Shapes.ShowShape(goingdown[i]) Program.Delay(40) EndFor Shapes.Remove(elarm) Shapes.Remove(emarm) For i = 1 to 20 Step 1 Shapes.Remove(goingdown[i]) endfor GraphicsWindow.PenColor = "Black" elarm = Shapes.AddLine(510, 245, 500, 270) emarm = Shapes.AddLine(510, 245, 520, 270) EndIf EndSub Sub fireanimation gain = "true" GraphicsWindow.penColor ="Red" GraphicsWindow.BrushColor="Red" TextWindow.WriteLine("1. Fireball") TextWindow.WriteLine("2.Fire Bullets") TextWindow.WriteLine("3. Brilliant Flame") TextWindow.WriteLine("4. Gather Energy") TextWindow.WriteLine("5. Leave") actionr = TextWindow.Read() If actionr = 1 then If player_magic_energy >= 100 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Fire Ball") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 245) player_magic_energy = player_magic_energy - 100 GraphicsWindow.BrushColor = "Red" fireball = Shapes.AddEllipse(20, 20) Shapes.Move(fireball, 135, 235) Shapes.animate(fireball, 465, 235, 3000) Program.Delay(3000) For i = 100 To 0 Step -2 Shapes.Zoom(fireball,10, 10) Shapes.SetOpacity(fireball, i ) Program.Delay(50) endfor shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy (100)") gain = "false" endif ElseIf actionr = 2 then If player_magic_energy >= 200 and player_level >= 7 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Fire Bullet") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 245) player_magic_energy = player_magic_energy - 200 GraphicsWindow.BrushColor = "Red" firebullet1 = Shapes.AddEllipse(10,10) firebullet2 = Shapes.AddEllipse(10,10) firebullet3 =Shapes.AddEllipse(10,10) Shapes.Move(firebullet1,135,130) Shapes.Move(firebullet2,135, 241) Shapes.Move(firebullet3,135,252) Shapes.Animate(firebullet1,465,130,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(firebullet1,5, 5) Shapes.SetOpacity(firebullet1, i ) Program.Delay(25) endfor Shapes.Animate(firebullet2,465,241,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(firebullet2,5, 5) Shapes.SetOpacity(firebullet2, i ) Program.Delay(25) endfor Shapes.Animate(firebullet3,465,252,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(firebullet3,5, 5) Shapes.SetOpacity(firebullet3, i ) Program.Delay(25) endfor shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy (200) or you need to be level 11 or higher") gain = "false" endif elseif actionr = 3 then If player_magic_energy >= 300 and player_level >= 30 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Brilliant Flame") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 270) player_magic_energy = player_magic_energy - 300 GraphicsWindow.BrushColor = "Yellow" brilliant_flame = Shapes.AddEllipse(10,10) Shapes.Move(brilliant_flame,135,230) Shapes.Animate(brilliant_flame, 465,230,3000) Program.Delay(3000) For i = 100 to 0 step -4 Shapes.Zoom(brilliant_flame, 30,30) Shapes.SetOpacity(brilliant_flame,i) Program.Delay(50) endfor Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 120, 245) TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy (300) or you need to be level 30 or higher") gain = "false" endif elseif actionr = 4 then If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit Else player_magic_energy = player_magic_energy + 200 If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit endif TextWindow.Pause() display() EndIf elseif actionr = 5 then endif Shapes.Remove(word) Shapes.Remove(wordline) endsub Sub enemyfire ' enemy fire animation eaction = Math.GetRandomNumber(3) If eaction = 1 then GraphicsWindow.penColor ="Red" Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.BrushColor = "Red" efireball = Shapes.AddEllipse(20, 20) Shapes.Move(efireball, 465, 235) Shapes.animate(efireball, 135, 235, 3000) Program.Delay(3000) For i = 100 To 0 Step -2 Shapes.Zoom(efireball,10, 10) Shapes.SetOpacity(efireball, i ) Program.Delay(50) endfor Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) ElseIf eaction = 2 then GraphicsWindow.penColor ="Red" Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.BrushColor = "Red" efirebullet1 = Shapes.AddEllipse(10,10) efirebullet2 = Shapes.AddEllipse(10,10) efirebullet3 =Shapes.AddEllipse(10,10) Shapes.Move(efirebullet1,465,230) Shapes.Move(efirebullet2,465, 241) Shapes.Move(efirebullet3,465,252) Shapes.Animate(efirebullet1,135,230,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(efirebullet1,5, 5) Shapes.SetOpacity(efirebullet1, i ) Program.Delay(25) endfor Shapes.Animate(efirebullet2,135,241,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(efirebullet2,5, 5) Shapes.SetOpacity(efirebullet2, i ) Program.Delay(25) endfor Shapes.Animate(efirebullet3,135,252,100) Program.Delay(100) For i = 100 To 0 Step -5 Shapes.Zoom(efirebullet3,5, 5) Shapes.SetOpacity(efirebullet3, i ) Program.Delay(25) endfor Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) elseif eaction = 3 then GraphicsWindow.penColor ="Red" Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.BrushColor = "Yellow" ebrilliant_flame = Shapes.AddEllipse(10,10) Shapes.Move(ebrilliant_flame,465,230) Shapes.Animate(ebrilliant_flame, 135,230,3000) Program.Delay(3000) For i = 100 to 0 step -4 Shapes.Zoom(ebrilliant_flame, 30,30) Shapes.SetOpacity(ebrilliant_flame,i) Program.Delay(50) endfor Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) endif endsub Sub wateranimation gain = "true" GraphicsWindow.penColor ="Blue" GraphicsWindow.BrushColor="Blue" TextWindow.WriteLine("1. Water Lock") TextWindow.WriteLine("2. Water Beam") TextWindow.WriteLine("3. Tsunami") TextWindow.WriteLine("4. Gather Energy") TextWindow.WriteLine("5. Leave") actionr = TextWindow.Read() If actionr = 1 Then If player_magic_energy >= 100 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Water Lock") Shapes.Move(word, 90, 180) Program.Delay(1000) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 245) player_magic_energy = player_magic_energy - 100 GraphicsWindow.BrushColor="#6eb7cd" GraphicsWindow.PenColor="#6eb7cd" waterwavetop = Shapes.AddRectangle(80, 80) Shapes.Move(waterwavetop, 137, 220) Shapes.Animate(waterwavetop, 465,220, 3000) Program.Delay(3000) For i = 1 To 1080 Step 1 Shapes.Rotate(waterwavetop,i) Program.Delay(1) endfor For i = 100 To 0 Step -1 Shapes.SetOpacity(waterwavetop, i) Program.Delay(25) endfor Shapes.Remove(marm) GraphicsWindow.penColor ="Blue" marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy(100)") gain = "false" endif ElseIf actionr = 2 then If player_magic_energy >= 200 and player_level >= 7 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Water Beam") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 200 GraphicsWindow.BrushColor="#6eb7cd" GraphicsWindow.PenColor="#6eb7cd" For i = 135 to 510 step 1 waterwall[i] = Shapes.Addline( i, 235, i, 255) Program.Delay(25) endfor For i = 135 To 510 Step 1 Shapes.Remove(waterwall[i]) Program.Delay(25) endfor TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy (200)or you have to be level 11") gain = "false" EndIf Elseif actionr = 3 then If player_magic_energy >= 300 and player_level >= 30 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Water Tsunami") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 300 Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245, 100, 220) marm = Shapes.AddLine(110, 245, 120, 220) GraphicsWindow.PenColor="#6eb7cd" For i = 400 to 0 step -1 Shapes.SetOpacity(waterline[i], 3) waterline[i] = Shapes.AddLine(0, i, 600, i) Shapes.SetOpacity(waterline[i], 3) Program.Delay(15) endfor For i = 0 to 400 step 1 Shapes.Remove(waterline[i]) endfor Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("you do not have enough energy (300)or you have to be level 30") gain = "false" endif Elseif actionr = 4 then If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit Else player_magic_energy = player_magic_energy + 200 If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit endif EndIf elseif actionr = 5 then EndIf Shapes.Remove(word) Shapes.Remove(wordline) endsub Sub enemywater eaction = Math.GetRandomNumber(3) If eaction = 1 Then Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.BrushColor="#6eb7cd" GraphicsWindow.PenColor="#6eb7cd" waterwavetop = Shapes.AddRectangle(80, 80) Shapes.Move(waterwavetop, 425, 220) Shapes.Animate(waterwavetop, 80,220, 3000) Program.Delay(3000) For i = 1 To 1080 Step 1 Shapes.Rotate(waterwavetop,i) Program.Delay(1) endfor For i = 100 To 0 Step -1 Shapes.SetOpacity(waterwavetop, i) Program.Delay(25) endfor Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) ElseIf eaction = 2 then GraphicsWindow.BrushColor="#6eb7cd" GraphicsWindow.PenColor="#6eb7cd" For i = 485 to 110 step -1 waterwall[i] = Shapes.Addline( i, 235, i, 255) Program.Delay(25) endfor For i = 485 To 110 Step -1 Shapes.Remove(waterwall[i]) Program.Delay(25) endfor Elseif eaction = 3 then Shapes.Remove(elarm) Shapes.Remove(emarm) GraphicsWindow.PenColor="#6eb7cd" elarm = Shapes.AddLine(510, 245, 500, 220) emarm = Shapes.AddLine(510, 245, 520, 220) GraphicsWindow.PenColor="#6eb7cd" For i = 400 to 0 step -1 waterline[i] = Shapes.AddLine(0, i, 600, i) Program.Delay(15) endfor For i = 0 to 400 step 1 Shapes.Remove(waterline[i]) endfor Shapes.Remove(elarm) Shapes.Remove(emarm) elarm = Shapes.AddLine(510, 245, 500, 270) emarm = Shapes.AddLine(510, 245, 520, 270) EndIf endsub Sub lightninganimation lightningagain: gain = "true" TextWindow.WriteLine("1. Lightning Bolt") TextWindow.WriteLine("2. Lightning Shockwave") TextWindow.WriteLine("3. Lightning Storm") TextWindow.WriteLine("4. Gather Energy") TextWindow.WriteLine("5. Leave") GraphicsWindow.BrushColor="Yellow" GraphicsWindow.PenColor = "Yellow" actionr = TextWindow.Read() If actionr = 1 then If player_magic_energy >= 100 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Lightning Bolt") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 100 Shapes.Remove(marm) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 135, 245) GraphicsWindow.PenColor = "Yellow" x = 135 x2 = 135 sq = 1 sq2 = 1 start = 245 start2 = 245 While x < 510 GraphicsWindow.PenWidth = 3 randomy = 245 + Math.GetRandomNumber(50) randomy3 = 245 - Math.GetRandomNumber(50) randomdis = Math.GetRandomNumber(60) randomdis2 = Math.GetRandomNumber(60) total = x + randomdis total2 = x2 + randomdis2 random[sq] = Shapes.AddLine(x, start, total, randomy) randomi[sq2] = Shapes.AddLine(x2, start2, total2, randomy3) randomy2 = 245 - Math.GetRandomNumber(50) randomy4 = 245 + Math.GetRandomNumber(50) randomdist = Math.GetRandomNumber(60) randomdist2 = Math.GetRandomNumber(60) finaltotal = total + randomdist finaltotal2 = total2 + randomdist2 random[sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) randomi[sq2+1] = Shapes.AddLine(total2, randomy3, finaltotal2, randomy4) x = total + randomdist x2 = total2+randomdist2 start = randomy2 start2 = randomy4 sq = sq + 2 sq2 = sq2 + 2 Program.Delay(400) EndWhile While sq <> 0 And sq2 <> 0 Shapes.Remove(random[sq]) Shapes.Remove(randomi[sq2]) sq = sq -1 sq2 = sq2 - 1 EndWhile GraphicsWindow.PenWidth=2 Shapes.Remove(marm) Shapes.Remove(marm) marm = Shapes.AddLine(110, 245, 120, 270) Else TextWindow.WriteLine("You do not have enough energy (100)") gain = "false" endif ElseIf actionr = 2 then If player_magic_energy >= 200 and player_level >= 11 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Lightning Shockwave") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 200 Shapes.Remove(marm) Shapes.Remove(torso) Shapes.Remove(larm) Shapes.Remove(leg1) Shapes.Remove(leg2) Shapes.Remove(head) GraphicsWindow.PenColor = "Yellow" x = 135 sq = 1 start = 245 While x < 510 GraphicsWindow.PenWidth = 10 randomy = 245 + Math.GetRandomNumber(50) randomdis = Math.GetRandomNumber(60) total = x + randomdis random[sq] = Shapes.AddLine(x, start, total, randomy) randomy2 = 245 - Math.GetRandomNumber(50) randomdist = Math.GetRandomNumber(60) finaltotal = total + randomdist random[sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) x = total + randomdist start = randomy2 sq = sq + 2 Program.Delay(40) EndWhile While sq <> 0 Shapes.Remove(random[sq]) sq = sq -1 EndWhile GraphicsWindow.PenWidth=2 GraphicsWindow.BrushColor = "Yellow" head = Shapes.AddEllipse(20, 20) Shapes.Move(head, 100, 220) torso = Shapes.AddLine(110, 240, 110, 270) leg1 = Shapes.AddLine(110, 270, 100, 300) leg2 = Shapes.AddLine(110,270, 120, 300) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) TextWindow.Pause() Else TextWindow.WriteLine("You do not have enough energy (200) or you are not level 11") gain = "false" endif elseif actionr = 3 then If player_magic_energy >= 300 and player_level >= 30 then wordline = Shapes.AddLine(110, 220, 90, 190) word = Shapes.AddText("Lightning Storm") Shapes.Move(word, 90, 180) Program.Delay(1000) player_magic_energy = player_magic_energy - 300 Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245,100, 220) marm = Shapes.AddLine(110, 245, 120, 220) For i = 1 to 3 step 1 GraphicsWindow.BrushColor="grey" cloud[i] = Shapes.AddEllipse(100, 50) Shapes.Move(cloud[i], i * 60, 0) endfor sq = 1 GraphicsWindow.PenColor = "Yellow" For i = 1 to 5 step 1 x = 135 + Math.GetRandomNumber(120) start = 50 While x < 510 randomy = start + 30 randomdis = 21 total = x + randomdis random[i][sq] = Shapes.AddLine(x, start, total, randomy) randomy2 = randomy - 5 randomdist = 21 finaltotal = total + randomdist random[i][sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) x = total + randomdist start = randomy2 sq = sq + 2 Program.Delay(10) EndWhile TextWindow.WriteLine("Finished while loop") For j = sq to 0 step -1 Shapes.Remove(random[i][j]) endfor endfor Shapes.Remove(larm) Shapes.Remove(marm) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) Else TextWindow.WriteLine("You do not have enough energy (300) or you are not level 30") gain = "false" endif elseif actionr = 4 then If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit Else player_magic_energy = player_magic_energy + 200 If player_magic_energy >= player_magic_energy_limit then player_magic_energy = player_magic_energy_limit endif EndIf Elseif actionr = 5 then Elseif actionr > 5 then Goto lightningagain EndIf Shapes.Remove(word) Shapes.Remove(wordline) EndSub Sub enemylightning eaction = 3 If eaction= 1 then Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 485, 245) GraphicsWindow.PenColor = "Yellow" x = 485 x2 = 485 sq = 1 sq2 = 1 start = 245 start2 = 245 While x > 135 GraphicsWindow.PenWidth = 3 randomy = 245 + Math.GetRandomNumber(50) randomy3 = 245 - Math.GetRandomNumber(50) randomdis = Math.GetRandomNumber(60) randomdis2 = Math.GetRandomNumber(60) total = x - randomdis total2 = x2 - randomdis2 random[sq] = Shapes.AddLine(x, start, total, randomy) randomi[sq2] = Shapes.AddLine(x2, start2, total2, randomy3) randomy2 = 245 - Math.GetRandomNumber(50) randomy4 = 245 + Math.GetRandomNumber(50) randomdist = Math.GetRandomNumber(60) randomdist2 = Math.GetRandomNumber(60) finaltotal = total - randomdist finaltotal2 = total2 - randomdist2 random[sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) randomi[sq2+1] = Shapes.AddLine(total2, randomy3, finaltotal2, randomy4) x = total - randomdist x2 = total2 -randomdist2 start = randomy2 start2 = randomy4 sq = sq + 2 sq2 = sq2 + 2 Program.Delay(400) EndWhile While sq <> 0 And sq2 <> 0 Shapes.Remove(random[sq]) Shapes.Remove(randomi[sq2]) sq = sq -1 sq2 = sq2 - 1 EndWhile GraphicsWindow.PenWidth=2 GraphicsWindow.PenColor="black" Shapes.Remove(elarm) elarm = Shapes.AddLine(510, 245, 500, 270) ElseIf eaction = 2 then Shapes.Remove(elarm) Shapes.Remove(etorso) Shapes.Remove(emarm) Shapes.Remove(eleg1) Shapes.Remove(eleg2) Shapes.Remove(ehead) GraphicsWindow.PenColor = "Yellow" x = 485 sq = 1 start = 245 While x > 110 GraphicsWindow.PenWidth = 10 randomy = 245 + Math.GetRandomNumber(50) randomdis = Math.GetRandomNumber(60) total = x - randomdis random[sq] = Shapes.AddLine(x, start, total, randomy) randomy2 = 245 - Math.GetRandomNumber(50) randomdist = Math.GetRandomNumber(60) finaltotal = total - randomdist random[sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) x = total - randomdist start = randomy2 sq = sq + 2 Program.Delay(40) EndWhile While sq <> 0 Shapes.Remove(random[sq]) sq = sq -1 EndWhile GraphicsWindow.PenWidth=2 GraphicsWindow.BrushColor = "Yellow" ehead = Shapes.AddEllipse(20, 20) 'head = x= 110, y = 120 Shapes.Move(ehead, 500, 220) GraphicsWindow.PenColor = "Black" etorso = Shapes.AddLine(510, 240, 510, 270) eleg1 = Shapes.AddLine(510, 270, 500, 300) eleg2 = Shapes.AddLine(510,270, 520, 300) elarm = Shapes.AddLine(510, 245, 500, 270) emarm = Shapes.AddLine(510, 245, 520, 270) elseif eaction = 3 then Shapes.Remove(elarm) Shapes.Remove(emarm) elarm = Shapes.AddLine(510, 245,500, 220) emarm = Shapes.AddLine(510, 245, 520, 220) For i = 1 to 3 step 1 GraphicsWindow.BrushColor="black" cloud[i] = Shapes.AddEllipse(100, 50) Shapes.Move(cloud[i], 400 + i*(50),1) endfor sq = 1 GraphicsWindow.PenColor = "Yellow" For i = 1 to 5 step 1 x = 485 + Math.GetRandomNumber(115) start = 50 While x >110 randomy = start + 30 randomdis = 21 total = x - randomdis random[i][sq] = Shapes.AddLine(x, start, total, randomy) randomy2 = randomy - 5 randomdist = 21 finaltotal = total - randomdist random[i][sq+1] = Shapes.AddLine(total, randomy,finaltotal, randomy2) x = total - randomdist start = randomy2 sq = sq + 2 Program.Delay(40) EndWhile For j = sq to 0 step -1 Shapes.Remove(random[i][j]) endfor endfor For i = 1 to 3 step 1 Shapes.reMove(cloud[i]) endfor GraphicsWindow.PenColor="black" Shapes.Remove(elarm) Shapes.Remove(emarm) elarm = Shapes.AddLine(510, 245, 500, 270) emarm = Shapes.AddLine(510, 245, 520, 270) EndIf EndSub Sub showstats TextWindow.WriteLine("Health = " + player_level_health) TextWindow.WriteLine("EXP = " +player_exp) TextWindow.WriteLine("Energy = " +player_magic_energy) TextWindow.WriteLine("Strength = " +player_strength) TextWindow.WriteLine("Level = " +player_level) TextWindow.WriteLine("Speed = " +speed) TextWindow.WriteLine("Magic Strength = " + player_magic_strength) TextWindow.WriteLine("Magic = " + player_magic_type) EndSub Sub options character() while 1=1 TextWindow.WriteLine("What do you want to do?") TextWindow.WriteLine("1. practice") TextWindow.WriteLine("2. save") TextWindow.WriteLine("3. rest") TextWindow.WriteLine("4. Stats") TextWindow.WriteLine("5. Fight") answerchoice = TextWindow.ReadNumber() If answerchoice = 1 Then practice() ElseIf answerchoice =2 then makesaves() Elseif answerchoice = 3 then player_health = player_level_health player_magic_energy = player_magic_energy_limit display() elseif answerchoice = 4 then showstats() display() elseif answerchoice = 5 then fight() display() EndIf endwhile EndSub Sub practice While actionr <> 5 display() If player_magic_type="Fire" Then fireanimation() ElseIf player_magic_type = "Water" then wateranimation() elseif player_magic_type = "Wind" then windanimation() Elseif player_magic_type = "Lightning" then lightninganimation() endif If actionr = 4 Or actionr = 5 Then ElseIf gain = "true" then expearn() Else endif display() TextWindow.Clear() endwhile actionr = 0 EndSub Sub character If player_magic_type = "Fire" Then GraphicsWindow.BrushColor ="Red" ElseIf player_magic_type = "Water" then GraphicsWindow.BrushColor ="Blue" ElseIf player_magic_type = "Wind" then GraphicsWindow.BrushColor ="White" elseif player_magic_type="Lightning" then GraphicsWindow.BrushColor = "Yellow" endif head = Shapes.AddEllipse(20, 20) Shapes.Move(head, 100, 220) If player_magic_type = "Fire" Then GraphicsWindow.penColor ="Red" ElseIf player_magic_type = "Water" then GraphicsWindow.penColor ="Blue" ElseIf player_magic_type = "Wind" then GraphicsWindow.penColor ="White" elseif player_magic_type="Lightning" then GraphicsWindow.penColor = "Yellow" endif torso = Shapes.AddLine(110, 240, 110, 270) leg1 = Shapes.AddLine(110, 270, 100, 300) leg2 = Shapes.AddLine(110,270, 120, 300) larm = Shapes.AddLine(110, 245, 100, 270) marm = Shapes.AddLine(110, 245, 120, 270) EndSub Sub enemy enemyhealth = 500 enemy_strength = 100 enemyspeed = 50 magic = Math.GetRandomNumber(4) If magic = 1 then TextWindow.WriteLine("Enemy magic type is Fire") ElseIf magic = 2 then TextWindow.WriteLine("Enemy magic type is Water") elseif magic = 3 then TextWindow.WriteLine("Enemy magic type is Wind") elseif magic = 4 then TextWindow.WriteLine("Enemy magic type is Water") endif If magic= 1 Then GraphicsWindow.BrushColor ="Red" ElseIf magic= 2 then GraphicsWindow.BrushColor ="Blue" ElseIf magic= 3 then GraphicsWindow.BrushColor ="White" elseif magic= 4 then GraphicsWindow.BrushColor = "Yellow" endif ehead = Shapes.AddEllipse(20, 20) 'head = x= 110, y = 120 Shapes.Move(ehead, 500, 220) GraphicsWindow.PenColor = "Black" etorso = Shapes.AddLine(510, 240, 510, 270) eleg1 = Shapes.AddLine(510, 270, 500, 300) eleg2 = Shapes.AddLine(510,270, 520, 300) elarm = Shapes.AddLine(510, 245, 500, 270) emarm = Shapes.AddLine(510, 245, 520, 270) endsub Sub display j = (player_magic_energy/player_magic_energy_limit)*100 k = (player_health/player_level_health)*100 l = (player_exp/player_exp_level)*100 j = Math.Round(j) k = Math.Round(k) l = Math.Round(l) GraphicsWindow.BrushColor = "Green" Shapes.Remove(health) health = Shapes.AddText("Health = " + player_health + "/" + player_level_health) Shapes.Move(health, 360, 0) GraphicsWindow.BrushColor = "Blue" Shapes.Remove(energy) energy = Shapes.AddText("Magic = " + player_magic_energy + "/" + player_magic_energy_limit) Shapes.Move(energy, 360, 30) Shapes.Remove(expt) expt = Shapes.AddText("exp = " + player_exp + "/" + player_exp_level) Shapes.Move(expt, 360, 60) Shapes.Remove(levelt) levelt = Shapes.AddText("Level = " + player_level ) Shapes.Move(levelt, 360, 90) GraphicsWindow.PenColor = "Green" If o > k then While o > k Shapes.Remove(healthl[o]) Program.Delay(2) o = o - 1 endwhile ElseIf o < k then While o < k o = o +1 healthl[o] = Shapes.AddLine(o+500, 0, o+500, 20) Program.Delay(2) EndWhile elseif o = k then EndIf GraphicsWindow.PenColor = "Blue" If nowenergy > j then While nowenergy > j Shapes.Remove(energyl[nowenergy]) nowenergy = nowenergy - 1 Program.Delay(2) endwhile ElseIf nowenergy < j then While nowenergy <> j nowenergy =nowenergy +1 energyl[nowenergy] = Shapes.AddLine(nowenergy+500, 30, nowenergy+500, 50) Program.Delay(2) EndWhile Elseif nowenergy = j then endif If player_magic_type = "Fire" Then GraphicsWindow.penColor ="Red" ElseIf player_magic_type = "Water" then GraphicsWindow.penColor ="Blue" ElseIf player_magic_type = "Wind" then GraphicsWindow.penColor ="White" elseIf player_magic_type="Lightning" then GraphicsWindow.penColor="Yellow" endif If p > l then While p > l Shapes.Remove(expl[p]) Shapes.Remove(expl[p]) p = p - 1 endwhile ElseIf p < l then While p < l expl[p] = Shapes.AddLine(p+500,60, p+500, 70) p = p + 1 EndWhile ElseIf p = l then EndIf endsub Sub enemydisplay Shapes.Remove(enemyhealthpic) GraphicsWindow.BrushColor = "Red" enemyhealthpic = Shapes.addrectangle((enemyhealth/500)*100, 30) Shapes.Move(enemyhealthpic, 500, 90) EndSub Sub expearn player_exp = player_exp + 1 If player_exp = player_exp_level or player_exp > player_exp_level Then player_level = player_level +1 GraphicsWindow.ShowMessage("Your new level is " +player_level, "LEVEL UP") player_exp = 0 player_exp_level = player_level * 3 player_magic_energy_limit =300+ (25 * player_level) player_level_health = 100 + (25 * player_level) speed = 2 * player_level player_magic_strength = 50 * player_level endif endsub Sub expearnfromenemy player_exp = player_exp + 5 If player_exp = player_exp_level or player_exp > player_exp_level Then player_level = player_level +1 GraphicsWindow.ShowMessage("Your new level is " +player_level, "LEVEL UP") player_exp = player_exp - player_exp_level player_exp_level = player_exp_level + 5 player_magic_energy_limit =300+ (25 * player_level) player_level_health = 100 + (25 * player_level) speed = 2 * player_level player_magic_strength = 50 * player_level endif endsub Sub makesaves PATH = Program.Directory + "\Data\" NAME = "Fairytail" EXT = ".txt" LF = Text.GetCharacter(10) TextWindow.WriteLine(PATH + NAME + EXT + LF) filesave["Health"] = player_health filesave[2] = player_level_health filesave["Player exp"] = player_exp filesave[4] = player_exp_level filesave["Player enery"] = player_magic_energy filesave["Player magic strength"] = player_magic_strength filesave["Player strength"] = player_strength filesave["Magic type"] = player_magic_type filesave[9] = magic_energy_take filesave["Player level"] = player_level filesave[11] = player_magic_energy_limit filesave["Speed"] = speed filesave["Tries"] = try ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(PATH) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(PATH+NAME+EXT, filesave) filesave = "" ' The following line could be harmful and has been automatically commented. ' filesave = File.ReadContents(PATH + NAME + EXT) endsub Sub getsaves ' The following line could be harmful and has been automatically commented. ' filesave = File.ReadContents(PATH+NAME+EXT) player_health = filesave["Health"] player_level_health = filesave[2] player_exp = filesave["Player exp"] player_exp_level = filesave[4] player_magic_energy = filesave["Player enery"] player_magic_strength = filesave["Player magic strength"] player_strength = filesave["Player strength"] player_magic_type = filesave["Magic type"] magic_energy_take=filesave[9] player_level= filesave["Player level"] player_magic_energy_limit = filesave[11] speed = filesave["Speed"] try = filesave["Tries"] EndSub Sub init PATH = Program.Directory + "\Data\" NAME = "Fairytail" EXT = ".txt" LF = Text.GetCharacter(10) endsub End>RQB628.sb< Start>RQB683-1.sb< ' Rocket 0.5 (RQB683-1) ' 2012/09/09 22:31:53 Generated ' by Shapes Editor 0.5 ' ' initialize shapes Shapes_Init() ' add shapes scale = 1 Shapes_Add() ' main code added by Nonki Takahashi x = shX For y = shY To 10 Step -1 Shapes_Move() l = (y - 10) / 160 * 255 color = GraphicsWindow.GetColorFromRGB(l, l, l) GraphicsWindow.BackgroundColor = color EndFor For angle = 0 To -90 Step -1 Shapes_Rotate() EndFor For t = 0 To 360 * 3 angle = -90 + 5 * Math.Sin(t * Math.Pi / 180) Shapes_Rotate() EndFor For angle = angle To 0 Shapes_Rotate() EndFor x = shX For y = shY To 170 Shapes_Move() l = (y - 10) / 160 * 255 color = GraphicsWindow.GetColorFromRGB(l, l, l) GraphicsWindow.BackgroundColor = color EndFor ' main end Sub Shapes_Init ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 230 ' x offset shY = 170 ' y offset shape[1] = "func=tri;x=22;y=0;x1=70;y1=0;x2=0;y2=96;x3=140;y3=96;bc=#752424;pc=#000000;pw=2;" shape[2] = "func=tri;x=0;y=194;x1=21;y1=0;x2=0;y2=78;x3=42;y3=78;bc=#6E6E6E;pc=#000000;pw=2;" shape[3] = "func=tri;x=142;y=193;x1=20;y1=0;x2=0;y2=80;x3=41;y3=80;bc=#6E6E6E;pc=#000000;pw=2;" shape[4] = "func=tri;x=52;y=189;x1=41;y1=0;x2=0;y2=70;x3=82;y3=70;bc=#1F1F1F;pc=#000000;pw=2;" shape[5] = "func=rect;x=21;y=96;width=143;height=144;bc=#6E6E6E;pc=#000000;pw=2;" shape[6] = "func=tri;x=73;y=192;x1=20;y1=0;x2=0;y2=81;x3=41;y3=81;bc=#6E6E6E;pc=#000000;pw=2;" shape[7] = "func=ell;x=51;y=101;width=84;height=88;bc=#6E6E6E;pc=#000000;pw=2;" shape[8] = "func=ell;x=59;y=110;width=68;height=71;bc=#217DBB;pc=#000000;pw=2;" shape[9] = "func=ell;x=29;y=211;width=16;height=18;bc=#6E6E6E;pc=#000000;pw=2;" shape[10] = "func=ell;x=56;y=213;width=16;height=17;bc=#6E6E6E;pc=#000000;pw=2;" shape[11] = "func=ell;x=115;y=213;width=15;height=16;bc=#6E6E6E;pc=#000000;pw=2;" shape[12] = "func=ell;x=140;y=213;width=12;height=15;bc=#6E6E6E;pc=#000000;pw=2;" shape[13] = "func=ell;x=65;y=278;width=57;height=146;bc=#FF0F0F;pw=0;" shape[14] = "func=ell;x=76;y=286;width=36;height=102;bc=#FF930F;pw=0;" shape[15] = "func=ell;x=85;y=291;width=18;height=50;bc=#FFEF0F;pw=0;" EndSub Sub Shapes_Add ' param shape - array of shapes ' param scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Shapes_CalcWidthAndHeight() s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddRectangle(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] shape[i]["obj"] = Shapes.AddEllipse(width * s, height * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] x3 = shape[i]["x3"] y3 = shape[i]["y3"] shape[i]["obj"] = Shapes.AddTriangle(x1 * s, y1 * s, x2 * s, y2 * s, x3 * s, y3 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) ElseIf shape[i]["func"] = "line" Then x = shape[i]["x"] y = shape[i]["y"] x1 = shape[i]["x1"] y1 = shape[i]["y1"] x2 = shape[i]["x2"] y2 = shape[i]["y2"] shape[i]["obj"] = Shapes.AddLine(x1 * s, y1 * s, x2 * s, y2 * s) Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) EndIf EndFor shAngle = 0 EndSub Sub Shapes_CalcWidthAndHeight ' return nShapes - number of shapes ' return shWidth, shHeight - total size of shapes nShapes = Array.GetItemCount(shape) For i = 1 To nShapes If shape[i]["func"] = "tri" Or shape[i]["func"] = "line" Then xmin = shape[i]["x1"] xmax = shape[i]["x1"] ymin = shape[i]["y1"] ymax = shape[i]["y1"] If shape[i]["x2"] < xmin Then xmin = shape[i]["x2"] EndIf If xmax < shape[i]["x2"] Then xmax = shape[i]["x2"] EndIf If shape[i]["y2"] < ymin Then ymin = shape[i]["y2"] EndIf If ymax < shape[i]["y2"] Then ymax = shape[i]["y2"] EndIf If shape[i]["func"] = "tri" Then If shape[i]["x3"] < xmin Then xmin = shape[i]["x3"] EndIf If xmax < shape[i]["x3"] Then xmax = shape[i]["x3"] EndIf If shape[i]["y3"] < ymin Then ymin = shape[i]["y3"] EndIf If ymax < shape[i]["y3"] Then ymax = shape[i]["y3"] EndIf EndIf shape[i]["width"] = xmax - xmin shape[i]["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shape[i]["x"] + shape[i]["width"] shHeight = shape[i]["y"] + shape[i]["height"] Else If shWidth < shape[i]["x"] + shape[i]["width"] Then shWidth = shape[i]["x"] + shape[i]["width"] EndIf If shHeight < shape[i]["y"] + shape[i]["height"] Then shHeight = shape[i]["y"] + shape[i]["height"] EndIf EndIf EndFor EndSub Sub Shapes_CalcRotatePos ' param x, y - position of a shape ' param width, height - size of a shape ' param cx, cy - center of shapes ' param shAngle - rotate angle ' return x, y - rotated position of a shape _cx = x + width / 2 _cy = y + height / 2 x = _cx - cx y = _cy - cy Math_CartesianToPolar() a = a + shAngle x = r * Math.Cos(a * Math.Pi / 180) y = r * Math.Sin(a * Math.Pi / 180) _cx = x + cx _cy = y + cy x = _cx - width / 2 y = _cy - height / 2 EndSub Sub Shapes_Move ' param shape - array of shapes ' param scale ' param x, y - position to move ' return shX, shY - new position of shapes shX = x shY = y For i = 1 To nShapes _x = shape[i]["x"] _y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] Shapes_CalcRotatePos() Shapes.Move(shape[i]["obj"], shX + _x * s, shY + _y * s) EndFor EndSub Sub Shapes_Remove ' param shape - array of shapes For i = 1 To nShapes Shapes.Remove(shape[i]["obj"]) EndFor EndSub Sub Shapes_Rotate ' param shape - array of shapes ' param scale ' param angle s = scale shAngle = angle cx = shWidth / 2 cy = shHeight / 2 For i = 1 To nShapes x = shape[i]["x"] y = shape[i]["y"] width = shape[i]["width"] height = shape[i]["height"] Shapes_CalcRotatePos() Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shape[i]["obj"], shAngle) EndFor EndSub Sub Math_CartesianToPolar ' 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>RQB683-1.sb< Start>RQB683-3.sb< ' Rocket 0.51 (RQB683-3) ' 10/07/2013 16:10:22 Shapes generated by Shapes 1.5b ' GraphicsWindow.Title = "Rocket 0.51" ' initialize shapes SB_Workaround() Stars_Add() Shapes_Init() ' add shapes scale = 1 angle = 0 iMin = 1 iMax = 15 Shapes_Add() ' main code added by Nonki Takahashi x = shX dx = 0 dy = 5 For y = shY To 10 Step -2 Shapes_Move() Stars_Scroll() l = (y - 10) / 160 * 255 * 2 If 255 < l Then color = GraphicsWindow.GetColorFromRGB(l - 255, l - 255, 255) Else color = GraphicsWindow.GetColorFromRGB(0, 0, l) EndIf GraphicsWindow.BackgroundColor = color EndFor For angle = 0 To -90 Step -2 Shapes_Rotate() dx = -5 * Math.Sin(Math.GetRadians(angle)) dy = 5 * Math.Cos(Math.GetRadians(angle)) Stars_Scroll() EndFor dx = 5 dy = 0 For t = 0 To 360 * 3 Step 8 angle = -90 + 5 * Math.Sin(t * Math.Pi / 180) Shapes_Rotate() Stars_Scroll() EndFor For angle = angle To 0 Step 2 Shapes_Rotate() dx = -5 * Math.Sin(Math.GetRadians(angle)) dy = -5 * Math.Cos(Math.GetRadians(angle)) Stars_Scroll() EndFor x = shX dx = 0 dy = -5 For y = shY To 170 Step 2 Shapes_Move() Stars_Scroll() l = (y - 10) / 160 * 255 * 2 If 255 < l Then color = GraphicsWindow.GetColorFromRGB(l - 255, l - 255, 255) Else color = GraphicsWindow.GetColorFromRGB(0, 0, l) EndIf GraphicsWindow.BackgroundColor = color EndFor ' main end Sub Stars_Add nStars = 50 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" For i = 1 To nStars star["x" + i] = Math.GetRandomNumber(gw) star["y" + i] = Math.GetRandomNumber(gh) star["o" + i] = Shapes.AddEllipse(2, 2) Shapes.Move(star["o" + i], star["x" + i], star["y" + i]) EndFor EndSub Sub Stars_Scroll For i = 1 To nStars star["x" + i] = star["x" + i] + dx If star["x" + i] < 0 Then star["x" + i] = star["x" + i] + gw ElseIf gw <= star["x" + i] Then star["x" + i] = star["x" + i] - gw EndIf star["y" + i] = star["y" + i] + dy If star["y" + i] < 0 Then star["y" + i] = star["y" + i] + gh ElseIf gh <= star["y" + i] Then star["y" + i] = star["y" + i] - gh EndIf Shapes.Move(star["o" + i], star["x" + i], star["y" + i]) EndFor EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 230 ' x offset shY = 170 ' y offset shape = "" shape[1] = "func=tri;x=22;y=0;x1=70;y1=0;x2=0;y2=96;x3=140;y3=96;bc=#752424;pc=#000000;pw=2;" shape[2] = "func=tri;x=0;y=194;x1=21;y1=0;x2=0;y2=78;x3=42;y3=78;bc=#6E6E6E;pc=#000000;pw=2;" shape[3] = "func=tri;x=142;y=193;x1=20;y1=0;x2=0;y2=80;x3=41;y3=80;bc=#6E6E6E;pc=#000000;pw=2;" shape[4] = "func=tri;x=52;y=189;x1=41;y1=0;x2=0;y2=70;x3=82;y3=70;bc=#1F1F1F;pc=#000000;pw=2;" shape[5] = "func=rect;x=21;y=96;width=143;height=144;bc=#6E6E6E;pc=#000000;pw=2;" shape[6] = "func=tri;x=73;y=192;x1=20;y1=0;x2=0;y2=81;x3=41;y3=81;bc=#6E6E6E;pc=#000000;pw=2;" shape[7] = "func=ell;x=51;y=101;width=84;height=88;bc=#6E6E6E;pc=#000000;pw=2;" shape[8] = "func=ell;x=59;y=110;width=68;height=71;bc=#217DBB;pc=#000000;pw=2;" shape[9] = "func=ell;x=29;y=211;width=16;height=18;bc=#6E6E6E;pc=#000000;pw=2;" shape[10] = "func=ell;x=56;y=213;width=16;height=17;bc=#6E6E6E;pc=#000000;pw=2;" shape[11] = "func=ell;x=115;y=213;width=15;height=16;bc=#6E6E6E;pc=#000000;pw=2;" shape[12] = "func=ell;x=140;y=213;width=12;height=15;bc=#6E6E6E;pc=#000000;pw=2;" shape[13] = "func=ell;x=65;y=278;width=57;height=146;bc=#FF0F0F;pw=0;" shape[14] = "func=ell;x=76;y=286;width=36;height=102;bc=#FF930F;pw=0;" shape[15] = "func=ell;x=85;y=291;width=18;height=50;bc=#FFEF0F;pw=0;" 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 Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shape[i]["func"] = "tri" Then x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ElseIf shape[i]["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shape[i]["x1"] - shape[i]["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shape[i]["y1"] - shape[i]["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) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shape[i]["func"]) Then GraphicsWindow.BrushColor = shape[i]["bc"] EndIf If shape[i]["func"] = "rect" Then shape[i]["obj"] = Shapes.AddRectangle(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then shape[i]["obj"] = Shapes.AddEllipse(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "tri" Then shape[i]["obj"] = Shapes.AddTriangle(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s, shape[i]["x3"] * s, shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then shape[i]["obj"] = Shapes.AddLine(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s) ElseIf shape[i]["func"] = "text" Then If silverlight Then fs = Math.Floor(shape[i]["fs"] * 0.9) Else fs = shape[i]["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shape[i]["fn"] shape[i]["obj"] = Shapes.AddText(shape[i]["text"]) EndIf If silverlight And shape[i]["func"] = "tri" Then alpha = Math.GetRadians(shape[i]["angle"]) x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ox = shape[i]["x"] - x1 oy = shape[i]["y"] - y1 r = Math.SquareRoot(x1 * x1 + y1 * y1) x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Else Shapes.Move(shape[i]["obj"], shX + shape[i]["x"] * s, shY + shape[i]["y"] * s) EndIf If Text.IsSubText("rect|ell|tri|text", shape[i]["func"]) And shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf shape[i]["rx"] = shape[i]["x"] shape[i]["ry"] = shape[i]["y"] EndFor shAngle = 0 i = Stack.PopValue("local") EndSub Sub Shapes_CalcRotatePos ' Shapes | Calculate position for rotated 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 ' 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) 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 ' 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 If shape[i]["func"] = "tri" Or shape[i]["func"] = "line" Then xmin = shape[i]["x1"] xmax = shape[i]["x1"] ymin = shape[i]["y1"] ymax = shape[i]["y1"] If shape[i]["x2"] < xmin Then xmin = shape[i]["x2"] EndIf If xmax < shape[i]["x2"] Then xmax = shape[i]["x2"] EndIf If shape[i]["y2"] < ymin Then ymin = shape[i]["y2"] EndIf If ymax < shape[i]["y2"] Then ymax = shape[i]["y2"] EndIf If shape[i]["func"] = "tri" Then If shape[i]["x3"] < xmin Then xmin = shape[i]["x3"] EndIf If xmax < shape[i]["x3"] Then xmax = shape[i]["x3"] EndIf If shape[i]["y3"] < ymin Then ymin = shape[i]["y3"] EndIf If ymax < shape[i]["y3"] Then ymax = shape[i]["y3"] EndIf EndIf shape[i]["width"] = xmax - xmin shape[i]["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shape[i]["x"] + shape[i]["width"] shHeight = shape[i]["y"] + shape[i]["height"] Else If shWidth < shape[i]["x"] + shape[i]["width"] Then shWidth = shape[i]["x"] + shape[i]["width"] EndIf If shHeight < shape[i]["y"] + shape[i]["height"] Then shHeight = shape[i]["y"] + shape[i]["height"] EndIf EndIf EndFor EndSub Sub Shapes_Move ' Shapes | Move shapes ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - to zoom ' param x, y - position to move ' return shX, shY - new position of shapes Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax _x = shape[i]["rx"] _y = shape[i]["ry"] Shapes.Move(shape[i]["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove ' Shapes | Remove shapes ' param iMin, iMax - shapes indices to remove ' param shape - array of shapes Stack.PushValue("local", i) For i = iMin To iMax Shapes.Remove(shape[i]["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate ' Shapes | Rotate shapes ' param iMin, iMax - shapes indices to rotate ' param shape - array of shapes ' param scale - to zoom ' param angle - to rotate Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) s = scale param["angle"] = angle param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 For i = iMin To iMax param["x"] = shape[i]["x"] param["y"] = shape[i]["y"] param["width"] = shape[i]["width"] param["height"] = shape[i]["height"] Shapes_CalcRotatePos() If silverlight And Text.IsSubText("tri|line", shape[i]["func"]) Then alpha = Math.GetRadians(angle + shape[i]["angle"]) SB_RotateWorkAround() EndIf shape[i]["rx"] = x shape[i]["ry"] = y Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shape[i]["obj"], angle + shape[i]["angle"]) EndFor y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>RQB683-3.sb< Start>RQB683-4.sb< ' Rocket 0.52 (RQB683-4) ' 2013-07-10 16:10:22 Shapes generated by Shapes 1.5b ' 2014-10-12 Minor update (position and window size) ' GraphicsWindow.Title = "Rocket 0.52" ' initialize shapes SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh Stars_Add() Shapes_Init() ' add shapes scale = 1 angle = 0 iMin = 1 iMax = 15 Shapes_Add() ' main code added by Nonki Takahashi Program.Delay(1000) x = shX dx = 0 dy = 5 For y = shY To 10 Step -2 Shapes_Move() Stars_Scroll() l = (y - 10) / 160 * 255 * 2 If 255 < l Then color = GraphicsWindow.GetColorFromRGB(l - 255, l - 255, 255) Else color = GraphicsWindow.GetColorFromRGB(0, 0, l) EndIf GraphicsWindow.BackgroundColor = color EndFor For angle = 0 To -90 Step -2 Shapes_Rotate() dx = -5 * Math.Sin(Math.GetRadians(angle)) dy = 5 * Math.Cos(Math.GetRadians(angle)) Stars_Scroll() EndFor dx = 5 dy = 0 For t = 0 To 360 * 3 Step 8 angle = -90 + 5 * Math.Sin(t * Math.Pi / 180) Shapes_Rotate() Stars_Scroll() EndFor For angle = angle To 0 Step 2 Shapes_Rotate() dx = -5 * Math.Sin(Math.GetRadians(angle)) dy = -5 * Math.Cos(Math.GetRadians(angle)) Stars_Scroll() EndFor x = shX dx = 0 dy = -5 For y = shY To 154 Step 2 Shapes_Move() Stars_Scroll() l = (y - 10) / 144 * 255 * 2 If 255 < l Then color = GraphicsWindow.GetColorFromRGB(l - 255, l - 255, 255) Else color = GraphicsWindow.GetColorFromRGB(0, 0, l) EndIf GraphicsWindow.BackgroundColor = color EndFor ' main end Sub Stars_Add nStars = 50 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" For i = 1 To nStars star["x" + i] = Math.GetRandomNumber(gw) star["y" + i] = Math.GetRandomNumber(gh) star["o" + i] = Shapes.AddEllipse(2, 2) Shapes.Move(star["o" + i], star["x" + i], star["y" + i]) EndFor EndSub Sub Stars_Scroll For i = 1 To nStars star["x" + i] = star["x" + i] + dx If star["x" + i] < 0 Then star["x" + i] = star["x" + i] + gw ElseIf gw <= star["x" + i] Then star["x" + i] = star["x" + i] - gw EndIf star["y" + i] = star["y" + i] + dy If star["y" + i] < 0 Then star["y" + i] = star["y" + i] + gh ElseIf gh <= star["y" + i] Then star["y" + i] = star["y" + i] - gh EndIf Shapes.Move(star["o" + i], star["x" + i], star["y" + i]) EndFor EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 208 ' x offset shY = 154 ' y offset shape = "" shape[1] = "func=tri;x=22;y=0;x1=70;y1=0;x2=0;y2=96;x3=140;y3=96;bc=#752424;pc=#000000;pw=2;" shape[2] = "func=tri;x=0;y=194;x1=21;y1=0;x2=0;y2=79;x3=42;y3=79;bc=#6E6E6E;pc=#000000;pw=2;" shape[3] = "func=tri;x=142;y=193;x1=20;y1=0;x2=0;y2=80;x3=41;y3=80;bc=#6E6E6E;pc=#000000;pw=2;" shape[4] = "func=tri;x=52;y=189;x1=41;y1=0;x2=0;y2=70;x3=82;y3=70;bc=#1F1F1F;pc=#000000;pw=2;" shape[5] = "func=rect;x=21;y=96;width=143;height=144;bc=#6E6E6E;pc=#000000;pw=2;" shape[6] = "func=tri;x=73;y=192;x1=20;y1=0;x2=0;y2=81;x3=41;y3=81;bc=#6E6E6E;pc=#000000;pw=2;" shape[7] = "func=ell;x=51;y=101;width=84;height=88;bc=#6E6E6E;pc=#000000;pw=2;" shape[8] = "func=ell;x=59;y=110;width=68;height=71;bc=#217DBB;pc=#000000;pw=2;" shape[9] = "func=ell;x=29;y=211;width=16;height=18;bc=#6E6E6E;pc=#000000;pw=2;" shape[10] = "func=ell;x=56;y=213;width=16;height=17;bc=#6E6E6E;pc=#000000;pw=2;" shape[11] = "func=ell;x=115;y=213;width=15;height=16;bc=#6E6E6E;pc=#000000;pw=2;" shape[12] = "func=ell;x=140;y=213;width=12;height=15;bc=#6E6E6E;pc=#000000;pw=2;" shape[13] = "func=ell;x=65;y=278;width=57;height=146;bc=#FF0F0F;pw=0;" shape[14] = "func=ell;x=76;y=286;width=36;height=102;bc=#FF930F;pw=0;" shape[15] = "func=ell;x=85;y=291;width=18;height=50;bc=#FFEF0F;pw=0;" 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 Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shape[i]["func"] = "tri" Then x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ElseIf shape[i]["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shape[i]["x1"] - shape[i]["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shape[i]["y1"] - shape[i]["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) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shape[i]["func"]) Then GraphicsWindow.BrushColor = shape[i]["bc"] EndIf If shape[i]["func"] = "rect" Then shape[i]["obj"] = Shapes.AddRectangle(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then shape[i]["obj"] = Shapes.AddEllipse(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "tri" Then shape[i]["obj"] = Shapes.AddTriangle(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s, shape[i]["x3"] * s, shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then shape[i]["obj"] = Shapes.AddLine(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s) ElseIf shape[i]["func"] = "text" Then If silverlight Then fs = Math.Floor(shape[i]["fs"] * 0.9) Else fs = shape[i]["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shape[i]["fn"] shape[i]["obj"] = Shapes.AddText(shape[i]["text"]) EndIf If silverlight And shape[i]["func"] = "tri" Then alpha = Math.GetRadians(shape[i]["angle"]) x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ox = shape[i]["x"] - x1 oy = shape[i]["y"] - y1 r = Math.SquareRoot(x1 * x1 + y1 * y1) x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Else Shapes.Move(shape[i]["obj"], shX + shape[i]["x"] * s, shY + shape[i]["y"] * s) EndIf If Text.IsSubText("rect|ell|tri|text", shape[i]["func"]) And shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf shape[i]["rx"] = shape[i]["x"] shape[i]["ry"] = shape[i]["y"] EndFor shAngle = 0 i = Stack.PopValue("local") EndSub Sub Shapes_CalcRotatePos ' Shapes | Calculate position for rotated 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 ' 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) 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 ' 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 If shape[i]["func"] = "tri" Or shape[i]["func"] = "line" Then xmin = shape[i]["x1"] xmax = shape[i]["x1"] ymin = shape[i]["y1"] ymax = shape[i]["y1"] If shape[i]["x2"] < xmin Then xmin = shape[i]["x2"] EndIf If xmax < shape[i]["x2"] Then xmax = shape[i]["x2"] EndIf If shape[i]["y2"] < ymin Then ymin = shape[i]["y2"] EndIf If ymax < shape[i]["y2"] Then ymax = shape[i]["y2"] EndIf If shape[i]["func"] = "tri" Then If shape[i]["x3"] < xmin Then xmin = shape[i]["x3"] EndIf If xmax < shape[i]["x3"] Then xmax = shape[i]["x3"] EndIf If shape[i]["y3"] < ymin Then ymin = shape[i]["y3"] EndIf If ymax < shape[i]["y3"] Then ymax = shape[i]["y3"] EndIf EndIf shape[i]["width"] = xmax - xmin shape[i]["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shape[i]["x"] + shape[i]["width"] shHeight = shape[i]["y"] + shape[i]["height"] Else If shWidth < shape[i]["x"] + shape[i]["width"] Then shWidth = shape[i]["x"] + shape[i]["width"] EndIf If shHeight < shape[i]["y"] + shape[i]["height"] Then shHeight = shape[i]["y"] + shape[i]["height"] EndIf EndIf EndFor EndSub Sub Shapes_Move ' Shapes | Move shapes ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - to zoom ' param x, y - position to move ' return shX, shY - new position of shapes Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax _x = shape[i]["rx"] _y = shape[i]["ry"] Shapes.Move(shape[i]["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove ' Shapes | Remove shapes ' param iMin, iMax - shapes indices to remove ' param shape - array of shapes Stack.PushValue("local", i) For i = iMin To iMax Shapes.Remove(shape[i]["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate ' Shapes | Rotate shapes ' param iMin, iMax - shapes indices to rotate ' param shape - array of shapes ' param scale - to zoom ' param angle - to rotate Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) s = scale param["angle"] = angle param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 For i = iMin To iMax param["x"] = shape[i]["x"] param["y"] = shape[i]["y"] param["width"] = shape[i]["width"] param["height"] = shape[i]["height"] Shapes_CalcRotatePos() If silverlight And Text.IsSubText("tri|line", shape[i]["func"]) Then alpha = Math.GetRadians(angle + shape[i]["angle"]) SB_RotateWorkAround() EndIf shape[i]["rx"] = x shape[i]["ry"] = y Shapes.Move(shape[i]["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shape[i]["obj"], angle + shape[i]["angle"]) EndFor y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>RQB683-4.sb< Start>RQB683-6.sb< ' Sprite - Rocket ' Version 0.6 ' Copyright © 2019 Nonki Takahashi. The MIT License. ' 2013-07-10 16:10:22 Shapes generated by Shapes 1.5b ' Program ID RQB683-6 SB_Workaround() name = "Rocket" Init() Shapes_Init_Rocket() scale = 1 Group_Add() Sub Init GraphicsWindow.Title = "Sprite - " + name gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY - origin of shape array ' param scale - to resize ' 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["height"] = shHeight grp["cx"] = shWidth / 2 grp["cy"] = shHeight / 2 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 sbd And (shp["func"] = "line") Then shp["wx"] = x shp["wy"] = y ElseIf 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 Group_Move ' Group | move a group ' param group[i] - group To move ' param x, y - position To move ' return group[i] - updated group 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] If sbd And (shp["func"] = "line") Then _x = shp["wx"] _y = shp["wy"] ElseIf silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], grp["x"] + _x * s, grp["y"] + _y * s) EndFor group[i] = grp j = 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 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 SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param x, y - original coordinate ' param _alpha - angle [radian] ' returns x, y - workaround coordinate If shape[i]["func"] = "tri" Then x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ElseIf shape[i]["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shape[i]["x1"] - shape[i]["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shape[i]["y1"] - shape[i]["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 / SBD ' return silverlight - "True" if in remote ' return sbd - "True" if Small Basic Desktop color = GraphicsWindow.GetPixel(0, 0) sbd = "False" If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" _gw = GraphicsWindow.Width _gh = GraphicsWindow.Height If (_gw = 624) And (_gh = 441) Then sbd = "True" EndIf EndIf EndSub Sub Shapes_CalcRotatePos2 param = "" ' Shapes | Calculate position for rotated 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 ' 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) 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 ' 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_Rocket ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 208 ' x offset shY = 154 ' y offset shape = "" shape[1] = "func=tri;x=22;y=0;x1=70;y1=0;x2=0;y2=96;x3=140;y3=96;bc=#752424;pc=#000000;pw=2;" shape[2] = "func=tri;x=0;y=194;x1=21;y1=0;x2=0;y2=79;x3=42;y3=79;bc=#6E6E6E;pc=#000000;pw=2;" shape[3] = "func=tri;x=142;y=193;x1=20;y1=0;x2=0;y2=80;x3=41;y3=80;bc=#6E6E6E;pc=#000000;pw=2;" shape[4] = "func=tri;x=52;y=189;x1=41;y1=0;x2=0;y2=70;x3=82;y3=70;bc=#1F1F1F;pc=#000000;pw=2;" shape[5] = "func=rect;x=21;y=96;width=143;height=144;bc=#6E6E6E;pc=#000000;pw=2;" shape[6] = "func=tri;x=73;y=192;x1=20;y1=0;x2=0;y2=81;x3=41;y3=81;bc=#6E6E6E;pc=#000000;pw=2;" shape[7] = "func=ell;x=51;y=101;width=84;height=88;bc=#6E6E6E;pc=#000000;pw=2;" shape[8] = "func=ell;x=59;y=110;width=68;height=71;bc=#217DBB;pc=#000000;pw=2;" shape[9] = "func=ell;x=29;y=211;width=16;height=18;bc=#6E6E6E;pc=#000000;pw=2;" shape[10] = "func=ell;x=56;y=213;width=16;height=17;bc=#6E6E6E;pc=#000000;pw=2;" shape[11] = "func=ell;x=115;y=213;width=15;height=16;bc=#6E6E6E;pc=#000000;pw=2;" shape[12] = "func=ell;x=140;y=213;width=12;height=15;bc=#6E6E6E;pc=#000000;pw=2;" shape[13] = "func=ell;x=65;y=278;width=57;height=146;bc=#FF0F0F;pw=0;" shape[14] = "func=ell;x=76;y=286;width=36;height=102;bc=#FF930F;pw=0;" shape[15] = "func=ell;x=85;y=291;width=18;height=50;bc=#FFEF0F;pw=0;" EndSub End>RQB683-6.sb< Start>RQB972.sb< ' SmallBasic Version 1.2 ' Program: GradientMaker ' Changelog: ' Author: Pappa Lapub ' Website: ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev, Fremy ' Comment: ?? Remove "BrushX", brushName = "" enough (to remove from memory)?? ' LDUtilities.GetNextMapIndex("Brush") ?? _nameGenerationMap ' LDImage.Open/Close WorkingImage does not increase ImageList# ' Variables: ' ToDo: + saving W,H; ell axis a,b in % of W,H ' Load/Save Gradient presets '=============================================================================== cols0 = "1=Black;2=White;" ' init. Gradient colors, max. 7 colors ornt0 = "R" ' init. Gradient orientation: H, V, DU, DD or R saveDir = Program.Directory +"\img\Gradients" ' existing directory to save GradientImages bgCol = "LightBlue" '------------------------------------------------------------------------------- ' The following line could be harmful and has been automatically commented. ' sets = File.GetSettingsFilePath() ' to load/save presets ' The following line could be harmful and has been automatically commented. ' pre = LDFile.ReadANSIToArray(sets) nPre = Array.GetItemCount(pre) max = 7 r = 100 ' shp w=h = 2*r img = LDImage.NewImage(200,200, "Transparent") ' (2*r,2*r, picExt = "1=bmp;2=gif;3=jpg;4=png;" 'transB = "#00000000" ' transp. Black 'transB = LDColours.SetOpacity("Black", 0) bTop = "True" cPin = "Gray" 'For n = 1 To max ' arrCnt[n] = n 'EndFor arrCnt = "1=1;2=2;3=3;4=4;5=5;6=6;7=7;" arrOrnt = "1=Horizontal →;2=Vertical ↓;3=DiagonalUp ↗;4=DiagonalDown ↘;5=Radial ⟴;" ' ⦿ ⚩⧬ ⦽ ⟴, ⇴ arrOrVal = "1=H;2=V;3=DU;4=DD;5=R;" ResetValues() 'cols = cols0 'nCol = Math.Min(Array.GetItemCount(cols), max) 'For n = nCol+1 To max ' cols[n] = "Black" 'EndFor 'ornt = ornt0 'iOrnt = LDArray.GetIndex(arrOrVal, Text.ConvertToUpperCase(ornt)) nBtn = nCol BuildGUI() ' init. GetImage vermeiden (überzeichnet Grid via ResetGUI oder DrawGradient) ResetGUI() LDGraphicsWindow.ResumeUpdates() DrawGradient() Controls.ButtonClicked = OnButtonClick GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.TextInput = OnTextInput LDControls.ComboBoxItemChanged = OnComboChange LDControls.SliderChanged = OnSliderChange LDControls.ContextMenuClicked = OnContextClick ' //////////////////// SUBs //////////////////// Sub BuildGUI LDGraphicsWindow.Resize = 0 GraphicsWindow.Width = 432 GraphicsWindow.Height = 340 GraphicsWindow.Title = "GradientMaker" ' The following line could be harmful and has been automatically commented. ' LDGraphicsWindow.Icon = SBFile.Expand("%SBICONS%\SpectrumLR.ico") ' SpectrumRA.ico, SpectrumLR.ico, SpectrumRI.ico ' The following line could be harmful and has been automatically commented. ' 'LDGraphicsWindow.Icon = SBFile.Expand("%SBICONS%\GradientEditor.ico") ' SBFile.Expand("%SBICONS%\GradientMaker.ico") GraphicsWindow.BrushColor = bgCol GraphicsWindow.FontSize = 72 GraphicsWindow.DrawText(40,110, "Loading...") LDGraphicsWindow.PauseUpdates() GraphicsWindow.Clear() GraphicsWindow.FontSize = 11 GraphicsWindow.FontBold = "False" GraphicsWindow.BrushColor = "Black" GraphicsWindow.BackgroundColor = bgCol ' Grid under ImageShape (changes previous text in GW written with 'DrawText' -> smudged) ' Gitter zeichnen VOR Sliderbeschriftung (diese ist sonst verschmiert) GraphicsWindow.PenWidth = 0.18 GraphicsWindow.PenColor = "Gray" For y = 130 To 320 Step 10 For x = 220 To 410 Step 10 GraphicsWindow.DrawRectangle(x,y, 10,10) EndFor EndFor GraphicsWindow.PenColor = "Black" ' ColorButtons For n = 1 To max btn[n] = Controls.AddButton("✎"+n, 29*(n-1)+10,40) ' "Col"+n, "🎨"+n, "✎"+n, "💧"+n 'LDShapes.BrushColour(btn[n], cols[n]) If n > nCol Then Controls.HideControl(btn[n]) EndIf EndFor 'SetAllBtnColors() ' ActionButtons btnGo = Controls.AddButton("Draw Gradient ░", 10,100) LDShapes.BrushColour(btnGo, "PaleGreen") btnRnd = Controls.AddButton("Random Colors #", 10,70) Controls.SetSize(btnRnd, 95,25) btnBow = Controls.AddButton("Rainbow Cols 🌈", 116,70) Controls.SetSize(btnBow, 95,25) btnRev = Controls.AddButton("Reverse Colors ⇄", 220,70) ' ⟲ 'Controls.SetSize(btnRev, 95,25) btnShf = Controls.AddButton("Shuffle Colors ⧢", 325,70) Controls.SetSize(btnShf, 95,25) btnSave = Controls.AddButton("Save Image 💾", 116,100) Controls.SetSize(btnSave, 95,25) ' ComboBoxes cbCnt = LDControls.AddComboBox(arrCnt, 33,100) Controls.Move(cbCnt, 10,10) 'LDControls.ComboBoxSelect(cbCnt, nCol) cbOrnt = LDControls.AddComboBox(arrOrnt, 106,100) Controls.Move(cbOrnt, 51,10) 'LDControls.ComboBoxSelect(cbOrnt, iOrnt) ' Slider / TrackBar GraphicsWindow.DrawText(220,105, "Crop in•") ' verschmiert, wenn VOR Grid gezeichnet 'GraphicsWindow.DrawText(291,105, "|") GraphicsWindow.DrawText(320,105, "◘out") ' verschmiert, wenn VOR Grid gezeichnet LDControls.SliderMaximum = 2 slid = LDControls.AddSlider(100,22, "H") LDShapes.SetProperty(slid, "SmallChange",1) ' default: 0.1 'LDShapes.SetProperty(slid, "LargeChange",1) ' default 'LDShapes.SetProperty(slid, "TickFrequency",1) ' default LDShapes.SetProperty(slid, "TickPlacement","BottomRight") LDShapes.SetProperty(slid, "IsSnapToTickEnabled","True") LDDialogs.ToolTip(slid, "Inner/Outer Ellipse") Controls.Move(slid, 265,101) Controls.SetSize(slid, 55,22) 'LDControls.SliderValue(slid, 1) ' TextBoxes tbA = Controls.AddTextBox(355,101) LDShapes.SetProperty(tbA, "TextAlignment","Right") Controls.SetSize(tbA, 30,22) 'Controls.SetTextBoxText(tbA, r) LDDialogs.ToolTip(tbA, "Ellipse a→") tbB = Controls.AddTextBox(390,101) LDShapes.SetProperty(tbB, "TextAlignment","Right") Controls.SetSize(tbB, 30,22) 'Controls.SetTextBoxText(tbB, r) LDDialogs.ToolTip(tbB, "Ellipse b↑") tb = Controls.AddMultiLineTextBox(220,30) LDControls.TextBoxReadOnly(tb, "True") Controls.SetSize(tb, 200,35) LDShapes.BrushColour(tb, GraphicsWindow.BackgroundColor) LDShapes.SetProperty(tb, "TextWrapping","Wrap") LDControls.AddContextMenu(tb, "1=Load preset1;2=Save to presets;","") SetTBText() ' GradientShape, left GraphicsWindow.PenWidth = 1 shp = Shapes.AddRectangle(202,202) ' (2*r+2,2*r+2) Shapes.Move(shp, 10-1,130-1) ' penWidth = 1 ' ImageShape over Grid, right shp2 = Shapes.AddImage(img) 'LDImage.Remove(img) ' remove init transp. Image again Shapes.Move(shp2, 220,130) ' InfoShape GraphicsWindow.BrushColor = "Red" info = Shapes.AddText("") ' ("Image copied") Shapes.Move(info, 220,10) Shapes.SetOpacity(info, 0) ' Topmost Pin GraphicsWindow.BrushColor = cPin top = Shapes.AddText(Text.GetCharacter(55357)+Text.GetCharacter(56524)) Shapes.Move(top, 432-18,5) LDGraphicsWindow.TopMost = bTop LDShapes.PenColour(top, LDLogic.Switch(bTop, cPin,"Transparent")) EndSub Sub DrawGradient GetAxes() curCols = "" For n = 1 To nCol curCols[n] = cols[n] EndFor If nCol = 1 Then ' for single color, no Gradient available LDShapes.BrushColour(shp, curCols[1]) Else brush = "" brush = LDShapes.BrushGradient(curCols, ornt) LDShapes.BrushShape(shp, brush) EndIf GetImage() ShowImage() EndSub Sub GetAxes a = Math.Min(r, Math.Floor(Math.Abs(Controls.GetTextBoxText(tbA)))) b = Math.Min(r, Math.Floor(Math.Abs(Controls.GetTextBoxText(tbB)))) Controls.SetTextBoxText(tbA, a) Controls.SetTextBoxText(tbB, b) a2 = a * a b2 = b * b EndSub Sub GetImage LDImage.Remove(img) img = LDGraphicsWindow.Capture("","") LDImage.Crop(img, 10,130, 200,200) ' ,2*r,2*r) EndSub Sub ShowImage If val = 0 Then CropInnerEll() ' make transp. outside ElseIf val = 2 Then CropOuterEll() ' make transp. inside (Picture-Frame) EndIf LDShapes.SetImage(shp2, img) EndSub Sub SaveImage pic = LDDialogs.SaveFile("Bilddateien|*.png;*.bmp;*.gif;*.jpg", saveDir) ' The following line could be harmful and has been automatically commented. ' If pic <> "" And Array.ContainsValue(picExt, Text.ConvertToLowerCase(LDFile.GetExtension(pic))) Then LDImage.SaveAs(img, pic) ' GraphicsWindow.ShowMessage(pic +" saved.", "GradientMaker") Else GraphicsWindow.ShowMessage("Image NOT saved!", "GradientMaker") EndIf EndSub Sub CopyImage If LDClipboard.SetImage(img) = "SUCCESS" Then Shapes.SetText(info, "Image copied") LDShapes.AnimateOpacity(info, 5000, 0.5) EndIf EndSub Sub RandColors For n = 1 To nCol cols[n] = GraphicsWindow.GetRandomColor() LDShapes.BrushColour(btn[n], cols[n]) EndFor EndSub Sub ReverseColors arrRev = cols For n = 1 To nCol cols[n] = arrRev[nCol+1-n] LDShapes.BrushColour(btn[n], cols[n]) EndFor arrRev = "" EndSub Sub ShuffleColors For n = 1 To nCol rnd = Math.GetRandomNumber(nCol) If rnd <> n Then tmp = cols[rnd] cols[rnd] = cols[n] 'LDShapes.BrushColour(btn[rnd], cols[rnd]) cols[n] = tmp 'LDShapes.BrushColour(btn[n], cols[n]) Else n = n - 1 EndIf EndFor EndSub Sub SetBtnColors For n = 1 To nCol LDShapes.BrushColour(btn[n], cols[n]) EndFor EndSub Sub SetAllBtnColors For n = 1 To max LDShapes.BrushColour(btn[n], cols[n]) EndFor EndSub Sub SetTBText str = "" For n = 1 To nCol str = str + n +"="+ cols[n] +";" EndFor Controls.SetTextBoxText(tb, str) EndSub Sub SetBG LDGraphicsWindow.BackgroundBrush(brush) 'LDShapes.BrushShape(btnGo, brush) LDShapes.BrushColour(tb, "Transparent") EndSub Sub ResetBG GraphicsWindow.BackgroundColor = bgCol LDShapes.BrushColour(tb, bgCol) EndSub Sub Reset ' ResetValues() cols = cols0 '"1=Black;2=White;" nCol = Math.Min(Array.GetItemCount(cols), max) For n = nCol+1 To max cols[n] = "Black" EndFor ornt = ornt0 ' "R" iOrnt = LDArray.GetIndex(arrOrVal, Text.ConvertToUpperCase(ornt)) ' ResetGUI() SetAllBtnColors() ' SetBtnColors() Controls.SetTextBoxText(tbA, r) Controls.SetTextBoxText(tbB, r) LDControls.SliderValue(slid, 1) LDControls.ComboBoxSelect(cbCnt, nCol) LDControls.ComboBoxSelect(cbOrnt, iOrnt) DrawGradient() ResetBG() EndSub Sub ResetValues 'cols = cols0 ornt = ornt0 nCol = Math.Min(Array.GetItemCount(cols), max) For n = nCol+1 To max cols[n] = "Black" EndFor iOrnt = LDArray.GetIndex(arrOrVal, Text.ConvertToUpperCase(ornt)) EndSub Sub ResetGUI SetAllBtnColors() Controls.SetTextBoxText(tbA, r) Controls.SetTextBoxText(tbB, r) LDControls.SliderValue(slid, 1) LDControls.ComboBoxSelect(cbCnt, nCol) ' incl. nBtn = nCol LDControls.ComboBoxSelect(cbOrnt, iOrnt) DrawGradient() ResetBG() EndSub Sub ShowHelp tab = Text.GetCharacter(9) lf = Text.GetCharacter(10) hlp = "* Keys:"+ lf hlp = hlp +"D,G"+ tab +"Draw Gradient"+ lf hlp = hlp +"S"+ tab +"Save image"+ lf hlp = hlp +"C"+ tab +"Copy image"+ lf hlp = hlp +"B"+ tab +"Background gradient (Shift+B to reset)"+ lf hlp = hlp +"R"+ tab +"Reset"+ lf hlp = hlp +"L"+ tab +"Load preset"+ lf hlp = hlp +"P"+ tab +"save Preset"+ lf hlp = hlp +"V"+ tab +"debug View"+ lf hlp = hlp +"←/→"+ tab +"adjust Crop-Slider"+ lf hlp = hlp +"H"+ tab +"this Help"+ lf hlp = hlp +"Esc"+ tab +"Exit"+ lf+lf hlp = hlp +"* Mouse:"+ lf hlp = hlp +"R-Click"+ tab +"Toggle Topmost" GraphicsWindow.ShowMessage(hlp, "GradientMaker Help") EndSub Sub CropInnerEll LDImage.OpenWorkingImage(img) For x = 1 To r For y = 1 To r If x*x/a2 + y*y/b2 > 1 Then ' x,y is outside LDImage.SetWorkingImagePixel(img, r-x+1,r-y+1, "#00000000") ' II 100-1 LDImage.SetWorkingImagePixel(img, r+x,r+y, "#00000000") ' IV 101-200 LDImage.SetWorkingImagePixel(img, r+x,r-y+1, "#00000000") ' I LDImage.SetWorkingImagePixel(img, r-x+1,r+y, "#00000000") ' III EndIf EndFor EndFor LDImage.CloseWorkingImage(img) EndSub Sub CropOuterEll LDImage.OpenWorkingImage(img) For x = 1 To a For y = 1 To b If x*x/a2 + y*y/b2 < 1 Then ' x,y is inside LDImage.SetWorkingImagePixel(img, r-x+1,r-y+1, "#00000000") ' II 100-1 LDImage.SetWorkingImagePixel(img, r+x,r+y, "#00000000") ' IV 101-200 LDImage.SetWorkingImagePixel(img, r+x,r-y+1, "#00000000") ' I LDImage.SetWorkingImagePixel(img, r-x+1,r+y, "#00000000") ' III EndIf EndFor EndFor LDImage.CloseWorkingImage(img) EndSub ' ////////////////// EVENTs /////////////////// Sub OnButtonClick lastBtn = Controls.LastClickedButton lastId = Text.GetSubTextToEnd(lastBtn, 7) If lastBtn = btnGo Then ornt = arrOrVal[LDControls.ComboBoxGetSelected(cbOrnt)] DrawGradient() ElseIf lastBtn = btnRnd Then RandColors() SetTBText() ElseIf lastBtn = btnRev Then ReverseColors() SetTBText() ElseIf lastBtn = btnBow Then cols = "1=DarkViolet;2=Indigo;3=Blue;4=Lime;5=Yellow;6=Orange;7=Red;" ' alt: 1=Violet; LDControls.ComboBoxSelect(cbCnt, 7) SetAllBtnColors() ' SetBtnColors() SetTBText() ElseIf lastBtn = btnShf Then If nCol > 2 Then ShuffleColors() SetAllBtnColors() ' SetBtnColors() SetTBText() EndIf ElseIf lastBtn = btnSave Then SaveImage() Else ' ColorButtons with ids 1-7 c = LDDialogs.Colour() If c <> "" Then cols[lastId] = c LDShapes.BrushColour(btn[lastId], c) EndIf SetTBText() EndIf EndSub Sub OnComboChange lastCB = LDControls.LastComboBox If lastCB = cbCnt Then nCol = LDControls.LastComboBoxIndex If nCol > nBtn Then For n = nBtn+1 To nCol Controls.ShowControl(btn[n]) EndFor ElseIf nCol < nBtn Then For n = nCol+1 To nBtn Controls.HideControl(btn[n]) EndFor EndIf nBtn = nCol ElseIf lastCB = cbOrnt Then ornt = arrOrVal[LDControls.LastComboBoxIndex] ' = arrOrVal[LDControls.ComboBoxGetSelected(lastCB)] EndIf SetTBText() EndSub Sub OnSliderChange 'val = Math.Round(LDControls.SliderGetValue(slid)) 'val = Math.Round(LDControls.LastSliderValue) ' 0-1-2 'LDControls.SliderValue(slid, val) val = LDControls.LastSliderValue EndSub Sub OnKeyDown ' ' spießt sich mit OnTextInput lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "D" Or lastKey = "G" Then DrawGradient() ElseIf lastKey = "S" Then SaveImage() ElseIf lastKey = "C" Then CopyImage() ElseIf lastKey = "B" And FCKeyboard.IsShiftPressed <> "True" Then SetBG() ElseIf lastKey = "B" And FCKeyboard.IsShiftPressed Then ' "P" ResetBG() ElseIf lastKey = "R" Then ResetValues() ResetGUI() ElseIf lastKey = "L" Then LoadPreset() ElseIf lastKey = "P" Then SavePreset() ElseIf lastKey = "V" Then DbgView() 'ElseIf LDRegex.Match(lastKey, "D\d","") <> "" Then ' dig = Text.GetSubTextToEnd(lastKey, 2) ' LoadPreset() ElseIf lastKey = "H" Then ShowHelp() ElseIf lastKey = "Left" Then ' like "PgUp" val = Math.Max(val-1,0) LDControls.SliderValue(slid, val) ElseIf lastKey = "Right" Then ' like "Next" val = Math.Min(val+1,2) LDControls.SliderValue(slid, val) EndIf EndSub Sub OnContextClick 'lastCtx = LDControls.LastContextControl lastItem = LDControls.LastContextItem If lastItem = 1 Then ' Load 'line = 1 'LoadPreset() ElseIf lastItem = 2 Then ' Save 'SavePreset() EndIf EndSub Sub OnTextInput ' spießt sich mit OnKeyDown lastText = GraphicsWindow.LastText lastCode = Text.GetCharacterCode(lastText) TextWindow.WriteLine("lastText= "+ lastText) TextWindow.WriteLine("lastCode= "+ lastCode) TextWindow.WriteLine("nPre= "+ nPre) If lastText > 0 And lastText <= nPre Then ' is # 1 - nPre ? line = lastText LoadPreset() TextWindow.WriteLine("Loaded Preset #"+ line) EndIf TextWindow.WriteLine("") isDbg = "True" EndSub Sub OnMouseDown If Mouse.IsRightButtonDown Then bTop = LDLogic.Not(bTop) LDGraphicsWindow.TopMost = bTop LDShapes.PenColour(top, LDLogic.Switch(bTop, cPin,"Transparent")) EndIf EndSub ' //////////////////// SUBs2 //////////////////// Sub SavePreset ' The following line could be harmful and has been automatically commented. ' 'File.AppendContents(sets, curCols) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(sets, Controls.GetTextBoxText(tb)) Shapes.SetText(info, "Gradient colors saved") LDShapes.AnimateOpacity(info, 5000, 0.5) EndSub Sub LoadPreset 'line = 1 cols = pre[line] ornt = ornt0 'nCol = Array.GetItemCount(cols) 'SetBtnColors() 'SetTBText() 'DrawGradient() ResetValues() ResetGUI() EndSub Sub DbgView If isDbg Then 'TextWindow.Clear() TextWindow.Hide() 'isDbg = "" Else TextWindow.WriteLine("cols= "+ cols) TextWindow.WriteLine("curCols= "+ curCols) TextWindow.WriteLine("nCol= "+ nCol) TextWindow.WriteLine("nBtn= "+ nBtn) TextWindow.WriteLine("") 'isDbg = "True" EndIf isDbg = LDLogic.Not(isDbg) EndSub End>RQB972.sb< Start>RQD767.sb< ' Calendar with Flickr Pictures ' Copyright © 2018 Nonki Takahashi. The MIT License. Init() While "True" CalcMonth() DrawCalendar() WaitButton() EndWhile Sub CalcMonth If Math.Remainder(year, 4) = 0 And Math.Remainder(year, 100) > 0 Or Math.Remainder(year, 400) = 0 Then dom[2] = 29 Else dom[2] = 28 Endif nol = Math.Floor((year - 1) / 4) - Math.Floor((year - 1) / 100) + Math.Floor((year - 1) / 400) ' number of leap year woy = Math.Remainder((year + nol), 7) ' week of year doy = 0 For _m = 1 To mm - 1 doy = doy + dom[_m] EndFor w = Math.Remainder((doy + woy), 7) EndSub Sub DrawCalendar url = Flickr.GetRandomPicture(month[mm]) img = ImageList.LoadImage(url) iw = ImageList.GetWidthOfImage(img) ih = ImageList.GetHeightOfImage(img) If (iw / ih) < (gw / gh) Then width = gw height = gw / iw * ih x = 0 y = (gh - height) / 2 Else width = gh / ih * iw height = gh x = (gw - width) / 2 y = 0 EndIf GraphicsWindow.Title = month[mm] + " " + year GraphicsWindow.DrawResizedImage(img, x, y, width, height) x = 24 y = 14 dx = (gw - 20) / 7 GraphicsWindow.FontSize = 14 For _w = 0 To 6 GraphicsWindow.BrushColor = sc GraphicsWindow.DrawText(x + 2, y + 2, week[_w]) GraphicsWindow.BrushColor = fc GraphicsWindow.DrawText(x, y, week[_w]) x = x + dx EndFor y = y + 32 fs = 40 GraphicsWindow.FontSize = fs fw = fs * 0.5 For d = 1 To dom[mm] x = 24 + w * dx GraphicsWindow.BrushColor = sc GraphicsWindow.DrawText(x + 2 + fw, y + 2, d) GraphicsWindow.BrushColor = fc GraphicsWindow.DrawText(x + fw, y, d) If d = 9 Then fw = 0 EndIf w = w + 1 If 6 < w Then w = 0 y = y + fs * 1.6 EndIf EndFor EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh month = "1=January;2=February;3=March;4=April;" month = month + "5=May;6=June;7=July;8=August;9=September;" month = month + "10=October;11=November;12=December;" week = "0=Sunday;1=Monday;2=Tuesday;3=Wednesday;" week = week + "4=Thursday;5=Friday;6=Saturday;" dom = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;" sc = "#99000000" ' shadow color fc = "White" ' font color GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" Controls.AddButton("<", gw - 58, gh - 40) Controls.AddButton(">", gw - 30, gh - 40) year = Clock.Year mm = Clock.Month Controls.ButtonClicked = OnButtonClicked EndSub Sub OnButtonClicked wait = "False" EndSub Sub WaitButton wait = "True" While wait Program.Delay(200) EndWhile If Controls.GetButtonCaption(Controls.LastClickedButton) = "<" Then mm = mm - 1 If mm < 1 Then mm = 12 year = year - 1 EndIf Else mm = mm + 1 If 12 < mm Then mm = 1 year = year + 1 EndIf EndIf EndSub End>RQD767.sb< Start>RQG397.sb< GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 Wheel = Shapes.AddRectangle(40,100) Shapes.Rotate(Wheel,0) Shapes.Move(Wheel,100,200) LDPhysics.AddMovingShape(Wheel,0.8,0.8,0.8) LDPhysics.SetVelocity(Wheel,20,20) LDPhysics.SetGravity(0,0) For i = 1 To 5 Text[i] = Shapes.AddText("") Shapes.Move(Text[i],100,20*i) EndFor While 1 = 1 Program.Delay(10) LDPhysics.DoTimestep() GlobalVelocityArray = LDPhysics.GetVelocity(Wheel) GlobalVelocity = Math.SquareRoot((GlobalVelocityArray[1]*GlobalVelocityArray[1]) + (GlobalVelocityArray[2]*GlobalVelocityArray[2])) 'Get movement direction OldX = X OldY = Y X = LDShapes.GetLeft(Wheel) Y = LDShapes.GetTop(Wheel) MovementAngle = Math.Round(Zock77Math.GetAngle(X,OldX,Y,OldY)) 'Get Lateral Direction LateralAngle = LDPhysics.GetAngle(Wheel) + 90 If LateralAngle >= 360 Then LateralAngle = LateralAngle - 360 EndIf 'Get angle difference Difference = Math.Remainder(Math.abs(LateralAngle - MovementAngle),360) if(Difference > 180) Then Difference = 360 - Difference EndIf 'Get the Lateral Velocity LateralVelocity = Math.Sin(Math.GetRadians(Difference+90)) * GlobalVelocity 'Get the X and Y impulses YImpulse = Math.Cos(Math.GetRadians(LateralAngle)) * (LateralVelocity * LDPhysics.GetMass(Wheel)) XImpulse = Math.Sin(Math.GetRadians(LateralAngle)) * (LateralVelocity * LDPhysics.GetMass(Wheel)) 'Aplly the impulses LDPhysics.SetImpulse(Wheel,-XImpulse,YImpulse) Shapes.SetText(Text[1],"GlobalVelocity: " + GlobalVelocity) Shapes.SetText(Text[2],"MovementAngle: " + MovementAngle) Shapes.SetText(Text[3],"XImpulse: " + -XImpulse) Shapes.SetText(Text[4],"YImpulse: " + -YImpulse) Shapes.SetText(Text[5],"LateralVelocity: " + LateralVelocity) If LDUtilities.KeyDown("Right") Then LDPhysics.SetRotation(Wheel,10) EndIf If LDUtilities.KeyDown("Left") Then LDPhysics.SetRotation(Wheel,-10) EndIf EndWhile End>RQG397.sb< Start>RQG434.sb< 'Written by Thaelmann-Pioniere GraphicsWindow.Title="Molecular Challenge-Formaldehyde(HCHO)" GraphicsWindow.BackgroundColor="#dabc72" GraphicsWindow.BrushColor="black" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize=32 GraphicsWindow.DrawText(500,100,"HCHO") GraphicsWindow.BrushColor="black" Turtle.Speed=10 rofC=30 'The "r" means "radius". The "r" in "rofH" & "rofO" means the same. The "C" means "Carbon". dofC=rofC*2' The "d" means "diameter" rofH=10' The "H" means "hydrogen" dofH=rofH*2 rofO=40' The "O" means "oxygen". dofO=rofO*2 GraphicsWindow.FillEllipse(320-rofC,240-rofC,dofC,dofC)' the carbon atom GraphicsWindow.PenWidth=6 direction=120 For i = 1 To 2 GraphicsWindow.PenColor="black" Turtle.PenUp() Turtle.MoveTo(320,240) Turtle.Angle=direction Turtle.PenDown() Turtle.Move(rofC+50) GraphicsWindow.PenColor="white" Turtle.Move(50) xofH[i]=Turtle.X-rofH yofH[i]=Turtle.Y-rofH direction=direction+120' EndFor' The carbon-hydrogen bonds GraphicsWindow.BrushColor="white" For i = 1 To 2 GraphicsWindow.FillEllipse(xofH[i],yofH[i],dofH,dofH) EndFor' the hydrogen atoms Turtle.PenUp() Turtle.MoveTo(305,240) GraphicsWindow.PenColor="black" Turtle.PenDown() Turtle.Angle=0 Turtle.Move(rofC+50) GraphicsWindow.PenColor="red" Turtle.Move(50) Turtle.PenUp() Turtle.MoveTo(335,240) GraphicsWindow.PenColor="black" Turtle.PenDown() Turtle.Angle=0 Turtle.Move(rofC+50) GraphicsWindow.PenColor="red" Turtle.Move(50)' the carbon-hydrogen bond GraphicsWindow.BrushColor="red" GraphicsWindow.FillEllipse(320-rofO,240-130-rofO,dofO,dofO)' the oxygen atom Turtle.Hide() End>RQG434.sb< Start>RQG965.sb< GraphicsWindow.Width = 350 GraphicsWindow.Height = 400 GraphicsWindow.Title = "Tetris V1.0 Web App" GraphicsWindow.CanResize = "false" Shape = 0 SX = 0 Sy = 0 Difficulty = 1 Screen = "Title" Score = 0 Lines = 0 Level = 1 Shape = Math.GetRandomNumber(7) StartScrn() Sub StartScrn GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.FontBold = "false" GraphicsWindow.FontItalic = "true" GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawBoundText(GraphicsWindow.Width/2-20, GraphicsWindow.Height/2-20,100,"Start") GraphicsWindow.MouseDown = Clicked EndSub Sub Clicked If(Screen = "Title")Then Screen = "Game" Play() EndIf EndSub Sub Play GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "lightblue" GraphicsWindow.PenColor = "Gray" For i = 1 To 210/20 For j = 1 To 340/20 GraphicsWindow.DrawRectangle(i*20,j*20,20,20) EndFor EndFor GraphicsWindow.PenColor = "black" GraphicsWindow.DrawRectangle(20,20,200,340) Piece() EndSub Sub Piece If(Shape = 1)Then TLS = Shapes.AddRectangle(20,20) Shapes.Move(TLS, 100,20) TRS = Shapes.AddRectangle(20,20) Shapes.Move(TRS, 120,20) BLS = Shapes.AddRectangle(20,20) Shapes.Move(BLS, 100,40) BRS = Shapes.AddRectangle(20,20) Shapes.Move(BRS,120,40) SQ1 = "TLS" SQ2 = "TRS" SQ3 = "BLS" SQ4 = "BRS" ElseIf Shape = 2 Then T1L = Shapes.AddRectangle(20,20) Shapes.Move(T1L, 100,20) T2L = Shapes.AddRectangle(20,20) Shapes.Move(T2L,100,40) B1L = Shapes.AddRectangle(20,20) Shapes.Move(B1L,100,60) B2L = Shapes.AddRectangle(20,20) Shapes.Move(B2L, 100,80) SQ1 = "T1L" SQ2 = "T2L" SQ3 = "B1L" SQ4 = "B2L" Elseif Shape = 3 Then TL = Shapes.AddRectangle(20,20) Shapes.Move(TL, 80,20) TM = Shapes.AddRectangle(20,20) Shapes.Move(TM,100,20) TR = Shapes.AddRectangle(20,20) Shapes.Move(TR,120,20) TB = Shapes.AddRectangle(20,20) Shapes.Move(TB, 100,40) SQ1 = "TL" SQ2 = "TM" SQ3 = "TR" SQ4 = "TB" Elseif Shape = 4 Then JT = Shapes.AddRectangle(20,20) Shapes.Move(JT, 100,20) JM = Shapes.AddRectangle(20,20) Shapes.Move(JT,100,40) JB = Shapes.AddRectangle(20,20) Shapes.Move(JB,100,60) JL = Shapes.AddRectangle(20,20) Shapes.Move(JL, 80,60) SQ1 = "JT" SQ2 = "JM" SQ3 = "JB" SQ4 = "JL" Elseif Shape = 5 Then LST = Shapes.AddRectangle(20,20) Shapes.Move(LST, 100,20) LSM = Shapes.AddRectangle(20,20) Shapes.Move(LSM,100,40) LSB = Shapes.AddRectangle(20,20) Shapes.Move(LSB,100,60) LSR = Shapes.AddRectangle(20,20) Shapes.Move(LSR, 120,60) SQ1 = "LST" SQ2 = "LSM" SQ3 = "LSB" SQ4 = "LSR" Elseif Shape = 6 Then SR = Shapes.AddRectangle(20,20) Shapes.Move(SR, 120,20) ST = Shapes.AddRectangle(20,20) Shapes.Move(ST,100,20) SB = Shapes.AddRectangle(20,20) Shapes.Move(SB, 100,40) SL = Shapes.AddRectangle(20,20) Shapes.Move(SL, 80,40) SQ1 = "SR" SQ2 = "ST" SQ3 = "SB" SQ4 = "SL" Elseif Shape = 7 Then ZR = Shapes.AddRectangle(20,20) Shapes.Move(ZR, 120,40) ZT = Shapes.AddRectangle(20,20) Shapes.Move(ZT,100,20) ZB = Shapes.AddRectangle(20,20) Shapes.Move(ZB, 100,40) ZL = Shapes.AddRectangle(20,20) Shapes.Move(ZL, 80,20) SQ1 = "ZR" SQ2 = "ZT" SQ3 = "ZB" SQ4 = "ZL" EndIf Timer.Interval = 10 Timer.Tick = Update EndSub Sub Update Shapes.Move(SQ1,Shapes.GetLeft(SQ1),Shapes.GetTop(SQ1)+20) Shapes.Move(SQ2,Shapes.GetLeft(SQ2),Shapes.GetTop(SQ2)+20) Shapes.Move(SQ3,Shapes.GetLeft(SQ3),Shapes.GetTop(SQ3)+20) Shapes.Move(SQ4,Shapes.GetLeft(SQ4),Shapes.GetTop(SQ4)+20) EndSub End>RQG965.sb< Start>RQH226.sb< GraphicsWindow.Title="7 pendulums GraphicsWindow.BackgroundColor=GraphicsWindow.GetColorFromRGB(0,150,0) dw=800 dh=800 GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 tau=math.pi*2 For n=1 To 7 pend[n]=shapes.AddRectangle (20 350) Shapes.Move(pend[n],300,200) endfor While 1=1 For t=0 To tau*10 Step tau/450 For n=1 to 7 ldShapes.RotateAbout (pend[n],310 210 math.sin(t*n/10)*50) EndFor Program.Delay (1) EndFor EndWhile End>RQH226.sb< Start>RQH525.sb< fontsize = GraphicsWindow.FontSize begin() Sub begin 'highscore = 122 GraphicsWindow.Hide() GraphicsWindow.CanResize = "False" GraphicsWindow.Show() GraphicsWindow.Width = 840 GraphicsWindow.Height = 360 GraphicsWindow.Title = "Jump" GraphicsWindow.BackgroundColor = "Blue" GraphicsWindow.BrushColor = "Orange" GraphicsWindow.FillRectangle(0,300,860,60) GraphicsWindow.BrushColor = "red" GraphicsWindow.KeyDown = KeyDown GraphicsWindow.KeyUp = KeyUp Timer.Interval = 10 Timer.Tick = Tick character = Shapes.AddEllipse(50,50) GraphicsWindow.FontSize = fontsize Shapes.Move(character, 0, GraphicsWindow.Height - 110) addshadows() GraphicsWindow.BrushColor = "Black" blocks_passed = Shapes.AddText("Blocks Passed: 0") money_txt = Shapes.AddText("Money: $10.00") Shapes.Move(money_txt, 120, 0) explosives_txt = Shapes.AddText("Explosives: 0") Shapes.Move(explosives_txt, 220, 0) Controls.ButtonClicked = ButtonClicked shop_btn = Controls.AddButton("Shop", GraphicsWindow.Width - 47, 5) getnewblock() x = 35 y = 250 space = 0 left = 0 speedrate = 1 moneyamount = 0.50 paused = "False" health = 100 isusedexplosives = "False" money = 10 istimefornewblock = "False" newblockcount = 0 EndSub Sub KeyDown key = GraphicsWindow.LastKey If key = "Space" Or key = "Up" Or key = "W" Then continue = "True" space = 1 EndIf If key = "Right" Or key = "D" Then right = 1 EndIf If key = "Left" Or key = "A" Then left2 = 1 EndIf If key = "Down" Or key = "S" Then shrink() EndIf If key = "F1" And explosivescount > 0 Then useexplosives() EndIf If key = "Escape" Then space = 0 isindown = "False" isinmidjump = "False" Shapes.Move(character, left, GraphicsWindow.Height - 110) charposY = GraphicsWindow.Height - 110 EndIf EndSub Sub KeyUp key2 = GraphicsWindow.LastKey If key2 = "Left" Or key2 = "A" Then left2 = 0 EndIf If key2 = "Right" Or key2 = "D" Then right = 0 EndIf If key2 = "Down" Or key2 = "S" Then unshrink() EndIf space = 0 EndSub blockpos = GraphicsWindow.Width + 75 blockpos2 = GraphicsWindow.Width + 75 charposY = Shapes.GetTop(character) isindown = "False" While "True" If paused = "False" Then If space = 1 then isinmidjump = "True" space = 0 EndIf If left2 = 1 Then moveleft() EndIf If right = 1 Then moveright() EndIf If isindown Then movecharacterdown() EndIf If isinmidjump Then begincounting = "True" movecharacter() EndIf moverectangle() blockpos = blockpos - speedrate blockpos2 = blockpos2 - speedrate If blockpos < -75 Then blocktype = blocktype + 1 If blocktype = 4 Then blocktype = 1 EndIf blockpos = GraphicsWindow.Width + 75 Shapes.Remove(block) getnewblock() Shapes.Move(block, blockpos, blockypos) passed = passed + 1 money = money + moneyamount Shapes.SetText(blocks_passed, "Blocks Passed: " + passed) Shapes.SetText(money_txt, "Money: $" + money) EndIf getifhitblock() Program.Delay(5) EndIf EndWhile Sub moverectangle Shapes.Move(block, blockpos, blockypos) EndSub Sub movecharacter If continue Then space = 0 getisatend() count = count + 1 If isatend = "False" Then charposY = charposY - 3 Else charposY = charposY - 3 EndIf If isshrunk Then charposY2 = charposY + 20 Else charposY2 = charposY EndIf Shapes.Move(character, left, charposY2) If charposY < 2 Then count = 0 isinmidjump = "False" isindown = "True" EndIf If count > 249 Then count = 0 continue = "False" count = 0 space = 0 KeyUp() isatend = "False" isinmidjump = "False" isindown = "True" 'unstick() EndIf 'Else ' isindown = "True" ' movecharacterdown() EndIf EndSub Sub movecharacterdown isinmidjump = "False" space = 0 getisatend() count = count + 1 If isatend = "False" Then charposY = charposY + 3 Else charposY = charposY + 2.5 EndIf If isshrunk Then charposY2 = charposY + 20 Else charposY2 = charposY EndIf Shapes.Move(character, left, charposY2) If charposY > GraphicsWindow.Height - 112 Then isindown = "False" EndIf If count > 179 Then count = 0 space = 0 KeyUp() Shapes.Move(character, left, GraphicsWindow.Height - 110) isatend = "False" isindown = "False" isinmidjump = "False" begincounting = "False" charposY2 = GraphicsWindow.Height - 110 charposY = GraphicsWindow.Height - 110 EndIf EndSub Sub getisatend If Shapes.GetTop(character) < GraphicsWindow.Height - 210 Then isatend = "True" Else isatend = "False" EndIf EndSub Sub moveright If left < GraphicsWindow.Width - 50 Then left = left + 5 EndIf If isshrunk Then charposY2 = charposY + 20 Else charposY2 = charposY EndIf Shapes.Move(character, left, charposY2) EndSub Sub moveleft If left > 0 Then left = left - 5 EndIf If isshrunk Then charposY2 = charposY + 20 Else charposY2 = charposY EndIf Shapes.Move(character, left, charposY2) EndSub Sub shrink isshrunk = "True" Shapes.Remove(character) GraphicsWindow.BrushColor = "Red" character = Shapes.AddEllipse(50, 30) Shapes.Move(character, left, charposY + 20) shrinkshadows() EndSub Sub unshrink isshrunk = "False" GraphicsWindow.BrushColor = "Red" Shapes.Remove(character) character = Shapes.AddEllipse(50, 50) Shapes.Move(character, left, charposY) unshrinkshadows() EndSub Sub getifhitblock getleft = Shapes.GetLeft(character) getright = getleft + 50 gettop = Shapes.GetTop(character) getbottom = gettop + 50 l = Shapes.GetLeft(block) r = l + randomW t = Shapes.GetTop(block) b = t + randomY If (getright > l) And (getleft < r) And (getbottom > t) And (gettop < b) And isusedexplosives = "False" Then health = health - 10 If health = 0 Then health = 100 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 50 GraphicsWindow.DrawText(100, 100, "YOU LOST!") Program.Delay(1000) restart() EndIf EndIf EndSub Sub getnewblock GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() randomW = 0 randomY = 0 While randomW < 10 randomW = Math.GetRandomNumber(250) EndWhile While randomy < 50 randomY = Math.GetRandomNumber(200) EndWhile randomy2 = Math.GetRandomNumber(GraphicsWindow.Height - (randomY+120)) randomy2 = randomy2 + 150 blockypos = randomy2 block = Shapes.AddRectangle(randomW, randomY) Shapes.Move(block, GraphicsWindow.Width + randomW, randomy2) EndSub Sub restart Shapes.Remove(block) Shapes.Remove(character) GraphicsWindow.Clear() Shapes.Remove(shop_btn) left2 = 0 right = 0 space = 0 passed = 0 money = 0 blockpos2 = GraphicsWindow.Width explosivescount = 0 isusedexplosives = "False" blockpos = GraphicsWindow.Width Shapes.SetText(blocks_passed, "Blocks Passed: 0") begin() EndSub Sub ButtonClicked buton = Controls.LastClickedButton If buton = shop_btn Then openshop() ElseIf buton = exit_btn Then closeshop() ElseIf buton = buy_explosives Then buyexplosives() EndIf EndSub Sub openshop paused = "True" Shapes.Remove(shop_btn) GraphicsWindow.BrushColor = "Black" exit_btn = Controls.AddButton("Exit", GraphicsWindow.Width - 47, 5) additems() EndSub Sub closeshop Shapes.Remove(exit_btn) GraphicsWindow.BrushColor = "Black" shop_btn = Controls.AddButton("Shop", GraphicsWindow.Width - 47, 5) paused = "False" Shapes.Remove(buy_explosives) EndSub Sub additems buy_explosives = Controls.AddButton("Explosives: Removes the block in front of you. Stay away from the block or you'll be hurt. Good for 3 uses on any block. (key:F1). Cost: $5", 0, 100) EndSub Sub buyexplosives If money > 4.5 Then explosivescount = explosivescount + 3 money = money - 5 Shapes.SetText(money_txt, "Money: $" + money) Shapes.SetText(explosives_txt, "Explosives: " + explosivescount) EndIf EndSub Sub useexplosives explosivescount = explosivescount - 1 Shapes.Remove(block) Shapes.SetText(explosives_txt, "Explosives: " + explosivescount) isusedexplosives="True" EndSub Sub addshadows For i = 1 To 5 a_shadow[i] = Shapes.AddEllipse(50, 50) Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character)) EndFor i = 0 EndSub Sub moveshadows i = i + 1 If i = 6 Then i = 1 EndIf Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character)) EndSub Sub Tick moveshadows() EndSub Sub unstick 'For i = Shapes.GetTop(character) To GraphicsWindow.Height - 110 ' Shapes.Move(character, left, i) ' charposY = 0 ' charposY2 = 0 ' Program.Delay(2) ' moveshadows() 'EndFor EndSub Sub shrinkshadows ' For i = 1 To 5 ' Shapes.Remove(a_shadow[i]) ' EndFor ' GraphicsWindow.BrushColor = "Red" ' For i = 1 To 5 ' a_shadow[i] = Shapes.AddEllipse(50, 30) ' Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character)) ' EndFor EndSub Sub unshrinkshadows ' For i = 1 To 5 ' Shapes.Remove(a_shadow[i]) ' EndFor ' GraphicsWindow.BrushColor = "Red" ' For i = 1 To 5 ' a_shadow[i] = Shapes.AddEllipse(50, 50) ' Shapes.Move(a_shadow[i], Shapes.GetLeft(character), Shapes.GetTop(character)) ' EndFor EndSub Sub loadgame ' The following line could be harmful and has been automatically commented. ' 'arrays = File.ReadContents(Program.Directory + "\game!.txt") 'health = arrays[1] 'money = arrays[2] 'Shapes.Move(character, arrays[3], arrays[4]) EndSub End>RQH525.sb< Start>RQM411.sb< 'Problem Analysis Model version 2 ' Copyright (C) 2010, Robert W. Jones ' ' Game area controls ModelWidth = 1200 ModelHeight = 480 background = "blue" 'GraphicsWindow.PenColor = "Gold" 'BrushColor = "White" ' Window title ModelTitle = "Problem Analysis Model Version 2" ' Main Program Init() 'DrawTerminal() Play() 'GraphicsWindow.ShowMessage(ImageName1, "ImageList Loaded") '====================================== ' Program Setup Sub Init GraphicsWindow.Hide() GraphicsWindow.Title = ModelTitle GraphicsWindow.CanResize = "false" GraphicsWindow.Width = ModelWidth GraphicsWindow.Height = ModelHeight GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Blue" GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(20,370,"One Moment Please, Loading Model") 'GraphicsWindow.DrawImage(background, 0, 0) ImageName1 = ImageList.LoadImage("http://24.207.27.16/BCFerriesNew/web.site/logs/Graphics001.jpg") ImageName1Height = ImageList.GetHeightOfImage(ImageName1) ImageName1Width = ImageList.GetWidthOfImage(ImageName1) GraphicsWindow.DrawImage(ImageName1,0,0) GraphicsWindow.FontSize = 14 GraphicsWindow.PenColor = "Gold" GraphicsWindow.BrushColor = "Gold" GraphicsWindow.PenWidth = 10 GraphicsWindow.DrawRectangle(0,0,ImageName1Width,480) GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(20, 400, "Height = " + ImageName1Height + " Width = " + ImageName1Width) EndSub Sub Berth1RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp1 = Shapes.AddLine(395,140,495,140) EndSub Sub Berth1Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor ="Lime" Loading1 = Shapes.AddLine(395,140,530,140) EndSub Sub Berth2RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp2 = Shapes.AddLine(435,200,530,200) endsub Sub Berth2Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Lime" Loading2 = Shapes.AddLine(435,200,575,200) endsub Sub DrawRoad1 GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Road1 = Shapes.AddLine(490,135,530,200) endsub Sub Berth3RampDown GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Ramp3 = Shapes.AddLine(475,260,570,260) endsub Sub Berth3Loading GraphicsWindow.PenWidth = 10 'GraphicsWindow.BrushColor = "Lime" GraphicsWindow.PenColor ="Lime" Loading3 = Shapes.AddLine(475,260,615,260) endsub Sub DrawRoad2 GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Road2 = Shapes.AddLine(530,200,570,260) Endsub Sub DrawRoad3 GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Road3 = Shapes.AddLine(570,260, 600,295) Endsub Sub DrawRoad4 GraphicsWindow.PenWidth = 20 GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor ="Green" Road4 = Shapes.AddLine(595,290, ModelWidth,290) Endsub ' Main routine Sub Play GraphicsWindow.PenColor = "white" GraphicsWindow.BrushColor = "white" Vessel1 = Shapes.AddEllipse(200,40) Vessel2 = Shapes.AddEllipse(200,40) Vessel3 = Shapes.AddEllipse(200,40) Shapes.Move(Vessel1, 200,120) Shapes.Move(Vessel2, 240, 180) Shapes.Move(Vessel3, 280, 240) GraphicsWindow.Show() 'Berth1RampDown() 'Berth2RampDown() 'Berth3RampDown() 'DrawRoad1() 'DrawRoad2() 'DrawRoad3() 'DrawRoad4() 'Berth1Loading() 'Berth2Loading() 'Berth3Loading() Vessel1Departure() EndSub Sub Vessel1Departure Sound.PlayChimes() Shapes.Animate(Vessel1, 50, 120, 4000) Program.Delay(4000) Shapes.Rotate(Vessel1, -5) Shapes.Animate(Vessel1,45, 125, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -10) Shapes.Animate(Vessel1,40, 130, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -15) Shapes.Animate(Vessel1,35, 135, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -20) Shapes.Animate(Vessel1,30, 140, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -25) Shapes.Animate(Vessel1,25, 145, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -30) Shapes.Animate(Vessel1,20, 150, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -35) Shapes.Animate(Vessel1,15, 155, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -40) Shapes.Animate(Vessel1,10, 160, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -45) Shapes.Animate(Vessel1,5, 170, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -50) Shapes.Animate(Vessel1,0, 175, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -60) Shapes.Animate(Vessel1,-5, 180, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1, -70) Shapes.Animate(Vessel1,-10, 190, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-80) Shapes.Animate(Vessel1,-15, 200, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-90) Shapes.Animate(Vessel1,-15, 220, 1000) Program.Delay(1000) Shapes.Rotate(Vessel1,-90) Shapes.Animate(Vessel1,-15, 250, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 290, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 340, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 400, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 470, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 540, 1000) Program.Delay(1000) Shapes.Animate(Vessel1,-15, 620, 1000) Program.Delay(1000) EndSub End>RQM411.sb< Start>RQM589.sb< ' Sudoku ' Version 0.1 ' Copyright © 2019 Nonki Takahashi. The MIT License. GraphicsWindow.Title = "Sudoku" Init() While "True" If buttonClicked Then If (Controls.GetButtonCaption(btn) = "Solve") And (puzzle = "") Then Solve() ElseIf (Controls.GetButtonCaption(btn) = "New") Then New() EndIf buttonClicked = "False" EndIf If keyUp Then key = GraphicsWindow.LastKey If (key = "Left") And (1 < col) Then col = col - 1 Select() ElseIf (key = "Right") And (col < 9) Then col = col + 1 Select() ElseIf (key = "Up") And (1 < row) Then row = row - 1 Select() ElseIf (key = "Down") And (row < 9) Then row = row + 1 Select() ElseIf (key = "Delete") Or (key = "Back") Then Shapes.SetText(num[row][col], "") sudoku[row][col] = "" Else n = Text.GetSubText(key, Text.GetLength(key), 1) If (1 <= n) And (n <= 9) And (puzzle[row][col] = "") Then Shapes.SetText(num[row][col], n) sudoku[row][col] = n EndIf EndIf keyUp = "False" EndIf If mouseDown Then mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY mc = Math.Floor((mx - x0) / size) + 1 mr = Math.Floor((my - y0) / size) + 1 If (1 <= mc) And (mc <= 9) And (1 <= mr) And (mr <= 9) Then col = mc row = mr Select() EndIf mouseDown = "False" EndIf Program.Delay(100) EndWhile Sub Init gw = 400 gh = 400 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "SkyBlue" size = 30 size9 = size * 9 x0 = (gw - size9) / 2 x1 = x0 + size9 y0 = (gh - size9) / 2 - size / 2 y1 = y0 + size9 GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(x0, y0, size9, size9) pc = "Gray" pw = 1 delta = size Grid() pc = "Black" pw = 4 delta = size * 3 Grid() GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.FontSize = size * 0.8 GraphicsWindow.BrushColor = "Black" Numbers() btn = Controls.AddButton("Solve", 10, gh - (size * 1.3 + 10)) GraphicsWindow.PenColor = "#99FF0000" GraphicsWindow.BrushColor = "Transparent" cell = Shapes.AddRectangle(size, size) col = 1 row = 1 Select() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.KeyUp = OnKeyUp Controls.ButtonClicked = OnButtonClicked EndSub Sub Grid GraphicsWindow.PenColor = pc GraphicsWindow.PenWidth = pw For x = x0 To x1 Step delta GraphicsWindow.DrawLine(x, y0 - pw / 2, x, y0 + size9 + pw / 2) EndFor For y = y0 To y1 Step delta GraphicsWindow.DrawLine(x0 - pw / 2, y, x0 + size9 + pw / 2, y) EndFor EndSub Sub New Stack.PushValue("local", row) Stack.PushValue("local", col) puzzle = "" sudoku = "" For row = 1 To 9 For col = 1 To 9 Shapes.Remove(num[row][col]) EndFor EndFor GraphicsWindow.BrushColor = "Black" Numbers() Controls.SetButtonCaption(btn, "Solve") col = Stack.PopValue("local") row = Stack.PopValue("local") EndSub Sub Numbers For row = 1 To 9 For col = 1 To 9 num[row][col] = Shapes.AddText("") x = x0 + (col - 1) * size + size * 0.25 y = y0 + (row - 1) * size Shapes.Move(num[row][col], x, y) EndFor EndFor EndSub Sub OnButtonClicked buttonClicked = "True" EndSub Sub OnKeyUp keyUp = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub Sub Select ' param row, col - position to move cell x = x0 + (col - 1) * size y = y0 + (row - 1) * size Shapes.Move(cell, x, y) EndSub Sub Solve GraphicsWindow.BrushColor = "Blue" Stack.PushValue("local", row) Stack.PushValue("local", col) For row = 1 To 9 For col = 1 To 9 n = sudoku[row][col] If n = "" Then Shapes.Remove(num[row][col]) num[row][col] = Shapes.AddText("") x = x0 + (col - 1) * size + size * 0.25 y = y0 + (row - 1) * size Shapes.Move(num[row][col], x, y) Else puzzle[row][col] = n sudoku[row][col] = "" EndIf EndFor EndFor col = Stack.PopValue("local") row = Stack.PopValue("local") Controls.SetButtonCaption(btn, "New") EndSub End>RQM589.sb< Start>RQM981.sb< GraphicsWindow.Title = "How expensive will your trip be?" GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 2 GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width) / 2 colour = GraphicsWindow.GetRandomColor() colour2 = GraphicsWindow.GetRandomColor() GraphicsWindow.BackgroundColor = colour GraphicsWindow.BrushColor = colour2 GraphicsWindow.DrawText(0, 24, "Enter your total journey's distance in kilometers:") Distance1 = Controls.AddTextBox(295, 20) GraphicsWindow.DrawText(82, 46, "Enter your fuel consumption (KPL):") Consumption1 = Controls.AddTextBox(295, 42) GraphicsWindow.DrawText(103, 68, "Enter the price per liter for fuel:") Price1 = Controls.AddTextBox(295, 64) Controls.AddButton("Calculate", 190, 150) Controls.ButtonClicked = Button Sub Button GraphicsWindow.DrawText(0, 90, "It will cost you $") Distance = Controls.GetTextBoxText(Distance1) Consumption = Controls.GetTextBoxText(Consumption1) Price = Controls.GetTextBoxText(Price1) Total = Distance*Consumption*Price/100 GraphicsWindow.DrawText(100, 90, Total) EndSub End>RQM981.sb< Start>RQP189.sb< size=400 GraphicsWindow.Width=SIZE*2 GraphicsWindow.Height=SIZE*2 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="white 'ee=Shapes.AddEllipse(9 9) LDEvents.MouseWheel=www zz=1 nn="false not="true=false;false=true tt=100 m1[SIZE][SIZE]=2 mm=LDFastArray.CreateFromValues(m1) For x=1 To SIZE For y=1 To SIZE LDFastArray.Set2D(mm x y 0) EndFor EndFor Wh: For t=1 To tt wh1: X = math.getrandomnumber(SIZE)-1 Y = math.getrandomnumber(SIZE)-1 If LDFastArray.Get2D(mm x y)<>1 Then If not[nn] Then LDFastArray.Set2D(mm x y 1) ee=Shapes.AddEllipse(1 1) LDShapes.Centre(ee x y) EndIf nn="false Else Goto wh1 EndIf EndFor tt=1 gg: 'GraphicsWindow.Title=x+" : "+y 'LDShapes.Centre(ee x y) oldX = X oldY = Y X =x+ math.getrandomnumber(3) - 2 Y =y+ math.getrandomnumber(3) - 2 If LDFastArray.Get2D(mm x y)=1 Then ee=Shapes.AddEllipse(1 1) LDShapes.Centre(ee oldx oldy) LDFastArray.Set2D(mm oldx oldy 1) ii=ii+1 nn="true GraphicsWindow.Title=ii Goto wh Else If X>=0 and X=0 and Y (50*i-25)) And (GraphicsWindow.MouseX < (50*i+25)) Then If (GraphicsWindow.MouseY >= 50) And (GraphicsWindow.MouseY <= 305) Then Shapes.Move(sliderShape[i], 50*i-25, GraphicsWindow.MouseY-5) sliderValue[i] = 305-GraphicsWindow.MouseY Shapes.SetText(sliderText[i],sliderValue[i]) GraphicsWindow.FontSize = "66" GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(sliderValue[R],sliderValue[G],sliderValue[B]) GraphicsWindow.drawtext(200,30,"HAPPY/NEW/YEAR-2018!") Controls.SetTextBoxText(colorTextBox, "GraphicsWindow.GetColorFromRGB(" + sliderValue[R] + "," + sliderValue[G] + "," + sliderValue[B]+")") EndIf EndIf EndFor EndIf EndSub '================' End>RQP692.sb< Start>RQQ435.sb< GraphicsWindow.KeyDown=OnKeyDown factor=0 scale=10 GraphicsWindow.DrawBoundText(5,5,390,"Verander de vorm met de pijltjestoetsen") Sub onKeyDown key=graphicsWindow.LastKey If key="Up" Then factor=factor+1 ElseIf key="Down" then If factor>1 Then factor=factor-1 EndIf ElseIf key="Left" then If scale>1 Then scale=scale-1 EndIf ElseIf key="Right" then scale=scale+1 endif GraphicsWindow.clear() GraphicsWindow.DrawBoundText(5,5,390,"Factor=: "+factor+". Schaal is: "+scale) For i=0 To 360 l=50+scale*math.Cos(Math.GetRadians(factor*i)) x=200+l*math.Cos(Math.GetRadians(i)) y=200+l*math.sin(Math.GetRadians(i)) GraphicsWindow.SetPixel(x,y,"black") endfor EndSub End>RQQ435.sb< Start>RQQ827.sb< GraphicsWindow.Show() GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BackgroundColor = "Black" road = Shapes.AddImage ("http://spiralforums.biz/uploads/post-53-1139607373.jpg") car = Shapes.AddImage ("http://openclipart.org/image/800px/svg_to_png/61201/simple-travel-car-top_view.png") Shapes.Rotate (car,270) Shapes.Zoom (car.2,.2) Shapes.Move (car,-100,120) Shapes.Zoom (road,1,5) Shapes.Move (road,-300,-200) Shapes.SetOpacity (road,100) GraphicsWindow.ShowMessage ("You Have To Escape The Cops! Dodge The Barricades and Drive over 1/2 Mile to Win!","Use Mouse To Drive") loop2: GraphicsWindow.BrushColor = "ORange" R = Math.GetRandomNumber(350) plat_Car = Shapes.AddRectangle (80,10) loop:'LOOP1 Score = Score + 2 Shapes.Move (road,0,Shapes.Gettop(road) + 10) If Shapes.GetTop (road) > 640 Then Shapes.Move (road,0,0) EndIf Program.Delay (4) Shapes.Move (car,GraphicsWindow.MouseX-400,120) RY = RY + 6 Shapes.Move (plat_Car,R,RY) Program.Delay (5) ' IF End If Shapes.GetTop (plat_Car) >= 400 then Shapes.Remove (plat_Car) RY = 0 Goto loop2 EndIf GraphicsWindow.KeyDown = Key_Down Sub Key_Down If GraphicsWindow.LastKey = "Space" Then Shapes.Remove (plat_Car) RY = 500 Goto loop2 EndIf EndSub If Score > 2640 Then GraphicsWindow.ShowMessage ("You have Escaped! You drove " + Score + "feet","Congratulations") RY = 0 Score = 0 Goto loop2 EndIf If Shapes.GetLeft (plat_Car) > GraphicsWindow.MouseX - 40 And Shapes.GetLeft (plat_Car) < GraphicsWindow.MouseX + 40 And Shapes.GetTop (plat_Car) > 230 And Shapes.GetTop(plat_Car) < 300 Then If Score < 5280 then GraphicsWindow.ShowMessage ("You crashed and have Been Arrested! You Drove " + Score + " Feet","Notification") EndIf Shapes.Remove (plat_Car) RY = 0 Score = 0 Goto loop2 EndIf Goto loop End>RQQ827.sb< Start>RQR126-0.sb< 'Get All Char codes & test & store positions 'start with " " literals Initialise() LF = Text.GetCharacter(10) '13 then 10 is a line break While 0=0 If buttonClicked Then ParseCode() buttonClicked = "False" EndIf Program.Delay(50) EndWhile Sub ParseCode code = Controls.GetTextBoxText(codeBox) temp = code + Text.GetCharacter(13) + LF 'add a line break at the end 'Index loc - w/o linebreaks While Text.IsSubText(temp, LF) i = i + 1 loc[i] = Text.GetSubText(temp, 1, Text.GetIndexOf(temp, LF) - 2) '-2 removes line break temp = Text.GetSubTextToEnd(temp, Text.GetIndexOf(temp, LF) + 1) '+1 gets next char after line break EndWhile TextWindow.WriteLine("loc=" + loc) ' N 'Loop thru chars 1 loc at a time temp = loc For i = 1 To Array.GetItemCount(temp) 'isolate Literals within quotations (34) For j = 1 To Text.GetLength(temp[i]) If Text.GetSubText(temp[i], j, 1) = Text.GetCharacter(34) Then 'TextWindow.WriteLine(Text.GetCharacterCode(temp[j])) k = k + 1 quote[k] = j EndIf EndFor TextWindow.WriteLine("----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----") ' N TextWindow.WriteLine(temp[i]) ' N TextWindow.WriteLine(quote) TextWindow.Pause() EndFor EndSub Sub Initialise lineNumber = 1 btn = Controls.AddButton("read/write", 5, 5) Controls.SetSize(btn, 85, 25) codeBox = Controls.AddMultiLineTextBox(5, 5+5+25+5) Controls.SetSize(codeBox, GraphicsWindow.Width - 10, GraphicsWindow.Height-5-5-25-5-5) Controls.ButtonClicked = OnButtonClicked EndSub Sub OnButtonClicked buttonClicked = "True" EndSub End>RQR126-0.sb< Start>RQR126.sb< 'Get All Char codes & test & store positions 'start with " " literals Initialise() LF = Text.GetCharacter(10) '13 then 10 is a line break While 0=0 If buttonClicked Then ParseCode() buttonClicked = "False" EndIf Program.Delay(50) EndWhile Sub ParseCode code = Controls.GetTextBoxText(codeBox) temp = code + Text.GetCharacter(13) + LF 'add a line break at the end 'Index loc - w/o linebreaks While Text.IsSubText(temp, LF) i = i + 1 loc[i] = Text.GetSubText(temp, 1, Text.GetIndexOf(temp, LF) - 2) '-2 removes line break temp = Text.GetSubTextToEnd(temp, Text.GetIndexOf(temp, LF) + 1) '+1 gets next char after line break EndWhile 'Loop thru chars 1 loc at a time temp = loc For i = 1 To Array.GetItemCount(temp) 'isolate Literals within quotations (34) For j = 1 To Text.GetLength(temp[i]) If Text.GetSubText(temp[i], j, 1) = Text.GetCharacter(34) Then 'TextWindow.WriteLine(Text.GetCharacterCode(temp[j])) k = k + 1 quote[k] = j EndIf EndFor TextWindow.WriteLine(quote) TextWindow.Pause() EndFor EndSub Sub Initialise lineNumber = 1 btn = Controls.AddButton("read/write", 5, 5) Controls.SetSize(btn, 85, 25) codeBox = Controls.AddMultiLineTextBox(5, 5+5+25+5) Controls.SetSize(codeBox, GraphicsWindow.Width - 10, GraphicsWindow.Height-5-5-25-5-5) Controls.ButtonClicked = OnButtonClicked EndSub Sub OnButtonClicked buttonClicked = "True" EndSub End>RQR126.sb< Start>RQS299-0.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,"#77aaaa00",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) 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=ImageList.LoadImage ("c:\razno\941.jpg")'<-------------------put ur image of stone path here args=0 ll=0 jj=1 d20=-25 For d=0 to 2 step 2 dy=d*15-15 rott() endfor p1=(d20)+":0:-15:"+(d20)+":0:15" p10=LD3DView.AddTube(view3D p1 1.8 10 "blue" "D") p1=(d20)+":0:2:"+(d20+20)+":0:2:"+(d20+20)+":0:-2:"+(d20)+":0:-2:" ds=LD3DView.AddTube(view3D p1 1.8 10 "blue" "D") dy=0 d20=20 rott() p1=d20+":0:2:"+(d20-5)+":17:2:"+(d20-5)+":17:-2:"+d20+":0:-2:" LD3DView.AddTube(view3D p1 2.2 10 "blue" "D") p1=(d20-5)+":17:0:"+(d20-7)+":25:0:" LD3DView.AddTube(view3D p1 2.2 10 "blue" "D") p1=(d20-25)+":0:0:"+(d20-6.5)+":20:0" LD3DView.AddTube(view3D p1 2.4 10 "blue" "D") p1=(d20-25)+":0:0:"+(d20-30)+":22:0" LD3DView.AddTube(view3D p1 1.8 10 "blue" "D") p1=(d20-45)+":0:1.5:"+(d20-29)+":17:1.5:" p1=p1+(d20-29)+":17:-1.5:"+(d20-45)+":0:-1.5:" ks=LD3DView.AddTube(view3D p1 1.5 10 "blue" "D") d20=-5 For t=0 to 2 pp=d20+":22.5:"+(t-1)/2+":"+(d20-9)+":22.5:"+(t-1)*1.5 LD3DView.AddTube(view3D pp 2.5 10 "black" "D") endfor d20=13.5 pp=d20+":24.5:-12:"+(d20)+":24.5:12" LD3DView.AddTube(view3D pp 2.5 10 "blue" "D") pp=d20+":24.5:-12:"+(d20)+":24.5:-6" LD3DView.AddTube(view3D pp 2.51 10 "black" "D") pp=d20+":24.5:12:"+(d20)+":24.5:6" LD3DView.AddTube(view3D pp 2.51 10 "black" "D") For f=0 to 1 sf=LD3DView.AddSphere (view3D 1.25 12 "black" "D") LD3DView.TranslateGeometry (view3D sf d20 24.5, -12+f*24) endfor d20=-5 pp=d20+":-6:-10:"+d20+":-6:-4:"+d20+":0:-4:"+(d20)+":0:4:"+(d20)+":6:4:"+(d20)+":6:10" ppd=LD3DView.AddTube(view3D pp 1 10 "gray" "D") LD3DView.AnimateRotation (view3D ppd 0 0 1 0, -360 2,-1) cc=LD3DView.AddCone (view3D 40 38 1.5 40 "lightgray" "D") LD3DView.TranslateGeometry (view3D cc 0, -17, 0) LD3DView.AddDirectionalLight (view3D "Red" 10 30 10) LD3DView.AddImage (view3D cc "" ii "D") Sub rott' ***************************************** pp="" pp1="" i=1 For j=0 To 360 Step 5 px= d20+LDMath.Cos(j)*15 py= LDMath.sin (j)*15 px1= d20+LDMath.Cos(j)*14 py1= LDMath.sin (j)*14 pp1=pp1+px1+":"+py1+":"+dy+":" pp=pp+px+":"+py+":"+dy+":" p1=d20+":0:"+dy+":"+px+":"+py+":"+dy rd[jj][i]= LD3DView.AddTube(view3D p1 .4 10 "darkgray" "D") i=i+1 EndFor rd[jj][i]=LD3DView.AddTube(view3D pp1 1.2 10 "darkgray" "D") i=i+1 rd[jj][i]=LD3DView.AddTube(view3D pp 2 10 "brown" "D") jj=jj+1 EndSub f5=45 LDEvents.MouseWheel=mww ya=51 r35=95 While "true For aa=0 To 360 Step .5 px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Program.Delay (22) EndFor EndWhile Sub mww ll=ll+ LDEvents.LastMouseWheelDelta*.5 LD3DView.TranslateGeometry (view3D p10 ll 0 0) LDCall.Function2 ("trrd" 1 ll) LDCall.Function2 ("trrd" 2 ll) d20=20 GraphicsWindow.Title =ll p1=(d20-45+ll)+":0:1.5:"+(d20-29)+":17:1.5:" p1=p1+(d20-29)+":17:-1.5:"+(d20-45+ll)+":0:-1.5:" LD3DView.ModifyObject (view3D ks "X") LD3DView.ModifyObject (view3D ds "X") p11=(d20-45+ll)+":0:2:"+(d20+20-45)+":0:2:"+(d20+20-45)+":0:-2:"+(d20+ll-45)+":0:-2:" ds=LD3DView.AddTube(view3D p11 1.8 10 "blue" "D") ks=LD3DView.AddTube(view3D p1 1.5 10 "blue" "D") endsub Sub trrd For f=1 To i LD3DView.TranslateGeometry (view3D rd[args[1]][f] args[2] 0 0) EndFor EndSub Sub rottq ' LD3DView.TranslateGeometry(view3D oo[z][i][j] LDMath.Cos(an)*(10)+LDMath.Cos(an+90)*i*3 20+z*3 LDMath.sin (an)*(10)+LDMath.sin (an+90)*i*3) Program.Delay (5) EndSub End>RQS299-0.sb< Start>RQS299.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,"#77aaaa00",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) 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=ImageList.LoadImage ("e:\sttne.jpg")'<-------------------put ur image of stone path here ll=90 d20=-25 rott() p1=(d20)+":0:2:"+(d20+20)+":0:2:"+(d20+20)+":0:-2:"+(d20)+":0:-2:" LD3DView.AddTube(view3D p1 1.8 10 "blue" "D") d20=20 rott() p1=d20+":0:2:"+(d20-5)+":17:2:"+(d20-5)+":17:-2:"+d20+":0:-2:" LD3DView.AddTube(view3D p1 2.2 10 "blue" "D") p1=(d20-5)+":17:0:"+(d20-7)+":25:0:" LD3DView.AddTube(view3D p1 2.2 10 "blue" "D") p1=(d20-25)+":0:0:"+(d20-6.5)+":20:0:"+(d20-30)+":17:0:" LD3DView.AddTube(view3D p1 2.4 10 "blue" "D") p1=(d20-25)+":0:0:"+(d20-30)+":22:0" LD3DView.AddTube(view3D p1 1.8 10 "blue" "D") p1=(d20-45)+":0:1.5:"+(d20-29)+":17:1.5:" p1=p1+(d20-29)+":17:-1.5:"+(d20-45)+":0:-1.5:" LD3DView.AddTube(view3D p1 1.5 10 "blue" "D") d20=-5 For t=0 to 2 pp=d20+":22.5:"+(t-1)/2+":"+(d20-9)+":22.5:"+(t-1)*1.5 LD3DView.AddTube(view3D pp 2.5 10 "black" "D") endfor d20=13.5 pp=d20+":24.5:-12:"+(d20)+":24.5:12" LD3DView.AddTube(view3D pp 2.5 10 "blue" "D") pp=d20+":24.5:-12:"+(d20)+":24.5:-6" LD3DView.AddTube(view3D pp 2.51 10 "black" "D") pp=d20+":24.5:12:"+(d20)+":24.5:6" LD3DView.AddTube(view3D pp 2.51 10 "black" "D") For f=0 to 1 sf=LD3DView.AddSphere (view3D 1.25 12 "black" "D") LD3DView.TranslateGeometry (view3D sf d20 24.5, -12+f*24) endfor d20=-5 pp=d20+":-6:-10:"+d20+":-6:-4:"+d20+":0:-4:"+(d20)+":0:4:"+(d20)+":6:4:"+(d20)+":6:10" ppd=LD3DView.AddTube(view3D pp 1 10 "gray" "D") LD3DView.AnimateRotation (view3D ppd 0 0 1 0, -360 2,-1) cc=LD3DView.AddCone (view3D 40 38 1.5 40 "lightgray" "D") LD3DView.TranslateGeometry (view3D cc 0, -17, 0) LD3DView.AddDirectionalLight (view3D "Red" 10 30 10) Sub rott' ***************************************** pp="" pp1="" For j=0 To 360 Step 5 px= d20+LDMath.Cos(j)*15 py= LDMath.sin (j)*15 px1= d20+LDMath.Cos(j)*14 py1= LDMath.sin (j)*14 pp1=pp1+px1+":"+py1+":0:" pp=pp+px+":"+py+":0:" p1=d20+":0:0:"+px+":"+py+":0" LD3DView.AddTube(view3D p1 .4 10 "darkgray" "D") EndFor LD3DView.AddTube(view3D pp1 1.2 10 "darkgray" "D") LD3DView.AddTube(view3D pp 2 10 "brown" "D") EndSub f5=45 LDEvents.MouseWheel=mww ya=51 r35=95 While "true For aa=0 To 360 Step .5 px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Program.Delay (22) EndFor EndWhile Sub mww ll=ll+ LDEvents.LastMouseWheelDelta*3 LD3DView.ModifyObject(view3D sl "X") sl=LD3DView.AddspotLight(view3D,"white",LDMath.cos(ll)*30,20, LDMath.sin(ll)*30 ,1 ,1 ,1 90 150) GraphicsWindow.Title =ll endsub Sub rottq ' LD3DView.TranslateGeometry(view3D oo[z][i][j] LDMath.Cos(an)*(10)+LDMath.Cos(an+90)*i*3 20+z*3 LDMath.sin (an)*(10)+LDMath.sin (an+90)*i*3) Program.Delay (5) EndSub End>RQS299.sb< Start>RQS337.sb< '############################################################### '############## A CURLING PROGRAM FOR SMALL BASIC ################# '############################################################### '=============================================================== 'Initial TextWindow screen to select player colours and show instructions '=============================================================== Colors[1] = "Red" Colors[2] = "Blue" Colors[3] = "Green" Colors[4] = "Cyan" Colors[5] = "Purple" Colors[6] = "Orange" Colors[7] = "Yellow" TextWindow.Title = "Curling" For i = 1 To 7 TextWindow.WriteLine(i+" : "+Colors[i]) EndFor TextWindow.WriteLine("") TextWindow.ForegroundColor = "Yellow" 'This is rather fussy code to ensure only allowed number data is entered to select player colours While (Color[1] = "") TextWindow.CursorTop = 8 TextWindow.WriteLine(" ") TextWindow.CursorTop = 8 TextWindow.Write("Player 1 Select Colour: ") Color[1] = Colors[TextWindow.ReadNumber()] EndWhile While (Color[2] = "" Or Color[1] = Color[2]) TextWindow.CursorTop = 9 TextWindow.WriteLine(" ") TextWindow.CursorTop = 9 TextWindow.Write("Player 2 Select Colour: ") Color[2] = Colors[TextWindow.ReadNumber()] EndWhile TextWindow.ForegroundColor = "White" TextWindow.WriteLine("") TextWindow.WriteLine("Screen reloution of 1280x800 is best.") TextWindow.WriteLine("") TextWindow.WriteLine("Use the mouse click to first direct the stone, then set the curl.") TextWindow.WriteLine("The stone will run roughly double the initial set direction.") TextWindow.WriteLine("Waggle the mouse just in front of the stone to sweep it further.") TextWindow.WriteLine("Sweeping to one side will also alter its path slightly.") TextWindow.WriteLine("") TextWindow.WriteLine("See the code to see what what else is happening - that's what its for.") TextWindow.WriteLine("") TextWindow.Write("Press ") TextWindow.ForegroundColor = "Red" TextWindow.Write("ENTER") TextWindow.ForegroundColor = "White" TextWindow.Write(" to play.") '=============================================================== 'Load the images (with the player colours) while waiting for an ENTER, then get rid of the TextWindow '=============================================================== 'dir = Program.Directory dir = "http://litdev.web.officelive.com/images/Thumbnails" For i = 1 To 2 stoneImage[i] = ImageList.LoadImage(dir+"\stone"+Color[i]+".png") brushImage[i] = ImageList.LoadImage(dir+"\brush"+Color[i]+".png") EndFor rad = ImageList.GetWidthOfImage(stoneImage[1])/2 brushW = ImageList.GetWidthOfImage(brushImage[1])/2 brushH = ImageList.GetHeightOfImage(brushImage[1])*7/8 TextWindow.Read() TextWindow.Hide() 'Download the sweeping sound - works OK just using it directly 'sweepSound = Network.DownloadFile("http://litdev.web.officelive.com/Documents/sweep.wma") ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' 'File.CopyFile(sweepSound,Program.Directory+"\sweep.wma") 'must be named wma, not tmp 'sweepSound = Program.Directory+"\sweep.wma" sweepSound = "http://litdev.web.officelive.com/Documents/sweep.wma" 'Can't fix the sound conflict issues (sometimes crashes game) so flag to turn off sound effects (0-Off : 1-On) USESOUND = 0 '=============================================================== 'Set the GraphicsWindow up, including the background colour 'bg' '=============================================================== gw = 1250 gh = 400 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.Title = "Curling" bg = "#ddeeff" GraphicsWindow.BackgroundColor = bg Mouse.HideCursor() Mouse.MouseX = GraphicsWindow.Left+gw/2 Mouse.MouseY = GraphicsWindow.Top+gh/2 CL = 0.85*gw 'Centre line of scoring zone '=============================================================== 'Draw the rink with SHAPES - they always lie on top of the background pane used for play direction and curl arrows 'The Order of adding the shapes is important - they lay on top of each other - rink, then brushes, then stones '=============================================================== GraphicsWindow.PenColor = "Blue" GraphicsWindow.BrushColor = "Blue" size = 9 Shapes.Move(Shapes.AddEllipse(size*rad,size*rad),CL-size/2*rad,gh/2-size/2*rad) GraphicsWindow.PenColor = bg GraphicsWindow.BrushColor = bg size = 6.5 Shapes.Move(Shapes.AddEllipse(size*rad,size*rad),CL-size/2*rad,gh/2-size/2*rad) GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" size = 4 Shapes.Move(Shapes.AddEllipse(size*rad,size*rad),CL-size/2*rad,gh/2-size/2*rad) GraphicsWindow.PenColor = bg GraphicsWindow.BrushColor = bg size = 1.5 Shapes.Move(Shapes.AddEllipse(size*rad,size*rad),CL-size/2*rad,gh/2-size/2*rad) 'Some game play lines (hog line, centre lines) GraphicsWindow.PenColor = "DarkGray" GraphicsWindow.BrushColor = GraphicsWindow.PenColor Shapes.Move(Shapes.AddRectangle(2,gh),CL-1,0) Shapes.Move(Shapes.AddRectangle(gw,2),0,gh/2-1) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = GraphicsWindow.PenColor Shapes.Move(Shapes.AddRectangle(4,gh),gw/2-2,0) 'Back foot stop Shapes.Move(Shapes.AddRectangle(8,15),0,gh/2-25) Shapes.Move(Shapes.AddRectangle(8,15),0,gh/2+10) Shapes.Move(Shapes.AddRectangle(4,50),0,gh/2-25) 'Speckles on the ice GraphicsWindow.PenColor = "#ddccccff" GraphicsWindow.BrushColor = GraphicsWindow.PenColor For i = 1 To 1000 Shapes.Move(Shapes.AddEllipse(2,2),Math.GetRandomNumber(gw)-1,Math.GetRandomNumber(gh)-1) EndFor 'Brushes For i = 1 To 2 brush[i] = Shapes.AddImage(brushImage[i]) Shapes.HideShape(brush[i]) EndFor '=============================================================== 'Start events and set some game parameters 'hammer is the order of play hammer[1] = 2 means player 2 goes first '=============================================================== GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp MouseMove = 0 mouseDown = 0 mouseUp = 0 pi = Math.Pi deg2rad = pi/180 friction = 0.05 ' Stone friction elastic = 0.8 'Elasticity of collisions dt = 0.1 'Speed of game play (time-step size) soundDelay = 500 'Delay (ms) between trying to play sounds - the shortest that works OK for PlayClick() nStone = 16 '=============================================================== 'Main game play - 10 ends '=============================================================== START: hammer[1] = 1 hammer[2] = 3-hammer[1] For game = 1 To 10 For i = 1 To 2 Score[game][i] = 0 EndFor EndFor For game = 1 To 10 DrawScore() 'Update the score graphic - this is on the background layer and can be messed by the game shot direction arrows stone = "" 'Reset the active stones For i = 1 To 4 'Player For k = 1 To 2 'Stone For j = 1 To 2 'Team 'iNext is the stone to add, depends on player order (hammer) iNext = 4*(i-1)+2*(k-1)+j 'Add the stone and move to the starting area Shapes.Remove(stones[iNext]) stones[iNext] = Shapes.AddImage(stoneImage[hammer[j]]) Shapes.Move(stones[iNext],(4-i)*2*rad,(j-1)*(gh-4*rad)+(k-1)*2*rad) EndFor EndFor EndFor 'Now the game starts For i = 1 To 4 'Player For k = 1 To 2 'Stone For j = 1 To 2 'Team 'Select the current player stone iNext = 4*(i-1)+2*(k-1)+j 'Throw the stone throwStones() 'Update the score graphics - again it can be messed by the shot direction arrows DrawScore() EndFor EndFor EndFor UpdateScore() Program.Delay(1000) EndFor '=============================================================== 'Game finished - Find and report eport the winner '=============================================================== 'Remove the stone shapes for tidyness or in case we want to restart For i = 1 To nStone Shapes.Remove(stones[i]) EndFor stones = "" For i = 1 To 2 Total[i] = 0 For j = 1 To 10 Total[i] = Total[i] + Score[j][i] EndFor EndFor GraphicsWindow.BrushColor = "DarkGray" GraphicsWindow.FontSize = 70 If (Total[1] > Total[2]) Then GraphicsWindow.DrawText(100,100,"Player 1 is the WINNER") ElseIf (Total[2] > Total[1]) Then GraphicsWindow.DrawText(100,100,"Player 2 is the WINNER") Else GraphicsWindow.DrawText(100,100,"The game is a DRAW") EndIf 'Finish here - we could ask the user to restart and then GoTo START Program.Delay(5000) Program.End() '=============================================================== 'SUBROUTINES FOR GAME '=============================================================== '=============================================================== 'Calculate the Score - nearest sones within the scoring zone '=============================================================== Sub UpdateScore For iStone = 1 To nStone dist[iStone] = Math.SquareRoot((stoneX[iStone]-CL)*(stoneX[iStone]-CL) + (stoneY[iStone]-gh/2)*(stoneY[iStone]-gh/2)) rank[iStone] = 0 If (dist[iStone] < 5.5*rad) Then If (iStone/2 = Math.Floor(iStone/2)) Then rank[iStone] = 2 Else rank[iStone] = 1 EndIf EndIf EndFor For iStone = 1 To nStone-1 For jStone = iStone To nStone If (dist[jStone] < dist[iStone]) Then temp = dist[iStone] dist[iStone] = dist[jStone] dist[jStone] = temp temp = rank[iStone] rank[iStone] = rank[jStone] rank[jStone] = temp EndIf EndFor EndFor winner = rank[1] If (winner > 0) Then i = 1 While (rank[i] = winner) Score[game][hammer[winner]] = Score[game][hammer[winner]] + 1 i = i+1 EndWhile 'Next end the winner goes first - advantage to go last (have the hammer) hammer[1] = hammer[winner] hammer[2] = 3-hammer[1] EndIf DrawScore() EndSub '=============================================================== 'Draw the score graphics as required '=============================================================== Sub DrawScore GraphicsWindow.PenColor = bg GraphicsWindow.BrushColor = bg GraphicsWindow.FillRectangle(250,0,300,60) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FillRectangle(320,20,200,40) GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FillRectangle(320+20*(game-1),2,20,16) GraphicsWindow.BrushColor = Color[1] GraphicsWindow.DrawText(250,20,"Player 1") GraphicsWindow.BrushColor = Color[2] GraphicsWindow.DrawText(250,40,"Player 2") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(250,0,"End") For iX = 1 To 10 'i and j variables used in main loop GraphicsWindow.DrawText(320+20*(iX-1),0,iX) For jX = 1 To 2 GraphicsWindow.DrawText(320+20*(iX-1),20*jX,Score[iX][jX]) EndFor EndFor EndSub '=============================================================== 'Throw the stones - the PHYSICS part '=============================================================== Sub throwStones 'Set the next active (stone) from the list of availables stones (stones) stone[iNext] = stones[iNext] If (iNext/2 = Math.Floor(iNext/2)) Then iPlayer = hammer[2] Else iPlayer = hammer[1] EndIf 'Do the initial direction, velocity and curl startStone() 'Run while stones are active (moving) active = 1 mouseMove = 0 While (active = 1) 'Add the player brush image (note it is centred on the middle of the brush, not the middle of the image) Shapes.ShowShape(brush[iPlayer]) xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY Shapes.Move(brush[iPlayer],xM-brushW,yM-brushH) 'Process each active stone (each stone in the playiong area) active = 0 For iStone = 1 To Array.GetItemCount(stone) If (stoneX[iStone] > 0) Then ' Only consider moving stones for the position update 'iPlayerStone is the the player corresponding to the current stone - we can't sweep opponent stone untill it is past the score zone centre If (iStone/2 = Math.Floor(iStone/2)) Then iPlayerStone = hammer[2] Else iPlayerStone = hammer[1] EndIf 'Get the current stone path angle If (stoneU[iStone] = 0) Then ang = pi/2 Else ang = Math.ArcTan(stoneV[iStone]/stoneU[iStone]) EndIf If (stoneU[iStone] < 0) Then ang = ang+pi EndIf 'Check if the stone is being swept 'Are we just in front of the stone, is it our stone or are we past the score zone centre 'Is the stone moving and is the mouse moving (sweeping) 'We check 2 overlapping circles the size of the stone infront of its path direction sweep = 0 If ((iPlayerStone = iPlayer Or stoneX[iStone] > CL) And Math.Abs(stoneU[iStone]) > 0 And mouseMove = 1) Then centreX = stoneX[iStone]+2*rad*Math.Cos(ang) centreY = stoneY[iStone]+2*rad*Math.Sin(ang) dist = Math.SquareRoot((centreX-xM)*(centreX-xM)+(centreY-yM)*(centreY-yM)) If (dist < rad) Then sweep = 1 EndIf centreX = stoneX[iStone]+3*rad*Math.Cos(ang) centreY = stoneY[iStone]+3*rad*Math.Sin(ang) dist = Math.SquareRoot((centreX-xM)*(centreX-xM)+(centreY-yM)*(centreY-yM)) If (dist < rad) Then sweep = 1 EndIf mouseMove = 0 EndIf 'Give a swept stone an opacity change to see it is being swept If (sweep = 1) Then Shapes.SetOpacity(stone[iStone],50) 'Add your own sweeping sound here - otherwise uses a downloaded file If (USESOUND = 1) Then ms = Clock.ElapsedMilliseconds If (ms-lastSound > soundDelay) Then lastSound = ms Sound.Stop(sweepSound) Sound.Play(sweepSound) EndIf EndIf Else Shapes.SetOpacity(stone[iStone],100) EndIf 'Update the velocity and rotation speed for friction, accounting for reduced friction with sweep stoneU[iStone] = (1-friction*(1-0.2*sweep)*dt)*stoneU[iStone] stoneV[iStone] = (1-friction*(1-0.2*sweep)*dt)*stoneV[iStone] stoneRotate[iStone] = (1-0.5*friction*(1-0.2*sweep)*dt)*stoneRotate[iStone] 'Average velocity and the velocity of the left and right edges affected by the curl 'The curl is generated by differenbt velocities and hence friction on the spinning stone vel = Math.SquareRoot(stoneU[iStone]*stoneU[iStone]+stoneV[iStone]*stoneV[iStone]) dvel = stoneRotate[iStone]*deg2rad*rad vel1 = vel+dvel vel2 = vel-dvel 'This is a fudge to estimate a deviation based on the velocities of the stone wrt to the ice on either side of the spinning stone deviation = 0.0002*(vel1-vel2) 'stoneRotate > 0 (clockwise) increases stoneV (down) and deviation > 0 => vel1>vel2, hence bush below (yM>stoneY) swings stone up (reduces deviation) 'Sweep also affects the deviation - the trig (tan) is just accounting for the fact that the stone may not be moving just in the X direction If (sweep = 1) Then If (yM > stoneY[iStone]+(xM-stoneX[iStone])*Math.Tan(ang)) Then deviation = deviation-0.001*Math.Abs(dvel) Else deviation = deviation+0.001*Math.Abs(dvel) EndIf EndIf 'Update velocity - deviate from current path due to curl stoneU[iStone] = stoneU[iStone]-Math.Sin(ang)*deviation stoneV[iStone] = stoneV[iStone]+Math.Cos(ang)*deviation 'Update position and rotation stoneAngle[iStone] = stoneAngle[iStone]+stoneRotate[iStone]*dt stoneX[iStone] = stoneX[iStone]+stoneU[iStone]*dt stoneY[iStone] = stoneY[iStone]+stoneV[iStone]*dt 'Do any collisions Collision() 'Check for stopped stones If (vel > 1) Then active = 1 Else stoneU[iStone] = 0 stoneV[iStone] = 0 stoneRotate[iStone] = 0 'A stone that doesn't reach the half way point is dead If (stoneX[iStone] < gw/2) Then stoneX[iStone] = -1000 stoneY[iStone] = -1000 playClick() EndIf EndIf 'Remove and dead stones that hit the end or top /botton edges If (stoneX[iStone] > gw-rad Or stoneY[iStone] < rad Or stoneY[iStone] > gh-rad) Then stoneX[iStone] = -1000 stoneY[iStone] = -1000 stoneU[iStone] = 0 stoneV[iStone] = 0 playClick() EndIf 'Finally rotate and move the stone image shape Shapes.Rotate(stone[iStone],stoneAngle[iStone]) Shapes.Move(stone[iStone],stoneX[iStone]-rad,stoneY[iStone]-rad) EndIf EndFor Program.Delay(10) EndWhile 'Ensure all stones at the end of the delivery are fully opaque and hide the brush ans stop any remaining sweeping sound For iStone = 1 To Array.GetItemCount(stone) Shapes.SetOpacity(stone[iStone],100) EndFor Shapes.HideShape(brush[iPlayer]) Sound.Stop(sweepSound) EndSub '=============================================================== 'Check for collisions of active stones in the play area '=============================================================== Sub Collision 'Consider the current stone and all other stones in play (array stone) For jStone = 1 To Array.GetItemCount(stone) If (iStone <> jStone) Then dx = stoneX[jStone]-stoneX[iStone] dy = stoneY[jStone]-stoneY[iStone] dist = Math.SquareRoot(dx*dx+dy*dy) If (dist < 1.9*rad) Then 'Images are slightly bigger than stone diameter 'Calculate average velocity vector U = (stoneU[iStone]+stoneU[jStone])/2 V = (stoneV[iStone]+stoneV[jStone])/2 'This is the centre of momentun velocities - the collisions are easiest in this reference frame 'This is because each stone then effectively just rebounds as if it hit a wall 'Just like two balls with equal speed hitting head on - the centre of momentum there is stationary stoneU[iStone] = stoneU[iStone]-U stoneV[iStone] = stoneV[iStone]-V stoneU[jStone] = stoneU[jStone]-U stoneV[jStone] = stoneV[jStone]-V 'This is the normal unit vector from the centre of stone iStone to the centre of jStone normX = dx/dist normY = dy/dist 'This is not obvious, but I think it is the easiest way to calculate the collision reasonably without lots of trig and angles 'Basically it just uses vectors - hard to explain without a drawing, but with a drawing it should make sense 'u is the incident stone vector 'u* is its reflection direction vector 'n is the unit vector from stone i to stone j 'u.n is a dot product (the distance of u in the direction n) 'u -u* = 2u.n n dotProduct = normX*stoneU[iStone] + normY*stoneV[iStone] If (dotProduct > 0) Then ' Only collide stones that are impacting - but not if it is inside the collision radius and moving away (could happen with long time-steps) stoneU[iStone] = stoneU[iStone] - 2*normX*dotProduct stoneV[iStone] = stoneV[iStone] - 2*normY*dotProduct EndIf 'u*-u = -2u.n n dotProduct = normX*stoneU[jStone] + normY*stoneV[jStone] If (dotProduct < 0) Then stoneU[jStone] = stoneU[jStone] - 2*normX*dotProduct stoneV[jStone] = stoneV[jStone] - 2*normY*dotProduct EndIf 'Convert back from centre of momentun frame to true frame, with a little energy loss (elastic < 1) - this runs a stone on a little after it hits a target stone stoneU[iStone] = elastic*stoneU[iStone]+U stoneV[iStone] = elastic*stoneV[iStone]+V stoneU[jStone] = elastic*stoneU[jStone]+U stoneV[jStone] = elastic*stoneV[jStone]+V 'Play an impact sound playClick() EndIf EndIf EndFor EndSub '=============================================================== 'Initialise a stone throw - all the arrow starting for direction, power and curl '=============================================================== Sub startStone 'The starting point - rotation is just to align the handle in the X direction stoneX[iNext] = 50 stoneY[iNext] = gh/2 stoneAngle[iNext] = -68 Shapes.Rotate(stone[iNext],stoneAngle[iNext]) Shapes.Move(stone[iNext],stoneX[iNext]-rad,stoneY[iNext]-rad) 'Draw the arrow for speed and direction - most of the effor here is the overdraw to prevent shaddow images remaining as we move the arrow with the mouse mouseUp = 0 While (mouseUp = 0) If (mouseMove = 1) Then xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY GraphicsWindow.PenColor = Color[iPlayer] GraphicsWindow.PenWidth = 2 Shapes.Remove(line) line=shapes.AddLine(stoneX[iNext]+22,stoneY[iNext],xM,yM) mouseMove = 0 EndIf EndWhile Shapes.Remove(line) 'Set intial velocity vector - we could add some randomness here stoneU[iNext] = (xM-stoneX[iNext])/10 stoneV[iNext] = (yM-stoneY[iNext])/10 'Draw the arrow for curl xStart = xM mouseUp = 0 While (mouseUp = 0) If (mouseMove = 1) Then xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY GraphicsWindow.PenColor = Color[iPlayer] GraphicsWindow.PenWidth = 2 Shapes.Remove(line) line=shapes.AddLine(xStart,stoneY[iNext],xStart,yM) mouseMove = 0 EndIf EndWhile Shapes.Remove(line) 'Set intial curl rotation - again some randomness is possible, but I thought the game was best without stoneRotate[iNext] = (yM-gh/2)/2 EndSub '=============================================================== 'Play a click - try to prevent sound clashing - the time check is to make sure it is finished the last before starting the next sound '=============================================================== Sub playClick If (USESOUND = 1) Then ms = Clock.ElapsedMilliseconds If (ms-lastSound > soundDelay) Then lastSound = ms Sound.Stop(sweepSound) Sound.PlayClick() EndIf EndIf EndSub '=============================================================== 'The events - just set flags as required '=============================================================== Sub OnMouseMove mouseMove = 1 'TextWindow.WriteLine(Clock.ElapsedMilliseconds) 'Interesting effect - this event is triggered when a shape moves over the mouse - could be useful (not here though) EndSub Sub OnMouseDown mouseDown = 1 mouseUp = 0 EndSub Sub OnMouseUp mouseDown = 0 mouseUp = 1 EndSub End>RQS337.sb< Start>RQV069.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() AddLoadedImage() HideLoadedImage() 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, 10) TMBtnOpenFile = Controls.AddButton("", 44, 6) Controls.SetSize(TMBtnOpenFile, 39, 33) Shapes.SetOpacity(TMBtnOpenFile, 10) TMBtnSaveFile = Controls.AddButton("", 81, 6) Controls.SetSize(TMBtnSaveFile, 39, 33) Shapes.SetOpacity(TMBtnSaveFile, 10) TMBtnFont = Controls.AddButton("", 120, 6) Controls.SetSize(TMBtnFont, 37, 33) Shapes.SetOpacity(TMBtnFont, 10) TMBtnSecondScreen = Controls.AddButton("", 158, 6) Controls.SetSize(TMBtnSecondScreen, 37, 33) Shapes.SetOpacity(TMBtnSecondScreen, 10) TMBtnAddImage = Controls.AddButton("", 196, 6) Controls.SetSize(TMBtnAddImage, 37, 33) Shapes.SetOpacity(TMBtnAddImage, 10) TMBtnSettings = Controls.AddButton("", 234, 6) Controls.SetSize(TMBtnSettings, 37, 33) Shapes.SetOpacity(TMBtnSettings, 10) 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" Then Controls.SetSize(Screen, GraphicsWindow.Width - 10, GraphicsWindow.Height - 50) ElseIf SecondScreenAdded = "Yes" Or ImageAdded = "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() HideLoadedImage() 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(490, 150) Shapes.Move(IDBackRec, 505, 45) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" IDBackRecWhite = Shapes.AddRectangle(488, 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 ImageAdded = "Yes" And ImageLoaded = "Yes" Then ShowLoadedImage() EndIf EndSub 'AddLoadedImage Sub AddLoadedImage GraphicsWindow.BrushColor = GrayControl GraphicsWindow.PenColor = GrayControlShadow LIBackRec = Shapes.AddRectangle(490, 35) Shapes.Move(LIBackRec, 505, 5) LIBackImage = Shapes.AddRectangle(490, 550) Shapes.Move(LIBackImage, 505, 45) GraphicsWindow.PenColor = "Gray" GraphicsWindow.BrushColor = "Gainsboro" LIInnerBackImage = Shapes.AddRectangle(488, 548) Shapes.Move(LIInnerBackImage, 506, 46) EndSub 'ShowLoadedImage Sub ShowLoadedImage Shapes.ShowShape(LIBackRec) Shapes.ShowShape(LIBackImage) Shapes.ShowShape(LIInnerBackImage) Shapes.ShowShape(LoadedImage) EndSub 'HideLoadedImage Sub HideLoadedImage Shapes.HideShape(LIBackRec) Shapes.HideShape(LIBackImage) Shapes.HideShape(LIInnerBackImage) Shapes.HideShape(LoadedImage) EndSub 'CheckLIWidth Sub CheckLIWidth If ImageList.GetWidthOfImage(ImgLoadedImage) > 486 Then Controls.SetSize(LoadedImage, 486, ImageList.GetHeightOfImage(ImgLoadedImage)) 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() HideAllMenus() ShowTopMenu() Shapes.ShowShape(Screen) GoBack() 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) GoBack() EndIf EndIf ElseIf Controls.LastClickedButton = TMBtnSaveFile Then Sound.PlayClick() HideAllMenus() ShowSaveFileDialog() ElseIf Controls.LastClickedButton = SFBtnCancel Then Sound.PlayClick() HideSaveFileDialog() ShowTopMenu() Controls.ShowControl(Screen) GoBack() 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) GoBack() 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) GoBack() 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" HideAllMenus() ApplyFontSettings() ShowTopMenu() AddScreen() GoBack() 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() GoBack() 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() If ImageLoaded = "No" Then AppearImageDialog() Else ShowLoadedImage() EndIf Controls.SetTextBoxText(Screen, PrevTF1Txt) ElseIf ImageAdded = "Yes" Then ImageAdded = "No" HideTopMenuControls() PrevTF1Txt = Controls.GetTextBoxText(Screen) Controls.SetTextBoxText(Screen, "") If ImageLoaded = "No" Then FadeImageDialog() Else HideLoadedImage() EndIf 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) GoBack() 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) GoBack() ElseIf Controls.LastClickedButton = IDBtnCancel Then Sound.PlayClick() PrevTF1Txt = Controls.GetTextBoxText(Screen) Controls.SetTextBoxText(Screen, "") HideTopMenuControls() FadeImageDialog() IncreaseLeftTf() ShowTopMenuControls() Controls.SetTextBoxText(Screen, PrevTF1Txt) 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 If Text.EndsWith(GetAddImagePath, ".jpg") Or Text.EndsWith(GetAddImagePath, ".jpeg") Or Text.EndsWith(GetAddImagePath, ".png") Or Text.EndsWith(GetAddImagePath, ".bmp") Or Text.EndsWith(GetAddImagePath, ".gif") Or Text.EndsWith(GetAddImagePath, ".dib") Or Text.EndsWith(GetAddImagePath, ".jpe") Or Text.EndsWith(GetAddImagePath, ".jfif") Or Text.EndsWith(GetAddImagePath, ".tif") Or Text.EndsWith(GetAddImagePath, ".tiff") Then HideImageDialog() ImagePath = Controls.GetTextBoxText(IDTBAddImage) ShowLoadedImage() ImgLoadedImage = ImageList.LoadImage(ImagePath) LoadedImage = Shapes.AddImage(ImgLoadedImage) Shapes.Move(LoadedImage, 507, 47) CheckLIWidth() ImageLoaded = "Yes" Else GraphicsWindow.ShowMessage("The image could not be found. Please make sure that you typed the extention of the image (extention examples: .jpg, .png, .gif, etc.).", "Information") EndIf EndIf EndIf EndSub End>RQV069.sb< Start>RQW402.sb< x = 10 y = 320 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.SetPixel(320, x, "White") While x<300 x = x + 1 spread = spread + 1 For div = -spread To spread If (GraphicsWindow.GetPixel(320 - 1 + div, x - 1) = "#000000") Then '[X][?][?] If (GraphicsWindow.GetPixel(320 + div, x - 1) = "#000000") Then '[X][X][?] If(GraphicsWindow.GetPixel(320 + 1 + div, x - 1) = "#000000") Then '[X][X][X] GraphicsWindow.SetPixel(320 + div, x, "Black") Else '[X][X][ ] GraphicsWindow.SetPixel(320 + div, x, "White") EndIf Else '[X][ ][?] If (GraphicsWindow.GetPixel(320 + 1 + div, x - 1) = "#000000") Then '[X][ ][X] GraphicsWindow.SetPixel(320 + div, x, "Black") Else '[X][ ][ ] GraphicsWindow.SetPixel(320 + div, x, "Black") EndIf EndIf Else '[ ][?][?] If (GraphicsWindow.GetPixel(320 + div, x - 1) = "#000000") Then '[ ][X][?] If(GraphicsWindow.GetPixel(320 + 1 + div, x - 1) = "#000000") Then '[ ][X][X] GraphicsWindow.SetPixel(320 + div, x, "White") Else '[ ][X][ ] GraphicsWindow.SetPixel(320 + div, x, "Black") EndIf Else '[ ][ ][?] If (GraphicsWindow.GetPixel(320 + 1 + div, x - 1) = "#000000") Then '[ ][ ][X] GraphicsWindow.SetPixel(320 + div, x, "White") Else '[ ][ ][ ] GraphicsWindow.SetPixel(320 + div, x, "Black") EndIf EndIf EndIf 'Interesting results: 'BWBBWBWB 'BWWBWBWB EndFor EndWhile End>RQW402.sb< Start>RQX345-8.sb< ' Graph - Sin, Cos and Tan ' Version 0.9 ' Copyright © 2015-2018 Nonki Takahashi. The MIT License. ' Last update 2018-12-09 ' Program ID RQX345-8 GraphicsWindow.Title = "Graph 0.9" Not = "True=False;False=True;" color = "1=#CC0033FF;2=#CC339900;3=#CCFF6600;" Form() For fid = 1 To 3 _gwx = "" GraphicsWindow.PenColor = color[fid] GraphicsWindow.DrawLine(10 + (fid - 1) * 60, 16, 30 + (fid - 1) * 60, 16) Fx_GetProperties() GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(34 + (fid - 1) * 60, 10, textFx) dx = 0.01 For p = 1 To part Graph_Draw() EndFor EndFor Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.FontName = "Arial" param = "x=10;" param["width"] = gw - 20 param["y"] = 30 param["height"] = gh - 40 Graph_SetGWViewPort() GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(param["x"], param["y"], param["width"], param["height"]) x1 = -6.5 param["x"] = x1 x2 = 6.5 param["width"] = x2 - x1 param["height"] = -param["width"] / (gw - 20) * (gh - 40) y1 = -param["height"] / 2 y2 = param["height"] / 2 param["y"] = y1 Graph_SetLogicalViewPort() GraphicsWindow.PenColor = "#11000000" dx = 0.1 dy = 0.1 Graph_DrawGrid() GraphicsWindow.PenColor = "#22000000" GraphicsWindow.BrushColor = "#333333" dx = 1 dy = 1 num = "True" Graph_DrawGrid() GraphicsWindow.PenColor = "Gray" GraphicsWindow.DrawRectangle(10, 30, gw - 20, gh - 40) ox = gwx1 + 300 oy = gwy1 + 300 EndSub Sub Fx ' param fid - function ID If fid = 1 Then y = Math.Sin(x) ElseIf fid = 2 Then y = Math.Cos(x) Else y = Math.Tan(x) EndIf EndSub Sub Fx_GetProperties ' param fid - function ID If fid = 1 Then textFx = "Sin" ElseIf fid = 2 Then textFx = "Cos" Else textFx = "Tan" EndIf minX[1] = x1 maxX[1] = x2 continuous[1] = "True" part = 1 EndSub Sub Graph_Draw For p = 1 To part For x = minX[p] To maxX[p] Step dx Fx() Graph_DrawLine() _x = x _y = y EndFor EndFor EndSub Sub Graph_SetGWViewPort ' param["x"] ' param["y"] ' param["width"] ' param["height"] gwvp = param EndSub Sub Graph_SetLogicalViewPort ' param["x"] ' param["y"] ' param["width"] ' param["height"] vp = param EndSub Sub Graph_ToGWCoordinate ' param x, y - logical co-ordinate ' return gwx, gwy - graphics window co-ordinate gwx = gwvp["x"] + (x - vp["x"]) / vp["width"] * gwvp["width"] gwy = gwvp["y"] + (y - vp["y"]) / vp["height"] * gwvp["height"] EndSub Sub Graph_DrawLine ' param x, y - logical point to endt line ' param _x, _y - logical point to start line If x = 0 Then ' for SB 1.2 sign = 0 Else sign = x / Math.Abs(x) EndIf Graph_ToGWCoordinate() If _gwx <> "" And (continuous[p] Or (Not[continuous[p]] And Math.Abs(gwy - _gwy) < 30)) Then If y2 <= _y And _y <= y1 And y2 <= y And y <= y1 Then GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) ElseIf y2 <= _y And _y <= y1 Then Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", gwx) Stack.PushValue("local", gwy) If y < y2 Then k = (_y - y2) / (_y - y) x = (1 - k) * _x + k * x y = y2 Else k = (y1 - _y) / (y - _y) x = (1 - k) * _x + k * x y = y1 EndIf Graph_ToGWCoordinate() GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) gwy = Stack.PopValue("local") gwx = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") ElseIf y2 <= y And y <= y1 Then Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", gwx) Stack.PushValue("local", gwy) Stack.PushValue("local", _gwx) Stack.PushValue("local", _gwy) _gwx = gwx _gwy = gwy If _y < y2 Then k = (y - y2) / (y - _y) x = (1 - k) * x + k * _x y = y2 Else k = (y1 - y) / (_y - y) x = (1 - k) * x + k * _x y = y1 EndIf Graph_ToGWCoordinate() GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) _gwy = Stack.PopValue("local") _gwx = Stack.PopValue("local") gwy = Stack.PopValue("local") gwx = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") EndIf EndIf _gwx = gwx _gwy = gwy EndSub Sub Graph_DrawGrid ' param x1, y1 - logical left top of the grid ' param x2, y2 - logical right bottom of the grid ' param dx, dy - logical grid pitch x = x1 y = y1 Graph_ToGWCoordinate() gwx1 = gwx gwy1 = gwy x = x2 y = y2 Graph_ToGWCoordinate() gwx2 = gwx gwy2 = gwy x = 0 For y = 0 To y2 Step -dy Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx1, gwy, gwx2, gwy) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, y) EndIf EndFor For y = 0 To y1 Step dy Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx1, gwy, gwx2, gwy) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, y) EndIf EndFor y = 0 For x = 0 To x2 Step dx Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx, gwy1, gwx, gwy2) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, x) EndIf EndFor For x = 0 To x1 Step -dx Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx, gwy1, gwx, gwy2) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, x) EndIf EndFor EndSub End>RQX345-8.sb< Start>RQX345.sb< ' Graph ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Last update 2015-06-12 ' Version 0.2 ' GraphicsWindow.Title = "Graph 0.2" Not = "True=False;False=True;" Form() GraphicsWindow.PenColor = "DimGray" dx = 0.1 Graph_Draw() Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Arial" GetTextFx() GraphicsWindow.DrawText(10, 10, "y=" + textFx) param = "x=10;" param["width"] = gw - 20 param["y"] = 30 param["height"] = gh - 40 Graph_SetGWViewPort() GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(param["x"], param["y"], param["width"], param["height"]) x1 = -6.5 param["x"] = x1 x2 = 6.5 param["width"] = x2 - x1 param["height"] = -param["width"] / (gw - 20) * (gh - 40) y1 = -param["height"] / 2 y2 = param["height"] / 2 param["y"] = y1 Graph_SetLogicalViewPort() GraphicsWindow.PenColor = "#99FFFF" dx = 0.1 dy = 0.1 Graph_DrawGrid() GraphicsWindow.PenColor = "#77CCCC" GraphicsWindow.BrushColor = "#559999" dx = 1 dy = 1 num = "True" Graph_DrawGrid() GraphicsWindow.PenColor = "Gray" GraphicsWindow.DrawRectangle(10, 30, gw - 20, gh - 40) ox = gwx1 + 300 oy = gwy1 + 300 EndSub Sub Fx y = Math.ArcTan(x) EndSub Sub GetTextFx textFx = "arctan x" EndSub Sub Graph_Draw For x = vp["x"] To vp["x"] + vp["width"] Step dx Fx() Graph_DrawLine() _x = x _y = y EndFor EndSub Sub Graph_SetGWViewPort ' param["x"] ' param["y"] ' param["width"] ' param["height"] gwvp = param EndSub Sub Graph_SetLogicalViewPort ' param["x"] ' param["y"] ' param["width"] ' param["height"] vp = param EndSub Sub Graph_ToGWCoordinate ' param x, y - logical co-ordinate ' return gwx, gwy - graphics window co-ordinate gwx = gwvp["x"] + (x - vp["x"]) / vp["width"] * gwvp["width"] gwy = gwvp["y"] + (y - vp["y"]) / vp["height"] * gwvp["height"] EndSub Sub Graph_DrawLine ' param x, y - logical point to endt line ' param _x, _y - logical point to start line sign = x / Math.Abs(x) Graph_ToGWCoordinate() If _gwx <> "" Then If y2 <= _y And _y <= y1 And y2 <= y And y <= y1 Then GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) ElseIf y2 <= _y And _y <= y1 Then Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", gwx) Stack.PushValue("local", gwy) If y < y2 Then k = (_y - y2) / (_y - y) x = (1 - k) * _x + k * x y = y2 Else k = (y1 - _y) / (y - _y) x = (1 - k) * _x + k * x y = y1 EndIf Graph_ToGWCoordinate() GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) gwy = Stack.PopValue("local") gwx = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") ElseIf y2 <= y And y <= y1 Then Stack.PushValue("local", x) Stack.PushValue("local", y) Stack.PushValue("local", gwx) Stack.PushValue("local", gwy) Stack.PushValue("local", _gwx) Stack.PushValue("local", _gwy) _gwx = gwx _gwy = gwy If _y < y2 Then k = (y - y2) / (y - _y) x = (1 - k) * x + k * _x y = y2 Else k = (y1 - y) / (_y - y) x = (1 - k) * x + k * _x y = y1 EndIf Graph_ToGWCoordinate() GraphicsWindow.DrawLine(_gwx, _gwy, gwx, gwy) _gwy = Stack.PopValue("local") _gwx = Stack.PopValue("local") gwy = Stack.PopValue("local") gwx = Stack.PopValue("local") y = Stack.PopValue("local") x = Stack.PopValue("local") EndIf EndIf _gwx = gwx _gwy = gwy EndSub Sub Graph_DrawGrid ' param x1, y1 - logical left top of the grid ' param x2, y2 - logical right bottom of the grid ' param dx, dy - logical grid pitch x = x1 y = y1 Graph_ToGWCoordinate() gwx1 = gwx gwy1 = gwy x = x2 y = y2 Graph_ToGWCoordinate() gwx2 = gwx gwy2 = gwy x = 0 For y = 0 To y2 Step -dy Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx1, gwy, gwx2, gwy) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, y) EndIf EndFor For y = 0 To y1 Step dy Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx1, gwy, gwx2, gwy) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, y) EndIf EndFor y = 0 For x = 0 To x2 Step dx Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx, gwy1, gwx, gwy2) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, x) EndIf EndFor For x = 0 To x1 Step -dx Graph_ToGWCoordinate() GraphicsWindow.DrawLine(gwx, gwy1, gwx, gwy2) If num Then GraphicsWindow.DrawText(gwx + 2, gwy, x) EndIf EndFor EndSub End>RQX345.sb< Start>RRF043.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>RRF043.sb< Start>RRF718.sb< GraphicsWindow.Title = "Neon Sign dd=";shadowdepth=8;opacity=.95;blurradius=15 px = 80 py = 90 Init() pc = "#00F" cll="blue S() M() A() L() L() NewLine() cll="magenta pc = "#F0F" B() A() S() I() C() Sub Arc If a1 < a2 Then da = 15 Else da = -15 EndIf GraphicsWindow.BrushColor = pc GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc For angle = a1 To a2 Step da x2 = ox + rx * ldMath.Cos(angle) y2 = oy + ry * ldMath.Sin(angle) If angle = a1 Then ss[si]=Shapes.AddEllipse (pw pw) Shapes.Move (ss[si] x2 - pw / 2, y2 - pw / 2) si=si+1 Else ss[si]=Shapes.AddLine (x1, y1, x2, y2) si=si+1 'ss[si]=Shapes.AddEllipse (pw pw) 'Shapes.Move (ss[si] x2 - pw / 2, y2 - pw / 2) 'si=si+1 EndIf x1 = x2 y1 = y2 EndFor EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#000044 fh = 100 fw = 70 pw = 6 gap = 20 _px = px EndSub Sub NewLine px = _px py = py + fh + gap EndSub Sub A For r=1 To 5 ss[r]=shapes.AddEllipse (pw pw) EndFor GraphicsWindow.BrushColor = pc shapes.Move(ss[1] px, py + fh - pw) GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc shapes.Move(ss[2] px + fw / 2 - pw / 2, py) ss[6]=shapes.addLine(px + pw / 2, py + fh - pw / 2, px + fw / 2, py + pw / 2) ss[7]=shapes.addLine(px + fw / 2, py + pw / 2, px + fw - pw / 2, py + fh - pw / 2) shapes.Move(ss[3] px + fw - pw, py + fh - pw) oy = py + fh / 2 + ry shapes.Move(ss[4] px + pw * 4 - pw / 2, oy - pw / 2) shapes.Move(ss[5] px + fw - pw * 4 - pw / 2, oy - pw / 2) ss[8]=shapes.addLine(px + pw * 4, oy, px + fw - pw * 4, oy) px = px + fw + gap For r=1 To 8 LDEffect.DropShaddow (ss[r] "color="+cll+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub Sub B rx = fw / 2 - pw / 2 ry = (fh / 2 - pw / 2) / 2 ox = px + fw / 2 oy = py + ry + pw / 2 a1 = 45 a2 = -90 Arc() GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc GraphicsWindow.BrushColor = pc GraphicsWindow.DrawLine(px + fw / 2, py + pw / 2, px + pw / 2, py + pw / 2) GraphicsWindow.FillEllipse(px, py, pw, pw) GraphicsWindow.DrawLine(px + pw / 2, py + pw / 2, px + pw / 2, py + fh - pw / 2) GraphicsWindow.FillEllipse(px, py + fh - pw, pw, pw) GraphicsWindow.DrawLine(px + fw / 2, py + fh - pw / 2, px + pw / 2, py + fh - pw / 2) oy = py + fh / 2 + ry a1 = 90 a2 = -90 Arc() GraphicsWindow.FillEllipse(px + pw * 3 / 2, py + fh / 2 - pw / 2, pw, pw) GraphicsWindow.DrawLine(px + pw * 2, py + fh / 2, px + fw / 2, py + fh / 2) px = px + fw + gap EndSub Sub C rx = fw / 2 - pw / 2 ry = (fh / 2 - pw / 2) / 2 ox = px + fw / 2 oy = py + ry + pw / 2 GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc ss[1]=shapes.addLine(ox - rx, oy, ox - rx, py + fh / 2 + ry) si=2 a1 = 0 a2 = -180 Arc() oy = py + fh / 2 + ry a1 = -180 a2 = -360 Arc() px = px + fw + gap For r=1 To si-1 LDEffect.DropShaddow (ss[r] "color=magenta"+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub Sub I GraphicsWindow.BrushColor = pc ss[1]=shapes.AddEllipse (pw pw) ss[2]=shapes.AddEllipse (pw pw) Shapes.Move (ss[1] px, py) Shapes.Move (ss[2] px, py + fh - pw) GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc ss[3]=shapes.addLine(px + pw / 2, py + pw / 2, px + pw / 2, py + fh - pw / 2) px = px + pw + gap For r=1 To 3 LDEffect.DropShaddow (ss[r] "color=magenta"+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub Sub L GraphicsWindow.BrushColor = pc For r=1 To 3 ss[r]=shapes.AddEllipse (pw pw) EndFor Shapes .Move (ss[1] px, py) Shapes.Move (ss[2] px, py + fh - pw) GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc ss[4]=shapes.addLine(px + pw / 2, py + pw / 2, px + pw / 2, py + fh - pw / 2) shapes.move(ss[3] px + fw/1.5 - pw, py + fh - pw) ss[5]=shapes.addLine(px + pw / 2, py + fh - pw / 2, px + fw/1.5 - pw / 2, py + fh - pw / 2) px = px + fw + gap/5 For r=1 To 5 LDEffect.DropShaddow (ss[r] "color=blue"+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub Sub M GraphicsWindow.BrushColor = pc For r=1 To 5 ss[r]=shapes.AddEllipse (pw pw) EndFor Shapes.Move (ss[1] px, py) Shapes.Move (ss[2] px, py + fh - pw) GraphicsWindow.PenWidth = pw GraphicsWindow.PenColor = pc ss[6]=shapes.addLine(px + pw / 2, py + pw / 2, px + pw / 2, py + fh - pw / 2) Shapes.Move (ss[3] px + fw / 2 - pw / 2, py + fh - pw) ss[7]=shapes.addLine(px + pw / 2, py + pw / 2, px + fw / 2, py + fh - pw / 2) ss[8]=shapes.addLine(px + fw / 2, py + fh - pw / 2, px + fw - pw / 2, py + pw / 2) Shapes.Move (ss[4] px + fw - pw, py) Shapes.Move (ss[5] px + fw - pw, py + fh - pw) ss[9]=shapes.addLine(px + fw - pw / 2, py + pw / 2, px + fw - pw / 2, py + fh - pw / 2) px = px + fw + gap For r=1 To 9 LDEffect.DropShaddow (ss[r] "color=blue"+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub sub S si=1 rx = fw / 2 - pw / 2 ry = (fh / 2 - pw / 2) / 2 ox = px + fw / 2 oy = py + ry + pw / 2 a1 = 0 a2 = -270 Arc() oy = py + fh / 2 + ry a1 = -90 a2 = 180 Arc() px = px + fw + gap For r=1 To si-1 LDEffect.DropShaddow (ss[r] "color="+cll+dd) LDShapes.AnimateOpacity (ss[r] 1500 0) EndFor EndSub End>RRF718.sb< Start>RRG519.sb< ' SmallBasic Version 1.2 ' Program: TheodorusSpiral ' Changelog: ' Author: Pappa Lapub ' Website: ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: https://de.wikipedia.org/wiki/Wurzelschnecke ' https://en.wikipedia.org/wiki/Spiral_of_Theodorus ' http://csharphelper.com/blog/2018/06/draw-the-spiral-of-theodorus-in-c/ ' ' Variables: a*a + 1 = c*c = n, tan(rad) = 1/a ' ToDo: '=============================================================================== max = 53 ' 32 180 l = 40 ' init. radius styl = 1 ' 0, 1, 2 (0 .. alternating, 1.. with, 2 .. w/o zIndex) gwh = 600 x0 = gwh / 2 y0 = x0 dh = 360 / max ' hue diff dl = 1/(max-1) ' light diff nCyc = 5 a = 1 x1 = x0 + l*a ' * Math.Cos(rad) y1 = y0 ' - l*a * Math.Sin(rad) gamma = 2.2 'LDGraphicsWindow.TransparentGW() GraphicsWindow.Top = 0 GraphicsWindow.CanResize = "" GraphicsWindow.Width = gwh GraphicsWindow.Height = gwh 'GraphicsWindow.BackgroundColor = "#202020" 'LDGraphicsWindow.BackgroundBrush(LDShapes.BrushGradient("1=Yellow;2=Red;","V")) LDGraphicsWindow.BackgroundBrush(LDShapes.BrushGradient("1=Black;2=#D2D3D4;","V")) GraphicsWindow.Title = "Theo's Spiral ["+ max +"]" ' The following line could be harmful and has been automatically commented. ' LDGraphicsWindow.Icon = SBFile.Expand("%SBICONS%\Spiral.ico") GraphicsWindow.PenWidth = 0 ' 1 'GraphicsWindow.PenColor = "Transparent" 'GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor ' "Transparent" For n = 1 To max c = Math.SquareRoot(n+1) rad = rad + Math.ArcTan(1/a) x2 = x0 + l*c * Math.Cos(rad) y2 = y0 - l*c * Math.Sin(rad) 'hue = dh * (n-1) ' starting "Red" = 0 hue = Math.Remainder(dh*n, 360) ' ending "Red" = 0 cols[n] = LDColours.HSLtoRGB(hue, 1 ,0.5) ' rainbow bw[n] = LDColours.HSLtoRGB(0, 0, (n-1)*dl) ' grayscale 'carn[n] = LDColours.HSLtoRGB(34, 0.93, 0.25+(n-1)*dl/2) ' carnation 'cr = 255 * Math.Power(LDColours.GetRed(bw[n]) / 255, gamma) 'cg = 255 * Math.Power(LDColours.GetGreen(bw[n]) / 255, gamma) 'cb = 255 * Math.Power(LDColours.GetBlue(bw[n]) / 255, gamma) 'bw[n] = GraphicsWindow.GetColorFromRGB(cr,cg,cb) ' grayscale gamma corrected 'rnd[n] = GraphicsWindow.GetRandomColor() ' random GraphicsWindow.BrushColor = cols[n] ' carn[n], rnd[n] tri = Shapes.AddTriangle(x0,y0, x1,y1, x2,y2) If styl = 1 Or styl = Math.Remainder(n,2) Then ' 1 Or alt. zIndex LDShapes.ZIndex(tri, -n) EndIf Program.Delay(100) a = c x1 = x2 y1 = y2 EndFor cc = cols GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown ' ////////////////// EVENTs /////////////////// Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "B" Or lastKey = "G" Then ' Cols <-> Grayscale BlackWhite() ElseIf lastKey = "R" Then ' Reverse CurCols Reverse() ElseIf lastKey = "O" Or lastKey = "W" Then ' Outline/Wireframe Outline() ElseIf lastKey = "Left" Then ' Rotate CCW sgn = -1 Rotate() ElseIf lastKey = "Right" Then ' Rotate CW sgn = 1 Rotate() ElseIf lastKey = "S" Then ff = ff + 1 ' The following line could be harmful and has been automatically commented. ' File.WriteContents(Program.Directory +"\TheosSpiral_"+ ff +".txt", cols) EndIf EndSub Sub OnMouseDown If Mouse.IsLeftButtonDown Then ' In -> Out ScrollOut() ElseIf Mouse.IsRightButtonDown Then ' Out -> In ScrollIn() Else ' If Mouse.IsMiddleButtonDown Zoom() EndIf EndSub ' //////////////////// SUBs //////////////////// Sub Reverse rev = cc For n = 1 To max rev[n] = cc[max-n+1] LDShapes.BrushColour("Triangle"+n, rev[n]) EndFor cc = rev rev = "" EndSub Sub BlackWhite ' Grayscale If isBW Then cc = cols Else cc = bw EndIf SetCurCols() isBW = LDLogic.Not(isBW) EndSub Sub SetCurCols For n = 1 To max LDShapes.BrushColour("Triangle"+n, cc[n]) EndFor EndSub Sub Rotate ang = ang + sgn * nCyc * 360 LDGraphicsWindow.Animate(1,1, 0,0, ang,(nCyc*1500)) 'For deg = sgn To (sgn*nCyc*360) Step sgn ' LDGraphicsWindow.Reposition(1,1, 0,0, deg) ' Program.Delay(5) 'EndFor EndSub Sub Outline If wire Then pw = 0 pc = "Transparent" Else pw = 1 pc = "Black" EndIf wire = LDLogic.Not(wire) For n = 1 To max LDShapes.PenWidth("Triangle"+n, pw) LDShapes.PenColour("Triangle"+n, pc) EndFor EndSub Sub ScrollOut For j = 1 To nCyc For i = 1 To max 'bg = Math.Remainder(max+max-1-i,max)+1 For n = max To 1 Step -1 nn = Math.Remainder(max+n-1-i, max) + 1 LDShapes.BrushColour("Triangle"+n, cc[nn]) EndFor 'GraphicsWindow.BackgroundColor = cc[bg] ' cc[Math.Remainder(max+max-1-i,max)+1] Program.Delay(20) EndFor EndFor EndSub Sub ScrollIn For j = 1 To nCyc For i = 1 To max For n = 1 To max nn = Math.Remainder(n-1+i, max) + 1 LDShapes.BrushColour("Triangle"+n, cc[nn]) EndFor 'GraphicsWindow.BackgroundColor = cc[nn] Program.Delay(20) EndFor EndFor EndSub Sub Zoom 'For n = 1 To 2.5 Step 0.015 For n = 1 To 5 Step 0.015 ' 1.5/100 LDGraphicsWindow.Reposition(n,n, 0,0, 0) Program.Delay(20) EndFor Program.Delay(2000) 'For n = 2.5 To 1 Step -0.015 For n = 5 To 1 Step -0.015 ' -1.5/100 LDGraphicsWindow.Reposition(n,n, 0,0, 0) Program.Delay(20) EndFor EndSub Sub Zoom_Anim 'For n = 1 To LDGraphicsWindow.Animate(2.5,2.5, 0,0, 0,3000) 'LDGraphicsWindow.Animate(-2.5,-2.5, 0,0, 0,3000) 'LDGraphicsWindow.Animate(-5,-5, 0,0, 0,6000) 'Program.Delay(3000) LDGraphicsWindow.Animate(-2.5,-2.5, 0,0, 0,6000) EndSub Sub Rotate_0 r = gwh '* Math.SquareRoot(2) img = LDGraphicsWindow.Capture("","") 'LDImage.Resize(img, r,r) GraphicsWindow.Clear() s = Math.SquareRoot(2) GraphicsWindow.Width = gwh / s GraphicsWindow.Height = GraphicsWindow.Width shp = Shapes.AddImage(img) d = (r-gwh) / 2 Shapes.Move(shp, -d,-d) 'Shapes.Zoom(shp, s,s) LDShapes.AnimateRotation(shp, 1000,"") EndSub End>RRG519.sb< Start>RRH635.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[1289563074>=+-:, " 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="# 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 + = > - : ," " ") For h=1 to 42 thh=chm[h] LDCall.Function("gench" thh) LDCall.Function("gencb" thh) If h<27 Then LDCall.Function("gencm" thh) EndIf jj[thh]=LDImage.Copy(ii[thh]) LDImage.ReplaceColour(ii[thh] "red" "white" 5) LDImage.ReplaceColour(ii[thh] "blue" "black" 5) LDImage.ReplaceColour(jj[thh] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(jj[thh] "red" "black" 5) LDImage.ReplaceColour(kk[thh] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(kk[thh] "red" "lime" 5) LDImage.ReplaceColour(im[thh] "blue" "DarkSlateGray" 5) LDImage.ReplaceColour(im[thh] "red" "black" 5) EndFor GraphicsWindow.KeyDown=kkk ss=1 ttw="1=1;2=3;3=4 LDCall.Function5("print" 1 20 "[1982 SINCLAIR" "teal" 2) LDCall.Function5("print" 16 20 "RESEARCH LTD " "teal" 4) Program.Delay(1333) GraphicsWindow.Clear() lll: LDCall.Function5("print" 1 1 "10 INPUT A" "teal" 2) LDCall.Function5("print" 1 2 "20 LET B=2 : LET C=3" "teal" 2) LDCall.Function5("print" 1 3 "30>PRINT A+B,C-A" "teal" 2) for x=1 to 4 LDCall.Function5("print" 1 21 "K" "teal" 1) Program.Delay(455) LDCall.Function5("print" 1 21 "K" "teal" 2) Program.Delay(455) EndFor LDCall.Function5("print" 1 21 "RUN" "teal" 2) LDCall.Function5("print" 5 21 "L" "teal" 1) Program.Delay(755) GraphicsWindow.Clear() 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) if brk Then goto xxx EndIf EndWhile xxx: GraphicsWindow.Clear() brk="false LDCall.Function5("print" 1 21 "D BREAK 0:1" "teal" 2) Program.Delay(1377) GraphicsWindow.Clear() LDCall.Function5("print" 1 21 "LIST" "teal" 2) LDCall.Function5("print" 6 21 "L" "teal" 1) Program.Delay(1377) GraphicsWindow.Clear() goto lll Sub kkk'--------------------------------*********************--KEYS ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) If ll="right" Then ss=ss+1 ElseIf ll="left" Then ss=ss-1 ElseIf ll="escape" Then brk="true EndIf GraphicsWindow.Title=ss 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=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 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>RRH635.sb< Start>RRH745.sb< 'Arrow-button DirScreens="D:\data\Small-Basic\Garmin-emulation\GPS-Screens\" w = 250 h = 500 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.Top = 50 GraphicsWindow.Left = 50 GraphicsWindow.FontSize = 15 TextWindow.left=550 TextWindow.top =50 textwindow.writeline("w= "+w+" h= "+h+" top= "+GraphicsWindow.Top+" left= "+GraphicsWindow.Left) GraphicsWindow.PenWidth = 5 GraphicsWindow.PenColor = "Black" GraphicsWindow.title=" Garmin GPSMAP 66s" GraphicsWindow.fontsize=12 'xxxxxxxxxxxxxx MAIN PROGRAM xxxxxxxxxxxxxxx setoperator() power="on" CreateGUI() ConnectorOuiNon() 'StartGpsScreens() GraphicsWindow.MouseDown=MouseDown 'waiting for input and will execute each time the Mouse subroutine 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub CreateGUI 'GraphicsWindow.BrushColor = "darkgrey" GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "White" Field[1]="Texte=PLUS;FH=15;FV=345;FHS=50;FVS=30;TH=22;TV=352;Key=0" Field[2]="Texte=FIND;FH=15;FV=385;FHS=50;FVS=30;TH=22;TV=392;Key=0" Field[3]="Texte=MARK;FH=15;FV=425;FHS=50;FVS=30;TH=22;TV=432;Key=0" Field[4]="Texte=QUIT;FH=35;FV=465;FHS=70;FVS=30;TH=52;TV=472;Key=0" Field[5]="Texte=MIN;FH=185;FV=345;FHS=50;FVS=30;TH=197;TV=352;Key=0" Field[6]="Texte=PAGE;FH=185;FV=385;FHS=50;FVS=30;TH=193;TV=392;Key=0" Field[7]="Texte=MENU;FH=185;FV=425;FHS=50;FVS=30;TH=193;TV=432;Key=0" Field[8]="Texte=ENTER;FH=145;FV=465;FHS=70;FVS=30;TH=160;TV=472;Key=0" Field[9]="Texte=UP;FH=102;FV=350;FHS=50;FVS=30;TH=119;TV=358;Key=0" Field[10]="Texte=LEFT;FH=77;FV=385;FHS=45;FVS=30;TH=85;TV=392;Key=0" Field[11]="Texte=RIGHT;FH=128;FV=385;FHS=45;FVS=30;TH=130;TV=392;Key=0" Field[12]="Texte=DOWN;FH=102;FV=420;FHS=50;FVS=30;TH=107;TV=426;Key=0" Field[13]="Texte=GPSPOWER;FH=234;FV=5;FHS=10;FVS=10;TH=235;TV=2;Key=1" For x=1 to 13 GraphicsWindow.DrawRectangle(Field[x]["FH"],Field[x]["FV"],Field[x]["FHS"],Field[x]["FVS"]) GraphicsWindow.drawtext(Field[x]["TH"],Field[x]["TV"],Field[x]["Texte"]) Endfor GraphicsWindow.Backgroundcolor="DimGray" GraphicsWindow.BrushColor = "black" EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Sub MouseDown ''WhT mx=GraphicsWindow.MouseX my=GraphicsWindow.MouseY TextWindow.WriteLine( " " ) TextWindow.WriteLine("mx = "+mx +" my= "+my) operator=0 for x=1 to 13 'if Field[x]["Key"]=1 then If (mx>Field[x]["FH"] and (mxField[x]["FV"] and (my "+Field[x]["FH"]+"(FH) "+mx+ " < " +(Field[x]["FH"]+Field[x]["FHS"]+"(FH + FHS)")) TextWindow.WriteLine( my+ " > "+Field[x]["FV"]+"(FV) "+my+ " < " +(Field[x]["FV"]+Field[x]["FVS"]+"(FV + FVS)" )) operator =Field[x]["Texte"] TextWindow.WriteLine("operator "+x+" = "+ operator) Sound.PlayClick() ' EndIf EndIf 'TextWindow.WriteLine("operator = "+ operator) endfor setoperator() ButtonDown() EndSub Sub ButtonDown If operator="UP" Then TextWindow.WriteLine("operator : "+operator+" call subroutine SubUp") SubUp() ' GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\001.jpg", 25, 10, 200, 325) elseif operator="LEFT" Then TextWindow.WriteLine("operator : "+operator+" call subroutine") elseif operator="Right" Then TextWindow.WriteLine("operator : "+operator+" call subroutine") elseif operator="DOWN" Then TextWindow.WriteLine("operator : "+operator+" call SubDown") SubDown() ' TextWindow.WriteLine("operator : "+operator+" call SubDown") elseif operator="PLUS" Then TextWindow.WriteLine("operator : "+operator+" call subroutine") elseif operator="FIND" Then TextWindow.WriteLine("operator : "+operator+" call subroutine 99") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\99.bmp", 25, 10, 200, 325) elseif operator="MARK" Then TextWindow.WriteLine("operator : "+operator+" call subroutine 1977") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\1977.bmp", 25, 10, 200, 325) elseif operator="QUIT" Then TextWindow.WriteLine("operator : "+operator+" call subroutine 134") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\134.bmp", 25, 10, 200, 325) elseif operator="MIN" Then TextWindow.WriteLine("operator : "+operator+" call subroutine") elseif operator="PAGE" Then TextWindow.WriteLine("operator : "+operator+" call subroutine 2012") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\2012.bmp", 25, 10, 200, 325) elseif operator="MENU" Then TextWindow.WriteLine("operator : "+operator+" call subroutine") elseif operator="ENTER" Then TextWindow.WriteLine("operator : "+operator+" call SubEnter") SubEnter() 'imageflow() 'test elseif operator="GPSPOWER" Then TextWindow.WriteLine("operator : "+operator+" call connector") connectorOuiNon() else 'operator="" TextWindow.WriteLine("operator : "+operator+" No operator detected subroutine line 122") endif EndSub 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx SUB setoperator if power="off" Then Field[8]["Key"]=1 'ENTER Field[9]["Key"]=1 'UP Field[12]["Key"]=1 'DOWN Field[13]["Key"]=1 'GPSPOWER EndIf endsub SUB StartGpsScreens if power="on" Then GraphicsWindow.BrushColor = "green" GraphicsWindow.fillRectangle(234,5,10,10) Else GraphicsWindow.BrushColor = "green" GraphicsWindow.fillRectangle(234,5,10,10) endif GraphicsWindow.brushcolor="Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawRectangle(25,10,200,325) TextWindow.WriteLine("loading : "+DirScreens+"Garmin.jpg") GraphicsWindow.DrawResizedImage(DirScreens+"Garmin.jpg", 25, 10, 200, 325) interval=2000 Delayloop() TextWindow.WriteLine("loading : "+DirScreens+"start.jpg") GraphicsWindow.DrawResizedImage(DirScreens+"start.jpg", 25, 10, 200, 325) interval=3000 Delayloop() TextWindow.WriteLine("loading : "+DirScreens+"start-loading.jpg") GraphicsWindow.DrawResizedImage(DirScreens+"start-loading-1.jpg", 25, 10, 200, 325) interval=1000 Delayloop() GraphicsWindow.DrawResizedImage(DirScreens+"start-loading-2.jpg", 25, 10, 200, 325) Delayloop() GraphicsWindow.DrawResizedImage(DirScreens+"start-loading-3.jpg", 25, 10, 200, 325) Delayloop() GraphicsWindow.DrawResizedImage(DirScreens+"start-loading-4.jpg", 25, 10, 200, 325) Delayloop() TextWindow.WriteLine("loading : "+DirScreens+"carte.bmp") GraphicsWindow.DrawResizedImage(DirScreens+"carte.bmp", 25, 10, 200, 325) EndSub Sub ConnectorOuiNon if power="off" Then GraphicsWindow.BrushColor = "red" GraphicsWindow.fillRectangle(234,5,10,10) power="on" Else power="off" GraphicsWindow.BrushColor = "green" GraphicsWindow.fillRectangle(234,5,10,10) StartGPSScreens() endif GraphicsWindow.BrushColor = "red" GraphicsWindow.fillRectangle(234,5,10,10) TextWindow.WriteLine("operator : "+operator+"saving wp") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\SavingWP.jpg", 25, 10, 200, 325) interval=12000 Delayloop() TextWindow.WriteLine("operator : "+operator+"loading map oui-non") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\oui-non.jpg", 25, 10, 200, 325) Field[12]["Key"]=1 'DOWN SubDownvar="OuiNon" EndSub Sub SubDown TextWindow.WriteLine("Subdownroutine loading map non-oui") if SubDownvar="OuiNon" Then TextWindow.WriteLine("operator : "+operator+"loading map non-oui") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\non-oui.jpg", 25, 10, 200, 325) SubDownvar="NonOui" EndIf setoperator() endsub Sub SubUp TextWindow.WriteLine("Subdownroutine loading map oui-non") if SubDownvar="NonOui" Then TextWindow.WriteLine("operator : "+operator+"loading map oui-non") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\oui-non.jpg", 25, 10, 200, 325) SubDownvar="NonOui" EndIf setoperator() endsub sub connectorOui ' TextWindow.WriteLine("operator : "+operator+"loading map non-oui") ' GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\non-oui.jpg", 25, 10, 200, 325) TextWindow.WriteLine("operator : "+operator+"saving wp") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\SavingWP.jpg", 25, 10, 200, 325) Delayloop() TextWindow.WriteLine("loading : "+DirScreens+"carte.bmp") GraphicsWindow.DrawResizedImage(DirScreens+"carte.bmp", 25, 10, 200, 325) setoperator() Endsub sub connectorNon ' TextWindow.WriteLine("operator : "+operator+"loading map non-oui") ' GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\non-oui.jpg", 25, 10, 200, 325) TextWindow.WriteLine("operator : "+operator+"saving wp") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\SavingWP.jpg", 25, 10, 200, 325) Delayloop() TextWindow.WriteLine("operator : "+operator+"loading connector") GraphicsWindow.DrawResizedImage("D:\data\Small-Basic\Garmin-emulation\GPS-screens\connector.jpg", 25, 10, 200, 325) Delayloop() Endsub Sub SubEnter if SubDownvar="OuiNon" then ConnectorOui() endif if SubDownvar="NonOui" then ConnectorNon() endif endsub sub delayloop interval=8000 x=0 while xRRH745.sb< Start>RRK490.sb< a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" TextWindow.WriteLine("Enter a letter") l1 = Text.ConvertToUpperCase(TextWindow.Read()) TextWindow.WriteLine("Enter a letter") l2 = Text.ConvertToUpperCase(TextWindow.Read()) If Text.GetLength(l1) = 1 And Text.GetLength(l2) = 1 Then TextWindow.WriteLine(Text.GetSubText(a,Text.GetIndexOf(a,l1),Text.GetIndexOf(a,l2))) EndIf End>RRK490.sb< Start>RRL622.sb< GraphicsWindow.Title = "Zodiac 5" wrap = "True gw = 1670 gh = 800 LDUtilities.ShowErrors ="false LDUtilities.ShowNoShapeErrors ="false GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#000055 star=0 qi=1 GraphicsWindow.MouseMove=moom Shapes_Init() scale = 1 angle = 0 Shapes_Add() InitStars()'----------------fishes num = Array.GetItemCount(star) index = Array.GetAllIndices(star) offsetX = 0 offsetY = 0 GetMinMax() offsetX = -xMin + 50 offsetY = -yMin + 90 DrawGrids() sdrw() qi=2 Shapes_Initcc()'-------------capricorn scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarscc() num = Array.GetItemCount(star) index = Array.GetAllIndices(star) sdrw() qi=3'-----------------------aquarius Shapes_Initaq() scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarsaq() num = Array.GetItemCount(star) index = Array.GetAllIndices(star) sdrw() qi=4'----------------------aries Shapes_Initary() scale = 1 angle = 0 Shapes_Add() star=0 InitStarsary() num = Array.GetItemCount(star) index = Array.GetAllIndices(star) sdrw() qi=5'------------------------cancer shpcnc() scale = 1 angle = 0 Shapes_Add() star=0 initscnc () num = Array.GetItemCount(star) index = Array.GetAllIndices(star) sdrw() LDFastShapes.Update () ds=95 For s= 1 to 10 dooff () Program.Delay (333) endfor LDEvents.MouseWheel=wll inn=0 Sub sdrw GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DarkGray nume = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) For i = 1 To nume e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y ly=Shapes.AddLine(x1, y1, x2, y2) lyn[qi][i]=LDFastShapes.ShapeIndex (ly) EndFor LDFastShapes.Update () num = Array.GetItemCount(star) index = Array.GetAllIndices(star) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() mag = star[index[i]]["Mag"] d = 20 / mag ell = Shapes.AddEllipse(d, d) el[qi][i]=LDFastShapes.ShapeIndex (ell) ldfastShapes.Move(el[qi][i], x - d / 2, y - d / 2) EndFor EndSub Sub moom GraphicsWindow.Title="Zodiac scroll 'GraphicsWindow.Title=GraphicsWindow.MouseX +" , "+GraphicsWindow.MouseY EndSub Sub wll If inn=0 then inn=1 ds=LDEvents.LastMouseWheelDelta *25 off=off+ds 'GraphicsWindow.Title=off dooff() inn=0 endif EndSub sub dooff For qi=1 To 5 For i = 1 To Array.GetItemCount (el[qi]) LDFastShapes.Move (el[qi][i],LDFastShapes.GetLeft (el[qi][i])+ds, LDFastShapes.GetTop (el[qi][i])) EndFor For i = 1 To Array.GetItemCount (ffs[qi]) LDFastShapes.Move (ffs[qi][i],LDFastShapes.GetLeft (ffs[qi][i])+ds, LDFastShapes.GetTop (ffs[qi][i])) EndFor For i = 1 To Array.GetItemCount (lyn[qi]) LDFastShapes.Move (lyn[qi][i],LDFastShapes.GetLeft (lyn[qi][i])+ds, LDFastShapes.GetTop (lyn[qi][i])) EndFor EndFor LDFastShapes.Update () For i=1 to Array.GetItemCount (txx) Shapes.Move (txx[i],shapes.GetLeft (txx[i])+ds, Shapes.GetTop (txx[i])) EndFor For i=1 to Array.GetItemCount (ltx) Shapes.Move (ltx[i], Shapes.GetLeft (ltx[i])+ds,1) EndFor EndSub Sub GetMinMax For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() ra1 = Text.GetSubText(ra, 1, 2) If wrap And 12 < ra1 Then ra1 = ra1 - 24 EndIf If i = 1 Then raMin = ra1 decMin = Text.GetSubText(dec, 1, 3) raMax = ra1 decMax = Text.GetSubText(dec, 1, 3) xMin = x yMin = y xMax = x yMax = y Else raMin = Math.Min(ra1, raMin) decMin = Math.Min(Text.GetSubText(dec, 1, 3), decMin) raMax = Math.Max(ra1, raMax) decMax = Math.Max(Text.GetSubText(dec, 1, 3), decMax) xMin = Math.Min(x, xMin) yMin = Math.Min(y, yMin) xMax = Math.Max(x, xMax) yMax = Math.Max(y, yMax) EndIf EndFor decMin = Math.Floor(decMin / 10) * 10 raMax = raMax + 1 decMax = decMax + 1 EndSub Sub InitStars star[99] = "name=η Psc;ra=01 31 28.99;dec=+15 20 45.0;mag=3.62;" star[6] = "name=γ Psc;ra=23 17 09.49;dec=+03 16 56.1;mag=3.70;" star[28] = "name=ω Psc;ra=23 59 18.60;dec=+06 51 48.9;mag=4.03;" star[17] = "name=ι Psc;ra=23 39 56.82;dec=+05 37 38.5;mag=4.13;" star[110] = "name=ο Psc;ra=01 45 23.59;dec=+09 09 27.5;mag=4.26;" star[71] = "name=ε Psc;ra=01 02 56.66;dec=+07 53 24.3;mag=4.27;" star[10] = "name=θ Psc;ra=23 27 58.17;dec=+06 22 44.8;mag=4.27;" star[113] = "name=α Psc A;ra=02 02 02.80;dec=+02 45 49.5;mag=4.33;" star[30] = "name=30 Psc;ra=00 01 57.59;dec=−06 00 50.3;mag=4.37;" star[63] = "name=δ Psc;ra=00 48 40.90;dec=+07 35 06.7;mag=4.44;" star[106] = "name=ν Psc;ra=01 41 25.91;dec=+05 29 15.4;mag=4.45;" star[4] = "name=β Psc;ra=23 03 52.61;dec=+03 49 12.3;mag=4.48;" star[18] = "name=λ Psc;ra=23 42 02.88;dec=+01 46 49.5;mag=4.49;" star[83] = "name=τ Psc;ra=01 11 39.59;dec=+30 05 23.0;mag=4.51;" star[33] = "name=33 Psc;ra=00 05 20.15;dec=−05 42 28.2;mag=4.61;" star[111] = "name=ξ Psc;ra=01 53 33.34;dec=+03 11 14.9;mag=4.61;" star[84] = "name=χ Psc;ra=01 11 27.19;dec=+21 02 04.8;mag=4.66;" star[85] = "name=φ Psc;ra=01 13 44.94;dec=+24 35 01.6;mag=4.67;" star[90] = "name=υ Psc;ra=01 19 27.98;dec=+27 15 50.7;mag=4.74;" star[98] = "name=μ Psc;ra=01 30 10.94;dec=+06 08 38.2;mag=4.84;" star[27] = "name=27 Psc;ra=23 58 40.41;dec=−03 33 20.9;mag=4.88;" star[8] = "name=κ Psc;ra=23 26 55.91;dec=+01 15 21.0;mag=4.95;" star[19] = "name=19 Psc;ra=23 46 23.54;dec=+03 29 12.7;mag=4.95;" star[47] = "name=47 Psc;ra=00 28 02.84;dec=+17 53 35.1;mag=5.01;" star[7] = "name=7 Psc;ra=23 20 20.54;dec=+05 22 53.2;mag=5.05;" star[64] = "name=64 Psc;ra=00 48 58.71;dec=+16 56 28.1;mag=5.07;" star[29] = "name=29 Psc;ra=00 01 49.44;dec=−03 01 38.9;mag=5.13;" star[89] = "name=89 Psc;ra=01 17 47.98;dec=+03 36 52.3;mag=5.13;" star[82] = "name=82 Psc;ra=01 11 06.77;dec=+31 25 29.2;mag=5.15;" star[86] = "name=ζ Psc A;ra=01 13 43.80;dec=+07 34 31.8;mag=5.21;" star[113] = "name=α Psc B;ra=02 02 02.80;dec=+02 45 49.0;mag=5.23;" star[91] = "name=91 Psc;ra=01 21 07.35;dec=+28 44 18.2;mag=5.23;" star[107] = "name=107 Psc;ra=01 42 29.95;dec=+20 16 12.5;mag=5.24;" star[74] = "name=ψ¹ Psc;ra=01 05 40.93;dec=+21 28 23.6;mag=5.33;" star[93] = "name=ρ Psc;ra=01 26 15.28;dec=+19 10 20.4;mag=5.35;" star[55] = "name=55 Psc;ra=00 39 55.55;dec=+21 26 18.8;mag=5.36;" star[57] = "name=57 Psc;ra=00 46 32.98;dec=+15 28 32.2;mag=5.36;" star[41] = "name=41 Psc;ra=00 20 35.86;dec=+08 11 24.9;mag=5.38;" star[52] = "name=52 Psc;ra=00 32 35.40;dec=+20 17 40.0;mag=5.38;" star[5] = "name=5 Psc;ra=23 08 40.84;dec=+02 07 39.4;mag=5.42;" star[2] = "name=2 Psc;ra=22 59 27.40;dec=+00 57 47.1;mag=5.43;" star[68] = "name=68 Psc;ra=00 57 50.15;dec=+28 59 32.0;mag=5.44;" star[20] = "name=20 Psc;ra=23 47 56.49;dec=−02 45 41.8;mag=5.49;" star[69] = "name=σ Psc;ra=01 02 49.09;dec=+31 48 15.6;mag=5.50;" star[94] = "name=94 Psc;ra=01 26 41.65;dec=+19 14 26.0;mag=5.50;" star[58] = "name=58 Psc;ra=00 47 01.43;dec=+11 58 26.2;mag=5.51;" star[80] = "name=80 Psc;ra=01 08 22.34;dec=+05 39 00.8;mag=5.51;" star[34] = "name=34 Psc;ra=00 10 02.18;dec=+11 08 44.9;mag=5.54;" star[102] = "name=π Psc;ra=01 37 05.96;dec=+12 08 29.4;mag=5.54;" star[74] = "name=ψ¹ Psc;ra=01 05 41.68;dec=+21 27 55.7;mag=5.55;" star[79] = "name=ψ² Psc;ra=01 07 57.11;dec=+20 44 21.6;mag=5.56;" star[81] = "name=ψ³ Psc;ra=01 09 49.20;dec=+19 39 30.2;mag=5.57;" star[22] = "name=22 Psc;ra=23 51 57.83;dec=+02 55 49.5;mag=5.59;" star[72] = "name=72 Psc;ra=01 05 05.35;dec=+14 56 45.6;mag=5.64;" star[16] = "name=16 Psc;ra=23 36 23.35;dec=+02 06 07.5;mag=5.68;" star[51] = "name=51 Psc;ra=00 32 23.75;dec=+06 57 19.6;mag=5.69;" star[32] = "name=32 Psc;ra=00 02 29.76;dec=+08 29 08.1;mag=5.70;" star[44] = "name=44 Psc;ra=00 25 24.22;dec=+01 56 23.0;mag=5.77;" star[21] = "name=21 Psc;ra=23 49 27.48;dec=+01 04 34.3;mag=5.77;" star[66] = "name=66 Psc;ra=00 54 35.22;dec=+19 11 18.4;mag=5.80;" star[54] = "name=54 Psc;ra=00 39 22.09;dec=+21 15 04.9;mag=5.88;" star[53] = "name=53 Psc;ra=00 36 47.31;dec=+15 13 54.3;mag=5.89;" star[112] = "name=112 Psc;ra=02 00 09.02;dec=+03 05 51.5;mag=5.89;" star[14] = "name=14 Psc;ra=23 34 08.95;dec=−01 14 51.1;mag=5.91;" star[62] = "name=62 Psc;ra=00 48 17.34;dec=+07 17 59.7;mag=5.92;" star[24] = "name=24 Psc;ra=23 52 55.52;dec=−03 09 19.4;mag=5.93;" star[87] = "name=87 Psc;ra=01 14 07.65;dec=+16 08 00.8;mag=5.97;" star[60] = "name=60 Psc;ra=00 47 23.62;dec=+06 44 27.5;mag=5.98;" star[105] = "name=105 Psc;ra=01 39 40.77;dec=+16 24 21.2;mag=5.98;" star[97] = "name=97 Psc;ra=01 29 52.83;dec=+18 21 20.4;mag=6.01;" star[35] = "name=35 Psc;ra=00 14 58.78;dec=+08 49 15.7;mag=6.02;" star[73] = "name=73 Psc;ra=01 04 52.62;dec=+05 39 22.7;mag=6.03;" star[88] = "name=88 Psc;ra=01 14 42.40;dec=+06 59 42.7;mag=6.04;" star[48] = "name=48 Psc;ra=00 28 12.69;dec=+16 26 42.4;mag=6.05;" star[67] = "name=67 Psc;ra=00 55 58.52;dec=+27 12 33.7;mag=6.08;" star[59] = "name=59 Psc;ra=00 47 13.56;dec=+19 34 43.3;mag=6.11;" star[1] = "name=1 Psc;ra=22 54 59.47;dec=+01 03 53.6;mag=6.11;" star[36] = "name=36 Psc;ra=00 16 34.06;dec=+08 14 24.7;mag=6.12;" star[75] = "name=75 Psc;ra=01 06 33.62;dec=+12 57 21.5;mag=6.14;" star[3] = "name=3 Psc;ra=23 00 37.88;dec=+00 11 09.0;mag=6.22;" star[26] = "name=26 Psc;ra=23 55 07.78;dec=+07 04 15.7;mag=6.22;" star[78] = "name=78 Psc;ra=01 08 01.20;dec=+32 00 43.9;mag=6.23;" star[101] = "name=101 Psc;ra=01 35 46.44;dec=+14 39 41.2;mag=6.23;" star[42] = "name=42 Psc;ra=00 22 25.45;dec=+13 28 56.8;mag=6.25;" star[9] = "name=9 Psc;ra=23 27 14.77;dec=+01 07 21.7;mag=6.26;" star[109] = "name=109 Psc;ra=01 44 55.85;dec=+20 05 00.3;mag=6.27;" star[76] = "name=76 Psc;ra=01 06 11.20;dec=+32 10 53.6;mag=6.28;" star[25] = "name=25 Psc;ra=23 53 04.75;dec=+02 05 26.3;mag=6.29;" star[31] = "name=31 Psc;ra=00 02 24.17;dec=+08 57 24.6;mag=6.33;" star[77] = "name=77 Psc A;ra=01 05 49.22;dec=+04 54 31.2;mag=6.35;" star[13] = "name=13 Psc;ra=23 31 57.56;dec=−01 05 09.3;mag=6.39;" star[46] = "name=46 Psc;ra=00 27 58.48;dec=+19 30 50.7;mag=6.40;" star[86] = "name=ζ Psc B;ra=01 13 45.17;dec=+07 34 42.2;mag=6.44;" star[15] = "name=15 Psc;ra=23 35 28.61;dec=+01 18 47.5;mag=6.47;" star[43] = "name=43 Psc;ra=00 24 38.15;dec=+14 18 55.9;mag=6.48;" star[61] = "name=61 Psc;ra=00 47 54.73;dec=+20 55 31.1;mag=6.51;" star[40] = "name=40 Psc;ra=00 19 56.28;dec=+16 15 03.2;mag=6.60;" star[38] = "name=38 Psc;ra=00 17 24.50;dec=+08 52 34.8;mag=6.66;" star[104] = "name=104 Psc;ra=01 39 15.39;dec=+14 17 08.3;mag=6.74;" star[45] = "name=45 Psc;ra=00 25 41.89;dec=+07 41 28.4;mag=6.77;" star[65] = "name=65 Psc;ra=00 49 53.11;dec=+27 42 37.1;mag=7.0;" star[95] = "name=95 Psc;ra=01 27 39.81;dec=+05 21 11.2;mag=7.01;" star[65] = "name=65 Psc;ra=00 49 53.20;dec=+27 42 37.0;mag=7.1;" star[77] = "name=77 Psc B;ra=01 05 51.42;dec=+04 54 35.0;mag=7.26;" star[100] = "name=100 Psc;ra=01 34 51.61;dec=+12 33 31.2;mag=7.28;" 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 Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.FontSize = 12 y1 = 0 ww=1 y2 = GraphicsWindow.Height For ra = 0 To 23 RADec2XY() ltx[ww]=Shapes.AddLine(x, y1, x, y2) raTxt = ra If wrap And raTxt < 0 Then raTxt = raTxt + 24 EndIf txx[ww] = Shapes.AddText(raTxt + "h") Shapes.Move(txx[ww], x, 5) ww=ww+1 EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -40 To 40 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() Shapes.AddLine(x1, y, x2, y) txt = Shapes.AddText(dec) Shapes.Move(txt, x1, y) EndFor EndSub Sub RADec2XY ' param ra - right ascension ' param dec - declination ' return x, y x = Text.GetSubText(ra, 1, 2) If wrap And 12 < x Then x = x - 24 EndIf x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = offsetX - (x - raMin) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = offsetY - y * 3600 / 360 EndSub Sub Shapes_Init shX = 41 ' x offset shY = 110 ' y offset shape = "" shape[1] = "func=ell;x=76;y=10;width=63;height=119;angle=23;bc=#2F559D;pw=0;" shape[2] = "func=tri;x=70;y=94;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=25;bc=#2F559D;pw=0;" shape[3] = "func=tri;x=108;y=0;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=199;bc=#000055;pw=0;" shape[4] = "func=ell;x=118;y=34;width=20;height=21;bc=#000055;pw=0;" shape[5] = "func=ell;x=74;y=40;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[6] = "func=ell;x=121;y=72;width=15;height=40;angle=17;bc=#2F559D;pw=0;" shape[7] = "func=ell;x=342;y=195;width=63;height=119;angle=106;bc=#2F559D;pw=0;" shape[8] = "func=tri;x=304;y=210;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=105;bc=#2F559D;pw=0;" shape[9] = "func=tri;x=401;y=258;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=295;bc=#000055;pw=0;" shape[10] = "func=ell;x=397;y=243;width=20;height=21;bc=#000055;pw=0;" shape[11] = "func=ell;x=367;y=203;width=15;height=40;angle=112;bc=#2F559D;pw=0;" shape[12] = "func=ell;x=361;y=271;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[13] = "func=line;x=43;y=130;x1=39;y1=0;x2=0;y2=72;pc=#2F559D;pw=8;" shape[14] = "func=line;x=0;y=201;x1=0;y1=74;x2=44;y2=0;pc=#2F559D;pw=8;" shape[15] = "func=line;x=2;y=238;x1=0;y1=35;x2=42;y2=0;pc=#2F559D;pw=8;" shape[16] = "func=line;x=41;y=242;x1=18;y1=31;x2=0;y2=0;pc=#2F559D;pw=8;" shape[17] = "func=line;x=56;y=271;x1=0;y1=1;x2=30;y2=0;pc=#2F559D;pw=8;" shape[18] = "func=line;x=82;y=232;x1=0;y1=38;x2=1;y2=0;pc=#2F559D;pw=8;" shape[19] = "func=line;x=83;y=230;x1=0;y1=6;x2=65;y2=0;pc=#2F559D;pw=8;" shape[20] = "func=line;x=143;y=230;x1=0;y1=0;x2=79;y2=7;pc=#2F559D;pw=8;" shape[21] = "func=line;x=217;y=234;x1=0;y1=2;x2=98;y2=0;pc=#2F559D;pw=8;" EndSub Sub Shapes_Add j=1 Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale 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", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shpp = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shpp = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shpp = 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 shpp = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y ffs[qi][j]=LDFastShapes.ShapeIndex(shpp) ldfastShapes.Move(ffs[qi][j], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then ldfastShapes.Rotate(ffs[qi][j], shp["angle"]) EndIf 'shape[i] = shpp j=j+1 EndFor LDFastShapes.Update () shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight 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_Move Stack.PushValue("local", i) s = scale shX = x shY = y For i = 1 To Array.GetItemCount(shape) 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 InitStarsaq ' Initialize stars in Aquarius star[22] = "name=β Aqr;ra=21 31 33.52;dec=-05 34 16.2;mag=2.90;" star[34] = "name=α Aqr;ra=22 05 47.03;dec=-00 19 11.4;mag=2.95;" star[76] = "name=δ Aqr;ra=22 54 39.04;dec=-15 49 14.7;mag=3.27;" star[55] = "name=ζ1 Aqr;ra=22 28 49.80;dec=-00 01 12.2;mag=3.65;" star[88] = "name=88 Aqr;ra=23 09 26.76;dec=-21 10 20.9;mag=3.68;" star[73] = "name=λ Aqr;ra=22 52 36.86;dec=-07 34 46.8;mag=3.73;" star[2] = "name=ε Aqr;ra=20 47 40.53;dec=-09 29 44.5;mag=3.78;" star[48] = "name=γ Aqr;ra=22 21 39.30;dec=-01 23 14.5;mag=3.86;" star[98] = "name=98 Aqr;ra=23 22 58.30;dec=-20 06 01.2;mag=3.96;" star[62] = "name=η Aqr;ra=22 35 21.33;dec=-00 07 02.5;mag=4.04;" star[71] = "name=τ2 Aqr;ra=22 49 35.51;dec=-13 35 33.1;mag=4.05;" star[43] = "name=θ Aqr;ra=22 16 49.97;dec=-07 46 59.7;mag=4.17;" star[90] = "name=φ Aqr;ra=23 14 19.33;dec=-06 02 54.7;mag=4.22;" star[91] = "name=ψ1 Aqr;ra=23 15 53.28;dec=-09 05 15.7;mag=4.24;" star[33] = "name=ι Aqr;ra=22 06 26.21;dec=-13 52 10.3;mag=4.29;" star[99] = "name=99 Aqr;ra=23 26 02.82;dec=-20 38 30.7;mag=4.38;" star[93] = "name=ψ2 Aqr;ra=23 17 54.20;dec=-09 10 57.0;mag=4.41;" star[55] = "name=ζ2 Aqr;ra=22 28 50.10;dec=-00 01 12.0;mag=4.42;" star[3] = "name=3 Aqr;ra=20 47 44.24;dec=-05 01 39.4;mag=4.43;" star[86] = "name=86 Aqr;ra=23 06 40.81;dec=-23 44 35.2;mag=4.48;" star[105] = "name=ω2 Aqr;ra=23 42 43.28;dec=-14 32 41.1;mag=4.49;" star[13] = "name=ν Aqr;ra=21 09 35.59;dec=-11 22 18.0;mag=4.50;" star[23] = "name=ξ Aqr;ra=21 37 45.04;dec=-07 51 14.9;mag=4.68;" star[66] = "name=66 Aqr;ra=22 43 35.25;dec=-18 49 49.1;mag=4.68;" star[101] = "name=101 Aqr;ra=23 33 16.63;dec=-20 54 52.3;mag=4.70;" star[89] = "name=89 Aqr;ra=23 09 54.88;dec=-22 27 27.3;mag=4.71;" star[6] = "name=μ Aqr;ra=20 52 39.21;dec=-08 58 59.7;mag=4.73;" star[31] = "name=ο Aqr;ra=22 03 18.83;dec=-02 09 19.2;mag=4.74;" star[52] = "name=π Aqr;ra=22 25 16.61;dec=+01 22 38.6;mag=4.80;" star[57] = "name=σ Aqr;ra=22 30 38.82;dec=-10 40 40.4;mag=4.82;" star[104] = "name=104 Aqr A;ra=23 41 45.80;dec=-17 48 59.5;mag=4.82;" star[92] = "name=χ Aqr;ra=23 16 50.95;dec=-07 43 35.3;mag=4.93;" star[102] = "name=ω1 Aqr;ra=23 39 47.04;dec=-14 13 19.4;mag=4.97;" star[95] = "name=ψ3 Aqr;ra=23 18 57.65;dec=-09 36 38.6;mag=4.99;" star[63] = "name=κ Aqr;ra=22 37 45.42;dec=-04 13 39.9;mag=5.04;" star[25] = "name=25 Aqr;ra=21 39 33.28;dec=+02 14 37.5;mag=5.10;" star[47] = "name=47 Aqr;ra=22 21 35.58;dec=-21 35 52.9;mag=5.12;" star[1] = "name=1 Aqr;ra=20 39 24.83;dec=+00 29 11.4;mag=5.15;" star[108] = "name=108 Aqr;ra=23 51 21.32;dec=-18 54 33.0;mag=5.17;" star[94] = "name=94 Aqr B;ra=23 19 06.37;dec=-13 27 17.0;mag=5.19;" star[97] = "name=97 Aqr;ra=23 22 39.10;dec=-15 02 21.8;mag=5.19;" star[94] = "name=94 Aqr A;ra=23 19 06.51;dec=-13 27 30.4;mag=5.20;" star[59] = "name=υ Aqr;ra=22 34 41.50;dec=-20 42 28.3;mag=5.21;" star[68] = "name=68 Aqr;ra=22 47 33.19;dec=-19 36 46.3;mag=5.24;" star[106] = "name=106 Aqr;ra=23 44 12.06;dec=-18 16 36.9;mag=5.24;" star[107] = "name=107 Aqr;ra=23 46 00.84;dec=-18 40 42.1;mag=5.28;" star[32] = "name=32 Aqr;ra=22 04 47.43;dec=-00 54 22.5;mag=5.29;" star[41] = "name=41 Aqr;ra=22 14 18.02;dec=-21 04 28.9;mag=5.33;" star[42] = "name=42 Aqr;ra=22 16 48.04;dec=-12 49 53.2;mag=5.34;" star[46] = "name=ρ Aqr;ra=22 20 11.91;dec=-07 49 16.0;mag=5.35;" star[103] = "name=103 Aqr;ra=23 41 34.51;dec=-18 01 36.8;mag=5.36;" star[38] = "name=38 Aqr;ra=22 10 37.46;dec=-11 33 53.9;mag=5.43;" star[83] = "name=83 Aqr;ra=23 05 09.71;dec=-07 41 37.7;mag=5.44;" star[18] = "name=18 Aqr;ra=21 24 11.44;dec=-12 52 41.3;mag=5.48;" star[21] = "name=21 Aqr;ra=21 25 16.96;dec=-03 33 23.7;mag=5.48;" star[7] = "name=7 Aqr;ra=20 56 54.03;dec=-09 41 51.1;mag=5.49;" star[12] = "name=12 Aqr B;ra=21 04 04.58;dec=-05 49 24.2;mag=7.31;" star[49] = "name=49 Aqr;ra=22 23 30.79;dec=-24 45 45.6;mag=5.53;" star[77] = "name=77 Aqr;ra=22 54 45.60;dec=-16 16 18.3;mag=5.53;" star[5] = "name=5 Aqr;ra=20 52 08.69;dec=-05 30 25.4;mag=5.55;" star[30] = "name=30 Aqr;ra=22 03 16.43;dec=-06 31 20.7;mag=5.55;" star[53] = "name=53 Aqr B;ra=22 26 34.15;dec=-16 44 31.7;mag=5.55;" star[96] = "name=96 Aqr;ra=23 19 23.86;dec=-05 07 27.5;mag=5.56;" star[28] = "name=28 Aqr;ra=22 01 05.01;dec=+00 36 17.1;mag=5.60;" star[26] = "name=26 Aqr;ra=21 42 10.12;dec=+01 17 07.0;mag=5.66;" star[69] = "name=τ1 Aqr;ra=22 47 42.75;dec=-14 03 23.1;mag=5.68;" star[19] = "name=19 Aqr;ra=21 25 13.02;dec=-09 44 53.3;mag=5.71;" star[44] = "name=44 Aqr;ra=22 17 06.50;dec=-05 23 14.0;mag=5.75;" star[50] = "name=50 Aqr;ra=22 24 27.03;dec=-13 31 45.9;mag=5.76;" star[51] = "name=51 Aqr;ra=22 24 06.87;dec=-04 50 13.2;mag=5.79;" star[35] = "name=35 Aqr;ra=22 08 58.99;dec=-18 31 10.5;mag=5.80;" star[74] = "name=74 Aqr;ra=22 53 28.69;dec=-11 36 59.5;mag=5.80;" star[15] = "name=15 Aqr;ra=21 18 11.07;dec=-04 31 10.2;mag=5.83;" star[16] = "name=16 Aqr;ra=21 21 04.33;dec=-04 33 36.5;mag=5.87;" star[60] = "name=60 Aqr;ra=22 34 02.89;dec=-01 34 27.0;mag=5.88;" star[12] = "name=12 Aqr A;ra=21 04 04.74;dec=-05 49 23.0;mag=5.89;" star[45] = "name=45 Aqr;ra=22 19 00.70;dec=-13 18 17.9;mag=5.96;" star[4] = "name=4 Aqr;ra=20 51 25.69;dec=-05 37 35.9;mag=5.99;" star[17] = "name=17 Aqr;ra=21 22 56.27;dec=-09 19 09.4;mag=5.99;" star[39] = "name=39 Aqr;ra=22 12 25.74;dec=-14 11 37.8;mag=6.04;" star[82] = "name=82 Aqr;ra=23 02 32.56;dec=-06 34 26.1;mag=6.18;" star[70] = "name=70 Aqr;ra=22 48 30.19;dec=-10 33 19.8;mag=6.19;" star[78] = "name=78 Aqr;ra=22 54 34.13;dec=-07 12 16.3;mag=6.20;" star[11] = "name=11 Aqr;ra=21 00 33.81;dec=-04 43 47.7;mag=6.21;" star[81] = "name=81 Aqr;ra=23 01 23.65;dec=-07 03 40.1;mag=6.23;" star[100] = "name=100 Aqr;ra=23 31 42.04;dec=-21 22 10.0;mag=6.24;" star[53] = "name=53 Aqr A;ra=22 26 34.40;dec=-16 44 33.0;mag=6.35;" star[56] = "name=56 Aqr;ra=22 30 17.33;dec=-14 35 08.3;mag=6.36;" star[20] = "name=20 Aqr;ra=21 24 51.68;dec=-03 23 53.6;mag=6.38;" star[29] = "name=29 Aqr;ra=22 02 26.25;dec=-16 57 53.4;mag=6.39;" star[58] = "name=58 Aqr;ra=22 31 41.28;dec=-10 54 19.7;mag=6.39;" star[61] = "name=61 Aqr;ra=22 35 48.82;dec=-17 27 37.1;mag=6.39;" star[67] = "name=67 Aqr;ra=22 43 14.25;dec=-06 57 46.5;mag=6.40;" star[14] = "name=14 Aqr;ra=21 16 17.78;dec=-09 12 52.8;mag=6.45;" star[114] = "name=HD 210277;ra=22 09 29.87;dec=-07 32 55.2;mag=6.63;" star[37] = "name=37 Aqr;ra=22 10 31.74;dec=-10 49 13.7;mag=6.64;" star[24] = "name=24 Aqr;ra=21 39 31.39;dec=-00 03 04.1;mag=6.66;" star[104] = "name=104 Aqr B;ra=23 41 46.39;dec=-17 47 00.5;mag=8.52;" 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 Shapes_Initaq shX = 384 ' x offset shY = 315 ' y offset shape = "" shape[1] = "func=ell;x=92;y=62;width=56;height=31;angle=30;bc=#204040;pw=0;" shape[2] = "func=ell;x=106;y=0;width=73;height=86;angle=32;bc=#204040;pw=0;" shape[3] = "func=ell;x=101;y=72;width=37;height=14;angle=28;bc=#102020;pw=0;" shape[4] = "func=tri;x=63;y=39;x1=31;y1=0;x2=0;y2=155;x3=63;y3=155;angle=38;bc=#204040;pw=0;" shape[5] = "func=ell;x=37;y=173;width=36;height=100;angle=10;bc=#204040;pw=0;" shape[6] = "func=ell;x=12;y=155;width=34;height=118;angle=17;bc=#204040;pw=0;" shape[7] = "func=ell;x=0;y=151;width=28;height=90;angle=24;bc=#204040;pw=0;" shape[8] = "func=ell;x=238;y=26;width=55;height=71;angle=28;bc=#204040;pw=0;" shape[9] = "func=rect;x=234;y=78;width=22;height=34;angle=32;bc=#204040;pw=0;" shape[10] = "func=rect;x=179;y=95;width=87;height=81;angle=31;bc=#204040;pw=0;" shape[11] = "func=rect;x=256;y=144;width=67;height=22;angle=53;bc=#204040;pw=0;" shape[12] = "func=rect;x=299;y=165;width=65;height=19;angle=348;bc=#204040;pw=0;" shape[13] = "func=rect;x=144;y=94;width=74;height=22;angle=334;bc=#204040;pw=0;" shape[14] = "func=rect;x=137;y=62;width=18;height=69;angle=358;bc=#204040;pw=0;" shape[15] = "func=rect;x=153;y=160;width=89;height=54;angle=19;bc=#204040;pw=0;" shape[16] = "func=rect;x=99;y=186;width=75;height=30;angle=341;bc=#204040;pw=0;" shape[17] = "func=rect;x=130;y=220;width=96;height=31;angle=328;bc=#204040;pw=0;" shape[18] = "func=ell;x=80;y=199;width=35;height=34;bc=#204040;pw=0;" shape[19] = "func=ell;x=117;y=247;width=35;height=39;bc=#204040;pw=0;" shape[20] = "func=rect;x=128;y=274;width=28;height=56;angle=345;bc=#204040;pw=0;" shape[21] = "func=rect;x=80;y=217;width=27;height=74;bc=#204040;pw=0;" shape[22] = "func=ell;x=248;y=49;width=14;height=14;bc=#102020;pw=0;" shape[23] = "func=ell;x=268;y=60;width=14;height=14;bc=#102020;pw=0;" shape[24] = "func=ell;x=258;y=17;width=21;height=22;bc=#204040;pw=0;" shape[25] = "func=ell;x=274;y=19;width=21;height=22;bc=#204040;pw=0;" shape[26] = "func=ell;x=285;y=32;width=21;height=22;bc=#204040;pw=0;" shape[27] = "func=ell;x=289;y=49;width=21;height=22;bc=#204040;pw=0;" shape[28] = "func=ell;x=241;y=21;width=21;height=22;bc=#204040;pw=0;" shape[29] = "func=ell;x=280;y=65;width=21;height=22;bc=#204040;pw=0;" shape[30] = "func=ell;x=229;y=35;width=21;height=22;bc=#204040;pw=0;" shape[31] = "func=ell;x=359;y=148;width=32;height=31;bc=#204040;pw=0;" shape[32] = "func=ell;x=357;y=155;width=13;height=73;angle=6;bc=#204040;pw=0;" shape[33] = "func=ell;x=385;y=162;width=14;height=78;angle=345;bc=#204040;pw=0;" shape[34] = "func=tri;x=58;y=270;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=265;bc=#204040;pw=0;" shape[35] = "func=tri;x=116;y=308;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=261;bc=#204040;pw=0;" EndSub Sub InitStarscc ' Initialize stars in Capricornus star[49] = "name=δ Cap;ra=21 47 02.29;dec=-16 07 35.6;mag=2.85;" star[9] = "name=β1 Cap;ra=20 21 00.65;dec=-14 46 53.0;mag=3.05;" star[6] = "name=α2 Cap;ra=20 18 03.22;dec=-12 32 41.5;mag=3.58;" star[40] = "name=γ Cap;ra=21 40 05.34;dec=-16 39 44.1;mag=3.69;" star[34] = "name=ζ Cap;ra=21 26 40.03;dec=-22 24 41.0;mag=3.77;" star[23] = "name=θ Cap;ra=21 05 56.78;dec=-17 13 57.8;mag=4.08;" star[18] = "name=ω Cap;ra=20 51 49.30;dec=-26 55 08.9;mag=4.12;" star[16] = "name=ψ Cap;ra=20 46 05.77;dec=-25 16 13.9;mag=4.13;" star[32] = "name=ι Cap;ra=21 22 14.78;dec=-16 50 04.4;mag=4.27;" star[5] = "name=α1 Cap;ra=20 17 38.86;dec=-12 30 29.6;mag=4.30;" star[24] = "name=24 Cap;ra=21 07 07.69;dec=-25 00 20.7;mag=4.49;" star[36] = "name=36 Cap;ra=21 28 43.32;dec=-21 48 25.8;mag=4.50;" star[39] = "name=ε Cap;ra=21 37 04.82;dec=-19 27 57.6;mag=4.51;" star[43] = "name=κ Cap;ra=21 42 39.42;dec=-18 51 58.7;mag=4.72;" star[8] = "name=ν Cap;ra=20 20 39.81;dec=-12 45 32.6;mag=4.77;" star[11] = "name=ρ Cap;ra=20 28 51.62;dec=-17 48 49.2;mag=4.77;" star[22] = "name=η Cap;ra=21 04 24.32;dec=-19 51 17.8;mag=4.82;" star[51] = "name=μ Cap;ra=21 53 17.58;dec=-13 33 06.5;mag=5.07;" star[10] = "name=π Cap;ra=20 27 19.20;dec=-18 12 42.1;mag=5.08;" star[46] = "name=46 Cap;ra=21 45 00.25;dec=-09 04 56.7;mag=5.10;" star[15] = "name=υ Cap;ra=20 40 02.96;dec=-18 08 19.0;mag=5.15;" star[42] = "name=42 Cap;ra=21 41 32.93;dec=-14 02 48.7;mag=5.16;" star[28] = "name=φ Cap;ra=21 15 37.89;dec=-20 39 06.1;mag=5.17;" star[14] = "name=τ2 Cap;ra=20 39 16.32;dec=-14 57 17.0;mag=5.24;" star[41] = "name=41 Cap;ra=21 42 00.64;dec=-23 15 45.5;mag=5.24;" star[7] = "name=σ Cap;ra=20 19 23.60;dec=-19 07 06.6;mag=5.28;" star[25] = "name=χ Cap;ra=21 08 33.61;dec=-21 11 36.7;mag=5.30;" star[29] = "name=29 Cap;ra=21 15 44.83;dec=-15 10 17.4;mag=5.31;" star[33] = "name=33 Cap;ra=21 24 09.60;dec=-20 51 05.6;mag=5.38;" star[30] = "name=30 Cap;ra=21 17 57.28;dec=-17 59 06.5;mag=5.40;" star[48] = "name=λ Cap;ra=21 46 32.08;dec=-11 21 57.4;mag=5.57;" star[37] = "name=37 Cap;ra=21 34 51.07;dec=-20 05 03.8;mag=5.70;" star[19] = "name=19 Cap;ra=20 54 47.85;dec=-17 55 22.3;mag=5.78;" star[35] = "name=35 Cap;ra=21 27 14.83;dec=-21 11 46.1;mag=5.78;" star[2] = "name=ξ2 Cap;ra=20 12 25.76;dec=-12 37 01.3;mag=5.84;" star[4] = "name=4 Cap;ra=20 18 01.38;dec=-21 48 35.6;mag=5.86;" star[44] = "name=44 Cap;ra=21 43 04.40;dec=-14 23 59.1;mag=5.88;" star[17] = "name=17 Cap;ra=20 46 09.97;dec=-21 30 50.4;mag=5.91;" star[12] = "name=ο Cap A;ra=20 29 53.89;dec=-18 34 58.7;mag=5.94;" star[45] = "name=45 Cap;ra=21 44 00.98;dec=-14 44 57.8;mag=5.96;" star[47] = "name=47 Cap;ra=21 46 16.26;dec=-09 16 33.4;mag=6.00;" star[21] = "name=21 Cap;ra=21 00 51.78;dec=-17 31 51.1;mag=6.07;" star[27] = "name=27 Cap;ra=21 09 32.93;dec=-20 33 22.8;mag=6.25;" star[20] = "name=20 Cap;ra=20 59 36.13;dec=-19 02 06.8;mag=6.26;" star[3] = "name=3 Cap;ra=20 16 22.80;dec=-12 20 13.5;mag=6.30;" star[1] = "name=ξ1 Cap;ra=20 11 57.90;dec=-12 23 32.5;mag=6.34;" star[12] = "name=ο Cap B;ra=20 29 52.58;dec=-18 35 10.2;mag=6.74;" star[13] = "name=τ1 Cap;ra=20 37 21.16;dec=-15 08 50.0;mag=6.76;" star[50] = "name=50 Cap;ra=21 46 42.09;dec=-11 41 52.2;mag=7.01;" star[31] = "name=31 Cap;ra=21 18 15.64;dec=-17 27 44.2;mag=7.07;" edge = "1=6-9;2=9-16;3=16-18;4=18-34;5=34-49;6=49-40;7=40-32;" edge = edge + "8=32-23;9=23-9;" EndSub Sub Shapes_Initcc shX = 640 ' x offset shY = 441 ' y offset shape = "" shape[1] = "func=rect;x=191;y=68;width=44;height=86;bc=#83809C;pw=0;" shape[2] = "func=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0;" shape[3] = "func=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0;" shape[4] = "func=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16;" shape[5] = "func=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16;" shape[6] = "func=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16;" shape[7] = "func=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16;" shape[8] = "func=ell;x=1;y=82;width=97;height=99;bc=#83809C;pw=0;" shape[9] = "func=ell;x=59;y=72;width=144;height=87;angle=351;bc=#83809C;pw=0;" shape[10] = "func=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#000055;pw=4;" shape[11] = "func=ell;x=35;y=123;width=15;height=16;bc=#191970;pw=0;" shape[12] = "func=ell;x=210;y=93;width=15;height=16;bc=#191970;pw=0;" shape[13] = "func=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0;" shape[14] = "func=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0;" shape[15] = "func=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4;" shape[16] = "func=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0;" shape[17] = "func=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0;" shape[18] = "func=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4;" EndSub Sub InitStarsary star[13] = "name=α Ari;ra=02 07 10.29;dec=+23 27 46.0;mag=2.01;" star[6] = "name=β Ari;ra=01 54 38.35;dec=+20 48 29.9;mag=2.64;" star[41] = "name=41 Ari;ra=02 49 58.99;dec=+27 15 38.8;mag=3.61;" star[57] = "name=δ Ari;ra=03 11 37.67;dec=+19 43 36.1;mag=4.35;" star[39] = "name=39 Ari;ra=02 47 54.44;dec=+29 14 50.7;mag=4.52;" star[5] = "name=γ2 Ari;ra=01 53 31.80;dec=+19 17 45.0;mag=4.62;" star[35] = "name=35 Ari;ra=02 43 27.11;dec=+27 42 25.8;mag=4.65;" star[5] = "name=γ1 Ari;ra=01 53 31.77;dec=+19 17 38.7;mag=4.70;" star[9] = "name=λ Ari;ra=01 57 55.78;dec=+23 35 45.9;mag=4.79;" star[58] = "name=ζ Ari;ra=03 14 54.11;dec=+21 02 40.7;mag=4.87;" star[14] = "name=14 Ari;ra=02 09 25.29;dec=+25 56 23.9;mag=4.98;" star[12] = "name=κ Ari;ra=02 06 33.91;dec=+22 38 54.3;mag=5.03;" star[8] = "name=ι Ari;ra=01 57 21.03;dec=+17 49 03.3;mag=5.09;" star[63] = "name=τ2 Ari;ra=03 22 45.27;dec=+20 44 31.6;mag=5.10;" star[38] = "name=38 Ari;ra=02 44 57.51;dec=+12 26 45.5;mag=5.18;" star[48] = "name=ε Ari A;ra=02 59 12.70;dec=+21 20 25.0;mag=5.2;" star[17] = "name=η Ari;ra=02 12 47.98;dec=+21 12 39.5;mag=5.23;" star[42] = "name=π Ari;ra=02 49 17.56;dec=+17 27 51.6;mag=5.26;" star[61] = "name=τ1 Ari;ra=03 21 13.61;dec=+21 08 49.7;mag=5.27;" star[33] = "name=33 Ari;ra=02 40 41.03;dec=+27 03 39.6;mag=5.30;" star[32] = "name=ν Ari;ra=02 38 49.00;dec=+21 57 41.2;mag=5.45;" star[52] = "name=52 Ari A;ra=03 05 26.69;dec=+25 15 18.7;mag=5.45;" star[24] = "name=ξ Ari;ra=02 24 49.04;dec=+10 36 38.2;mag=5.48;" star[48] = "name=ε Ari B;ra=02 59 12.73;dec=+21 20 25.6;mag=5.5;" star[64] = "name=64 Ari;ra=03 24 18.46;dec=+24 43 27.1;mag=5.50;" star[43] = "name=σ Ari;ra=02 51 29.57;dec=+15 04 55.7;mag=5.52;" star[62] = "name=62 Ari;ra=03 22 11.89;dec=+27 36 27.3;mag=5.55;" star[21] = "name=21 Ari;ra=02 15 42.83;dec=+25 02 35.7;mag=5.57;" star[22] = "name=θ Ari;ra=02 18 07.55;dec=+19 54 04.2;mag=5.58;" star[46] = "name=ρ3 Ari;ra=02 56 25.98;dec=+18 01 25.1;mag=5.58;" star[10] = "name=10 Ari;ra=02 03 39.26;dec=+25 56 07.6;mag=5.64;" star[31] = "name=31 Ari;ra=02 36 37.75;dec=+12 26 52.2;mag=5.64;" star[15] = "name=15 Ari;ra=02 10 37.54;dec=+19 30 01.5;mag=5.68;" star[19] = "name=19 Ari;ra=02 13 03.25;dec=+15 16 47.7;mag=5.72;" star[34] = "name=μ Ari;ra=02 42 21.92;dec=+20 00 41.7;mag=5.74;" star[55] = "name=55 Ari;ra=03 09 36.73;dec=+29 04 37.6;mag=5.74;" star[7] = "name=7 Ari;ra=01 55 51.03;dec=+23 34 38.4;mag=5.76;" star[45] = "name=ρ2 Ari;ra=02 55 48.50;dec=+18 19 54.0;mag=5.76;" star[37] = "name=ο Ari;ra=02 44 32.97;dec=+15 18 42.8;mag=5.78;" star[56] = "name=56 Ari;ra=03 12 14.24;dec=+27 15 25.2;mag=5.78;" star[20] = "name=20 Ari;ra=02 15 45.94;dec=+25 46 59.2;mag=5.79;" star[47] = "name=47 Ari;ra=02 58 05.08;dec=+20 40 07.7;mag=5.80;" star[1] = "name=1 Ari A;ra=01 50 08.58;dec=+22 16 31.3;mag=5.83;" star[40] = "name=40 Ari;ra=02 48 32.06;dec=+18 17 01.9;mag=5.83;" star[4] = "name=4 Ari;ra=01 48 10.90;dec=+16 57 20.3;mag=5.86;" star[(16)] = "name=HR 830;ra=02 48 45.87;dec=+25 11 17.1;mag=5.89;" star[1] = "name=1 Ari B;ra=01 50 08.50;dec=+22 16 33.0;mag=5.90;" star[49] = "name=49 Ari;ra=03 01 54.15;dec=+26 27 44.4;mag=5.91;" star[59] = "name=59 Ari;ra=03 19 55.81;dec=+27 04 16.7;mag=5.91;" star[(54)] = "name=54 Cet;ra=01 50 52.01;dec=+11 02 36.4;mag=5.93;" star[29] = "name=29 Ari;ra=02 32 54.15;dec=+15 02 04.1;mag=6.00;" star[11] = "name=11 Ari;ra=02 06 49.22;dec=+25 42 16.5;mag=6.01;" star[16] = "name=16 Ari;ra=02 11 12.06;dec=+25 56 13.0;mag=6.01;" star[66] = "name=66 Ari;ra=03 28 26.57;dec=+22 48 15.4;mag=6.03;" star[65] = "name=65 Ari;ra=03 24 26.11;dec=+20 48 12.6;mag=6.07;" star[53] = "name=53 Ari;ra=03 07 25.69;dec=+17 52 47.9;mag=6.13;" star[26] = "name=26 Ari;ra=02 30 38.37;dec=+19 51 19.4;mag=6.14;" star[60] = "name=60 Ari;ra=03 20 25.57;dec=+25 39 46.7;mag=6.14;" star[27] = "name=27 Ari;ra=02 30 54.38;dec=+17 42 14.6;mag=6.21;" star[54] = "name=54 Ari;ra=03 08 21.09;dec=+18 47 42.3;mag=6.25;" star[(85)] = "name=85 Cet;ra=02 42 28.95;dec=+10 44 30.4;mag=6.32;" star[36] = "name=36 Ari;ra=02 44 19.09;dec=+17 45 50.5;mag=6.46;" star[30] = "name=30 Ari A;ra=02 37 00.44;dec=+24 38 50.1;mag=6.48;" star[51] = "name=51 Ari;ra=03 02 25.87;dec=+26 36 34.7;mag=6.62;" star[52] = "name=52 Ari B;ra=03 05 26.70;dec=+25 15 19.0;mag=7.00;" star[44] = "name=ρ1 Ari;ra=02 54 55.17;dec=+17 44 05.3;mag=7.01;" star[30] = "name=30 Ari B;ra=02 36 57.64;dec=+24 38 53.1;mag=7.09;" edge = "1=5-6;2=6-13;3=13-32;4=32-57;" EndSub Sub Shapes_Initary shX = -200 ' x offset shY = 133 ' y offset shape = "" shape[1] = "func=ell;x=62;y=33;width=99;height=97;bc=#5E5E5E;pw=0;" shape[2] = "func=ell;x=0;y=59;width=67;height=37;angle=348;bc=#5E5E5E;pw=0;" shape[3] = "func=ell;x=45;y=80;width=2;height=0;bc=#5E5E5E;pw=0;" shape[4] = "func=ell;x=222;y=0;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[5] = "func=ell;x=186;y=58;width=99;height=97;bc=#5E5E5E;pw=0;" shape[6] = "func=rect;x=107;y=44;width=127;height=98;angle=11;bc=#5E5E5E;pw=0;" shape[7] = "func=rect;x=68;y=139;width=103;height=17;angle=28;bc=#5E5E5E;pw=0;" shape[8] = "func=rect;x=196;y=147;width=70;height=16;angle=27;bc=#5E5E5E;pw=0;" shape[9] = "func=rect;x=192;y=164;width=70;height=16;angle=356;bc=#5E5E5E;pw=0;" shape[10] = "func=rect;x=218;y=141;width=70;height=16;angle=9;bc=#5E5E5E;pw=0;" shape[11] = "func=rect;x=238;y=172;width=70;height=16;angle=292;bc=#5E5E5E;pw=0;" shape[12] = "func=ell;x=218;y=36;width=37;height=54;angle=34;bc=#5E5E5E;pc=#000000;pw=4;" shape[13] = "func=ell;x=229;y=11;width=78;height=78;bc=#5E5E5E;pw=0;" shape[14] = "func=ell;x=255;y=51;width=20;height=20;bc=#000000;pw=0;" shape[15] = "func=line;x=218;y=71;x1=0;y1=4;x2=11;y2=0;pc=#000000;pw=4;" shape[16] = "func=tri;x=238;y=76;x1=40;y1=0;x2=0;y2=25;x3=80;y3=25;angle=288;bc=#5E5E5E;pw=0;" shape[17] = "func=ell;x=287;y=27;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[18] = "func=line;x=284;y=49;x1=0;y1=0;x2=26;y2=9;pc=#000000;pw=4;" shape[19] = "func=line;x=284;y=49;x1=18;y1=32;x2=0;y2=0;pc=#000000;pw=4;" shape[20] = "func=tri;x=165;y=161;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[21] = "func=tri;x=162;y=168;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[22] = "func=tri;x=252;y=205;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=210;bc=#5E5E5E;pw=0;" shape[23] = "func=tri;x=246;y=203;x1=7;y1=0;x2=0;y2=27;x3=15;y3=27;angle=214;bc=#5E5E5E;pw=0;" shape[24] = "func=tri;x=179;y=160;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[25] = "func=tri;x=182;y=153;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[26] = "func=rect;x=97;y=127;width=103;height=17;angle=12;bc=#5E5E5E;pw=0;" shape[27] = "func=tri;x=196;y=140;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" EndSub Sub initscnc star[17] = "name=β Cnc;ra=08 16 30.95;dec=+09 11 08.4;mag=3.53;" star[47] = "name=δ Cnc;ra=08 44 41.11;dec=+18 09 17.5;mag=3.94;" star[48] = "name=ι Cnc A;ra=08 46 41.83;dec=+28 45 36.0;mag=4.03;" star[65] = "name=α Cnc;ra=08 58 29.20;dec=+11 51 28.0;mag=4.26;" star[43] = "name=γ Cnc;ra=08 43 17.21;dec=+21 28 06.9;mag=4.66;" star[16] = "name=ζ Cnc;ra=08 12 12.71;dec=+17 38 53.3;mag=4.67;" star[8] = "name=8 Cnc;ra=08 05 04.51;dec=+13 07 06.1;mag=5.14;" star[18] = "name=χ Cnc;ra=08 20 03.87;dec=+27 13 07.0;mag=5.14;" star[77] = "name=ξ Cnc;ra=09 09 21.53;dec=+22 02 43.6;mag=5.16;" star[62] = "name=ο1 Cnc;ra=08 57 14.91;dec=+15 19 21.8;mag=5.22;" star[58] = "name=ρ2 Cnc;ra=08 55 39.69;dec=+27 55 39.2;mag=5.23;" star[64] = "name=σ3 Cnc;ra=08 59 32.68;dec=+32 25 07.1;mag=5.23;" star[76] = "name=κ Cnc;ra=09 07 44.82;dec=+10 40 05.6;mag=5.23;" star[10] = "name=μ2 Cnc;ra=08 07 45.84;dec=+21 34 55.1;mag=5.30;" star[31] = "name=θ Cnc;ra=08 31 35.77;dec=+18 05 40.4;mag=5.33;" star[33] = "name=η Cnc;ra=08 32 42.52;dec=+20 26 28.6;mag=5.33;" star[82] = "name=82 Cnc;ra=09 15 13.88;dec=+14 56 29.5;mag=5.36;" star[57] = "name=57 Cnc;ra=08 54 14.70;dec=+30 34 45.0;mag=5.40;" star[72] = "name=τ Cnc;ra=09 08 00.07;dec=+29 39 15.2;mag=5.42;" star[60] = "name=60 Cnc;ra=08 55 55.56;dec=+11 37 33.8;mag=5.44;" star[59] = "name=σ2 Cnc;ra=08 56 56.63;dec=+32 54 38.1;mag=5.44;" star[69] = "name=ν Cnc;ra=09 02 44.27;dec=+24 27 10.6;mag=5.45;" star[27] = "name=27 Cnc;ra=08 26 43.95;dec=+12 39 17.5;mag=5.56;" star[22] = "name=φ1 Cnc;ra=08 26 27.73;dec=+27 53 37.9;mag=5.58;" star[3] = "name=3 Cnc;ra=08 00 47.31;dec=+17 18 31.4;mag=5.60;" star[15] = "name=15 Cnc;ra=08 13 08.87;dec=+29 39 23.7;mag=5.62;" star[45] = "name=45 Cnc;ra=08 43 12.34;dec=+12 40 51.1;mag=5.62;" star[49] = "name=49 Cnc;ra=08 44 45.04;dec=+10 04 54.2;mag=5.63;" star[51] = "name=σ1 Cnc;ra=08 52 34.62;dec=+32 28 26.8;mag=5.67;" star[63] = "name=ο2 Cnc;ra=08 57 35.16;dec=+15 34 52.4;mag=5.68;" star[30] = "name=υ1 Cnc;ra=08 31 30.57;dec=+24 04 52.4;mag=5.71;" star[14] = "name=ψ2 Cnc;ra=08 10 27.23;dec=+25 30 29.4;mag=5.73;" star[1] = "name=1 Cnc;ra=07 56 59.47;dec=+15 47 25.4;mag=5.80;" star[2] = "name=ω1 Cnc;ra=08 00 55.87;dec=+25 23 34.2;mag=5.87;" star[50] = "name=50 Cnc;ra=08 46 56.06;dec=+12 06 36.3;mag=5.89;" star[66] = "name=66 Cnc;ra=09 01 24.13;dec=+32 15 08.3;mag=5.89;" star[19] = "name=λ Cnc;ra=08 20 32.15;dec=+24 01 20.5;mag=5.92;" star[36] = "name=36 Cnc;ra=08 37 05.79;dec=+09 39 20.1;mag=5.92;" star[20] = "name=20 Cnc;ra=08 23 21.87;dec=+18 19 56.2;mag=5.94;" star[29] = "name=29 Cnc;ra=08 28 37.35;dec=+14 12 39.1;mag=5.94;" star[75] = "name=75 Cnc;ra=09 08 47.42;dec=+26 37 48.0;mag=5.95;" star[(1)] = "name=1 LMi;ra=08 38 19.00;dec=+32 48 07.3;mag=5.96;" star[55] = "name=55 Cnc;ra=08 52 36.13;dec=+28 19 53.0;mag=5.96;" star[9] = "name=μ1 Cnc;ra=08 06 18.40;dec=+22 38 07.8;mag=5.97;" star[5] = "name=5 Cnc;ra=08 01 30.29;dec=+16 27 19.2;mag=5.99;" star[79] = "name=79 Cnc;ra=09 10 20.86;dec=+21 59 47.1;mag=6.04;" star[28] = "name=28 Cnc;ra=08 28 36.80;dec=+24 08 42.2;mag=6.05;" star[67] = "name=67 Cnc;ra=09 01 48.88;dec=+27 54 10.0;mag=6.07;" star[21] = "name=21 Cnc;ra=08 23 55.21;dec=+10 37 55.6;mag=6.11;" star[25] = "name=25 Cnc;ra=08 25 49.99;dec=+17 02 47.9;mag=6.11;" star[46] = "name=46 Cnc;ra=08 45 21.42;dec=+30 41 51.9;mag=6.12;" star[23] = "name=φ2 Cnc A;ra=08 26 47.08;dec=+26 56 07.7;mag=6.14;" star[23] = "name=φ2 Cnc B;ra=08 26 47.00;dec=+26 56 07.0;mag=6.19;" star[(4)] = "name=4 LMi;ra=08 40 18.31;dec=+31 56 31.1;mag=6.21;" star[12] = "name=12 Cnc;ra=08 08 42.44;dec=+13 38 27.4;mag=6.25;" star[53] = "name=53 Cnc;ra=08 52 28.60;dec=+28 15 33.0;mag=6.25;" star[61] = "name=61 Cnc;ra=08 57 58.63;dec=+30 14 01.5;mag=6.25;" star[41] = "name=ε Cnc;ra=08 40 27.03;dec=+19 32 41.4;mag=6.29;" star[4] = "name=4 Cnc;ra=08 01 43.77;dec=+25 05 22.0;mag=6.32;" star[32] = "name=υ2 Cnc;ra=08 33 00.14;dec=+24 05 05.7;mag=6.35;" star[54] = "name=54 Cnc;ra=08 51 01.53;dec=+15 21 01.7;mag=6.36;" star[39] = "name=39 Cnc;ra=08 40 06.44;dec=+20 00 28.1;mag=6.39;" star[13] = "name=ψ1 Cnc;ra=08 10 13.12;dec=+25 50 40.4;mag=6.44;" star[34] = "name=34 Cnc;ra=08 32 39.87;dec=+10 03 57.7;mag=6.48;" star[81] = "name=81 Cnc;ra=09 12 17.87;dec=+14 59 43.6;mag=6.49;" star[24] = "name=24 Cnc A;ra=08 26 39.82;dec=+24 32 03.7;mag=6.51;" star[37] = "name=37 Cnc;ra=08 38 05.19;dec=+09 34 28.7;mag=6.54;" star[35] = "name=35 Cnc;ra=08 35 19.47;dec=+19 35 24.3;mag=6.55;" star[40] = "name=40 Cnc;ra=08 40 11.47;dec=+19 58 16.2;mag=6.61;" star[83] = "name=83 Cnc;ra=09 18 58.91;dec=+17 42 20.4;mag=6.61;" star[38] = "name=38 Cnc;ra=08 39 42.68;dec=+19 46 42.5;mag=6.66;" star[70] = "name=70 Cnc;ra=09 04 09.87;dec=+27 53 53.9;mag=6.67;" star[(2)] = "name=2 LMi;ra=08 39 31.87;dec=+32 30 56.2;mag=6.69;" star[(3)] = "name=3 LMi;ra=08 39 56.35;dec=+32 43 38.2;mag=6.71;" star[42] = "name=42 Cnc;ra=08 40 43.23;dec=+19 43 09.6;mag=6.83;" star[7] = "name=7 Cnc;ra=08 03 50.48;dec=+22 04 14.9;mag=6.84;" star[80] = "name=80 Cnc;ra=09 11 56.93;dec=+18 02 39.0;mag=6.87;" star[78] = "name=78 Cnc;ra=09 09 02.31;dec=+17 28 10.7;mag=7.18;" star[52] = "name=52 Cnc;ra=08 51 10.83;dec=+15 59 57.8;mag=7.38;" star[24] = "name=24 Cnc B;ra=08 26 40.10;dec=+24 32 07.0;mag=7.81;" star[44] = "name=44 Cnc;ra=08 43 08.36;dec=+18 09 02.0;mag=8.03;" star[71] = "name=71 Cnc;ra=09 05 45.52;dec=+17 23 24.5;mag=8.10;" edge = "1=48-43;2=43-47;3=47-65;4=47-17;" EndSub Sub shpcnc shX = -1040 ' x offset shY = 77 ' y offset shape = "" shape[1] = "func=ell;x=60;y=44;width=126;height=181;bc=#661F1F;pc=#000000;pw=2;" shape[2] = "func=ell;x=54;y=99;width=21;height=21;bc=#661F1F;pc=#000000;pw=2;" shape[3] = "func=ell;x=56;y=145;width=21;height=21;bc=#661F1F;pc=#000000;pw=2;" shape[4] = "func=rect;x=73;y=22;width=27;height=23;angle=12;bc=#661F1F;pc=#000000;pw=2;" shape[5] = "func=rect;x=96;y=30;width=24;height=22;angle=21;bc=#661F1F;pc=#000000;pw=2;" shape[6] = "func=rect;x=49;y=209;width=29;height=22;bc=#661F1F;pc=#000000;pw=2;" shape[7] = "func=rect;x=70;y=207;width=24;height=19;angle=327;bc=#661F1F;pc=#000000;pw=2;" shape[8] = "func=tri;x=107;y=15;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=332;bc=#661F1F;pc=#000000;pw=2;" shape[9] = "func=tri;x=131;y=12;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=338;bc=#661F1F;pc=#000000;pw=2;" shape[10] = "func=tri;x=152;y=21;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=346;bc=#661F1F;pc=#000000;pw=2;" shape[11] = "func=tri;x=170;y=34;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=351;bc=#661F1F;pc=#000000;pw=2;" shape[12] = "func=tri;x=103;y=218;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000000;pw=2;" shape[13] = "func=tri;x=127;y=217;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000000;pw=2;" shape[14] = "func=tri;x=142;y=219;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000000;pw=2;" shape[15] = "func=tri;x=161;y=206;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000000;pw=2;" shape[16] = "func=tri;x=49;y=102;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=290;bc=#661F1F;pc=#000000;pw=2;" shape[17] = "func=tri;x=49;y=122;x1=7;y1=0;x2=0;y2=36;x3=14;y3=36;angle=264;bc=#661F1F;pc=#000000;pw=2;" shape[18] = "func=rect;x=127;y=77;width=14;height=33;angle=351;bc=#661F1F;pc=#000000;pw=2;" shape[19] = "func=rect;x=141;y=74;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[20] = "func=rect;x=158;y=84;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[21] = "func=rect;x=169;y=96;width=14;height=33;angle=10;bc=#661F1F;pc=#000000;pw=2;" shape[22] = "func=rect;x=122;y=161;width=14;height=33;angle=7;bc=#661F1F;pc=#000000;pw=2;" shape[23] = "func=rect;x=136;y=162;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[24] = "func=rect;x=153;y=160;width=14;height=33;angle=352;bc=#661F1F;pc=#000000;pw=2;" shape[25] = "func=rect;x=167;y=150;width=14;height=33;angle=351;bc=#661F1F;pc=#000000;pw=2;" shape[26] = "func=rect;x=120;y=48;width=14;height=33;angle=338;bc=#661F1F;pc=#000000;pw=2;" shape[27] = "func=rect;x=139;y=46;width=14;height=33;angle=351;bc=#661F1F;pc=#000000;pw=2;" shape[28] = "func=rect;x=158;y=55;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[29] = "func=rect;x=173;y=67;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[30] = "func=rect;x=117;y=191;width=14;height=33;angle=12;bc=#661F1F;pc=#000000;pw=2;" shape[31] = "func=rect;x=136;y=194;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[32] = "func=rect;x=154;y=192;width=14;height=33;angle=7;bc=#661F1F;pc=#000000;pw=2;" shape[33] = "func=rect;x=170;y=181;width=14;height=33;bc=#661F1F;pc=#000000;pw=2;" shape[34] = "func=ell;x=70;y=99;width=114;height=68;bc=#661F1F;pc=#000000;pw=2;" shape[35] = "func=ell;x=14;y=0;width=50;height=102;angle=45;bc=#661F1F;pc=#000000;pw=2;" shape[36] = "func=ell;x=0;y=132;width=49;height=105;angle=342;bc=#661F1F;pc=#000000;pw=2;" shape[37] = "func=tri;x=16;y=34;x1=18;y1=0;x2=0;y2=66;x3=36;y3=66;angle=30;bc=#000000;pw=0;" shape[38] = "func=tri;x=13;y=130;x1=11;y1=0;x2=0;y2=73;x3=23;y3=73;angle=168;bc=#000000;pw=0;" shape[39] = "func=ell;x=54;y=99;width=21;height=21;bc=#33000000;pc=#000000;pw=2;" shape[40] = "func=ell;x=56;y=145;width=21;height=21;bc=#33000000;pc=#000000;pw=2;" EndSub End>RRL622.sb< Start>RRM749-0.sb< ' mahreen miangul Animate Move and Fire MaY 2017 ' Animate Sprite S-W-A-T-F SpaceBar ' Cannon Move and Fire XZ F GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = "1288" GraphicsWindow.Height = "666" GraphicsWindow.BackgroundColor="skyblue" GraphicsWindow.KeyDown = onkeyDown GraphicsWindow.BrushColor = "slateblue" cannon1_x = 333 cannon1_y = 566 cannon = Shapes.AddRectangle(50,100) Shapes.Move(cannon, cannon1_x, cannon1_y) '----------------- Draw Hill------------------------------------------------------------------------------------------------------- ' Hill GraphicsWindow.brushColor = "tan" GraphicsWindow.fillEllipse(-88,505,620,288) GraphicsWindow.fillEllipse(211,388,622,366) GraphicsWindow.fillEllipse(211,388,1888,666) 'Makesprite() SPRITE_init() ' <--------- all shape data is input here!! add_shapes() ' <--------- all shapes are added here!! dX=0 dY=0 GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor="darkslategray" Ball=Shapes.AddEllipse(40,40) Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) Timer.Interval=1000 '<-------------- Timer.Tick=kong_up '<-------------- 'Animate Cycle dZ = 0.1 zoom = 1 ddx=0 ' initial cycle moving speed-X ddy=0 ' initial cycle moving speed-Y bdx=0 ' initial ball moving speed-X bdy=10 ' initial ball moving speed-Y NMB="5:1" ' Santa & reindeer shapes number=5 repeat =1 shoot="False" While 0=0 ' Blinking   zoom = zoom - dZ   For i = 1 To Array.GetItemCount(shape[5]) ' Santa & reindeer shapes data number=5     If Array.ContainsValue(shape[5][i], "eye") Then       Shapes.Zoom(shp[NMB][i], 1, zoom)     ElseIf Array.ContainsValue(shape[5][i], "mouth") Then       Shapes.Zoom(shp[NMB][i], zoom, zoom)     EndIf shapes.Move(shp[NMB][i],shapes.GetLeft(shp[NMB][i])+ddx,shapes.Gettop(shp[NMB][i])+ddy) EndFor   If zoom = 0.1 Or zoom = 1 Then     dZ = -dZ   EndIf ' cycle reverse moving X,Y direction cycleX= shapes.GetLeft(shp[NMB][1]) ' 1 =reindeer's body cycleY= shapes.GetTop(shp[NMB][1]) If cycleX<0 Or cycleX>GraphicsWindow.Width-shape[5][1]["width"] Then ' 1 =reindeer's body ddx=-ddx EndIf If cycleY<0 Or cycleY>cannon1_y-shape[5][1]["height"] Then ' 1 =reindeer's body ddy=-ddy EndIf ' ball moving and collision check If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)+angle/4,shapes.Gettop(ball)-bdy) If shapes.Gettop(ball)<-100 then shoot="False" Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) EndIf ' collision check here ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (cycleX1 ' 1 =reindeer's body GraphicsWindow.Title="You Hit !!!!!!!!!!!" Sound.PlayChimeAndWait() shoot="False" Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) EndIf EndIf Program.Delay(20) EndWhile ' Sub kong_up Timer.Pause() For L=1 To Array.GetItemCount(shape[1]) Shapes.Rotate(SHP["1:1"][L],Shape[1][L]["angle"]) ' <-------------- rotating angle EndFor Program.Delay(300) For L=1 To Array.GetItemCount(shape[1]) Shapes.Rotate(SHP["1:1"][L], 0) ' <-------------- rotating angle EndFor Program.Delay(300) Timer.Resume() EndSub ' ' Sub add_shapes For M=1 to Array.GetItemCount(s) ' 5 types shapes // Kong , trees , House , Apple , sprite For N=1 to Array.GetItemCount(s[M]) ' repeat number //Kong=1 , trees =12 , House=1 , Apple=16 , sprite=1 ss=s[M][N] ' scale _shx=shx[M][N] ' base point _X _shY=shY[M][N] ' base point _Y _shape=shape[M] ' temporary shape data NMB=M+":"+N ' shape index 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[N][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 ' Keys S, W, A, T, X,Z,F , SpaceBar works Sub OnKeyDown key= GraphicsWindow.LastKey If key="S" Then ddx=4 ElseIf Key="W"then ddx=-4 ElseIf Key="A"then ddy=4 ElseIf key="T"Then ddy=-4 ElseIf key="Space" Then ddx=0 ddy=0 EndIf If shoot="False" Then If Key = "X" Then angle=angle+1 Shapes.Rotate(cannon,angle) ElseIf Key = "Z" Then angle=angle-1 Shapes.Rotate(cannon,angle) ElseIf Key="F" then Shapes.ShowShape(Ball) shoot="True" EndIf endif PMXY= text.GetCharacterCode(GraphicsWindow.LastKey) If PMXY=76 Or PMXY=82 Then ' Left Arrow : 76 Right Arrow : 82 dX= (PMXY-79)/3*5 ' <-- (82-76)/2=3 ,82-3=79 , dX=+5 or -5 dY=0 Move_index() elseIf PMXY=68 Or PMXY=85 Then ' Up Arrow : 85 Down Arrow : 68 dY= (76.5-PMXY)/8.5*5 ' <-- (85-68)/2=8.5, 85-8.5=76.5, dY=+5 or -5 dx=0 Move_index() endif EndSub Sub move_index For ii=1 To 47 ' <--- shp[] array number is 47 Shapes.Move(shp["1:1"][ii],Shapes.GetLeft(shp["1:1"][ii])+dX,Shapes.Gettop(shp["1:1"][ii])+dY) ' current position +dX ,+dY EndFor EndSub Sub SPRITE_init s[1] ="1=0.5" ' DONKEY KONG shX[1] ="1=0" shY[1] ="1=0" shape[1][1] = "func=ell;x=98;y=44;width=110;height=71;bc=#834216;pw=0;" shape[1][2] = "func=ell;x=51;y=247;width=75;height=23;angle=348;bc=#FDBC90;pc=#834216;pw=2;" shape[1][3] = "func=ell;x=197;y=250;width=74;height=22;angle=11;bc=#FDBC90;pc=#834216;pw=2;" shape[1][4] = "func=ell;x=113;y=253;width=20;height=22;bc=#FDBC90;pc=#834216;pw=2;" shape[1][5] = "func=ell;x=191;y=255;width=18;height=20;bc=#FDBC90;pc=#834216;pw=2;" shape[1][6] = "func=ell;x=40;y=260;width=13;height=16;bc=#FDBC90;pc=#834216;pw=2;" shape[1][7] = "func=ell;x=47;y=264;width=16;height=18;bc=#FDBC90;pc=#834216;pw=2;" shape[1][8] = "func=ell;x=261;y=267;width=13;height=13;bc=#FDBC90;pc=#834216;pw=2;" shape[1][9] = "func=ell;x=252;y=269;width=13;height=15;bc=#FDBC90;pc=#834216;pw=2;" shape[1][10] = "func=ell;x=81;y=190;width=36;height=67;angle=332;bc=#834216;pw=0;" shape[1][11] = "func=ell;x=200;y=188;width=35;height=67;angle=20;bc=#834216;pw=0;" shape[1][12] = "func=ell;x=76;y=175;width=62;height=43;bc=#834216;pw=0;" shape[1][13] = "func=ell;x=171;y=178;width=60;height=40;bc=#834216;pw=0;" shape[1][14] = "func=ell;x=112;y=139;width=82;height=76;bc=#834216;pw=0;" shape[1][15] = "func=ell;x=75;y=99;width=81;height=72;bc=#834216;pw=0;" shape[1][16] = "func=ell;x=149;y=96;width=82;height=74;bc=#834216;pw=0;" shape[1][17] = "func=ell;x=5;y=87;width=107;height=55;angle=340;bc=#834216;pw=0;" shape[1][18] = "func=ell;x=195;y=82;width=109;height=59;angle=25;bc=#834216;pw=0;" shape[1][19] = "func=ell;x=0;y=126;width=43;height=76;angle=341;bc=#834216;pw=0;" shape[1][20] = "func=ell;x=263;y=126;width=45;height=72;angle=17;bc=#834216;pw=0;" shape[1][21] = "func=ell;x=33;y=176;width=39;height=35;bc=#FDBC90;pc=#834216;pw=2;" shape[1][22] = "func=ell;x=239;y=176;width=41;height=37;bc=#FDBC90;pc=#834216;pw=2;" shape[1][23] = "func=tri;x=113;y=0;x1=37;y1=0;x2=0;y2=76;x3=75;y3=76;bc=#834216;pw=0;" shape[1][24] = "func=tri;x=148;y=5;x1=15;y1=0;x2=0;y2=43;x3=31;y3=43;bc=#834216;pw=0;" shape[1][25] = "func=ell;x=110;y=46;width=58;height=41;angle=33;bc=#FDBC90;pw=0;" shape[1][26] = "func=ell;x=138;y=47;width=61;height=41;angle=318;bc=#FDBC90;pw=0;" shape[1][27] = "func=tri;x=119;y=60;x1=33;y1=0;x2=0;y2=41;x3=67;y3=41;angle=180;bc=#000000;pc=#000000;pw=2;" shape[1][28] = "func=ell;x=127;y=61;width=28;height=19;angle=349;bc=#FFFFFF;pc=#000000;pw=2;" shape[1][29] = "func=ell;x=152;y=62;width=30;height=20;angle=16;bc=#FFFFFF;pc=#000000;pw=2;" shape[1][30] = "func=ell;x=135;y=66;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[1][31] = "func=ell;x=158;y=67;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[1][32] = "func=ell;x=123;y=140;width=59;height=60;bc=#FCA76E;pc=#834216;pw=2;" shape[1][33] = "func=ell;x=150;y=107;width=62;height=55;bc=#FCA76E;pw=0;" shape[1][34] = "func=ell;x=94;y=107;width=64;height=53;bc=#FCA76E;pw=0;" shape[1][35] = "func=ell;x=96;y=79;width=118;height=69;bc=#FDBC90;pc=#834216;pw=2;" shape[1][36] = "func=ell;x=77;y=65;width=35;height=23;angle=38;bc=#FDBC90;pc=#834216;pw=2;" shape[1][37] = "func=ell;x=194;y=63;width=36;height=23;angle=317;bc=#FDBC90;pc=#834216;pw=2;" shape[1][38] = "func=ell;x=130;y=74;width=22;height=17;angle=15;bc=#FDBC90;pw=0;" shape[1][39] = "func=ell;x=156;y=73;width=22;height=18;angle=348;bc=#FDBC90;pw=0;" shape[1][40] = "func=tri;x=111;y=90;x1=10;y1=0;x2=0;y2=22;x3=20;y3=22;angle=298;bc=#FFFFFF;pc=#000000;pw=2;" shape[1][41] = "func=tri;x=172;y=91;x1=11;y1=0;x2=0;y2=23;x3=22;y3=23;angle=62;bc=#FFFFFF;pc=#000000;pw=2;" shape[1][42] = "func=rect;x=125;y=97;width=55;height=21;bc=#FFFFFF;pc=#000000;pw=2;" shape[1][43] = "func=ell;x=135;y=78;width=15;height=9;angle=23;bc=#834216;pw=0;" shape[1][44] = "func=ell;x=159;y=77;width=15;height=9;angle=339;bc=#834216;pw=0;" shape[1][45] = "func=line;x=152;y=97;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[1][46] = "func=line;x=137;y=98;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[1][47] = "func=line;x=167;y=99;x1=0;y1=0;x2=0;y2=18;pc=#000000;pw=2;" ' 12 Trees s[2]="1=0.8;2=.8;3=.8;4=.8;5=.8;6=.8;7=.8;8=.8;9=.8;10=.8;11=.8;12=.8" shX[2]="1=-0;2=100;3=280;4=200;5=10;6=150;7=740;8=644;9=777;10=866;11=966;12=1088"" shY[2]="1=200;2=170;3=100;4=140;5=300;6=300;7=280;8=100;9=80;10=70;11=80;12=100" shape[2][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2" shape[2][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2 shape[2][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2 shape[2][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2 shape[2][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2 shape[2][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2 shape[2][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2 shape[2][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2 shape[2][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2 shape[2][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 ' 1 House s[3] ="1=.5" shX[3] ="1=88" shY[3] ="1=55" shape[3][1] = "func=rect;x=800;y=280;width=210;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A4 shape[3][2] = "func=rect;x=777;y=310;width=258;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A3 shape[3][3] = "func=rect;x=755;y=340;width=277;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A2 shape[3][4] = "func=rect;x=766;y=370;width=272;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A1 shape[3][5] = "func=tri;x=480;y=340;x1=222;y1=60;x2=262;y2=8;x3=320;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[3][6] = "func=tri;x=480;y=320;x1=244;y1=50;x2=280;y2=6;x3=320;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[3][7] = "func=tri;x=480;y=300;x1=267;y1=40;x2=298;y2=4;x3=320;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[3][8] = "func=tri;x=480;y=280;x1=292;y1=30;x2=320;y2=2;x3=320;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[3][9] = "func=tri;x=480;y=340;x1=530;y1=60;x2=585;y2=8;x3=636;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[3][10] = "func=tri;x=480;y=320;x1=530;y1=50;x2=566;y2=6;x3=608;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[3][11] = "func=tri;x=480;y=300;x1=530;y1=40;x2=548;y2=4;x3=580;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[3][12] = "func=tri;x=480;y=280;x1=530;y1=30;x2=530;y2=2;x3=555;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[3][13] = "func=rect;x=743;y=397;width=333;height=333;bc=snow;pc=darkslategray;pw=2"'Body Structpw=2ure shape[3][14] = "func=rect;x=766;y=608;width=100;height=122;bc=saddlebrown;pc=darkslategray;pw=2"'DoorA shape[3][15] = "func=ell;x=766;y=573;width=100;height=80;bc=saddlebrown;pw=2"'pc=saddlebrown;"'DoorB shape[3][16] ="func=ell;x=788;y=684;width=10;height=10;bc=yellow;pc=darcksategray;pw=2"'DoorC shape[3][17] ="func=rect;x=944;y=480;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowA shape[3][18] ="func=ell;x=944;y=428;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowB shape[3][19] = "func=rect;x=955;y=473;width=80;height=111;bc=skyblue;pc=darkslategray;pw=2"'windowC shape[3][20] = "func=ell;x=955;y=442;width=80;height=88;bc=skyblue;pc=darkslategray;pw=2"'windowD shape[3][21] ="func=line;x=877;y=451;x1=80;y1=30;x2=155;y2=30;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 1 shape[3][22] ="func=line;x=8977;y=451;x1=80;y1=60;x2=155;y2=60;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 2 shape[3][23] ="func=line;x=877;y=451;x1=80;y1=90;x2=155;y2=90;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 3 shape[3][24] ="func=line;x=900;y=395;x1=95;y1=44;x2=95;y2=188;bc=dodgerblue;pc=darkslategray;pw=2"'Window Grill 4 shape[3][25] ="func=rect;x=922;y=242;width=80;height=100;bc=crimson;pc=darkslategray;pw=2"'Chimny 1 shape[3][26] ="func=rect;x=911;y=241;width=100;height=20;bc=firebrick;pe;fi=False;x=340;y=72;width=200;height=113;pw=0;bc=#80FFFFFF;name=TextBox 2;" ' 16 Apples s[4] ="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" shX[4] ="1=-60;2=60;3=140;4=140;5=650;6=600;7=700;8=800;9=900;10=1000;11=1080;12=-80;13=0;14=100;15=740;16=240" shY[4] ="1=360;2=300;3=270;4=444;5=420;6=240;7=220;8=240;9=220;10=240;11=220;12=440;13=420;14=420;15=420;16=240" shape[4][1] = "func=rect;x=626;y=110;width=20;height=60;angle=30;bc=yellowgreen;pw=0;" shape[4][2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;" shape[4][3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;" shape[4][4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;" shape[4][5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;" shape[4][6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;" shape[4][7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;" shape[4][8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;" ' 1 Sprite Santa & reindeer s[5] = "1=0.7" shX[5]= "1=980" shY[5]= "1=10" shape[5][1] = "func=ell;x=28;y=110;width=120;height=58;bc=#814a27;pw=0" shape[5][2] = "func=rect;x=36;y=144;width=9;height=65;bc=#814a27;pw=0" shape[5][3] = "func=rect;x=49;y=143;width=9;height=65;bc=#814a27;pw=0" shape[5][4] = "func=rect;x=99;y=143;width=9;height=65;bc=#814a27;pw=0" shape[5][5] = "func=rect;x=113;y=143;width=9;height=65;bc=#814a27;pw=0" shape[5][6] = "func=rect;x=32;y=78;width=24;height=47;bc=#814a27;pw=0" shape[5][7] = "func=ell;x=140;y=115;width=18;height=20;bc=#814a27;pw=0" shape[5][8] = "func=rect;x=43;y=36;width=7;height=30;bc=#a7842a;pw=0" shape[5][9] = "func=rect;x=53;y=43;width=7;height=30;bc=#a7842a;pw=0" shape[5][10] = "func=rect;x=33;y=18;width=7;height=30;angle=-60;bc=#a7842a;pw=0" shape[5][11] = "func=rect;x=63;y=23;width=7;height=30;angle=60;bc=#a7842a;pw=0" shape[5][12] = "func=rect;x=20;y=0;width=7;height=30;bc=#a7842a;pW=0" shape[5][13] = "func=rect;x=75;y=3;width=7;height=30;bc=#a7842a;pw=0" shape[5][14] = "func=rect;x=29;y=109;width=27;height=7;bc=#000000;pw=2" shape[5][15] = "func=ell;x=21;y=112;width=18;height=18;bc=#c3ab6f;;pw=0" shape[5][16] = "func=rect;x=157;y=198;width=241;height=9;bc=#8c8c8c;pw=0" shape[5][17] = "func=rect;x=177;y=178;width=9;height=23;bc=#8c8c8c;pw=0" shape[5][18] = "func=rect;x=369;y=178;width=9;height=23;bc=#8c8c8c;pw=0" shape[5][19] = "func=rect;x=150;y=184;width=9;height=23;angle=-40;bc=#8c8c8c;pw=0" shape[5][20] = "func=rect;x=61;y=111;width=9;height=52;bc=#000000;pw=0" shape[5][21] = "func=rect;x=65;y=136;width=111;height=9;bc=#000000;pw=0" shape[5][22] = "func=ell;x=310;y=80;width=70;height=70;bc=#ebe4d0;pw=0" ' white toys bag shape[5][23] = "func=ell;x=237;y=81;width=85;height=90;bc=#9d1010;pw=0" ' red body shape[5][24] = "func=ell;x=255;y=50;width=40;height=50;bc=#ebe4d0;pw=0" ' white face shape[5][25] = "func=rect;x=258;y=61;width=33;height=21;bc=#dbb9a9;pw=0" ' pink face shape[5][26] = "func=ell;x=274;y=72;width=11;height=12;bc=#9d1010;pw=0" ' nose shape[5][27] = "func=ell;x=264;y=64;width=12;height=12;bc=#000000;pw=0;tag=eye" ' eye 1 <------ shape[5][28] = "func=ell;x=285;y=64;width=12;height=12;bc=#000000;pw=0;tag=eye" ' eye 2 <------ shape[5][29] = "func=rect;x=263;y=40;width=32;height=14;angle=13;bc=#9d1010;pw=0" 'red cap 1 shape[5][30] = "func=rect;x=265;y=34;width=36;height=13;bc=#9d1010;pw=0" ' red cap 2 shape[5][31] = "func=ell;x=295;y=30;width=18;height=20;bc=#ebe4d0;pw=0" 'white cap 3 shape[5][32] = "func=rect;x=255;y=82;width=10;height=45;angle=-22;bc=#ebe4d0;pw=0"' white strip 1 shape[5][33] = "func=rect;x=275;y=82;width=10;height=63;angle=22;bc=#ebe4d0;pw=0" ' white strip 2 shape[5][34] = "func=rect;x=176;y=136;width=202;height=43;bc=#563a1a;pw=0" ' cart shape[5][35] = "func=ell;x=205;y=60;width=25;height=25;bc=#ebe4d0;pw=0" ' white fingers shape[5][36] = "func=rect;x=207;y=77;width=26;height=34;angle=-10;bc=#9d1010;pw=0" ' red arm shape[5][37] = "func=rect;x=216;y=83;width=26;height=34;angle=-90;bc=#9d1010;pw=0" ' red shoulder shape[5][38] = "func=ell;x=11;y=65;width=55;height=20;bc=#814a27;pw=0" shape[5][39] = "func=ell;x=32;y=65;width=14;height=14;bc=#000000;pw=0;tag=eye" ' <------ shape[5][40] = "func=ell;x=4;y=68;width=14;height=14;bc=#9d1010;pw=0;tag=mouth" ' <------ shape[5][41] = "func=ell;x=52;y=65;width=28;height=10;angle=-20;bc=#814a27;pw=0" endsub End>RRM749-0.sb< Start>RRM749.sb< ' mahreen miangul Animate Move and Fire MaY 2017 ' Animate Sprite S-W-A-T-F SpaceBar ' Cannon Move and Fire XZ F GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = "1288" GraphicsWindow.Height = "666" GraphicsWindow.BackgroundColor="skyblue" GraphicsWindow.KeyDown = onkeyDown GraphicsWindow.BrushColor = "slateblue" cannon1_x = 333 cannon1_y = 566 cannon = Shapes.AddRectangle(50,100) Shapes.Move(cannon, cannon1_x, cannon1_y) '----------------- Draw Hill------------------------------------------------------------------------------------------------------- ' Hill GraphicsWindow.brushColor = "tan" GraphicsWindow.fillEllipse(-88,505,620,288) GraphicsWindow.fillEllipse(211,388,622,366) GraphicsWindow.fillEllipse(211,388,1888,666) 'Makesprite() init() SPRITE_init() ' <--------- all shape data is input here!! add_shapes() ' <--------- all shapes are added here!! dX=0 dY=0 ' sprite 'Sub Makesprite 'scale = 2.6 'x0 = 420 * scale 'y0 = 5 * scale GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor="darkslategray" Ball=Shapes.AddEllipse(40,40) Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) 'Animate Cycle dZ = 0.1 zoom = 1 ddx=0 ' initial cycle moving speed-X ddy=0 ' initial cycle moving speed-Y bdx=0 ' initial ball moving speed-X bdy=10 ' initial ball moving speed-Y NMB="5:1" ' Cycle shapes number=5 repeat =1 shoot="False" While 0=0 ' Blinking   zoom = zoom - dZ   For i = 1 To Array.GetItemCount(shape[5]) ' Cycle shapes number=5     If Array.ContainsValue(shape[5][i], "eye") Then       Shapes.Zoom(shp[NMB][i], 1, zoom)     ElseIf Array.ContainsValue(shape[5][i], "mouth") Then       Shapes.Zoom(shp[NMB][i], zoom, zoom)     EndIf shapes.Move(shp[NMB][i],shapes.GetLeft(shp[NMB][i])+ddx,shapes.Gettop(shp[NMB][i])+ddy) EndFor   If zoom = 0.1 Or zoom = 1 Then     dZ = -dZ   EndIf ' cycle reverse moving X,Y direction cycleX= shapes.GetLeft(shp[NMB][3]) ' = face cycleY= shapes.GetTop(shp[NMB][3]) If cycleX<0 Or cycleX>GraphicsWindow.Width-shape[5][3]["width"] Then ddx=-ddx EndIf If cycleY<0 Or cycleY>cannon1_y-shape[5][3]["height"] Then ddy=-ddy EndIf ' ball moving and collision check If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)+angle/4,shapes.Gettop(ball)-bdy) If shapes.Gettop(ball)<-100 then shoot="False" Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) EndIf ' collision check here ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (cycleX0 Then Shapes.Rotate(SHP[i], Shape[i]["angle"]) ' <-------------- rotating angle EndIf Program.Delay(50) EndFor endsub ' Shapes Data Kong Sub KONG_Init shape[1] = "func=ell;x=98;y=44;width=110;height=71;bc=#834216;pw=0;" shape[2] = "func=ell;x=51;y=247;width=75;height=23;angle=348;bc=#FDBC90;pc=#834216;pw=2;" shape[3] = "func=ell;x=197;y=250;width=74;height=22;angle=11;bc=#FDBC90;pc=#834216;pw=2;" shape[4] = "func=ell;x=113;y=253;width=20;height=22;bc=#FDBC90;pc=#834216;pw=2;" shape[5] = "func=ell;x=191;y=255;width=18;height=20;bc=#FDBC90;pc=#834216;pw=2;" shape[6] = "func=ell;x=40;y=260;width=13;height=16;bc=#FDBC90;pc=#834216;pw=2;" shape[7] = "func=ell;x=47;y=264;width=16;height=18;bc=#FDBC90;pc=#834216;pw=2;" shape[8] = "func=ell;x=261;y=267;width=13;height=13;bc=#FDBC90;pc=#834216;pw=2;" shape[9] = "func=ell;x=252;y=269;width=13;height=15;bc=#FDBC90;pc=#834216;pw=2;" shape[10] = "func=ell;x=81;y=190;width=36;height=67;angle=332;bc=#834216;pw=0;" shape[11] = "func=ell;x=200;y=188;width=35;height=67;angle=20;bc=#834216;pw=0;" shape[12] = "func=ell;x=76;y=175;width=62;height=43;bc=#834216;pw=0;" shape[13] = "func=ell;x=171;y=178;width=60;height=40;bc=#834216;pw=0;" shape[14] = "func=ell;x=112;y=139;width=82;height=76;bc=#834216;pw=0;" shape[15] = "func=ell;x=75;y=99;width=81;height=72;bc=#834216;pw=0;" shape[16] = "func=ell;x=149;y=96;width=82;height=74;bc=#834216;pw=0;" shape[17] = "func=ell;x=5;y=87;width=107;height=55;angle=340;bc=#834216;pw=0;" shape[18] = "func=ell;x=195;y=82;width=109;height=59;angle=25;bc=#834216;pw=0;" shape[19] = "func=ell;x=0;y=126;width=43;height=76;angle=341;bc=#834216;pw=0;" shape[20] = "func=ell;x=263;y=126;width=45;height=72;angle=17;bc=#834216;pw=0;" shape[21] = "func=ell;x=33;y=176;width=39;height=35;bc=#FDBC90;pc=#834216;pw=2;" shape[22] = "func=ell;x=239;y=176;width=41;height=37;bc=#FDBC90;pc=#834216;pw=2;" shape[23] = "func=tri;x=113;y=0;x1=37;y1=0;x2=0;y2=76;x3=75;y3=76;bc=#834216;pw=0;" shape[24] = "func=tri;x=148;y=5;x1=15;y1=0;x2=0;y2=43;x3=31;y3=43;bc=#834216;pw=0;" shape[25] = "func=ell;x=110;y=46;width=58;height=41;angle=33;bc=#FDBC90;pw=0;" shape[26] = "func=ell;x=138;y=47;width=61;height=41;angle=318;bc=#FDBC90;pw=0;" shape[27] = "func=tri;x=119;y=60;x1=33;y1=0;x2=0;y2=41;x3=67;y3=41;angle=180;bc=#000000;pc=#000000;pw=2;" shape[28] = "func=ell;x=127;y=61;width=28;height=19;angle=349;bc=#FFFFFF;pc=#000000;pw=2;" shape[29] = "func=ell;x=152;y=62;width=30;height=20;angle=16;bc=#FFFFFF;pc=#000000;pw=2;" shape[30] = "func=ell;x=135;y=66;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[31] = "func=ell;x=158;y=67;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[32] = "func=ell;x=123;y=140;width=59;height=60;bc=#FCA76E;pc=#834216;pw=2;" shape[33] = "func=ell;x=150;y=107;width=62;height=55;bc=#FCA76E;pw=0;" shape[34] = "func=ell;x=94;y=107;width=64;height=53;bc=#FCA76E;pw=0;" shape[35] = "func=ell;x=96;y=79;width=118;height=69;bc=#FDBC90;pc=#834216;pw=2;" shape[36] = "func=ell;x=77;y=65;width=35;height=23;angle=38;bc=#FDBC90;pc=#834216;pw=2;" shape[37] = "func=ell;x=194;y=63;width=36;height=23;angle=317;bc=#FDBC90;pc=#834216;pw=2;" shape[38] = "func=ell;x=130;y=74;width=22;height=17;angle=15;bc=#FDBC90;pw=0;" shape[39] = "func=ell;x=156;y=73;width=22;height=18;angle=348;bc=#FDBC90;pw=0;" shape[40] = "func=tri;x=111;y=90;x1=10;y1=0;x2=0;y2=22;x3=20;y3=22;angle=298;bc=#FFFFFF;pc=#000000;pw=2;" shape[41] = "func=tri;x=172;y=91;x1=11;y1=0;x2=0;y2=23;x3=22;y3=23;angle=62;bc=#FFFFFF;pc=#000000;pw=2;" shape[42] = "func=rect;x=125;y=97;width=55;height=21;bc=#FFFFFF;pc=#000000;pw=2;" shape[43] = "func=ell;x=135;y=78;width=15;height=9;angle=23;bc=#834216;pw=0;" shape[44] = "func=ell;x=159;y=77;width=15;height=9;angle=339;bc=#834216;pw=0;" shape[45] = "func=line;x=152;y=97;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[46] = "func=line;x=137;y=98;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[47] = "func=line;x=167;y=99;x1=0;y1=0;x2=0;y2=18;pc=#000000;pw=2;" EndSub Sub SPRITE_init ' 0 shapes s[1] ="1=0.2" shX[1] ="1=822" shY[1] ="1=30" ' 0 shapes s[2] ="1=.1" shX[2]="1=777" shY[2]="1=500" ' 1 House s[3] ="1=.5" shX[3] ="1=88" shY[3] ="1=55" shape[3][1] = "func=rect;x=800;y=280;width=210;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A4 shape[3][2] = "func=rect;x=777;y=310;width=258;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A3 shape[3][3] = "func=rect;x=755;y=340;width=277;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A2 shape[3][4] = "func=rect;x=766;y=370;width=272;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A1 shape[3][5] = "func=tri;x=480;y=340;x1=222;y1=60;x2=262;y2=8;x3=320;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[3][6] = "func=tri;x=480;y=320;x1=244;y1=50;x2=280;y2=6;x3=320;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[3][7] = "func=tri;x=480;y=300;x1=267;y1=40;x2=298;y2=4;x3=320;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[3][8] = "func=tri;x=480;y=280;x1=292;y1=30;x2=320;y2=2;x3=320;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[3][9] = "func=tri;x=480;y=340;x1=530;y1=60;x2=585;y2=8;x3=636;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[3][10] = "func=tri;x=480;y=320;x1=530;y1=50;x2=566;y2=6;x3=608;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[3][11] = "func=tri;x=480;y=300;x1=530;y1=40;x2=548;y2=4;x3=580;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[3][12] = "func=tri;x=480;y=280;x1=530;y1=30;x2=530;y2=2;x3=555;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[3][13] = "func=rect;x=743;y=397;width=333;height=333;bc=snow;pc=darkslategray;pw=2"'Body Structpw=2ure shape[3][14] = "func=rect;x=766;y=608;width=100;height=122;bc=saddlebrown;pc=darkslategray;pw=2"'DoorA shape[3][15] = "func=ell;x=766;y=573;width=100;height=80;bc=saddlebrown;pw=2"'pc=saddlebrown;"'DoorB shape[3][16] ="func=ell;x=788;y=684;width=10;height=10;bc=yellow;pc=darcksategray;pw=2"'DoorC shape[3][17] ="func=rect;x=944;y=480;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowA shape[3][18] ="func=ell;x=944;y=428;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowB shape[3][19] = "func=rect;x=955;y=473;width=80;height=111;bc=skyblue;pc=darkslategray;pw=2"'windowC shape[3][20] = "func=ell;x=955;y=442;width=80;height=88;bc=skyblue;pc=darkslategray;pw=2"'windowD shape[3][21] ="func=line;x=877;y=451;x1=80;y1=30;x2=155;y2=30;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 1 shape[3][22] ="func=line;x=8977;y=451;x1=80;y1=60;x2=155;y2=60;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 2 shape[3][23] ="func=line;x=877;y=451;x1=80;y1=90;x2=155;y2=90;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 3 shape[3][24] ="func=line;x=900;y=395;x1=95;y1=44;x2=95;y2=188;bc=dodgerblue;pc=darkslategray;pw=2"'Window Grill 4 shape[3][25] ="func=rect;x=922;y=242;width=80;height=100;bc=crimson;pc=darkslategray;pw=2"'Chimny 1 shape[3][26] ="func=rect;x=911;y=241;width=100;height=20;bc=firebrick;pe;fi=False;x=340;y=72;width=200;height=113;pw=0;bc=#80FFFFFF;name=TextBox 2;" ' 8 AppleS s[4] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=0.2;8=0.2" ' 1 Sprite s[5] = "1=0.7" shX[5]= "1=980" shY[5]= "1=10" shape[5][1] = "func=ell;x=28;y=110;width=120;height=58;bc=#814a27;pw=0" shape[5][2] = "func=rect;x=36;y=144;width=9;height=65;bc=#814a27;pw=0" shape[5][3] = "func=rect;x=49;y=143;width=9;height=65;bc=#814a27;;pw=0" shape[5][4] = "func=rect;x=99;y=143;width=9;height=65;bc=#814a27;pw=0" shape[5][5] = "func=rect;x=113;y=143;width=9;height=65;bc=#814a27;pw=0" shape[5][6] = "func=rect;x=32;y=78;width=24;height=47;bc=#814a27;pw=0" shape[5][7] = "func=ell;x=140;y=115;width=18;height=20;bc=#814a27;pw=0" shape[5][8] = "func=rect;x=43;y=36;width=7;height=30;bc=#a7842a;pw=0" shape[5][9] = "func=rect;x=53;y=43;width=7;height=30;bc=#a7842a;pw=0" shape[5][10] = "func=rect;x=33;y=18;width=7;height=30;angle=-60;bc=#a7842a;pw=0" shape[5][11] = "func=rect;x=63;y=23;width=7;height=30;angle=60;bc=#a7842a;pw=0" shape[5][12] = "func=rect;x=20;y=0;width=7;height=30;bc=#a7842a;pW=0" shape[5][13] = "func=rect;x=75;y=3;width=7;height=30;bc=#a7842a;pw=0" shape[5][14] = "func=rect;x=29;y=109;width=27;height=7;bc=#000000;pw=2" shape[5][15] = "func=ell;x=21;y=112;width=18;height=18;bc=#c3ab6f;;pw=0" shape[5][16] = "func=rect;x=157;y=198;width=241;height=9;bc=#8c8c8c;pw=0" shape[5][17] = "func=rect;x=177;y=178;width=9;height=23;bc=#8c8c8c;pw=0" shape[5][18] = "func=rect;x=369;y=178;width=9;height=23;bc=#8c8c8c;pw=0" shape[5][19] = "func=rect;x=150;y=184;width=9;height=23;angle=-40;bc=#8c8c8c;pw=0" shape[5][20] = "func=rect;x=61;y=111;width=9;height=52;bc=#000000;pw=0" shape[5][21] = "func=rect;x=65;y=136;width=111;height=9;bc=#000000;pw=0" shape[5][22] = "func=ell;x=310;y=80;width=70;height=70;bc=#ebe4d0;pw=0" ' white toys bag shape[5][23] = "func=ell;x=237;y=81;width=85;height=90;bc=#9d1010;pw=0" ' red body shape[5][24] = "func=ell;x=255;y=50;width=40;height=50;bc=#ebe4d0;pw=0" ' white face shape[5][25] = "func=rect;x=258;y=61;width=33;height=21;bc=#dbb9a9;pw=0" ' pink face shape[5][26] = "func=ell;x=274;y=72;width=11;height=12;bc=#9d1010;pw=0" ' nose shape[5][27] = "func=ell;x=264;y=64;width=12;height=12;bc=#000000;pw=0" ' eye 1 shape[5][28] = "func=ell;x=285;y=64;width=12;height=12;bc=#000000;pw=0" ' eye 2 shape[5][29] = "func=rect;x=263;y=40;width=32;height=14;angle=13;bc=#9d1010;pw=0" 'red cap 1 shape[5][30] = "func=rect;x=265;y=34;width=36;height=13;bc=#9d1010;pw=0" ' red cap 2 shape[5][31] = "func=ell;x=295;y=30;width=18;height=20;bc=#ebe4d0;pw=0" 'white cap 3 shape[5][32] = "func=rect;x=255;y=82;width=10;height=45;angle=-22;bc=#ebe4d0;pw=0"' white strip 1 shape[5][33] = "func=rect;x=275;y=82;width=10;height=63;angle=22;bc=#ebe4d0;pw=0" ' white strip 2 shape[5][34] = "func=rect;x=176;y=136;width=202;height=43;bc=#563a1a;pw=0" ' cart shape[5][35] = "func=ell;x=205;y=60;width=25;height=25;bc=#ebe4d0;pw=0" ' white fingers shape[5][36] = "func=rect;x=207;y=77;width=26;height=34;angle=-10;bc=#9d1010;pw=0" ' red arm shape[5][37] = "func=rect;x=216;y=83;width=26;height=34;angle=-90;bc=#9d1010;pw=0" ' red shoulder shape[5][38] = "func=ell;x=11;y=65;width=55;height=20;bc=#814a27;pw=0" shape[5][39] = "func=ell;x=32;y=65;width=14;height=14;bc=#000000;pw=0" shape[5][40] = "func=ell;x=4;y=68;width=14;height=14;bc=#9d1010;pw=0" shape[5][41] = "func=ell;x=52;y=65;width=28;height=10;angle=-20;bc=#814a27;pw=0" ' 12 Trees   s[6]="1=0.8;2=.8;3=.8;4=.8;5=.8;6=.8;7=.8;8=.8;9=.8;10=.8;11=.8;12=.8"   shX[6]="1=-0;2=100;3=280;4=200;5=10;6=150;7=740;8=644;9=777;10=866;11=966;12=1088""   shY[6]="1=200;2=170;3=100;4=140;5=300;6=300;7=280;8=100;9=80;10=70;11=80;12=100" shape[6][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2" shape[6][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2 shape[6][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2 shape[6][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2 shape[6][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2 shape[6][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2 shape[6][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2 shape[6][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2 shape[6][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2 shape[6][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[6][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[6][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[6][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 ' 16 Apples s[7] ="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" shX[7] ="1=-60;2=60;3=140;4=140;5=650;6=600;7=700;8=800;9=900;10=1000;11=1080;12=-80;13=0;14=100;15=740;16=240" shY[7] ="1=360;2=300;3=270;4=444;5=420;6=240;7=220;8=240;9=220;10=240;11=220;12=440;13=420;14=420;15=420;16=240" shape[7][1] = "func=rect;x=626;y=110;width=20;height=60;angle=30;bc=yellowgreen;pw=0;" shape[7][2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;" shape[7][3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;" shape[7][4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;" shape[7][5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;" shape[7][6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;" shape[7][7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;" shape[7][8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;" endsub End>RRM749.sb< Start>RRP679.sb< 'CONWAYS GAME OF LIFE IN 3D 'V. 0.1 by Gunthkab 'Rotation must be improved!!! colorDesign="redgreen"'"blackwhite"'/////////////////////INIT Standard Color-design of the cells rotator=0 '//////if you want to use rotation, change into 1!!!! '/////it will draw the rotation-buttons in DrawUI() GraphicsWindow.Title="Game of Life 3D V. 0.1" GraphicsWindow.BackgroundColor="black"'GraphicsWindow.GetColorFromRGB(210,210,210)'"black" GraphicsWindow.Height = 600'700 GraphicsWindow.Width = 820'1300 Controls.ButtonClicked = onButtonClick Controls.TextTyped = textinput1 GraphicsWindow.KeyDown = onKeyDown start=0 'for "do-nothing"-loop UI2loop=0 '////////////////////////////////////////////////////////'INIT STANDARD RULES r1=3'4'-1 '3'4'3'3 r2=2'5'-1 '4'4'4'4 r3=2'5'-1 '4'4'4'5 r4=3'5'4 '1'1'3' r5=4'5'4 '2'1'2'5 '//////////////////////////////////////////////////////// gridsize=4 'INIT STANDARD GRIDSIZE DrawUI() '////////////////////////////////////////////////////////'CALCULATE ALL VALUES FOR DRAWING Feldgröße=gridsize If gridsize < 10 then size= (12-gridsize)/10 positionY=(gridsize*10+(gridsize*10-20)) positionX=(-140+(gridsize-3)*40)+100 else size=0.2 positionY=(gridsize*10+(gridsize*10-20)) positionX=(-140+(gridsize-3)*40)+100 endif '////////////////////////////////////////////////////////'INIT VALUES FOR ROTATION moveX=0 moveY=0 multiY=1 xPos=0 xPosRot=0 xCorrect=10 rotateCountX=1 rotateCountY=1 '//////////////////////////////////////////////////////// programstart: If onestep=0 then 'SIMULATE ONLY ONE GENERATION DrawUI() endif While start=0 '"DO-NOTHING"-LOOP endwhile 'restart=0 'RunLoop: GraphicsWindow.Clear() Feldausgabe3D() 'DRAW ALL CELLS Nachbarprüfung3D() 'CALCULATE THE NEIGHBORS Felderneuerung3D() 'SAVE OLD GRID INTO NEWONE If onestep=1 then Program.Delay(500) 'PROGRAMDELAY AFTER DRAW ALL CELLS IN CONTINOUES SIMULATION endif start=onestep Goto programstart 'Goto RunLoop Sub Feldausgabe3D 'DRAW ALL CELLS GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650,570,150,"Press any Key to stop continuous Simulation!") For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr = 0 to Feldgröße If (grid[xr][yr][zr] = 1) Then If zr=0 And xr=0 then xPos=0 init() Else xPos=xPosRot*xr+xPosRot*(0.5*zr) 'FOR ROTATION init() 'draw one cell on the correct xyz-position endif EndIf Endfor EndFor EndFor 'foregroundCube() EndSub Sub Nachbarprüfung3D 'NEIGHBOR-CALCULATION For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr = 0 to Feldgröße buffergrid[xr][yr][zr]=0 Zellnachbar = 0 If (grid[xr-1][yr][zr] = 1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr-1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr+1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr+1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr-1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr-1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr+1][zr]=1) Then Zellnachbar = Zellnachbar + 1 EndIf '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If (grid[xr-1][yr][zr-1] = 1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr-1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr+1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr+1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr-1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr-1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr+1][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr][zr-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If (grid[xr-1][yr][zr+1] = 1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr-1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr-1][yr+1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr+1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr+1][yr-1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr-1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr+1][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[xr][yr][zr+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf 'GraphicsWindow.ShowMessage("" + Zellnachbar , "Zellnachbar") '/////////////////////////////////////////////////////////////////////////////'RULE-EVALUATION If (grid[xr][yr][zr]=1) Then If (Zellnachbar = r1 or Zellnachbar = r2) Then buffergrid[xr][yr][zr] = 1 Else buffergrid[xr][yr][zr] = 0 EndIf EndIf If(grid[xr][yr][zr]=0) Then If (Zellnachbar = r4 Or Zellnachbar = r5) Then' buffergrid[xr][yr][zr] = 1 Else 'buffergrid[x][y] = 0 EndIf EndIf '////////////////////////////////////////////////////////////////////////////////////// Endfor EndFor EndFor EndSub Sub Felderneuerung3D 'save the new calculated grid into the old one For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr = 0 to Feldgröße grid[xr][yr][zr] = buffergrid[xr][yr][zr] Endfor EndFor EndFor EndSub Sub DrawUI scaleUI2 = 0 If rotator=1 then buttonRotation1=Controls.AddButton("rotate left",gridsize+220,570) buttonRotation2=Controls.AddButton("rotate right",gridsize+310,570) endif GraphicsWindow.BrushColor= "blue" button1=Controls.AddButton(" Simulate one Step ",gridsize+650, 10) button11=Controls.AddButton("Continuous Simulation",gridsize+650, 40) GraphicsWindow.DrawBoundText(gridsize+650,120,155,"Color-Design of the Cells:") colordesignbutton1=Controls.AddButton("black-white",gridsize+650,145) colordesignbutton2=Controls.AddButton(" red-green ",gridsize+650,175) GraphicsWindow.PenColor= "white" GraphicsWindow.DrawLine(gridsize+640,0,gridsize+640,700) GraphicsWindow.DrawLine(gridsize+640,115,gridsize+820,115) GraphicsWindow.FontSize=15 GraphicsWindow.BrushColor= "blue" GraphicsWindow.DrawText(gridsize+642, 540,"current rules: "+r4+" "+r5+" "+r1+" "+r2) GraphicsWindow.DrawText(gridsize+680, 220,"Size: "+(gridsize+1)+"x"+(gridsize+1)+"x"+(gridsize+1)) GraphicsWindow.DrawText(gridsize+685,285,"PRESETS:") GraphicsWindow.BrushColor= "blue" GraphicsWindow.FontSize=12 buttonScale1=Controls.AddButton(" Scale up ",gridsize+735, 245) buttonScale2=Controls.AddButton("Scale down",gridsize+650 245) GraphicsWindow.DrawLine(gridsize+640,280,gridsize+820,280) GraphicsWindow.BrushColor= "blue" GraphicsWindow.FontSize=12 buttonPreset1=Controls.AddButton("Random",gridsize+660, 320) Controls.SetSize(buttonPreset1,132,26) buttonPreset2=Controls.AddButton("Preset2 ",gridsize+660, 380) buttonPreset3=Controls.AddButton("Preset3 ",gridsize+730, 350) buttonPreset41=Controls.AddButton("Preset4 ",gridsize+730, 380) buttonPreset4=Controls.AddButton("Preset1 ",gridsize+660, 350) buttonPreset5=Controls.AddButton(" Oszi1 ",gridsize+660, 410) buttonPreset6=Controls.AddButton(" Oszi2 ",gridsize+730, 410) GraphicsWindow.PenColor= "black" Endsub Sub DrawUI2 scaleUI2 = 1 GraphicsWindow.PenColor= "white" GraphicsWindow.BrushColor= "blue" GraphicsWindow.DrawLine(gridsize+640,0,gridsize+640,700) GraphicsWindow.DrawText(gridsize+650, 160,"current size: "+(gridsize+1)+"x"+(gridsize+1)+"x"+(gridsize+1)) GraphicsWindow.BrushColor= "blue" GraphicsWindow.FontSize=12 buttonScale1=Controls.AddButton(" Scale up ",gridsize+735, 180) buttonScale2=Controls.AddButton("Scale down",gridsize+650 180) GraphicsWindow.DrawLine(gridsize+640,220,gridsize+820,220) GraphicsWindow.BrushColor= "blue" GraphicsWindow.FontSize=12 GraphicsWindow.DrawText(gridsize+650, 240,"current rules: "+r4+" "+r5+" "+r1+" "+r2) rulebutton1=Controls.AddButton(" 3 4 3 2 ",gridsize+650, 260) rulebutton2=Controls.AddButton("4 4 -1 -1",gridsize+650, 290) rulebutton3=Controls.AddButton(" 4 5 5 5 ",gridsize+650, 320) rulebutton4=Controls.AddButton(" 1 2 3 4 ",gridsize+720, 260) rulebutton5=Controls.AddButton(" 1 1 4 4 ",gridsize+720, 290) rulebutton6=Controls.AddButton(" 2 3 3 4 ",gridsize+720, 320) GraphicsWindow.DrawLine(gridsize+640,360,gridsize+820,360) UI2loopbutton=Controls.AddButton("OK",gridsize+650, 390) Controls.SetSize(UI2loopbutton,150,50) Endsub Sub onKeyDown 'TO BREAK THE CONTINOUS SIMULATION onestep=0 start=0 Endsub Sub onButtonClick If Controls.LastClickedButton = colordesignbutton1 then colorDesign="blackwhite" GraphicsWindow.Clear() Feldausgabe3D() DrawUI() endif If Controls.LastClickedButton = colordesignbutton2 then colorDesign="redgreen" GraphicsWindow.Clear() Feldausgabe3D() DrawUI() endif If Controls.LastClickedButton = buttonRotation1 then 'FOR ROTATION left If rotateCountX < 7 then moveX= moveX-40/gridsize moveY= moveY+40/gridsize multiY=multiY+1 xPosRot=xPosRot-40/gridsize xCorrect=(xCorrect+40/gridsize) rotateCountX=rotateCountX+1 rotateCountY=rotateCountY-1 else endif GraphicsWindow.Clear() Feldausgabe3D() DrawUI() endif If Controls.LastClickedButton = buttonRotation2 then 'FOR ROTATION right If rotateCountY < 3 then moveX= moveX+40/gridsize moveY= moveY-40/gridsize xPosRot=xPosRot+40/gridsize xCorrect=(xCorrect-80/gridsize) rotateCountY=rotateCountY+1 rotateCountX=rotateCountX-1 else endif GraphicsWindow.Clear() Feldausgabe3D() DrawUI() endif If Controls.LastClickedButton = button1 Then '"SIMULATE ONLY ON GERNATION"-BUTTON onestep=0 start = 1 Endif If Controls.LastClickedButton = button11 Then '"CONTINOUS-SIMULATION-BUTTON onestep=1 start = 1 Endif If Controls.LastClickedButton = buttonScale1 Then 'SCALE UP THE GRID GraphicsWindow.Clear() If gridsize <11 then gridsize=gridsize+1 else gridsize = 11 endif Feldgröße=gridsize If gridsize < 10 then size= (12-gridsize)/10 positionY=gridsize*10+(gridsize*10-20) positionX=(-140+(gridsize-3)*40)+100 else size=0.3 positionY=gridsize*10+(gridsize*10-20) positionX=((-140+(gridsize-3)*40)+100)-100 endif initPreset() If scaleUI2 = 1 then DrawUI2() else DrawUI() endif Endif If Controls.LastClickedButton = buttonScale2 Then 'SCALE DOWN THE GRID GraphicsWindow.Clear() If gridsize >1 then gridsize=gridsize-1 else gridsize = 1 endif Feldgröße=gridsize If gridsize < 10 then size= (12-gridsize)/10 positionY=gridsize*10+(gridsize*10-20) positionX=(-140+(gridsize-3)*40)+100 else size=0.4 positionY=gridsize*10+(gridsize*10-20) positionX=((-140+(gridsize-3)*40)+100)-100 endif initPreset() If scaleUI2 = 1 then DrawUI2() else DrawUI() endif Endif If Controls.LastClickedButton = UI2loopbutton Then ' GraphicsWindow.Clear() DrawUI() Feldausgabe3D() Endif If Controls.LastClickedButton = buttonPreset1 Then start=0 Presetnumber=1 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset works good with all Rules!") DrawUI2() initPreset()'Zufallsbelegung3D() Endif If Controls.LastClickedButton = buttonPreset2 Then start=0 Presetnumber=2 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) 'GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset works good with all Rules!") DrawUI2() initPreset()' Endif If Controls.LastClickedButton = buttonPreset3 Then start=0 Presetnumber=3 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset works good with the Rule 2 3 3 4 and a odd gridsize") DrawUI2() initPreset()' Endif If Controls.LastClickedButton = buttonPreset41 Then start=0 Presetnumber=41 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) DrawUI2() initPreset()' Endif If Controls.LastClickedButton = buttonPreset4 Then start=0 Presetnumber=4 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset works good with the Rule 3 4 3 2 and a size of 7x7x7 or 9x9x9!") DrawUI2() initPreset()'Test3D() Endif If Controls.LastClickedButton = buttonPreset5 Then start=0 Presetnumber=5 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset only oscillates with the Rule 4 4 -1 -1!") DrawUI2() initPreset()'Oszi3D() Endif If Controls.LastClickedButton = buttonPreset6 Then start=0 Presetnumber=6 GraphicsWindow.Clear() GraphicsWindow.BrushColor="red"'GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.DrawBoundText(gridsize+650, 50,150,"This Preset only oscillates with the Rule 4 4 -1 -1!") DrawUI2() initPreset()'Oszi13D() Endif If Controls.LastClickedButton = rulebutton1 then r1=3 r2=2 r3=2 r4=3 r5=4 GraphicsWindow.Clear() DrawUI2() endif If Controls.LastClickedButton = rulebutton2 then r1=-1 r2=-1 r4=4 r5=4 GraphicsWindow.Clear() DrawUI2() endif If Controls.LastClickedButton = rulebutton3 then r1=5 r2=5 r4=4 r5=5 GraphicsWindow.Clear() DrawUI2() endif If Controls.LastClickedButton = rulebutton4 then r1=3 r2=4 r4=1 r5=2 GraphicsWindow.Clear() DrawUI2() endif If Controls.LastClickedButton = rulebutton5 then r1=4 r2=4 r4=1 r5=1 GraphicsWindow.Clear() DrawUI2() endif If Controls.LastClickedButton = rulebutton6 then r1=3 r2=4 r4=2 r5=3 GraphicsWindow.Clear() DrawUI2() endif Endsub Sub textinput1 endsub Sub initPreset moveX=0 moveY=0 multiY=1 xPos=0 xPosRot=0 xCorrect=10 If Presetnumber=1 then Zufallsbelegung3D() endif If Presetnumber=5 then Oszi3D() endif If Presetnumber=6 then Oszi13D() endif If Presetnumber=4 then Test3D() endif If Presetnumber=2 then Preset23D() endif If Presetnumber=3 then Preset3() endif If Presetnumber=41 then Preset4() endif Endsub Sub init 'GENERATE THE CUBE-PARTS GraphicsWindow.PenWidth = 1 farbton = zr+1 pos=0 col=Feldgröße+1 xx=0.5*moveX yy=moveY*0.5 'GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(0*farbton/col,0*farbton/col,0*farbton/col) If colorDesign="redgreen" then GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,0,0) GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,50,0) endif If colorDesign="blackwhite" then GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(0*farbton/col,0*farbton/col,0*farbton/col) GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,255*farbton/col,255*farbton/col) endif boxes0[xr][yr][zr] = Shapes.AddTriangle(0*size+xPos+xCorrect,0*size+yy,0*size+xPos+xCorrect,80*size+yy,79.4*size+moveX+xPos+xCorrect,89.75*size+yy) boxes1[xr][yr][zr] = Shapes.AddTriangle(0*size+xPos+xCorrect,0*size+yy,79.4*size+moveX+xPos+xCorrect,9.75*size+yy,79.4*size+moveX+xPos+xCorrect,89.75*size+yy) 'GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,0,0) If colorDesign="redgreen" then GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,80,0) endif If colorDesign="blackwhite" then GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(230*farbton/col,230*farbton/col,230*farbton/col) endif boxes2[xr][yr][zr] = Shapes.AddTriangle(0*size+xPos+xCorrect,0*size+yy,75.4*size+moveX+xPos+xCorrect,9.75*size+yy,104.13*size+xx+xPos+xCorrect,-16.02*size+yy) boxes3[xr][yr][zr] = Shapes.AddTriangle(0*size+xPos+xCorrect,0*size+yy,29.73*size-xx+xPos+xCorrect,-26.77*size+yy,104.13*size+xx+xPos+xCorrect,-16.02*size+yy) 'GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,0,0) If colorDesign="redgreen" then GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(255*farbton/col,65,0) endif If colorDesign="blackwhite" then GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(200*farbton/col,200*farbton/col,200*farbton/col) endif boxes4[xr][yr][zr] = Shapes.AddTriangle(0*size+moveX+xPos+xCorrect,0*size+yy,29.73*size+xx+xPos+xCorrect,50.23*size+yy,0*size+moveX+xPos+xCorrect,78*size+yy) boxes5[xr][yr][zr] = Shapes.AddTriangle(0*size+moveX+xPos+xCorrect,0*size+yy,29.73*size+xx+xPos+xCorrect,-26.77*size+yy,29.73*size+xx+xPos+xCorrect,50.23*size+yy) white=0 ll=zr kk=yr ii=xr 'x 2 Cubetransform() Endsub Sub Cubetransform 'DRAW THE CUBES ON THE CORRECT POSITION GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor="blue" zz=1 aw=0 a=9.75 b=79.4 c=80 dxl=29.73 dyl=-26.77 Shapes.Move(boxes0[xr][yr][zr],(250.0-dxl*ll+b*ii)*size+positionX,(376.77-dyl*ll+a*ii-c*kk)*size+positionY) Shapes.Move(boxes1[xr][yr][zr],(250.0-dxl*ll+b*ii)*size+positionX,(376.77-dyl*ll+a*ii-c*kk)*size+positionY) Shapes.Move(boxes2[xr][yr][zr],(254.87-dxl*ll+b*ii)*size+positionX,(376.00-dyl*ll+a*ii-c*kk)*size+positionY) Shapes.Move(boxes3[xr][yr][zr],(250.87-dxl*ll+b*ii)*size+positionX,(376.00-dyl*ll+a*ii-c*kk)*size+positionY) Shapes.Move(boxes4[xr][yr][zr],(330.27-dxl*ll+b*ii)*size+positionX,(388-dyl*ll+a*ii-c*kk)*size+positionY) Shapes.Move(boxes5[xr][yr][zr],(330.27-dxl*ll+b*ii)*size+positionX,(388-dyl*ll+a*ii-c*kk)*size+positionY) GraphicsWindow.PenWidth = 1 EndSub '/////////////////////////////////////////////////////////PRESETS/////////////////////////////////////////////////// Sub Blinker3D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[1][2][2]=1 grid[2][2][2]=1 grid[3][2][2]=1 grid[3][3][2]=1 grid[3][4][2]=1 EndSub Sub Test3D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 EndSub Sub Preset23D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2-1)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2+1)]=1 EndSub Sub Oszi3D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)]=1 EndSub Sub Oszi13D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2-1)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)][Math.Floor(gridsize/2-1)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2-1)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2-1)]=1 grid[Math.Floor(gridsize/2)][Math.Floor(gridsize/2-1)][Math.Floor(gridsize/2)]=1 grid[Math.Floor(gridsize/2+1)][Math.Floor(gridsize/2+2)][Math.Floor(gridsize/2-1)]=1 EndSub Sub Muster3D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[0][0][0]=1 grid[Math.Floor(gridsize/2)][0][gridsize]=1 For zi=1 to gridsize grid[0][0][zi]=1 Endfor For zi=1 to gridsize grid[gridsize][0][zi]=1 Endfor For zi=1 to gridsize grid[0][gridsize][zi]=1 Endfor For xi=1 to gridsize grid[xi][0][0]=1 Endfor For yi=1 to gridsize grid[0][yi][0]=1 Endfor EndSub Sub Zufallsbelegung3D For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 To Feldgröße If (Math.GetRandomNumber(5) > 4) Then grid[xr][yr][zr] = 1 Else grid[xr][yr][zr] = 0 EndIf Endfor EndFor Endfor EndSub Sub Preset3'osziliert mit 2334 For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor grid[gridsize][gridsize][gridsize]=1 grid[gridsize][gridsize][gridsize-1]=1 grid[gridsize][gridsize][gridsize-2]=1 grid[gridsize][gridsize-1][gridsize]=1 grid[gridsize][gridsize-2][gridsize]=1 grid[gridsize-1][gridsize][gridsize]=1 grid[gridsize-2][gridsize][gridsize]=1 EndSub Sub Preset4'osziliert mit 2334 For xr = 0 To Feldgröße For yr = 0 To Feldgröße For zr =0 to Feldgröße grid[xr][yr][zr]=0 endfor EndFor EndFor For xi=0 to gridsize grid[xi][Math.Floor(gridsize/2)][Math.Floor(gridsize/2)]=1 Endfor EndSub End>RRP679.sb< Start>RRQ220.sb< GraphicsWindow.Title = "Cogs 3" Init() GraphicsWindow.BackgroundColor="black" bc = "gold" width = 42 height = 30 w_2 = width / 2 ratio = 0.3 c = "1=12;2=6;3=8;" r = "1=120;2=60;3=80;" _ox = "1=180;2=345;3=460;" _oy = "1=170;2=315;3=180;" a0 = "1=-5;2=7;3=-5;" For g = 1 To 3 h[g] = Math.SquareRoot(r[g] * r[g] + w_2 * w_2) + 1 GraphicsWindow.PenWidth = h[g] - 20 GraphicsWindow.PenColor = bc GraphicsWindow.BrushColor = "Transparent" gear = Shapes.AddEllipse(2 * h[g], 2 * h[g]) Shapes.Move(gear, _ox[g] - h[g], _oy[g] - h[g]) GraphicsWindow.PenWidth = 0 ox = _ox[g] oy = _oy[g] x = ox - width / 2 y = oy - (r[g] + height) angle = 0 For i = 1 To c[g] AddTrapezoid() angle = angle + 360 / c[g] RotateShapesAt() If i = 1 Then ns[g] = n ElseIf i = c[g] Then ne[g] = n EndIf EndFor angle = a0[g] For n = ns[g] To ne[g] RotateShapesAt() EndFor EndFor q5=30 For ff=1 To q5 sign = 1 For g = 1 To 3 angle = sign * 12 / c[g] ox = _ox[g] oy = _oy[g] For n = ns[g] To ne[g] RotateShapesAt() EndFor sign = -sign EndFor ii=ii+1 cc[ii]=LDGraphicsWindow.Capture("" "false") LDImage.MakeTransparent(cc[ii] "black") Program.Delay(50) EndFor GraphicsWindow.Clear() For ff=1 To q5 For r=1 To 10 GraphicsWindow.DrawImage(cc[ff] ,-r r) EndFor ccc[ff]=LDGraphicsWindow.Capture("" "false") Program.Delay(35) GraphicsWindow.Clear() EndFor While 1=1 For mm=1 To q5 GraphicsWindow.DrawImage(ccc[mm] 0 0) Program.Delay(25) EndFor EndWhile Sub AddTrapezoid GraphicsWindow.BrushColor = bc _x = x _y = y _width = width _height = height ' left triangle x1 = height * ratio y1 = 0 x2 = 0 y2 = _height x3 = x1 * 2 y3 = y2 shp[1] = Shapes.AddTriangle(x1, y1, x2, y2, x3, y3) cx[1] = x1 cy[1] = y2 / 2 Shapes.Move(shp[1], x, y) ' right triangle x = _x + width - x3 shp[2] = Shapes.AddTriangle(x1, y1, x2, y2, x3, y3) cx[2] = x1 cy[2] = y2 / 2 Shapes.Move(shp[2], x, y) ' middle rectangle x = _x + x1 width = _width - x3 shp[3] = Shapes.AddRectangle(width, height) cx[3] = width / 2 cy[3] = height / 2 Shapes.Move(shp[3], x, y) x = _x y = _y width = _width height = _height n = n + 1 trap[n]["shp"] = shp trap[n]["cx"] = cx trap[n]["cy"] = cy trap[n]["a"] = 0 EndSub Sub RotateShapesAt shp = trap[n]["shp"] cx = trap[n]["cx"] cy = trap[n]["cy"] a = trap[n]["a"] + angle If 360 <= a Then a = a - 360 EndIf trap[n]["a"] = a _angle = angle * Math.Pi / 180 _n = Array.GetItemCount(shp) For _i = 1 To _n x1 = Shapes.GetLeft(shp[_i]) + cx[_i] y1 = Shapes.GetTop(shp[_i]) + cy[_i] _x = x1 - ox _y = y1 - oy x2 = ox + Math.Cos(_angle) * _x - Math.Sin(_angle) * _y y2 = oy + Math.Sin(_angle) * _x + Math.Cos(_angle) * _y Shapes.Move(shp[_i], x2 - cx[_i], y2 - cy[_i]) Shapes.Rotate(shp[_i], a) EndFor EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.PenWidth = 0 EndSub End>RRQ220.sb< Start>RRQ564-1.sb< Sub init not="true=false;false=true LDGraphicsWindow.TransparentGW() mm["File"]="Main mm["New"]="File mm["Open"]="File mm["OpenDfs"]="File mm["Save"]="File mm["-"]="File mm["Exit"]="File mm["Edit"]="Main mm["Replace"]="Edit mm["List"]="Edit mm["ListDfs"]="Edit ch["ListDfs"]="false mm["AutoLinNr"]="Edit ch["AutoLinNr"]="true mm["UnMute"]="Edit ch["UnMute"]="true mm["Run"]="Main mm["Start"]="Run mm["Stop"]="Run sf=1.25 GraphicsWindow.Left=5 GraphicsWindow.top=5 LDGraphicsWindow.TopMost="true Timer.Interval=250 Timer.Tick=ttt TextWindow.Left=5 TextWindow.Top=5 ms=LDControls.AddMenu(500 30 mm "" ch) LDShapes.BrushColour(ms "SandyBrown") LDShapes.PenColour(ms "black") LDControls.MenuClicked=mcc LDControls.MenuBackground(ms "gold") TextWindow.BackgroundColor="darkblue TextWindow.Clear() TextWindow.Title="QBasic Editor LDTextWindow.SetColour(7 "#aaaaaa") TextWindow.ForegroundColor=7 'TextWindow.WriteLine("Edit:") LDTextWindow.KeyDown=kkk LDTextWindow.Keyup=kuu not="false=true;true=false cps="false ldTextWindow.Encoding="Unicode 'TextWindow.Write("░▒▓█┌─┐│┼┴┬┤├└┘") mem=LDFastArray.add() For wy=1 To 200 For wx=1 To 160 LDFastArray.set2D(mem wx wy " ") EndFor EndFor If LDControls.MenuChecked(ms "Autolinnr") Then lll=lll+10 ldcall.function("twrt" lll+":") EndIf EndSub nnn=Text.GetCharacter(13)+Text.GetCharacter(10) ttb=Text.GetCharacter(9) args=0 init() Sub wsetup If www="true" Then Else GraphicsWindow.Width=600 GraphicsWindow.Height=400 www="true GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height) GraphicsWindow.Show() GraphicsWindow.BackgroundColor="tan EndIf EndSub While 1=1'---------------mainloop=============== If rnn Then TextWindow.Title="running >>> Timer.Pause() GraphicsWindow.Hide() indd="true arrmk() arr=LDText.Replace(arr "?" "print ") TextWindow.Clear() pl=LDText.Split(arr nnn) ln=1 dfmk() For gg=1 To Array.GetItemCount(pl)'----------make gotolbl index------- li=LDText.Split(text.ConvertToLowerCase(pl[gg]) ":") pl[gg]=LDText.Replace(pl[gg] "msin" "Math.sin") For qq=1 To Array.GetItemCount(arrd) pl[gg]=LDText.Replace(pl[gg] arrd[qq][1] arrd[qq][2]) EndFor gtt[li[1]]=gg EndFor 'GraphicsWindow.ShowMessage(pl "") 'TextWindow.WriteLine(gtt) While ln<=Array.GetItemCount(pl)'--------main run loop-------================== li=LDText.Split((pl[ln]) ":") For mi=2 To Array.GetItemCount(li) vi=LDText.Split(ldtext.replace(li[mi] "=" " = ") " ") vi[1]=text.ConvertToLowerCase(vi[1]) If vi[2]="=" Then vi[2]=vi[1] vi[1]="set" EndIf If Text.StartsWith(vi[1] "inpu") Then varr[vi[2]]=fcDialogs.AskForTextLine(vi[3]) ElseIf Text.StartsWith(vi[1] "paus") Then Program.Delay(vi[2]) ElseIf Text.StartsWith(vi[1] "sptr") Then memm[varr[vi[2]]]=varr[vi[3]] ' GraphicsWindow.ShowMessage(memm "") ElseIf Text.StartsWith(vi[1] "gosub") Then Stack.PushValue("gss" ln+1) ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "ret") Then If Stack.GetCount("gss")>0 Then ln=Stack.PopValue("gss") Goto ccc Else fcDialogs.ShowMessageAsError("ret w/o gosub on #"+ln+":"+gtt[ln]) EndIf ElseIf Text.StartsWith(vi[1] "cp") or Text.StartsWith(vi[1] "cmp") Then oa=varr["a"] oa=oa-vi[2] If oa=0 Then zff="true Else zff="false EndIf ElseIf Text.StartsWith(vi[1] "push") Then Stack.PushValue("reg" varr[vi[2]]) ElseIf Text.StartsWith(vi[1] "pop") and Stack.GetCount("reg")>0 Then varr[vi[2]]=Stack.PopValue("reg") ElseIf Text.StartsWith(vi[1] "add") Then varr[vi[2]]=varr[vi[2]]+varr[vi[3]] ElseIf Text.StartsWith(vi[1] "sub") Then varr[vi[2]]=varr[vi[2]]-varr[vi[3]] ElseIf Text.StartsWith(vi[1] "schr") Then TextWindow.Write(Text.GetCharacter(ldcall.Function("eptr" vi[2]))) ElseIf Text.StartsWith(vi[1] "inc") Then ii=vi[3] If ii=0 or ii="" Then ii=1 EndIf varr[vi[2]]=varr[vi[2]]+ii ElseIf Text.StartsWith(vi[1] "dec") Then ii=vi[3] If ii=0 or ii="" Then ii=1 EndIf varr[vi[2]]=varr[vi[2]]-ii ElseIf Text.StartsWith(vi[1] "djnz") Then varr["bc"]=varr["bc"]-1 If varr["bc"]>0 Then ln=gtt[vi[2]] Goto ccc EndIf ElseIf Text.StartsWith(vi[1] "jpz") and zff Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "jpnz") and not[zff] Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "goto") Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "if") Then If LDMath.Evaluate3( LDCall.Function("wset" vi[2])) Then ln=gtt[vi[3]] Else ln=gtt[vi[4]] EndIf Goto ccc ElseIf Text.StartsWith(vi[1] "plot") Then wsetup() GraphicsWindow.SetPixel(LDMath.Evaluate2(LDCall.Function("wset" vi[2])+"+0") LDMath.Evaluate2(LDCall.Function("wset" vi[3])+"+0") vi[4]) ElseIf Text.StartsWith(vi[1] "set")or Text.StartsWith(vi[1] "ld") or (vi[1]= "mov") Then varr[vi[2]]=LDMath.Evaluate2(LDCall.Function("wset" vi[3])+"+0") ElseIf Text.StartsWith(vi[1] "@pri") Then TextWindow.CursorLeft=vi[3] TextWindow.CursorTop=vi[4] Goto pp ElseIf Text.StartsWith(vi[1] "prin") Then pp: TextWindow.Write(ldtext.Replace(ldtext.Replace(ldtext.Replace(ldtext.Replace( LDCall.Function("numm" LDCall.Function("wset" vi[2])) "\n" nnn)"\t" ttb) "[" " = " )"\s" " ")) EndIf EndFor ln=ln+1 ccc: EndWhile TextWindow.Title="ok GraphicsWindow.ShowMessage("OK Done." "QBasic") GraphicsWindow.Show() www="false GraphicsWindow.Height=25 GraphicsWindow.Width=300 Timer.Resume() plist() rnn="false indd=rnn EndIf EndWhile sub numm if FCExtensions.IsNumber(args[1]) Then return=LDMath.FixDecimal(args[1] 4) Else return=(args[1]) EndIf EndSub Sub plist TextWindow.Clear() arrmk() arr=LDText.Replace(arr "?" "Print ") arr2mm() mwrt() TextWindow.CursorLeft=0 TextWindow.CursorTop=1 EndSub Sub wset ii=args[1] ac=Array.GetAllIndices(varr) For rt=1 To Array.GetItemCount(ac) ii=LDText.Replace(ii "#"+ac[rt] varr[ac[rt]]) EndFor return=ii EndSub Sub eptr If Text.StartsWith(args[1] "$") Then return=memm[varr[text.GetSubTextToEnd( args[1] 2)]] Else return=args[1] EndIf EndSub Sub arrmk'---------------create array from edits arr="" For wy=1 To 200 al="" For wx=1 To 158 al=Text.Append(al LDFastArray.get2D(mem wx wy)) EndFor arr=Text.Append(arr al+nnn) EndFor EndSub Sub dfmk'---------------create array from defines arrd="" For wy=1 To 50 al="" For wx=1 To 158 al=Text.Append(al LDFastArray.get2D(memd wx wy)) EndFor al=LDText.Trim(al) arrd[wy]=LDText.Split(al ":") EndFor ' GraphicsWindow.ShowMessage(arrd "") EndSub Sub arr2mm'--------------fastarray recreate in=0 For wy=1 To 200 For wx=1 To 158 in=in+1 LDFastArray.set2D(mem wx wy text.GetSubText(arr in 1)) EndFor While text.GetCharacterCode(text.GetSubText(arr in 1))>31 in=in+1 EndWhile in=in+1 EndFor EndSub sub memdel For wy=1 To 200 For wx=1 To 158 LDFastArray.set2D(mem wx wy " ") EndFor EndFor EndSub sub loadmem ca=LDText.Split(cc nnn) memdel() for wy=1 to Array.GetItemCount(ca) for fx=1 to Text.GetLength(ca[wy]) LDFastArray.set2D(mem fx wy text.GetSubText(ca[wy] fx 1)) EndFor EndFor EndSub Sub twrt'----------------memo&shw input px=TextWindow.CursorLeft+1 py=TextWindow.CursorTop+1 txx=args[1] For rw=1 To Text.GetLength(txx) LDFastArray.Set2D(mem px+rw-1 py Text.GetSubText(txx rw 1)) EndFor TextWindow.Write(txx) EndSub Sub mcc'-----------------menu handling---------------- ii=text.ConvertToLowerCase( LDControls.LastMenuItem) If ii="new" Then TextWindow.Clear() ElseIf ii="unmute" Then indd=not[LDControls.MenuChecked(ms "UnMute")] ElseIf ii="start" Then rnn="true ElseIf ii="stop" Then rnn="false ElseIf ii="exit" Then Program.End() ElseIf ii="list" Then plist() ElseIf ii="replace" Then indd="true tf=FCDialogs.AskForTextLine("text to fnd:") If tf="" Then Else tr=FCDialogs.AskForTextLine("text to replace:") arrmk() arr=LDText.Replace(arr tf tr) ' GraphicsWindow.ShowMessage(arr "") arr2mm() TextWindow.Clear() mwrt() EndIf indd="false ElseIf ii="save" Then indd="true ff=LDDialogs.saveFile("1=txt;2=bas;3=sb;4=itt" "e:\") mw=LDFastArray.ToArray(mem) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(ff mw) indd="false ElseIf ii="open" Then indd="true ff=LDDialogs.OpenFile("1=txt;2=bas;3=sb;4=itt" "e:\") ' 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. ' cc=File.ReadContents(ff) TextWindow.Clear() If Text.IsSubText(ff ".itt") Then mem=LDFastArray.CreateFromValues(cc) mwrt() Else loadmem() mwrt() EndIf indd="false TextWindow.Title=ff EndIf ElseIf ii="opendfs" Then indd="true ff=LDDialogs.OpenFile("1=itt;2=dff" "e:\") ' 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. ' cc=File.ReadContents(ff) TextWindow.Clear() memd=LDFastArray.CreateFromValues(cc) mwrt() EndIf indd="False EndIf 'TextWindow.Title=ii EndSub Sub mwrt'----------------list cmd If LDControls.MenuChecked(ms "listdfs") Then p50=50 Else p50=0 EndIf For wy=1 To 200 For wx=1 To 158 TextWindow.CursorLeft=wx-1 TextWindow.CursorTop=wy-1+p50 TextWindow.Write(LDFastArray.Get2D(mem wx wy)) EndFor EndFor If LDControls.MenuChecked(ms "listdfs") Then TextWindow.CursorLeft=0 TextWindow.CursorTop=0 TextWindow.Write("#defines:") For wy=1 To 50 For wx=1 To 158 TextWindow.CursorLeft=wx-1 TextWindow.CursorTop=wy TextWindow.Write(LDFastArray.Get2D(memd wx wy)) EndFor EndFor EndIf TextWindow.CursorLeft=0 TextWindow.CursorTop=p50 EndSub Sub ttt'-----------------Timer GraphicsWindow.Left=TextWindow.Left/sf+35 GraphicsWindow.Top=TextWindow.Top/sf EndSub Sub kuu'-----------------kyup lky=text.ConvertToLowerCase( LDTextWindow.LastKey) If Text.EndsWith(lky "iftkey") and not[cps] Then shh="false EndIf EndSub Sub kkk'-----------------keybrd-handling---------- If indd Then Else lk=text.ConvertToLowerCase( LDTextWindow.LastKey) 'TextWindow.WriteLine(lk) ' TextWindow.Title=lk If lk="return" Then 'TextWindow.WriteLine("") TextWindow.CursorLeft=0 TextWindow.CursorTop=TextWindow.CursorTop+1 If LDControls.MenuChecked(ms "Autolinnr") Then lll=lll+10 ldcall.function("twrt" lll+":") EndIf ElseIf lk="left" Then If TextWindow.CursorLeft>0 Then TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf ElseIf lk="oemtilde" Then If shh Then ldcall.function("twrt" "@") Else ldcall.function("twrt" "#") EndIf ElseIf lk="tab" Then ldcall.function("twrt" ttb) ElseIf lk="oem5" Then ldcall.function("twrt" "\") ElseIf lk="oem7" Then ldcall.function("twrt" "'") ElseIf lk="oemplus" Then ldcall.function("twrt" "=") ElseIf lk="down" Then TextWindow.CursorTop=TextWindow.CursorTop+1 ElseIf lk="up" Then If TextWindow.CursorTop>0 Then TextWindow.CursorTop=TextWindow.CursorTop-1 EndIf ElseIf lk="right" Then TextWindow.CursorLeft=TextWindow.CursorLeft+1 ElseIf Text.EndsWith(lk "iftkey") Then shh="true ElseIf Text.EndsWith(lk "uestion") Then If shh Then ldcall.function("twrt" "?") Else ldcall.function("twrt" "/") EndIf ElseIf Text.EndsWith(lk "kets") Then If shh Then ldcall.function("twrt" "[") Else ldcall.function("twrt" "(") EndIf ElseIf Text.EndsWith(lk "em6") Then If shh Then ldcall.function("twrt" "]") Else ldcall.function("twrt" ")") EndIf ElseIf Text.EndsWith(lk "em1") Then If shh Then ldcall.function("twrt" ";") Else ldcall.function("twrt" ":") EndIf ElseIf Text.EndsWith(lk "omma") Then If shh Then ldcall.function("twrt" "<") Else ldcall.function("twrt" ",") EndIf ElseIf Text.EndsWith(lk "iod") Then If shh Then ldcall.function("twrt" ">") Else ldcall.function("twrt" ".") EndIf ElseIf Text.EndsWith(lk "pital") Then cps=not[cps] If CPS Then shh="true Else shh="false EndIf ElseIf lk="space" Then ldcall.function("twrt" " ") 'TextWindow.CursorLeft=TextWindow.CursorLeft-1 ElseIf lk="add" Then ldcall.function("twrt" "+") ElseIf lk="subtract" Then ldcall.function("twrt" "-") ElseIf lk="multiply" Then ldcall.function("twrt" "*") ElseIf lk="divide" Then ldcall.function("twrt" "/") ElseIf lk="back" Then If TextWindow.CursorLeft>0 Then TextWindow.CursorLeft=TextWindow.CursorLeft-1 ldcall.function("twrt" " ") TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf Else If shh Then If lk="d1" Then ldcall.function("twrt" "$") Else ldcall.function("twrt" text.ConvertToUpperCase( Text.GetSubTextToEnd(lk Text.GetLength(lk)))) EndIf Else ldcall.function("twrt" Text.GetSubTextToEnd(lk Text.GetLength(lk))) EndIf ' ldcall.function("twrt" "<") ' TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf EndIf EndSub End>RRQ564-1.sb< Start>RRQ564-2.sb< Sub init not="true=false;false=true LDGraphicsWindow.TransparentGW() insm="true mm["File"]="Main mm["New"]="File mm["Open"]="File mm["OpenDfs"]="File mm["Save"]="File mm["-"]="File mm["Exit"]="File mm["Edit"]="Main mm["Replace"]="Edit mm["List"]="Edit mm["ListDfs"]="Edit ch["ListDfs"]="false mm["AutoLinNr"]="Edit ch["AutoLinNr"]="true mm["UnMute"]="Edit ch["UnMute"]="true mm["Run"]="Main mm["Start"]="Run mm["Stop"]="Run sf=1.25 GraphicsWindow.Left=5 GraphicsWindow.top=5 LDGraphicsWindow.TopMost="true Timer.Interval=250 Timer.Tick=ttt TextWindow.Left=5 TextWindow.Top=5 ms=LDControls.AddMenu(500 30 mm "" ch) LDShapes.BrushColour(ms "SandyBrown") LDShapes.PenColour(ms "black") LDControls.MenuClicked=mcc LDControls.MenuBackground(ms "gold") TextWindow.BackgroundColor="darkblue TextWindow.Clear() TextWindow.Title="QBasic Editor LDTextWindow.SetColour(7 "#aaaaaa") TextWindow.ForegroundColor=7 'TextWindow.WriteLine("Edit:") LDTextWindow.KeyDown=kkk LDTextWindow.Keyup=kuu not="false=true;true=false cps="false ldTextWindow.Encoding="Unicode 'TextWindow.Write("░▒▓█┌─┐│┼┴┬┤├└┘") mem=LDFastArray.add() For wy=1 To 200 For wx=1 To 160 LDFastArray.set2D(mem wx wy " ") EndFor EndFor If LDControls.MenuChecked(ms "Autolinnr") Then lll=lll+10 ldcall.function("twrt" lll+":") EndIf EndSub nnn=Text.GetCharacter(13)+Text.GetCharacter(10) ttb=Text.GetCharacter(9) args=0 init() Sub wsetup If www="true" Then Else GraphicsWindow.Width=600 GraphicsWindow.Height=400 www="true GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height) GraphicsWindow.Show() GraphicsWindow.BackgroundColor="tan EndIf EndSub While 1=1'---------------mainloop=============== If rnn Then TextWindow.Title="running >>> Timer.Pause() GraphicsWindow.Hide() indd="true arrmk() arr=LDText.Replace(arr "?" "print ") TextWindow.Clear() pl=LDText.Split(arr nnn) ln=1 dfmk() For gg=1 To Array.GetItemCount(pl)'----------make gotolbl index------- li=LDText.Split(text.ConvertToLowerCase(pl[gg]) ":") pl[gg]=LDText.Replace(pl[gg] "msin" "Math.sin") For qq=1 To Array.GetItemCount(arrd) pl[gg]=LDText.Replace(pl[gg] arrd[qq][1] arrd[qq][2]) EndFor gtt[li[1]]=gg EndFor 'GraphicsWindow.ShowMessage(pl "") 'TextWindow.WriteLine(gtt) While ln<=Array.GetItemCount(pl)'--------main run loop-------================== li=LDText.Split((pl[ln]) ":") For mi=2 To Array.GetItemCount(li) vi=LDText.Split(ldtext.replace(li[mi] "=" " = ") " ") vi[1]=text.ConvertToLowerCase(vi[1]) If vi[2]="=" Then vi[2]=vi[1] vi[1]="set" EndIf If Text.StartsWith(vi[1] "inpu") Then varr[vi[2]]=fcDialogs.AskForTextLine(vi[3]) ElseIf Text.StartsWith(vi[1] "paus") Then Program.Delay(vi[2]) ElseIf Text.StartsWith(vi[1] "sptr") Then memm[varr[vi[2]]]=varr[vi[3]] ' GraphicsWindow.ShowMessage(memm "") ElseIf Text.StartsWith(vi[1] "gosub") Then Stack.PushValue("gss" ln+1) ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "ret") Then If Stack.GetCount("gss")>0 Then ln=Stack.PopValue("gss") Goto ccc Else fcDialogs.ShowMessageAsError("ret w/o gosub on #"+ln+":"+gtt[ln]) EndIf ElseIf Text.StartsWith(vi[1] "cp") or Text.StartsWith(vi[1] "cmp") Then oa=varr["a"] oa=oa-vi[2] If oa=0 Then zff="true Else zff="false EndIf ElseIf Text.StartsWith(vi[1] "push") Then Stack.PushValue("reg" varr[vi[2]]) ElseIf Text.StartsWith(vi[1] "pop") and Stack.GetCount("reg")>0 Then varr[vi[2]]=Stack.PopValue("reg") ElseIf Text.StartsWith(vi[1] "add") Then varr[vi[2]]=varr[vi[2]]+varr[vi[3]] ElseIf Text.StartsWith(vi[1] "sub") Then varr[vi[2]]=varr[vi[2]]-varr[vi[3]] ElseIf Text.StartsWith(vi[1] "schr") Then TextWindow.Write(Text.GetCharacter(ldcall.Function("eptr" vi[2]))) ElseIf Text.StartsWith(vi[1] "inc") Then ii=vi[3] If ii=0 or ii="" Then ii=1 EndIf varr[vi[2]]=varr[vi[2]]+ii ElseIf Text.StartsWith(vi[1] "dec") Then ii=vi[3] If ii=0 or ii="" Then ii=1 EndIf varr[vi[2]]=varr[vi[2]]-ii ElseIf Text.StartsWith(vi[1] "djnz") Then varr["bc"]=varr["bc"]-1 If varr["bc"]>0 Then ln=gtt[vi[2]] Goto ccc EndIf ElseIf Text.StartsWith(vi[1] "jpz") and zff Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "jpnz") and not[zff] Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "goto") Then ln=gtt[vi[2]] Goto ccc ElseIf Text.StartsWith(vi[1] "if") Then If LDMath.Evaluate3( LDCall.Function("wset" vi[2])) Then ln=gtt[vi[3]] Else ln=gtt[vi[4]] EndIf Goto ccc ElseIf Text.StartsWith(vi[1] "plot") Then wsetup() GraphicsWindow.SetPixel(LDMath.Evaluate2(LDCall.Function("wset" vi[2])+"+0") LDMath.Evaluate2(LDCall.Function("wset" vi[3])+"+0") vi[4]) ElseIf Text.StartsWith(vi[1] "set")or Text.StartsWith(vi[1] "ld") or (vi[1]= "mov") Then varr[vi[2]]=LDMath.Evaluate2(LDCall.Function("wset" vi[3])+"+0") ElseIf Text.StartsWith(vi[1] "@pri") Then TextWindow.CursorLeft=vi[3] TextWindow.CursorTop=vi[4] Goto pp ElseIf Text.StartsWith(vi[1] "prin") Then pp: TextWindow.Write(ldtext.Replace(ldtext.Replace(ldtext.Replace(ldtext.Replace( LDCall.Function("numm" LDCall.Function("wset" vi[2])) "\n" nnn)"\t" ttb) "[" " = " )"\s" " ")) EndIf EndFor ln=ln+1 ccc: EndWhile TextWindow.Title="ok GraphicsWindow.ShowMessage("OK Done." "QBasic") GraphicsWindow.Show() www="false GraphicsWindow.Height=25 GraphicsWindow.Width=300 Timer.Resume() plist() rnn="false indd=rnn EndIf EndWhile Sub numm If FCExtensions.IsNumber(args[1]) Then return=LDMath.FixDecimal(args[1] 4) Else return=(args[1]) EndIf EndSub Sub plist TextWindow.Clear() arrmk() arr=LDText.Replace(arr "?" "Print ") arr2mm() mwrt() TextWindow.CursorLeft=0 TextWindow.CursorTop=1 EndSub Sub wset ii=args[1] ac=Array.GetAllIndices(varr) For rt=1 To Array.GetItemCount(ac) ii=LDText.Replace(ii "#"+ac[rt] varr[ac[rt]]) EndFor return=ii EndSub Sub eptr If Text.StartsWith(args[1] "$") Then return=memm[varr[text.GetSubTextToEnd( args[1] 2)]] Else return=args[1] EndIf EndSub Sub arrmk'---------------create array from edits arr="" For wy=1 To 200 al="" For wx=1 To 158 al=Text.Append(al LDFastArray.get2D(mem wx wy)) EndFor arr=Text.Append(arr al+nnn) EndFor EndSub Sub dfmk'---------------create array from defines arrd="" For wy=1 To 50 al="" For wx=1 To 158 al=Text.Append(al LDFastArray.get2D(memd wx wy)) EndFor al=LDText.Trim(al) arrd[wy]=LDText.Split(al ":") EndFor ' GraphicsWindow.ShowMessage(arrd "") EndSub Sub arr2mm'--------------fastarray recreate in=0 For wy=1 To 200 For wx=1 To 158 in=in+1 LDFastArray.set2D(mem wx wy text.GetSubText(arr in 1)) EndFor While text.GetCharacterCode(text.GetSubText(arr in 1))>31 in=in+1 EndWhile in=in+1 EndFor EndSub Sub memdel For wy=1 To 200 For wx=1 To 158 LDFastArray.set2D(mem wx wy " ") EndFor EndFor EndSub Sub loadmem ca=LDText.Split(cc nnn) memdel() For wy=1 To Array.GetItemCount(ca) For fx=1 To Text.GetLength(ca[wy]) LDFastArray.set2D(mem fx wy text.GetSubText(ca[wy] fx 1)) EndFor EndFor EndSub Sub twrt'----------------memo&shw input px=TextWindow.CursorLeft+1 py=TextWindow.CursorTop+1 txx=args[1] If insm Then rr="" For tq=158 To px-1 Step -1 ch=LDFastArray.get2D(mem tq py) LDFastArray.Set2D(mem tq+1 py ch) rr=text.Append(ch rr) EndFor TextWindow.Write(rr) TextWindow.CursorLeft=px-1 Goto qss Else qss: For rw=1 To Text.GetLength(txx) LDFastArray.Set2D(mem px+rw-1 py Text.GetSubText(txx rw 1)) EndFor TextWindow.Write(txx) EndIf EndSub Sub mcc'-----------------menu handling---------------- ii=text.ConvertToLowerCase( LDControls.LastMenuItem) If ii="new" Then TextWindow.Clear() ElseIf ii="unmute" Then indd=not[LDControls.MenuChecked(ms "UnMute")] ElseIf ii="start" Then rnn="true ElseIf ii="stop" Then rnn="false ElseIf ii="exit" Then Program.End() ElseIf ii="list" Then plist() ElseIf ii="replace" Then indd="true tf=FCDialogs.AskForTextLine("text to fnd:") If tf="" Then Else tr=FCDialogs.AskForTextLine("text to replace:") arrmk() arr=LDText.Replace(arr tf tr) ' GraphicsWindow.ShowMessage(arr "") arr2mm() TextWindow.Clear() mwrt() EndIf indd="false ElseIf ii="save" Then indd="true ff=LDDialogs.saveFile("1=txt;2=bas;3=sb;4=itt" "e:\") mw=LDFastArray.ToArray(mem) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(ff mw) indd="false ElseIf ii="open" Then indd="true ff=LDDialogs.OpenFile("1=txt;2=bas;3=sb;4=itt" "e:\") ' 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. ' cc=File.ReadContents(ff) TextWindow.Clear() If Text.IsSubText(ff ".itt") Then mem=LDFastArray.CreateFromValues(cc) mwrt() Else loadmem() mwrt() EndIf indd="false TextWindow.Title=ff EndIf ElseIf ii="opendfs" Then indd="true ff=LDDialogs.OpenFile("1=itt;2=dff" "e:\") ' 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. ' cc=File.ReadContents(ff) TextWindow.Clear() memd=LDFastArray.CreateFromValues(cc) mwrt() EndIf indd="False EndIf 'TextWindow.Title=ii EndSub Sub mwrt'----------------list cmd If LDControls.MenuChecked(ms "listdfs") Then p50=50 Else p50=0 EndIf For wy=1 To 200 For wx=1 To 158 TextWindow.CursorLeft=wx-1 TextWindow.CursorTop=wy-1+p50 TextWindow.Write(LDFastArray.Get2D(mem wx wy)) EndFor EndFor If LDControls.MenuChecked(ms "listdfs") Then TextWindow.CursorLeft=0 TextWindow.CursorTop=0 TextWindow.Write("#defines:") For wy=1 To 50 For wx=1 To 158 TextWindow.CursorLeft=wx-1 TextWindow.CursorTop=wy TextWindow.Write(LDFastArray.Get2D(memd wx wy)) EndFor EndFor EndIf TextWindow.CursorLeft=0 TextWindow.CursorTop=p50 EndSub Sub ttt'-----------------Timer GraphicsWindow.Left=TextWindow.Left/sf+35 GraphicsWindow.Top=TextWindow.Top/sf EndSub Sub kuu'-----------------kyup lky=text.ConvertToLowerCase( LDTextWindow.LastKey) If Text.EndsWith(lky "iftkey") and not[cps] Then shh="false EndIf EndSub Sub kkk'-----------------keybrd-handling---------- If indd Then Else lk=text.ConvertToLowerCase( LDTextWindow.LastKey) 'TextWindow.WriteLine(lk) ' TextWindow.Title=lk If lk="return" Then 'TextWindow.WriteLine("") TextWindow.CursorLeft=0 TextWindow.CursorTop=TextWindow.CursorTop+1 If LDControls.MenuChecked(ms "Autolinnr") Then lll=lll+10 ldcall.function("twrt" lll+":") EndIf ElseIf lk="left" Then If TextWindow.CursorLeft>0 Then TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf ElseIf lk="delete" Then dell: px=TextWindow.CursorLeft+1 py=TextWindow.CursorTop+1 rr="" For tq= px to 158 ch=LDFastArray.get2D(mem tq+1 py) LDFastArray.Set2D(mem tq py ch) rr=text.Append(rr ch) EndFor LDFastArray.Set2D(mem 159 py " ") LDFastArray.Set2D(mem 160 py " ") rr=rr+" " TextWindow.Write(rr) TextWindow.CursorLeft=px-1 TextWindow.CursorTop=py-1 ElseIf lk="insert" Then insm=not[insm] ElseIf lk="oemtilde" Then If shh Then ldcall.function("twrt" "@") Else ldcall.function("twrt" "#") EndIf ElseIf lk="tab" Then ldcall.function("twrt" ttb) ElseIf lk="oem5" Then ldcall.function("twrt" "\") ElseIf lk="oem7" Then ldcall.function("twrt" "'") ElseIf lk="oemplus" Then ldcall.function("twrt" "=") ElseIf lk="down" Then TextWindow.CursorTop=TextWindow.CursorTop+1 ElseIf lk="up" Then If TextWindow.CursorTop>0 Then TextWindow.CursorTop=TextWindow.CursorTop-1 EndIf ElseIf lk="right" Then TextWindow.CursorLeft=TextWindow.CursorLeft+1 ElseIf Text.EndsWith(lk "iftkey") Then shh="true ElseIf Text.EndsWith(lk "uestion") Then If shh Then ldcall.function("twrt" "?") Else ldcall.function("twrt" "/") EndIf ElseIf Text.EndsWith(lk "kets") Then If shh Then ldcall.function("twrt" "[") Else ldcall.function("twrt" "(") EndIf ElseIf Text.EndsWith(lk "em6") Then If shh Then ldcall.function("twrt" "]") Else ldcall.function("twrt" ")") EndIf ElseIf Text.EndsWith(lk "em1") Then If shh Then ldcall.function("twrt" ";") Else ldcall.function("twrt" ":") EndIf ElseIf Text.EndsWith(lk "omma") Then If shh Then ldcall.function("twrt" "<") Else ldcall.function("twrt" ",") EndIf ElseIf Text.EndsWith(lk "iod") Then If shh Then ldcall.function("twrt" ">") Else ldcall.function("twrt" ".") EndIf ElseIf Text.EndsWith(lk "pital") Then cps=not[cps] If CPS Then shh="true Else shh="false EndIf ElseIf lk="space" Then ldcall.function("twrt" " ") 'TextWindow.CursorLeft=TextWindow.CursorLeft-1 ElseIf lk="add" Then ldcall.function("twrt" "+") ElseIf lk="subtract" Then ldcall.function("twrt" "-") ElseIf lk="multiply" Then ldcall.function("twrt" "*") ElseIf lk="divide" Then ldcall.function("twrt" "/") ElseIf lk="back" Then if insm and TextWindow.CursorLeft>0 Then TextWindow.CursorLeft=TextWindow.CursorLeft-1 goto dell elseIf TextWindow.CursorLeft>0 Then TextWindow.CursorLeft=TextWindow.CursorLeft-1 ldcall.function("twrt" " ") TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf Else If shh Then If lk="d1" Then ldcall.function("twrt" "$") Else ldcall.function("twrt" text.ConvertToUpperCase( Text.GetSubTextToEnd(lk Text.GetLength(lk)))) EndIf Else ldcall.function2("twrt" Text.GetSubTextToEnd(lk Text.GetLength(lk)) insm) EndIf ' ldcall.function("twrt" "<") ' TextWindow.CursorLeft=TextWindow.CursorLeft-1 EndIf EndIf EndSub End>RRQ564-2.sb< Start>RRQ875.sb< ' 1942 like Game ID: KJW676 'most of Game artwork created by Dagam Demisee ' and others grabed from free web sprites '------------------------- 'replace by your directory path 'Path ="file://C:/Users/Laurent/Desktop/small basic/images1942/" Path= "http://imode.free.fr/images1942/" 'replace by your directory path '------------------------- ' Game area controls gameWidth = 640 gameHeight = 480 fps = 50 bgs = 2 'backgroundspeed Player_Lives = 10 nbrisland = 5 'nomber of island images islandcount = 5 'nomber of island in the wall field ' Window title gameTitle = "1942, Score: " GraphicsWindow.Hide() GraphicsWindow.Title = gameTitle + "0" GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gameWidth GraphicsWindow.Height = gameHeight 'Presentation ' todo ' Start game Init() define_paths() TimePlay = 0 pathNBR = 1 'create_enemies1() Play() ' Setup world Sub Init GraphicsWindow.Hide() Mouse.HideCursor() ' addImage in the right order is needed to define the shapes depth island4= ImageList.LoadImage(Path + "island4.png") island1= ImageList.LoadImage(Path + "island1.png") island2= ImageList.LoadImage(Path + "island2.png") island3= ImageList.LoadImage(Path + "island3.png") island5= ImageList.LoadImage(Path + "island5.png") player0 = ImageList.LoadImage(Path + "myplane1.png") background = ImageList.LoadImage(Path + "fond.png") bullet0 = ImageList.LoadImage(Path + "bullet.png") enemy= ImageList.LoadImage(Path + "enemy1.png") enemy2 = ImageList.LoadImage(Path + "enemy2.png") enemy_expl1=ImageList.LoadImage(Path + "explo1.png") enemy_expl2=ImageList.LoadImage(Path + "explo2.png") player_expl=ImageList.LoadImage(Path + "explo2.png") Enemy_bullet=ImageList.LoadImage(Path + "E_bullet.png") end = ImageList.LoadImage(Path + "End.png") enemy_Array = "EnemyArray" 'Array that contain all the enemies ' every enemy in tha array has 5 informations ' TimeLine: each enemy has its own timeline ' PathNBR: the precalculated path defineing the movement ' the movement is decomposed in LineNbr differents lines ' each line is define in the enemy_path table with rotation, deltaY and deltaY ' PositonX, PositonY: position in space ' ' enemy_TimeLine = "EnemyTimeLine" enemy_line = "enemyLineNbr" enemy_PosX = "enemyPositonX" enemy_PosY = "enemyPositonY" enemy_PathNBR="enemy_PathNBR" enemy_Nbr = 6 enemy_Count = 0 enemy_speed = 4 'enemy_NextRemove = 1 enemy_Life = 10 player_size= 65 enemy_size = 32 enemy_ammo_size = 8 player_bullet_size = 32 island_Array = "Island array" IslandsPosition() create_level1() fond= Shapes.AddImage(background) Array.SetValue(island_Array,1,Shapes.AddImage(island1)) Array.SetValue(island_Array,2,Shapes.AddImage(island2)) Array.SetValue(island_Array,3,Shapes.AddImage(island3)) Array.SetValue(island_Array,4,Shapes.AddImage(island4)) Array.SetValue(island_Array,5,Shapes.AddImage(island5)) For i = 6 to islandcount Array.SetValue(island_Array,i,Array.getValue(island_Array,Math.Remainder(i,4))) Endfor player = Shapes.AddImage(player0) GraphicsWindow.FontSize = 20 GraphicsWindow.BackgroundColor = "Grey" GraphicsWindow.PenColor = "Yellow" Player_Ammo = "Player_AmmoArray" Player_AmmoAge = "Player_AmmoAge" Player_AmmoMax = 50 Player_AmmoCount = 0 Player_Ammospeed = bgs +4 Player_AmmoLife = 100 Enemy_Ammo = "Enemy_AmmoArray" Enemy_AmmoAge = "Enemy_AmmoAge" Enemy_Ammo_Angle="Enemy_Ammo_Angle" Enemy_AmmoMax = 30 Enemy_AmmoCount = 0 Enemy_Ammospeed = bgs +4 Enemy_AmmoLife = 50 Enemy_Agresivity = 200 score = 0 EndSub ' Main gane routine Sub Play GraphicsWindow.Show() ' Main loop play = 1 pause = 0 incx =0 ' X-axis increment for background incy = 0 ' Y-axis increment for background incbx = 0 'increment for bullets and all objects on X incby = 0 'increment for bullets and all objects on Y squadron = 1 ' Island initial position j= 0 For i= 1 To islandcount j=Math.Remainder(i,6) posy[i]= islandPos[j][2] posx[i]= islandPos[j][3] incislandx[i] = 0 incislandy[i] = 0 EndFor TimePlay = 0 Shapes.Move(player, gameWidth/2 , gameHeight -80 ) While(play = 1) Program.Delay(1000/fps) TimePlay = TimePlay +1 If (pause = 0) Then If (TimePlay = level1[squadron][1]) then pathNBR = level1[squadron][2] enemyPosX1 = level1[squadron][3] 'X position enemyPosY1 = level1[squadron][4] 'Y position enemy_Nbr = level1[squadron][6] enemy_type = level1[squadron][7] if (level1[squadron][5]=1) then create_enemies_left() Else create_enemies_right() endif squadron = squadron + 1 endif If (TimePlay > 4000) then Shapes.Move(Shapes.addImage(end), 230,200) Program.Delay(5000) Program.End() Endif moveall() GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown AgePlayer_Ammo() EndIf EndWhile EndSub Sub OnMouseMove paddleX = GraphicsWindow.MouseX - player_size/2 paddleY = GraphicsWindow.MouseY- player_size If (paddleX < 0) then paddleX = 0 endif Shapes.Move(player, paddleX , paddleY ) EndSub Sub OnMouseDown ShootX = GraphicsWindow.MouseX - 15 ' in order to be from the neck of the plane ShootY = GraphicsWindow.MouseY - 80 Fire() EndSub Sub moveall incbx = 0 incby =0 GraphicsWindow.Title = gameTitle + score +" Lives:"+Player_Lives If (paddleX >(gameWidth-62) ) Then incx = incx - bgs incbx = incbx - bgs For i= 1 To islandcount incislandx[i] = incislandx[i] - bgs EndFor If (incx = -32 ) Then incx =0 Endif Endif If (paddleX < 64 ) Then incx = incx + bgs incbx = incbx + bgs For i= 1 To islandcount incislandx[i] = incislandx[i] + bgs EndFor If (incx = 32 ) Then incx =0 Endif Endif Shapes.Move(fond,incx -32 ,incy - 32) For i= 1 To islandcount islx = posx[i]+incislandx[i] isly = posy[i]+incislandy[i] Shapes.Move(Array.GetValue(island_Array,i),islx,isly) EndFor incy = incy + bgs incby = incby+ bgs For i= 1 To islandcount incislandy[i] = incislandy[i] + bgs EndFor If (incy = 32) Then incy =0 Endif For i= 1 To islandcount If ((posy[i]+incislandy[i]) > (gameHeight+15)) Then 'relaunch island if no more visible R= Math.Round(Math.GetRandomNumber(nbrisland)) AA = Math.Remainder(TimePlay,6) 'give new coordinates posx[i]= islandPos[AA][2] posy[i]= islandPos[AA][3] Shapes.move(Array.GetValue(island_Array,R),posx[i],posy[i]) incislandy[i]=0 incislandx[i]=0 EndIf ENDFOR ' Move playerammo For i = 1 To Player_AmmoCount Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i)) +incbx Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i)) - Player_Ammospeed Shapes.Move(Array.GetValue(Player_Ammo, i), Player_Ammox, Player_Ammoy) Array.SetValue(Player_AmmoAge, i, Array.GetValue(Player_AmmoAge, i) + 1) EndFor ' Move Enemy ammo For iea = 1 To Enemy_AmmoCount dx =(Math.Sin((Array.GetValue(Enemy_Ammo_Angle, iea) )) * Enemy_Ammospeed) dy =(Math.Cos((Array.GetValue(Enemy_Ammo_Angle, iea) ))* Enemy_Ammospeed) Enemy_Ammox = Shapes.GetLeft(Array.GetValue(Enemy_Ammo, iea)) +dx+incbx Enemy_Ammoy = Shapes.GetTop(Array.GetValue(Enemy_Ammo, iea)) +dy+incby*0.1 Shapes.Move(Array.GetValue(Enemy_Ammo, iea), Enemy_Ammox, Enemy_Ammoy) Array.SetValue(Enemy_AmmoAge, iea, Array.GetValue(Enemy_AmmoAge, iea) + 1) EndFor ' move ennemies For i=1 To enemy_Count ' move as TimeLine and Path say eNBR= Array.GetValue(enemy_PathNBR,i) uu =Array.GetValue(enemy_line,i) Time= Array.GetValue(enemy_TimeLine, i) etl=enemyPath[eNBR][1][uu] 'enemy own timeLine IF (Time=etl) Then 'it's time to rotate enemy rr = enemyPath[eNBR][2][uu+1] Shapes.Rotate(Array.GetValue(enemy_Array,i),rr) EndIf IF (Time > etl) Then uu = uu+1 Array.SetValue(enemy_line,i,uu) ' next line for enemy move EndIf xx1=Array.GetValue(enemy_PosX,i) yy1= Array.GetValue(enemy_PosY,i) xx = xx1+enemyPath[eNBR][3][uu]+incbx yy = yy1+enemyPath[eNBR][4][uu]+incby*0.1 ' Randomly fire-enemy If (Math.GetRandomNumber(Enemy_Agresivity)=1) Then Enemy_ShootX = xx1 + 16 Enemy_ShootY = yy1 + 4 If (yy1 > 0 AND xx1 > 0 And yy1< gameHeight And xx1 < gameWidth) then 'this avoid enemy fire from outside the screen fire_Enemy() Endif EndIf Shapes.Move(Array.GetValue(enemy_Array,i),xx,yy) Array.SetValue(enemy_PosX,i,xx) Array.SetValue(enemy_PosY,i,yy) Array.SetValue(enemy_TimeLine, i, Time + 1) If ((uu > enemyPath[eNBR][0][0]) And (Time > etl)) Then ' if last timelife remove the enemy sprite next_enemy_remove = i remove_enemy() endif Collision_pbe() Collision_ep() EndFor EndSub Sub RemovePlayer_Ammo Shapes.Remove(Array.GetValue(Player_Ammo, Player_Ammo_nextRemove)) For iz = Player_Ammo_nextRemove To Player_AmmoCount - 1 Array.SetValue(Player_Ammo, iz, Array.GetValue(Player_Ammo, iz+1)) Array.SetValue(Player_AmmoAge, iz, Array.GetValue(Player_AmmoAge, iz+1)) EndFor Array.RemoveValue(Player_Ammo, Player_AmmoCount) Array.RemoveValue(Player_AmmoAge, Player_AmmoCount) Player_AmmoCount = Player_AmmoCount - 1 EndSub Sub RemoveEnemy_Ammo Shapes.Remove(Array.GetValue(Enemy_Ammo, Enemy_Ammo_nextRemove)) For irea = Enemy_Ammo_nextRemove To Enemy_AmmoCount - 1 Array.SetValue(Enemy_Ammo, irea, Array.GetValue(Enemy_Ammo, irea+1)) Array.SetValue(Enemy_AmmoAge, irea, Array.GetValue(Enemy_AmmoAge, irea+1)) Array.SetValue(Enemy_Ammo_Angle, irea, Array.GetValue(Enemy_Ammo_Angle,irea+1)) EndFor Array.RemoveValue(Enemy_Ammo, Enemy_AmmoCount) Array.RemoveValue(Enemy_AmmoAge, Enemy_AmmoCount) Array.RemoveValue(Enemy_Ammo_Angle,Enemy_AmmoCount) Enemy_AmmoCount = Enemy_AmmoCount - 1 EndSub Sub fire ' Remove additional player Ammo While(Player_AmmoCount > Player_AmmoMax ) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile ' Add the player Ammo Player_AmmoCount = Player_AmmoCount + 1 Array.SetValue(Player_Ammo, Player_AmmoCount, Shapes.AddImage(bullet0)) Shapes.Move(Array.GetValue(Player_Ammo, Player_AmmoCount), ShootX, ShootY) EndSub Sub fire_Enemy ' Remove additional Enemy Ammo While(Enemy_AmmoCount > (Enemy_AmmoMax - 1)) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile ' Add the Enemy Ammo Enemy_AmmoCount = Enemy_AmmoCount + 1 Array.SetValue(Enemy_Ammo, Enemy_AmmoCount, Shapes.AddImage(Enemy_bullet)) Array.SetValue(Enemy_Ammo_Angle, Enemy_AmmoCount,Math.ArcTan((paddleX- Enemy_ShootX+player_size/2)/(paddleY-Enemy_ShootY))) Shapes.Move(Array.GetValue(Enemy_Ammo, Enemy_AmmoCount), Enemy_ShootX, Enemy_ShootY) EndSub 'Check playerammo age Sub AgePlayer_Ammo While (Array.GetValue(Player_AmmoAge, 1) > Player_AmmoLife) Player_Ammo_nextRemove = 1 RemovePlayer_Ammo() EndWhile EndSub 'Check enemy ammo age Sub AgeEnemy_Ammo While (Array.GetValue(Enemy_AmmoAge, 1) > Enemy_AmmoLife) Enemy_Ammo_nextRemove = 1 RemoveEnemy_Ammo() EndWhile EndSub Sub remove_enemy Shapes.remove(Array.GetValue(enemy_Array,next_enemy_remove)) ' Remove all references from the arrays For ii = next_enemy_remove To enemy_Count - 1 Array.SetValue(enemy_Array, ii, Array.GetValue(enemy_Array, ii+1)) Array.SetValue(enemy_line, ii, Array.GetValue(enemy_line, ii+1)) Array.SetValue(enemy_PosX, ii, Array.GetValue(enemy_PosX, ii+1)) Array.SetValue(enemy_PosY, ii, Array.GetValue(enemy_PosY, ii+1)) Array.SetValue(enemy_TimeLine, ii, Array.GetValue(enemy_TimeLine, ii+1)) Array.SetValue(enemy_PathNBR, ii , Array.GetValue(enemy_PathNBR, ii+1)) EndFor Array.RemoveValue(enemy_Array, enemy_Count) Array.RemoveValue(enemy_line, enemy_Count) Array.RemoveValue(enemy_PosX, enemy_Count) Array.RemoveValue(enemy_PosY, enemy_Count) Array.RemoveValue(enemy_TimeLine, enemy_Count) Array.RemoveValue(enemy_PathNBR,enemy_Count) enemy_Count = enemy_Count - 1 EndSub Sub create_enemies_left TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) If (enemy_type = 2) Then Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy2)) Else Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) EndIf Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 - 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub create_enemies_right TimeLine1 =0 For i=1 To enemy_Nbr enemy_Count= enemy_Count + 1 Array.SetValue(enemy_PathNBR,enemy_Count,pathNBR) Array.SetValue(enemy_Array, enemy_Count,Shapes.AddImage(enemy)) Array.SetValue(enemy_line,enemy_Count,1) Array.SetValue(enemy_PosX, enemy_Count,enemyPosX1) Array.SetValue(enemy_PosY, enemy_Count,enemyPosY1) Array.SetValue(enemy_TimeLine, enemy_Count, TimeLine1) enemyPosX1 = enemyPosX1 + 64 'distance between ennemies TimeLine1 = TimeLine1 - 64 / enemy_speed EndFor For i=(enemy_Count-enemy_Nbr+1) To enemy_Count xxx=Array.GetValue(enemy_PosX,i) yyy= Array.GetValue(enemy_PosY,i) Shapes.Move(Array.GetValue(enemy_Array,i),xxx,yyy) EndFor EndSub Sub Collision_pbe 'for player-bullet and enemies For i1 = 1 To Player_AmmoCount ' player bullet position Player_Ammox = Shapes.GetLeft(Array.GetValue(Player_Ammo, i1)) Player_Ammoy = Shapes.GetTop(Array.GetValue(Player_Ammo, i1)) px1=Player_Ammox+player_bullet_size/3 'in order to have a more precise collison than the bullet image size py1=Player_Ammoy+player_bullet_size/3 px2=px1+2*player_bullet_size/3 py2=py1+2*player_bullet_size/3 For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2)+enemy_size/4 ay1=Array.GetValue(enemy_PosY,i2)+enemy_size/4 ax2=ax1+3*enemy_size/4 ay2=ay1+3*enemy_size/4 If ( (ax1 < px1 And ax2 > px1) Or (ax1 < px2 And ax2 > px2) ) Then If ( (ay1 < py1 And ay2 > py1) Or (ay1 < py2 And ay2 > py2) ) Then ' collision between enemy nbr i2 and player bullet i ' remove bullet i and animate explosion and remove enemy i2 Player_Ammo_nextRemove = i1 RemovePlayer_Ammo() next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(enemy_expl2) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) score = score +100 EndIf EndIf EndFor Endfor EndSub Sub Collision_ep 'for enemies and player px1 = Shapes.GetLeft(player) py1 = Shapes.GetTop(player) px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i2 = 1 to enemy_Count ' enemy position ax1=Array.GetValue(enemy_PosX,i2) ay1=Array.GetValue(enemy_PosY,i2) ax2=ax1+enemy_size ay2=ay1+enemy_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy nbr i2 and player ' animate explosion and decrease lives next_enemy_remove = i2 remove_enemy() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,ax1,ay1) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,ax1,ay1) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor px1 = paddleX py1 = paddleY px2 = px1 + player_size py2 = py1 + player_size 'Shapes.Move(Shapes.AddRectangle(px2-px1 ,py2-py1), px1, py1) For i3 = 1 to Enemy_AmmoCount ' enemy position ax1=Shapes.GetLeft(Array.GetValue(enemy_Ammo,i3)) ay1=Shapes.GetTop(Array.GetValue(enemy_Ammo,i3)) ax2=ax1+enemy_ammo_size ay2=ay1+enemy_ammo_size 'Shapes.Move(Shapes.AddRectangle(ax2-ax1 ,ay2-ay1), ax1, ay1) If ( (px1 < ax1 And px2 > ax1) Or (px1 < ax2 And px2 > ax2) ) Then If ( (py1 < ay1 And py2 > ay1) Or (py1 < ay2 And py2 > ay2) ) Then ' collision between enemy ammo nbr i3 and player ' animate explosion and decrease lives Enemy_Ammo_nextRemove = i3 RemoveEnemy_Ammo() ' begin animation for explosion at coordinate ax1, ay1 toto= Shapes.AddImage(enemy_expl1) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(30) Shapes.Remove(toto) toto= Shapes.AddImage(player_expl) Shapes.move(toto,paddleX+ player_size/2,paddleY+ player_size/2) Program.Delay(300) Shapes.Remove(toto) Player_Lives = Player_Lives -1 If (Player_Lives = 0) THEN Program.End() EndIf EndIf EndIf EndFor EndSub Sub IslandsPosition ' island positions, avoid randomGeneration and islands overlap islandPos[0][1]=1 islandPos[0][2]=0 islandPos[0][3]=-150 islandPos[1][1]=1 islandPos[1][2]=-Math.Round(gameWidth/2) islandPos[1][3]=-150 islandPos[2][1]=2 islandPos[2][2]=-2*Math.Round(gameWidth/3) islandPos[2][3]=-150 islandPos[3][1]=1 islandPos[3][2]=2*Math.Round(gameWidth/3) islandPos[3][3]=-150 islandPos[4][1]=2 islandPos[4][2]=gameWidth islandPos[4][3]=-150 islandPos[5][1]=3 islandPos[5][2]=Math.Round(gameWidth/3) islandPos[5][3]=-150 islandPos[6][1]=3 islandPos[6][2]=-gameWidth islandPos[6][3]=-150 EndSub Sub define_paths enemyPath[0][0][0] = 3 'nbr of strait lines of path enemyPath[0][1][1] = 30 'from 0 to this in timeline enemyPath[0][1][2] = 100 ' from this to next in timeline enemyPath[0][1][3] = 400 'sprite goes up enemyPath[0][2][1] = 0 'first line rotation = 0 enemyPath[0][2][2] = 45 ' second line rotation = 45 enemyPath[0][2][3] = 45 enemyPath[0][3][1] = enemy_speed ' first line x movment enemyPath[0][3][2] = enemy_speed 'second line x movment enemyPath[0][3][3] = enemy_speed ' third line ... enemyPath[0][4][1] = 0 ' first line y movment enemyPath[0][4][2] = enemy_speed enemyPath[0][4][3] = enemy_speed '---------- second path enemyPath[1][0][0] = 4 enemyPath[1][1][1] = 1 enemyPath[1][1][2] = 1 enemyPath[1][1][3] = 100 enemyPath[1][1][4] = 400 enemyPath[1][2][1] = 180 enemyPath[1][2][2] = 135 enemyPath[1][2][3] = 135 enemyPath[1][2][4] = 90 enemyPath[1][3][1] = -enemy_speed enemyPath[1][3][2] = -enemy_speed enemyPath[1][3][3] = -enemy_speed enemyPath[1][3][4] = 0 enemyPath[1][4][1] = 0 enemyPath[1][4][2] = 0 enemyPath[1][4][3] = enemy_speed enemyPath[1][4][4] = enemy_speed 'round r=5 enemyPath[2][0][0]=21 enemyPath[2][1][1]=50 enemyPath[2][1][2]=55 enemyPath[2][1][3]=60 enemyPath[2][1][4]=65 enemyPath[2][1][5]=70 enemyPath[2][1][6]=75 enemyPath[2][1][7]=80 enemyPath[2][1][8]=85 enemyPath[2][1][9]=90 enemyPath[2][1][10]=95 enemyPath[2][1][11]=100 enemyPath[2][1][12]=105 enemyPath[2][1][13]=110 enemyPath[2][1][14]=115 enemyPath[2][1][15]=120 enemyPath[2][1][16]=125 enemyPath[2][1][17]=130 enemyPath[2][1][18]=135 enemyPath[2][1][19]=140 enemyPath[2][1][20]=145 enemyPath[2][1][21]=350 enemyPath[2][2][1]=0 enemyPath[2][2][2]=18 enemyPath[2][2][3]=36 enemyPath[2][2][4]=54 enemyPath[2][2][5]=72 enemyPath[2][2][6]=90 enemyPath[2][2][7]=108 enemyPath[2][2][8]=126 enemyPath[2][2][9]=144 enemyPath[2][2][10]=162 enemyPath[2][2][11]=180 enemyPath[2][2][12]=198 enemyPath[2][2][13]=216 enemyPath[2][2][14]=234 enemyPath[2][2][15]=252 enemyPath[2][2][16]=-90 enemyPath[2][2][17]=-72 enemyPath[2][2][18]=-54 enemyPath[2][2][19]=-36 enemyPath[2][2][20]=-18 enemyPath[2][2][21]=0 enemyPath[2][3][1]=enemy_speed enemyPath[2][3][2]=0.95*enemy_speed enemyPath[2][3][3]=0.81*enemy_speed enemyPath[2][3][4]=0.59*enemy_speed enemyPath[2][3][5]=0.31*enemy_speed enemyPath[2][3][6]=0 enemyPath[2][3][7]=-0.31*enemy_speed enemyPath[2][3][8]=-0.59*enemy_speed enemyPath[2][3][9]=-0.81*enemy_speed enemyPath[2][3][10]=-0.95*enemy_speed enemyPath[2][3][11]=-enemy_speed enemyPath[2][3][12]=-0.95*enemy_speed enemyPath[2][3][13]=-0.81*enemy_speed enemyPath[2][3][14]=-0.59*enemy_speed enemyPath[2][3][15]=-0.31*enemy_speed enemyPath[2][3][16]=0 enemyPath[2][3][17]=0.31*enemy_speed enemyPath[2][3][18]=0.59*enemy_speed enemyPath[2][3][19]=0.81*enemy_speed enemyPath[2][3][20]=0.95*enemy_speed enemyPath[2][3][21]=enemy_speed enemyPath[2][4][1]=0 enemyPath[2][4][2]=0.31*enemy_speed enemyPath[2][4][3]=0.59*enemy_speed enemyPath[2][4][4]=0.81*enemy_speed enemyPath[2][4][5]=0.95*enemy_speed enemyPath[2][4][6]=enemy_speed enemyPath[2][4][7]=0.95*enemy_speed enemyPath[2][4][8]=0.81*enemy_speed enemyPath[2][4][9]=0.59*enemy_speed enemyPath[2][4][10]=0.31*enemy_speed enemyPath[2][4][11]=0 enemyPath[2][4][12]=-0.31*enemy_speed enemyPath[2][4][13]=-0.59*enemy_speed enemyPath[2][4][14]=-0.81*enemy_speed enemyPath[2][4][15]=-0.95*enemy_speed enemyPath[2][4][16]=-enemy_speed enemyPath[2][4][17]=-0.95*enemy_speed enemyPath[2][4][18]=-0.81*enemy_speed enemyPath[2][4][19]=-0.59*enemy_speed enemyPath[2][4][20]=-0.31*enemy_speed enemyPath[2][4][21]=0 'round r=20 enemyPath[3][0][0]=21 enemyPath[3][1][1]=120 enemyPath[3][1][2]=140 enemyPath[3][1][3]=160 enemyPath[3][1][4]=180 enemyPath[3][1][5]=200 enemyPath[3][1][6]=220 enemyPath[3][1][7]=240 enemyPath[3][1][8]=260 enemyPath[3][1][9]=280 enemyPath[3][1][10]=300 enemyPath[3][1][11]=320 enemyPath[3][1][12]=340 enemyPath[3][1][13]=360 enemyPath[3][1][14]=380 enemyPath[3][1][15]=400 enemyPath[3][1][16]=420 enemyPath[3][1][17]=440 enemyPath[3][1][18]=460 enemyPath[3][1][19]=480 enemyPath[3][1][20]=500 enemyPath[3][1][21]=600 enemyPath[3][2][1]=0 enemyPath[3][2][2]=18 enemyPath[3][2][3]=36 enemyPath[3][2][4]=54 enemyPath[3][2][5]=72 enemyPath[3][2][6]=90 enemyPath[3][2][7]=108 enemyPath[3][2][8]=126 enemyPath[3][2][9]=144 enemyPath[3][2][10]=162 enemyPath[3][2][11]=180 enemyPath[3][2][12]=198 enemyPath[3][2][13]=216 enemyPath[3][2][14]=234 enemyPath[3][2][15]=252 enemyPath[3][2][16]=-90 enemyPath[3][2][17]=-72 enemyPath[3][2][18]=-54 enemyPath[3][2][19]=-36 enemyPath[3][2][20]=-18 enemyPath[3][2][21]=0 enemyPath[3][3][1]=enemy_speed enemyPath[3][3][2]=0.95*enemy_speed enemyPath[3][3][3]=0.81*enemy_speed enemyPath[3][3][4]=0.59*enemy_speed enemyPath[3][3][5]=0.31*enemy_speed enemyPath[3][3][6]=0 enemyPath[3][3][7]=-0.31*enemy_speed enemyPath[3][3][8]=-0.59*enemy_speed enemyPath[3][3][9]=-0.81*enemy_speed enemyPath[3][3][10]=-0.95*enemy_speed enemyPath[3][3][11]=-enemy_speed enemyPath[3][3][12]=-0.95*enemy_speed enemyPath[3][3][13]=-0.81*enemy_speed enemyPath[3][3][14]=-0.59*enemy_speed enemyPath[3][3][15]=-0.31*enemy_speed enemyPath[3][3][16]=0 enemyPath[3][3][17]=0.31*enemy_speed enemyPath[3][3][18]=0.59*enemy_speed enemyPath[3][3][19]=0.81*enemy_speed enemyPath[3][3][20]=0.95*enemy_speed enemyPath[3][3][21]=enemy_speed enemyPath[3][4][1]=0 enemyPath[3][4][2]=0.31*enemy_speed enemyPath[3][4][3]=0.59*enemy_speed enemyPath[3][4][4]=0.81*enemy_speed enemyPath[3][4][5]=0.95*enemy_speed enemyPath[3][4][6]=enemy_speed enemyPath[3][4][7]=0.95*enemy_speed enemyPath[3][4][8]=0.81*enemy_speed enemyPath[3][4][9]=0.59*enemy_speed enemyPath[3][4][10]=0.31*enemy_speed enemyPath[3][4][11]=0 enemyPath[3][4][12]=-0.31*enemy_speed enemyPath[3][4][13]=-0.59*enemy_speed enemyPath[3][4][14]=-0.81*enemy_speed enemyPath[3][4][15]=-0.95*enemy_speed enemyPath[3][4][16]=-enemy_speed enemyPath[3][4][17]=-0.95*enemy_speed enemyPath[3][4][18]=-0.81*enemy_speed enemyPath[3][4][19]=-0.59*enemy_speed enemyPath[3][4][20]=-0.31*enemy_speed enemyPath[3][4][21]=0 'round r=10 enemyPath[4][0][0]=21 enemyPath[4][1][1]=110 enemyPath[4][1][2]=120 enemyPath[4][1][3]=130 enemyPath[4][1][4]=140 enemyPath[4][1][5]=150 enemyPath[4][1][6]=160 enemyPath[4][1][7]=170 enemyPath[4][1][8]=180 enemyPath[4][1][9]=190 enemyPath[4][1][10]=200 enemyPath[4][1][11]=210 enemyPath[4][1][12]=220 enemyPath[4][1][13]=230 enemyPath[4][1][14]=240 enemyPath[4][1][15]=250 enemyPath[4][1][16]=260 enemyPath[4][1][17]=270 enemyPath[4][1][18]=280 enemyPath[4][1][19]=290 enemyPath[4][1][20]=300 enemyPath[4][1][21]=500 enemyPath[4][2][1]=0 enemyPath[4][2][2]=18 enemyPath[4][2][3]=36 enemyPath[4][2][4]=54 enemyPath[4][2][5]=72 enemyPath[4][2][6]=90 enemyPath[4][2][7]=108 enemyPath[4][2][8]=126 enemyPath[4][2][9]=144 enemyPath[4][2][10]=162 enemyPath[4][2][11]=180 enemyPath[4][2][12]=198 enemyPath[4][2][13]=216 enemyPath[4][2][14]=234 enemyPath[4][2][15]=252 enemyPath[4][2][16]=-90 enemyPath[4][2][17]=-72 enemyPath[4][2][18]=-54 enemyPath[4][2][19]=-36 enemyPath[4][2][20]=-18 enemyPath[4][2][21]=0 enemyPath[4][3][1]=enemy_speed enemyPath[4][3][2]=0.95*enemy_speed enemyPath[4][3][3]=0.81*enemy_speed enemyPath[4][3][4]=0.59*enemy_speed enemyPath[4][3][5]=0.31*enemy_speed enemyPath[4][3][6]=0 enemyPath[4][3][7]=-0.31*enemy_speed enemyPath[4][3][8]=-0.59*enemy_speed enemyPath[4][3][9]=-0.81*enemy_speed enemyPath[4][3][10]=-0.95*enemy_speed enemyPath[4][3][11]=-enemy_speed enemyPath[4][3][12]=-0.95*enemy_speed enemyPath[4][3][13]=-0.81*enemy_speed enemyPath[4][3][14]=-0.59*enemy_speed enemyPath[4][3][15]=-0.31*enemy_speed enemyPath[4][3][16]=0 enemyPath[4][3][17]=0.31*enemy_speed enemyPath[4][3][18]=0.59*enemy_speed enemyPath[4][3][19]=0.81*enemy_speed enemyPath[4][3][20]=0.95*enemy_speed enemyPath[4][3][21]=enemy_speed enemyPath[4][4][1]=0 enemyPath[4][4][2]=0.31*enemy_speed enemyPath[4][4][3]=0.59*enemy_speed enemyPath[4][4][4]=0.81*enemy_speed enemyPath[4][4][5]=0.95*enemy_speed enemyPath[4][4][6]=enemy_speed enemyPath[4][4][7]=0.95*enemy_speed enemyPath[4][4][8]=0.81*enemy_speed enemyPath[4][4][9]=0.59*enemy_speed enemyPath[4][4][10]=0.31*enemy_speed enemyPath[4][4][11]=0 enemyPath[4][4][12]=-0.31*enemy_speed enemyPath[4][4][13]=-0.59*enemy_speed enemyPath[4][4][14]=-0.81*enemy_speed enemyPath[4][4][15]=-0.95*enemy_speed enemyPath[4][4][16]=-enemy_speed enemyPath[4][4][17]=-0.95*enemy_speed enemyPath[4][4][18]=-0.81*enemy_speed enemyPath[4][4][19]=-0.59*enemy_speed enemyPath[4][4][20]=-0.31*enemy_speed enemyPath[4][4][21]=0 'round r=15 + exit down enemyPath[5][0][0]=27 enemyPath[5][1][1]=120 enemyPath[5][1][2]=125 enemyPath[5][1][3]=150 enemyPath[5][1][4]=165 enemyPath[5][1][5]=180 enemyPath[5][1][6]=195 enemyPath[5][1][7]=210 enemyPath[5][1][8]=225 enemyPath[5][1][9]=240 enemyPath[5][1][10]=255 enemyPath[5][1][11]=270 enemyPath[5][1][12]=285 enemyPath[5][1][13]=300 enemyPath[5][1][14]=315 enemyPath[5][1][15]=330 enemyPath[5][1][16]=345 enemyPath[5][1][17]=360 enemyPath[5][1][18]=375 enemyPath[5][1][19]=390 enemyPath[5][1][20]=405 enemyPath[5][1][21]=600 enemyPath[5][1][22]=615 enemyPath[5][1][23]=630 enemyPath[5][1][24]=645 enemyPath[5][1][254]=660 enemyPath[5][1][26]=675 enemyPath[5][1][27]=800 enemyPath[5][2][1]=0 enemyPath[5][2][2]=18 enemyPath[5][2][3]=36 enemyPath[5][2][4]=54 enemyPath[5][2][5]=72 enemyPath[5][2][6]=90 enemyPath[5][2][7]=108 enemyPath[5][2][8]=126 enemyPath[5][2][9]=144 enemyPath[5][2][10]=162 enemyPath[5][2][11]=180 enemyPath[5][2][12]=198 enemyPath[5][2][13]=216 enemyPath[5][2][14]=234 enemyPath[5][2][15]=252 enemyPath[5][2][16]=-90 enemyPath[5][2][17]=-72 enemyPath[5][2][18]=-54 enemyPath[5][2][19]=-36 enemyPath[5][2][20]=-18 enemyPath[5][2][21]=0 enemyPath[5][2][22]=18 enemyPath[5][2][23]=36 enemyPath[5][2][24]=54 enemyPath[5][2][25]=72 enemyPath[5][2][26]=90 enemyPath[5][2][27]=90 enemyPath[5][3][1]=enemy_speed enemyPath[5][3][2]=0.95*enemy_speed enemyPath[5][3][3]=0.81*enemy_speed enemyPath[5][3][4]=0.59*enemy_speed enemyPath[5][3][5]=0.31*enemy_speed enemyPath[5][3][6]=0 enemyPath[5][3][7]=-0.31*enemy_speed enemyPath[5][3][8]=-0.59*enemy_speed enemyPath[5][3][9]=-0.81*enemy_speed enemyPath[5][3][10]=-0.95*enemy_speed enemyPath[5][3][11]=-enemy_speed enemyPath[5][3][12]=-0.95*enemy_speed enemyPath[5][3][13]=-0.81*enemy_speed enemyPath[5][3][14]=-0.59*enemy_speed enemyPath[5][3][15]=-0.31*enemy_speed enemyPath[5][3][16]=0 enemyPath[5][3][17]=0.31*enemy_speed enemyPath[5][3][18]=0.59*enemy_speed enemyPath[5][3][19]=0.81*enemy_speed enemyPath[5][3][20]=0.95*enemy_speed enemyPath[5][3][21]=enemy_speed enemyPath[5][3][22]=0.95*enemy_speed enemyPath[5][3][23]=0.81*enemy_speed enemyPath[5][3][24]=0.59*enemy_speed enemyPath[5][3][25]=0.31*enemy_speed enemyPath[5][3][26]=0 enemyPath[5][3][27]=0 enemyPath[5][4][1]=0 enemyPath[5][4][2]=0.31*enemy_speed enemyPath[5][4][3]=0.59*enemy_speed enemyPath[5][4][4]=0.81*enemy_speed enemyPath[5][4][5]=0.95*enemy_speed enemyPath[5][4][6]=enemy_speed enemyPath[5][4][7]=0.95*enemy_speed enemyPath[5][4][8]=0.81*enemy_speed enemyPath[5][4][9]=0.59*enemy_speed enemyPath[5][4][10]=0.31*enemy_speed enemyPath[5][4][11]=0 enemyPath[5][4][12]=-0.31*enemy_speed enemyPath[5][4][13]=-0.59*enemy_speed enemyPath[5][4][14]=-0.81*enemy_speed enemyPath[5][4][15]=-0.95*enemy_speed enemyPath[5][4][16]=-enemy_speed enemyPath[5][4][17]=-0.95*enemy_speed enemyPath[5][4][18]=-0.81*enemy_speed enemyPath[5][4][19]=-0.59*enemy_speed enemyPath[5][4][20]=-0.31*enemy_speed enemyPath[5][4][21]=0 enemyPath[5][4][22]=0.31*enemy_speed enemyPath[5][4][23]=0.59*enemy_speed enemyPath[5][4][24]=0.81*enemy_speed enemyPath[5][4][25]=0.95*enemy_speed enemyPath[5][4][26]=enemy_speed enemyPath[5][4][27]=enemy_speed enemyPath[6][0][0]=3 enemyPath[6][1][1]=1 enemyPath[6][1][2]=80 enemyPath[6][1][3]=200 enemyPath[6][2][1]=0 enemyPath[6][2][2]=90 enemyPath[6][2][3]=-90 enemyPath[6][3][1]=0 enemyPath[6][3][2]=0 enemyPath[6][3][3]=0 enemyPath[6][4][1]=0 enemyPath[6][4][2]=enemy_speed enemyPath[6][4][3]=-enemy_speed EndSub Sub create_level1 'this define the behavior of the différent squadron along the time play for level 1 level1[1][1]=20 'when timeplay=level1[1][1] level1[1][2]= 2 ' lauch enemy with Path level1[1][2] level1[1][3]= -10 ' at x coordinate level1[1][3] level1[1][4] = 0 ' at y coordinate level1[1][4] level1[1][5] = 1 ' 1 for create enemy at the left side; 2 for the right side of screen level1[1][6] = 4 'level[1][6] is the number of enemies level1[1][7] = 1 'type of enemy level1[2][1]= 80 level1[2][2]= 6 level1[2][3]= gameWidth/2 level1[2][4] = -500 level1[2][5] = 1 level1[2][6] = 3 level1[2][7] = 1 level1[3][1]= 150 level1[3][2]= 0 level1[3][3]= -10 level1[3][4] = 0 level1[3][5] = 1 level1[3][6] = 6 level1[3][7] = 2 level1[4][1]= 280 level1[4][2]= 4 level1[4][3]= -10 level1[4][4] = 0 level1[4][5] = 1 level1[4][6] = 3 level1[4][7] = 2 level1[5][1]= 410 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 3 level1[5][7] = 1 level1[6][1]= 430 level1[6][2]= 6 level1[6][3]= 2*gameWidth/3 level1[6][4] = -50 level1[6][5] = 2 level1[6][6] = 3 level1[6][7] = 1 level1[5][1]= 500 level1[5][2]= 6 level1[5][3]= gameWidth/3 level1[5][4] = -50 level1[5][5] = 1 level1[5][6] = 6 level1[5][7] = 2 level1[6][1]= 590 level1[6][2]= 5 level1[6][3]= 100 level1[6][4] = -80 level1[6][5] = 1 level1[6][6] = 3 level1[6][7] = 3 level1[7][1]= 690 level1[7][2]= 6 level1[7][3]= gameWidth/3 level1[7][4] = -50 level1[7][5] = 2 level1[7][6] = 3 level1[7][7] = 2 For i= 1 To 10 Level1[7+i][1]=700+50*i level1[7+i][2]= 6 level1[7+i][3]= math.GetrandomNumber(gameWidth) level1[7+i][4] = -50 +i level1[7+i][5] = math.GetrandomNumber(2) level1[7+i][6] = math.GetrandomNumber(3) level1[7+i][7] = math.GetrandomNumber(2) EndFor level1[18][1]= 1300 level1[18][2]= 1 level1[18][3]= gameWidth level1[18][4] = -10 level1[18][5] = 2 level1[18][6] = 6 level1[18][7] = 2 For i= 1 To 10 Level1[18+i][1]=1330+50*i level1[18+i][2]= 4+math.GetrandomNumber(2) level1[18+i][3]= math.GetrandomNumber(50) level1[18+i][4] = i level1[18+i][5] = 1 level1[18+i][6] = math.GetrandomNumber(3) level1[18+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[28+i][1]=1900+50*i level1[28+i][2]= 4+math.GetrandomNumber(2) level1[28+i][3]= -math.GetrandomNumber(50) level1[28+i][4] = i level1[28+i][5] = 1 level1[28+i][6] = math.GetrandomNumber(3) level1[28+i][7] = math.GetrandomNumber(2) EndFor For i= 1 To 10 Level1[38+i][1]=2450+100*i level1[38+i][2]= 6 level1[38+i][3]= math.GetrandomNumber(gameWidth) level1[38+i][4] = -50 +i level1[38+i][5] = math.GetrandomNumber(2) level1[38+i][6] = math.GetrandomNumber(5) level1[38+i][7] = math.GetrandomNumber(2) EndFor EndSub End>RRQ875.sb< Start>RRR048.sb< 'Adventure Game 1 '////////////////////////////////////////////////////// 'GraphicsWindow.BackgroundColor = "Black" 'Graphics Window Parameters gw = 800 gh = 650 cellSize = 50 CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) CRLF = CR+LF 'CRLF = CR+LF GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.KeyDown = OnKeyDown ValidDirection = "No" GraphicsWindow.Top = (Desktop.Height - gh) / 2 GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Title = "Adventure 1" GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "LightGray" 'CellNumbTextBox = Controls.AddTextBox(650, 610) LoadImages() BuildMap() BuildDisplay() 'Graphics 'BeginStory() 'Testing Text window TextBeginStory() Sub OnKeyDown If GraphicsWindow.LastKey= "Return" Then LocationDescription() 'DIRECTION CURSOR KEY ElseIf GraphicsWindow.LastKey = "Left" Then CheckValidMove() Direction = "West" PlayersPosition() ElseIf GraphicsWindow.LastKey = "Right" Then Direction = "East" PlayersPosition() ElseIf GraphicsWindow.LastKey = "Up" Then Direction = "North" PlayersPosition() ElseIf GraphicsWindow.LastKey = "Down" Then Direction = "South" PlayersPosition() 'ACTION VERB ElseIf GraphicsWindow.LastKey = "D1" Then VerbMsg = "Get what?" Actionverb = "Yes" Controls.SetTextBoxText(VerbDescriptionBox, VerbMsg) ElseIf GraphicsWindow.LastKey = "D2" Then VerbMsg = "Cut or chop what?" Controls.SetTextBoxText(VerbDescriptionBox, VerbMsg) ElseIf Actionverb = "Yes" Then If GraphicsWindow.LastKey = "A" Then ObjectMsg = "tall Tree" ActionGood = "Yes" Controls.SetTextBoxText(ObjectDescriptionBox, ObjectMsg) CheckAction() EndIf ElseIf GraphicsWindow.LastKey = "D8" Then TextBeginStory() EndIf EndSub Sub CheckValidMove For i=1 to array.GetItemCount(Location[Row][Col]) ValidDirection=Location[1]["CanMove"] EndFor EndSub Sub CheckAction If ActionGood = "Yes" Then ResultMsg = "After much work, you chop down a tall tree" Else ResultMsg = "You can't do that here" EndIf Controls.SetTextBoxText(ResultBox, ResultMsg) EndSub 'First time thru to get rid of red rectangle at pos 7,7 GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(CurX, CurY, cellSize, cellSize) 'Cursor / game start position startX = 250 startY = 250 CurX = startX CurY = startY DrawCell() 'GraphicsWindow.KeyDown = OnKeyDown Sub SetupBoard For col = 0 to 7 For row = 0 To 7 DrawCell() EndFor EndFor EndSub Sub DrawCell PrevX = CurX PrevY = CurY If row >= 0 And col >= 0 And row <= 7 And col <= 7 Then CurX = col * cellSize CurY = row * cellSize EndIf 'This turns previous location rectangle outline black GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(PrevX, PrevY, cellSize, cellSize) 'This turns current location rectangle red GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawRectangle(CurX, CurY, cellSize, cellSize) EndSub DirectionLoop: Sub PlayersPosition If ValidDirection = "Yes" Then CanMoveText = "Yes" Controls.SetTextBoxText(MainTextBox, CanMoveText) Else NoMoveMsg = "You can't go in that direction" Controls.SetTextBoxText(MainTextBox, NoMoveMsg) 'CanMove = "Yes" Goto DirectionLoop EndIf Controls.SetTextBoxText(LocationTestBox, CanMoveText) If Direction = "West" and col > 0 Then 'Left GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(PrevX, PrevY, cellSize, cellSize) CurY = PrevY CurX = PrevX - 50 ElseIf Direction = "East" and col < 7 Then 'Right x axis GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(PrevX, PrevY, cellSize, cellSize) CurY = PrevY CurX = PrevX + 50 ElseIf Direction = "North" and row > 0 Then 'Up - Y axis GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(PrevX, PrevY, cellSize, cellSize) CurX = PrevX CurY = PrevY - 50 ElseIf Direction = "South" and row < 7 Then 'Down - Y axis GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(PrevX, PrevY, cellSize, cellSize) CurX = PrevX CurY = PrevY + 50 EndIf row = Math.Floor(CurY / cellSize) col = Math.Floor(CurX / cellSize) DrawCell() 'Test GraphicsWindow.FontSize = 20 RowNum = ("Row = " + row ) ColNum = (" Col = " + col) mxNum = ("X = " + Curx) myNum = (" Y =" + CurY) PrevXandY = ("PrevX = " + PrevX) PrevXandY = (PrevXandY + PrevY) 'Controls.SetTextBoxText(MxMyTestBox, mxNum + myNum) Controls.SetTextBoxText(RowColTestBox, RowNum + ColNum) Controls.SetTextBoxText(DirectionTestBox, Direction) 'Controls.SetTextBoxText(PrevXandYBox, PrevXandY) Location() EndSub Sub Location 'Row 1 Location[0][0] = "CanMove=Yes;ShortDescription=northern village" Location[0][1] = "dangerous marsh" Location[0][2] = "impassable mountains" Location[0][3] = "impassable mountains" Location[0][4] = "gravel path" Location[0][5] = "mine opening" Location[0][6] = "impassable mountains" Location[0][7] = "impassable mountains" 'Row 2 Location[1][0] = "gravel path" Location[1][1] = "dangerous marsh" Location[1][2] = "grove of medium trees" Location[1][3] = "gravel path" Location[1][4] = "gravel path" Location[1][5] = "impassable mountains" Location[1][6] = "river natives" Location[1][7] = "River" 'Row 3 Location[2][0] = "gravel path" Location[2][1] = "gravel path" Location[2][2] = "grove of small trees" Location[2][3] = "grove of large trees" Location[2][4] = "gravel path" Location[2][5] = "impassable mountains" Location[2][6] = "gravel path" Location[2][7] = "mill" 'Row 3 Location[3][0] = "orchard natives" Location[3][1] = "gravel path" Location[3][2] = "dense jungle" Location[3][3] = "gravel path" Location[3][4] = "gravel path" Location[3][5] = "gravel path" Location[3][6] = "gravel path" Location[3][7] = "dense jungle" 'Row 4 Location[4][0] = "orchard" Location[4][1] = "gravel path" Location[4][2] = "dense jungle" Location[4][3] = "gravel path" Location[4][4] = "dense jungle" Location[4][5] = "dense jungle" Location[4][6] = "gravel path" Location[4][7] = "dense jungle" 'Row 5 Location[5][0] = "dense jungle" Location[5][1] = "gravel path" Location[5][2] = "gravel path" Location[5][3] = "gravel path" Location[5][4] = "dense jungle" Location[5][5] = Loc55 Location[5][6] = "gravel path" Location[5][7] = "You are in a small fishing town.There's a fisherman's" + CRLF + "tavern. The fisher is here." 'Row 6 Location[6][0] = "gravel path" Location[6][1] = "gravel path" Location[6][2] = "dense jungle" Location[6][3] = "gravel path" Location[6][4] = "eco natives" Location[6][5] = "dock" Location[6][6] = "gravel path" Location[6][7] = "sandy beach" 'Row 7 Location[7][0] = "hemp grove" Location[7][1] = "southern village" Location[7][2] = "dense jungle" Location[7][3] = "sandy beach" Location[7][4] = "Ocean" Location[7][5] = "Ocean" Location[7][6] = "Ocean" Location[7][7] = "Ocean" ' ell Location 'Row 1 CellNumb[0][0] = "North = No,East = Yes, South = No, West = No" CellNumb[0][1] = "Cell01" CellNumb[0][2] = "Cell02" CellNumb[0][3] = "Cell03" CellNumb[0][4] = "Cell04" CellNumb[0][5] = "Cell05" CellNumb[0][6] = "Cell06" CellNumb[0][7] = "Cell07" 'Row 2 CellNumb[1][0] = "Cell10" CellNumb[1][1] = "Cell11" CellNumb[1][2] = "Cell12" CellNumb[1][3] = "Cell13" CellNumb[1][4] = "Cell14" CellNumb[1][5] = "Cell15" CellNumb[1][6] = "Cell16" CellNumb[1][7] = "Cell17" 'Row 3 CellNumb[2][0] = "Cell20" CellNumb[2][1] = "Cell21" CellNumb[2][2] = "Cell22" CellNumb[2][3] = "Cell23" CellNumb[2][4] = "Cell24" CellNumb[2][5] = "Cell25" CellNumb[2][6] = "Cell26" CellNumb[2][7] = "Cell27" 'Row 4 CellNumb[3][0] = "Cell30" CellNumb[3][1] = "Cell31" CellNumb[3][2] = "Cell32" CellNumb[3][3] = "Cell33" CellNumb[3][4] = "Cell34" CellNumb[3][5] = "Cell35" CellNumb[3][6] = "Cell36" CellNumb[3][7] = "Cell37" 'Row 5 CellNumb[4][0] = "Cell40" CellNumb[4][1] = "Cell41" CellNumb[4][2] = "Cell42" CellNumb[4][3] = "Cell43" CellNumb[4][4] = "Cell44" CellNumb[4][5] = "Cell45" CellNumb[4][6] = "Cell46" CellNumb[4][7] = "Cell47" 'Row 6 CellNumb[5][0] = "Cell50" CellNumb[5][1] = "Cell51" CellNumb[5][2] = "Cell52" CellNumb[5][3] = "Cell53" CellNumb[5][4] = "Cell54" CellNumb[5][5] = "Cell55" CellNumb[5][6] = "Cell56" CellNumb[5][7] = "Cell57" 'Row 7 CellNumb[6][0] = "Cell60" CellNumb[6][1] = "Cell61" CellNumb[6][2] = "Cell62" CellNumb[6][3] = "Cell63" CellNumb[6][4] = "Cell64" CellNumb[6][5] = "Cell65" CellNumb[6][6] = "Cell66" CellNumb[6][7] = "Cell67" 'Row 8 CellNumb[7][0] = "Cell70" CellNumb[7][1] = "Cell71" CellNumb[7][2] = "Cell72" CellNumb[7][3] = "Cell73" CellNumb[7][4] = "Cell74" CellNumb[7][5] = "Cell75" CellNumb[7][6] = "Cell76" CellNumb[7][7] = "Cell77" Controls.SetTextBoxText(LocationTestBox, Location[Row][Col]) Controls.SetTextBoxText(CellNumbTestBox, CellNumb[Row][Col]) EndSub Sub LocationDescription Controls.SetTextBoxText(LocationDescriptionBox, "Got Here") Controls.SetTextBoxText(MainTextBox,Location[Row][Col]) Loc55 = "This is a test to see if it works." + CRLF Loc55 = Loc55 + "This would be the second line" + CRLF Loc55 = Loc55 + "This is third row" 'ToDo EndSub Sub BuildDisplay GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 14 GraphicsWindow.DrawBoundText(490, 2, 210, "LOCATION DESCRIPTION") GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "Black" MainTextBox= Controls.AddTextBox(410, 30) Controls.SetSize(MainTextBox,350, 100) GraphicsWindow.FontSize = 15 'Controls.SetSize(MainText, 380, 150) GraphicsWindow.DrawText(410,200, "Action") GraphicsWindow.DrawText(600,200, "Object") VerbDescriptionBox = Controls.AddTextBox(410, 220) ObjectDescriptionBox = Controls.AddTextBox(600, 220) GraphicsWindow.DrawText(410,260, "Results") ResultBox = Controls.AddTextBox(410, 280) Controls.SetSize(ResultBox, 350, 25) 'VERB LIST GraphicsWindow.DrawText(10,440,"1 Get (or take)") GraphicsWindow.DrawText(10,460,"2 Cut (Chop)") GraphicsWindow.DrawText(10,480,"3 Leave (or drop)") GraphicsWindow.DrawText(10,500,"4 Write") GraphicsWindow.DrawText(10,520,"5 Speak") GraphicsWindow.DrawText(10,540,"6 Fit (or Fix)") GraphicsWindow.DrawText(10,560,"7 Inventory") GraphicsWindow.DrawText(10,580,"8 Repeat Story Line") 'OBJECT LIST GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawText(200,440,"A tall Tree") GraphicsWindow.DrawText(200,460,"B medium sized tree") GraphicsWindow.DrawText(200,480,"C slim tree") GraphicsWindow.DrawText(200,500,"D hemp plants") GraphicsWindow.DrawText(200,520,"E fine twine") GraphicsWindow.DrawText(200,540,"F canvas") GraphicsWindow.DrawText(200,560,"G sails") GraphicsWindow.DrawText(200,580,"H thick twine") GraphicsWindow.DrawText(400,440,"I hemp rope") GraphicsWindow.DrawText(400,460,"J junk metal") GraphicsWindow.DrawText(400,480,"K metal fitting parts") GraphicsWindow.DrawText(400,500,"L hemp doll") GraphicsWindow.DrawText(400,520,"M ripe fruit") GraphicsWindow.DrawText(400,540,"N hemp fibers") GraphicsWindow.DrawText(400,560,"O hunting knife") GraphicsWindow.DrawText(400,580,"P seashell") GraphicsWindow.DrawText(600,440,"Q quartz") GraphicsWindow.DrawText(600,460,"R wicker basket") GraphicsWindow.DrawText(600,480,"S rigging plan") GraphicsWindow.DrawText(600,500,"T cultural report") GraphicsWindow.DrawText(600,520,"U long handled axe") GraphicsWindow.DrawText(600,540,"V donkey with satchels") GraphicsWindow.DrawText(600,560,"W notebook and pen") EndSub 'Load Images Sub LoadImages Village = ImageList.LoadImage(Program.Directory + "\Village.jpg") GravelPath = ImageList.LoadImage(Program.Directory + "\GravelPath.jpg") Mountain = ImageList.LoadImage(Program.Directory + "\Mountain.jpg") Marsh = ImageList.LoadImage(Program.Directory + "\Marsh.jpg") LargeTrees = ImageList.LoadImage(Program.Directory + "\Large Trees.jpg") MediumTrees = ImageList.LoadImage(Program.Directory + "\Medium Trees.jpg") SmallTrees = ImageList.LoadImage(Program.Directory + "\Small Trees.jpg") Mine = ImageList.LoadImage(Program.Directory + "\Mine.jpg") DenseJungle = ImageList.LoadImage(Program.Directory + "\Dense Jungle.jpg") EcoNatives = ImageList.LoadImage(Program.Directory + "\Eco Natives.jpg") OrchardNatives = ImageList.LoadImage(Program.Directory + "\Orchard Natives.jpg") RiverNatives = ImageList.LoadImage(Program.Directory + "\River Natives.jpg") Mill = ImageList.LoadImage(Program.Directory + "\Mill.jpg") Orchard = ImageList.LoadImage(Program.Directory + "\Orchard.jpg") Beach = ImageList.LoadImage(Program.Directory + "\Beach.jpg") HempGrove = ImageList.LoadImage(Program.Directory + "\HempGrove.jpg") Port = ImageList.LoadImage(Program.Directory + "\Port.jpg") Town = ImageList.LoadImage(Program.Directory + "\Town.jpg") Ocean = ImageList.LoadImage(Program.Directory + "\Ocean.jpg") River2 = ImageList.LoadImage(Program.Directory + "\River2.jpg") Dock = ImageList.LoadImage(Program.Directory + "\Dock.jpg") EndSub 'Build Map Sub BuildMap 'row 1 GraphicsWindow.DrawResizedImage(Village, 0, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Marsh, 50, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 100, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 150, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 200, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mine, 250, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 300, 0, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 350, 0, cellsize, cellsize) 'row 2 GraphicsWindow.DrawResizedImage(GravelPath, 0, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Marsh, 50, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(MediumTrees, 100, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 150, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 200, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 250, 50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(RiverNatives, 300,50, cellsize, cellsize) GraphicsWindow.DrawResizedImage(River2, 350, 50, cellsize, cellsize) 'Row 3 GraphicsWindow.DrawResizedImage(GravelPath, 0, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 50, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(SmallTrees, 100, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(LargeTrees, 150, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 200, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mountain, 250, 100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 300,100, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Mill, 350, 100, cellsize, cellsize) 'Row 4 GraphicsWindow.DrawResizedImage(OrchardNatives, 0, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 50, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 100, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 150, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 200, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 250, 150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 300,150, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 350, 150, cellsize, cellsize) 'Row 5 GraphicsWindow.DrawResizedImage(Orchard, 0, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 50, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 100, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 150, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 200, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 250, 200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 300,200, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 350, 200, cellsize, cellsize) 'row 6 GraphicsWindow.DrawResizedImage(DenseJungle, 0, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 50, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 100, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 150, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 200, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Port, 250, 250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 300,250, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Town, 350, 250, cellsize, cellsize) 'Row 7 GraphicsWindow.DrawResizedImage(GravelPath, 0, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 50, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 100, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 150, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(EcoNatives, 200, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Dock, 250, 300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(GravelPath, 300,300, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Beach, 350, 300, cellsize, cellsize) 'Row 7 GraphicsWindow.DrawResizedImage(HempGrove, 0, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Village, 50, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(DenseJungle, 100, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Beach, 150, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Ocean, 200, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Ocean, 250, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Ocean, 300, 350, cellsize, cellsize) GraphicsWindow.DrawResizedImage(Ocean, 350, 350, cellsize, cellsize) 'Sub SetupBoard For col = 0 to 7 For row = 0 To 7 DrawCell() EndFor EndFor 'EndSub EndSub 'Begin Story 'Testing Text Sub TextBeginStory TextWindow.Show() TextWindow.WriteLine("1. You are sailing around the world when you got caught in a") TextWindow.WriteLine("2. terrible storm. You have survived the storm, but your") TextWindow.WriteLine("3. ship's rigging - masts, sails etc. are gone except for") TextWindow.Writeline("4. the bowsprit and a few ropes. However, you have made it to a") TextWindow.WriteLine("5. fishing port in order to repair your ship so that you can") TextWindow.WriteLine("6. continue on your journey.") TextWindow.WriteLine("7. Someone offers help, and you will also meet others who will") TextWindow.WriteLine("8. cooperate in exchange for small favors. There are 10 people to") TextWindow.WriteLine("9. interact with, and 23 objects that you can manipulate to get") TextWindow.WriteLine("10.your ship repaired. Conversation lines develop and certain") TextWindow.WriteLine("11.objects appear depending on the progress of the verbal exchange") TextWindow.WriteLine("12.with various people. Time needs to pass for some things to") TextWindow.WriteLine("11.appear and there is a specific order to repairing your ship.") TextWindow.WriteLine("12.All repairs must be made at the dock.") TextWindow.WriteLine("13.Finally you can only carry 7 things at a time.") ' To add ambience, different animals appear here and there at random, and ' a merchant sailing ship passes by occasionally. TextWindow.WriteLine(" ") TextWindow.WriteLine("14.The game is text-run, managed by the cursor to move") TextWindow.WriteLine("15.around and certain number keys that repesent action verbs.") TextWindow.WriteLine("16.The program will ask for an object") TextWindow.WriteLine("17.to go with an action verb, and will execute the task") TextWindow.WriteLine("18.if possible, or in some cases provide a helpful comment.") TextWindow.WriteLine(" ") TextWindow.WriteLine("19.There is a map to guide you - movement by cursor keys.") TextWindow.WriteLine("20.The Enter/Return Key will bring up a description of your location.") TextWindow.WriteLine("21.Certain actions can be performed using number next to the action verbs") TextWindow.WriteLine("22.and then the letter next to the object.") TextWindow.Pause() TextWindow.Hide() EndSub Sub BeginStory BeginText = ("You have survived a terrible storm, but your ship's " + CRLF) BeginText = (BeginText + "rigging is gone except for the bowsprit and a few ropes. " + CRLF) BeginText = (BeginText + "However, you make it to a fishing port in order to repair " + CRLF) BeginText = (BeginText + "your ship so that you can continue on your journey." + CRLF) BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "Someone offers help, and you will also meet others " + CRLF) BeginText = (BeginText + "who will cooperate in exchange for small favors. " + CRLF) BeginText = (BeginText + "There are 10 people to interact with, and 23 objects" + CRLF) BeginText = (BeginText + "that you can manipulate to get your ship repaired." + CRLF) BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "Conversation lines develop and certain objects appear " + CRLF) BeginText = (BeginText + "depending on the progress of the verbal exchange with " + CRLF) BeginText = (BeginText + "various people." + CRLF) ' To add ambience, different animals appear here and there at random, and ' a merchant sailing ship passes by occasionally. BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "The game is text-run, managed by the cursor to move " + CRLF) BeginText = (BeginText + "around, and certain letter keys which are the initials " + CRLF) BeginText = (BeginText + "of the action verbs. The program will ask for an object" + CRLF) BeginText = (BeginText + "to go with an action verb, and will execute the task" + CRLF) BeginText = (BeginText + "if possible, or in some cases provide a helpful comment." + CRLF) BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "There is a map to guide you - movement by cursor keys. " + CRLF) BeginText = (BeginText + "The Enter/Return Key will bring up location description." + CRLF) BeginText = (BeginText + "Certain actions can be performed using the first letter: " + CRLF) BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "Get (or Take) Write Cut (Chop) Inventory" + CRLF) BeginText = (BeginText + " " + CRLF) BeginText = (BeginText + "Leave (or Drop) Speak Fit (Fix)") Controls.SetTextBoxText(MainTextBox, BeginText) EndSub '////////////// For Testing GraphicsWindow.PenColor = "Black" DirectionTestBox = Controls.AddTextBox(10, 610) Controls.SetSize(DirectionTestBox,75, 25) RowColTestBox = Controls.AddTextBox(100, 610) Controls.SetSize(RowColTestBox,160, 25) 'MxMyTestBox = Controls.AddTextBox(550, 610) LocationTestBox = Controls.AddTextBox(270, 610) Controls.SetSize(LocationTestBox,180, 25) LocationDescriptionBox = Controls.AddTextBox(480, 610) Controls.SetSize(LocationDescriptionBox,100, 25) CellNumbTestBox = Controls.AddTextBox(600, 610) VerbDescriptionBox = Controls.AddTextBox(410, 220) ObjectDescriptionBox = Controls.AddTextBox(600, 220) 'PrevXandYBox = Controls.AddTextBox(10, 560) End>RRR048.sb< Start>RRR611-0.sb< ' Orignal Code Program (Tryhest) ID RRR611 ' Updated mahreen miangul GraphicsWindow.Title = "Merry Christmas and A Happy New Year 2019" bg = "midnightblue GraphicsWindow.BackgroundColor = bg gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh DrawStars() ' draw wall GraphicsWindow.BrushColor = bg GraphicsWindow.FillRectangle(270, 250, 110, 150) ' initialize shapes For Santa Shapes_Init_Santa() angle = 0 scale = 0.5 name = "Santa" Group_Add() ' initialize shapes For Christmas tree Shapes_Init_Tree() scale = 0.4 name = "Tree" Group_Add() InitFlashLights() ' initialize shapes For house (and snowman) Shapes_Init_House() scale = 0.8 name = "House" Group_Add() eyes = "1=6;2=7 'LDShapes.SetShapeEvent(ls) 'LDShapes.ShapeEvent=see 'LDShapes.ZIndex(ls 1000) h1=Shapes.AddText("Happy") h2=Shapes.AddText("New") h3=Shapes.AddText("2019.") h4=Shapes.AddText("Year") ll=Shapes.GetLeft(ls) tt=Shapes.GetTop(ls) Program.Delay(55) 'LDShapes.Font(h1 "Clarendon BT" 22 "false" "true") 'LDShapes.Font(h2 "Clarendon BT" 22 "false" "true") 'LDShapes.Font(h3 "Clarendon BT" 22 "false" "true") 'LDShapes.Font(h4 "Clarendon BT" 22 "false" "true") 'ldShapes.Centre(h1 ll+35 tt+15) Program.Delay(55) 'ldShapes.Centre(h2 ll+35 tt+45) Program.Delay(55) 'ldShapes.Centre(h3 ll+35 tt+75) Program.Delay(55) 'ldShapes.Centre(h4 ll+35 tt+105) Sub see 'If LDShapes.LastEventType="MouseDown" Then 'ldShapes.AnimateOpacity(ls 1500 3) 'EndIf EndSub While 1=1'----------------------------------------mainloop _t = Math.Remainder(t, 250) ' 20 sec If 70 < _t Then i = 1 ' Santa grp = group[i] x = 500 - 7 * (_t - 130) y = grp["y"] Group_Move() EndIf _t = Math.Remainder(t, 30) ' 3 sec If _t = 0 Then pattern = Math.GetRandomNumber(3) If pattern = 3 Then GenerateRandomArray() EndIf i = 3 ' snowman (house) grp = group[i] shape = grp["shape"] For i = 1 To 2 shp = shape[eyes[i]] Shapes.ShowShape(shp["obj"]) EndFor EndIf If (0 <= _t) And (_t <= 25) Then i = 2 ' tree grp = group[i] shape = grp["shape"] If pattern = 1 Then shp = shape[_t + fbegin] ElseIf pattern = 2 Then shp = shape[fend - _t] ElseIf pattern = 3 Then shp = shape[fbegin + ra[_t]] EndIf Shapes.SetOpacity(shp["obj"], 0) ' flash lights on EndIf If _t = 28 Then i = 3 ' snowman (house) grp = group[i] shape = grp["shape"] For i = 1 To 2 shp = shape[eyes[i]] Shapes.HideShape(shp["obj"]) EndFor EndIf If _t = 29 Then i = 2 ' tree grp = group[i] shape = grp["shape"] For f = fbegin To fend shp = shape[f] Shapes.SetOpacity(shp["obj"], 70) ' flash lights off EndFor EndIf Program.Delay(70) t = t + 1 EndWhile'========================================================endmainlp Sub DrawStars GraphicsWindow.BrushColor = "White" For i = 1 To 500 x = Math.GetRandomNumber(gw) - 1 y = Math.GetRandomNumber(gh) - 1 s = Math.GetRandomNumber(3) GraphicsWindow.FillEllipse(x, y, s, s) EndFor EndSub Sub GenerateRandomArray ra[0] = 1 ra[1] = 0 ' end n = 2 For i = 2 To 25 p = 0 o = Math.GetRandomNumber(n) - 1 While 0 < o p = ra[p] o = o - 1 EndWhile ra[i] = ra[p] ra[p] = i n = n + 1 EndFor EndSub Sub InitFlashLights fbegin = 48 fend = 73 For f = fbegin To fend shp = shape[f] Shapes.SetOpacity(shp["obj"], 70) ' flash lights off EndFor 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 Text.IsSubText("text|btn", shp["func"]) Then fs = shp["fs"] 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 ls = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) shp["obj"]=ls 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) shp["width"] = shp["x3"] - shp["x2"] shp["height"] = shp["y2"] - shp["y1"] ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) shp["width"] = Math.Max(shp["x1"], shp["x2"]) - Math.Min(shp["x1"], shp["x2"]) shp["height"] = Math.Max(shp["y1"], shp["y2"]) - Math.Min(shp["y1"], shp["y2"]) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) shp["width"] = shp["fs"] * 0.6 * Text.GetLength(shp["text"]) shp["height"] = shp["fs"] EndIf param["x"] = shp["x"] param["y"] = shp["y"] param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 param["width"] = shp["width"] param["height"] = shp["height"] param["scale"] = s param["angle"] = 0 Shapes_CalcRotateZoomPos() shp["rx"] = x shp["ry"] = y If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x, shY + y) Else Shapes.Move(shp["obj"], shX + x, shY + y) 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"] Shapes.Move(shp["obj"], grp["x"] + _x, grp["y"] + _y) 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 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 _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 * param["scale"] y = _cy - param["height"] / 2 * param["scale"] EndSub Sub Shapes_CalcWidthAndHeight 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_House shX = -10 ' x offset shY = 50 ' y offset shape = "" shape[1] = "func=rect;x=463;y=327;width=38;height=15;angle=29;bc=#442200;pw=0;" shape[2] = "func=ell;x=495;y=266;width=84;height=73;bc=#FFFFFF;pw=0;" shape[3] = "func=ell;x=479;y=320;width=115;height=97;bc=#FFFFFF;pw=0;" shape[4] = "func=rect;x=513;y=297;width=16;height=6;bc=#000000;pw=0;" shape[5] = "func=rect;x=545;y=297;width=16;height=6;bc=#000000;pw=0;" shape[6] = "func=ell;x=512;y=290;width=18;height=19;bc=#000000;pw=0;" shape[7] = "func=ell;x=544;y=290;width=18;height=19;bc=#000000;pw=0;" shape[8] = "func=rect;x=526;y=317;width=21;height=5;bc=#000000;pw=0;" shape[9] = "func=rect;x=-80;y=380;width=758;height=78;bc=#FFFFFF;pw=0;" shape[10] = "func=tri;x=30;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;bc=#999999;pw=0;" shape[11] = "func=rect;x=30;y=200;width=200;height=200;bc=#999999;pw=0;" shape[12] = "func=tri;x=130;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;angle=180;bc=#660000;pw=0;" shape[13] = "func=rect;x=230;y=50;width=100;height=150;bc=#660000;pw=0;" shape[14] = "func=tri;x=230;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;bc=#660000;pw=0;" shape[15] = "func=rect;x=230;y=200;width=50;height=200;bc=#CCCCCC;pw=0;" shape[16] = "func=rect;x=380;y=200;width=50;height=200;bc=#CCCCCC;pw=0;" shape[17] = "func=rect;x=230;y=350;width=200;height=50;bc=#CCCCCC;pw=0;" shape[18] = "func=rect;x=80;y=200;width=100;height=200;bc=brown;pw=0;" EndSub Sub Shapes_Init_Tree shX = 210 ' x offset shY = 170 ' y offset ss= "func=rect;x=44;y=247;width=84;height=24;bc=#661100;pw=0|func=tri;x=50;y=270;x1=8;y1=0;x2=0;y2=58;x3=17;y3=58;angle=180;bc=#661100;pw=0|func=tri;x=104;y=270;x1=8;y1=0;x2=0;y2=58;x3=17;y3=58;angle=180;bc=#661100;pw=0|func=rect;x=59;y=270;width=54;height=58;bc=#661111;pw=0|func=rect;x=44;y=270;width=84;height=5;bc=#66222222;pw=0|func=rect;x=74;y=200;width=22;height=48;bc=#3B1E0C;pw=0|func=tri;x=30;y=19;x1=54;y1=0;x2=0;y2=82;x3=109;y3=82;bc=#17330B;pw=0|func=tri;x=16;y=49;x1=69;y1=0;x2=0;y2=98;x3=138;y3=98;bc=#17330B;pw=0|func=tri;x=0;y=89;x1=84;y1=0;x2=0;y2=113;x3=168;y3=113;bc=#17330B;pw=0|func=tri;x=61;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=181;bc=#B5925E;pw=0|func=tri;x=60;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=252;bc=#B5925E;pw=0|func=tri;x=59;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=331;bc=#B5925E;pw=0|func=rect;x=157;y=253;width=77;height=74;bc=#CC9999;pw=0|func=rect;x=170;y=287;width=26;height=28;angle=20;bc=#669966;pw=0|func=rect;x=171;y=263;width=17;height=18;angle=20;bc=#669966;pw=0|func=rect;x=204;y=284;width=21;height=22;angle=20;bc=#669966;pw=0|func=rect;x=187;y=236;width=16;height=91;bc=#990000;pw=0|func=tri;x=164;y=227;x1=13;y1=0;x2=0;y2=20;x3=27;y3=20;bc=Transparent;pc=#990000;pw=8|func=tri;x=200;y=227;x1=13;y1=0;x2=0;y2=20;x3=27;y3=20;bc=Transparent;pc=#990000;pw=8|func=line;x=166;y=245;x1=26;y1=0;x2=0;y2=21;pc=#990000;pw=8|func=line;x=197;y=245;x1=0;y1=0;x2=23;y2=23;pc=#990000;pw=8|func=rect;x=100;y=57;width=8;height=8;bc=#0029CC;pw=0|func=rect;x=91;y=68;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=78;y=75;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=67;y=82;width=10;height=9;bc=#0029CC;pw=0|func=rect;x=52;y=86;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=39;y=86;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=121;y=83;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=114;y=95;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=102;y=106;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=92;y=117;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=82;y=125;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=71;y=133;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=57;y=138;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=43;y=138;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=31;y=137;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=26;y=127;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=134;y=126;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=125;y=135;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=115;y=145;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=105;y=154;width=9;height=10;bc=#0029CC;pw=0|func=rect;x=93;y=163;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=80;y=170;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=66;y=174;width=10;height=9;bc=#0029CC;pw=0|func=rect;x=51;y=176;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=37;y=175;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=22;y=173;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=100;y=57;width=8;height=8;bc=#000000;pw=0|func=rect;x=91;y=68;width=9;height=9;bc=#000000;pw=0|func=rect;x=78;y=75;width=10;height=8;bc=#000000;pw=0|func=rect;x=67;y=82;width=10;height=9;bc=#000000;pw=0|func=rect;x=52;y=86;width=10;height=10;bc=#000000;pw=0|func=rect;x=39;y=86;width=10;height=8;bc=#000000;pw=0|func=rect;x=121;y=83;width=10;height=10;bc=#000000;pw=0|func=rect;x=114;y=95;width=9;height=9;bc=#000000;pw=0|func=rect;x=102;y=106;width=8;height=9;bc=#000000;pw=0|func=rect;x=92;y=117;width=10;height=8;bc=#000000;pw=0|func=rect;x=82;y=125;width=8;height=10;bc=#000000;pw=0|func=rect;x=71;y=133;width=8;height=10;bc=#000000;pw=0|func=rect;x=57;y=138;width=10;height=10;bc=#000000;pw=0|func=rect;x=43;y=138;width=10;height=10;bc=#000000;pw=0|func=rect;x=31;y=137;width=8;height=9;bc=#000000;pw=0|func=rect;x=26;y=127;width=10;height=8;bc=#000000;pw=0|func=rect;x=134;y=126;width=8;height=10;bc=#000000;pw=0|func=rect;x=125;y=135;width=8;height=10;bc=#000000;pw=0|func=rect;x=115;y=145;width=8;height=10;bc=#000000;pw=0|func=rect;x=105;y=154;width=9;height=10;bc=#000000;pw=0|func=rect;x=93;y=163;width=10;height=10;bc=#000000;pw=0|func=rect;x=80;y=170;width=10;height=10;bc=#000000;pw=0|func=rect;x=66;y=174;width=10;height=9;bc=#000000;pw=0|func=rect;x=51;y=176;width=9;height=9;bc=#000000;pw=0|func=rect;x=37;y=175;width=8;height=9;bc=#000000;pw=0|func=rect;x=22;y=173;width=10;height=10;bc=#000000;pw=0|func=ell;x=79;y=185;width=23;height=24;bc=#969696;pw=0|func=ell;x=93;y=126;width=23;height=24;bc=#969696;pw=0|func=ell;x=41;y=149;width=23;height=24;bc=#969696;pw=0|func=ell;x=41;y=101;width=23;height=24;bc=#969696;pw=0|func=ell;x=138;y=138;width=23;height=24;bc=#969696;pw=0|func=ell;x=57;y=41;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=80;y=88;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=20;y=191;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=124;y=176;width=23;height=24;bc=#B5925E;pw=0 'shape = LDText.Split(ss "|") EndSub Sub Shapes_Init_Santa shX = 500 ' x offset shY = -40 ' y offset ss="func=ell;x=35;y=114;width=104;height=50;bc=#814A27;pw=0|func=rect;x=44;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=57;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=107;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=121;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=40;y=85;width=24;height=47;bc=#814A27;pw=0|func=ell;x=131;y=116;width=18;height=20;bc=#814A27;pw=0|func=rect;x=51;y=43;width=7;height=30;bc=#A7842A;pw=0|func=rect;x=61;y=50;width=7;height=30;bc=#A7842A;pw=0|func=rect;x=41;y=26;width=7;height=30;angle=297;bc=#A7842A;pw=0|func=rect;x=71;y=30;width=7;height=30;angle=55;bc=#A7842A;pw=0|func=rect;x=29;y=6;width=7;height=30;angle=352;bc=#A7842A;pw=0|func=rect;x=83;y=10;width=7;height=30;angle=7;bc=#A7842A;pw=0|func=rect;x=38;y=116;width=27;height=7;angle=349;bc=#000000;pw=0|func=ell;x=28;y=117;width=16;height=16;bc=#C3AB6F;pw=0|func=rect;x=165;y=205;width=241;height=9;bc=#8C8C8C;pw=0|func=rect;x=185;y=185;width=9;height=23;bc=#8C8C8C;pw=0|func=rect;x=377;y=185;width=9;height=23;bc=#8C8C8C;pw=0|func=rect;x=156;y=191;width=9;height=23;angle=317;bc=#8C8C8C;pw=0|func=rect;x=69;y=114;width=9;height=52;angle=355;bc=#000000;pw=0|func=rect;x=73;y=143;width=111;height=9;bc=#000000;pw=0|func=ell;x=299;y=75;width=92;height=88;bc=#EBE4D0;pw=0|func=ell;x=239;y=87;width=84;height=88;bc=#9D1010;pw=0|func=ell;x=258;y=51;width=49;height=57;bc=#EBE4D0;pw=0|func=rect;x=266;y=66;width=33;height=21;bc=#DBB9A9;pw=0|func=ell;x=275;y=79;width=13;height=13;bc=#9D1010;pw=0|func=rect;x=271;y=47;width=32;height=14;angle=13;bc=#9D1010;pw=0|func=rect;x=274;y=43;width=36;height=13;bc=#9D1010;pw=0|func=ell;x=306;y=37;width=18;height=20;bc=#EBE4D0;pw=0|func=rect;x=264;y=89;width=10;height=45;angle=333;bc=#E2D8BB;pw=0|func=rect;x=283;y=89;width=10;height=63;angle=33;bc=#EBE4D0;pw=0|func=rect;x=184;y=143;width=202;height=43;bc=#563A1A;pw=0|func=ell;x=210;y=65;width=24;height=24;bc=#EBE4D0;pw=0|func=rect;x=215;y=83;width=26;height=34;angle=347;bc=#9D1010;pw=0|func=rect;x=225;y=90;width=26;height=34;angle=272;bc=#9D1010;pw=0|func=ell;x=16;y=71;width=56;height=30;bc=#814A27;pw=0|func=ell;x=41;y=75;width=12;height=12;bc=#000000;pw=0|func=ell;x=7;y=79;width=14;height=14;bc=#9D1010;pw=0|func=ell;x=64;y=72;width=24;height=12;angle=340;bc=#814A27;pw=0|func=rect;x=259;y=71;width=17;height=4;angle=350;bc=#EBE4D0;pw=|func=rect;x=288;y=71;width=17;height=4;angle=18;bc=#EBE4D0;pw=|func=rect;x=98;y=19;width=7;height=30;angle=81;bc=#A7842A;pw=0|func=rect;x=17;y=16;width=7;height=30;angle=287;bc=#A7842A;pw=0|func=rect;x=115;y=5;width=7;height=30;angle=16;bc=#A7842A;pw=0|func=rect;x=0;y=0;width=7;height=30;angle=338;bc=#A7842A;pw=0|func=ell;x=289;y=81;width=21;height=22;bc=#EBE4D0;pw=0|func=ell;x=255;y=83;width=21;height=22;bc=#EBE4D0;pw=0|func=ell;x=265;y=71;width=14;height=14;bc=#FFFFFF;pc=#000000;pw=2|func=ell;x=285;y=71;width=14;height=14;bc=#FFFFFF;pc=#000000;pw=2|func=line;x=277;y=77;x1=0;y1=0;x2=10;y2=0;pc=#000000;pw=2 'shape = LDText.Split(ss "|") EndSub End>RRR611-0.sb< Start>RRR611.sb< GraphicsWindow.Title = "Merry Christmas and A Happy New Year 2019" bg = "midnightblue GraphicsWindow.BackgroundColor = bg gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh DrawStars() ' draw wall GraphicsWindow.BrushColor = bg GraphicsWindow.FillRectangle(270, 250, 110, 150) ' initialize shapes For Santa Shapes_Init_Santa() angle = 0 scale = 0.5 name = "Santa" Group_Add() ' initialize shapes For Christmas tree Shapes_Init_Tree() scale = 0.4 name = "Tree" Group_Add() InitFlashLights() ' initialize shapes For house (and snowman) Shapes_Init_House() scale = 0.8 name = "House" Group_Add() eyes = "1=6;2=7 LDShapes.SetShapeEvent(ls) LDShapes.ShapeEvent=see LDShapes.ZIndex(ls 1000) h1=Shapes.AddText("Happy") h2=Shapes.AddText("New") h3=Shapes.AddText("2019.") h4=Shapes.AddText("Year") ll=Shapes.GetLeft(ls) tt=Shapes.GetTop(ls) Program.Delay(55) LDShapes.Font(h1 "Clarendon BT" 22 "false" "true") LDShapes.Font(h2 "Clarendon BT" 22 "false" "true") LDShapes.Font(h3 "Clarendon BT" 22 "false" "true") LDShapes.Font(h4 "Clarendon BT" 22 "false" "true") ldShapes.Centre(h1 ll+35 tt+15) Program.Delay(55) ldShapes.Centre(h2 ll+35 tt+45) Program.Delay(55) ldShapes.Centre(h3 ll+35 tt+75) Program.Delay(55) ldShapes.Centre(h4 ll+35 tt+105) Sub see If LDShapes.LastEventType="MouseDown" Then ldShapes.AnimateOpacity(ls 1500 3) EndIf EndSub While 1=1'----------------------------------------mainloop _t = Math.Remainder(t, 250) ' 20 sec If 70 < _t Then i = 1 ' Santa grp = group[i] x = 500 - 7 * (_t - 130) y = grp["y"] Group_Move() EndIf _t = Math.Remainder(t, 30) ' 3 sec If _t = 0 Then pattern = Math.GetRandomNumber(3) If pattern = 3 Then GenerateRandomArray() EndIf i = 3 ' snowman (house) grp = group[i] shape = grp["shape"] For i = 1 To 2 shp = shape[eyes[i]] Shapes.ShowShape(shp["obj"]) EndFor EndIf If (0 <= _t) And (_t <= 25) Then i = 2 ' tree grp = group[i] shape = grp["shape"] If pattern = 1 Then shp = shape[_t + fbegin] ElseIf pattern = 2 Then shp = shape[fend - _t] ElseIf pattern = 3 Then shp = shape[fbegin + ra[_t]] EndIf Shapes.SetOpacity(shp["obj"], 0) ' flash lights on EndIf If _t = 28 Then i = 3 ' snowman (house) grp = group[i] shape = grp["shape"] For i = 1 To 2 shp = shape[eyes[i]] Shapes.HideShape(shp["obj"]) EndFor EndIf If _t = 29 Then i = 2 ' tree grp = group[i] shape = grp["shape"] For f = fbegin To fend shp = shape[f] Shapes.SetOpacity(shp["obj"], 70) ' flash lights off EndFor EndIf Program.Delay(70) t = t + 1 EndWhile'========================================================endmainlp Sub DrawStars GraphicsWindow.BrushColor = "White" For i = 1 To 500 x = Math.GetRandomNumber(gw) - 1 y = Math.GetRandomNumber(gh) - 1 s = Math.GetRandomNumber(3) GraphicsWindow.FillEllipse(x, y, s, s) EndFor EndSub Sub GenerateRandomArray ra[0] = 1 ra[1] = 0 ' end n = 2 For i = 2 To 25 p = 0 o = Math.GetRandomNumber(n) - 1 While 0 < o p = ra[p] o = o - 1 EndWhile ra[i] = ra[p] ra[p] = i n = n + 1 EndFor EndSub Sub InitFlashLights fbegin = 48 fend = 73 For f = fbegin To fend shp = shape[f] Shapes.SetOpacity(shp["obj"], 70) ' flash lights off EndFor 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 Text.IsSubText("text|btn", shp["func"]) Then fs = shp["fs"] 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 ls = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) shp["obj"]=ls 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) shp["width"] = shp["x3"] - shp["x2"] shp["height"] = shp["y2"] - shp["y1"] ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) shp["width"] = Math.Max(shp["x1"], shp["x2"]) - Math.Min(shp["x1"], shp["x2"]) shp["height"] = Math.Max(shp["y1"], shp["y2"]) - Math.Min(shp["y1"], shp["y2"]) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) shp["width"] = shp["fs"] * 0.6 * Text.GetLength(shp["text"]) shp["height"] = shp["fs"] EndIf param["x"] = shp["x"] param["y"] = shp["y"] param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 param["width"] = shp["width"] param["height"] = shp["height"] param["scale"] = s param["angle"] = 0 Shapes_CalcRotateZoomPos() shp["rx"] = x shp["ry"] = y If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x, shY + y) Else Shapes.Move(shp["obj"], shX + x, shY + y) 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"] Shapes.Move(shp["obj"], grp["x"] + _x, grp["y"] + _y) 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 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 _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 * param["scale"] y = _cy - param["height"] / 2 * param["scale"] EndSub Sub Shapes_CalcWidthAndHeight 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_House shX = -10 ' x offset shY = 50 ' y offset shape = "" shape[1] = "func=rect;x=463;y=327;width=38;height=15;angle=29;bc=#442200;pw=0;" shape[2] = "func=ell;x=495;y=266;width=84;height=73;bc=#FFFFFF;pw=0;" shape[3] = "func=ell;x=479;y=320;width=115;height=97;bc=#FFFFFF;pw=0;" shape[4] = "func=rect;x=513;y=297;width=16;height=6;bc=#000000;pw=0;" shape[5] = "func=rect;x=545;y=297;width=16;height=6;bc=#000000;pw=0;" shape[6] = "func=ell;x=512;y=290;width=18;height=19;bc=#000000;pw=0;" shape[7] = "func=ell;x=544;y=290;width=18;height=19;bc=#000000;pw=0;" shape[8] = "func=rect;x=526;y=317;width=21;height=5;bc=#000000;pw=0;" shape[9] = "func=rect;x=-80;y=380;width=758;height=78;bc=#FFFFFF;pw=0;" shape[10] = "func=tri;x=30;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;bc=#999999;pw=0;" shape[11] = "func=rect;x=30;y=200;width=200;height=200;bc=#999999;pw=0;" shape[12] = "func=tri;x=130;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;angle=180;bc=#660000;pw=0;" shape[13] = "func=rect;x=230;y=50;width=100;height=150;bc=#660000;pw=0;" shape[14] = "func=tri;x=230;y=50;x1=100;y1=0;x2=0;y2=150;x3=200;y3=150;bc=#660000;pw=0;" shape[15] = "func=rect;x=230;y=200;width=50;height=200;bc=#CCCCCC;pw=0;" shape[16] = "func=rect;x=380;y=200;width=50;height=200;bc=#CCCCCC;pw=0;" shape[17] = "func=rect;x=230;y=350;width=200;height=50;bc=#CCCCCC;pw=0;" shape[18] = "func=rect;x=80;y=200;width=100;height=200;bc=brown;pw=0;" EndSub Sub Shapes_Init_Tree shX = 210 ' x offset shY = 170 ' y offset ss= "func=rect;x=44;y=247;width=84;height=24;bc=#661100;pw=0|func=tri;x=50;y=270;x1=8;y1=0;x2=0;y2=58;x3=17;y3=58;angle=180;bc=#661100;pw=0|func=tri;x=104;y=270;x1=8;y1=0;x2=0;y2=58;x3=17;y3=58;angle=180;bc=#661100;pw=0|func=rect;x=59;y=270;width=54;height=58;bc=#661111;pw=0|func=rect;x=44;y=270;width=84;height=5;bc=#66222222;pw=0|func=rect;x=74;y=200;width=22;height=48;bc=#3B1E0C;pw=0|func=tri;x=30;y=19;x1=54;y1=0;x2=0;y2=82;x3=109;y3=82;bc=#17330B;pw=0|func=tri;x=16;y=49;x1=69;y1=0;x2=0;y2=98;x3=138;y3=98;bc=#17330B;pw=0|func=tri;x=0;y=89;x1=84;y1=0;x2=0;y2=113;x3=168;y3=113;bc=#17330B;pw=0|func=tri;x=61;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=181;bc=#B5925E;pw=0|func=tri;x=60;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=252;bc=#B5925E;pw=0|func=tri;x=59;y=0;x1=24;y1=0;x2=0;y2=14;x3=49;y3=14;angle=331;bc=#B5925E;pw=0|func=rect;x=157;y=253;width=77;height=74;bc=#CC9999;pw=0|func=rect;x=170;y=287;width=26;height=28;angle=20;bc=#669966;pw=0|func=rect;x=171;y=263;width=17;height=18;angle=20;bc=#669966;pw=0|func=rect;x=204;y=284;width=21;height=22;angle=20;bc=#669966;pw=0|func=rect;x=187;y=236;width=16;height=91;bc=#990000;pw=0|func=tri;x=164;y=227;x1=13;y1=0;x2=0;y2=20;x3=27;y3=20;bc=Transparent;pc=#990000;pw=8|func=tri;x=200;y=227;x1=13;y1=0;x2=0;y2=20;x3=27;y3=20;bc=Transparent;pc=#990000;pw=8|func=line;x=166;y=245;x1=26;y1=0;x2=0;y2=21;pc=#990000;pw=8|func=line;x=197;y=245;x1=0;y1=0;x2=23;y2=23;pc=#990000;pw=8|func=rect;x=100;y=57;width=8;height=8;bc=#0029CC;pw=0|func=rect;x=91;y=68;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=78;y=75;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=67;y=82;width=10;height=9;bc=#0029CC;pw=0|func=rect;x=52;y=86;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=39;y=86;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=121;y=83;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=114;y=95;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=102;y=106;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=92;y=117;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=82;y=125;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=71;y=133;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=57;y=138;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=43;y=138;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=31;y=137;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=26;y=127;width=10;height=8;bc=#0029CC;pw=0|func=rect;x=134;y=126;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=125;y=135;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=115;y=145;width=8;height=10;bc=#0029CC;pw=0|func=rect;x=105;y=154;width=9;height=10;bc=#0029CC;pw=0|func=rect;x=93;y=163;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=80;y=170;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=66;y=174;width=10;height=9;bc=#0029CC;pw=0|func=rect;x=51;y=176;width=9;height=9;bc=#0029CC;pw=0|func=rect;x=37;y=175;width=8;height=9;bc=#0029CC;pw=0|func=rect;x=22;y=173;width=10;height=10;bc=#0029CC;pw=0|func=rect;x=100;y=57;width=8;height=8;bc=#000000;pw=0|func=rect;x=91;y=68;width=9;height=9;bc=#000000;pw=0|func=rect;x=78;y=75;width=10;height=8;bc=#000000;pw=0|func=rect;x=67;y=82;width=10;height=9;bc=#000000;pw=0|func=rect;x=52;y=86;width=10;height=10;bc=#000000;pw=0|func=rect;x=39;y=86;width=10;height=8;bc=#000000;pw=0|func=rect;x=121;y=83;width=10;height=10;bc=#000000;pw=0|func=rect;x=114;y=95;width=9;height=9;bc=#000000;pw=0|func=rect;x=102;y=106;width=8;height=9;bc=#000000;pw=0|func=rect;x=92;y=117;width=10;height=8;bc=#000000;pw=0|func=rect;x=82;y=125;width=8;height=10;bc=#000000;pw=0|func=rect;x=71;y=133;width=8;height=10;bc=#000000;pw=0|func=rect;x=57;y=138;width=10;height=10;bc=#000000;pw=0|func=rect;x=43;y=138;width=10;height=10;bc=#000000;pw=0|func=rect;x=31;y=137;width=8;height=9;bc=#000000;pw=0|func=rect;x=26;y=127;width=10;height=8;bc=#000000;pw=0|func=rect;x=134;y=126;width=8;height=10;bc=#000000;pw=0|func=rect;x=125;y=135;width=8;height=10;bc=#000000;pw=0|func=rect;x=115;y=145;width=8;height=10;bc=#000000;pw=0|func=rect;x=105;y=154;width=9;height=10;bc=#000000;pw=0|func=rect;x=93;y=163;width=10;height=10;bc=#000000;pw=0|func=rect;x=80;y=170;width=10;height=10;bc=#000000;pw=0|func=rect;x=66;y=174;width=10;height=9;bc=#000000;pw=0|func=rect;x=51;y=176;width=9;height=9;bc=#000000;pw=0|func=rect;x=37;y=175;width=8;height=9;bc=#000000;pw=0|func=rect;x=22;y=173;width=10;height=10;bc=#000000;pw=0|func=ell;x=79;y=185;width=23;height=24;bc=#969696;pw=0|func=ell;x=93;y=126;width=23;height=24;bc=#969696;pw=0|func=ell;x=41;y=149;width=23;height=24;bc=#969696;pw=0|func=ell;x=41;y=101;width=23;height=24;bc=#969696;pw=0|func=ell;x=138;y=138;width=23;height=24;bc=#969696;pw=0|func=ell;x=57;y=41;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=80;y=88;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=20;y=191;width=23;height=24;bc=#B5925E;pw=0|func=ell;x=124;y=176;width=23;height=24;bc=#B5925E;pw=0 shape = LDText.Split(ss "|") EndSub Sub Shapes_Init_Santa shX = 500 ' x offset shY = -40 ' y offset ss="func=ell;x=35;y=114;width=104;height=50;bc=#814A27;pw=0|func=rect;x=44;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=57;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=107;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=121;y=150;width=9;height=65;bc=#814A27;pw=0|func=rect;x=40;y=85;width=24;height=47;bc=#814A27;pw=0|func=ell;x=131;y=116;width=18;height=20;bc=#814A27;pw=0|func=rect;x=51;y=43;width=7;height=30;bc=#A7842A;pw=0|func=rect;x=61;y=50;width=7;height=30;bc=#A7842A;pw=0|func=rect;x=41;y=26;width=7;height=30;angle=297;bc=#A7842A;pw=0|func=rect;x=71;y=30;width=7;height=30;angle=55;bc=#A7842A;pw=0|func=rect;x=29;y=6;width=7;height=30;angle=352;bc=#A7842A;pw=0|func=rect;x=83;y=10;width=7;height=30;angle=7;bc=#A7842A;pw=0|func=rect;x=38;y=116;width=27;height=7;angle=349;bc=#000000;pw=0|func=ell;x=28;y=117;width=16;height=16;bc=#C3AB6F;pw=0|func=rect;x=165;y=205;width=241;height=9;bc=#8C8C8C;pw=0|func=rect;x=185;y=185;width=9;height=23;bc=#8C8C8C;pw=0|func=rect;x=377;y=185;width=9;height=23;bc=#8C8C8C;pw=0|func=rect;x=156;y=191;width=9;height=23;angle=317;bc=#8C8C8C;pw=0|func=rect;x=69;y=114;width=9;height=52;angle=355;bc=#000000;pw=0|func=rect;x=73;y=143;width=111;height=9;bc=#000000;pw=0|func=ell;x=299;y=75;width=92;height=88;bc=#EBE4D0;pw=0|func=ell;x=239;y=87;width=84;height=88;bc=#9D1010;pw=0|func=ell;x=258;y=51;width=49;height=57;bc=#EBE4D0;pw=0|func=rect;x=266;y=66;width=33;height=21;bc=#DBB9A9;pw=0|func=ell;x=275;y=79;width=13;height=13;bc=#9D1010;pw=0|func=rect;x=271;y=47;width=32;height=14;angle=13;bc=#9D1010;pw=0|func=rect;x=274;y=43;width=36;height=13;bc=#9D1010;pw=0|func=ell;x=306;y=37;width=18;height=20;bc=#EBE4D0;pw=0|func=rect;x=264;y=89;width=10;height=45;angle=333;bc=#E2D8BB;pw=0|func=rect;x=283;y=89;width=10;height=63;angle=33;bc=#EBE4D0;pw=0|func=rect;x=184;y=143;width=202;height=43;bc=#563A1A;pw=0|func=ell;x=210;y=65;width=24;height=24;bc=#EBE4D0;pw=0|func=rect;x=215;y=83;width=26;height=34;angle=347;bc=#9D1010;pw=0|func=rect;x=225;y=90;width=26;height=34;angle=272;bc=#9D1010;pw=0|func=ell;x=16;y=71;width=56;height=30;bc=#814A27;pw=0|func=ell;x=41;y=75;width=12;height=12;bc=#000000;pw=0|func=ell;x=7;y=79;width=14;height=14;bc=#9D1010;pw=0|func=ell;x=64;y=72;width=24;height=12;angle=340;bc=#814A27;pw=0|func=rect;x=259;y=71;width=17;height=4;angle=350;bc=#EBE4D0;pw=|func=rect;x=288;y=71;width=17;height=4;angle=18;bc=#EBE4D0;pw=|func=rect;x=98;y=19;width=7;height=30;angle=81;bc=#A7842A;pw=0|func=rect;x=17;y=16;width=7;height=30;angle=287;bc=#A7842A;pw=0|func=rect;x=115;y=5;width=7;height=30;angle=16;bc=#A7842A;pw=0|func=rect;x=0;y=0;width=7;height=30;angle=338;bc=#A7842A;pw=0|func=ell;x=289;y=81;width=21;height=22;bc=#EBE4D0;pw=0|func=ell;x=255;y=83;width=21;height=22;bc=#EBE4D0;pw=0|func=ell;x=265;y=71;width=14;height=14;bc=#FFFFFF;pc=#000000;pw=2|func=ell;x=285;y=71;width=14;height=14;bc=#FFFFFF;pc=#000000;pw=2|func=line;x=277;y=77;x1=0;y1=0;x2=10;y2=0;pc=#000000;pw=2 shape = LDText.Split(ss "|") EndSub End>RRR611.sb< Start>RRR959-0.sb< ' Poker 0.6b ' Copyright © 2012-2015 Nonki Takahashi. The MIT License. ' ' History ' 0.6b 2015-05-26 Bug fixed. (RRR959-0) ' 0.51b 2015-05-03 Removed trial count. (RRR959) ' 0.5b 2015-05-03 Modified as Poker for Challenge of the Month. ' 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 = "Poker 0.6b" Not = "False=True;True=False;" sim = "True" Cards_Init() GraphicsWindow.FontSize = 12 * scale GraphicsWindow.BrushColor = "White" txtWinner = Shapes.AddText("Winner") Shapes.Move(txtWinner, 80 * scale, y0 + 30 * scale) txtWinner = Shapes.AddText("") Shapes.Move(txtWinner, 140 * scale, y0 + 30 * scale) GraphicsWindow.BrushColor = "Black" buttonTry = Controls.AddButton("Deal", 80 * scale, y0) GraphicsWindow.BrushColor = "White" txtPlayer[CPU] = Shapes.AddText("CPU") col = 6 row = 2 x = x0 + (col - 1) * (width + 10) y = y0 + (row - 1) * (height + 30) Shapes.Move(txtPlayer[CPU], x, y) txtHand[CPU] = Shapes.AddText("") Shapes.Move(txtHand[CPU], x, y + 12 * scale) txtPlayer[PLAYER] = Shapes.AddText("PLAYER") row = 3 y = y0 + (row - 1) * (height + 30) Shapes.Move(txtPlayer[PLAYER], x, y) txtHand[PLAYER] = Shapes.AddText("") Shapes.Move(txtHand[PLAYER], x, y + 12 * scale) clicked = "False" Controls.ButtonClicked = OnButtonClicked While "True" If clicked Then clicked = "False" RecombineCards() col = 1 row = 2 ShuffleCards() DrawCards() turn = CPU CheckPokerHand() nums[CPU] = kindNum turn = PLAYER CheckPokerHand() nums[PLAYER] = kindNum For i = CPU To PLAYER Shapes.SetText(txtHand[i], pokerHand[i]) EndFor CheckWinner() Shapes.SetText(txtWinner, winner) EndIf EndWhile Sub OnButtonClicked clicked = "True" EndSub Sub DrawCards ' draw 5 cards from deck ' param col, row - target position to draw ' param turn - 1 for AI, 2 for PLAYER For i = 1 To 10 index = deck[i] field[i] = index Cards_Move() col = col + 1 If 5 < col Then col = 1 row = row + 1 EndIf EndFor EndSub Sub CheckWinner ' param nums - array for kind of numbers If pokerHands[pokerHand[CPU]] < pokerHands[pokerHand[PLAYER]] Then winner = "PLAYER" ElseIf pokerHands[pokerHand[PLAYER]] < pokerHands[pokerHand[CPU]] Then winner = "CPU" Else ' pokerHand[PLAYER] = pokerHand[CPU] winner = "DRAW" cpuNums = nums[CPU] playerNums = nums[PLAYER] If pokerHand[CPU] = "Four of a Kind" Then nOfKind = 4 CheckN() ElseIf pokerHand[CPU] = "Full House" Or pokerHand[CPU] = "Three of a Kind" Then nOfKind = 3 CheckN() ElseIf pokerHand[CPU] = "Two Pair" Then CheckTwoPair() ElseIf pokerHand[CPU] = "One Pair" Then nOfKind = 2 CheckN() EndIf If winner = "DRAW" Then ' need to check other numbers For n = 14 To 1 Step -1 If cpuNums[n] <> "" And playerNums[n] = "" Then winner = "CPU" n = 1 ' break ElseIf cpuNums[n] = "" And playerNums[n] <> "" Then winner = "PLAYER" n = 1 ' break EndIf EndFor EndIf EndIf EndSub Sub CheckN ' param nOfKind - 4, 3 or 2 (one pair) For n = 1 To 14 If cpuNums[n] = nOfKind Then cpuN = n EndIf If playerNums[n] = nOfKind Then playerN = n EndIf EndFor If cpuN = playerN Then cpuNums[cpuN] = "" playerNums[playerN] = "" ElseIf cpuN < playerN Then winner = "PLAYER" ElseIf playerN < cpuN Then winner = "CPU" EndIf EndSub Sub CheckTwoPair cpuMin = 14 cpuMax = 1 playerMin = 14 playerMax = 1 For n = 1 To 14 If cpuNums[n] = 2 Then If n < cpuMin Then cpuMin = n EndIf If cpuMax < n Then cpuMax = n EndIf EndIf If playerNums[n] = 2 Then If n < playerMin Then playerMin = n EndIf If playerMax < n Then playerMax = n EndIf EndIf EndFor If cpuMax = playerMax Then cpuNums[cpuMax] = "" playerNums[playerMax] = "" If cpuMin = playerMin Then cpuNums[cpuMin] = "" playerNums[playerMin] = "" ElseIf cpuMin < playerMin Then winner = "PLAYER" ElseIf playerMin < cpuMin Then winner = "CPU" EndIf ElseIf cpuMax < playerMax Then winner = "PLAYER" ElseIf playerMax < cpuMax Then winner = "CPU" EndIf EndSub Sub CheckPokerHand ' param turn - 1 for CPU, 2 for PLAYER ' return pokerHand[turn] - poker hand ' return kindNum - array of kind of numbers pokerHand[turn] = "" kindNum = "" kindSuite = "" keepA = "False" For i = 1 + (turn - 1) * 5 To 5 + (turn - 1) * 5 num = Math.Remainder(field[i] - 1, 13) + 1 kindNum[num] = kindNum[num] + 1 suite = Math.Floor((field[i] - 1) / 13) + 1 kindSuite[suite] = kindSuite[suite] + 1 EndFor nKind = Array.GetItemCount(kindNum) iKind = Array.GetAllIndices(kindNum) If nKind = 2 Then If kindNum[iKind[1]] = 1 Or kindNum[iKind[1]] = 4 Then pokerHand[turn] = "Four of a Kind" ElseIf kindNum[iKind[1]] = 2 Or kindNum[iKind[1]] = 3 Then pokerHand[turn] = "Full House" EndIf ElseIf nKind = 3 Then If kindNum[iKind[1]] = 3 Or kindNum[iKind[2]] = 3 Or kindNum[iKind[3]] = 3 Then pokerHand[turn] = "Three of a Kind" ElseIf kindNum[iKind[1]] = 1 Or kindNum[iKind[2]] = 1 Or kindNum[iKind[3]] = 1 Then pokerHand[turn] = "Two Pair" EndIf ElseIf nKind = 4 Then pokerHand[turn] = "One Pair" Else min = 13 max = 2 For i = 2 To 13 If kindNum[i] <> "" Then If i < min Then min = i EndIf If max < i Then max = i EndIf EndIf EndFor If (kindNum[1] = "") And (max - min = 4) Then pokerHand[turn] = "Straight" ElseIf (kindNum[1] <> "") And (min = 2) And (max = 5) Then pokerHand[turn] = "Straight" keepA = "True" ElseIf (kindNum[1] <> "") And (min = 10) And (max = 13) Then pokerHand[turn] = "Straight" EndIf EndIf If Not[keepA] Then kindNum[14] = kindNum[1] kindNum[1] = "" EndIf nKind = Array.GetItemCount(kindSuite) If nKind = 1 Then If pokerHand[turn] = "Straight" Then pokerHand[turn] = "Straight Flush" Else pokerHand[turn] = "Flush" EndIf EndIf EndSub Sub RecombineCards col = 1 row = 1 For i = 1 To 10 index = field[i] Cards_Move() EndFor EndSub Sub ShuffleCards ' Shuffle cards For i = 1 To 10 i1 = i i2 = Math.GetRandomNumber(nSuites * nNumbers) Cards_Swap() EndFor EndSub Sub Cards_Init ' return cards - array for cards properties ' return nSuites - number of suites ' return nNumbers - number of numbers CPU = 1 PLAYER = 2 pokerHands = "Straight Flush=8;Four of a Kind=7;Full House=6;Flush=5;Straight=4;Three of a Kind=3;Two Pair=2;One Pair=1;" scale = 1.4 width = 50 * scale height = 70 * scale cards["width"] = width cards["height"] = height cards["xs"] = 4 * scale ' offset for suite in a card cards["ys"] = 30 * scale cards["xn"] = 4 * scale ' offset for number in a card cards["yn"] = 5 * scale cards["xp"] = 6 * scale ' 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 = 598 ' (width + 10) * nNumbers + 10 GraphicsWindow.Height = 428 ' (height + 10) * (nSuites + 1) + 10 col = 1 row = 1 x0 = 20 * scale y0 = 20 * scale hex = pattern["code"] Math_Hex2Dec() pChar = Text.GetCharacter(dec) For s = 1 To nSuites suite = suites[iSuites[s]] hex = suite["code"] Math_Hex2Dec() sChar = Text.GetCharacter(dec) For n = 1 To nNumbers index = index + 1 deck[index] = index GraphicsWindow.BrushColor = "White" card = cards[index] card["oCard"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = suite["color"] GraphicsWindow.FontSize = 28 * scale card["oSuite"] = Shapes.AddText(sChar) card["oNumber"] = Shapes.AddText(numbers[n]) If Not[sim] Then GraphicsWindow.BrushColor = "White" card["oCard2"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = pattern["color"] GraphicsWindow.FontSize = 60 * scale card["oPattern"] = Shapes.AddText(pChar) EndIf cards[index] = card Cards_Move() EndFor EndFor If sim Then card = cards[index] GraphicsWindow.BrushColor = "White" card["oCard2"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = pattern["color"] GraphicsWindow.FontSize = 60 * scale card["oPattern"] = Shapes.AddText(pChar) Shapes.Move(card["oCard2"], x0, y0) Shapes.Move(card["oPattern"], x0 + cards["xp"], y0 + cards["yp"]) cards[index] = card EndIf EndSub Sub Cards_Close ' param index card = cards[index] Shapes.ShowShape(card["oCard2"]) Shapes.ShowShape(card["oPattern"]) EndSub Sub Cards_Open ' param index card = cards[index] Shapes.HideShape(card["oPattern"]) Shapes.HideShape(card["oCard2"]) EndSub Sub Cards_Move ' param index - index of a card ' param col, row - position to move card = cards[index] card["col"] = col card["row"] = row x = x0 + (col - 1) * (width + 10) y = y0 + (row - 1) * (height + 30) Shapes.Move(card["oCard"], x, y) Shapes.Move(card["oSuite"], x + cards["xs"], y + cards["ys"]) Shapes.Move(card["oNumber"], x + cards["xn"], y + cards["yn"]) If Not[sim] Then Shapes.Move(card["oCard2"], x, y) Shapes.Move(card["oPattern"], x + cards["xp"], y + cards["yp"]) EndIf cards[index] = card EndSub Sub Cards_Swap ' param i1, i2 - indices of two cards index = deck[i1] deck[i1] = deck[i2] deck[i2] = index EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param hex ' return dec 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>RRR959-0.sb< Start>RRR959.sb< ' Poker 0.51b ' Copyright © 2012-2015 Nonki Takahashi. The MIT License. ' ' History ' 0.51b 2015-05-03 Removed trial count. ' 0.5b 2015-05-03 Modified for Challenge of the Month. ' 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 = "Poker 0.51b" Not = "False=True;True=False;" sim = "True" Cards_Init() GraphicsWindow.FontSize = 12 * scale GraphicsWindow.BrushColor = "White" txtWinner = Shapes.AddText("Winner") Shapes.Move(txtWinner, 80 * scale, y0 + 30 * scale) txtWinner = Shapes.AddText("") Shapes.Move(txtWinner, 140 * scale, y0 + 30 * scale) GraphicsWindow.BrushColor = "Black" buttonTry = Controls.AddButton("Deal", 80 * scale, y0) GraphicsWindow.BrushColor = "White" txtPlayer[CPU] = Shapes.AddText("CPU") col = 6 row = 2 x = x0 + (col - 1) * (width + 10) y = y0 + (row - 1) * (height + 30) Shapes.Move(txtPlayer[CPU], x, y) txtHand[CPU] = Shapes.AddText("") Shapes.Move(txtHand[CPU], x, y + 12 * scale) txtPlayer[PLAYER] = Shapes.AddText("PLAYER") row = 3 y = y0 + (row - 1) * (height + 30) Shapes.Move(txtPlayer[PLAYER], x, y) txtHand[PLAYER] = Shapes.AddText("") Shapes.Move(txtHand[PLAYER], x, y + 12 * scale) clicked = "False" Controls.ButtonClicked = OnButtonClicked While "True" If clicked Then clicked = "False" RecombineCards() col = 1 row = 2 ShuffleCards() DrawCards() turn = CPU CheckPokerHand() nums[CPU] = kindNum turn = PLAYER CheckPokerHand() nums[PLAYER] = kindNum For i = CPU To PLAYER Shapes.SetText(txtHand[i], pokerHand[i]) EndFor CheckWinner() Shapes.SetText(txtWinner, winner) Program.Delay(1000) EndIf EndWhile Sub OnButtonClicked clicked = "True" EndSub Sub DrawCards ' draw 5 cards from deck ' param col, row - target position to draw ' param turn - 1 for AI, 2 for PLAYER For i = 1 To 10 index = deck[i] field[i] = index Cards_Move() col = col + 1 If 5 < col Then col = 1 row = row + 1 EndIf EndFor EndSub Sub CheckWinner ' param nums - array for kind of numbers If pokerHands[pokerHand[CPU]] < pokerHands[pokerHand[PLAYER]] Then winner = "PLAYER" ElseIf pokerHands[pokerHand[PLAYER]] < pokerHands[pokerHand[CPU]] Then winner = "CPU" Else cpuNums = nums[CPU] playerNums = nums[PLAYER] winner = "DRAW" If cpuNums[1] <> "" And playerNums[1] = "" Then winner = "CPU" ElseIf cpuNums[1] = "" And playerNums[1] <> "" Then winner = "PLAYER" Else For n = 13 To 2 Step -1 If cpuNums[n] <> "" And playerNums[n] = "" Then winner = "CPU" n = 2 ' break ElseIf cpuNums[n] = "" And playerNums[n] <> "" Then winner = "PLAYER" n = 2 ' break EndIf EndFor EndIf EndIf EndSub Sub CheckPokerHand ' param turn - 1 for CPU, 2 for PLAYER ' return pokerHand pokerHand[turn] = "" kindNum = "" kindSuite = "" For i = 1 + (turn - 1) * 5 To 5 + (turn - 1) * 5 num = Math.Remainder(field[i] - 1, 13) + 1 kindNum[num] = kindNum[num] + 1 suite = Math.Floor((field[i] - 1) / 13) + 1 kindSuite[suite] = kindSuite[suite] + 1 EndFor nKind = Array.GetItemCount(kindNum) iKind = Array.GetAllIndices(kindNum) If nKind = 2 Then If kindNum[iKind[1]] = 1 Or kindNum[iKind[1]] = 4 Then pokerHand[turn] = "Four of a Kind" ElseIf kindNum[iKind[1]] = 2 Or kindNum[iKind[1]] = 3 Then pokerHand[turn] = "Full House" EndIf ElseIf nKind = 3 Then If kindNum[iKind[1]] = 3 Or kindNum[iKind[2]] = 3 Or kindNum[iKind[3]] = 3 Then pokerHand[turn] = "Three of a Kind" ElseIf kindNum[iKind[1]] = 1 Or kindNum[iKind[2]] = 1 Or kindNum[iKind[3]] = 1 Then pokerHand[turn] = "Two Pair" EndIf ElseIf nKind = 4 Then pokerHand[turn] = "One Pair" Else min = 13 max = 1 For i = 1 To 13 If kindNum[i] <> "" Then If i < min Then min = i EndIf If max < i Then max = i EndIf EndIf EndFor If max - min = 4 Then pokerHand[turn] = "Straight" EndIf EndIf nKind = Array.GetItemCount(kindSuite) If nKind = 1 Then If pokerHand[turn] = "Straight" Then pokerHand[turn] = "Straight Flush" Else pokerHand[turn] = "Flush" EndIf EndIf EndSub Sub RecombineCards col = 1 row = 1 For i = 1 To 10 index = field[i] Cards_Move() EndFor EndSub Sub ShuffleCards ' Shuffle cards For i = 1 To 10 i1 = i i2 = Math.GetRandomNumber(nSuites * nNumbers) Cards_Swap() EndFor EndSub Sub Cards_Init ' return cards - array for cards properties ' return nSuites - number of suites ' return nNumbers - number of numbers CPU = 1 PLAYER = 2 pokerHands = "Straight Flush=8;Four of a Kind=7;Full House=6;Flush=5;Straight=4;Three of a Kind=3;Two Pair=2;One Pair=1;" scale = 1.4 width = 50 * scale height = 70 * scale cards["width"] = width cards["height"] = height cards["xs"] = 4 * scale ' offset for suite in a card cards["ys"] = 30 * scale cards["xn"] = 4 * scale ' offset for number in a card cards["yn"] = 5 * scale cards["xp"] = 6 * scale ' 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 = 598 ' (width + 10) * nNumbers + 10 GraphicsWindow.Height = 428 ' (height + 10) * (nSuites + 1) + 10 col = 1 row = 1 x0 = 20 * scale y0 = 20 * scale hex = pattern["code"] Math_Hex2Dec() pChar = Text.GetCharacter(dec) For s = 1 To nSuites suite = suites[iSuites[s]] hex = suite["code"] Math_Hex2Dec() sChar = Text.GetCharacter(dec) For n = 1 To nNumbers index = index + 1 deck[index] = index GraphicsWindow.BrushColor = "White" card = cards[index] card["oCard"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = suite["color"] GraphicsWindow.FontSize = 28 * scale card["oSuite"] = Shapes.AddText(sChar) card["oNumber"] = Shapes.AddText(numbers[n]) If Not[sim] Then GraphicsWindow.BrushColor = "White" card["oCard2"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = pattern["color"] GraphicsWindow.FontSize = 60 * scale card["oPattern"] = Shapes.AddText(pChar) EndIf cards[index] = card Cards_Move() EndFor EndFor If sim Then card = cards[index] GraphicsWindow.BrushColor = "White" card["oCard2"] = Shapes.AddRectangle(width, height) GraphicsWindow.BrushColor = pattern["color"] GraphicsWindow.FontSize = 60 * scale card["oPattern"] = Shapes.AddText(pChar) Shapes.Move(card["oCard2"], x0, y0) Shapes.Move(card["oPattern"], x0 + cards["xp"], y0 + cards["yp"]) cards[index] = card EndIf EndSub Sub Cards_Close ' param index card = cards[index] Shapes.ShowShape(card["oCard2"]) Shapes.ShowShape(card["oPattern"]) EndSub Sub Cards_Open ' param index card = cards[index] Shapes.HideShape(card["oPattern"]) Shapes.HideShape(card["oCard2"]) EndSub Sub Cards_Move ' param index - index of a card ' param col, row - position to move card = cards[index] card["col"] = col card["row"] = row x = x0 + (col - 1) * (width + 10) y = y0 + (row - 1) * (height + 30) Shapes.Move(card["oCard"], x, y) Shapes.Move(card["oSuite"], x + cards["xs"], y + cards["ys"]) Shapes.Move(card["oNumber"], x + cards["xn"], y + cards["yn"]) If Not[sim] Then Shapes.Move(card["oCard2"], x, y) Shapes.Move(card["oPattern"], x + cards["xp"], y + cards["yp"]) EndIf cards[index] = card EndSub Sub Cards_Swap ' param i1, i2 - indices of two cards index = deck[i1] deck[i1] = deck[i2] deck[i2] = index EndSub Sub Math_Hex2Dec ' Math | Convert hexadecimal to decimal ' param hex ' return dec 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>RRR959.sb< Start>RRS083.sb< GraphicsWindow.PenWidth=0 'This prevents the following objects to habe black lines around them. Makes them "prettier" :P GraphicsWindow.BrushColor="Purple" 'Sets the color for all the "Swarm" objects. For i = 1 to 20 'Add 20 "Swarm" objects Swarm[i]=shapes.AddEllipse(10,10) 'This adds 20 "Swarm" objects. Wich are circles of 10x10 pixels here. This can be changed to every object you want. SX[i]=Math.GetRandomNumber(150)+225 'This here sets the X Position of every "Swarm" object to a random value SY[i]=Math.GetRandomNumber(150)+225 'This here sets the Y Position of every "Swarm" object to a random value endfor While "true" 'Main Loop For i = 1 To 20 'Do the following for all 20 "Swarm" objects: If SY[i] GraphicsWindow.MouseY and SWY[i] > -15 THen 'Accelerates the "Swarm" object up, if it is lower than the Cursor. SWY[i]=SWY[i]-0.5 'Decreases the Y Speed by -0.5. endif If SX[i] < GraphicsWindow.MouseX and SWX[i] < 15 THen 'Accelerates the "Swarm" object to the right side, if it is on the left side of the Cursor. SWX[i]=SWX[i]+0.5 'Increases the X Speed by 0.5. elseIf SX[i] > GraphicsWindow.MouseX and SWX[i] > -15 THen 'Accelerates the "Swarm" object to the left side, if it is on the right side of the Cursor. SWX[i]=SWX[i]-0.5 'Decreases the X Speed by -0.5. endif SX[i]=SX[i]+SWX[i] ' "Combines" the X position of the "Swarm" object with its X speed. This isnt necessary, shapes.move(Swarm[i],SX[i]+SWX[i],SY[i]+SWY[i]), can also be used instead. But this method gives it better overview and makes it easyer to call an objects position. SY[i]=SY[i]+SWY[i] ' "Combines" the Y position of the "Swarm" object with its Y speed Shapes.Move(Swarm[i],SX[i]+5,SY[i]+5) ' Moves the "Swarm" object to its new assigned position. The +5 is there to make the object move around its center. And its +5 Because the radius of the object is 5 pixels. endfor Program.Delay(10)' Added a delay of 10 Milliseconds to limit the programs speed. Try to remove it, and see what happens ;D endwhile 'End of main loop End>RRS083.sb< Start>RRS442.sb< GraphicsWindow.TextInput = TextInputSub GraphicsWindow.Title = "Charactor Code Finder v1.0 by Jay Turner" begin: GraphicsWindow.DrawText(0, 0, "Charactor Code Finder v1.0 by Jay Turner. With Help by Rushworks.") GraphicsWindow.DrawText(0, 15, "Type a charactor and I will return its code: ") GraphicsWindow.DrawText(0, 30, code) Program.Delay(400) GraphicsWindow.Clear() Goto begin 'Thanks to Rushworks for this bit of code which enabled live imput and live answers Sub TextInputSub code = GraphicsWindow.LastText code = code + " = " + Text.GetCharacterCode(code) EndSub End>RRS442.sb< Start>RRT018.sb< 'Mr. Computer 'Group Project of Intro to Programming 'Fall 2012 'importCode: srf986-21 TextWindow.WriteLine("Let's talk about something... (m = menu)") TextWindow.WriteLine("") TextWindow.WriteLine("Press to continue") top: key = Text.ConvertToLowerCase(TextWindow.Read()) If (key = "m") then TextWindow.Clear() TextWindow.WriteLine("Menu-----") TextWindow.WriteLine("1) Authors: Chien-Hsun Chen (Bruce), Qian Cao (Jessie), Lie Song, Brando Caruso") TextWindow.WriteLine("2) Authors: Reagan Shi, Mingxin Lu (Simon), Yu Tian (Tim), Xueyao Wang (Wendy)") TextWindow.WriteLine("3) Authors: Delaney Crumblish, Rachael Metallo, Vaughn McCall") TextWindow.WriteLine("4) Authors: Dominic Marshall, Luiggi Reno, Alex Contron") TextWindow.WriteLine("5) Authors: Charolotte Ng, Shaodong Mao, Xiocun Zhong (Nathaniel)") TextWindow.WriteLine("6) Authors: Diane Margo, Jason Wang, Keagen Ferrell-Clegg") TextWindow.WriteLine("7) Authors: Trinity Mims, Guanming Xu (George), Gileysa Penzo") TextWindow.WriteLine("8) Authors: Harry Vaughn, John Hancock, Jiawen Liu (Gavin)") TextWindow.WriteLine("9) Authors: Tyler DeWitt, Keri Milsap, Sung Yueh Chang (Dereck)") TextWindow.WriteLine("") TextWindow.Write("Enter your choice: ") teamChoice = TextWindow.ReadNumber() else teamChoice = Math.GetRandomNumber(9) endif TextWindow.Title = "Mr. Computer" TextWindow.ForegroundColor = "gray" TextWindow.BackgroundColor = "black" TextWindow.Clear() If teamChoice = 1 then Team1() elseif teamChoice = 2 then Team2() elseif teamChoice = 3 then team3() elseif teamChoice = 4 then team4() elseif teamChoice = 5 then team5() elseif teamChoice = 6 then team6() elseif teamChoice = 7 then team7() elseif teamChoice = 8 then team8() else Team9() endif TextWindow.WriteLine("") TextWindow.WriteLine("Thanks to the " + authors) TextWindow.WriteLine("Stats: " + authorStats) TextWindow.WriteLine("That was fun!") TextWindow.WriteLine("") TextWindow.WriteLine("Let's change topics. (m = menu)") TextWindow.WriteLine("") TextWindow.WriteLine("Press to continue") Goto top Sub team1 authors ="Chien-Hsun Chen (Bruce), Qian Cao (Jessie), Lie Song, Brando Caruso" authorStats = "12 Questions, 45 Responses, 0 nested questions" 'Question 3 ------------------------------------------------------------------------ TextWindow.Write("Where are you from? ") Country = TextWindow.Read() If Country="US"Or Country="America" Then TextWindow.WriteLine("It's nice to be an American") ElseIf Country="Italy" Then TextWindow.WriteLine("Great pizza and spaghetti") Elseif Country="China" Then TextWindow.WriteLine("So many people in China. It's good") Else TextWindow.WriteLine("I should visit your country someday") EndIf TextWindow.Writeline("") 'Question 4 ------------------------------------------------------------------------ TextWindow.Write("What grade are you? ") Grade = TextWindow.Read() If Grade="Senior" Then TextWindow.WriteLine("Congratulation! Graduation in 25 days") ElseIf Grade="Junior" Then TextWindow.WriteLine("Study for your SAT and Toefl!") Elseif Grade="Sophomore" Then TextWindow.WriteLine("Best wishes to you") Else TextWindow.WriteLine("Get higher on your GPA") EndIf TextWindow.Writeline("") 'Question 5 ------------------------------------------------------------------------ TextWindow.Write("What is your favorite food?") Food = TextWindow.Read() If Food="Rice" Then TextWindow.WriteLine("Nice choice") ElseIf Food="French Fries" Then TextWindow.WriteLine("I guess you are fat!") Elseif Food="Pizza" Then TextWindow.WriteLine("I guess you like French Fries,too") ElseIf Food="Hotpot" Then TextWindow.WriteLine("You must be Chinese") Else TextWindow.WriteLine("It's not bad.") EndIf TextWindow.Writeline("") 'Question 6 ------------------------------------------------------------------------ TextWindow.Write("What is your favorite sport?") Sport = TextWindow.Read() If Sport="basketball" Then TextWindow.WriteLine("Every boy likes to play basketball!") ElseIf Sport="Track" or Sport="Run" Then TextWindow.WriteLine("You must run really fast!") ElseIF Sport="Swim" Then TextWindow.WriteLine("You must have a nice body") Elseif Sport="Ping Pong" Then TextWindow.WriteLine("You need to have a fast reaction") Else TextWindow.WriteLine("Good for you. You should go to do other sports,too") EndIf TextWindow.Writeline("") 'Question 7 ------------------------------------------------------------------------ TextWindow.Write("Do you have a pet?") ans = TextWindow.Read() If ans="Yes" Then TextWindow.WriteLine("You are friendly. You have a light heart") ElseIf ans="no" Then TextWindow.WriteLine("You should get a pet.") Else TextWindow.WriteLine("Being silent is great") EndIf TextWindow.Writeline("") 'Question 8------------------------------------------------------------------------ TextWindow.Write("Do you like programming") ans = TextWindow.Read() If ans="Yes" Then TextWindow.WriteLine("Interesting. Mr.Parets will give you a higher grade") ElseIf ans="No" Then TextWindow.WriteLine("You should like it.") Else TextWindow.WriteLine("Alright") EndIf TextWindow.Writeline("") 'Question 9------------------------------------------------------------------------ TextWindow.Write("What is your favorite brand? ") brand = TextWindow.Read() If brand="LV"Or brand="Louis Vuitton" Then TextWindow.WriteLine("You must be rich!") ElseIf brand="Gucci" Then TextWindow.WriteLine("You must be rich!") Elseif brand="Channel" THen TextWindow.WriteLine("You have good taste.") Elseif brand="versace" Then TextWindow.WriteLine("You must be a rich guy") Else TextWindow.WriteLine("We have the same taste.") EndIf TextWindow.Writeline("") 'Question 10------------------------------------------------------------------------ TextWindow.Write("Do you like MVA uniform?") ans = TextWindow.Read() If ans="y" Or ans="yes" Then TextWindow.WriteLine("I agree with you,") Else TextWindow.WriteLine("It's better than its in China") EndIf TextWindow.Writeline("") 'Question 11------------------------------------------------------------------------ TextWindow.Write("How tall are you?(ft)") ans =TextWindow.ReadNumber() If ans>=0 And ans<=5 Then TextWindow.WriteLine(" You must be short") ElseIf ans>5 and ans<5.8 Then TextWindow.WriteLine("You are a normal guy") Else TextWindow.WriteLine("You are a giant!!") EndIf TextWindow.Writeline("") 'Question 12------------------------------------------------------------------------ TextWindow.Write("Do you prefer first lunch or second lunch?") ans = TextWindow.Read() If ans = "first lunch" Then TextWindow.WriteLine("You still have two lessons to go") ElseIf ans="Second lunch" Then TextWindow.WriteLine("Bad for you! You are gonna to starve") EndIf TextWindow.Writeline("") 'Question 13------------------------------------------------------------------------ TextWindow.Write("When are you planning to get married?") ans= TextWindow.ReadNumber() If ans>0 And ans<=20 Then TextWindow.WriteLine("It's too early for you to get married") ElseIf ans>20 and ans<=40 Then TextWindow.WriteLine("It's just abount the right time to get married!") Else TextWindow.WriteLine("It's too late to get married.Bad for you!") EndIf TextWindow.Writeline("") 'Question 14------------------------------------------------------------------------ TextWindow.Write("What is your favorite subject") subject = TextWindow.Read() If subject="history" Then TextWindow.WriteLine("It's boring. I hate it!") ElseIf subject="Math" Then TextWindow.WriteLine("You must have a good logic") ElseIf subject="English" Then TextWindow.WriteLine("The reading is so interesting") Else TextWindow.WriteLine("I love it,t00") EndIf TextWindow.Writeline("") 'Question 10------------------------------------------------------------------------ EndSub Sub team2 authors ="Reagan Shi, Mingxin Lu (Simon), Yu Tian (Tim), Xueyao Wang (Wendy)" authorStats = "11 Questions, 24 Responses, 0 nested questions" TextWindow.Write("do you drink water? ") Wat = TextWindow.Read() If Wat = "yes" Then TextWindow.WriteLine("Oh, that's good.") Else TextWindow.WriteLine("I don't care.") EndIf TextWindow .Write("do you like girl or boy? ") bg= TextWindow.Read() If bg="girl" Then TextWindow.WriteLine("me too.") Else TextWindow.WriteLine("shame on you.") EndIf TextWindow .Write("do you like pink?") bg= TextWindow.Read() If bg="yes" Then TextWindow.WriteLine("me, too.") Else TextWindow.WriteLine("I don't.") EndIf TextWindow.Write("how many computer games have you ever played?? ") ga = TextWindow.Read() If ga>0 And ga<10 Then TextWindow.WriteLine("Good for you.") ElseIf ga>=10 and ga<=50 then TextWindow.WriteLine("Shame on you.") Else TextWindow.WriteLine("one side go away.") EndIf TextWindow.Write("do you like to eat fish? ") Wat = TextWindow.Read() If Wat = "yes" Then TextWindow.WriteLine("Oh, it's health for you!!") Else TextWindow.WriteLine("no!!!but i like it thou :) ") EndIf TextWindow.Write("do you like read book?") book = TextWindow.Read() If book = "yes" Then TextWindow.WriteLine("me, too.") Else TextWindow.WriteLine("I like write.") EndIf TextWindow.Write("do you like play computer games?") games = TextWindow.Read() If games = "yes" Then TextWindow.WriteLine("I like play computer games.") Else TextWindow.WriteLine("I like play cards") EndIf TextWindow.Write("How many language cann you speak???") num = TextWindow.ReadNumber() If num<=2 Then TextWindow.WriteLine("Not bad") ElseIf num>=2 then TextWindow.WriteLine("Wow, That's crazy!!") Else TextWindow.WriteLine("You are amazing!!") EndIf TextWindow.Write("do you like to study?? ") Wat = TextWindow.Read() If Wat = "yes" Then TextWindow.WriteLine("well, i dont!!") Else TextWindow.WriteLine("I like the way you are! ") EndIf TextWindow .Write ("Do you think Tim is a fun ?") fun = TextWindow .Read() If fun = "yes" Then TextWindow .WriteLine ("Yes ,I think so too.") Else TextWindow .WriteLine ("He is a fun.") EndIf TextWindow .Write("Is Regan skin dirty?") paul = TextWindow .Read() If paul = "yes" Then TextWindow .WriteLine("He has to wash it off.") Else TextWindow .WriteLine("He died.") EndIf EndSub Sub team3 authors ="Delaney Crumblish, Rachael Metallo, Vaughn McCall" authorStats = "12 Questions, 41 Responses, 0 nested questions" '-------------------------------------------------------------------------------------- 'Question 3 TextWindow.WriteLine("") TextWindow.Write("What is your favorite sport? ") sp= TextWindow.Read() sp= Text.ConvertToLowerCase(sp) If sp="soccer" Then TextWindow.WriteLine("Yay, that's Delaney's favorite sport!") ElseIf sp="basketball" then TextWindow.WriteLine("Yay, that's Vaughn's favorite sport!") Elseif sp="gymnastics" then TextWindow.WriteLine("Yay, that's Rachael's favorite sport!") Else TextWindow.WriteLine("I would have never guessed!") EndIf 'Question4 TextWindow.WriteLine("") TextWindow.Write("What is your favorite flavor of icecream? ") ic=textwindow.Read() ic= Text.ConvertToLowerCase(ic) If ic="vanilla" Then TextWindow.WriteLine("That's my favorite!!!") ElseIf ic= "chocolate" then TextWindow.WriteLine("That's decent.") elseif ic= "strawberry" then TextWindow.WriteLine("Vaughn eats that all the time.") Else TextWindow.WriteLine("Ewww that's gross! How do you eat that!!!!") EndIf 'Question5 TextWindow.WriteLine("") TextWindow.Write("Did you do your homework last night? ") hw= TextWindow.Read() hw= Text.ConvertToLowerCase(hw) If hw="no" Then TextWindow.WriteLine("You're in trouble.") ElseIf hw= "yes" then TextWindow.WriteLine("Well someone is an overachiever! Good for you.") Else TextWindow.WriteLine("Alright then.") EndIf 'Question6 TextWindow.WriteLine("") TextWindow.Write("Do you like fast food? ") ff= TextWindow.Read() ff= Text.ConvertToLowerCase(ff) If ff= "yes" Then TextWindow.WriteLine("Well, you are what you eat.") ElseIf ff= "no" then TextWindow.WriteLine("That's why you have that body!") EndIf 'Question7 TextWindow.WriteLine("") TextWindow.Write("Do you want to go to college? ") col= TextWindow.Read() col= Text.ConvertToLowerCase(col) If col= "yes" Then TextWindow.WriteLine("Good for you! Go Gators!") ElseIf col= "no" then TextWindow.WriteLine("When will you be turning in your application for McDonalds?") EndIf 'Question8 TextWindow.WriteLine("") TextWindow.Write("What did you have for breakfast? ") bf = TextWindow.Read() bf = Text.ConvertToLowerCase(bf) If bf = "eggs" Then TextWindow.WriteLine("I put salsa in my eggs.") ElseIf bf = "waffles" then TextWindow.WriteLine("Waffles are okay.") elseif bf = "cereal" then TextWindow.WriteLine("Did you not have time for a real breakfast?") Else TextWindow.WriteLine("I wouldn't have that for breakfast...") EndIf 'Question9 TextWindow.WriteLine("") TextWindow.Write("What color eyes do you have? ") eyes = TextWindow.Read() eyes = Text.ConvertToLowerCase(eyes) If eyes = "brown" Then TextWindow.WriteLine("Delaney and Vaughn have brown eyes!") ElseIf eyes = "blue" then TextWindow.WriteLine("Blue is such a pretty color!") elseif eyes = "green" Then TextWindow.WriteLine("Rachael has green eyes too!") elseif eyes = "red" then TextWindow.WriteLine("What have you been doing?") Else TextWindow.WriteLine("You're weird.") EndIf 'Question10 TextWindow.WriteLine("") TextWindow.Write("Do you like babies? ") bb= TextWindow.Read() bb= Text.ConvertToLowerCase(bb) If bb= "yes" Then TextWindow.WriteLine("Babies are cute.") ElseIf bb= "no" then TextWindow.WriteLine("What's wrong with you?") EndIf 'Question11 TextWindow.WriteLine("") TextWindow.Write("How many years have you gone to Montverde?(1-10) ") yrs= TextWindow.ReadNumber() If yrs>=1 And yrs<=3 Then TextWindow.WriteLine("That's not long at all!") ElseIf yrs>=4 and yrs<=6 then TextWindow.WriteLine("That's been a while at the same school.") elseif yrs>=7 and yrs<=10 then TextWindow.WriteLine("WOW! That's a long long time.") EndIf 'Question12 TextWindow.WriteLine("") TextWindow.Write("What's you favorite subject in school? ") sbj= TextWindow.Read() sbj= Text.ConvertToLowerCase(sbj) If sbj="math" Then TextWindow.WriteLine("I don't understand why you like doing someone else's problems.") ElseIf sbj= "english" then TextWindow.WriteLine("Rachael likes English too.") elseif sbj= "science" then TextWindow.WriteLine("That's very interesting.") elseif sbj= "history" then TextWindow.WriteLine("That's cool, but don't waste your time because history repeats itself.") elseif sbj= "spanish" then TextWindow.WriteLine("Yo no comprende espanol.") Else TextWindow.WriteLine("I would have never of guessed that.") EndIf 'Question13 TextWindow.WriteLine("") TextWindow.Write("Do you like to read books? ") read= TextWindow.Read() read= Text.ConvertToLowerCase(read) If read= "yes" Then TextWindow.WriteLine("I guess you have a lot of free time.") ElseIf read= "no" then TextWindow.WriteLine("Yeah, I agree, it is extremely boring.") EndIf 'Question14 TextWindow.WriteLine("") TextWindow.Write("What color hair do you have? ") haircolor= TextWindow.Read() haircolor= Text.ConvertToLowerCase(haircolor) If haircolor= "brown" Then TextWindow.WriteLine("You are obviously a brunette. That's awesome. ") ElseIf haircolor= "red" then TextWindow.WriteLine("You're a ginger!") elseif haircolor = "blonde" then TextWindow.WriteLine("You must be dumb! Haha, just kidding.") Else TextWindow.WriteLine("You're a bit unique...") EndIf TextWindow.WriteLine("") EndSub Sub team4 authors ="Dominic Marshall, Luiggi Reno, Alex Contron" authorStats = "15 Questions, 44 Responses, 0 nested questions" 'q3----------------------------------------------------------------------- TextWindow.Write("Are you good at driving? ") driving = TextWindow.Read() If driving = "yes" Then TextWindow.WriteLine("You must be a male driver.") Else TextWindow.WriteLine("You must be a women.") EndIf TextWindow.Writeline("") 'q4------------------------------------------------------------------ TextWindow.Write("Do you preffer coke or pepsi? ") soda = TextWindow.Read() If soda = "coke" Then TextWindow.WriteLine("You must have given up on life.") Else TextWindow.WriteLine("You must be an amazing and talented person!") EndIf TextWindow.Writeline("") 'q5--------------------------------------------------------------------- TextWindow.Write("Where are you from? ") country = TextWindow.Read() If country = "china" Then TextWindow.WriteLine("Ching chang wang") ElseIf country = "usa" or country ="america" then TextWindow.WriteLine("What's up.") Elseif country= "vietnam" then TextWindow.WriteLine("Nihao") Else TextWindow.WriteLine("I would like to visit!") EndIf TextWindow.Writeline("") 'q6---------------------------------------------------------------- TextWindow.Write("do you have Mr. Parets for programming? ") class = TextWindow.Read() If class = "yes" Then TextWindow.WriteLine("You must be able to programm anything!") Else TextWindow.WriteLine("You must struggle in class!") EndIf TextWindow.Writeline("") 'q7---------------------------------------------------------------- TextWindow.Write("Do you attend MVA? ") mva = TextWindow.Read() If mva = "yes" Then TextWindow.WriteLine("WOW! Me too!") Else TextWindow.WriteLine("Oh...") EndIf TextWindow.Writeline("") 'q8-------------------------------------------------------------------- TextWindow.Write("Do you preffer Japanese food or Chinese food? ") food = TextWindow.Read() If food = "chinese" Then TextWindow.WriteLine("One egg roll, please!") Else TextWindow.WriteLine("You must like sushi!") EndIf TextWindow.Writeline("") 'q9------------------------------------------------------------------ TextWindow.Write("Do you preffer pencils or pens? ") pens = TextWindow.Read() If pens = "pens" Then TextWindow.WriteLine("You must not make mistakes!") Else TextWindow.WriteLine("You must make mistakes!") EndIf TextWindow.Writeline("") 'q10--------------------------------------------------------------- TextWindow.Write("Do you think Miami Heat will win The Finals? ") heat = TextWindow.Read() If heat= "yes" Then TextWindow.WriteLine("Of course!") Else TextWindow.WriteLine("Are you crazy?!") EndIf TextWindow.Writeline("") EndSub Sub team5 authors ="Charolotte Ng, Shaodong Mao, Xiocun Zhong (Nathaniel)s" authorStats = "16 Questions, 38 Responses, 0 nested questions" TextWindow.Write("Do you like Kevin Love?(Y/N) ") ans = TextWindow.Read() If (ans = "yes") Then TextWindow.WriteLine("Oh! He is my favourite baseketball player. ") Else TextWindow.WriteLine("That's interesting. Maybe you favourite ") TextWindow.WriteLine("player is Kevin Garnett." ) EndIf TextWindow.Writeline("") TextWindow.Write("Do you like shopping?(Y/N) ") ans2 = TextWindow.Read() If (ans2 = "yes") Then TextWindow.WriteLine("Oh! I like shopping too. ") Else TextWindow.WriteLine("That's fine. It's OK. ") EndIf TextWindow.Writeline("") TextWindow.Write("Are you male or female? ") ans3 = TextWindow.Read() If (ans3 = "male") Then TextWindow.WriteLine("Oh! I'm male too. Do you like playing ") TextWindow.WriteLine("basketball? ") Else TextWindow.WriteLine("That's good. My partner is female too. ") EndIf TextWindow.Writeline("") TextWindow.Write("Are you golfer? (Y/N)") ans4 = TextWindow.Read() If (ans4 = "yes") Then TextWindow.WriteLine("Oh! I'm golfer too. Have you win tournament ") TextWindow.WriteLine("before? ") Else TextWindow.WriteLine("Than you must be a full time student in MVA. ") EndIf TextWindow.Writeline("") TextWindow.Write("Do you like to eat McDonald? ") ans5 = TextWindow.Read() If (ans5 = "yes") Then TextWindow.WriteLine("I usually eat McDonald in Sunday afternoon ") Else TextWindow.WriteLine("You must be a health person. ") EndIf TextWindow.Writeline("") TextWindow.Write("Do you like to watch comic book? ") ans6 = TextWindow.Read() If (ans6 = "yes") Then TextWindow.WriteLine("I love too, my favouite one is Pokeamon") Else TextWindow.WriteLine("You must be a very good student. ") EndIf TextWindow.Writeline("") TextWindow.Write("Do you like playing 2K13? ") ans7 = TextWindow.Read() If (ans7 = "yes") Then TextWindow.WriteLine("I love too. I have won a championship in ") TextWindow.WriteLine("this game. ") Else TextWindow.WriteLine("You must be a very good student. ") EndIf TextWindow.Writeline("") TextWindow.Write("Which singer do you like the best? ") ans8 = TextWindow.Read() If (ans8 = "lady gaga") Then TextWindow.WriteLine("I love her so much and I am a little ") TextWindow.WriteLine(" monster fan. ") Else TextWindow.WriteLine("It's ok. I love this singer too. ") EndIf TextWindow.Writeline("") TextWindow.Write("Are you MVA Student? ") ans9 = TextWindow.Read() If (ans9 = "yes") Then TextWindow.WriteLine("That's great, I am MVA student too. ") Else TextWindow.WriteLine("MVA is a good academy. Hope you can come here ") TextWindow.WriteLine(" to study.") EndIf TextWindow.Writeline("") TextWindow.Write("Which year will you be graduate from high school? ") ans10 = TextWindow.Read() If (ans10 = "2013") Then TextWindow.WriteLine("Congratulation! Than you must be a Senior ") TextWindow.WriteLine("this year! ") ElseIf (ans10 = "2014") Then TextWindow.WriteLine("Than you one more year to graduate.") ElseIf (ans10 > "2014") Then TextWindow.WriteLine("Enjoying your last few years in MVA.") EndIf TextWindow.WriteLine("") TextWindow.Write("What's your favorite subject? ") ans11 = TextWindow.Read() If (ans11 = "Math") Then TextWindow.WriteLine("Wow! You must be clever. ") ElseIf (ans11 = "English") Then TextWindow.WriteLine("Your English must be good. ") ElseIf (ans11 = "Biology") Then TextWindow.WriteLine("I think you want to be a biologist in ") TextWindow.WriteLine("the future.") Else TextWindow.WriteLine("Emm.. I guess your favorite subject is ") TextWindow.WriteLine("U.S History. ") EndIf TextWindow.WriteLine("") TextWindow.Write("Do you think Boston Celtics can win the") textwindow.Write(" champion this year? ") ans12 = TextWindow.Read() If (ans12 = "yes") Then TextWindow.WriteLine("Yes! I think we are both the fans of ") TextWindow.WriteLine("Boston Celtics ") Else TextWindow.WriteLine("Probably, they will not will this year ") TextWindow.WriteLine("because they have too many injury!!") EndIf TextWindow.WriteLine("") TextWindow.Write("What type of ice cream you like the most?") ans13 = TextWindow.Read() If (ans13 = "chocolate") Then TextWindow.WriteLine("WOW! We have the same favor that we like.") ElseIf (ans13 = "strawberry") Then TextWindow.WriteLine(" I like that too.") ElseIf (ans13 = "vanilla") Then TextWindow.WriteLine("That's interesting! ") ElseIf (ans13 = "green tea") Then TextWindow.WriteLine("It's cool! But I'm not like it really. ") Else TextWindow.WriteLine("Oh. You have a special taste.") EndIf TextWindow.WriteLine("") TextWindow.Write("After T-MAC came back, do you think he can pass") textwindow.Write(" the first round? ") ans13 = TextWindow.Read() If (ans13 = "yes") Then TextWindow.WriteLine("Yes, because he join in a better team now!!") Else TextWindow.WriteLine("Because he is unlucky for his whole career ") EndIf TextWindow.WriteLine("") TextWindow.Write("Do you think lakers can pass the first round ") textwindow.Write("without kobe?") ans14 = TextWindow.Read() If (ans14 = "yes") Then TextWindow.WriteLine("Because they have a better coach!") Else TextWindow.WriteLine("Emmm.. Because they don't have leader. ") TextWindow.WriteLine("And supers is too strong!!") EndIf TextWindow.WriteLine("") TextWindow.Write("Do you like to watch movie? ") ans15 = TextWindow.Read() If (ans15 = "yes") Then TextWindow.WriteLine("I always watch on saturday night") Else TextWindow.WriteLine("That's fine! I think watching movie is a ") TextWindow.WriteLine("good way to relax yourself. ") EndIf TextWindow.WriteLine("") EndSub Sub team6 authors ="Diane Margo, Jason Wang, Keagen Ferrell-Clegg" authorStats = "30 Questions, 70 Responses, 0 nested questions" 'Question 3 ------------------------------------------------------------------------- TextWindow.Write("What is your favorite number? ") favnum = TextWindow.ReadNumber() If (favnum < 5) Or (favnum > 29) Then TextWindow.WriteLine("That's my favorite number too") ElseIf (favnum >= 30) and (favnum < 79) Then TextWindow.WriteLine("It's a good number.") TextWindow.WriteLine("I don't like that number.") ElseIf (favnum >= 80) and (favnum <= 100) then TextWindow.WriteLine("That's a decent number.") Else 'between 19 and forever TextWindow.WriteLine("Wow! That is a pretty big number") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 4 ------------------------------------------------------------------------ TextWindow.Write("What is the color of your pants? ") pants = TextWindow.Read() pants = Text.ConvertToLowerCase(pants) 'convert the input to all lower case If (pants="black") Then TextWindow.Writeline("That's a dark color.") TextWindow.WriteLine("One of the three choices in the school.") Else TextWindow.WriteLine("I guess you don't like black") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 5 ------------------------------------------------------------------------ TextWindow.Write("What school do you go to? ") school = TextWindow.Read() school = Text.ConvertToLowerCase(school) 'convert the input to all lower case If (school= "Montverde Academy") Then TextWindow.Writeline("Really! I live in that school too") TextWindow.WriteLine("We have so much in common") Else TextWindow.WriteLine("We don't go to the same school.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 6 ------------------------------------------------------------------------ TextWindow.Write("Do you drink water? ") water= TextWindow.Read() water = Text.ConvertToLowerCase(water) 'convert the input to all lower case If (water="yes") Then TextWindow.Writeline("You are very healthy.") Else TextWindow.WriteLine("You must think water is too plain.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 7 ------------------------------------------------------------------------ TextWindow.Write("what color is your shoes? ") shoe= TextWindow.Read() shoe = Text.ConvertToLowerCase(shoe) 'convert the input to all lower case If (shoe="black") Then TextWindow.Writeline("I have the same colored shoe.") Else TextWindow.WriteLine("Our shoe color doesn't match.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 8 ------------------------------------------------------------------------ TextWindow.Write("Do you like small basic? ") smallbasic = TextWindow.Read() smallbasic = Text.ConvertToLowerCase(smallbasic) 'convert the input to all lower case If (smallbasic="yes") Then TextWindow.Writeline("I like your style!") Else TextWindow.WriteLine("I'm so sad right now.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 9 ------------------------------------------------------------------------ TextWindow.Write("Who's your favorite teacher?(Mr.Parets or Mrs.Parks) ") teacher = TextWindow.Read() teacher = Text.ConvertToLowerCase(teacher) 'convert the input to all lower case If (teacher="Mr.Parets") Then TextWindow.Writeline("He's cool!") Else TextWindow.WriteLine("Why do you like her?") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 10 ------------------------------------------------------------------------- TextWindow.Write("How many close friends do you have? ") friends = TextWindow.ReadNumber() If (friends < 5) Or (friends > 10) Then TextWindow.WriteLine("That's how many friends I have") ElseIf (friends >= 11) and (friends < 20) Then TextWindow.WriteLine("You have a lot of friends") ElseIf (friends >= 21) and (friends <= 40) then TextWindow.WriteLine("you must be popular") Else 'between 19 and 80 TextWindow.WriteLine("You have too many") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 11 ------------------------------------------------------------------------ TextWindow.Write("Do you like English? ") English = TextWindow.Read() English = Text.ConvertToLowerCase(English) 'convert the input to all lower case If (English="yes") Then TextWindow.Writeline("I love English too!") Else TextWindow.WriteLine("We're speaking English now.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 12 ------------------------------------------------------------------------ TextWindow.Write("Do you have a hobby?(yes/no) ") hobby = TextWindow.Read() hobby = Text.ConvertToLowerCase(hobby) 'convert the input to all lower case If (hobby="yes") Then TextWindow.Writeline("I wonder what your hobby is.") Else TextWindow.WriteLine("You should get one. Try Small Basic.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 13 ------------------------------------------------------------------------ TextWindow.Write("Do you like dogs or cats?(yes/no) ") dogcat = TextWindow.Read() dogcat = Text.ConvertToLowerCase(dogcat) 'convert the input to all lower case If (dogcat="dogs") Then TextWindow.Writeline("I like dogs too.") ElseIf dogcat = "cats" then TextWindow.WriteLine("The cat keeps chasing my mouse.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 14 ------------------------------------------------------------------------ TextWindow.Write("Do you wear glasses?(yes/no) ") glasses = TextWindow.Read() glasses = Text.ConvertToLowerCase(glasses) 'convert the input to all lower case If (glasses="yes") Then TextWindow.Writeline("Small Basic can magnify your work.") Else TextWindow.WriteLine("You have good eyesight.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 15 ------------------------------------------------------------------------ TextWindow.Write("What gender are you?(male/female) ") gender = TextWindow.Read() gender = Text.ConvertToLowerCase(gender) 'convert the input to all lower case If (gender="male") Then TextWindow.Writeline("Computers have no gender.") ElseIf gender = "female" then TextWindow.WriteLine("I have no interest. I don't have a gender.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 16 ------------------------------------------------------------------------ TextWindow.Write("Do you have an Mac?(yes/no) ") Mac = TextWindow.Read() Mac = Text.ConvertToLowerCase(Mac) 'convert the input to all lower case If (Mac="yes") Then TextWindow.Writeline("You have money.") ElseIf Mac = "no" then TextWindow.WriteLine("You should get one. It's simple to use.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 17 ------------------------------------------------------------------------ TextWindow.Write("Do you like mice?(yes/no) ") mice = TextWindow.Read() mice = Text.ConvertToLowerCase(mice) 'convert the input to all lower case If (mice="yes") Then TextWindow.Writeline("I have a mouse.") ElseIf Mac = "no" then TextWindow.WriteLine("But mice are so fluffy.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 18 ------------------------------------------------------------------------ TextWindow.Write("Do you believe in math?(yes/no) ") maths = TextWindow.Read() maths = Text.ConvertToLowerCase(maths) 'convert the input to all lower case If (maths="yes") Then TextWindow.Writeline("I like math too.") ElseIf Mac = "no" then TextWindow.WriteLine("Small Basic has a math option.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 19 ------------------------------------------------------------------------ TextWindow.Write("DO you like senior speaches? ") sspeach = TextWindow.Read() sspeach = Text.ConvertToLowerCase(sspeach) 'convert the input to all lower case If (sspeach="yes") Then TextWindow.Writeline("You can live through thaT?") ElseIf sspeach = "no" then TextWindow.WriteLine("You need to expand your mind.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 20 ------------------------------------------------------------------------ TextWindow.Write("Do you wear watches?(yes/no) ") watch = TextWindow.Read() watch= Text.ConvertToLowerCase(watch) 'convert the input to all lower case If (watch="yes") Then TextWindow.Writeline("You must be on time all the time.") ElseIf watch = "no" then TextWindow.WriteLine("I hope you make it on time.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 21 ------------------------------------------------------------------------ TextWindow.Write("What language are you taking? ") language = TextWindow.Read() language= Text.ConvertToLowerCase(language) 'convert the input to all lower case If (language="Chinese") Then TextWindow.Writeline("Learn your character.") ElseIf language = "Spanish" then TextWindow.WriteLine("HOLA!") elseif language = "English" then TextWindow.WriteLine("Keep up the good work!") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 22 ------------------------------------------------------------------------ TextWindow.Write("Do you wear watches?(yes/no) ") watch = TextWindow.Read() watch= Text.ConvertToLowerCase(watch) 'convert the input to all lower case If (watch="yes") Then TextWindow.Writeline("You must be on time all the time.") ElseIf watch = "no" then TextWindow.WriteLine("I hope you make it on time.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 23 ------------------------------------------------------------------------ TextWindow.Write("Do you text in class?(yes/no) ") classtext = TextWindow.Read() classtext= Text.ConvertToLowerCase(classtext) 'convert the input to all lower case If (classtext="yes") Then TextWindow.Writeline("What is wrong with you?") ElseIf classtext = "no" then TextWindow.WriteLine("Good student!") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 24 ------------------------------------------------------------------------ TextWindow.Write("Where do you live?(city) ") livehome = TextWindow.Read() livehome= Text.ConvertToLowerCase(livehome) 'convert the input to all lower case If livehome = "Montverde" then TextWindow.WriteLine("Same Area") Else TextWindow.WriteLine("Really? I wonder where that is") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 25 ------------------------------------------------------------------------ TextWindow.Write("What's your favorite class? ") favclass = TextWindow.Read() favclass = Text.ConvertToLowerCase(favclass) 'convert the input to all lower case If (favclass = "Math") then TextWindow.WriteLine("Logic... smart!") Elseif favclass = "English" then TextWindow.WriteLine("We speak the same language") elseif favclass = "Art" then TextWindow.WriteLine("Use 'Turtle'") Else TextWindow.WriteLine("I don't use that.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 26 ------------------------------------------------------------------------ TextWindow.Write("Do you have black hair?(yes/no) ") blackhair = TextWindow.Read() blackhair= Text.ConvertToLowerCase(blackhair) 'convert the input to all lower case If (blackhair="yes") Then TextWindow.Writeline("Dark") ElseIf blackhair = "no" then TextWindow.WriteLine("I wonder what color") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 27 ------------------------------------------------------------------------ TextWindow.Write("Do you like pizza?(yes/no) ") pizza = TextWindow.Read() pizza= Text.ConvertToLowerCase(pizza) 'convert the input to all lower case If (pizza="yes") Then TextWindow.Writeline("I love pizza too.") ElseIf pizza = "no" then TextWindow.WriteLine("What is wrong with you?") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 28 ------------------------------------------------------------------------ TextWindow.Write("Are you going to the carnival? (yes/no) ") carnival = TextWindow.Read() carnival= Text.ConvertToLowerCase(carnival) 'convert the input to all lower case If (carnival="yes") Then TextWindow.Writeline("Have fun!") ElseIf carnival = "no" then TextWindow.WriteLine("What is wrong with you?") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 29 ------------------------------------------------------------------------ TextWindow.Write("Do you like reading books?(yes/no) ") reading = TextWindow.Read() reading= Text.ConvertToLowerCase(reading) 'convert the input to all lower case If (reading="yes") Then TextWindow.Writeline("I love reading") ElseIf reading = "no" then TextWindow.WriteLine("i don't like reading too") EndIf 'Question 30 ------------------------------------------------------------------------ TextWindow.Write("Are you an athlete(yes/no) ") athlete = TextWindow.Read() athlete= Text.ConvertToLowerCase(athlete) 'convert the input to all lower case If (athlete="yes") Then TextWindow.Writeline("You are active") ElseIf athlete = "no" then TextWindow.WriteLine("I wonder what you like doing.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 31 ------------------------------------------------------------------------ TextWindow.Write("Do you eat lunch on Wednesdays?(yes/no) ") Wednesdays = TextWindow.Read() Wednesdays= Text.ConvertToLowerCase(Wednesdays) 'convert the input to all lower case If (Wednesdays="yes") Then TextWindow.Writeline("You must like eating.") ElseIf Wednesdays = "no" then TextWindow.WriteLine("You must not like eating.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions 'Question 32 ------------------------------------------------------------------------ TextWindow.Write("What continent do you live in? ") continent = TextWindow.Read() continent = Text.ConvertToLowerCase(continent) 'convert the input to all lower case If (continent = "North America") then TextWindow.WriteLine("English") Elseif continent = "South America" then TextWindow.WriteLine("Spanish") elseif continent = "Europe" then TextWindow.WriteLine("Luxurious") Elseif continent = "Africa" then TextWindow.WriteLine("Lots of Animals") elseif continent = "Asia" then TextWindow.WriteLine("Smart") Elseif continent = "Antartica" then TextWindow.WriteLine("Chili") Else TextWindow.WriteLine("I wonder where you live in.") EndIf TextWindow.Writeline("") 'This gives a blank line between questions EndSub Sub team7 authors ="Trinity Mims, Guanming Xu (George), Gileysa Penzo" authorStats = "13 Questions, 40 Responses, 6 nested questions" 'Question 3 ---------------------------------------------------------------------- TextWindow.Write("Who is your favorite teacher? ") teacher= TextWindow.Read() teacher= Text.ConvertToLowerCase(teacher) If teacher= "mr. parets" Then TextWindow.WriteLine("Mines too!") ElseIf teacher= "mrs. parks" then TextWindow.WriteLine("I don't like study hall.") Else TextWindow.WriteLine("I don't know him/her pretty well.") EndIf 'Question 4 --------------------------------------------------------------------- TextWindow.Write("What is your favorite class? ") class= TextWindow.Read() class= Text.ConvertToLowerCase(class) If class= "programming" Then TextWindow.WriteLine("I took it my first year, it was hard!") ElseIf class= "math" then TextWindow.WriteLine("You better know what you are doing.") Else TextWindow.WriteLine("I love that topic.") EndIf 'Question 5 ---------------------------------------------------------------------- TextWindow.Write("Do you like pizza?(Yes/No) ") pizza= TextWindow.Read() pizza= Text.ConvertToLowerCase(pizza) If pizza= "yes" Then TextWindow.Write("What is your favorite topping? ") topping= TextWindow.Read() topping=Text.ConvertToLowerCase(topping) If topping= "pepperoni" Then TextWindow.WriteLine("That's my favorite topic too!") ElseIf topping= "bacon" then TextWindow.WriteLine("That in combination with sausages taste amazing") ElseIf topping= "onions" then TextWindow.WriteLine("Actually that is not my favorite.") Else TextWindow.WriteLine("I will try that the next time I eat pizza!") EndIf ElseIf pizza= "no" then TextWindow.WriteLine("WHAAT!! Are you insane? Next time I see you I will take you out and we will eat pizza.") EndIf 'Question 6 ---------------------------------------------------------------- TextWindow.Write("Do you watch any sport?(Yes/No) ") sport= TextWindow.Read() sport= Text.ConvertToLowerCase(sport) If sport= "yes" Then TextWindow.Write("Which one is your favorite? ") spt1= TextWindow.Read() spt1= Text.ConvertToLowerCase(spt1) If spt1= "basketball" Or "soccer" Or "football" Then TextWindow.Write("Who is your favorite player? Name their lastnames: ") fav= TextWindow.Read() fav= Text.ConvertToLowerCase(fav) If fav= "james" Then TextWindow.WriteLine("Good! He is the best in the league right now.") ElseIf fav= "bryant" then TextWindow.WriteLine("You don't know anything about basketball!") ElseIf fav= "beckham" then TextWindow.WriteLine("I have seen him play, he is alright.") ElseIf fav= "messi" then TextWindow.WriteLine("I love how the latinos play!") ElseIf fav= "jackson" then TextWindow.WriteLine("Yea he is a really good player. ") ElseIf fav= "rice " then TextWindow.WriteLine("Yea he was the best reciever in football history. ") Else TextWindow.WriteLine("I have never heard about him! I will look it up.") EndIf EndIf ElseIf sport= "no" then TextWindow.WriteLine("What do you do in your free time? ") time= TextWindow.Read() time= Text.ConvertToLowerCase(time) If time= "homework" and "study" then TextWindow.WriteLine("Then you love school!") Else TextWindow.WriteLine("That sounds interesting.") EndIf EndIf 'Question 7 ----------------------------------------------------------------- TextWindow.Write("Do you have a pet? ") pet= TextWindow.Read() pet= Text.ConvertToLowerCase(pet) If pet= "yes" Then TextWindow.WriteLine("Which one is your favorite? ") favpet= TextWindow.Read() favpet= Text.ConvertToLowerCase(favpet) If favpet= "dog" Then TextWindow.WriteLine("That is my favorite pet too.") ElseIf favpet= "cat" then TextWindow.WriteLine("It is a lazy pet.") ElseIf favpet= "fish" then TextWindow.WriteLine("You don't like dealing with mascots mess.") Else TextWindow.WriteLine("I have two of them in my house.") EndIf Else TextWindow.WriteLine("You need to get one soon, they are great to build your responsibility.") EndIf 'Question 8 --------------------------------------------------------------- TextWindow.Write("Do have any videogames consoles?") console= TextWindow.Read() console= Text.ConvertToLowerCase(console) If console= "yes" Then TextWindow.WriteLine("That is great, but don't spent too much time using it.") Else TextWindow.WriteLine("You should get one!") EndIf 'Question 9 ---------------------------------------------------------------- TextWindow.Write("Do you go to the movies? ") movies= TextWindow.Read() movies= Text.ConvertToLowerCase(movies) If movies= "yes" Then TextWindow.WriteLine("Which movie was the last one you have seen? ") last= TextWindow.Read() last= Text.ConvertToLowerCase(last) If last= "oblivion" Then TextWindow.WriteLine("Tom Cruise is a great actor.") ElseIf last= "django" then TextWindow.WriteLine("That movie was awesome!") ElseIf last= "iron man" then TextWindow.WriteLine("That actor makes the best jokes ever.") ElseIf last= "evil dead" then TextWindow.WriteLine("That movie wasn't scary as it was supposed to be.") ElseIf last= 42 then TextWindow.WriteLine("Movies based on a true story always have a morale at the end.") ElseIf last= "kung fu panda" then TextWindow.WriteLine("That is an old movie you need to go to the movies more often.") EndIf Else TextWindow.WriteLine("Movies are very fun you need to go out with your friend or family.") EndIf EndSub Sub team8 authors ="Harry Vaughn, John Hancock, Jiawen Liu (Gavin)" authorStats = "9 Questions, 40 Responses, 0 nested questions" 'Question 3---------------------------------------------------------------- TextWindow.ForegroundColor = "green" TextWindow.WriteLine("") TextWindow.WriteLine("What is your favorite food? ") food = TextWindow.Read() food = Text.ConvertToLowerCase(food) If food = "pizza" Then TextWindow.WriteLine("How predictable.") ElseIf food = "steak" then TextWindow.WriteLine("Think of how many cows have died for your enjoyment.") elseif food = "ice cream" then TextWindow.WriteLine("Eat healthier food.") Else TextWindow.WriteLine("Wow! Me too!") EndIf 'Question 4---------------------------------------------------------------- TextWindow.ForegroundColor = "red" TextWindow.WriteLine("") TextWindow.WriteLine("What's your favorite subject?") subject = TextWindow.Read() subject = Text.ConvertToLowerCase(subject) If subject = "math" Then TextWindow.WriteLine("Maybe you should consider a career in Engineering.") ElseIf subject = "english" then TextWindow.WriteLine("Why hello their!") elseif subject = "history" then TextWindow.WriteLine("That's fantastic.") elseif subject = "programming" then TextWindow.WriteLine("Suck-up.") Else TextWindow.WriteLine("I suggest dropping out.") EndIf 'Question 5------------------------------------------------------------------ TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("") TextWindow.WriteLine("What color are your eyes?") eye = TextWindow.Read() eye = Text.ConvertToLowerCase(eye) If eye = "brown" Then TextWindow.WriteLine("That's common.") ElseIf eye = "blue" then TextWindow.WriteLine("That's just like the sky!") elseif eye = "green" then TextWindow.WriteLine("GREEN IS NOT A CREATIVE COLOR.") Else TextWindow.WriteLine("Lies.") EndIf 'Question 6--------------------------------------------------------------------- TextWindow.ForegroundColor = "green" TextWindow.WriteLine("") TextWindow.WriteLine("Windows or Mac?") pc = TextWindow.Read() pc = Text.ConvertToLowerCase(pc) If pc = "mac" Then TextWindow.WriteLine("Hipster.") ElseIf pc = "windows" then TextWindow.WriteLine("Too mainstream.") EndIf 'Question 7---------------------------------------------------------------- TextWindow.ForegroundColor = "red" TextWindow.WriteLine("") TextWindow.WriteLine("Favorite fruit?") fruit = TextWindow.Read() fruit = Text.ConvertToLowerCase(fruit) If fruit = "apple" Then TextWindow.WriteLine("I bet your favorite color was red.") ElseIf fruit = "orange" then TextWindow.WriteLine("Hey apple! Hey, hey apple! APPLE!") elseif fruit = "banana" then TextWindow.WriteLine("You are closely related to our primate ancestors.") elseif fruit = "pear" then TextWindow.WriteLine("That's odd.") elseif fruit = "strawberry" then TextWindow.WriteLine("You sir, are my friend.") Else TextWindow.WriteLine("I prefer vegetables.") EndIf 'Question 8------------------------------------------------------------------ TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("") TextWindow.WriteLine("How many languages do you speak?") lang = TextWindow.ReadNumber() If lang = 1 Then TextWindow.WriteLine("Apply Yourself.") ElseIf lang = 2 then TextWindow.WriteLine("You are bilingual.") elseif lang = 3 then TextWindow.WriteLine("Wow, that's amazing.") ElseIf lang > 3 then TextWindow.WriteLine("Multi-lingual.") Else TextWindow.WriteLine("Lies.") EndIf 'Question 9-------------------------------------------------------------------- TextWindow.ForegroundColor = "green" TextWindow.WriteLine("") TextWindow.WriteLine("What is your favorite animal?") animal = TextWindow.Read() animal = Text.ConvertToLowerCase(animal) If animal = "cat" Then TextWindow.WriteLine("Stop being such an aristocat.") ElseIf animal = "dog" then TextWindow.WriteLine("You do strike me as a dog lover.") elseif animal = "fish" then TextWindow.WriteLine("Go home.") elseif animal = "sloth" then TextWindow.WriteLine("I love you.") Else TextWindow.WriteLine("How original.") EndIf 'Question 10------------------------------------------------------------------------ TextWindow.WriteLine("") TextWindow.ForegroundColor = "red" TextWindow.WriteLine("What is your favorite shape?") shape = TextWindow.Read() shape = Text.ConvertToLowerCase(shape) If shape = "circle" Then TextWindow.WriteLine("You do seem like a well-rounded individual.") ElseIf shape = "square" then TextWindow.WriteLine("That's nice.") elseif shape = "triangle" then TextWindow.WriteLine("Why don't you TRI to be my friend?") elseif shape = "rectangle" then TextWindow.WriteLine("I have no witty saying for that response.") Else TextWindow.WriteLine("That's acute response") EndIf 'Question 11------------------------------------------------------------------------- TextWindow.WriteLine("") TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Coke or Pepsi?") soda = TextWindow.Read() soda = Text.ConvertToLowerCase(soda) If soda = "coke" Then TextWindow.WriteLine("Just go away.") ElseIf soda = "pepsi" then TextWindow.WriteLine("Do you need a PEP talk?") elseif soda = "root beer" then TextWindow.WriteLine("Excellent choice!") Else TextWindow.WriteLine("There are only two possible answers.") EndIf EndSub Sub team9 authors ="Tyler DeWitt, Keri Milsap, Sung Yueh Chang (Dereck)" authorStats = "8 Questions, 16 Responses, 0 nested questions" 'Question 1 -------------------------------------------------------------------------- TextWindow.Write("Are you in high school. ") TextWindow.Write("Please answer Yes or No. ") answer = TextWindow.Read() If answer = "yes" Or answer = "Yes" Then TextWindow.WriteLine("From the looks of it you look like a little kid") Else TextWindow.WriteLine("Don't drop out because its bad") EndIf 'Question 2 -------------------------------------------------------------------------- TextWindow.Write("How is the weather today? ") TextWindow.Write("Put good or bad ") answer2 = TextWindow.Read() If answer2 = "good" Or answer2 = "Good" Then TextWindow.WriteLine("I agree it is a good day") Else TextWindow.WriteLine("Better stay inside") EndIf 'Question 3 -------------------------------------------------------------------------- TextWindow.Write("What is your favorite restaurant? ") answer3 = TextWindow.Read() If answer3 = "Bojangles" Then TextWindow.WriteLine("I agree it is the best!!") Else TextWindow.WriteLine("Wow! You have bad taste. Ever hear of Bojangles. ") EndIf 'Question 4 -------------------------------------------------------------------------- TextWindow.Write("What is your shoe size? ") shoe = TextWindow.ReadNumber() If shoe >= 9.5 Then TextWindow.WriteLine("Wow, you have a big feet.") Else TextWindow.WriteLine("Cool, you baby") EndIf 'Question 5 -------------------------------------------------------------------------- TextWindow.Write("Do you like spaghetti ") TextWindow.Write("Please answer Yes or No. ") answer4 = TextWindow.Read() If answer4 = "yes" Or answer4 = "Yes" Then TextWindow.WriteLine("Um, you are eating healthy.") Else TextWindow.WriteLine("Bad, you are eating unhealthy") EndIf 'Question 6 -------------------------------------------------------------------------- TextWindow.Write("What's your favorite sport? ") sport = TextWindow.Read() If sport = "basketball" Or sport = "Basketball" Then TextWindow.WriteLine("Are you as good as Lebron James? ") Else TextWindow.WriteLine("You probably don't need to play that.") EndIf 'Question 7 -------------------------------------------------------------------------- TextWindow.WriteLine("Soooo.......") TextWindow.Write("What do you want to talk about now? ") school = TextWindow.Read() If school = "school" or school = "School" Then TextWindow.WriteLine("Then, you are boring.") Else TextWindow.WriteLine("I don't care.") EndIf 'Question 8 -------------------------------------------------------------------------- TextWindow.Write("Who is your favorites person? ") name = TextWindow.Read() If name = "Dr. Kesselring"Then TextWindow.WriteLine("You have a very good taste in role models.") Else TextWindow.WriteLine("That's an Ok opinion") EndIf 'Question 9 -------------------------------------------------------------------------- TextWindow.Write("Do you have an Apple computer or Microsoft computer? ") Microsoft = TextWindow.Read() If Microsoft = "Microsoft" Or Microsoft = "microsoft" Then TextWindow.WriteLine("Yea because Microsoft is the BOMB!") Else TextWindow.WriteLine("You have a terrible opinion.") EndIf 'Question 10 -------------------------------------------------------------------------- TextWindow.Write("Do you like to cook? ") answer5 = TextWindow.Read() If answer5 = "yes" Or answer5 = "Yes" Then TextWindow.WriteLine("That is awesome!") Else TextWindow.WriteLine("How do you eat ?") EndIf 'Question 11 -------------------------------------------------------------------------- TextWindow.Write("How long did you sleep yesterday? ") time = TextWindow.ReadNumber() If time >= 8 Then TextWindow.WriteLine("Wow, you got a lot of sleep.") Else TextWindow.WriteLine("Oh! I don't care though") EndIf 'Question 12-------------------------------------------------------------------------- TextWindow.Write("Do you like to go to school here? ") TextWindow.Write("Please answer Yes or No. ") answer6 = TextWindow.Read() If answer6 = "yes" Or answer6 = "Yes" Then TextWindow.WriteLine("Awesome so does Keri.") Else TextWindow.WriteLine("So does Keri.") EndIf 'Question 13-------------------------------------------------------------------------- TextWindow.Write("Do you have a cellphone with you ? ") TextWindow.Write("Please answer Yes or No. ") answer7 = TextWindow.Read() If answer7 = "yes" Or answer7 = "Yes" Then TextWindow.WriteLine("Awesome so does Keri.") Else TextWindow.WriteLine("You are boring. ") EndIf 'Question 14-------------------------------------------------------------------------- TextWindow.Write("Are you a boy? ") TextWindow.Write("Please answer Yes or No. ") answer8 = TextWindow.Read() If answer8 = "yes" Or answer8 = "Yes" Then TextWindow.WriteLine("Awesome! Boys Rule the World!") Else TextWindow.WriteLine("Make me a sandwich!.") EndIf 'Question 15-------------------------------------------------------------------------- TextWindow.Write("Do you go hunting? ") TextWindow.Write("Please answer Yes or No. ") answer9 = TextWindow.Read() If answer9 = "yes" Or answer9 = "Yes" Then TextWindow.WriteLine("Well your probably not as good as Mr. Computer! ") Else TextWindow.WriteLine("You should go it is really fun! ") EndIf 'Question 16-------------------------------------------------------------------------- TextWindow.Write("Did you eat French Fries today ? ") TextWindow.Write("Please answer Yes or No. ") answer10 = TextWindow.Read() If answer10 = "yes" Or answer10 = "Yes" Then TextWindow.WriteLine("OH, then you are... never mind, i don't care.") Else TextWindow.WriteLine("OH, you should have! ") EndIf 'Question 17-------------------------------------------------------------------------- TextWindow.Write("Do you play Call of Duty Black Ops 2? ") TextWindow.Write("Please answer Yes or No. ") answer11 = TextWindow.Read() If answer11 = "yes" Or answer11 = "Yes" Then TextWindow.WriteLine("That's the best game ever as long as you are not a camper..") Else TextWindow.WriteLine("You better get it for Xbox 360 and play all night.") EndIf EndSub End>RRT018.sb< Start>RRV302.sb< 'Small Basic Blackjack 'Author: "John "JT" Hancock TextWindow.WriteLine("BlackJack") TextWindow.WriteLine("You have $100 to gamble with.") money = 100 Start: total = 0 card1 = 0 card2 = 0 card3 = 0 card4 = 0 card5 = 0 card6 = 0 dtotal = 0 dcard1 = 0 dcard2 = 0 dcard3 = 0 dcard4 = 0 dcard5 = 0 dcard6 = 0 ace1 = 0 ace2 = 0 ace3 = 0 ace4 = 0 ace5 = 0 ace6 = 0 If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("How much would you like to bet on this hand?") gamble = TextWindow.ReadNumber() If (gamble > money) Then TextWindow.WriteLine("You don't have that much money! You have $"+money) Goto Start ElseIf (gamble <= 0) Then TextWindow.WriteLine("You have to bet something!") Goto Start EndIf card1 = Math.GetRandomNumber(13) card2 = Math.GetRandomNumber(13) card3 = Math.GetRandomNumber(13) card4 = Math.GetRandomNumber(13) card5 = Math.GetRandomNumber(13) card6 = Math.GetRandomNumber(13) dcard1 = Math.GetRandomNumber(13) dcard2 = Math.GetRandomNumber(13) dcard3 = Math.GetRandomNumber(13) dcard4 = Math.GetRandomNumber(13) dcard5 = Math.GetRandomNumber(13) dcard6 = Math.GetRandomNumber(13) total = card1 + card2 If (card1 = 11) Then card1 = "Jack" total = total - 11 total = total + 10 EndIf If (card2 = 11) Then card2 = "Jack" total = total - 11 total = total + 10 EndIf If (card1 = 12) Then card1 = "Queen" total = total - 12 total = total + 10 EndIf If (card2 = 12) Then card2 = "Queen" total = total - 12 total = total + 10 EndIf If (card1 = 13) Then card1 = "King" total = total - 13 total = total + 10 EndIf If (card2 = 13) Then card2 = "King" total = total - 13 total = total + 10 EndIf If (card1 = 1) Then TextWindow.WriteLine("You have been dealt a "+card2+" and an ace.") TextWindow.WriteLine("Would you like to count the ace as 1 or 11?") total = total - 1 card1 = "Ace" ace1 = TextWindow.ReadNumber() EndIf If (card2 = 1) Then TextWindow.WriteLine("You have been dealt a "+card1+" and an ace.") TextWindow.WriteLine("Would you like to count the ace as 1 or 11?") total = total - 1 card2 = "Ace" ace2 = TextWindow.ReadNumber() EndIf If (ace1 = 1) Then total = total + 1 ElseIf (ace1 = 11) Then total = total + 11 ElseIf (ace1 = 0) Then total = total + 0 ElseIf (ace1 < 0) Or (ace1 > 11) Or (ace1 > 1 And ace1 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf If (ace2 = 1) Then total = total + 1 ElseIf (ace2 = 11) Then total = total + 11 ElseIf (ace2 = 0) Then total = total + 0 ElseIf (ace2 < 0) Or (ace2 > 11) Or (ace2 > 1 And ace2 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("You have been dealt a " + card1 + " and a " + card2) TextWindow.WriteLine("Your total is: " + total) If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf TextWindow.WriteLine("Would you like a hit? (y/n) ") Alpha = TextWindow.Read() If (Alpha = "n") Then Goto DealerTurn EndIf If (Alpha = "y") Then total = total + card3 If (card3 = 11) Then total = total - 11 total = total + 10 TextWindow.WriteLine("You have been dealt a Jack.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card3 = 12) Then total = total - 12 total = total + 10 TextWindow.WriteLine("You have been dealt a Queen.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card3 = 13) Then total = total - 13 total = total + 10 TextWindow.WriteLine("You have been dealt a King.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card3 < 11) And (card3 > 1) Then TextWindow.WriteLine("You have been dealt a " + card3) TextWindow.WriteLine("Your total is " +total) ElseIf (card3 = 1) Then TextWindow.WriteLine("You have been dealt an ace.") TextWindow.WriteLine("Would you like to count it as 1 or 11?") total = total - 1 ace3 = TextWindow.ReadNumber() EndIf If (ace3 = 1) Then total = total + 1 TextWindow.WriteLine("Your total is "+total) ElseIf (ace3 = 11) Then total = total + 11 TextWindow.WriteLine("Your total is "+total) ElseIf (ace3 = 0) Then total = total + 0 ElseIf (ace3 < 0) Or (ace3 > 11) Or (ace3 > 1 And ace3 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf TextWindow.WriteLine("Would you like a hit? (y/n) ") Bravo = TextWindow.Read() If (Bravo = "n") Then Goto DealerTurn EndIf If (Bravo = "y") Then total = total + card4 If (card4 = 11) Then total = total - 11 total = total + 10 TextWindow.WriteLine("You have been dealt a Jack.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card4 = 12) Then total = total - 12 total = total + 10 TextWindow.WriteLine("You have been dealt a Queen.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card4 = 13) Then total = total - 13 total = total + 10 TextWindow.WriteLine("You have been dealt a King.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card4 < 11) And (card4 > 1) Then TextWindow.WriteLine("You have been dealt a " + card4) TextWindow.WriteLine("Your total is " +total) ElseIf (card4 = 1) Then TextWindow.WriteLine("You have been dealt an ace.") TextWindow.WriteLine("Would you like to count it as 1 or 11?") total = total - 1 ace4 = TextWindow.ReadNumber() EndIf If (ace4 = 1) Then total = total + 1 TextWindow.WriteLine("Your total is "+total) ElseIf (ace4 = 11) Then total = total + 11 TextWindow.WriteLine("Your total is "+total) ElseIf (ace4 = 0) Then total = total + 0 ElseIf (ace4 < 0) Or (ace4 > 11) Or (ace4 > 1 And ace4 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf TextWindow.WriteLine("Would you like a hit? (y/n) ") Charlie = TextWindow.Read() If (Charlie = "n") Then Goto DealerTurn EndIf If (Charlie = "y") Then total = total + card5 If (card5 = 11) Then total = total - 11 total = total + 10 TextWindow.WriteLine("You have been dealt a Jack.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card5 = 12) Then total = total - 12 total = total + 10 TextWindow.WriteLine("You have been dealt a Queen.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card5 = 13) Then total = total - 13 total = total + 10 TextWindow.WriteLine("You have been dealt a King.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card5 < 11) And (card5 > 1) Then TextWindow.WriteLine("You have been dealt a " + card5) TextWindow.WriteLine("Your total is " +total) ElseIf (card5 = 1) Then TextWindow.WriteLine("You have been dealt an ace.") TextWindow.WriteLine("Would you like to count it as 1 or 11?") total = total - 1 ace5 = TextWindow.ReadNumber() EndIf If (ace5 = 1) Then total = total + 1 TextWindow.WriteLine("Your total is "+total) ElseIf (ace5 = 11) Then total = total + 11 TextWindow.WriteLine("Your total is "+total) ElseIf (ace5 = 0) Then total = total + 0 ElseIf (ace5 < 0) Or (ace5 > 11) Or (ace5 > 1 And ace5 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf TextWindow.WriteLine("Would you like a hit? (y/n) ") Delta = TextWindow.Read() If (Delta = "n") Then Goto DealerTurn EndIf If (Delta = "y") Then total = total + card6 If (card6 = 11) Then total = total - 11 total = total + 10 TextWindow.WriteLine("You have been dealt a Jack.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card6 = 12) Then total = total - 12 total = total + 10 TextWindow.WriteLine("You have been dealt a Queen.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card6 = 13) Then total = total - 13 total = total + 10 TextWindow.WriteLine("You have been dealt a King.") TextWindow.WriteLine("Your total is "+total+".") ElseIf (card6 < 11) And (card6 > 1) Then TextWindow.WriteLine("You have been dealt a " + card6) TextWindow.WriteLine("Your total is " +total) ElseIf (card6 = 1) Then TextWindow.WriteLine("You have been dealt an ace.") TextWindow.WriteLine("Would you like to count it as 1 or 11?") total = total - 1 ace6 = TextWindow.ReadNumber() EndIf If (ace6 = 1) Then total = total + 1 TextWindow.WriteLine("Your total is "+total) ElseIf (ace6 = 11) Then total = total + 11 TextWindow.WriteLine("Your total is "+total) ElseIf (ace6 = 0) Then total = total + 0 ElseIf (ace6 < 0) Or (ace6 > 11) Or (ace6 > 1 And ace6 < 11) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("ERROR. INVALID INPUT.") TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf DealerTurn: TextWindow.WriteLine("It is the dealer's turn.") TextWindow.Pause() dtotal = dcard1 + dcard2 If (dcard1 = 11) Then dcard1 = "Jack" dtotal = dtotal - 11 dtotal = dtotal + 10 EndIf If (dcard2 = 11) Then dcard2 = "Jack" dtotal = dtotal - 11 dtotal = dtotal + 10 EndIf If (dcard1 = 12) Then dcard1 = "Queen" dtotal = dtotal - 12 dtotal = dtotal + 10 EndIf If (dcard2 = 12) Then dcard2 = "Queen" dtotal = dtotal - 12 dtotal = dtotal + 10 EndIf If (dcard1 = 13) Then dcard1 = "King" dtotal = dtotal - 13 dtotal = dtotal + 10 EndIf If (dcard2 = 13) Then dcard2 = "King" dtotal = dtotal - 13 dtotal = dtotal + 10 EndIf If (dcard1 = 1) Then dcard1 = "Ace" TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) < 22) Then dtotal = dtotal - 1 dtotal = dtotal + 11 TextWindow.WriteLine("The dealer counts the ace as 11.") ElseIf ((dtotal + 11) > 21) Then dtotal = dtotal - 1 dtotal = dtotal + 1 TextWindow.WriteLine("The dealer counts the ace as 1.") EndIf EndIf If (dcard2 = 1) Then dcard2 = "Ace" TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) < 22) Then dtotal = dtotal - 1 dtotal = dtotal + 11 TextWindow.WriteLine("The dealer counts the ace as 11.") ElseIf ((dtotal + 11) > 21) Then dtotal = dtotal - 1 dtotal = dtotal + 1 TextWindow.WriteLine("The dealer counts the ace as 1.") EndIf EndIf TextWindow.WriteLine("The dealer has been dealt a " + dcard1 + " and a " + dcard2 + ".") TextWindow.WriteLine("The dealer's total is "+dtotal) If (dtotal > total) And (dtotal <= 21) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("You lose!!!") TextWindow.ForegroundColor = "gray" money = money - gamble TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal <= total) And (dtotal < 21) Then TextWindow.WriteLine("The dealer has taken a hit!") TextWindow.Pause() If (dcard3 = 1) Then TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) > 21) Then dtotal = dtotal + 1 TextWindow.WriteLine("The dealer has counted the ace as 1.") ElseIf ((dtotal + 11) <= 21) Then dtotal = dtotal + 11 TextWindow.WriteLine("The dealer has counted the ace as 11.") EndIf ElseIf (dcard3 = 11) Then TextWindow.WriteLine("The dealer has been dealt a Jack.") dtotal = dtotal + 10 ElseIf (dcard3 = 12) Then TextWindow.WriteLine("The dealer has been dealt a Queen.") dtotal = dtotal + 10 ElseIf (dcard3 = 13) Then TextWindow.WriteLine("The dealer has been dealt a King.") dtotal = dtotal + 10 ElseIf (dcard3 >= 1) And (dcard3 <= 10) Then TextWindow.WriteLine("The dealer has been dealt a " + dcard3 + ".") dtotal = dtotal + dcard3 EndIf TextWindow.WriteLine("The dealer's total is " + dtotal + ".") EndIf If (dtotal > 21) Then TextWindow.WriteLine("The dealer bust!!!") money = money + gamble TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("You win!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $" + money) TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal > total) And (dtotal <= 21) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("You lose!!!") money = money - gamble TextWindow.ForegroundColor = "gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal = 21) And (total = 21) Then TextWindow.WriteLine("Tie!") TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal <= total) And (dtotal < 21) Then TextWindow.WriteLine("The dealer has taken a hit!") TextWindow.Pause() If (dcard4 = 1) Then TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) > 21) Then dtotal = dtotal + 1 TextWindow.WriteLine("The dealer has counted the ace as 1.") ElseIf ((dtotal + 11) <= 21) Then dtotal = dtotal + 11 TextWindow.WriteLine("The dealer has counted the ace as 11.") EndIf ElseIf (dcard4 = 11) Then TextWindow.WriteLine("The dealer has been dealt a Jack.") dtotal = dtotal + 10 ElseIf (dcard4 = 12) Then TextWindow.WriteLine("The dealer has been dealt a Queen.") dtotal = dtotal + 10 ElseIf (dcard4 = 13) Then TextWindow.WriteLine("The dealer has been dealt a King.") dtotal = dtotal + 10 ElseIf (dcard4 >= 1) And (dcard4 <= 10) Then TextWindow.WriteLine("The dealer has been dealt a " + dcard4 + ".") dtotal = dtotal + dcard4 EndIf TextWindow.WriteLine("The dealer's total is " + dtotal + ".") EndIf If (dtotal > total) And (dtotal <= 21) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("You lose!!!") TextWindow.ForegroundColor = "gray" money = money - gamble TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal > 21) Then TextWindow.WriteLine("The dealer bust!!!") money = money + gamble TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("You win!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $" + money) TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal = 21) And (total = 21) Then TextWindow.WriteLine("Tie!") TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal <= total) And (dtotal < 21) Then TextWindow.WriteLine("The dealer has taken a hit!") TextWindow.Pause() If (dcard5 = 1) Then TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) > 21) Then dtotal = dtotal + 1 TextWindow.WriteLine("The dealer has counted the ace as 1.") ElseIf ((dtotal + 11) <= 21) Then dtotal = dtotal + 11 TextWindow.WriteLine("The dealer has counted the ace as 11.") EndIf ElseIf (dcard5 = 11) Then TextWindow.WriteLine("The dealer has been dealt a Jack.") dtotal = dtotal + 10 ElseIf (dcard5 = 12) Then TextWindow.WriteLine("The dealer has been dealt a Queen.") dtotal = dtotal + 10 ElseIf (dcard5 = 13) Then TextWindow.WriteLine("The dealer has been dealt a King.") dtotal = dtotal + 10 ElseIf (dcard5 >= 1) And (dcard5 <= 10) Then TextWindow.WriteLine("The dealer has been dealt a " + dcard5 + ".") dtotal = dtotal + dcard5 EndIf TextWindow.WriteLine("The dealer's total is " + dtotal + ".") EndIf If (dtotal > total) And (dtotal <= 21) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("You lose!!!") TextWindow.ForegroundColor = "gray" money = money - gamble TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal > 21) Then TextWindow.WriteLine("The dealer bust!!!") money = money + gamble TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("You win!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $" + money) TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal = 21) And (total = 21) Then TextWindow.WriteLine("Tie!") TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal <= total) And (dtotal < 21) Then TextWindow.WriteLine("The dealer has taken a hit!") TextWindow.Pause() If (dcard6 = 1) Then TextWindow.WriteLine("The dealer has been dealt an ace.") If ((dtotal + 11) > 21) Then dtotal = dtotal + 1 TextWindow.WriteLine("The dealer has counted the ace as 1.") ElseIf ((dtotal + 11) <= 21) Then dtotal = dtotal + 11 TextWindow.WriteLine("The dealer has counted the ace as 11.") EndIf ElseIf (dcard6 = 11) Then TextWindow.WriteLine("The dealer has been dealt a Jack.") dtotal = dtotal + 10 ElseIf (dcard6 = 12) Then TextWindow.WriteLine("The dealer has been dealt a Queen.") dtotal = dtotal + 10 ElseIf (dcard6 = 13) Then TextWindow.WriteLine("The dealer has been dealt a King.") dtotal = dtotal + 10 ElseIf (dcard6 >= 1) And (dcard6 <= 10) Then TextWindow.WriteLine("The dealer has been dealt a " + dcard5 + ".") dtotal = dtotal + dcard6 EndIf TextWindow.WriteLine("The dealer's total is " + dtotal + ".") EndIf If (dtotal > total) And (dtotal <= 21) Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("You lose!!!") TextWindow.ForegroundColor = "gray" money = money - gamble TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal > 21) Then TextWindow.WriteLine("The dealer bust!!!") money = money + gamble TextWindow.ForegroundColor = "Green" TextWindow.WriteLine("You win!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $" + money) TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (total > 21) Then TextWindow.WriteLine("You bust!!!") money = money - gamble TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("You lose!") TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("You now have $"+money) TextWindow.Pause() If (money <= 0) Then TextWindow.WriteLine("You are out of money!") TextWindow.WriteLine("Game over!") TextWindow.Pause() Program.End() EndIf TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf If (dtotal = 21) And (total = 21) Then TextWindow.WriteLine("Tie!") TextWindow.Pause() TextWindow.WriteLine("Would you like to play another hand? (y/n)") omega = TextWindow.Read() omega = Text.ConvertToLowerCase(omega) If omega = "y" Then Goto Start Else TextWindow.WriteLine("Game Over!") TextWindow.WriteLine("Your score is $"+money) TextWindow.Pause() Program.End() EndIf EndIf End>RRV302.sb< Start>RRW897.sb< 'Small Basic Challenge of the Month - September 2011 'Easy Challenge 'Use the SmallBASIC Turtle to write your name (or anything else) on the screen. 'Attempt 1. 'Below simply sets up the GraphicsWindow. gw = 800 gh = 800 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) /2 GraphicsWindow.Top = (Desktop.Height - gh) /2 GraphicsWindow.Title = "Challenge of the Month - September 2011 (Easy)" GraphicsWindow.Show() GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(1, 1, "Challenge of the Month - September 2011 (Easy)") GraphicsWindow.DrawText(1, 20"Objective: Use the SmallBASIC Turtle to write your name (or anything else) on the screen.") 'J Turtle.X = 200 Turtle.Y = 200 Turtle.Angle = 180 Turtle.Speed = 8 Turtle.Move(300) numberOfMoves = 100 angle1 = 180 / numberOfMoves For i = 1 To numberOfMoves Turtle.Turn(angle1) Turtle.Move(2) EndFor 'E Turtle.PenUp() Turtle.X = 250 Turtle.Y = 200 Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(350) Turtle.TurnLeft() Turtle.Move(100) Turtle.PenUp() Turtle.X = 250 Turtle.Y = 375 Turtle.PenDown() Turtle.Move(100) Turtle.PenUp() Turtle.X = 250 Turtle.Y = 200 Turtle.PenDown() Turtle.Move(100) 'S Turtle.PenUp() Turtle.X = 500 Turtle.Y = 250 Turtle.Angle = 0 Turtle.PenDown() s = 100 angle2 = -210/100 For i = 1 To s Turtle.Turn(angle2) Turtle.Move(2.2) EndFor Turtle.Move(220) s = 100 angle2 = 210/100 For i = 1 To s Turtle.Turn(angle2) Turtle.Move(2.2) EndFor 'S Turtle.PenUp() Turtle.X = 650 Turtle.Y = 250 Turtle.Angle = 0 Turtle.PenDown() s = 100 angle2 = -210/100 For i = 1 To s Turtle.Turn(angle2) Turtle.Move(2.2) EndFor Turtle.Move(220) s = 100 angle2 = 210/100 For i = 1 To s Turtle.Turn(angle2) Turtle.Move(2.2) EndFor Turtle.Hide() End>RRW897.sb< Start>RRZ478-0.sb< V1 = "Anton" V2 = "Anton" V1 = Text.ConvertToUpperCase(V1) V2 = Text.ConvertToUpperCase(V2) TextWindow.WriteLine(V1) TextWindow.WriteLine(V2) TestString() If (Val1 < Val2) Then TextWindow.Write(V1) TextWindow.Write(" < ") TextWindow.Write(V2) EndIf If (Val1 > Val2) Then TextWindow.Write(V1) TextWindow.Write(" > ") TextWindow.Write(V2) EndIf If (Val1 = Val2) Then TextWindow.Write(V1) TextWindow.Write(" = ") TextWindow.Write(V2) EndIf Sub TestString char = 0 Val1 = -1 Val2 = -1 While (Val1 = Val2 And char < Text.GetLength(V1) And char < Text.GetLength(V2)) char = char+1 Val1 = Text.GetCharacterCode(Text.GetSubText(V1,char,1)) Val2 = Text.GetCharacterCode(Text.GetSubText(V2,char,1)) EndWhile EndSub End>RRZ478-0.sb< Start>RRZ478-1.sb< V1 = "Antonxxx" V2 = "Anton" V1 = Text.ConvertToUpperCase(V1) V2 = Text.ConvertToUpperCase(V2) TextWindow.WriteLine(V1) TextWindow.WriteLine(V2) 'Test the strings V1 and V2 'The relative values of Val1 and Val2 indicate which is smaller (alphabetically) 'The absolute values of Val1 and Val2 are somewhat meaningless TestString() If (Val1 < Val2) Then TextWindow.Write(V1) TextWindow.Write(" < ") TextWindow.WriteLine(V2) EndIf If (Val1 > Val2) Then TextWindow.Write(V1) TextWindow.Write(" > ") TextWindow.WriteLine(V2) EndIf If (Val1 = Val2) Then TextWindow.Write(V1) TextWindow.Write(" = ") TextWindow.WriteLine(V2) EndIf Sub TestString char = 0 Val1 = -1 Val2 = -1 'Loop through characters until they are not equal - we have an inequality 'When we get to the end of a string the character code returned is zero - both will only be zero if the strings are identically equal While (Val1 = Val2 And Val1*Val2 > 0) char = char+1 Val1 = Text.GetCharacterCode(Text.GetSubText(V1,char,1)) Val2 = Text.GetCharacterCode(Text.GetSubText(V2,char,1)) EndWhile EndSub End>RRZ478-1.sb< Start>RRZ478.sb< V1 = "Anton" V2 = "Berta" V1 = Text.ConvertToUpperCase(V1) V2 = Text.ConvertToUpperCase(V2) TextWindow.WriteLine(V1) TextWindow.WriteLine(V2) If (V1 < V2) Then TextWindow.Write(V1) TextWindow.Write(" < ") TextWindow.Write(V2) EndIf If (V1 > V2) Then TextWindow.Write(V1) TextWindow.Write(" > ") TextWindow.Write(V2) EndIf If (V1 = V2) Then TextWindow.Write(V1) TextWindow.Write(" = ") TextWindow.Write(V2) EndIf End>RRZ478.sb< Start>RRZ656.sb< args=0 GraphicsWindow.BackgroundColor ="teal GraphicsWindow .PenWidth =1 GraphicsWindow .PenColor ="lime GraphicsWindow.Width=800 GraphicsWindow.Height =800 GraphicsWindow.Left =5 GraphicsWindow .Top=0 L3000=1900 'TextWindow.WriteLine (">>") GraphicsWindow.KeyDown =kkk LDEvents.MouseWheel =mww For f=0 to 3 'LDGraphicsWindow .PauseUpdates () T_x=376 T_y=370 t_Angle =f*45 ff=-1 ddrw() T_X =376 T_Y=372 T_Angle =f*45 ff=1 ddrw() EndFor Sub ddrw b=0 For i = 1 To L3000 j=Math.Remainder ((i-7) 20+b)'<<<<<<<<<<---------------- If i<7 or (J>10 And j<18+b) Then pdd="true else pdd="false endif if j=0 then b=1-b endif GraphicsWindow.penColor = LDColours.HSLtoRGB(120+f*30 1 .8-i/5000) 'Math.Remainder (i 2)/2+.2)' GraphicsWindow.PenWidth =4-i/1000 ldcall.Function("t_Move", ff*(5-i/1000)) t_Angle=t_Angle+(i*16.18) GraphicsWindow .Title=ic EndFor EndSub Sub kkk If Math.Remainder(ck 2)=1 Then TextWindow.WriteLine (i) Else TextWindow.Write (i+" -> ") EndIf ck=ck+1 EndSub Sub mww If Mouse.IsLeftButtonDown Then an=an+ LDEvents.LastMouseWheelDelta *3 else scc=scc+ LDEvents.LastMouseWheelDelta/10 endif LDGraphicsWindow.Reposition (scc scc 0 0 an) EndSub sub t_Move ds=args[1] mm=LDMath.Convert2Cartesian (t_x,t_y,ds, t_Angle-90 ) rr=math.Remainder (i-7 35) If pdd Then shapes.AddLine (T_x T_y mm[1] mm[2]) ic=ic+1 EndIf oa=t_Angle t_x= (mm[1]) t_y= (mm[2]) EndSub End>RRZ656.sb< Start>RSC028.sb< GraphicsWindow.BackgroundColor="midnightblue dw=desktop.Width dh=desktop.Height GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 clrz=LDText.Split("red lime lightblue cyan magenta yellow tan orange gray teal brown black" " ") 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 zo=LDText.Split("1 2 3 4 5 6 3 4 6 6 1 3" " ") view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddAmbientLight(view3D "#22555555") LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10) LD3DView.AddDirectionalLight (view3D,"white" ,-1,-1,-1) LD3DView.AutoControl2 (1 1) ss=":" For n=1 To 61 pt=pt+LDMath.Sin(n*6)*3+ss+LDMath.cos(n*6)*3+ss+"0"+ss EndFor For x=0 To 1 For y=0 To 1 o1=LD3DView.AddTube(view3D,pt .5 10 clrz[1],"D") LD3DView.TranslateGeometry(view3D o1 x*7 y*7 0) EndFor EndFor o1=LD3DView.AddTube(view3D,"-2:0:0 2:0:0" .5 10 clrz[2],"D") o11=LD3DView.AddTube(view3D,"0:0:0 4:0:0" .5 10 clrz[2],"D") LD3DView.TranslateGeometry(view3D o11 5 0 0) LD3DView.SetCentre(view3D o11 2 0 0 "R1R2R3") o21=LD3DView.AddTube(view3D,"-2:7:0 2:7:0" .5 10 clrz[2],"D") o31=LD3DView.AddTube(view3D,"0:7:0 4:7:0" .5 10 clrz[2],"D") LD3DView.TranslateGeometry(view3D o31 5 0 0) LD3DView.SetCentre(view3D o31 2 7 0 "R1R2R3") GraphicsWindow.Title="3D drone v0.1 For a=0 To 36000 Step 4 LD3DView.RotateGeometry(view3D o1 0 0 1 a) LD3DView.RotateGeometry(view3D o11 0 0 1, -a) LD3DView.RotateGeometry(view3D o31 0 0 1 a) LD3DView.RotateGeometry(view3D o21 0 0 1, -a) Program.Delay(2) EndFor End>RSC028.sb< Start>RSG598.sb< 'PRESS F5 OR RUN GraphicsWindow.Show() GraphicsWindow.Title = "StickRPG 2.0" GraphicsWindow.Width =Desktop.Width GraphicsWindow.Height =Desktop.Height - 250 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 TextWindow.Show() TextWindow.Title = "StickRPG 2.0" TextWindow.BackgroundColor = "Blue" TextWindow.ForegroundColor = "White" TextWindow.WriteLine("Stick RPG- 2.0") TextWindow.WriteLine("Please move the TextWindow into the bottom section of the screen.") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Instructions:") TextWindow.WriteLine("You control the character by using the Arrow keys.") TextWindow.WriteLine("The blue section of the screen will be your status bar. This is where your Stats (Health, sleep, etc.) will appear.") TextWindow.WriteLine("The white section of the screen will be your game section, where you interact with the game and move your character.") TextWindow.WriteLine("When you are ready,") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Please type in your character's name CAREFULLY.") name = TextWindow.Read() Textwindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Your character's name is " + name + ", correct?") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Please type in the color you want your character to be: Red or Blue (exactly how they are written here).") TextWindow.WriteLine("Note: more colors will be avalible later in the game.") col = TextWindow.Read() TextWindow.Pause() TextWindow.Clear() If col = "Red" then color = "Red" Else If col = "Blue" Then color = "Blue" Else TextWindow.WriteLine("your character's color was unrecognized. It will be the default color, Blue.") color = "Blue" TextWindow.Pause() TextWindow.Clear() EndIf EndIf TextWindow.WriteLine("Your character's stats are as follows:") TextWindow.WriteLine("15 strength") TextWindow.WriteLine("10 intelligence") TextWindow.WriteLine("$100 and a job at McStick's") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Remember, your character's color is " + color + ".") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Warning: if you too hungry, too thirsty, too tired, or too injured then you will die") TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Press any key to begin.") TextWindow.Pause() drawcity1() Drawcharacter() Timer.Interval = 500 Timer.Resume() sleep = 3 hunger = 15 strength = 15 AChealth = 10 + strength intellegence = 10 Time = 1 day = 1 death = 1 houseoptions = 0 health = AChealth thirst = 10 sleepnum = 10 money = 100 works = 1 entertainmentlevel = 0 phone = 0 sleepsettings = 0 timedot = 0 Tuition = 0 grade = 9 candystandowned = 0 computer = 0 jail = 0 tv = 0 cdplayer = 0 seconds = 0 minutes = 0 hours = 0 cd1 = 0 gun = 0 ammo = 0 houselevel = 0 losthealth = 0 orangeowned = 0 yellowowned = 0 greenowned = 0 purpleowned = 0 membership = 0 busticket = 0 characterdot = 0 x2 = 0 y2 = 0 image3 = "https://images.gr-assets.com/books/1374503921l/18221280.jpg" image2 = "https://images.gr-assets.com/books/1388338606l/8306745.jpg" image1= "http://disabilityinkidlit.com/dikl/wp-content/uploads/2015/12/michaelvey.jpg" image4 = "https://images.gr-assets.com/books/1398631518l/20342545.jpg" image5 = "https://upload.wikimedia.org/wikipedia/en/thumb/d/dc/The_Hunger_Games.jpg/220px-The_Hunger_Games.jpg" image6 = "https://images.gr-assets.com/books/1384021423l/17197651.jpg" image7 = "http://harrypotterfanzone.com/wp-content/2009/06/ss-us-jacket-art.jpg" image8 = "https://upload.wikimedia.org/wikipedia/en/c/ce/Eragon_book_cover.png" jobdot = 0 nonfictionbook = 0 comedybook = 0 usedatlas = 0 exercisebook = 0 atlasworthy = 0 'note: extend this into an alternate, endgame thing '============================================Events=============================================================================================== GraphicsWindow.KeyDown = MoveCycle Controls.ButtonClicked = buttons Timer.Tick = ticker '==========================================Subroutines============================================================================================== Sub MoveCycle key= GraphicsWindow.LastKey delX = 0 delY = 0 If (key = "Up") Then delY = -2 ElseIf (key = "W") then delY = -2 ElseIf (key = "Down") Then delY = 2 elseif (key = "S") then delY = 2 ElseIf (key = "Left") Then delX = -2 elseif (key = "A") then delX = -2 ElseIf (key = "Right") Then delX = 2 elseif (key = "D") then delX = 2 EndIf X = Shapes.GetLeft(Character) Y = Shapes.GetTop(Character) If characterdot = 0 Then Shapes.Move(Character, X + delX, Y + delY) EndIf EndSub '========== Sub statsbar TextWindow.Clear() AChealth = 10 + strength TextWindow.WriteLine(" " + name + " Health: " + health + "/" + AChealth + " Money: $" + money + " Sleep: " + sleep + " Hunger: " + hunger + " Thirst: " + thirst + " strength: " + strength + " Intellegence: " + intellegence + " Time: " + Time + " Day " + day + " ") If candystandowned = 1 Then If location = "candy" Then TextWindow.WriteLine("You have " + candies + " candies.") EndIf EndIf timesensor() EndSub '========== Sub pausebuttons timer.Pause() xpause = Shapes.GetLeft(Character) ypause = Shapes.GetTop(Character) GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = white GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 55 GraphicsWindow.DrawText(50,50,"Pause Menu") GraphicsWindow.DrawLine(50,113,420,113) GraphicsWindow.FontSize = 40 GraphicsWindow.DrawText(50,200,"Intellegence: " + intellegence) GraphicsWindow.DrawText(50,260,"Strength: " + strength) GraphicsWindow.DrawText(50,320,"Money: " + money) GraphicsWindow.DrawText(50,380,"Health: " + health + "/" + AChealth) GraphicsWindow.DrawText(50,440,"Hunger: " + hunger) GraphicsWindow.DrawText(50,500,"Thirst: " + thirst) GraphicsWindow.DrawText(50,560,"Time: " + time) GraphicsWindow.DrawText(50,620,"Day " + day) quitbutton = Controls.AddButton("Quit Game",250,680) Resumebutton = Controls.AddButton("Resume",60,680) EndSub '=========== Sub sleeps If sleepsettings = 0 Then Time = Time + 10 sleep = sleep + 1 If AChealth - health <= 19 Then health = AChealth Else health = health + 20 EndIf ticker() statsbar() houseoptions = 10 home() EndIf EndSub '========= Sub idied timer.Pause() GraphicsWindow.Clear() GraphicsWindow.Hide() TextWindow.Clear() TextWindow.BackgroundColor = red TextWindow.WriteLine("You played for " + hours + " hours, " + minutes + " minutes, and " + seconds + " seconds.") TextWindow.WriteLine("You died by " + death + ".") TextWindow.WriteLine("Thank you for playing Stick RPG 2.0") Program.Delay(3500) TextWindow.Clear() Textwindow.WriteLine("Credits:") TextWindow.WriteLine("Programmer: Jake Bauer") TextWindow.WriteLine("Animator: Jake Bauer") TextWindow.WriteLine("Writer: Jake Bauer") TextWindow.WriteLine("Stick RPG, Stick RPG Complete, and Stick RPG 2 by XGen Studios") Program.Delay(3500) Program.End() EndSub '========= Sub timesensor If Time > 24 Then Time = Time - 24 day = day + 1 hunger = hunger - 5 thirst = thirst - 2 sleep = sleep - 1 EndIf EndSub '=========== Sub deathsub If health < 0 Then death = "suffering too much damage" idied() elseif thirst < 0 then death = "not drinking enough liquids" idied() elseif hunger < 0 then death = "starving" idied() elseif sleep < 0 then death = "not getting enough sleep" idied() elseif jail = 1 then death = "going to jail for the rest of your life" idied() EndIf EndSub '======== Sub ticker If timedot = 0 Then statsbar() locations() locationsensor() deathsub() timesensor() realtime() ElseIf timedot = 1 then timesensor() statsbar() deathsub() realtime() EndIf If candystandowned = 1 Then candyadd() EndIf EndSub '========== Sub houseleave clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,22,102) Program.Delay(500) timedot = 0 EndSub '=========== Sub Drawcharacter If color = "Red" Then charactercolor = red Elseif color = "Blue" Then charactercolor = blue elseif color = "Orange" Then charactercolor = orange elseif color = "Yellow" then charactercolor = yellow elseif color = "Green" then charactercolor = lime elseif color = "Purple" then charactercolor = purple Else charactercolor = blue EndIf GraphicsWindow.BrushColor = charactercolor If characterdot = 0 then Character = Shapes.AddEllipse(15,15) EndIf EndSub '========== Sub clear TextWindow.Clear() GraphicsWindow.Clear() EndSub '========== Sub enter timedot = 1 clear() GraphicsWindow.BackgroundColor = white GraphicsWindow.FontSize = 22 GraphicsWindow.BrushColor = blue EndSub '========== Sub realtime seconds = seconds + 1 If seconds >= 60 Then seconds = seconds - 60 minutes = minutes + 1 EndIf if minutes >= 60 Then minutes = minutes - 60 hours = hours + 1 EndIf EndSub '========== Sub candyadd candyaddvariable5 = candyaddvariable5 + 1 If candyaddvariable5 >= 2 Then candyaddvariable5 = candyaddvariable5 - 2 candies = candies + 1 EndIf EndSub '==============================================Objectives================================================================================================================== 'Objective #1: create buttons (using Controls.AddButton) for the current interfaces 'Objectve #2: here is a list of all of the buildings that need/can need to be built: 'college! 'Car store(?) 'dollar store(?) '=========================================Interface=Subs================================================================================================================== Sub home enter() If houseoptions = 0 Then sleepbutton = Controls.AddButton("Sleep (" + sleepnum +" hours)",200,100) kitchenbutton = Controls.AddButton("Enter Kitchen",200,150) leavebutton = Controls.AddButton("Leave House",400,750) officebutton = Controls.AddButton("Enter Office",200,200) livingroom = Controls.AddButton("Enter Living Room",200,250) playmusicroom = Controls.AddButton("Play Music",200,300) changeclothes = Controls.AddButton("Change Clothes/Colors",200,350) If phone = 1 Then messages = Controls.AddButton("Check Messages",300,100) EndIf ElseIf houseoptions = 1 then enterpantry = Controls.AddButton("Check Pantry",200,100) If pbsandwiches>= 1 then eatapbsandwichbutton = Controls.AddButton("Eat a PB&J Sandwich (+10 hunger)",200,150) EndIf If toast>= 1 then eattoastbutton = Controls.AddButton("Eat a Piece of Toast (+2 hunger)",200,200) EndIf leavekitchen = Controls.AddButton("Leave Kitchen",400,750) Elseif houseoptions = 2 then homeworks = Controls.AddButton("Do Homework",200,100) If computer = 1 then computerbutton = Controls.AddButton("Use Computer",200,200) EndIf leaveoffice = Controls.AddButton("Leave Office",400,750) elseif houseoptions = 3 then If tv = 1 then watchtvbutton = Controls.AddButton("Watch TV",200,200) EndIf If nonfictionbook = 1 then readnonfictionbookbutton = Controls.AddButton("Read one of your nonfiction books",200,250) EndIf If exercisebook = 1 then readexercisebookbutton = Controls.AddButton("Read one of your workout books",200,300) EndIf If comedybook = 1 then readnonfictionbookbutton = Controls.AddButton("Read one of your nonfiction books",200,350) EndIf If usedatlas = 1 then openusedatlasbutton = Controls.AddButton("Open your heavily used, ancient-looking atlas",200,400) EndIf leavebutton2 = Controls.AddButton("Leave Living Room",400,750) elseif houseoptions = 15 then If breadslices>= 2 then toastbutton = Controls.AddButton("Make a Slice of Toast",200,200) If pbservings>= 1 then If jellyservings>=1 then pbjsandwichbutton = Controls.AddButton("Make A PB&J Sandwich",200,250) EndIf EndIf EndIf leavepantrybutton = Controls.AddButton("Leave Pantry",400,750) elseif houseoptions = 25 then intellegence = intellegence + 1 Time = Time + 1 GraphicsWindow.FontSize = 45 GraphicsWindow.DrawText(200,100,"Intelligence Increased!!!") GraphicsWindow.DrawText(250,150,intellegence) GraphicsWindow.FontSize = 25 homeworkokbutton = Controls.AddButton(" OK ",250,250) elseif houseoptions = 10 then GraphicsWindow.FontSize = 40 GraphicsWindow.DrawText(200,100,"Health Restored!") GraphicsWindow.DrawText(200,150,"Sleep Increased (" + sleep + ")") GraphicsWindow.DrawText(200,200,"Hunger : " + hunger) GraphicsWindow.DrawText(200,250,"Thirst: " + thirst) GraphicsWindow.DrawText(200,300,"Time: " + Time ) GraphicsWindow.DrawText(200,350,"Day " + day) GraphicsWindow.FontSize = 25 okaysleepbutton1 = Controls.AddButton(" OK ",210,450) elseif houseoptions = 4 then If cdplayer = 1 then If cd1 = 1 then cd1playbutton = Controls.AddButton("Play CD #1",200,200) EndIf EndIf leavemusicbutton = Controls.AddButton("Leave",400,750) Elseif houseoptions = 35 then tvchannel1button = Controls.AddButton("Channel 1: News",200,200) tvchannel2button = Controls.AddButton("Channel 2: Bodybuilding",200,250) turnofftvbutton = Controls.AddButton("Turn Off TV",400,750) elseif houseoptions = 351 then intellegence = intellegence + 2 Time = Time + 2 GraphicsWindow.DrawText(200,100,"Intelligence Increased!!!") GraphicsWindow.DrawText(250,150,intellegence) GraphicsWindow.FontSize = 25 okchannel1button = Controls.AddButton("OK",250,250) elseif houseoptions = 352 then strength = strength + 1 Time = Time + 2 GraphicsWindow.DrawText(200,100,"Strength Increased!!!") GraphicsWindow.DrawText(250,150,strength) GraphicsWindow.FontSize = 25 okchannel2button = Controls.AddButton("OK",250,250) elseif houseoptions = 5 then If orangeowned = 1 then changeobutton = Controls.AddButton("Change Into Orange Clothes",200,250) EndIf If yellowowned = 1 then changeybutton = Controls.AddButton("Change Into Yellow Clothes",200,300) EndIf If greenowned = 1 then changegbutton = Controls.AddButton("Change Into Green Clothes",200,350) EndIf If purpleowned = 1 then changepbutton = Controls.AddButton("Change Into Purple Clothes",200,450) EndIf changebbutton = Controls.AddButton("Change Into Blue Clothes",200,400) changerbutton = Controls.AddButton("Change Into Red Clothes",200,200) okclothesbutton = Controls.AddButton("OK",400,750) EndIf EndSub '============== Sub McSticks enter() sodabutton = Controls.AddButton("Buy Soda",200,100) Milkshakebutton = Controls.AddButton("Buy Milkshake",200,175) nuggetsbutton = Controls.AddButton("Buy McNuggets",200,250) friesbutton = Controls.AddButton("Buy Fries",200,325) burgerbutton = Controls.AddButton("Buy Cheeseburger",200,400) If jobdot = 0 then workmcbutton = Controls.AddButton("Work (1x)",200,485) EndIf leavemcbutton = Controls.AddButton("Leave",400,750) GraphicsWindow.FontSize = 17 GraphicsWindow.DrawText(200,145,"$5, Thirst +2") GraphicsWindow.DrawText(200,220,"$7, Hunger +2, Thirst +2") GraphicsWindow.DrawText(200,295,"$12, Hunger +5") GraphicsWindow.DrawText(200,370,"$10, Hunger +4") GraphicsWindow.DrawText(200,445,"$15, Hunger +10") If jobdot = 0 Then GraphicsWindow.DrawText(200,530,"($5/Hr.)") EndIf EndSub '============= Sub highschool enter() If highschooldot = 0 Then studybutton = Controls.AddButton("Study",200,100) gotoclassbutton = Controls.AddButton("Go to Class ($5 without tuition)",200,150) takeatestbutton = Controls.AddButton("Take A Test",200,200) Tuitionoptionsbutton = Controls.AddButton("Tuition Options",200,250) graduategradebutton = Controls.AddButton("Graduate Grade",200,300) GraphicsWindow.DrawText(200,350,"You are in grade " + grade) leavehighschoolbutton = Controls.AddButton("Leave",200,750) ElseIf highschooldot = 1 then intellegence = intellegence + 1 Time = Time + 1 GraphicsWindow.FontSize = 45 GraphicsWindow.DrawText(200,100,"Intelligence Increased!!!") GraphicsWindow.DrawText(250,150,intellegence) GraphicsWindow.FontSize = 25 okstudybutton = Controls.AddButton(" OK ",250,250) elseif highschooldot = 2 then If Tuition = 0 then money = money - 5 intellegence = intellegence + 2 Time = Time + 1 elseif Tuition = 1 then intellegence = intellegence + 2 Time = Time + 1 endif GraphicsWindow.DrawText(200,100,"Intelligence Increased!!!") GraphicsWindow.DrawText(250,150,intellegence) GraphicsWindow.DrawText(250,200,"You have $" + money) okayclassbutton = Controls.AddButton(" OK ",250,250) elseif highschooldot = 3 then If intellegence < 30 then GraphicsWindow.DrawText(200,100,"Test failed. :-( ") Else GraphicsWindow.DrawText(200,100,"Test passed! You now have a tuition!!!") Tuition = 1 endif okaytestbutton = Controls.AddButton(" OK ",250,250) elseif highschooldot = 4 then If Tuition = 0 then GraphicsWindow.DrawText(200,100,"You can either pass a test (over 30 intelligence) or you can buy one for $30.") GraphicsWindow.DrawText(200,150,"Your intelligence is " + intellegence) takeatest2button = Controls.AddButton("Take a test",200,200) buyatuitionbutton = Controls.AddButton("Buy a tuition",200,250) elseif Tuition = 1 then GraphicsWindow.DrawText(200,100,"You already have a tuition.") EndIf okaytuitionoptionsbutton = Controls.AddButton(" OK ",250,350) elseif highschooldot = 5 then GraphicsWindow.DrawText(200,200,"You are in grade " + grade) GraphicsWindow.DrawText(200,250,"You can gradutate/advance a grade by taking a graduation test. You must have a certain number of intelligence:") GraphicsWindow.DrawText(200,300,"9 => 10: 50 intelligence.") GraphicsWindow.DrawText(200,350,"10 => 11: 75 intelligence.") GraphicsWindow.DrawText(200,400,"11 => 12: 100 intelligence.") GraphicsWindow.DrawText(200,450,"12 => Graduated: 150 intelligence.") takegraduationtestbutton = Controls.AddButton("Take graduation/advancement test",200,500) okaygraduationbutton = Controls.AddButton("OK",200,750) Elseif highschooldot = 6 then If grade = 9 then If intellegence > 49 then GraphicsWindow.DrawText(200,200,"Test passed! You are now in 10th grade!") grade = 10 Else GraphicsWindow.DrawText(200,200,"Test failed. :-( ") EndIf elseIf grade = 10 then If intellegence > 74 then GraphicsWindow.DrawText(200,200,"Test passed! You are now in 11th grade!") grade = 11 Else GraphicsWindow.DrawText(200,200,"Test failed. :-( ") EndIf elseIf grade = 11 then If intellegence > 99 then GraphicsWindow.DrawText(200,200,"Test passed! You are now in 12th grade!") grade = 12 Else GraphicsWindow.DrawText(200,200,"Test failed. :-( ") EndIf elseIf grade = 12 then If intellegence > 149 then GraphicsWindow.DrawText(200,200,"Test passed! You are now graduated!") grade = 13 Else GraphicsWindow.DrawText(200,200,"Test failed. :-( ") EndIf EndIf okaygraduationtestbutton = Controls.AddButton("OK",200,250) EndIf EndSub '============= Sub candy enter() Buyalollipopbutton = Controls.AddButton("Buy a Lollipop ($2, Hunger +2)",200,200) If candystandowned = 1 Then workatthhecandystandbutton = Controls.AddButton("Work at the Candy Stand ($10/hr.)",200,250) Else buythecandyshopscandystandbutton = Controls.AddButton("Buy The Candy Shop's Candy Stand ($500, $10/hour)",200,250) EndIf leavecandybutton = Controls.AddButton("Leave",250,750) EndSub '============= Sub electronicsstore enter() If computer = 0 Then buycomputerbutton = Controls.AddButton("Buy a Computer ($1000)",200,200) EndIf If tv = 0 then buytvbutton = Controls.AddButton("Buy a TV ($500)",200,250) EndIf If phone = 0 Then buyaphonebutton = Controls.AddButton("Buy a Phone ($100)",200,300) EndIf If cdplayer = 0 Then buyacdplayerbutton = Controls.AddButton("Buy a CD Player ($50)",200,350) EndIf leaveelectronicsstorebutton = Controls.AddButton("Leave",250,750) EndSub '============= Sub generalstore enter() If generalstoredot = 0 Then aisle1button = Controls.AddButton("Aisle 1: Food",200,200) aisle2button = Controls.AddButton("Aisle 2: Drinks",200,250) aisle3button = Controls.AddButton("Aisle 3: Other",200,300) leavegeneralstorebutton = Controls.AddButton("Leave",400,750) If gun = 1 Then If ammo >= 20 Then robstorebutton = Controls.AddButton("Rob the Store",200,700) EndIf EndIf ElseIf generalstoredot = 1 then buybreadbutton = Controls.AddButton("Buy a Loaf of Bread ($20, 10 slices)",200,200) aisle1leavebutton = Controls.AddButton("Leave Aisle",400,750) Elseif generalstoredot = 2 then aisle2leavebutton = Controls.AddButton("Leave Aisle",400,750) elseif generalstoredot = 3 then buypeanutbutterbutton = Controls.AddButton("Buy a Jar of Peanut Butter ($5, 10 servings)",200,200) buyjellybutton= Controls.AddButton("Buy a Jar of Jelly ($5, 10 servings)",200,250) aisle3leavebutton = Controls.AddButton("Leave Aisle",400,750) EndIf EndSub '============= Sub teenstore enter() If cd1 = 0 Then buycd1button = Controls.AddButton("Buy CD #1 ($10)",200,200) EndIf leaveteenstorebutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub gunsandammunition enter() If gun = 0 then buyagun = Controls.AddButton("Buy a Handgun ($200)",200,200) Else buyammobutton = Controls.AddButton("Buy 10x Ammo ($5)",200,200) EndIf leavegunstorebutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub houseupgrades enter() If houselevel = 0 Then housetocondobutton = Controls.AddButton("Upgrade House => Condo ($1500)",200,200) ElseIf houselevel = 1 then condotomansion = Controls.AddButton("Upgrade Condo => Mansion ($2000)",200,200) elseif houselevel = 2 then mansiontocastlebutton = Controls.AddButton("Upgrade Mansion => Castle ($3000)",200,200) EndIf leavehouseupgradestore = Controls.AddButton("Leave",400,750) EndSub '============= Sub hospital enter() If health < AChealth Then healbutton = Controls.AddButton("Heal ($1/hp)",200,200) EndIf leavehospitalbutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub clothingstore enter() If orangeowned = 0 Then buyorangebutton = Controls.AddButton("Buy Orange Suit ($20)",200,200) EndIf If yellowowned = 0 Then buyyellowbutton = Controls.AddButton("Buy Yellow Suit ($20)",200,250) EndIf If greenowned = 0 Then buygreenbutton = Controls.AddButton("Buy Green Suit ($20)",200,300) EndIf If purpleowned = 0 Then buypurplebutton = Controls.AddButton("Buy Purple Suit ($20)",200,350) EndIf leaveclothingstorebutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub stickfurniture enter() if houselevel = 1 Then EndIf if houselevel = 2 Then EndIf if houselevel = 3 Then EndIf leavefurniturebutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub gym enter() If membership = 0 Then buymembershipbutton = Controls.AddButton("Buy Membership ($20)",200,200) Else Workoutbutton = Controls.AddButton("Work Out! (2 strength/hr.)",200,200) EndIf leavegymbutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub cinema enter() leavecinemabutton = Controls.AddButton("Leave",400,750) EndSub '============= Sub library enter() If librarydot = 0 then enterusedbooksection = Controls.AddButton("Buy a Used Book",200,200) enterfictionsection = Controls.AddButton("Enter Fiction Section",200,250) enternonfictionsection = Controls.AddButton("Enter Nonfiction Section",200,300) leavelibrarybutton = Controls.AddButton("Leave",400,750) ElseIf librarydot = 1 then If nonfictionbook = 0 then buyanonfictionbookbutton = Controls.AddButton("Buy a Nonfiction Book",200,200) EndIf If exercisebook = 0 then buyanexercisebookbutton = Controls.AddButton("Buy a Workout Book",200,250) EndIf If comedybook = 0 then buyacomedybook = Controls.AddButton("Buy a Comedy Book",200,300) EndIf If atlasworthy = 1 then buyausedatlas = Controls.AddButton("Buy a Heavily Used Atlas",200,350) EndIf GraphicsWindow.DrawText("Note that each used book is $10",200,400) enterlibraryatriumbutton1 = Controls.AddButton("Back to the Atrium",400,750) ElseIf librarydot = 2 then GraphicsWindow.DrawResizedImage(image1,150,5,200,300) GraphicsWindow.DrawResizedImage(image2,650,5,200,300) GraphicsWindow.DrawResizedImage(image3,1150,5,200,300) GraphicsWindow.DrawResizedImage(image4,1650,5,200,300) GraphicsWindow.DrawResizedImage(image5,650,360,200,300) GraphicsWindow.DrawResizedImage(image6,1150,360,200,300) GraphicsWindow.DrawResizedImage(image7,1650,360,200,300) GraphicsWindow.DrawResizedImage(image8,150,360,200,300) michaelveybook = Controls.AddButton("Michael Vey: Prisoner of Cell 25",50,305) beyondersbook1 = Controls.AddButton("Beyonders: A World Without Heroes",540,305) fivekingdoms = Controls.AddButton("Five Kingdoms: Sky Raiders",1090,305) steelheart = Controls.AddButton("Reckoners: Steelheart",1610,305) hungergames = Controls.AddButton("The Hunger Games",640,660) teslasattic = Controls.AddButton("Accelerati Trilogy: Tesla's Attic",1080,660) sorcerersstone = Controls.AddButton("Harry Potter and the Sorcerer's Stone",1470,660) eragon = Controls.AddButton("Inheritance Trilogy: Eragon",75,660) enterlibraryatriumbutton2 = Controls.AddButton("Back to the Atrium",100,750) ElseIf librarydot = 3 then book000s = Controls.AddButton("The 000's",200,200) book100s = Controls.AddButton("The 100's",200,250) book200s = Controls.AddButton("The 200's",200,300) book300s = Controls.AddButton("The 300's",200,350) book400s = Controls.AddButton("The 400's",200,400) book500s = Controls.AddButton("The 500's",200,450) book600s = Controls.AddButton("The 600's",200,500) book700s = Controls.AddButton("The 700's",200,550) book800s = Controls.AddButton("The 800's",200,600) book900s = Controls.AddButton("The 900's",200,650) enterlibraryatriumbutton3 = Controls.AddButton("Back to the Atrium",400,750) EndIf EndSub '============= Sub busstation enter() leavebusstation = Controls.AddButton("Leave",400,750) EndSub '============= Sub pool enter() leavepool = Controls.AddButton("Leave",400,750) EndSub '============= Sub joboffices enter() if jobdot = 0 Then EndIf leavejobsbutton = Controls.AddButton("Leave",400,750) EndSub '==================================Long=Subs===================================================================================================== sub buttons lastbutton = Controls.LastClickedButton GraphicsWindow.BrushColor = blue If lastbutton = pausebutton Then pausebuttons() ElseIf lastbutton = quitbutton then Program.Delay(500) Program.End() ElseIf lastbutton = sleepbutton then sleeps() elseif lastbutton = kitchenbutton then houseoptions = 1 home() elseif lastbutton = leavebutton then houseleave() elseif lastbutton = leavekitchen then houseoptions = 0 home() elseif lastbutton = livingroom then houseoptions = 3 home() elseif lastbutton = officebutton then houseoptions = 2 home() elseif lastbutton = leaveoffice then houseoptions = 0 home() Elseif lastbutton = leavebutton2 then houseoptions = 0 home() elseif lastbutton = Resumebutton then drawcity1() Drawcharacter() Shapes.Move(Character,xpause,ypause) timer.Resume() elseif lastbutton = homeworks then houseoptions = 25 home() elseif lastbutton = homeworkokbutton then houseoptions = 2 home() elseif lastbutton = okaysleepbutton1 then houseoptions = 0 home() Elseif lastbutton = enterpantry then houseoptions = 15 home() Elseif lastbutton = sodabutton then If money >= 5 then money = money - 5 thirst = thirst + 2 EndIf elseif lastbutton = Milkshakebutton then If money >= 7 then money = money - 7 thirst = thirst + 2 hunger = hunger + 2 EndIf elseif lastbutton = nuggetsbutton then if money>= 12 then money = money - 12 hunger = hunger + 5 EndIf elseif lastbutton = friesbutton then If money >= 10 then money = money - 10 hunger = hunger + 4 EndIf elseif lastbutton = burgerbutton then if money >= 15 then money = money - 15 hunger = hunger + 10 EndIf elseif lastbutton = workmcbutton then money = money + 6 Time = Time + 1 Elseif lastbutton = leavemcbutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,72,102) Program.Delay(500) timedot = 0 elseif lastbutton = leavehighschoolbutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,100,170) timedot = 0 elseif lastbutton = studybutton then highschooldot = 1 highschool() elseif lastbutton = gotoclassbutton then highschooldot = 2 highschool() elseif lastbutton = takeatestbutton then highschooldot= 3 highschool() elseif lastbutton = Tuitionoptionsbutton then highschooldot = 4 highschool() elseif lastbutton = okstudybutton then highschooldot = 0 highschool() elseif lastbutton = okayclassbutton then highschooldot = 0 highschool() elseif lastbutton = okaytestbutton then highschooldot = 0 highschool() elseif lastbutton = okaytuitionoptionsbutton then highschooldot = 0 highschool() elseif lastbutton = takeatest2button then highschooldot= 3 highschool() elseif lastbutton = buyatuitionbutton then if money >= 30 then If Tuition = 0 then money = money - 30 Tuition = 1 highschooldot = 4 highschool() EndIf EndIf elseif lastbutton = graduategradebutton then highschooldot = 5 highschool() elseif lastbutton = okaygraduationbutton then highschooldot = 0 highschool() elseif lastbutton = takegraduationtestbutton then highschooldot = 6 highschool() elseif lastbutton = okaygraduationtestbutton then highschooldot = 0 highschool() elseif lastbutton = leavecandybutton then clear() drawcity1() Drawcharacter() locations() Shapes.Move(Character,103,190) location = "Road" timedot = 0 elseif lastbutton = Buyalollipopbutton then If money>= 2 then money = money - 2 hunger = hunger + 2 EndIf elseif lastbutton = buythecandyshopscandystandbutton then If money>= 500 then money = money - 500 candystandowned = 1 candy() EndIf elseif lastbutton = workatthhecandystandbutton then money = money + 10 Time = Time + 1 elseif lastbutton = buycomputerbutton then If money>= 1000 then money = money - 1000 computer = 1 electronicsstore() EndIf elseif lastbutton = buytvbutton then If money >= 500 then money = money - 500 tv = 1 electronicsstore() EndIf elseif lastbutton = leaveelectronicsstorebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,102,280) timedot = 0 elseif lastbutton = buyacdplayerbutton then If money>= 50 then money = money - 50 cdplayer = 1 electronicsstore() EndIf elseif lastbutton = playmusicroom then houseoptions = 4 home() Elseif lastbutton = leavemusicbutton then houseoptions = 0 home() elseif lastbutton = leavegeneralstorebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,222,10) timedot = 0 elseif lastbutton = aisle1button then generalstoredot = 1 generalstore() elseif lastbutton = aisle2button then generalstoredot = 2 generalstore() elseif lastbutton = aisle3button then generalstoredot = 3 generalstore() elseif lastbutton = aisle1leavebutton then generalstoredot = 0 generalstore() elseif lastbutton = aisle2leavebutton then generalstoredot = 0 generalstore() elseif lastbutton = aisle3leavebutton then generalstoredot = 0 generalstore() elseif lastbutton = buybreadbutton then If money>= 20 then money = money - 20 breadslices = breadslices + 10 EndIf elseif lastbutton = buypeanutbutterbutton then If money>= 5 then money = money - 5 pbservings = pbservings + 10 EndIf Elseif lastbutton = buyjellybutton then If money>= 5 then money = money - 5 jellyservings = jellyservings + 10 EndIf elseif lastbutton = leavepantrybutton then houseoptions = 1 home() elseif lastbutton = toastbutton then If breadslices>= 1 then breadslices = breadslices - 1 toast = toast + 1 houseoptions = 15 home() EndIf elseif lastbutton = pbjsandwichbutton then breadslices = breadslices - 2 pbservings = pbservings -1 jellyservings = jellyservings - 1 pbsandwiches = pbsandwiches + 1 houseoptions = 15 home() elseif lastbutton = eatapbsandwichbutton then pbsandwiches = pbsandwiches - 1 hunger = hunger + 10 houseoptions = 1 home() elseif lastbutton = eattoastbutton then toast = toast - 1 hunger = hunger + 2 houseoptions = 1 home() elseif lastbutton = watchtvbutton then houseoptions = 35 home() elseif lastbutton = tvchannel1button then houseoptions = 351 home() elseif lastbutton = okchannel1button then houseoptions = 35 home() elseif lastbutton = tvchannel2button then houseoptions = 352 home() elseif lastbutton = okchannel2button then houseoptions = 35 home() elseif lastbutton = cd1playbutton then Sound.PlayMusic("o5 c2 d8 e4 d4 f4 e4 d8 h8 c4 a4 g4") Sound.PlayMusic("f4 e4 d4 e8 c8 g2") Sound.PlayMusic("c2 d8 e4 d4 f4 e4 d8 h8 c4 a4 g4") Sound.PlayMusic("f4 e4 d4 e8 c8 g2") elseif lastbutton = leaveteenstorebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,583,540) timedot = 0 elseif lastbutton = buycd1button then If money>= 10 then money = money - 10 cd1 = 1 teenstore() EndIf elseif lastbutton = buyagun then If money >= 200 then money = money - 200 gun = 1 gunsandammunition() endif Elseif lastbutton = buyammobutton then If money>= 5 then money = money - 5 ammo = ammo + 10 gunsandammunition() EndIf elseif lastbutton = robstorebutton then clear() drawcity1() Drawcharacter() Shapes.Move(Character,575,400) jail = 1 Program.Delay(3000) elseif lastbutton = leavegunstorebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,102,370) timedot = 0 elseif lastbutton = turnofftvbutton then houseoptions = 3 home() elseif lastbutton = leavehouseupgradestore then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,102,370) timedot = 0 elseif lastbutton = housetocondobutton then If money >= 1500 then money = money - 1500 houselevel = 1 houseupgrades() EndIf elseif lastbutton = condotomansion then If money >= 2000 then money = money - 2000 houselevel = 2 houseupgrades() EndIf elseif lastbutton = leavehospitalbutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,222,160) timedot = 0 elseif lastbutton = healbutton then losthealth = AChealth - health If money >= losthealth then money = money - losthealth health = AChealth EndIf hospital() elseif lastbutton = mansiontocastlebutton then If money >= 3000 then money = money - 3000 houselevel = 3 houseupgrades() EndIf elseif lastbutton = leaveclothingstorebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,462,150) timedot = 0 elseif lastbutton = changeclothes then houseoptions = 5 home() elseif lastbutton = okclothesbutton then houseoptions = 0 home() elseif lastbutton = buyorangebutton then If money >= 20 then money = money - 20 orangeowned = 1 clothingstore() EndIf elseif lastbutton = buyyellowbutton then If money >= 20 then money = money - 20 yellowowned = 1 clothingstore() EndIf elseif lastbutton = buygreenbutton then If money >= 20 then money = money - 20 greenowned = 1 clothingstore() EndIf elseif lastbutton = buypurplebutton then If money >= 20 then money = money - 20 purpleowned = 1 clothingstore() EndIf elseif lastbutton = changerbutton then color = "Red" elseif lastbutton = changeobutton then color = "Orange" elseif lastbutton = changeybutton then color = "Yellow" elseif lastbutton = changegbutton then color = "Green" elseif lastbutton = changebbutton then color = "Blue" elseif lastbutton = changepbutton then color = "Purple" elseif lastbutton = leavefurniturebutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,343,193) timedot = 0 elseif lastbutton = homebutton then Shapes.Move(Character,1,1) elseif lastbutton = leavegymbutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,463,193) timedot = 0 elseif lastbutton = buymembershipbutton then If money >= 20 then money = money - 20 membership = 1 gym() EndIf elseif lastbutton = Workoutbutton then strength = strength + 2 Time = Time + 1 elseif lastbutton = leavecinemabutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,342,85) timedot = 0 elseif lastbutton = leavebusstation then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,222,10) timedot = 0 elseif lastbutton = leavepool then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,223,313) timedot = 0 elseif lastbutton = leavelibrarybutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,540,102) timedot = 0 elseif lastbutton = leavejobsbutton then clear() drawcity1() location = "road" Drawcharacter() locations() Shapes.Move(Character,340,343) timedot = 0 elseif lastbutton = enterusedbooksection then librarydot = 1 library() elseif lastbutton = enterfictionsection then librarydot = 2 library() elseif lastbutton = enternonfictionsection then librarydot = 3 library() elseif lastbutton = michaelveybook then GraphicsWindow.ShowMessage("To everyone at Meridian High School, fourteen-year-old Michael Vey is nothing special, just the kid who has Tourette’s syndrome. But in truth, Michael is extremely special—he has electric powers. Michael thinks he is unique until he discovers that a cheerleader named Taylor has the same mysterious powers. With the help of Michael’s friend, Ostin, the three of them set out to discover how Michael and Taylor ended up with their abilities, and their investigation soon brings them to the attention of a powerful group who wants to control the electric teens—and through them, the world.","Michael Vey") elseif lastbutton = beyondersbook1 then GraphicsWindow.ShowMessage("Jason Walker has often wished his life could be a bit less predictable— until a routine day at the zoo ends with Jason suddenly transporting from the hippo tank to a place unlike anything he’s ever seen. In the past, the people of Lyrian welcomed visitors from the Beyond, but attitudes have changed since the wizard emperor Maldor rose to power. The brave resistors who opposed the emperor have been bought off or broken, leaving a realm where fear and suspicion prevail.In his search for a way home, Jason meets Rachel, who was also mysteriously drawn to Lyrian from our world. With the help of a few scattered rebels, Jason and Rachel become entangled in a quest to piece together the word of power that can destroy the emperor and learn that their best hope to find a way home will be to save this world without heroes.","Beyonders") elseif lastbutton = fivekingdoms then GraphicsWindow.ShowMessage("In a world that lies between reality and imagination, a “fanciful, action-packed adventure” awaits (Publishers Weekly, starred review). Come and claim it in this first book of the Five Kingdoms series, from the #1 New York Times bestselling author of the Fablehaven and Beyonders series. Cole Randolph was just trying to have a fun time with his friends on Halloween (and maybe get to know Jenna Hunt a little better). But when a spooky haunted house turns out to be a portal to something much creepier, Cole finds himself on an adventure on a whole different level. After Cole sees his friends whisked away to some mysterious place underneath the haunted house, he dives in after them—and ends up in The Outskirts. The Outskirts are made up of five kingdoms that lie between wakefulness and dreaming, reality and imagination, life and death. It’s an in-between place. Some people are born there. Some find their way there from our world, or from other worlds. And once you come to the Outskirts, it’s very hard to leave. With the magic of the Outskirts starting to unravel, it’s up to Cole and an unusual girl named Mira to rescue his friends, set things right in the Outskirts, and hopefully find his way back home…before his existence is forgotten.","Five Kingdoms") elseif lastbutton = steelheart then GraphicsWindow.ShowMessage("How far would you go for revenge if someone killed your father? If someone destroyed your city? If everything you ever loved was taken from you? David Charleston will go to any lengths to stop Steelheart. But to exact revenge in Steelheart’s world, David will need the Reckoners—a shadowy group of rebels bent on maintaining justice. And it turns out that the Reckoners might just need David too.","Steelheart") elseif lastbutton = hungergames then GraphicsWindow.ShowMessage("In the ruins of a place once known as North America lies the nation of Panem, a shining Capitol surrounded by twelve outlying districts. Long ago the districts waged war on the Capitol and were defeated. As part of the surrender terms, each district agreed to send one boy and one girl to appear in an annual televised event called the Hunger Games, a fight to the death on live TV. Sixteen-year-old Katniss Everdeen, who lives alone with her mother and younger sister, regards it as a death sentence when she is forced to represent her district in the Games. The terrain, rules, and level of audience participation may change but one thing is constant: kill or be killed.","The Hunger Games") elseif lastbutton = teslasattic then GraphicsWindow.ShowMessage("After their home burns down, fourteen-year-old Nick, his younger brother, and their father move into a ramshackle Victorian house they've inherited. When Nick opens the door to his attic room, he's hit in the head by a toaster. That's just the beginning of his weird experiences with the old junk stored up there. After getting rid of the odd antiques in a garage sale, Nick befriends some local kids-Mitch, Caitlin, and Vincent-and they discover that all of the objects have extraordinary properties. What's more, Nick figures out that the attic is a strange magnetic vortex, which attracts all sorts of trouble. It's as if the attic itself has an intelligence . . . and a purpose. Ultimately Nick learns that the genius Nikola Tesla placed the items-his last inventions-in the attic as part of a larger plan that he mathematically predicted. Nick and his new friends must retrieve everything that was sold at the garage sale and keep it safe. But the task is fraught with peril-in addition to the dangers inherent in Tesla's mysterious and powerful creations, a secret society of physicists, the Accelerati, is determined to stop Nick and alter destiny to achieve its own devious ends. It's a lot for a guy to handle, especially when he'd much rather fly under the radar as the new kid in town. Fans of intrigue, action, humor, and nonstop surprises are guaranteed a read unlike any other in Tesla's Attic, Book One of the Accelerati Trilogy.","Tesla's Attic") Elseif lastbutton = sorcerersstone then GraphicsWindow.ShowMessage("Harry Potter has no idea how famous he is. That's because he's being raised by his miserable aunt and uncle who are terrified Harry will learn that he's really a wizard, just as his parents were. But everything changes when Harry is summoned to attend an infamous school for wizards, and he begins to discover some clues about his illustrious birthright. From the surprising way he is greeted by a lovable giant, to the unique curriculum and colorful faculty at his unusual school, Harry finds himself drawn deep inside a mystical world he never knew existed and closer to his own noble destiny.","Harry Potter and the Sorcerer's Stone") elseif lastbutton = eragon then GraphicsWindow.ShowMessage("Fifteen-year-old Eragon believes that he is merely a poor farm boy—until his destiny as a Dragon Rider is revealed. Gifted with only an ancient sword, a loyal dragon, and sage advice from an old storyteller, Eragon is soon swept into a dangerous tapestry of magic, glory, and power. Now his choices could save—or destroy—the Empire.","Eragon") elseif lastbutton = enterlibraryatriumbutton1 then librarydot = 0 library() elseif lastbutton = enterlibraryatriumbutton2 then librarydot = 0 library() elseif lastbutton = enterlibraryatriumbutton3 then librarydot = 0 library() elseif lastbutton = book000s then GraphicsWindow.ShowMessage("The 000's are computer science, information & general works.","000's") elseif lastbutton = book100s then GraphicsWindow.ShowMessage("The 100's are philosophy and psychology","100's") elseif lastbutton = book200s then GraphicsWindow.ShowMessage("The 200's are religion","200's") elseif lastbutton = book300s then GraphicsWindow.ShowMessage("The 300's are social sciences","300's") elseif lastbutton = book400s then GraphicsWindow.ShowMessage("The 400's are languages","400's") elseif lastbutton = book500s then GraphicsWindow.ShowMessage("The 500's are pure science","500's") elseif lastbutton = book600s then GraphicsWindow.ShowMessage("The 600's are technology","600's") elseif lastbutton = book700s then GraphicsWindow.ShowMessage("The 700's are arts and recreation","700's") elseif lastbutton = book800s then GraphicsWindow.ShowMessage("The 800's are literature","800's") elseif lastbutton = book900s then graphicsWindow.ShowMessage("The 900's are history and geography","900's") elseif lastbutton = buyanonfictionbookbutton then If money >= 20 then money = money - 20 nonfictionbook = 1 library() EndIf elseif lastbutton = buyanexercisebookbutton then If money >= 20 then money = money - 20 exercisebook = 1 library() EndIf elseif lastbutton = buyacomedybook then If money >= 20 then money = money - 20 comedybook = 1 library() EndIf elseif lastbutton = buyausedatlas then If money >= 20 then money = money - 20 usedatlas = 1 library() EndIf EndIf EndSub '================================================== Sub drawcity1 Drawcharacter() TextWindow.Clear() TextWindow.Title = "Stick RPG 2.0: Stats Bar" GraphicsWindow.Show() GraphicsWindow.Clear() GraphicsWindow.Title = "Stick RPG 2.0: Gameplay area" lime = GraphicsWindow.GetColorFromRGB(0,255,0) red = GraphicsWindow.GetColorFromRGB(255,0,0) yellow = GraphicsWindow.GetColorFromRGB(255,255,0) blue = GraphicsWindow.GetColorFromRGB(0,0,255) silvergray2 = GraphicsWindow.GetColorFromRGB(192,192,255) coffeebrown = GraphicsWindow.GetColorFromRGB(103,78,55) ashgray = GraphicsWindow.GetColorFromRGB(102,99,98) cyan = GraphicsWindow.GetColorFromRGB(0,255,255) movietheaterred = GraphicsWindow.GetColorFromRGB(195,0,0) black = GraphicsWindow.GetColorFromRGB(0,0,0) white = GraphicsWindow.GetColorFromRGB(255,255,255) goldenbrown = GraphicsWindow.GetColorFromRGB(234,193,23) grayrandomcolorthatidontknowwhatisit = GraphicsWindow.GetColorFromRGB(219,218,216) caramelcolor = GraphicsWindow.GetColorFromRGB(184,115,51) white100 = GraphicsWindow.GetColorFromRGB(155,155,155) neonblue = GraphicsWindow.GetColorFromRGB(40,72,234) firebrick = GraphicsWindow.GetColorFromRGB(128,5,23) breadcolor = GraphicsWindow.GetColorFromRGB(255,207,93) woodbrown = GraphicsWindow.GetColorFromRGB(150,111,51) shamrockgreen = GraphicsWindow.GetColorFromRGB(52,124,23) harvestgold = GraphicsWindow.GetColorFromRGB(237,226,117) blue2 = GraphicsWindow.GetColorFromRGB(116,128,237) orange = GraphicsWindow.GetColorFromRGB(255,165,0) purple = GraphicsWindow.GetColorFromRGB(128,0,128) GraphicsWindow.BackgroundColor = lime If houselevel = 0 Then GraphicsWindow.BrushColor = red Shapes.AddTriangle(50,1,1,50,100,50) GraphicsWindow.BrushColor = coffeebrown GraphicsWindow.DrawRectangle(1,50,100,50) GraphicsWindow.FillRectangle(1,50,100,50) GraphicsWindow.BrushColor = red GraphicsWindow.FontSize = 13 GraphicsWindow.DrawText(25,75,"HOME") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(20,55,20,20) GraphicsWindow.FillRectangle(20,55,20,20) GraphicsWindow.DrawRectangle(50,55,20,20) GraphicsWindow.FillRectangle(50,55,20,20) ElseIf houselevel = 1 then GraphicsWindow.BrushColor = harvestgold GraphicsWindow.DrawEllipse(1,1,100,100) GraphicsWindow.FillEllipse(1,1,100,100) GraphicsWindow.BrushColor = lime GraphicsWindow.DrawRectangle(1,1,100,50) GraphicsWindow.FillRectangle(1,1,100,50) GraphicsWindow.BrushColor = harvestgold GraphicsWindow.DrawRectangle(1,1,20,50) GraphicsWindow.FillRectangle(1,1,20,50) GraphicsWindow.DrawRectangle(80,1,20,50) GraphicsWindow.FillRectangle(80,1,20,50) GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(25,25,20,20) GraphicsWindow.FillRectangle(25,25,20,20) GraphicsWindow.DrawRectangle(55,25,20,20) GraphicsWindow.FillRectangle(55,25,20,20) GraphicsWindow.BrushColor = blue2 GraphicsWindow.FontSize = 13 GraphicsWindow.DrawText(25,75,"CONDO") GraphicsWindow.DrawEllipse(35,55,25,20) GraphicsWindow.FillEllipse(35,55,25,20) elseif houselevel = 2 then GraphicsWindow.BrushColor = silvergray2 GraphicsWindow.DrawRectangle(1,25,100,75) GraphicsWindow.FillRectangle(1,25,100,75) GraphicsWindow.BrushColor = red GraphicsWindow.DrawTriangle(1,24,25,1,50,24) GraphicsWindow.FillTriangle(1,24,25,1,50,24) GraphicsWindow.DrawTriangle(51,24,75,1,100,24) GraphicsWindow.FillTriangle(51,24,75,1,100,24) GraphicsWindow.BrushColor = blue2 GraphicsWindow.DrawText(20,70,"MANSION") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(25,35,20,20) GraphicsWindow.FillRectangle(25,35,20,20) GraphicsWindow.DrawRectangle(55,35,20,20) GraphicsWindow.FillRectangle(55,35,20,20) elseif houselevel = 3 then GraphicsWindow.BrushColor = grayrandomcolorthatidontknowwhatisit GraphicsWindow.DrawRectangle(1,1,20,20) GraphicsWindow.FillRectangle(1,1,20,20) GraphicsWindow.DrawRectangle(28,1,20,20) GraphicsWindow.FillRectangle(28,1,20,20) GraphicsWindow.DrawRectangle(54,1,20,20) GraphicsWindow.FillRectangle(54,1,20,20) GraphicsWindow.DrawRectangle(81,1,20,20) GraphicsWindow.FillRectangle(81,1,20,20) GraphicsWindow.DrawRectangle(1,20,100,80) GraphicsWindow.FillRectangle(1,20,100,80) GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(20,40,20,20) GraphicsWindow.FillRectangle(20,40,20,20) GraphicsWindow.DrawRectangle(50,40,20,20) GraphicsWindow.FillRectangle(50,40,20,20) GraphicsWindow.BrushColor = black GraphicsWindow.DrawText(25,75,"CASTLE") EndIf GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(1,100,100000,20) GraphicsWindow.FillRectangle(1,100,100000,20) GraphicsWindow.DrawRectangle(100,1,20,100000) GraphicsWindow.FillRectangle(100,1,20,100000) GraphicsWindow.BrushColor = goldenbrown GraphicsWindow.DrawRectangle(1,120,100,50) GraphicsWindow.FillRectangle(1,120,100,50) GraphicsWindow.BrushColor = yellow GraphicsWindow.FontSize = 20 GraphicsWindow.DrawBoundText(45,130,20,"M") GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor = red GraphicsWindow.DrawRectangle(20,155,75,10) Graphicswindow.FillRectangle(20,155,75,10) GraphicsWindow.BrushColor = yellow GraphicsWindow.DrawBoundText(20,150,1000,"McStick's") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(1,170,10000,20) GraphicsWindow.FillRectangle(1,170,10000,20) GraphicsWindow.BrushColor = grayrandomcolorthatidontknowwhatisit GraphicsWindow.DrawRectangle(120,1,80,50) GraphicsWindow.FillRectangle(120,1,80,50) GraphicsWindow.BrushColor = silvergray2 GraphicsWindow.DrawRectangle(120,50,100,24) Graphicswindow.FillRectangle(120,50,100,24) GraphicsWindow.DrawRectangle(120,75,100,24) GraphicsWindow.FillRectangle(120,75,100,24) GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 12 GraphicsWindow.DrawBoundText(125,5,3000,"Bus Station") GraphicsWindow.BrushColor = red GraphicsWindow.DrawRectangle(120,120,100,50) GraphicsWindow.FillRectangle(120,120,100,50) GraphicsWindow.BrushColor = yellow GraphicsWindow.DrawBoundText(125,125,1000000,"Train Station") GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(220,1,20,100000) GraphicsWindow.FillRectangle(220,1,20,100000) GraphicsWindow.BrushColor = caramelcolor GraphicsWindow.DrawRectangle(1,190,100,150) GraphicsWindow.FillRectangle(1,190,100,150) GraphicsWindow.BrushColor = coffeebrown GraphicsWindow.DrawRectangle(120,190,100,65) GraphicsWindow.FillRectangle(120,190,100,65) GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 22 GraphicsWindow.DrawBoundText(5,205,1000,"High") GraphicsWindow.DrawBoundText(5,225,1000,"School") GraphicsWindow.DrawBoundText(5,245,1000,"Of Stick") GraphicsWindow.FontSize = 17 GraphicsWindow.DrawBoundText(125,205,1000,"Candy") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(1,340,10000,20) GraphicsWindow.FillRectangle(1,340,10000,20) GraphicsWindow.DrawRectangle(100,255,100000,20) GraphicsWindow.FillRectangle(100,255,100000,20) GraphicsWindow.BrushColor = grayrandomcolorthatidontknowwhatisit GraphicsWindow.DrawRectangle(120,275,100,65) GraphicsWindow.FillRectangle(120,275,100,65) GraphicsWindow.BrushColor = silvergray2 GraphicsWindow.DrawRectangle(1,360,100,60) GraphicsWindow.FillRectangle(1,360,100,60) GraphicsWindow.BrushColor = black GraphicsWindow.DrawBoundText(125,280,1000,"Electronics") GraphicsWindow.DrawBoundText(130,300,1000,"Store") GraphicsWindow.FontSize = 15 GraphicsWindow.DrawBoundText(5,370,10000,"Guns &") GraphicsWindow.DrawBoundText(5,385,10000,"Ammunition") GraphicsWindow.BrushColor = ashgray GraphicsWindow.DrawRectangle(120,360,100,60) GraphicsWindow.FillRectangle(120,360,100,60) GraphicsWindow.BrushColor = coffeebrown GraphicsWindow.DrawRectangle(240,1,100,100) GraphicsWindow.FillRectangle(240,1,100,100) GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 17 GraphicsWindow.DrawBoundText(125,365,10000,"House") GraphicsWindow.DrawBoundText(125,380,10000,"Upgrades") GraphicsWindow.FontSize = 19 GraphicsWindow.DrawBoundText(245,10,1000000,"General") GraphicsWindow.DrawBoundText(245,30,100000,"Store") GraphicsWindow.BrushColor = white100 GraphicsWindow.DrawRectangle(240,120,100,140) GraphicsWindow.FillRectangle(240,120,100,140) GraphicsWindow.BrushColor = red GraphicsWindow.FontSize = 60 GraphicsWindow.DrawBoundText(260,125,1000000,"+") GraphicsWindow.FontSize = 24 GraphicsWindow.DrawBoundText(241,200,10000,"Hospital") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(340,1,20,10000000) GraphicsWindow.FillRectangle(340,1,20,10000000) GraphicsWindow.DrawRectangle(1,420,10000000,20) GraphicsWindow.FillRectangle(1,420,10000000,20) GraphicsWindow.BrushColor = cyan GraphicsWindow.DrawRectangle(240,275,100,65) GraphicsWindow.FillRectangle(240,275,100,65) GraphicsWindow.BrushColor = blue GraphicsWindow.FontSize = 17 GraphicsWindow.DrawBoundText(245,280,10000,"Swimming") GraphicsWindow.DrawBoundText(250,300,10000,"Pool") GraphicsWindow.BrushColor = red GraphicsWindow.DrawRectangle(240,360,100,60) GraphicsWindow.FillRectangle(240,360,100,60) GraphicsWindow.BrushColor = black GraphicsWindow.DrawBoundText(245,365,1000,"Arcade &") GraphicsWindow.DrawBoundText(245,380,1000,"Bowling") GraphicsWindow.BrushColor = movietheaterred GraphicsWindow.DrawRectangle(360,1,100,100) GraphicsWindow.FillRectangle(360,1,100,100) GraphicsWindow.FontSize = 22 GraphicsWindow.BrushColor = neonblue GraphicsWindow.DrawBoundText(365,5,1000,"Cinema") GraphicsWindow.BrushColor = breadcolor GraphicsWindow.DrawRectangle(360,120,100,52) GraphicsWindow.FillRectangle(360,120,100,52) GraphicsWindow.BrushColor = silvergray2 GraphicsWindow.DrawRectangle(360,190,100,65) GraphicsWindow.FillRectangle(360,190,100,65) GraphicsWindow.BrushColor = ashgray GraphicsWindow.DrawBoundText(365,125,10000,"Bakery") GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 17 GraphicsWindow.DrawBoundText(365,195,10000,"Stick") GraphicsWindow.DrawBoundText(365,210,10000,"Furniture") GraphicsWindow.BrushColor = ashgray GraphicsWindow.DrawRectangle(360,275,120,145) GraphicsWindow.FillRectangle(360,275,120,145) GraphicsWindow.BrushColor = grayrandomcolorthatidontknowwhatisit GraphicsWindow.FontSize = 20 GraphicsWindow.DrawBoundText(365,280,1000,"Stick Job") GraphicsWindow.FontSize = 16 GraphicsWindow.DrawBoundText(365,300,1000,"Offices") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(365,325,20,20) GraphicsWindow.FillRectangle(365,325,20,20) GraphicsWindow.DrawRectangle(395,325,20,20) GraphicsWindow.FillRectangle(395,325,20,20) GraphicsWindow.DrawRectangle(425,325,20,20) GraphicsWindow.FillRectangle(425,325,20,20) GraphicsWindow.DrawRectangle(365,350,20,20) GraphicsWindow.FillRectangle(365,350,20,20) GraphicsWindow.DrawRectangle(395,350,20,20) GraphicsWindow.FillRectangle(395,350,20,20) GraphicsWindow.DrawRectangle(425,350,20,20) GraphicsWindow.FillRectangle(425,350,20,20) GraphicsWindow.DrawRectangle(365,375,20,20) GraphicsWindow.FillRectangle(365,375,20,20) GraphicsWindow.DrawRectangle(395,375,20,20) GraphicsWindow.FillRectangle(395,375,20,20) GraphicsWindow.DrawRectangle(425,375,20,20) GraphicsWindow.FillRectangle(425,375,20,20) GraphicsWindow.DrawRectangle(460,1,20,100000) GraphicsWindow.FillRectangle(460,1,20,100000) GraphicsWindow.BrushColor = firebrick GraphicsWindow.DrawRectangle(480,1,100,100) GraphicsWindow.FillRectangle(480,1,100,100) GraphicsWindow.BrushColor = white100 GraphicsWindow.FontSize = 18 GraphicsWindow.DrawBoundText(485,5,1000,"Library") GraphicsWindow.BrushColor = woodbrown GraphicsWindow.DrawRectangle(480,120,100,50) GraphicsWindow.FillRectangle(480,120,100,50) GraphicsWindow.BrushColor = neonblue GraphicsWindow.DrawBoundText(485,125,1000,"Clothing") GraphicsWindow.BrushColor = silvergray2 GraphicsWindow.DrawRectangle(1,440,340,120) GraphicsWindow.FillRectangle(1,440,340,120) GraphicsWindow.BrushColor = red GraphicsWindow.DrawRectangle(480,190,100,150) GraphicsWindow.FillRectangle(480,190,100,150) GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 75 GraphicsWindow.DrawBoundText(20,450,10000,"Airport") GraphicsWindow.BrushColor = yellow GraphicsWindow.FontSize = 40 GraphicsWindow.DrawBoundText(485,195,1000,"GYM") GraphicsWindow.FontSize = 20 GraphicsWindow.DrawBoundText(482,250,1000,"Gold Gym") GraphicsWindow.DrawBoundText(485,270,1000,"Fitness") GraphicsWindow.BrushColor = grayrandomcolorthatidontknowwhatisit GraphicsWindow.DrawRectangle(480,360,100,60) GraphicsWindow.FillRectangle(480,360,100,60) GraphicsWindow.DrawRectangle(360,440,100,120) GraphicsWindow.FillRectangle(360,440,100,120) GraphicsWindow.BrushColor = black GraphicsWindow.DrawBoundText(510,365,1000,"City") GraphicsWindow.DrawBoundText(510,385,1000,"Hall") GraphicsWindow.DrawBoundText(365,445,1000,"Stick") GraphicsWindow.DrawBoundText(365,470,1000,"Museum") GraphicsWindow.BrushColor = white GraphicsWindow.DrawRectangle(370,495,15,35) GraphicsWindow.FillRectangle(370,495,15,35) GraphicsWindow.DrawRectangle(395,495,15,35) GraphicsWindow.FillRectangle(395,495,15,35) GraphicsWindow.DrawRectangle(420,495,15,35) GraphicsWindow.FillRectangle(420,495,15,35) GraphicsWindow.DrawLine(362,495,443,495) GraphicsWindow.DrawLine(362,530,443,530) GraphicsWindow.BrushColor = shamrockgreen GraphicsWindow.DrawRectangle(480,440,100,120) GraphicsWindow.FillRectangle(480,440,100,120) GraphicsWindow.BrushColor = white GraphicsWindow.FontSize = 32 GraphicsWindow.DrawBoundText(485,445,1000,"Teens") GraphicsWindow.DrawBoundText(485,480,1000,"Shop") GraphicsWindow.DrawRectangle(580,1,20,10000) GraphicsWindow.FillRectangle(580,1,20,10000) GraphicsWindow.DrawRectangle(1,560,10000,20) GraphicsWindow.FillRectangle(1,560,10000,20) GraphicsWindow.BrushColor = black GraphicsWindow.FontSize = 22 pausebutton = Controls.AddButton("Pause & Stats",1710,5) homebutton = Controls.AddButton("Home",1610,5) EndSub '============ Sub locations left1 = Shapes.GetLeft(Character) top1 = Shapes.GetTop(Character) For forvariable5 = 0 To 15 For forvariable6 = 0 To 15 left = left1 + forvariable5 top = top1 + forvariable6 If top < 100 Then If left < 100 Then location = "home" ElseIf left < 120 then location = "road" ElseIf left < 220 Then location = "bus station" ElseIf left < 240 then location = "road" ElseIf left < 340 then location = "general store" ElseIf left < 360 then location = "road" ElseIf left < 460 then location = "cinema" ElseIf left < 480 then location = "road" ElseIf left < 580 then location = "library" ElseIf left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" Endif ElseIf top < 120 then If left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseIf top < 170 then If left < 100 then location = "mcsticks" Elseif left < 120 then location = "road" Elseif left < 220 then location = "trainstation" ElseIf left < 240 then location = "road" Elseif left < 340 then location = "hospital" elseif left < 360 then location = "road" elseif left < 460 then location = "bakery" elseif left < 480 then location = "road" Elseif left < 580 then location = "clothing" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 190 then If left < 240 then location = "road" elseif left < 340 then location = "hospital" elseIf left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 255 then If left < 100 then location = "highschool" elseif left < 120 then location = "road" elseif left < 220 then location = "candy" elseif left < 240 then location = "road" elseif left < 340 then location = "hospital" elseif left < 360 then location = "road" elseif left < 460 then location = "furniture" elseif left < 480 then location = "road" elseif left < 580 then location = "gym" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 275 then If left < 100 then location = "highschool" elseif left < 480 then location = "road" elseif left < 580 then location = "gym" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 340 then If left < 100 then location = "highschool" Elseif left < 120 then location = "road" elseif left < 220 then location = "electricstore" elseif left < 240 then location = "road" elseif left < 340 then location = "swimmingpool" elseif left < 360 then location = "road" elseif left < 460 then location = "jobs" elseif left < 480 then location = "road" elseif left < 580 then location = "gym" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" else location = "outofbounds" EndIf elseif top < 360 then If left < 360 then location = "road" elseif left < 460 then location = "jobs" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 420 then If left < 100 then location = "guns&ammo" elseif left < 120 then location = "road" elseif left < 220 then location = "houseupgrades" elseif left < 240 then location = "road" elseif left < 340 then location = "arcade" elseif left < 360 then location = "road" elseif left < 460 then location = "jobs" elseif left < 480 then location = "road" elseif left < 580 then location = "cityhall" Elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 440 then If left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" EndIf elseif top < 560 then If left < 340 then location = "airport" elseif left < 360 then location = "road" elseif left < 460 then location = "museum" elseif left < 480 then location = "road" elseif left < 580 then location = "teenstore" elseif left < 600 then location = "road" elseif left > 599 then location = "outofbounds" Else location = "outofbounds" endif elseif top > 560 then location = "outofbounds" EndIf If left < 0 Then location = "outofbounds" EndIf If top < 0 Then location = "outofbounds" EndIf EndFor EndFor endsub '======== Sub locationsensor If location = "outofbounds" then health = health - 10 Shapes.Move(Character,105,105) GraphicsWindow.ShowMessage("Out of Bounds (-10 health)","ERROR!!!!") Elseif location = "home" Then home() Elseif location = "mcsticks" then McSticks() elseif location = "highschool" then highschooldot = 0 highschool() elseif location = "candy" then candy() elseif location = "electricstore" then electronicsstore() elseif location = "general store" then generalstoredot = 0 generalstore() elseif location = "teenstore" then teenstore() elseif location = "guns&ammo" then gunsandammunition() elseif location = "houseupgrades" then houseupgrades() elseif location = "hospital" then hospital() elseif location = "clothing" then clothingstore() elseif location = "furniture" then stickfurniture() elseif location = "gym" then gym() elseif location = "cinema" then cinema() elseif location = "library" then librarydot = 0 library() elseif location = "bus station" then busstation() elseif location = "swimmingpool" then pool() elseif location = "jobs" then joboffices() elseif location = "" then EndIf EndSub '============= End>RSG598.sb< Start>RSG940.sb< GraphicsWindow.Show() gradient[1] = "Gray" gradient[2] = "DarkBlue" gradient[3] = "Blue" gradient[4] = "SteelBlue" gradient[5] = "SteelBlue" gradient[6] = "LightGray" gradient[7] = "SteelBlue" gradient[8] = "DarkGray" gradient[9] = "Black" gradient[10] = "Black" LDShapes.BrushGradientBackground(LDShapes.BrushGradient(gradient,"V")) 'Set the treeview data, the first index is the item number and the second is its parent (0 is top level) tree[1][0] = "Level 1" tree[2][1] = "Level 1 1" tree[3][1] = "Level 1 2" tree[4][3] = "Level 1 2 1" tree[5][0] = "Level 2" tree[6][5] = "Level 2 1" tree[7][5] = "Level 2 2" tree[8][0] = "Level 3" 'Create the treeview GraphicsWindow.Show() treeView = LDControls.AddTreeView(tree,200,200) Shapes.Move(treeView,50,50) gradient = "" gradient[1] = "LightGray" gradient[2] = "SteelBlue" gradient[3] = "LightGray" LDShapes.BrushGradientShape(treeView, LDShapes.BrushGradient(gradient,"V")) 'Add a textBox to show the current selection item = Controls.AddTextBox(50,260) 'Set up the initial view LDControls.TreeViewItemChanged = OnTreeViewItemChanged 'Register selection event LDControls.TreeViewSelect(treeView,5) 'Select the second top level item "Level 2' - Note the OnTreeViewItemChanged is also fired with this action 'Add buttons to toggle expand expand = Controls.AddButton("Expand All",50,20) collapse = Controls.AddButton("Collapse All",150,20) Controls.ButtonClicked = OnButtonClicked GraphicsWindow.BrushColor = "White" err = "Error by LDShapes.BrushGradientShape(treeView, LDShapes.BrushGradient(gradient''V''))" GraphicsWindow.DrawText(30, GraphicsWindow.Height -35, err) Sub OnTreeViewItemChanged index = Array.GetAllIndices(tree[LDControls.LastTreeViewIndex]) ' To get the second index (parent) for this item label Controls.SetTextBoxText(item,tree[LDControls.LastTreeViewIndex][index[1]]) EndSub Sub OnButtonClicked If (Controls.LastClickedButton = expand) Then LDControls.TreeViewExpand(treeview,0,"True","True") ElseIf (Controls.LastClickedButton = collapse) Then LDControls.TreeViewExpand(treeview,0,"False","True") EndIf EndSub End>RSG940.sb< Start>RSH103.sb< ' Serpens 0.1 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.1 2013/01/03 Created. () ' 0.0 2013/01/03 16:42:32 Generated by Shapes 1.5 ' ' Reference: ' http://en.wikipedia.org/wiki/List_of_stars_in_Serpens ' GraphicsWindow.Title = "Serpens 0.1" GraphicsWindow.BackgroundColor = "Black" InitStars() num = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) Shapes_Init() ' initialize shapes scale = 1 Shapes_Draw() ' draw shapes angle = 0 GraphicsWindow.PenWidth = 20 GraphicsWindow.PenColor = "#002200" GraphicsWindow.BrushColor = "#002200" For i = 1 To num e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = ser[Text.GetSubText(e, 1, m - 1)]["RA"] dec = ser[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = ser[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = ser[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y GraphicsWindow.DrawLine(x1, y1, x2, y2) GraphicsWindow.FillEllipse(x2 - 10, y2 - 10, 20, 20) EndFor DrawGrids() GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Green" For i = 1 To num e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = ser[Text.GetSubText(e, 1, m - 1)]["RA"] dec = ser[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = ser[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = ser[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor num = Array.GetItemCount(ser) index = Array.GetAllIndices(ser) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = ser[index[i]]["RA"] dec = ser[index[i]]["Dec"] RADec2XY() mag = ser[index[i]]["Mag"] d = 20 / mag GraphicsWindow.FillEllipse(x - d / 2, y - d / 2, d, d) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 30 GraphicsWindow.DrawText(40, 50, "A Happy New Year") GraphicsWindow.FontSize = 40 GraphicsWindow.DrawText(40, 90, "2013") ' end of main Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Gray" y1 = 0 y2 = GraphicsWindow.Height For ra = 15 To 19 RADec2XY() GraphicsWindow.DrawLine(x, y1, x, y2) EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -20 To 20 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() GraphicsWindow.DrawLine(x1, y, x2, y) EndFor EndSub Sub RADec2XY x = Text.GetSubText(ra, 1, 2) x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = 610 - (x - 15) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = 250 - y * 3600 / 360 EndSub Sub InitStars ' index: Flamsteed designation ' RA (Right ascension), Dec (Declination), Mag (Apparent magnitude) ser[24] = "name=α Ser;RA=15 44 16.00;Dec=+06 25 31.9;Mag=2.63;" ser[28] = "name=β Ser;RA=15 46 11.21;Dec=+15 25 18.9;Mag=3.65;" ser[41] = "name=γ Ser;RA=15 56 26.99;Dec=+15 39 53.0;Mag=3.85;" ser[13] = "name=δ Ser A;RA=15 34 48.19;Dec=+10 32 19.9;Mag=3.80;" ser[37] = "name=ε Ser;RA=15 50 48.89;Dec=+04 28 39.3;Mag=3.71;" ser[35] = "name=κ Ser;RA=15 48 44.41;Dec=+18 08 30.4;Mag=4.09;" ser[32] = "name=μ Ser;RA=15 49 37.27;Dec=-03 25 48.5;Mag=3.54;" ser["1o"] = "name=δ Oph;RA=16 14 20.77;Dec=-03 41 38.3;Mag=2.73;" ser["2o"] = "name=ε Oph;RA=16 18 19.24;Dec=-04 41 33.4;Mag=3.23;" ser["13o"] = "name=ζ Oph;RA=16 37 09.53;Dec=-10 34 01.7;Mag=2.54;" ser["35o"] = "name=η Oph;RA=17 10 22.66;Dec=-15 43 30.5;Mag=2.43;" ser[56] = "name=ο Ser;RA=17 41 24.92;Dec=-12 52 30.6;Mag=4.24;" ser[58] = "name=η Ser;RA=18 21 18.92;Dec=-02 53 49.6;Mag=3.23;" ser[63] = "name=θ2 Ser;RA=18 56 14.61;Dec=+04 12 07.4;Mag=4.98;" edge = "5=28-35;7=35-41;6=41-28;2=28-13;1=13-24;3=24-37;4=37-32;" edge = edge + "8=32-1o;9=1o-2o;10=2o-13o;11=13o-35o;12=35o-56;" edge = edge + "13=56-58;14=58-63;" EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 356 ' x offset shY = 44 ' y offset shape = "" shape[1] = "func=ell;x=47;y=0;width=99;height=64;bc=#002200;pw=0;" shape[2] = "func=tri;x=0;y=20;x1=51;y1=0;x2=0;y2=25;x3=103;y3=25;bc=#000000;pw=0;" shape[3] = "func=ell;x=91;y=11;width=21;height=22;bc=#000000;pw=0;" EndSub Sub Shapes_Draw ' Shapes | Draw shapes as shapes data ' param shape - array of shapes ' param scale - to zoom ' return nShapes - number of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) nShapes = Array.GetItemCount(shape) s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.FillRectangle(shX + shape[i]["x"] * s, shY + shape[i]["y"] * s, shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.FillEllipse(shX + shape[i]["x"] * s, shY + shape[i]["y"] * s, shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.FillTriangle(shX + shape[i]["x"] * s + shape[i]["x1"] * s, shY + shape[i]["y"] * s + shape[i]["y1"] * s, shX + shape[i]["x"] * s + shape[i]["x2"] * s, shY + shape[i]["y"] * s + shape[i]["y2"] * s, shX + shape[i]["x"] * s + shape[i]["x3"] * s, shY + shape[i]["y"] * s + shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then GraphicsWindow.DrawLine(shX + shape[i]["x1"] * s, shY + shape[i]["y1"] * s, shX + shape[i]["x2"] * s, shY + shape[i]["y2"] * s) EndIf shape[i]["rx"] = shape[i]["x"] shape[i]["ry"] = shape[i]["y"] EndFor shAngle = 0 i = Stack.PopValue("local") EndSub End>RSH103.sb< Start>RSH218-0.sb< 'Fixed Version 'This Program creates exe and copy all dlls to CompilerFolder 'If compiler is in ProgramFiles folder this program need to run as admistrator, requires Data.dll V.0.9.0.2. Security.RunAsAdmistrator() SetData() SearchAllSBPrograms() CompileIt() '************************************************************************** Sub SetData CompilerFolder = OperatingSystem.ProgramFilesPath+"\Microsoft\Small Basic\" DataPath = "C:\" EndSub Sub SearchAllSBPrograms DN = "" IS = 0 ' The following line could be harmful and has been automatically commented. ' F = File.GetFiles(DataPath) I = 1 For I = 1 to Array.GetItemCount(F)+1 IS = IS + 1 Extension = Text.GetSubTextToEnd(F[I],Text.GetLength(F[I])-10) If Extension = ".smallbasic" Then DN[I] = F[I] EndIf Endfor I = I + 1 EndSub Sub CompileIt I = 1 For i = 1 To IS If DN[i] = "" Then Else X = Process.StartWithArguments(CompilerFolder+"SmallBasicCompiler.exe",DN[i]) If X = "Failed" Then TextWindow.WriteLine(DN[i] + ", FAILED") Else Temp = DN[i] TextWindow.WriteLine(DN[i] + ", SUCCESS") EndIf EndIF EndFor TextWindow.Read() Program.End() EndSub End>RSH218-0.sb< Start>RSH218.sb< SetData() SearchAllSBPrograms() CompileIt() '************************************************************************** Sub SetData ProgramPath = "C:\Program Files\Microsoft\Small Basic\" DataPath = "E:\0000 Programmierung\0000 MS Programmierung\Small Basic\Programme\" 'TextWindow.WriteLine(ProgramPath) TextWindow.WriteLine(DataPath) EndSub 'SetData Sub SearchAllSBPrograms DN = "" files = "" dir = "" subDir = "" Stack.PushValue("DirStack", DataPath) i = 0 SearchDirectories() EndSub 'SearchAllSBPrograms Sub SearchDirectories While (Stack.GetCount("DirStack") > 0) dir = Stack.PopValue("DirStack") TextWindow.WriteLine(dir) ' The following line could be harmful and has been automatically commented. ' files = File.GetFiles(dir) For i = 1 To Array.GetItemCount(files) If Text.EndsWith(files[i],".sb") Then DN[Array.GetItemCount(DN)+1] = files[i] 'TextWindow.WriteLine(files[i]) EndIf EndFor ' The following line could be harmful and has been automatically commented. ' subDir = File.GetDirectories(dir) For i = 1 To Array.GetItemCount(subDir) Stack.PushValue("DirStack",subDir[i]) EndFor EndWhile EndSub 'SearchDirectories Sub CompileIt For i = 1 To Array.GetItemCount(DN) command = ProgramPath command = Text.Append(command, "SmallBasicCompiler.exe ") command = Text.Append(command, DN[i]) CMD.RunCMDcommand(Command) TextWindow.WriteLine(DN[i]) EndFor EndSub 'CompileIt End>RSH218.sb< Start>RSK377.sb< ' program by Yled , June 10th 2016 ' Pulsar ' program no : WKS333 ' **************************SOUS ROUTINE SUB au nom de présentation******************************************** ' installation des images d'arrière plan et images de formules et de Newton path=Program.Directory GraphicsWindow.BackgroundColor="black" orion=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874929") GraphicsWindow.DrawImage(orion,0,100) 'GraphicsWindow.DrawImage(orion,0,511) Image[1]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874934") Image[2]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874935") Image[3]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874938") Image[4]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874939") Image[5]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/875144") Image[6]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/875145") Image[7]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/875146") Image[8]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874939") planet[1]=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/874939") w=math.GetRandomNumber(10)+3 z=math.GetRandomNumber(10)-35 x=math.GetRandomNumber(21)+8 y=math.GetRandomNumber(32)+11 v1=math.GetRandomNumber(5000)+1000 v2=math.GetRandomNumber(10000)+1000 v3=math.GetRandomNumber(20000)+10000 GraphicsWindow.Title = " pulsar " GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height= 768 GraphicsWindow.Width = 1024 ' ici on charge l image de la terre, onl reduit, on lui donne un position x,y de départ ' ici l image est affecté a une varivable qui va bouger dans ma boucle FOR T soleil = Shapes.AddImage(planet[1]) Shapes.Zoom(soleil,(0.2),(0.2)) ' 0.003 determine la grosseur de l aterre finale apres son zoom Shapes.Move(soleil,350,-200) For H=1 TO 8 sphere[H] = Shapes.AddImage(image[math.GetRandomNumber(8)]) shapes.Zoom (sphere[H],0.75,0.75) ' 0.1 pour petite sphere de depart snon ca cache l écran Shapes.Move (sphere[H],math.GetRandomNumber(1024),math.GetRandomNumber(768)) endfor ' **************** ICI LA GRANDE BOUCLE SANS FIN DE LA DANSE DES SPHERES ****************** CYCLES: paramètres() ' coefficient de rotation plus le chiffre est grand plus la rotation est rapide deltaY=(deltaY-5) deltaX=(deltaX+8) deltaZ=(deltaZ+11) deltaF=(deltaZ-17) v1=math.GetRandomNumber(5000)+1000 v2=math.GetRandomNumber(10000)+1000 v3=math.GetRandomNumber(20000)+10000 K1=c/z K2=c1/z K3=c1/x K4=c1/w K5=c/x K6=c/y K7=c1/y K8=w*z K9=w-z K10=z+w Q1=math.GetRandomNumber(20) Q2=math.GetRandomNumber(10) Q3=math.GetRandomNumber(5) Q4=math.GetRandomNumber(2) Shapes.Zoom (sphere[1],(K1*Q2),(K1*Q2)) Shapes.animate (sphere[1],6*w,z*5,v1) Shapes.Rotate (sphere[1],deltaX) Shapes.Zoom (sphere[2],(K2*Q2),(K2*Q2)) Shapes.animate (sphere[2],z*3,K10,v2) Shapes.Rotate (sphere[2],deltaX) Shapes.Zoom (sphere[3],K6*Q3,K5*Q3) Shapes.animate (sphere[3],z*2,K9,v1) Shapes.Rotate (sphere[3],deltaZ) Shapes.Zoom (sphere[4],K2*Q4,K2*Q4) Shapes.animate (sphere[4],2*w,K10,v3) Shapes.Rotate (sphere[4],deltaF) Shapes.Zoom (sphere[5],K3*Q1,K2*Q1) Shapes.animate (sphere[5],25+w,23+w,v2) Shapes.Rotate (sphere[5],w) Shapes.Zoom (sphere[6],K3*Q2,K2*Q2) Shapes.animate (sphere[6],168+w,223+w,v1+v2) Shapes.Rotate (sphere[6],deltaZ) Shapes.Zoom (sphere[7],K7*0.54,K3*0.54) Shapes.animate (sphere[7],600-w,53-w,v1) Shapes.Rotate (sphere[7],deltaX) Shapes.Zoom (sphere[8],K3*0.68,K4*0.68) Shapes.animate (sphere[8],85+w,213+w,v3) Shapes.Rotate (sphere[8],deltaZ) Shapes.Zoom (sphere[9],K2,K2) Shapes.animate (sphere[9],120+w,223+w,v2+v3) Shapes.Rotate (sphere[9],deltaX) temps=temps+1 ' rotation de la terre bt=bt-0.10 Shapes.Rotate(soleil,bt) Goto CYCLES ' ****************************** fin du programmme ************************************************* SUB paramètres z=z+0.55 w=w+0.75 x=x+0.25 y=y+0.85 If z > -10 Then z=-35 EndIf If w > 55 Then w=45 EndIf If x > 200 Then x=20 EndIf If y > 1050 Then y=5 EndIf If F > 14 Then F=1 EndIf ' controle de temps si temps est plu rnd que 10,000 on inverse les données If temps > 100000 Then deltaY=0 deltaX=0 deltaZ=0 deltaF=0 w=math.GetRandomNumber(9) z=math.GetRandomNumber(11) x=math.GetRandomNumber(22)+10 y=math.GetRandomNumber(28)+10 EndIf ' controle l arrive de la boule 7 en perspctive et la fait reculer par c=c-1 If c < 30 Then c=c+1 Else c=30-c-1 EndIf ' ***********************simultion de la boule 8 qui vibre If c1 < 30 Then c1=c1+1 Else c1=c1-1 EndIf EndSub End>RSK377.sb< Start>RSK521.sb< GraphicsWindow.Title = "Cubic Bézier Curve Init() AddControlPoints() DrawCurve() mouseDown = "False" GraphicsWindow.BackgroundColor="tan GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove While "True" If mouseDown Then While mouseDown If mouseMove Then lsh1=Text.GetSubTextToEnd(lsh Text.GetLength(lsh))-1 p[lsh1]["x"] = mx p[lsh1]["y"] = my _p1 = p[lsh1] Shapes.Move(_p1["e"], _p1["x"] - r , _p1["y"] - r) i=lsh1 AddControlLine() mouseMove = "False" Else Program.Delay(3) EndIf EndWhile RemoveCurve() DrawCurve() Else Program.Delay(3) EndIf EndWhile Sub AddControlLine GraphicsWindow.PenColor = "SteelBlue" GraphicsWindow.PenWidth = 1 For ii=1 To 2 If ii = 1 Then _p1 = p[0] p0=1 Else _p1 = p[3] p0=2 EndIf _p = p[p0] Shapes.Remove(c[ii]["e"]) c[ii]["e"] = Shapes.AddLine(_p["x"], _p["y"], _p1["x"], _p1["y"]) EndFor EndSub Sub AddControlPoints GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = "Transparent" For i = 0 To 3 GraphicsWindow.PenColor = "Black" ee=Shapes.AddEllipse(2 * r, 2 * r) p[i]["e"] =ee _p1 = p[i] Shapes.Move(_p1["e"], _p1["x"] - r , _p1["y"] - r) LDShapes.SetShapeEvent(_p1["e"]) AddControlLine() EndFor LDShapes.ShapeEvent=see EndSub Sub see If LDShapes.LastEventType="MouseDown" Then lsh=LDShapes.LastEventShape EndIf EndSub Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh p[0] = "x=" + (gw / 5) + ";y=" + (gh / 2) + ";" p[1] = "x=" + (gw * 2 / 5) + ";y=" + (gh / 4) + ";" p[2] = "x=" + (gw * 3 / 5) + ";y=" + (gh / 4) + ";" p[3] = "x=300;y=300 r = 6 EndSub Sub CalcBt ' param t ' return b[] cood = "1=x;2=y;" For i = 1 To Array.GetItemCount(cood) a = cood[i] b[a] = Math.Power(1 - t, 3) * p[0][a] b[a] = b[a] + 3 * Math.Power(1 - t, 2) * t * p[1][a] b[a] = b[a] + 3 * (1 - t) * Math.Power(t, 2) * p[2][a] b[a] = b[a] + Math.Power(t, 3) * p[3][a] EndFor EndSub Sub DrawCurve GraphicsWindow.PenColor = "red" GraphicsWindow.PenWidth = 2 tt = 1 / 32 For t = 0 To 1 Step tt CalcBt() If 0 < t Then nL = nL + 1 l[nL] = Shapes.AddLine(_b["x"], _b["y"], b["x"], b["y"]) EndIf _b = b EndFor EndSub Sub RemoveCurve For i = 1 To nL Shapes.Remove(l[i]) EndFor nL = 0 EndSub Sub OnMouseDown mouseDown = "True" dx = GraphicsWindow.MouseX dy = GraphicsWindow.MouseY EndSub Sub OnMouseUp mouseDown = "False" EndSub Sub OnMouseMove mouseMove = "True" mx = GraphicsWindow.MouseX my = GraphicsWindow.MouseY EndSub End>RSK521.sb< Start>RSM376.sb< TextWindow.WriteLine(" *") TextWindow.WriteLine(" ***") TextWindow.WriteLine(" *****") TextWindow.WriteLine("*******") End>RSM376.sb< Start>RST943.sb< 'Land It Game Chase Morell 20012 TextWindow.ForegroundColor = "Green" TextWindow.WriteLine ("Welcome to Chase's Flight Simulator") TextWindow.WriteLine ("-") TextWindow.WriteLine ("How To Play") TextWindow.WriteLine ("Use The Mouse To adjust the altitude of the plane.") TextWindow.WriteLine ("The Controls are relative to the red dot at the center of the joystick") TextWindow.WriteLine ("Mouse over the Dot; plane goes down and vice versa.") TextWindow.WriteLine ("It is possible to land the plane") TextWindow.WriteLine ("Chase Morell 2012") GraphicsWindow.Show() GraphicsWindow.Title = "Chase's Flight Simulator" GraphicsWindow.Width = 800 GraphicsWindow.Height = 500 GraphicsWindow.BackgroundColor = "Blue" GraphicsWindow.BrushColor = "Green" greenland = Shapes.AddRectangle (800,200) 'move the land rectangle to the bottom of the screen Shapes.Move (greenland,0,350) 'add clouds and trees from the internet and put them at the top of the screen mountains = Shapes.AddImage ("http://www.kevinwalton.co.uk/images/mountain.png") cloud1 = Shapes.AddImage ("http://scri8e.com/stars/PNG_Clouds/CL04.png") cloud2 = Shapes.AddImage ("http://3.bp.blogspot.com/_LApxKDsDWI0/SsLnCxtP67I/AAAAAAAAB64/qi8Dn-Hx11c/s320/CL05.png") tree1 = Shapes.AddImage ("http://i33.photobucket.com/albums/d63/Ven0mSeven/tree.png") tree2 = Shapes.AddImage ("http://i562.photobucket.com/albums/ss61/andi_misty/tree.png") Shapes.Zoom (tree2,.2,.2) GraphicsWindow.BrushColor = "White" Joysticksquare = Shapes.AddRectangle(80,80) GraphicsWindow.PenColor = "Red" reddot = Shapes.AddRectangle (5,5) Shapes.Move (reddot,50,340) Shapes.Move (Joysticksquare,10,300) Shapes.Zoom (mountains,1,1) Shapes.Zoom (tree1,.2,.2) Timer.Tick = cloudanimation Timer.Interval = 10 N = 1 Sub cloudanimation Shapes.Move (tree2,Shapes.GetLeft(tree2) - 7 * N,170) Shapes.Move (cloud1,Shapes.GetLeft(cloud1) - 5 * N,0) Shapes.Move (cloud2,Shapes.GetLeft(cloud2) - 6 * N,10) Shapes.Move (tree1,Shapes.GetLeft(tree1) - 4 * N,200) Shapes.Move (mountains,Shapes.GetLeft(mountains) - .1 * N,-200) Shapes.Move (cloud3,Shapes.GetLeft(cloud3) - 7 * N,-200) If Shapes.GetLeft(cloud1) < -300 Then Shapes.Move (cloud1,800,0) EndIf If Shapes.GetLeft(cloud2) < -300 Then Shapes.Move (cloud2,800,10) EndIf If Shapes.GetLeft(tree1) < -200 Then Shapes.Move (tree1,800,200) EndIf If Shapes.GetLeft(cloud3) < -800 Then Shapes.Move (cloud3,800,-200) EndIf If Shapes.GetTop(airplane) = 200 Then N = 0 EndIf If Shapes.GetTop (airplane) < 200 Then N = 1 EndIf If Shapes.GetLeft(tree2) < -300 Then Shapes.Move (tree2,800,170) EndIf EndSub 'Import the airplane picture from the Web airplane = Shapes.AddImage ("http://www.veryicon.com/icon/png/Transport/Brilliant%20Transportation/airplane.png") Shapes.Zoom (airplane,.5,.5) 'resize the airplane 'add 1 more cloud cloud3 = Shapes.AddImage ("http://i967.photobucket.com/albums/ae160/mykyrIacos_bucket/TUBES%20NUAGES/Jillcreation-overlay-cloud.png") Shapes.Zoom (cloud3,.5,.5) GraphicsWindow.MouseMove = mousemove Sub mousemove If GraphicsWindow.MouseY < Shapes.GetTop(reddot) - 20 And Shapes.GetTop (airplane) < 201 Then Shapes.Move (airplane,0, Shapes.GetTop(airplane) + 5) Shapes.Rotate (airplane,10) EndIf If GraphicsWindow.MouseY > Shapes.GetTop(reddot) + 20 And Shapes.GetTop (airplane) > -200 Then Shapes.Move (airplane,0,Shapes.GetTop(airplane) -5) Shapes.Rotate (airplane,350) EndIf Program.Delay (10) EndSub GraphicsWindow.KeyDown = KD Sub KD If GraphicsWindow.LastKey = "Space" Then GraphicsWindow.PenColor = "Orange" GraphicsWindow.BrushColor = "Orange" bomb = Shapes.AddEllipse (5,5) Shapes.Animate (bomb,80,400,20) loop: ZoomF = ZoomF + 1 Shapes.Zoom (bomb,ZoomF,ZoomF) Program.Delay(10) If ZoomF > 5 Then Goto Out EndIf Goto loop out: EndIf EndSub End>RST943.sb< Start>RSZ837.sb< GraphicsWindow.BackgroundColor="midnightblue dw=desktop.Width dh=desktop.Height GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 po="x=113.90;y=72.21;z=0.00;|x=151.87;y=99.80;z=0.00;|x=137.37;y=144.43;z=0.00;|x=90.44;y=144.43;z=0.00;|x=75.94;y=99.80;z=0.00;|x=113.90;y=32.29;z=24.67;|x=189.84;y=87.46;z=24.67;|x=160.83;y=176.73;z=24.67;|x=66.97;y=176.73;z=24.67;|x=37.97;y=87.46;z=24.67;|x=151.87;y=19.96;z=49.35;|x=189.84;y=47.54;z=49.35;|x=213.30;y=119.76;z=49.35;|x=198.80;y=164.39;z=49.35;|x=137.37;y=209.03;z=49.35;|x=90.44;y=209.03;z=49.35;|x=29.00;y=164.39;z=49.35;|x=14.50;y=119.76;z=49.35;|x=37.97;y=47.54;z=49.35;|x=75.94;y=19.96;z=49.35;|x=137.37;y=0.00;z=89.27;|x=160.83;y=7.62;z=129.19;|x=198.80;y=35.20;z=129.19;|x=213.30;y=55.16;z=89.27;|x=227.80;y=99.80;z=89.27;|x=227.80;y=124.47;z=129.19;|x=213.30;y=169.10;z=129.19;|x=198.80;y=189.07;z=89.27;|x=160.83;y=216.65;z=89.27;|x=137.37;y=224.27;z=129.19;|x=90.44;y=224.27;z=129.19;|x=66.97;y=216.65;z=89.27;|x=29.00;y=189.07;z=89.27;|x=14.50;y=169.10;z=129.19;|x=0.00;y=124.47;z=129.19;|x=0.00;y=99.80;z=89.27;|x=14.50;y=55.16;z=89.27;|x=29.00;y=35.20;z=129.19;|x=66.97;y=7.62;z=129.19;|x=90.44;y=0.00;z=89.27;|x=137.37;y=15.24;z=169.11;|x=198.80;y=59.88;z=169.11;|x=213.30;y=104.51;z=169.11;|x=189.84;y=176.73;z=169.11;|x=151.87;y=204.31;z=169.11;|x=75.94;y=204.31;z=169.11;|x=37.97;y=176.73;z=169.11;|x=14.50;y=104.51;z=169.11;|x=29.00;y=59.88;z=169.11;|x=90.44;y=15.24;z=169.11;|x=160.83;y=47.54;z=193.78;|x=189.84;y=136.33;z=193.92;|x=113.90;y=191.98;z=193.78;|x=37.97;y=136.33;z=193.92;|x=66.97;y=47.54;z=193.78;|x=137.37;y=79.84;z=218.46;|x=151.87;y=124.48;z=218.55;|x=113.90;y=151.62;z=218.61;|x=75.94;y=124.48;z=218.55;|x=90.44;y=79.84;z=218.46 points=LDText.Split(po "|") ep=LDText.Split("37 19 36;36 19 10;36 10 18;45 53 46;30 46 31;30 45 46;47 54 48;47 48 35;47 35 34;49 55 50;49 50 39;49 39 38;58 57 56;58 56 60;58 60 59;42 51 41;42 41 22;42 22 23;3 2 1;3 1 4;4 1 5;13 25 24;13 24 12;13 12 7;44 52 43;44 43 27;27 43 26;15 29 28;15 28 14;15 14 8;6 11 21;6 21 40;6 40 20;32 16 9;32 9 17;32 17 33" ";") clrz=LDText.Split("red lime lightblue cyan magenta yellow tan orange gray teal brown black" " ") 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 zo=LDText.Split("1 2 3 4 5 6 3 4 6 6 1 3" " ") hy="1=1;2=6;3=11;4=12;5=7;6=2|1=2;2=7;3=13;4=14;5=8;6=3|1=3;2=8;3=15;4=16;5=9;6=4|1=4;2=9;3=17;4=18;5=10;6=5|1=5;2=10;3=19;4=20;5=6;6=1|1=11;2=21;3=22;4=23;5=24;6=12|1=13;2=25;3=26;4=27;5=28;6=14|1=15;2=29;3=30;4=31;5=32;6=16|1=17;2=33;3=34;4=35;5=36;6=18|1=19;2=37;3=38;4=39;5=40;6=20|1=21;2=40;3=39;4=50;5=41;6=22|1=24;2=23;3=42;4=43;5=26;6=25|1=28;2=27;3=44;4=45;5=30;6=29|1=32;2=31;3=46;4=47;5=34;6=33|1=36;2=35;3=48;4=49;5=38;6=37|1=41;2=50;3=55;4=60;5=56;6=51|1=43;2=42;3=51;4=56;5=57;6=52|1=45;2=44;3=52;4=57;5=58;6=53|1=47;2=46;3=53;4=58;5=59;6=54|1=49;2=48;3=54;4=59;5=60;6=55 hxx=LDText.Split(hy "|") view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddAmbientLight(view3D "#22555555") LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10) LD3DView.AddDirectionalLight (view3D,"white" ,-1,-1,-1) LD3DView.AutoControl2 (1 1) ss=":" c=2.2 ix=1 For j=1 To Array.GetItemCount(ep) cx=Math.Floor((j-1)/3)+1 zz=ldtext.split(ep[j] " ") pt="" For n=1 To 3 z=zz[n] pt=pt+points[z]["x"]/50+ss+points[z]["y"]/50+ss+points[z]["z"]/50+ss EndFor o1[ix]=LD3DView.AddGeometry(view3D,pt,indices,nrmz,clrz[12],"D") LD3DView.SetCentre(view3D o1[ix] c c 0 "R1R2R3") If j<=15 Then LD3DView.ReverseNormals (view3D o1[ix]) EndIf ix=ix+1 EndFor For j=1 To 20 cr=Math.GetRandomNumber(11) m=hxx[j] For qq=0 To 3 pt="" For n=1 To 3 z=m[zo[n+qq*3]] pt=pt+points[z]["x"]/50+ss+points[z]["y"]/50+ss+points[z]["z"]/50+ss EndFor o1[ix]=LD3DView.AddGeometry(view3D,pt,indices,nrmz,clrz[cr],"D") LD3DView.SetCentre(view3D o1[ix] c c 0 "R1R2R3") LD3DView.ReverseNormals (view3D o1[ix]) ix=ix+1 EndFor EndFor GraphicsWindow.Title="3D rotating football ball For a=0 To 36000 Step 2 For x=1 To 80+36 LD3DView.RotateGeometry(view3D o1[x] 0 0 1 a) EndFor Program.Delay(22) EndFor End>RSZ837.sb< Start>RTB151.sb< 'Non trigonometrical constrained turtle 'Code by Stendec 20/2/09 'Change the turtle speed to 9 or less to follow what is happening. 'The normal line colour is Red 'The reflected part of a line is Blue 'X = x position 'Y = y position 'moveX = Amout to move in x direction 'moveY = Amount to move in y direction 'overhangX = x movement beyond boundary 'overhangY = y movement beyond boundary Turtle.Show() Turtle.Speed = 10 X = 200 Y = 200 For i = 0 To 1000 GraphicsWindow.PenColor = "Red" moveX = 201 - Math.GetRandomNumber(401) 'Allows for random starting at 1 not 0 moveY = 201 - Math.GetRandomNumber(401) Process: overhangX = 0 overhangY = 0 If (X + moveX) > GraphicsWindow.Width Then 'Too far right overhangX = X + moveX - GraphicsWindow.Width 'overhang moveX = GraphicsWindow.Width - X If (moveX + overhangX) > 0 Then overhangY = -(moveY - moveY * moveX / (moveX + overhangX)) moveY = moveY * moveX / (moveX + overhangX) EndIf EndIf If (X + moveX) < 0 Then 'Too far left overhangX = X + moveX 'overhang moveX = -X If (moveX + overhangX) < 0 Then overhangY = -(moveY - moveY * moveX / (moveX + overhangX)) moveY = moveY * moveX / (moveX + overhangX) EndIf EndIf If (Y + moveY) > GraphicsWindow.Height Then 'Too far down overhangY = Y + moveY - GraphicsWindow.Height 'overhang moveY = GraphicsWindow.Height - Y If (moveY + overhangY) > 0 Then overhangX = -(moveX - moveX * moveY / (moveY + overhangY)) moveX = moveX * moveY / (moveY + overhangY) EndIf EndIf If (Y + moveY) < 0 Then 'Too far up overhangY = Y + moveY 'overhang moveY = -Y If (moveY + overhangY) < 0 Then overhangX = -(moveX - moveX * moveY / (moveY + overhangY)) moveX = moveX * moveY / (moveY + overhangY) EndIf EndIf X = X + moveX Y = Y + moveY ' GraphicsWindow.PenColor = "Red" Turtle.MoveTo(X,Y) 'If not all the movement has been used up, repeat the processing until it has If (overhangX <> 0) Or (overhangY <> 0) Then moveX = -overhangX moveY = -overhangY GraphicsWindow.PenColor = "Blue" Goto Process EndIf EndFor End>RTB151.sb< Start>RTD941.sb< GraphicsWindow.Width=1200 GraphicsWindow.BackgroundColor="teal GraphicsWindow.BrushColor="white tt="F.L.O.R.E.S. .I.P.S.U.M. .R.O.L.L.S" cc=LDText.Split (tt ".") GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=66 GraphicsWindow.DrawEllipse (1 1 1 1) Program .Delay (500) ff=.9 GraphicsWindow.Title="Text breathing px=30 For r=1 To 18 c[r]=ldtext.GetWidth(cc[r]) gw=gw+c[r] Program.Delay (5) ss[r]=shapes.addText (cc[r]) LDEffect.DropShaddow (ss[r] "") LDShapes.Skew (ss[r], -15 0) Shapes.Move (ss[r] px 100) px=px+c[r] EndFor gw=gw*2 While "true For y=1 To 70 px=30 For r=1 To 18 Shapes.Move (ss[r] 30+px 100) LDShapes.Skew (ss[r], -y/3 0) px=px+c[r]*ff EndFor ff=ff*1.01 Program.Delay (50) EndFor For y=70 To 1 Step -1 px=0 For r=18 To 1 Step -1 px=px+c[r]*ff Shapes.Move (ss[r] gw-px 100) LDShapes.Skew (ss[r], -y/3 0) EndFor ff=ff/1.01 Program.Delay (50) EndFor For y=1 To 70 Step 1 px=0 For r=18 To 1 Step -1 px=px+c[r]*ff Shapes.Move (ss[r] gw-px 100) LDShapes.Skew (ss[r], y/3 0) EndFor ff=ff*1.01 Program.Delay (50) EndFor For y=70 To 1 Step -1 px=30 For r=1 To 18 Step 1 Shapes.Move (ss[r] px 100) LDShapes.Skew (ss[r], y/3 0) px=px+c[r]*ff EndFor ff=ff/1.01 Program.Delay (50) EndFor EndWhile 'GraphicsWindow.DrawText (50 200 LDText.Replace (tt "." "")) End>RTD941.sb< Start>RTF108.sb< GraphicsWindow.PenColor="Black" GraphicsWindow.BrushColor="#44000000" GraphicsWindow.FillRectangle(0,350,700,1) Box[1]=Shapes.AddRectangle(50,50) Box[2]=Shapes.AddRectangle(50,50) GraphicsWindow.BrushColor="Orange" GraphicsWindow.PenColor="Orange" LightSource=Shapes.AddEllipse(30,30) 'Move the objects: Shapes.Move(Box[1],300,300) Shapes.Move(Box[2],200,300) Shapes.Move(LightSource,300,200) 'Prepare the Pen for the shadow: GraphicsWindow.PenWidth=1 GraphicsWindow.BrushColor="black" GraphicsWindow.PenColor="black" BoxX[1]=Shapes.GetLeft(Box[1]) BoxY[1]=Shapes.GetTop(Box[1]) BoxX[2]=Shapes.GetLeft(Box[2]) BoxY[2]=Shapes.GetTop(Box[2]) While "True" For i=1 To 2 LightSourceX=Shapes.GetLeft(LightSource)+15 LightSourceY=Shapes.GetTop(LightSource)+15 BigH[i]=((BoXY[i]+50)-LightSourceY) Smallh[i]=(((BoXY[i]+50)-LightSourceY)-50) If Smallh[i] <> 0 Then ' bbbbbbbbbbbbbbbbb****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowRight[i]=((BoxX[i]+50)-LightSourceX)*BigH[i]/(((BoXY[i]+50)-LightSourceY)-50)+LightSourceX ' aaaaaaaaaaaaaaaa****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowLeft[i]=LightSourceX-(LightSourceX-BoxX[i])*BigH[i]/Smallh[i] Else ShadowLeft=-3000 ShadowRight=3000 EndIf CreateShadow() Shapes.Move(LightSource,GraphicsWindow.MouseX-15,GraphicsWindow.MouseY-15) LightSourceOldX=LightSourceX LightSourceOldY=LightSourceY endfor endwhile Sub CreateShadow If LightSourceOldX<>LightSourceX And LightSourceOldY<>LightSourceY then if LightSourceX<=BoxX[i] then Program.Delay(5) Shapes.Remove(shadow2[i]) Shadow2[i]=Shapes.AddTriangle(BoxX[i],BoxY[i]+50,BoxX[i]+50,BoxY[i],ShadowLeft[i],BoxY[i]+100) else Program.Delay(5) Shapes.Remove(shadow2[i]) Shadow2[i]=Shapes.AddTriangle(BoxX[i],BoxY[i],BoxX[i]+50,BoxY[i]+50,ShadowLeft[i],BoxY[i]+100) endif if LightSourceX>BoxX[i] And LightSourceXBoxX[i]+50 then Program.Delay(5) Shapes.Remove(shadow1[i]) Shadow1[i]=Shapes.AddTriangle(BoxX[i]+50,BoxY[i]+50,ShadowLeft[i],BoxY[i]+100,ShadowRight[i],BoxY[i]+100) ElseIf LightSourceXRTF108.sb< Start>RTF380.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 null=0 inp2="" 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 STOP DATA DEC ABS SQR VAL LEN USR _ " grtx[3]="MLT EXP LPRINT LLIST BIN INK$ PI " rdxt[1]="ASIN ACOS ATN SHAPE MERGE WEB CUB2 LEFT$ RGHT$ 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# MEMGET MEMSET MEMCLR 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 if cntr=1 then cntr=0 rrx= cntt else rrx=1 endif while rrx< m300 prgf=LDArray.GetValue (prg,rrx) If prgf="0" then 'nxx rrx=rrx+1 else pt=text.GetIndexOf (prgf,":")+1 cm=text.GetSubTextToEnd ( prgf,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="Tab" Then if text.IsSubText(inp+inp2,":") Then If inp2="" then ttw=LDText.Split(inp,":") tt= Shapes.GetTop (kw) Shapes.SetText(cml1,ttw[1]) Shapes.SetText(cml2,ttw[2]) dss=ldShapes.Width(cml1) Shapes.Move(kw,70+dss+10,tt) Shapes.Move(cml2,70+dss+15+10,tt) inp=ttw[1] inp2=":"+ttw[2] ww="" Else inp=inp+inp2 inp2="" Shapes.SetText(cml2,"") ww="" EndIf Else Goto eee endif elseIf lk="Space" Then ww=" " elseIf lk="Escape" and text.GetLength(inp)<4 Then' ----------------edits line eee: 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 clrcol'---------------------clears column : symbol num=text.GetSubText(inp,1,5) ' num=LDText.Replace(num,":"," ") inp=num+text.GetSubTextToEnd(inp,6) 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 GraphicsWindow.title=Array.GetItemCount(prgf) 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) an=Array.GetAllIndices (varr) vc=array.GetItemCount(an) For fd=1 To Array.GetItemCount(inn) ao=1 while Text.IsSubText (inn[fd],"&") and ao<=vc vn=text.ConvertToLowerCase(an[ao]) inn[fd]=LDText.Replace(text.ConvertToLowerCase(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 For q=1 To 6 '------nest level 6 loops cm=LDText.Replace(cm,"%F"+q,fv[q]) endfor ldcall.Function ("replvars",cm) cm=ress 'TextWindow.WriteLine(cm) 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 fs[fc]>0 then If fv[fc]<=fx[fc] then rrx=flin[fc] Else rrx=rrx+1 fc=fc-1 endif Else If fv[fc]>=fx[fc] then rrx=flin[fc] Else rrx=rrx+1 fc=fc-1 endif 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]) If ltx[4]="|" then If null=0 then varr[vn] = varr[vn] + ltx[3] EndIf Else varr[vn] = FCExtensions.MathEval( varr[vn]) + FCExtensions.MathEval( ltx[3]) endif elseIf ltx[1]="DEC" then vn = text.ConvertToLowerCase (ltx[2]) varr[vn] = varr[vn] - ltx[3] elseIf ltx[1]="MLT" 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]="REPLC" then rtx=varr["mm$"] ra=ltx[2] rb=ltx[3] ra=ldtext.replace(ra,";;",":") rb=ldtext.replace(rb,";;",":") varr["mm$"]=ldtext.replace(rtx,ra,rb) 'TextWindow.WriteLine("MM>>"+varr["mm$"]) elseIf ltx[1]="MEMGET" then inp=LDArray.GetValue (prg,ltx[2]) varr["mm$"]=ldtext.replace(inp," ","~") elseIf ltx[1]="MEMCLR" then For xm1=ltx[2] to ltx[3] LDArray.SetValue (prg,xm1,0) endfor elseIf ltx[1]="MEMSET" then msw=ldtext.replace(ltx[3],"~"," ") lsq=ltx[2] If lsq>m300-2 then lsq=m300-2 endif LDArray.SetValue (prg,lsq,msw) If msw=0 or msw="" then null=1 ' TextWindow.WriteLine("NUlll*************") Else null=0 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 clrcol() cm=ldtext.Trim(inp) 'TextWindow.WriteLine (inp) 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("RST 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>RTF380.sb< Start>RTH736.sb< NumOfBalls = 20 BallSize = 10 For i = 1 To NumOfBalls Ball[i] = Shapes.AddEllipse(BallSize,BallSize) Ballx[i] = Math.GetRandomNumber(GraphicsWindow.Width - BallSize) Bally[i] = Math.GetRandomNumber(GraphicsWindow.Height - BallSize) Dx[i] = Math.GetRandomNumber(20) / 10 + 1 Dy[i] = Math.GetRandomNumber(20) / 10 + 1 EndFor While 1 = 1 Program.Delay(5) For t = 1 To NumOfBalls Bally[t] = Bally[t] + Dy[t] Ballx[t] = Ballx[t] + Dx[t] Shapes.Move(Ball[t], Ballx[t],Bally[t]) If Ballx[t] < 0 Or Ballx[t] > GraphicsWindow.Width - BallSize Then Dx[t] = - Dx[t] EndIf If Bally[t] < 0 Or Bally[t] > GraphicsWindow.Height - BallSize Then Dy[t] = - Dy[t] EndIf ' For q = 1 to NumOfBalls ' If Ballx[t] > Ballx[q] And Ballx[t] < Ballx[q] + BallSize Then ' If Bally[t] > Bally[q] And Bally[t] < Bally[q] + BallSize Then ' If Ballx[t] <> Ballx[q] Then ' Dx[t] = - Dx[t] ' Dy[t] = - Dy[t] ' EndIf ' EndIf ' EndIf ' EndFor EndFor EndWhile End>RTH736.sb< Start>RTK453.sb< 'Copyrighted Software 2016. Abhishek Sathiabalan . All Rights Reserved. Governed by EULA. 'For a timeline of release information please check Assets\Change_Log Table 'v1114 ' Transaction DB Implemented (Default is OFF ) 'Partial Localization Implemtented . ' 53 Languages are computer translated. English is the only verified and vetted Language currently 'v1115 ("The Localization Patch") 'Added Localization/Lang Folder which enables switching between languages to be nearly instant 'Added backend capability to use mods :) 'Front End capability still needed :( 'Moved Export Functions to a MOD File :) 'v1116 ("The Plugin Patch ") 'Smarter Mod Loader 'Importer now works a lot more reliabley alabit a bit slower 'Command Function reworked to include a parser 'debug_Parser added . Default value 0 . Debugs Command Line Parser 'Moved EULA UI Over to Universal Handler 'Moved all UI over to Universal Handler 'Improved Start up Speed by removing useless code 'Made Main Menu Interface better 'Added Universal Handler to improve plugin support 'v1117 'Moved Backup URL To GITHUB '______________________________________________________________________________ ' To do - Non Modding '______________________________________________________________________________ 'Cross Engine Support 'Add more Core Functions to sqlite sys 'Resarch custom functions in sqlite 'Dataview bug report | Dataview Crash Bug 'Automatic Limiter on Dataview ? Using SQL Limit ? 'Export Menu 'Access Table 'New Table Menu 'SQL Functions List 'Make the mastertable a view and remove the program only restrictions on it 'Make Views Read Only Program Side 'Finer Transaction Logging Support ' Ability to Supress Queries or CMDS ' Automated Backup Script for DBs ? 'Custom Connection Strings '______________________________________________________________________________ ' Localize Iniative '______________________________________________________________________________ 'Localize Self 'Localize Import Module '______________________________________________________________________________ ' To do - Modding '______________________________________________________________________________ 'XML Based Menu and Actions ? 'Server - Client Iniative ' Make a Server Mod ? ' Make a Client Mod ? 'GUI For a Mod Manager 'Make MOD Documentation '______________________________________________________________________________ ' Module Iniative '______________________________________________________________________________ ' Make the Core Engine a Module :) StartTime[0] = Clock.ElapsedMilliseconds GraphicsWindow.Show() MainWindowID = LDWindows.CurrentID LDGraphicsWindow.ExitOnClose = "False" LDGraphicsWindow.CancelClose = "True" LDGraphicsWindow.Closing = Closing '______________________________________________________________________________ ' Functions List ( Mini API of sorts ) '______________________________________________________________________________ logfunction = "Log" QueryFunction = "Query" CommandFunction = "Command" TransactionFunction = "TransactionRecord" RunModParserFunction = "MOD_RUN_Parser" Function_XML_Attributes = "XML_Fetch_All" Function_Handler_ComboBox = "ComboBoxChanged" Function_Handler_EULA = "EULA_Handler" Function_Handler_MainMenu = "MainMenuHandler" Function_Handler_ExportCB = "Export_CB_Handler" Function_UI_Add = "Add_UI_Controls" Function_UI_Query = "Query_UI_Controls" Function_Handler_Universal = "Universal_Handler" Function_RunMod_Parser = RunModParserFunction Function_Command = CommandFunction Function_Query = QueryFunction Function_Log = logfunction Function_Transaction = TransactionFunction '______________________________________________________________________________ ' List Names '______________________________________________________________________________ Export_T2 = "Export T2" Export_T1 = "Export T1" TrackDefaultTable = "TrackDefaultTable" List_Mod_Name = "Mod_Name" List_Mod_Path = "Mod_Path" List_Command_Parser = "Command_SQL_Parser" List_Command_Parser_Status = "Command_SQL_Parser_Status" List_Command_Parser_OnFail = "Command_SQL_Parser_Fail" List_Command_Parser_OnFail_Index = "Command_SQL_Parser_Fail_Index" List_UI_Name = "UI_Name" List_UI_Handler = "UI_Handler" List_UI_Action = "UI_Action" Register = "Register" LDUtilities.ShowErrors = "False" LDUtilities.ShowFileErrors= "False" LDUtilities.ShowNoShapeErrors = "False" LDEvents.Error = ErrorHandler debug_mode = 0 '1=On;0=Off(Default) debug_Parser = 0 'Debugs the CMD Function Parser . Seperated bc otherwise it creates a lot of noise in the debug output EULA_Test = 0 'Default 0 copyrightDate = 2016 ProductID = "DBM" PrgmVersionID = 1117 title = "Database Manager (" + ProductID + ") v" + PrgmVersionID + " " Self = Program.Directory +"\DB Manager.exe" Booleans ="True=1;False=0;0=False;1=True;" '______________________________________________________________________________ ' Not to be set by Settings '______________________________________________________________________________ TabKey = Text.GetCharacter(9) CLLF = Text.GetCharacter(10) DoubleQuotesCharacter = Text.GetCharacter(34) XML_Version_Number ="1.0" MOD_Running_False = 0 'Temp Fake Variable ; Add Functionality Later SQLFunctionsList = "1=AVG;2=COUNT;3=MAX;4=MIN;5=SUM;6=TOTAL;7=Hex;8=Length;9=Lower;10=round;11=Trim;12=Upper;" SQLFunctionsList = Text.ConvertToUpperCase( SQLFunctionsList ) DB_Engines_Types = "1=MySQL;2=Odbc;3=Oledb;4=SQLite;5=SqlServer;" DB_Engine_Username = "1=1;2=1;3=1;4=0;5=1;" DB_Engine_Password = "1=1;2=1;3=1;4=0;5=1;" Engine_Mode = 4 LOG_DB_SQL = "CREATE TABLE IF NOT EXISTS Log (ID Integer Primary Key,[UTC_DATE] TEXT,[UTC_TIME] TEXT,Date TEXT,Time TEXT,USER TEXT,ProductID TEXT,ProductVersion INTEGER,Type TEXT,Event TEXT);" LOG_DB_SQL_View = "CREATE VIEW IF NOT EXISTS [LOCAL_TIME] AS SELECT ID,DATE,TIME,USER,PRODUCTID,PRODUCTVERSION,Type,Event From Log;CREATE VIEW IF NOT EXISTS [UTC_TIME] AS Select ID,UTC_DATE,UTC_TIME,USER,ProductID,ProductVersion,Type,Event From Log;" Transactions_SQL = "CREATE TABLE IF NOT EXISTS Transactions (ID INTEGER PRIMARY KEY,UTC_DATE TEXT,UTC_TIME TEXT,USER TEXT,PATH TEXT,DB TEXT,SNAME TEXT,SQL TEXT,Type TEXT,Reason TEXT);" '______________________________________________________________________________ ' File Operations '______________________________________________________________________________ AssetPath = Program.Directory +"\Assets\" logpath = AssetPath +"Log.csv" LogDBpath = AssetPath +"Log.db" TransactionDBpath = AssetPath +"Transactions.db" EULAFile = AssetPath +"EULA.txt" settingspath = AssetPath+"setting.txt" ModPath = AssetPath +"Mod\" AutoRunMod_Path = AssetPath +"Auto Run Mod.txt" HelpPath = AssetPath +"HELP Table.html" LocalizationsFolder = Program.Directory +"\Localization\" LocalizationsLangFolder = Program.Directory +"\Localization\Lang\" ' The following line could be harmful and has been automatically commented. ' LocalizationsFilesArray = File.GetFiles ( LocalizationsFolder ) ' The following line could be harmful and has been automatically commented. ' IF LDFile.Exists(AssetPath) = "False" Or LDFile.Exists(LocalizationsFolder) = "False" Or LDFile.Exists( ModPath ) = "False" Then ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(AssetPath) ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(LocalizationsFolder ) ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(ModPath ) EndIf ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists( AutoRunMod_Path ) = "False" Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents( AutoRunMod_Path , "# This file designates the Mod and the subroutine the main program should call on the start of the program. Use this to insert your UI at startup. The character # marks the line as commented. ") EndIf ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(logpath) = "False" Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents( logpath , "id,local date,local time,Username,Product ID,Version ,Type of Error,Log Event") EndIf LOG_DB= LDDataBase.ConnectSQLite(LogDBpath) ' Creates Log DB if it does not exist TransactionDB = LDDataBase.ConnectSQLite( TransactionDBpath ) LDList.Add("DB_Path", LogDBpath ) LDList.Add("DB_Name", Log_DB ) LDList.Add("DB_Path", TransactionDBpath ) LDList.Add("DB_Name", TransactionDB ) LDDataBase.Command( TransactionDB , Transactions_SQL) LDCall.Function4( CommandFunction , LOG_DB , LOG_DB_SQL,"App","Auto Creation Statements" ) ' Cannot be Localized LDCall.Function4( CommandFunction , LOG_DB , LOG_DB_SQL_View ,"App","Auto Creation Statements")'Cannot be Localized LDCall.Function4( CommandFunction , TransactionDB , Transactions_SQL ,"App","Auto Creation Statements") ' Cannot be Localized LogNumber = LDDataBase.Query( LOG_DB,"SELECT COUNT(ID) From Log;","","True") LogNumber = LogNumber[1]["COUNT(ID)"] LDCall.Function5(TransactionFunction , "App" , LOG_DB +"| LOG" ,"SELECT COUNT(ID) From Log;" ,"Query", " Auto Query Log Count") 'Cannot be Localized TransactionNumber = LDDataBase.Query( TransactionDB,"SELECT COUNT(ID) From Transactions","","True") TransactionNumber = TransactionNumber[1]["COUNT(ID)"] OnlineEULaPath = "https://drive.google.com/uc?export=download&id=0B2v4xbFnpKvRNTFKckFKLVNNUDg" 'EULA Path OnlineDB_Refrence_Location = "https://docs.google.com/uc?id=0B2v4xbFnpKvRVmNVODZ4bnppd3c&export=download" 'Update DB Path StartTime[1] = Clock.ElapsedMilliseconds LDNetwork.DownloadFile(EULAFile,OnlineEULaPath) EndTime[1] = Clock.ElapsedMilliseconds LoadedFile = 0 SortByMode = 1 RestoreSettings = 0 args = "" 'Gets EULA Version ' The following line could be harmful and has been automatically commented. ' EULA_Version = LDText.Replace(File.ReadLine(EULAFile,1)," ","") For I = 1 To Text.GetLength(EULA_Version) Character = Text.GetSubText(EULA_Version,I,1) If Character <> TabKey Then NEULA_Version = Text.Append(NEULA_Version, Character ) EndIf EndFor EULA_Version = NEULA_Version NEULA_Version ="" '______________________________________________________________________________ ' End of No Settings Zone '______________________________________________________________________________ Startup() Sub Startup MOD_Find_All() LoadSettings() CMD_Output = AssetPath + "CMD.txt" CMD_String = "ECHO %SYSTEMROOT% >> " + CMD_Output ' The following line could be harmful and has been automatically commented. ' File.WriteContents(AssetPath+"Sysroot.bat" , CMD_String ) LDProcess.Start( AssetPath +"Sysroot.bat" ,"") Localization_XML() LDCall.Function2( logfunction , "Program Started",LangList["Application"]) '// Localize If Program.ArgumentCount = 1 Then GetPath() Load_DB() EndIf ' The following line could be harmful and has been automatically commented. ' If (EULA_Accepted = "True") And (EULA_Accepted_By = LDFile.UserName) And (EULA_Version = EULA_Accepted_Version) And (VersionID = PrgmVersionID) And EULA_Test = 0 Then Startup_GUI() Else SaveSettings() EULA_UI() EndIf EndSub Sub Startup_GUI Pre_MainMenuUI() MOD_READ_AutoRunFile() MOD_AutoRun() LDCall.Function2( logfunction , "Startup Time: " +(Clock.ElapsedMilliseconds - StartTime[0]) +" (ms)" ,LangList["UI"]) MainMenuUI() EndSub Sub Localization_XML XML_Localization_Path = LocalizationsFolder + Localization_lang+".xml" Localization_XML_DOC = LDxml.Open(XML_Localization_Path) ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(XML_Localization_Path ) Then LDxml.FirstNode() LDxml.FirstChild() LDxml.LastChild() XML_Array = LDCall.Function( Function_XML_Attributes , "") Localixation_XML_Private() While LDxml.PreviousSibling() = "SUCCESS" XML_Array = LDCall.Function( Function_XML_Attributes , "") Localixation_XML_Private() EndWhile Else LDCall.Function2( logfunction , "Localization XML Missing","Application") 'DO NOT LOCALIZE EVER! This error indicates the localization file is missing!! EndIf 'LDLanguages = LDTranslate.Languages() ' The following line could be harmful and has been automatically commented. ' Localization_Temp = File.ReadContents( LocalizationsLangFolder +Localization_lang+".txt" ) For I = 1 To Array.GetItemCount( LocalizationsFilesArray ) ' The following line could be harmful and has been automatically commented. ' MLanguages[I] = LDFile.GetFile( LocalizationsFilesArray[I] ) Localization_List[ MLanguages[I] ] = Localization_Temp[MLanguages[I]] LDList.Add("ISO_Lang", MLanguages[I] ) LDList.Add("ISO_Text" , Localization_List[ MLanguages[I] ] ) EndFor EndSub Sub Localixation_XML_Private If XML_Array[1]["language"] = Localization_lang Then LangList[ LDText.Replace( XML_Array[4] ,"_"," ") ] = XML_Array[6] ElseIf debug_mode = 1 Then TextWindow.WriteLine ("Recjected: " + XML_Array ) EndIf EndSub Sub LoadSettings If RestoreSettings = 0 Then ' The following line could be harmful and has been automatically commented. ' Settings = File.ReadContents(settingspath) EndIf Listview_Width = Settings["Listview_Width"] Listview_Height = Settings["Listview_Height"] VersionID = Settings["VersionID"] lastFolder = Settings["LastFolder"] SupportedExtensions = Settings["Extensions"] deliminator = Settings["Deliminator"] Transactions_mode = Settings["Transactions"] Localization_lang = Settings["Language"] EULA_Accepted = Settings["EULA"] EULA_Accepted_By = Settings["EULA_By"] EULA_Accepted_Version = Settings["EULA_Version"] OS_Dir = Settings["OS_Dir"] debug_mode = Settings["debug_mode"] debug_Parser = Settings["debug_parser"] Null_Settings = "1=Listview_Width;2=Listview_Height;3=VersionID;4=Extensions;5=Language;6=Transactions;7=LastFolder;8=OS_Dir;9=debug_parser;10=debug_mode;" ' The following line could be harmful and has been automatically commented. ' Setting_Default ="1=1500;2=900;3="+ PrgmVersionID +";5=en;6=0;7=" +LDFile.DocumentsFolder +";8=C:\\Windows\\System32\\;9=0;10=0;" Setting_Default[4] = "1=db;2=sqlite;3=*;" For I = 1 To Array.GetItemCount( Null_Settings ) If Settings[ Null_Settings[I] ] = "" Then Settings[ Null_Settings[I] ] = Setting_Default[I] RestoreSettings = 1 EndIf EndFor If RestoreSettings = 1 Then Listview_Width = Settings["Listview_Width"] Listview_Height = Settings["Listview_Height"] VersionID = Settings["VersionID"] SupportedExtensions = Settings["Extensions"] Localization_lang = Settings["Language"] Transactions_mode = Settings["Transactions"] lastFolder = Settings["LastFolder"] EndIf SaveSettings() EndSub Sub SaveSettings ' The following line could be harmful and has been automatically commented. ' status= File.WriteContents(settingspath,Settings) If status = "FAILED" Then LDCall.Function2( logfunction ,"Failed to save settings","UI") GraphicsWindow.ShowMessage(LangList["Failed Save Settings"] ,LangList["Error"]) 'Failed to Save Settings EndIf EndSub Sub GetPath If Program.ArgumentCount = 1 AND LoadedFile = 0 Then databasepath = Program.getArgument(1) LoadedFile = 1 Else databasepath = LDDialogs.OpenFile(SupportedExtensions,lastFolder+"\") EndIf EndSub Sub Load_DB ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(databasepath) = "True" then database = LDDataBase.ConnectSQLite(databasepath) LDCall.Function2(logfunction, "Program Started - OPENED : " + databasepath ,LangList["Application"])'//Localize ' The following line could be harmful and has been automatically commented. ' Settings["LastFolder"] = LDFile.GetFolder(databasepath) SaveSettings() LDList.Add("DB_Path", databasepath ) LDList.Add("DB_Name", database ) Else LDCall.Function2(logfunction, "Program Started - Failed to OPEN : " + databasepath,"Application" ) '//Localize GraphicsWindow.ShowMessage("File Could not be found or opened ", "Fatal Error" ) '//Localize Endif EndSub '______________________________________________________________________________ ' EULA UI '______________________________________________________________________________ Sub EULA_UI GraphicsWindow.Show() GraphicsWindow.Left = Desktop.Width / 3 GraphicsWindow.Top = Desktop.Height / 4 GraphicsWindow.Title = title + "EULA" defaultWidth = GraphicsWindow.Width defaultHeight= GraphicsWindow.Height LDControls.RichTextBoxReadOnly = "True" eulatextbox = LDControls.AddRichTextBox(600,350) Controls.Move(eulatextbox,10,10) LDControls.RichTextBoxReadOnly = "False" ' The following line could be harmful and has been automatically commented. ' DowloandedFilePath = File.GetTemporaryFilePath() LDNetwork.DownloadFile(DowloandedFilePath ,OnlineEULaPath) ' The following line could be harmful and has been automatically commented. ' OnlineEULACnts = File.ReadContents( DowloandedFilePath ) OnlineEULACnts = LDText.Replace(OnlineEULACnts,"",copyrightDate ) If OnlineEULACnts = "" Then LDCall.Function2( logfunction ,LangList["Failed Load Online EULA"],LangList["UI"]) GraphicsWindow.ShowMessage(LangList["Failed Load Online EULA"],LangList["Error"]) ' The following line could be harmful and has been automatically commented. ' EULAContents = Text.Append("This is the EULA that came with this program. This may not be the most latest EULA. Subject to General Part F the most latest EULA can be found here:" +Text.GetCharacter(10) + OnlineEULaPath ,File.ReadContents(EULAFile) ) Else EULAContents = OnlineEULACnts ' The following line could be harmful and has been automatically commented. ' File.WriteContents(EULAFile, EULAContents) EndIf If EULAContents = "" Then LDCall.Function2( logfunction , "NO EULA FOUND. Local or Online","UI")'//Localize GraphicsWindow.ShowMessage("EULA could not be loaded. This program cannot start without its EULA." "EULA LOAD ERROR")'//Localize Program.End() Else LDControls.RichTextBoxSetText(eulatextbox,EULAContents,"False") EULAContents = "" Ihaveread = LDControls.AddCheckBox("I have read and agree to this EULA.") EULAaccept = Controls.AddButton("Accept",235,390) EULADecline = Controls.AddButton("Decline",235+80,390) Controls.Move(Ihaveread,190,365) Controls.SetSize(EULAaccept,70,30) Controls.SetSize(EULADecline,70,30) LDCall.Function3( Function_UI_Add , Register , Ihaveread , Function_Handler_EULA ) LDCall.Function3( Function_UI_Add , Register , EULAaccept, Function_Handler_EULA ) LDCall.Function3( Function_UI_Add , Register , EULADecline, Function_Handler_EULA ) EndIf Controls.ButtonClicked = Universal_BD EndSub Sub EULA_Handler If args[1] <> "" Then LastClickedButton = args[1] EndIf ' The following line could be harmful and has been automatically commented. ' Settings["EULA_By"] = LDFile.UserName Settings["EULA_Version"] = EULA_Version Settings["VersionID"] = PrgmVersionID If LastClickedButton = EULAaccept AND LDControls.CheckBoxGetState(Ihaveread) = "True" Then Settings["EULA"] = "True" SaveSettings() GraphicsWindow.Clear() Startup_GUI() ElseIf LastClickedButton = EULADecline Then Settings["EULA"] = "False" SaveSettings() LDCall.Function2( logfunction , "EULA Declined","UI") GraphicsWindow.ShowMessage("If you disagree with this EULA please delete this program","EULA Decline") Program.End() EndIf EndSub '______________________________________________________________________________ ' Maine Menu UI '______________________________________________________________________________ Sub Pre_MainMenuUI 'Basically a List of Defines for the Main Menu UI 'Root LDCall.Function5(Function_UI_Add,"Menu",LangList[ "File" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "Edit" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "View" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "Save" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "Import" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "Export" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList[ "Settings" ], Function_Handler_MainMenu , "Main","") LDCall.Function5(Function_UI_Add,"Menu",LangList["New"], Function_Handler_MainMenu , LangList["File"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Open"], Function_Handler_MainMenu , LangList["File"],"") LDCall.Function5(Function_UI_Add,"Menu","-", Function_Handler_MainMenu , LangList["File"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["CSV"], Function_Handler_MainMenu , LangList["Import"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["SQL"], Function_Handler_MainMenu , LangList["Import"],"") LDCall.Function5(Function_UI_Add,"Menu","-", Function_Handler_MainMenu , LangList["Import"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["CSV"] + " ", Function_Handler_MainMenu , LangList["Export"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["SQL"] +" ", Function_Handler_MainMenu , LangList["Export"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["PXML"] + " " , Function_Handler_MainMenu , LangList["Export"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["HTML"] + " " , Function_Handler_MainMenu , LangList["Export"],"") LDCall.Function5(Function_UI_Add,"Menu","Export UI", Function_Handler_MainMenu , LangList["Export"],"") '// Localize LDCall.Function5(Function_UI_Add,"Menu","-", Function_Handler_MainMenu , LangList["Export"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Help"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["About"], Function_Handler_MainMenu , LangList["Help"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Show Help"], Function_Handler_MainMenu , LangList["Help"],"") LDCall.Function5(Function_UI_Add,"Menu","-", Function_Handler_MainMenu , LangList["Help"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Settings Editor"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Toggle Debug"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Toggle Transaction Log"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Refresh"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu",LangList["Check for Updates"], Function_Handler_MainMenu , LangList["Settings"],"") LDCall.Function5(Function_UI_Add,"Menu","Close TW", Function_Handler_MainMenu , LangList["Settings"],"") '// Localize LDCall.Function5(Function_UI_Add,"Menu","-", Function_Handler_MainMenu , LangList["Settings"],"") ViewDB_Button = LangList["View"] NewDB_Button = LangList["New"] EditDB_Button = LangList["Edit"] OpenDB_Button = LangList["Open"] ImportCSV_Button = LangList["CSV"] ImportSQL_Button = LangList["SQL"] ExportCSV_Button = LangList["CSV"]+" " ExportSQL_Button = LangList["SQL"]+" " ExportXML_Button = LangList["PXML"] +" " ExportHTML_Button = LangList["HTML"]+" " SaveButton = LangList["Save"] SettingsButton = LangList["Settings Editor"] ToggleDebug_Button = LangList["Toggle Debug"] AboutButton = LangList["About"] ShowHelp = LangList["Show Help"] RefreshButton = LangList["Refresh"] CheckForUpdates = LangList["Check for Updates"] ToggleTransaction = LangList["Toggle Transaction Log"] CLoseTW_Button = "Close TW" '// Localize Export_UI_Button = "Export UI" '// Localize EndSub Sub MainMenuUI GraphicsWindow.CanResize = "True" LDGraphicsWindow.ExitButtonMode(GraphicsWindow.Title,"Enabled") If debug_mode = 1 Then CheckList[ LangList["Toggle Debug"]] = "True" LDCall.Function2( logfunction , "Debug Mode is ON","UI") ElseIf debug_mode = 0 Then CheckList[LangList["Toggle Debug"]] = "False" EndIf If Transactions_mode = 1 Then CheckList[LangList["Toggle Transaction Log"]] = "True" ElseIf Transactions_mode = 0 Then CheckList[LangList["Toggle Transaction Log"]] = "False" EndIf 'GraphicsWindow.Clear() 'Is this nessecarry ?? //TO DO //LOCALIZE //FLAG LDGraphicsWindow.State = 2 GraphicsWindow.Title = title + " " Default_FontSize = GraphicsWindow.FontSize TypesOfSorts = "1=" + LangList["Table"] +";2=" +LangList["View"] +";3=" + LangList["Index"] +";4=" +LangList["Master Table"] +";" Get_SCHEMA() SCHEMA_CurrentList = SCHEMA_TableList GraphicsWindow.FontSize = 20 Menu = LDControls.AddMenu(Desktop.Width,30,MenuList,"",CheckList) Shapes.Move( Shapes.AddText(LangList["Sort"] +":") , 890 , 1) GraphicsWindow.FontSize = Default_FontSize TableCB = LDControls.AddComboBox(SCHEMA_TableList,100,100) SortsCB = LDControls.AddComboBox(TypesOfSorts,100,100) Controls.Move(TableCB,970,5) Controls.Move(SortsCB,1075,5) LDCall.Function5( Function_UI_Add , Register , TableCB , Function_Handler_ComboBox ,"","") LDCall.Function5( Function_UI_Add , Register , SortsCB , Function_Handler_ComboBox ,"","") LastClickedButton = ViewDB_Button 'Acts like a Virtual Function Call MainMenuHandler() GraphicsWindow.Title = title + " " +LangList[ "Table" ] +": " + Default_Table Ldcontrols.MenuClicked = Universal_MenuClicked LDControls.ComboBoxItemChanged = Universal_ComboBoxChanged Controls.ButtonClicked = Universal_BD If debug_mode = 0 And debug_Parser = 0 Then TextWindow.Hide() EndIf EndSub Sub MainMenuButton ' TextWindow.WriteLine(":(") LDCall.Function( Function_Handler_MainMenu , Controls.LastClickedButton ) EndSub Sub ComboBoxChanged If args[1] <> "" Then LastClickedCB = args[1] Else LastClickedCB = LDControls.LastComboBox EndIf LastCBIndex = LDControls.LastComboBoxIndex If LastClickedCB = TableCB Then If LDList.GetAt(TrackDefaultTable,LDList.Count(TrackDefaultTable)) <> LastCBIndex Then LDList.Add(TrackDefaultTable,LastCBIndex) Default_Table = SCHEMA_CurrentList[ LastCBIndex ] Get_SCHEMA_Private() Hide_Display_Results() List = SchemaList LDControls.ComboBoxContent(SortByCB ,SchemaList) LDControls.ComboBoxContent(SearchByCB, SchemaList ) LDControls.ComboBoxContent(ColumnListCB, SchemaList ) GraphicsWindow.Title = title + TypesOfSorts[SortByMode] +": " + Default_Table LastClickedButton = ViewDB_Button MainMenuHandler() EndIf ElseIf LastClickedCB = SortsCB Then SortsCB_IndexList = "1="+SCHEMA_TableList+";2="+SCHEMA_ViewList+";3="+SCHEMA_IndexList+";" SortByMode = LastCBIndex If LastCBIndex = 1 Then Default_Table = SCHEMA_TableList[1] SCHEMA_CurrentList = SCHEMA_TableList LDControls.ComboBoxContent(TableCB, SCHEMA_TableList ) ElseIf LastCBIndex = 2 Then Default_Table = SCHEMA_ViewList[1] SCHEMA_CurrentList = SCHEMA_ViewList LDControls.ComboBoxContent(TableCB, SCHEMA_ViewList ) ElseIf LastCBIndex = 3 Then Default_Table = SCHEMA_IndexList[1] SCHEMA_CurrentList = SCHEMA_IndexList LDControls.ComboBoxContent(TableCB, SCHEMA_IndexList ) ElseIf LastCBIndex = 4 then Default_Table = "sqlite_master" LDCall.Function( Function_Handler_Universal , ViewDB_Button ) EndIf If (LastCBIndex = 1 OR LastCBIndex = 2 OR LastCBIndex = 3 Or LastCBIndex = 4)and Default_Table <> "" Then LDList.Clear(TrackDefaultTable) LDList.Add(TrackDefaultTable,1) Get_SCHEMA_Private() Hide_Display_Results() List = SchemaList LDControls.ComboBoxContent(SortByCB ,SchemaList) LDControls.ComboBoxContent(SearchByCB, SchemaList ) LDControls.ComboBoxContent(ColumnListCB, SchemaList ) GraphicsWindow.Title = title + TypesOfSorts[SortByMode] +": " + Default_Table LDCall.Function( Function_Handler_Universal , ViewDB_Button ) GraphicsWindow.Title = title + " "+ TypesOfSorts[SortByMode] +": " + Default_Table Else LDCall.Function2(logfunction,"In the current database no "+LangList[ TypesOfSorts[SortByMode] ]+"s can be found.","UI") '//Localize GraphicsWindow.ShowMessage("In the current database no "+ LangList[ TypesOfSorts[SortByMode] ] +"s can be found." , "Error" ) '//Localize EndIf If debug_mode = 1 Then TextWindow.WriteLine("DEBUG: "+ LastCBIndex +":"+ TypesOfSorts[LastCBIndex] +":" + SortsCB_IndexList[LastCBIndex] +":" + Default_Table ) EndIf EndIf EndSub Sub MainMenuHandler Results_Search = 0 Results_Sort = 0 Results_Function = 0 If args[1] <> "" Then LastClickedButton = args[1] If debug_mode = 1 Then Textwindow.writeline(args[1]) EndIf EndIf If debug_mode = 0 Then TextWindow.Hide() EndIf If LastClickedButton = NewDB_Button Then 'New Database NewFileSavePath = LDDialogs.SaveFile("db",lastFolder) If NewFileSavePath <> "" Then ' The following line could be harmful and has been automatically commented. ' lastFolder = LDFile.GetFolder(NewFileSavePath) SaveSettings() TextWindow.Write("Creation Statement:") UserSQL = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' LDCall.Function4( CommandFunction , LDDataBase.ConnectSQLite(NewFileSavePath) , UserSQL ,LDFile.UserName ,"NEW DB") LDCall.Function2(logfunction, "Created DB : " + NewFileSavePath,"Application") listview = "" Dataview = "" databasepath = NewFileSavePath LoadSettings() Load_DB() SaveSettings() Pre_MainMenuUI() MainMenuUI() EndIf ElseIf LastClickedButton = EditDB_Button Then 'Edit Database List View If database <> "" Then If SortByMode <> 4 AND SortByMode <> 2 Then Controls.HideControl(listview) If Dataview = "" Then Dataview = LDControls.AddDataView(Listview_Width,Listview_Height,"") 'TextWindow.WriteLine(Dataview) 'Debug Controls.Move(Dataview,10,35) Else Controls.ShowControl(Dataview) EndIf CurrentControl = Dataview LDDataBase.EditTable(database,Default_Table,CurrentControl) Hide_Display_Results() ElseIf SortByMode = 4 Then LDCall.Function2(logfunction ,LangList["Master Table Protected"] , LangList["UI"]) GraphicsWindow.ShowMessage(LangList[ "Error"] +":" + LangList["Master Table Protected"] ,LangList["Access Denied"]) ElseIf SortByMode = 2 Then LDCall.Function2(logfunction ,"Views are a readonly type." , LangList["UI"]) 'Localize GraphicsWindow.ShowMessage(LangList[ "Error"] +":" + "Views cannot be edited" ,LangList["Access Denied"]) 'Lozalize EndIf Else LDCall.Function2(logfunction ,LangList["Error No DB"] , LangList["UI"]) GraphicsWindow.ShowMessage(LangList["Error No DB"] ,LangList[ "Error" ]) EndIf ElseIf LastClickedButton = ViewDB_Button Then 'View Database Controls.HideControl(Dataview) If listview = "" Then listview = LDDataBase.AddListView(Listview_Width,Listview_Height) Controls.Move(listview,10,35) Display_Results() Else Show_Display_Results() Controls.ShowControl(listview) EndIf CurrentControl = listview If Default_Table <> "" Then LDCall.Function5(QueryFunction,"SELECT * FROM " + Default_Table +";",CurrentControl,"False" ,LangList["App"],LangList[ "View Function"]) EndIf ElseIf LastClickedButton = OpenDB_Button Then 'Opens a DB listview = "" Dataview = "" LoadSettings() GetPath() Load_DB() SaveSettings() Pre_MainMenuUI() MainMenuUI() Elseif LastClickedButton = SaveButton Then 'Save Button If database <> "" and Dataview <> "" Then Save_Status = LDDataBase.SaveTable(database,Dataview) LDCall.Function2(logfunction ,"The save was : " + Save_Status , "UI" ) '//Localize GraphicsWindow.ShowMessage("The save was : " + Save_Status,"Save Status !") '//Localize Else LDCall.Function2(logfunction ,"The Database or Dataview does not exist or have not yet been loaded", "UI" ) '//Localize GraphicsWindow.ShowMessage("Error : The Database or Dataview does not exist or have not yet been loaded","Save Error") '//Localize EndIf ElseIf LastClickedButton = SortButton Then 'Sort View Results_Sort = 1 GenerateQuery() ElseIf LastClickedButton = SearchButton Then 'Search View Results_Search = 1 GenerateQuery() ElseIF LastClickedButton = CustomQueryButton Then 'USER Custom Query SQL ' The following line could be harmful and has been automatically commented. ' LDCall.Function5(QueryFunction,Controls.GetTextBoxText(CustomQuery),CurrentControl,"False",LDFile.UserName,LangList["User Requested"]) ElseIf LastClickedButton = CommandButton Then 'User Custom Run SQL ' The following line could be harmful and has been automatically commented. ' updated = LDCall.Function4(CommandFunction , database , Controls.GetTextBoxText(CustomQuery) , LDFile.UserName,LangList[ "User Requested" ]) GraphicsWindow.ShowMessage(" " + updated + " number of rows were updated.","") '//Localize ElseIf LastClickedButton = RunFunctionButton Then Results_Function = 1 GenerateQuery() ElseIf LastClickedButton = ImportCSV_Button Then 'Imports CSV LDCall.Function( Function_RunMod_Parser , "Import.CSV") ElseIf LastClickedButton = ImportSQL_Button Then ' Imports SQL ' The following line could be harmful and has been automatically commented. ' CurrentFolder = LDFile.GetFolder(databasepath) ' The following line could be harmful and has been automatically commented. ' records = LDCall.Function4( CommandFunction , database, File.ReadContents( LDDialogs.OpenFile("sql",CurrentFolder ) ) , LDFile.UserName ,"Import SQL") '//Localize LDCall.Function2(logfunction, "Imported data into: " + databasepath +" From sql file","Application") '//Localize GraphicsWindow.ShowMessage(records + " records updated","IMPORT") '//Localize ElseIf LastClickedButton = ExportSQL_Button Then LDCall.Function(Function_RunMod_Parser,"Export.Export_SQL") ElseIf LastClickedButton = ExportCSV_Button Then TextWindow.WriteLine("") TextWindow.WriteLine("SELECT DATA TO WRITE IN " + LastClickedButton) TextWindow.Write(">") querycmd = TextWindow.Read() querycmd = Text.ConvertToLowerCase(querycmd) TextWindow.Clear() TextWindow.Hide() LDCall.Function(Function_RunMod_Parser, "Export.CSV" ) ElseIf LastClickedButton = ExportXML_Button Then TextWindow.WriteLine("") TextWindow.WriteLine("SELECT DATA TO WRITE IN " + LastClickedButton) TextWindow.Write(">") querycmd = TextWindow.Read() querycmd = Text.ConvertToLowerCase(querycmd) TextWindow.Hide() LDCall.Function( Function_RunMod_Parser , "Export.XML" ) ElseIf LastClickedButton = ExportHTML_Button Then LDCall.Function( Function_RunMod_Parser, "Export.HTML" ) 'Mod Version ; Runs as a dll of sorts ElseIf LastClickedButton = ToggleDebug_Button Then If debug_mode = 1 Then debug_mode = 0 ElseIf debug_mode = 0 Then debug_mode = 1 EndIf ElseIf LastClickedButton = AboutButton Then GraphicsWindow.ShowMessage("DBM is a Database Mangement Program developed by Abhishek Sathiabalan. Copyright " + copyrightDate + ". All rights reserved." + CLLF + CLLF +"You are running : " + ProductID +" v" + VersionID ,"About") 'DO NOT LOCALIZE ElseIf LastClickedButton = ShowHelp Then LDProcess.Start(HelpPath,"") ElseIf LastClickedButton = SettingsButton Then Settings_UI() ElseIf LastClickedButton = Setting_Save Then Settings["Listview_Width"] = Controls.GetTextBoxText(Settings_WidthTB ) Settings["Listview_Height"]= Controls.GetTextBoxText(Settings_HeigthTB ) Settings["Extensions"] = Controls.GetTextBoxText(Settings_ExtensionsTB) Settings["Deliminator"] = Controls.GetTextBoxText( Settings_DeliminatorTB ) Settings["Language" ] = LDList.GetAt("ISO_Lang", LDControls.ComboBoxGetSelected( Language_LB ) ) TextWindow.WriteLine( LDControls.CheckBoxGetState( Settings_Debug_Mode ) ) 'debug_mode = LDControls.CheckBoxGetState( Settings_Debug_Mode ( 'debug_Parser = Localization_lang = Settings["Language" ] SaveSettings() LoadSettings() 'Sets it up so the Language Info can be reset LDList.Clear("ISO_Lang") LDList.Clear("ISO_Text") MenuList = "" CheckList= "" Localization_XML() LastClickedButton = Settings_Close MainMenuHandler() ElseIf LastClickedButton = Settings_Close Then listview = "" Dataview = "" Pre_MainMenuUI() MainMenuUI() ElseIf LastClickedButton = MoveRight Then 'Export UI Controls CB_Node = LDControls.ListBoxGetSelected( ExportListBox[1] ) If LDList.Contains(Export_T2, LDList.GetAt(Export_T1, CB_Node)) = "False" Then LDList.Add( Export_T2, LDList.GetAt(Export_T1, CB_Node )) LDList.SetAt(Export_T1,CB_Node ,"") Export_T1 = LDList.FromArray( LDList.ToArray(Export_T1) ) LDControls.ListBoxContent( ExportListBox[1],Export_T1 ) LDControls.ListBoxContent(ExportListBox[2] ,Export_T2) EndIf ElseIf LastClickedButton = MoveLeft Then CB_Node = LDControls.ListBoxGetSelected( ExportListBox[2] ) If LDList.Contains(Export_T1, LDList.GetAt(Export_T2, CB_Node)) = "False" Then LDList.Add( Export_T1, LDList.GetAt(Export_T2, CB_Node )) LDList.SetAt(Export_T2,CB_Node ,"") Export_T2 = LDList.FromArray( LDList.ToArray(Export_T2) ) LDControls.ListBoxContent( ExportListBox[1],Export_T1 ) LDControls.ListBoxContent(ExportListBox[2] ,Export_T2) EndIf ElseIf LastClickedButton = NextButton Then 'Create SQL Export Query :) ElseIf LastClickedButton = RefreshButton Then Get_SCHEMA() ElseIf LastClickedButton = CheckForUpdates Then MannualUpdateCheck = 1 UpdateFunction() ElseIf LastClickedButton = ToggleTransaction Then If Transactions_mode = 1 Then Transactions_mode = 0 ElseIf Transactions_mode = 0 Then Transactions_mode = 1 EndIf Settings["Transactions"] = Transactions_mode SaveSettings() ElseIf LastClickedButton = Export_Close Then listview = "" Dataview = "" Pre_MainMenuUI() MainMenuUI() LastClickedButton = ViewDB_Button MainMenuHandler() ElseIf LastClickedButton = Export_UI_Button Then Export_UI() ElseIf LastClickedButton = CLoseTW_Button Then TextWindow.Clear() TextWindow.Hide() Else GraphicsWindow.ShowMessage ( LastClickedButton + " "+ LDCall.Function2( Function_UI_Query , Register , LastClickedButton ) ,"") EndIf If LastClickedButton = ExportHTML_Button Or LastClickedButton = ExportCSV_Button Or LastClickedButton = ExportXML_Button or LastClickedButton = ExportSQL_Button Then LDCall.Function2(logfunction, "Exported: " + databasepath+" | " +TypesOfSorts[ SortByMode ] +":" + Default_Table + " INTO " + LastClickedButton,LangList["Application"]) '//Localize GraphicsWindow.ShowMessage("RAN EXPORT INTO " + LastClickedButton, LangList[ "Export"]) '//Localize EndIf EndSub '______________________________________________________________________________ ' Graphic Magic '______________________________________________________________________________ Sub Hide_Display_Results default_Brush = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = "WHITE" GraphicsWindow.FillRectangle( UIx -5 ,45 ,320 ,350) GraphicsWindow.BrushColor = default_Brush For I = 1 To Array.GetItemCount(Display_Results_MasterControlsList) Controls.HideControl(Display_Results_MasterControlsList[I] ) EndFor EndSub Sub Show_Display_Results GraphicsWindow.DrawRectangle( UIx ,50 ,310 ,240) GraphicsWindow.FontSize = 15 GraphicsWindow.DrawText( UIx + 100 , 52 ,LangList[ "Display Settings" ]) GraphicsWindow.DrawText( UIx + 20 ,73 ,LangList["Sort by"]) GraphicsWindow.DrawText( UIx + 100 , 150 , LangList["Search Settings"]) GraphicsWindow.DrawText( UIx + 20,180,LangList["Search in"]) GraphicsWindow.DrawText( UIx + 20,210,LangList["Search"] +":") For I = 1 To Array.GetItemCount(Display_Results_MasterControlsList) Controls.ShowControl(Display_Results_MasterControlsList[I] ) EndFor EndSub Sub Display_Results GraphicsWindow.Width = Desktop.Width GraphicsWindow.Height = Desktop.Height GraphicsWindow.Left = 0 GraphicsWindow.Top = 0 UIx = Listview_Width + 50 OrderByOptions = "1=ASC;2=DESC;" GraphicsWindow.DrawRectangle( UIx ,50 ,310 ,340) GraphicsWindow.FontSize = 15 GraphicsWindow.DrawText( UIx + 100 , 52 , LangList["Display Settings"]) GraphicsWindow.DrawText( UIx + 20 ,73 , LangList["Sort by"]) GraphicsWindow.DrawText( UIx + 100 , 150 , LangList["Search Settings"]) GraphicsWindow.DrawText( UIx + 20,180,LangList["Search in"]) GraphicsWindow.DrawText( UIx + 20,210,LangList["Search"] +":") GraphicsWindow.DrawText( UIx + 127,290,LangList["Functions"] +":") GraphicsWindow.FontSize = 13 List = Text.ConvertToUpperCase( SchemaList ) FunctionList = "" 'Sort SortByCB = LDControls.AddComboBox(List,100,100) AscDescString = "1=" + LangList["Asc"] +";2=" +LangList["Desc"]+";" ASCDESC_CB = LDControls.AddComboBox(AscDescString,110,100) SortButton = Controls.AddButton(LangList["SORT"], UIx + 10 , 120) Controls.Move(SortByCB, UIx + 80 , 72 ) Controls.Move(ASCDESC_CB, UIx + 190, 72) Controls.SetSize(SortButton,290,25) LDCall.Function5( Function_UI_Add , Register, SortButton , Function_Handler_MainMenu ,"","") LDCall.Function5( Function_UI_Add , Register, ASCDESC_CB,"" ,"","") LDCall.Function5( Function_UI_Add , Register, SortByCB ,"" ,"","") 'Search SearchByCB = LDControls.AddComboBox(List,200,120) SearchTextTB = Controls.AddTextBox(UIx + 100,210) StrictSearchCheckBox = LDControls.AddCheckBox(LangList["Strict Search"]) SearchButton = Controls.AddButton(Text.ConvertToUpperCase( LangList["Search"] ),UIx +10,260) Controls.SetSize(SearchTextTB, 200, 25) Controls.SetSize(SearchButton,290,25) Controls.Move(StrictSearchCheckBox,UIx+20,240) Controls.Move(SearchByCB, UIx + 100 , 160 +20 ) LDCall.Function5( Function_UI_Add ,Register, SearchButton , Function_Handler_MainMenu ,"","") LDCall.Function5( Function_UI_Add , Register, SearchByCB ,"" ,"","") 'Functions FunctionListCB = LDControls.AddComboBox(SQLFunctionsList,130,100) Controls.Move( FunctionListCB , UIx + 10 , 310 ) ColumnListCB = LDControls.AddComboBox(List,135,100) Controls.Move( ColumnListCB , UIx + 160 , 310 ) RunFunctionButton = Controls.AddButton(Text.ConvertToUpperCase( LangList["Run Function"] ),UIx +10 , 340) Controls.SetSize( RunFunctionButton, 290 , 25 ) LDCall.Function5( Function_UI_Add , Register, FunctionListCB ,"" ,"","") LDCall.Function5( Function_UI_Add , Register, ColumnListCB ,"" ,"","") LDCall.Function5( Function_UI_Add , Register, RunFunctionButton, Function_Handler_MainMenu ,"","") 'Custom Query CustomQuery = Controls.AddMultiLineTextBox(UIx,420) Controls.SetSize(CustomQuery,310, 150) CustomQueryButton = Controls.AddButton(Text.ConvertToUpperCase( LangList[ "Query" ] ),UIx , 580) Controls.SetSize(CustomQueryButton, 310 ,25) CommandButton = Controls.AddButton(Text.ConvertToUpperCase( LangList["Command"] ) ,UIx, 580 +35) Controls.SetSize(CommandButton, 310 ,25) LDCall.Function5( Function_UI_Add , Register, CustomQueryButton , Function_Handler_MainMenu ,"","") LDCall.Function5( Function_UI_Add ,Register, CommandButton , Function_Handler_MainMenu ,"","") Controls.SetTextBoxText(CustomQuery,"This Textbox allows you to use Custom" +CLLF+" SQL Queries. Remove this and type in an SQL"+CLLF+" statement."+CLLF+"You also use it to export data") '//Localize ?? Display_Results_MasterControlsList = "1="+SortByCB+";2="+ASCDESC_CB+";3="+SortButton+";4="+SearchByCB+";5="+SearchTextTB+";6="+StrictSearchCheckBox+";7="+SearchButton+";8="+CustomQuery+";9="+CustomQueryButton+";" Display_Results_MasterControlsList = Display_Results_MasterControlsList +"10="+CommandButton+";11="+FunctionListCB+";12="+ColumnListCB+";13="+RunFunctionButton+";" EndSub Sub Export_UI 'Currently not in use GraphicsWindow.Clear() If SortByMode = 1 Then Export_Default_Table = default_Table + " (T)" ElseIf SortByMode = 2 Then Export_Default_Table = default_Table + " (I)" ElseIf SortByMode = 3 Then Export_Default_Table = default_Table + " (V)" EndIf GraphicsWindow.Title = "Export" Export_Tables_UI = "" For I = 1 To Array.GetItemCount(SCHEMA_TableList ) Export_Tables_UI[ Array.GetItemCount(Export_Tables_UI) + 1] = SCHEMA_TableList[I] + " (T)" EndFor For I = 1 To Array.GetItemCount(SCHEMA_IndexList ) Export_Tables_UI[ Array.GetItemCount(Export_Tables_UI) + 1] = SCHEMA_IndexList[I] + " (I)" EndFor For I = 1 To Array.GetItemCount(SCHEMA_ViewList ) Export_Tables_UI[ Array.GetItemCount(Export_Tables_UI) + 1] = SCHEMA_ViewList[I] + " (V)" EndFor For I = 1 to Array.GetItemCount( Export_Tables_UI ) If Export_Tables_UI[I] = Export_Default_Table Then Export_Default_Node = I EndIf EndFor ExportComboBox = LDControls.AddComboBox( Export_Tables_UI , 200 , 50 ) LDCall.Function5( Function_UI_Add , Register , ExportComboBox ,Function_Handler_ExportCB,"","" ) Controls.Move (ExportComboBox , 10, 10 ) LDControls.ComboBoxSelect( ExportComboBox , Export_Default_Node ) Export_T1 = LDList.FromArray( SchemaList ) ExportListBox[1] = LDControls.AddListBox(SCHEMAList,200,200) ExportListBox[2] = LDControls.AddListBox("",200,200) Controls.Move(ExportListBox[1] , 1, 60 ) Controls.Move(ExportListBox[2] , 300,60 ) ToolTip[1] = Shapes.AddText("Columns" ) ToolTip[2] = Shapes.AddText("Export Following:") Shapes.Move(ToolTip[1], 25 ,40 ) Shapes.Move(ToolTip[2], 345,40 ) MoveRight = Controls.AddButton(">",230,120) MoveLeft = Controls.AddButton("<",230,150) NextButton = Controls.AddButton("Next", 230,180 ) Export_Close = Controls.AddButton("Close",50,300) LDCall.Function5( Function_UI_Add , Register , MoveRight ,Function_Handler_MainMenu,"","" ) LDCall.Function5( Function_UI_Add , Register , MoveLeft ,Function_Handler_MainMenu,"","" ) LDCall.Function5( Function_UI_Add , Register , NextButton ,Function_Handler_MainMenu,"","" ) LDCall.Function5( Function_UI_Add , Register , Export_Close ,Function_Handler_MainMenu,"","" ) Controls.SetSize( MoveRight ,50 , 25) Controls.SetSize( MoveLeft ,50 , 25) Controls.SetSize( NextButton , 50 , 25 ) LDControls.ComboBoxItemChanged = Universal_ComboBoxChanged EndSub Sub Export_CB_Handler If args[1] <> "" Then LastClickedCB = args[1] Else LastClickedCB = LDControls.LastComboBox EndIf LastCBIndex = LDControls.LastComboBoxIndex If LastClickedCB = ExportComboBox Then 'Export Menu Control If LDText.FindAll(Export_Tables_UI[ LastCBIndex ] ,"(T)") <> 0 Then SCHEMA_CurrentList = SCHEMA_TableList LastCBIndex = LastCBIndex ElseIf LDText.FindAll(Export_Tables_UI[ LastCBIndex ] ,"(I)" ) <> 0 Then SCHEMA_CurrentList = SCHEMA_IndexList LastCBIndex = LastCBIndex - ( Array.GetItemCount( SCHEMA_TableList ) ) ElseIf LDText.FindAll(Export_Tables_UI[ LastCBIndex ] ,"(V)" ) <> 0 Then SCHEMA_CurrentList = SCHEMA_ViewList LastCBIndex = LastCBIndex - ( Array.GetItemCount( SCHEMA_TableList ) + Array.GetItemCount( SCHEMA_IndexList) ) EndIf Default_Table = SCHEMA_CurrentList[ LastCBIndex ] Get_SCHEMA_Private() LDControls.ListBoxContent( ExportListBox[1] , SchemaList ) Export_T1 = LDList.FromArray( SchemaList ) LDControls.ListBoxContent( ExportListBox[2] , "" ) EndIf EndSub Sub Settings_UI GraphicsWindow.Clear() GraphicsWindow.Title = LangList["Settings"] GraphicsWindow.CanResize = "False" LDGraphicsWindow.CancelClose = "True" LDGraphicsWindow.ExitOnClose = "False" LDGraphicsWindow.Closing = Closing LDGraphicsWindow.ExitButtonMode(LangList["Settings"],"Disabled") GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(10,30, LangList["Listview Width"]) Settings_WidthTB = Controls.AddTextBox(200,25) GraphicsWindow.DrawText(10,65,LangList["Listview Height"]) Settings_HeigthTB = Controls.AddTextBox(200, 60) GraphicsWindow.DrawText(10,100,LangList["Extensions"]) Settings_ExtensionsTB = Controls.AddTextBox(200,95) GraphicsWindow.DrawText(10,135,LangList["Deliminator"]) Settings_DeliminatorTB = Controls.AddTextBox(200,130) GraphicsWindow.DrawText(10,165,LangList["Language"]) Language_LB = LDControls.AddComboBox( LDList.ToArray("ISO_Text") , 200,120 ) LDControls.ComboBoxSelect( Language_LB , LDList.IndexOf("ISO_Lang", Localization_lang ) ) Controls.Move( Language_LB , 200 , 165 ) Settings_Debug_Parser = LDControls.AddCheckBox("Debug Parser") Controls.Move(Settings_Debug_Parser , 10 ,220 ) Settings_Debug_Mode = LDControls.AddCheckBox("Debug Mode") Controls.Move(Settings_Debug_Mode , 10 ,270 ) Setting_Save = Controls.AddButton(LangList[ "Save and Close"],50,320) Settings_Close = Controls.AddButton(LangList["Close wo saving"] , 50, 370 ) Controls.SetSize ( Setting_Save , 280 , 35 ) Controls.SetSize ( Settings_Close , 280 , 35 ) LDCall.Function5( Function_UI_Add , Register , Setting_Save ,Function_Handler_MainMenu,"","" ) LDCall.Function5( Function_UI_Add , Register , Settings_Close ,Function_Handler_MainMenu,"","" ) Controls.SetTextBoxText(Settings_WidthTB , Listview_Width ) Controls.SetTextBoxText(Settings_HeigthTB, Listview_Height ) Controls.SetTextBoxText(Settings_ExtensionsTB , Settings["Extensions"] ) Controls.SetTextBoxText( Settings_DeliminatorTB , Settings["Deliminator"] ) LDControls.CheckBoxState(Settings_Debug_Mode , Booleans[ debug_mode ] ) LDControls.CheckBoxState( Settings_Debug_Parser , Booleans[ debug_Parser ] ) GraphicsWindow.FontSize = Default_FontSize EndSub '______________________________________________________________________________ ' Operations '______________________________________________________________________________ Sub GenerateQuery SearchByGQ = LDControls.ComboBoxGetSelected(SearchByCB) OrderByGQ = LDControls.ComboBoxGetSelected(SortByCB) SortOrder = LDControls.ComboBoxGetSelected(ASCDESC_CB) StrictSearchChecked = LDControls.CheckBoxGetState(StrictSearchCheckBox) FunctionListGQ = LDControls.ComboBoxGetSelected( FunctionListCB ) ColumnListGQ = LDControls.ComboBoxGetSelected( ColumnListCB) SearchTextGQ = Controls.GetTextBoxText(SearchTextTB) CMD = "" 'Techincally not needed , keep it in for clarity CMD = "SELECT * FROM " +Default_Table +" " If Results_Sort = 1 Then ElseIf Results_Search = 1 Then SearchTextGQ = LDText.Replace(SearchByGQ,"'","''") CMD = CMD + "WHERE "+ List[SearchByGQ] If StrictSearchChecked = "False" Then ' Non Strict CMD = CMD +" LIKE '%" + Controls.GetTextBoxText(SearchTextTB)+"%' " Else 'Strict CMD = CMD +"='" + Controls.GetTextBoxText(SearchTextTB)+"' " EndIf ElseIf Results_Function = 1 Then CMD = "" CMD = "SELECT " + SQLFunctionsList[FunctionListGQ] +"(" + List[ColumnListGQ]+") FROM " +Default_Table +" " EndIf 'Apply Sort Constraints CMD = CMD + "ORDER BY " + List[OrderByGQ] +" " If SortOrder = 1 Then CMD = CMD + "ASC;" ElseIf SortOrder = 2 Then CMD = CMD + "DESC;" EndIf ' The following line could be harmful and has been automatically commented. ' LDCall.Function5(QueryFunction,CMD,CurrentControl,"False",LangList["App"],"Auto Generated Query on behalf of " + LDFile.UserName) '//Localize EndSub Sub Get_SCHEMA If database <> "" Then 'Prevents Application from querying a nonexistent db TableList = LDCall.Function5(QueryFunction,"SELECT tbl_name , name FROM sqlite_master WHERE type ='table';","","True",LangList["App"],"SCHEMA") ViewList = LDCall.Function5(QueryFunction,"SELECT tbl_name , name FROM sqlite_master WHERE type ='view';","","True",LangList["App"],"SCHEMA") IndexList = LDCall.Function5(QueryFunction,"SELECT tbl_name , name FROM sqlite_master WHERE type ='index';","","True",LangList["App"],"SCHEMA") For I = 1 To Array.GetItemCount(TableList) SCHEMA_TableList[I] = TableList[I]["tbl_name"] EndFor For I = 1 To Array.GetItemCount(ViewList) SCHEMA_ViewList[I] = ViewList[I]["tbl_name"] EndFor For I = 1 To Array.GetItemCount(IndexList) SCHEMA_IndexList[I] = IndexList[I]["tbl_name"] EndFor Default_Table = SCHEMA_TableList[1] LDList.Add(TrackDefaultTable,1) Get_SCHEMA_Private() EndIf EndSub Sub Get_SCHEMA_Private 'Fetches the rows from the Current Table , Index, or View SchemaList = "" LDList.Clear("SCHEMA") SCHEMA = LDCall.Function5(QueryFunction,"PRAGMA table_info("+Default_Table+");","","True",LangList["App"],"SCHEMA-PRIVATE") '//Localize For Get_SCHEMA_I = 1 To Array.GetItemCount(SCHEMA) LDList.Add("SCHEMA",SCHEMA[Get_SCHEMA_I]["name"] ) EndFor SchemaList= LDList.ToArray("SCHEMA") EndSub '______________________________________________________________________________ ' Utilities '______________________________________________________________________________ Sub XML_Fetch_All XML_Array[1] = LDxml.Attributes XML_Array[2] = LDxml.AttributesCount XML_Array[3] = LDxml.ChildrenCount XML_Array[4] = LDxml.NodeName XML_Array[5] = LDxml.NodeType XML_Array[6] = LDxml.NodeInnerText XML_Array_SCHEMA ="1=Attributes:;2=Attribute Count:;3=Children count:;4=Node Name:;5=Node Type:;" return = XML_Array EndSub Sub Add_UI_Controls '5 Args needed Add_UI_Args = args If Add_UI_Args[1] = "Menu" Then MenuList[ Add_UI_Args[2] ] = Add_UI_Args[4] If LDList.IndexOf(List_UI_Name , Add_UI_Args[2] ) = 0 OR Add_UI_Args[2] ="-" Then LDList.Add( List_UI_Name , Add_UI_Args[2] ) LDList.Add( List_UI_Handler , Add_UI_Args[3] ) LDList.Add( List_UI_Action , Add_UI_Args[5] ) Else Temp_UI_Num = LDList.IndexOf( List_UI_Name , Add_UI_Args[2] ) LDList.SetAt( List_UI_Handler , Temp_UI_Num , Add_UI_Args[3] ) LDList.SetAt( List_UI_Action , Temp_UI_Num , Add_UI_Args[5]) EndIf return = 1 ElseIf Add_UI_Args[1] = Register Then If LDList.IndexOf(List_UI_Name , Add_UI_Args[2] ) = 0 Then LDList.Add( List_UI_Name , Add_UI_Args[2] ) LDList.Add( List_UI_Handler , Add_UI_Args[3] ) LDList.Add( List_UI_Action , Add_UI_Args[5] ) Else Temp_UI_Num = LDList.IndexOf( List_UI_Name , Add_UI_Args[2] ) LDList.SetAt( List_UI_Handler , Temp_UI_Num , Add_UI_Args[3] ) LDList.SetAt( List_UI_Action , Temp_UI_Num , Add_UI_Args[5]) EndIf return = 1 Else LDCall.Function2(Function_Log ,"UI ADD: Parameters unknown" + Add_UI_Args , LangList["App"] ) return = "Parameters unknown" EndIf EndSub Sub Query_UI_Controls Query_UI_Args = args If Query_UI_Args[1] = "Menu" Or Query_UI_Args[1] = Register Then return = LDList.GetAt( List_UI_Handler , LDList.IndexOf( List_UI_Name , args[2] ) ) ElseIf Query_UI_Args[1] = "Action" Then return = LDList.GetAt( List_UI_Action ,LDList.IndexOf( List_UI_Name , args[2] ) ) Else LDCall.Function2(Function_Log ,"UI QUERY: Parameters unknown " + Query_UI_Args , LangList["App"] ) return = "Parameters unknown" EndIf EndSub Sub Universal_BD LDCall.Function( Function_Handler_Universal , Controls.LastClickedButton ) EndSub Sub Universal_MenuClicked LDCall.Function( Function_Handler_Universal , LDControls.LastMenuItem ) EndSub Sub Universal_ComboBoxChanged LDCall.Function( Function_Handler_Universal , LDControls.LastComboBox ) EndSub Sub Universal_Handler Universal_Args = args Universal_Name = Universal_Args[1] Universal_Find_Hanlder = LDCall.Function2( Function_UI_Query ,Register , Universal_Args[1] ) Universal_Find_Action = LDCall.Function2( Function_UI_Query ,"Action" , Universal_Args[1] ) If Universal_Find_Hanlder = Function_RunMod_Parser Then 'Runs Mod LDCall.Function( Universal_Find_Hanlder , Universal_Find_Action ) return = 1 ElseIf Universal_Find_Action = "" Then LDCall.Function( Universal_Find_Hanlder , Universal_Name ) return = 1 EndIf EndSub '______________________________________________________________________________ ' MOD '______________________________________________________________________________ Sub MOD_XML EndSub Sub MOD_READ_AutoRunFile ' The following line could be harmful and has been automatically commented. ' AutoRunMod_Cnts = File.ReadContents( AutoRunMod_Path ) ' The following line could be harmful and has been automatically commented. ' For I = 1 To LDFile.Length( AutoRunMod_Path ) ' The following line could be harmful and has been automatically commented. ' Temp_Cnts = File.ReadLine( AutoRunMod_Path , I ) If Text.StartsWith( Temp_Cnts ,"#" ) = "True" Then ' AutoRunMod_Cnts[ ( Array.GetItemCount( AutoRunMod_Cnts ) + 1 ) ] = "Comment" Else AutoRunMod_Cnts[ ( Array.GetItemCount( AutoRunMod_Cnts ) + 1 ) ] = Temp_Cnts EndIf EndFor 'TextWindow.WriteLine( AutoRunMod_Cnts ) EndSub Sub MOD_AutoRun For I = 1 To Array.GetItemCount( AutoRunMod_Cnts ) LDCall.Function( Function_RunMod_Parser , AutoRunMod_Cnts[I]) EndFor EndSub Sub MOD_RUN_Parser Dynamically_Added_Mod = 0 Mod_Run_Args = args If Array.GetItemCount(Mod_Run_Args) = 1 AND Text.GetIndexOf(Mod_Run_Args[1],".") <> 0 Then 'Normalizes arguments into two arguments Mod_Index_of_Dot = Text.GetIndexOf(Mod_Run_Args[1],".") Mod_Run_Args[2] = Text.GetSubTextToEnd( Mod_Run_Args[1] ,( Mod_Index_of_Dot + 1 ) ) Mod_Run_Args[1] = Text.GetSubText( Mod_Run_Args[1] , 1 ,( Mod_Index_of_Dot - 1 ) ) EndIf If LDList.IndexOf( List_Mod_Name , Mod_Run_Args[1] ) <> 0 AND Mod_Name[ Mod_Run_Args[1] ] = "" Then 'If the Mod Is known but has not yet been included Temp_Mod_Path = LDList.GetAt( List_Mod_Path , LDList.IndexOf( List_Mod_Name , Mod_Run_Args[1] ) ) Temp_Mod_Name = Mod_Run_Args[1] Mod_Name[ Mod_Run_Args[1] ] = LDCall.Include( Temp_Mod_Path ) 'Dynamically adds the MOD Dynamically_Added_Mod = 1 EndIf If Mod_Name[ Mod_Run_Args[1] ] <> "" And Array.GetItemCount(Mod_Run_Args) = 2 Then 'If the Mod basically is known to exist and has been included return = LDCall.CallInclude(Mod_Name[ Mod_Run_Args[1] ],Mod_Run_Args[2]) If Dynamically_Added_Mod = 1 And debug_mode = 1 Then 'Debug type info , useless to most people LDCall.Function2(logfunction ,"Dynamically added " + Temp_Mod_Name + " ("+Mod_Name[ Temp_Mod_Name ]+")" + " FROM " + Temp_Mod_Path, LangList["System"]) Temp_Mod_Name = "" Temp_Mod_Path = "" EndIf Else LDCall.Function2(logfunction ,"Error : Critical Fault. Could not call " + Mod_Run_Args[1]+"."+Mod_Run_Args[2] +" as it could not be found. " , LangList["System"]) '//Localize GraphicsWindow.ShowMessage("Error : Critical Fault. Could not call " + Mod_Run_Args[1]+"."+Mod_Run_Args[2] +" as it could not be found. (" + Mod_Run_Args +")","Critical Fault Error" )'//Localize EndIf EndSub Sub MOD_Find_All ' The following line could be harmful and has been automatically commented. ' Mod_Files = File.GetFiles( ModPath ) LDList.Clear( List_Mod_Path ) LDList.Clear( List_Mod_Name ) For I = 1 To Array.GetItemCount ( Mod_Files ) ' The following line could be harmful and has been automatically commented. ' If LDFile.GetExtension( Mod_Files[I] ) = "exe" Then 'Loads all EXE Files into Mod List LDList.Add( List_Mod_Path , Mod_Files[I] ) ' The following line could be harmful and has been automatically commented. ' LDList.Add( List_Mod_Name , LDFile.GetFile(Mod_Files[I]) ) EndIf EndFor EndSub Sub MOD_Include_All ' Includes all mods even when it may not be nessecarry !! Obselete , left over as a failsafe debug_mode = 1 TextWindow.WriteLine("FORCE DEBUG MODE ON") TextWindow.WriteLine("YOU ARE USING AN OBSOLUTE FUNCTION NAMED : MOD_Include_All " ) TextWindow.WriteLine("Mod_Find_All and Mod_Run are the replacements for this function") TextWindow.WriteLine("Please stop using function at the earliest possible moment as it WILL be REMOVED in future versions") ' The following line could be harmful and has been automatically commented. ' Mod_Files = File.GetFiles( ModPath ) For I = 1 To Array.GetItemCount ( Mod_Files ) ' The following line could be harmful and has been automatically commented. ' If LDFile.GetExtension( Mod_Files[I] ) = "exe" Then 'Loads all EXE Files into Mod List ' The following line could be harmful and has been automatically commented. ' Mod_Name[ LDFile.GetFile(Mod_Files[I]) ] = LDCall.Include( Mod_Files[I] ) EndIf EndFor EndSub '______________________________________________________________________________ ' Query '______________________________________________________________________________ Sub Query QueryArgs = args If database <> "" Then If Text.IsSubText(QueryArgs[5] , "SCHEMA" ) <> "True" Then LDCall.Function5( TransactionFunction, QueryArgs[4] , database , QueryArgs[1] , "Query" , QueryArgs[5] ) EndIf return = LDDataBase.Query(database,Queryargs[1],Queryargs[2],Queryargs[3]) Else LDCall.Function2(logfunction , LangList["Query Error"] + ": " + LangList["Error No DB"] , LangList["UI"] ) GraphicsWindow.ShowMessage(LangList["Error No DB"] , LangList["Query Error"] ) EndIf EndSub '______________________________________________________________________________ ' Database Command '______________________________________________________________________________ Sub Command 'Runs A Command Function CommandArgs = args If Array.GetItemCount( CommandArgs ) = 4 Then ' LDDialogs.Wait("PROCCESSING...","BLUE") If CommandArgs[1] <> "" Then LDCall.Function5( TransactionFunction , CommandArgs[3] , CommandArgs[1], CommandArgs[2] ,"CMD", CommandArgs[4] ) CommandArgs[2] = LDText.Trim( CommandArgs[2] ) LDList.Clear( List_Command_Parser ) LDList.Clear( List_Command_Parser_OnFail ) LDList.Clear( List_Command_Parser_OnFail_Index ) LDList.Clear( List_Command_Parser_Status ) InString = 0 Command_Counter = 0 Command_Parser_Length = Text.GetLength( CommandArgs[2] ) For I = 1 to Command_Parser_Length Character = Text.GetSubText( CommandArgs[2] , I , 1 ) If debug_Parser = 1 Then TextWindow.Title = Math.Floor( I/ Command_Parser_Length ) * 100 EndIf If Character = ";" And InString = 0 Then LDList.Add(List_Command_Parser , String +";") String = "" ElseIf Character ="'" Then If InString = 0 Then InString = 1 ElseIf InString = 1 Then InString = 0 EndIf String = String + Character Else String = String + Character EndIf EndFor For I = 1 To LDList.Count(List_Command_Parser) Temp_Command_Counter = LDDataBase.Command( CommandArgs[1] , LDList.GetAt(List_Command_Parser,I) ) LDList.Add( List_Command_Parser_Status , Temp_Command_Counter ) If Temp_Command_Counter = 0 Then LDList.Add( List_Command_Parser_OnFail , LDList.GetAt(List_Command_Parser,I) ) LDList.Add( List_Command_Parser_OnFail_Index , I ) EndIf Command_Counter = Command_Counter + Temp_Command_Counter EndFor If debug_Parser = 1 Then LDList.Print( List_Command_Parser ) LDList.Print( List_Command_Parser_Status ) If LDList.Count( List_Command_Parser_OnFail ) > 0 Then 'Only If there are failed statements display them LDList.Print( List_Command_Parser_OnFail ) EndIf EndIf Command_Num_Cmds = LDList.Count( List_Command_Parser_Status ) return = Command_Counter Else LDCall.Function2(logfunction ,LangList["Command"] + LangList["Error No DB"] , LangList["UI"]) GraphicsWindow.ShowMessage(LangList["Error No DB"] , LangList["Command"] + " " + LangList["Error"] ) EndIf ' LDDialogs.EndWait() Else debug_mode = 1 TextWindow.WriteLine("FORCE DEBUG : ON ") TextWindow.WriteLine("Function_Command : Expected 4 Arguments but recsived " + Array.GetItemCount( CommandArgs ) ) EndIf EndSub Sub TransactionRecord TransactionArgs = args If Transactions_mode = 1 Then If Array.GetItemCount(TransactionArgs ) = 5 Then Transaction_DB_Path_Temp = LDList.GetAt("DB_Path", LDList.IndexOf("DB_Name",TransactionArgs[2] ) ) ' The following line could be harmful and has been automatically commented. ' Transactions_SQL = "INSERT INTO Transactions (USER,DB,SQL,TYPE,Reason,UTC_DATE,UTC_TIME,PATH,SNAME) VALUES('"+TransactionArgs[1] +"','"+TransactionArgs[2]+"','"+ LDText.Replace(TransactionArgs[3],"'","''")+"','"+TransactionArgs[4]+"','"+ TransactionArgs[5]+"',Date(),TIME(),'" + Transaction_DB_Path_Temp+"','"+ LDFile.GetFile(Transaction_DB_Path_Temp) +"');" LDDataBase.Command( TransactionDB , Transactions_SQL ) Else debug_mode = 1 TextWindow.WriteLine("FORCE DEBUG : ON ") TextWindow.WriteLine("Function_Transaction : Expected 5 Arguments but recsived " + Array.GetItemCount( TransactionArgs ) ) EndIf EndIf EndSub '______________________________________________________________________________ ' Logging '______________________________________________________________________________ Sub Closing If databasepath = "" Then LDCall.Function2(logfunction, "Program Closing ",LangList["Application"]) '//Localize Else LDCall.Function2(logfunction, "Program Closing - Closing : " + databasepath ,LangList["Application"]) '//Localize EndIf Program.End() EndSub Sub ErrorHandler If MOD_Running_False = 1 Then debug_mode = 1 '<< ANNOYING AT TIMES EndIf TextWindow.WriteLine("Error : " + LDEvents.LastError ) LDCall.Function2(logfunction, LDEvents.LastError ,LangList["System"]) EndSub Sub Log LogEvent = args[1] TypeofError = args[2] If debug_mode = 1 Then TextWindow.WriteLine(TypeofError +":" + LogEvent ) EndIf If TypeofError = "Debug" And debug_mode = 0 Then 'DO NOT STORE IF TRUE Else If TypeofError = "" Then TypeofError = "Unknown" EndIf If debug_mode = 1 Then If Text.StartsWith(LogEvent,"LDDataBase.Query") = "True" Then TextWindow.ForegroundColor = "RED" TextWindow.WriteLine( LogEvent ) TextWindow.WriteLine(QueryArgs ) ElseIf Text.StartsWith(LogEvent,"LDDataBase.Command") = "True" Then TextWindow.ForegroundColor = "RED" TextWindow.WriteLine( LogEvent ) TextWindow.WriteLine( CommandArgs ) EndIf EndIf LogNumber = LogNumber + 1 ' The following line could be harmful and has been automatically commented. ' File.AppendContents(logpath,LogNumber +"," + Clock.Date + "," + Clock.Time +"," + DoubleQuotesCharacter + LDText.Replace( LDFile.UserName , DoubleQuotesCharacter , DoubleQuotesCharacter + DoubleQuotesCharacter ) + DoubleQuotesCharacter +"," + ProductID +","+ VersionID+"," + DoubleQuotesCharacter + LDText.Replace( TypeofError , DoubleQuotesCharacter , DoubleQuotesCharacter + DoubleQuotesCharacter ) +DoubleQuotesCharacter +","+ DoubleQuotesCharacter + LDText.Replace( LogEvent , DoubleQuotesCharacter , DoubleQuotesCharacter + DoubleQuotesCharacter ) + DoubleQuotesCharacter) If Text.IsSubText( LogEvent , "Operation is not valid due to the current state of the object" ) = "True" Then Else ' The following line could be harmful and has been automatically commented. ' LOG_CMD = "INSERT INTO LOG (ID,UTC_DATE,UTC_TIME,DATE,TIME,USER,ProductID,ProductVersion,Event,Type) VALUES('"+LogNumber+"',DATE(),TIME(),DATE('now','localtime'),TIME('now','localtime'),'"+LDFile.UserName+"','"+ProductID+"','"+PrgmVersionID+"','"+LogEvent+"','"+TypeofError+"');" LDCall.Function4( CommandFunction , LOG_DB , LOG_CMD , LangList["App"] ,"Auto Log") '//Localize EndIf EndIf EndSub '______________________________________________________________________________ ' Update Function '______________________________________________________________________________ Sub UpdateFunction LDCall.Function( Function_RunMod_Parser , "Updater.Main") EndSub End>RTK453.sb< Start>RTL839.sb< 'Senior Countdown Clock - (C)opyright 2016 by codingCat aka Matthew L. Parets - No rights reserved if no money earned ' 'The end time is set at 3:10 pm, the end of the school day. This default 'can be changed below. If it is past this time in the day the program 'will default to 10 seconds into the future. This default can be 'changed by modifying the SetTestTime() subroutine. ' 'The size of the display is set dynaically based on the windows height. 'The default height is set below. The size can also be changed while the 'program is running by dragging the windows edge. This behavior is 'a little squirrelly due to the limits/inconsistencies in Small Basic / Windows 'Program Initalizations - Set the default window height 'Scaling is based on the height of the window. Sizes were developed with a height of 600. Minimum viable is 175 GraphicsWindow.Height = 600 windowHeight = GraphicsWindow.Height 'This represents the top for the dynamic resizing top: restart = "False" BuildTheScreen() 'Set the countdown time -- when in the future will the clock stop ih = 15 'Default time is 3:10 pm im = 10 is = 00 ims = 0 'Set up time. How many milliseconds in the future is the stop time. CalculateMils() mils = calcmils GetCurrentMils() If mils - curmils < 1 then 'If we have past the end time. SetTestTime() 'Go with a test time instead endif angleIncr = 1 'How often to update the clock. milSlice = (mils-curmils) / 360 'Default pause for 360 ticks around the clock While milSlice > 10000 'Ensure that the clock updates at least every 10 seconds milSlice = milSlice / 2 'Half the time slice angleIncr = angleIncr / 2 'Half the size of the tick (double how many their are) endwhile framestart = Clock.ElapsedMilliseconds 'Start the tick clock clockStart = Clock.ElapsedMilliseconds 'Start the master finish clock 'Starting point for the clock face nudge = 1.05 'Compensate for margin of error in drawing the arrow. prevarad =Math.GetRadians(0) angle = 0 ' --- Main Program Loop --------------------------------------------- While curmils < mils 'Keep going when there is time left UpdatePointer() 'Move the clock hand frameWait() 'pause for a moment - update the milliseconds - check for window sizing If (restart = "True") Then 'Restart if window has been resized Goto top EndIf prevang = angle angle = angle + angleIncr 'The next position for the clock hand endWhile 'recenter the pointer following the last tick angle = 360 UpdatePointer() FinalTimeUpdate() '---------------------------------------------------------------------------- 'Subroutines '---------------------------------------------------------------------------- '---------------------------------------------------------------------------- 'Set a test time when the time is past the default start time. Sub SetTestTime ih = Clock.Hour im = Clock.Minute is = Clock.Second +10 '10 seconds in the future If is > 59 then 'Wrap the time past seconds and mins as needed is = is -60 im = im + 1 endif If im > 59 then im = im - 60 ih = ih + 1 endif ims = Clock.Millisecond CalculateMils() mils = calcmils EndSub '---------------------------------------------------------------------------- 'Build the screen scaled for the window size - Clock face, time box, and message. Sub BuildTheScreen 'Window Setup GraphicsWindow.Clear() 'Set the width - The ratio between the height and the width is 2/3 GraphicsWindow.Width = GraphicsWindow.Height + (GraphicsWindow.Height * (2/3)) windowWidth = GraphicsWindow.Width GraphicsWindow.Title = "Senior Count Down Clock GraphicsWindow.BackgroundColor = "lightgreen" GraphicsWindow.Show() 'Scale settings scl = (windowHeight * 100) / 600'Scaling for the window program developed with window height of 600 digitSiz = 95 * (scl / 100) 'base font size = 100 milsDigsiz = 20 * (scl / 100) 'base font size = 20 msgSiz = 75 * (scl / 100) 'baed on font size of 75 'Draw the Clock Face siz = windowHeight / 2 - 50 bdrSiz = 20 x = windowWidth - siz - 30 y = windowHeight / 2 GraphicsWindow.BrushColor = "black" shadow = Shapes.AddEllipse(siz*2 + bdrSiz * 2,siz*2 + bdrSiz * 2) Shapes.SetOpacity(shadow,25) shapes.Move(shadow,x - siz - bdrSiz + 3, y - siz - bdrSiz + 3) face = Shapes.AddEllipse(siz*2 + bdrSiz * 2,siz*2 + bdrSiz * 2) shapes.Move(face,x - siz - bdrSiz, y - siz - bdrSiz) GraphicsWindow.BrushColor = "yellow" dial = Shapes.AddEllipse(siz*2,siz*2) Shapes.move(dial,x - siz,y - siz) cdSize = 50 'Draw the time box sclBw = 500 * (scl / 100) sclBh = 125 * (scl / 100) GraphicsWindow.BrushColor = "black" GraphicsWindow.PenColor = GraphicsWindow.BrushColor boxshaddow = Shapes.AddRectangle(sclBw,sclBh) Shapes.SetOpacity(boxshaddow, 10) Shapes.Move(boxshaddow,5,5) GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(234,236,255) Shapes.AddRectangle(sclBw,sclBh) GraphicsWindow.PenWidth = 2 'Display the message msgY = windowHeight GraphicsWindow.FontName = "Tahoma" GraphicsWindow.FontBold = "True" GraphicsWindow.FontItalic = "true" GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize = msgSiz senShapeShad = Shapes.AddText("Senior") Shapes.SetOpacity(senShapeShad,15) cntShapeShad = Shapes.AddText("Count Down") Shapes.SetOpacity(cntShapeShad,15) clkShapeShad = Shapes.AddText("Clock") Shapes.SetOpacity(clkShapeShad,15) msgBot = 90 * (scl / 100) msgStp = 70 * (scl / 100) Shapes.Move(senShapeShad,5+3,msgY-(msgBot+(msgStp*2))+3) Shapes.Move(cntShapeShad,15+3,msgY-(msgBot+(msgStp*1))+3) Shapes.Move(clkShapeShad,25+3,msgy-(msgBot+(msgStp*0))+3) GraphicsWindow.BrushColor = "black" senShape = Shapes.AddText("Senior") cntShape = Shapes.AddText("Count Down") clkShape = Shapes.AddText("Clock") Shapes.Move(senShape,5,msgY-(msgBot+(msgStp*2))) Shapes.Move(cntShape,15,msgY-(msgBot+(msgStp*1))) Shapes.Move(clkShape,25,msgy-(msgBot+(msgStp*0))) GraphicsWindow.FontBold = "false" 'Font settings for the time GraphicsWindow.FontName = "Magmawave Caps" GraphicsWindow.FontItalic = "True" EndSub '---------------------------------------------------------------------------- 'One last update once time time has expired - zero everything out Sub FinalTimeUpdate mils = curmils TimeUpdate() EndSub '---------------------------------------------------------------------------- 'Get the current time - Upate the display sub DisplayTimeUpdates GetCurrentMils() TimeUpdate() EndSub '---------------------------------------------------------------------------- 'Given the current milliseconds since midnight, calcuate the 'Hours minutes and seconds until the stop time. Sub TimeUpdate rms = mils - curmils rs = Math.Floor(rms/1000) rms = rms - (rs * 1000) rm = Math.Floor(rs/60) rs = rs - (rm * 60) rh = Math.Floor(rm/60) rm = rm - (rh * 60) GraphicsWindow.BrushColor = "black" If rs <> prs Then GraphicsWindow.FontSize = digitSiz If rh < 10 Then trh = "x" + "0" + rh Else trh = "x" + rh EndIf If rm < 10 Then trm = "x" + "0" + rm Else trm = "x" + rm EndIf If rs < 10 then trs = "x" + 0 + rs Else trs = "x" + rs EndIf timStr = Text.GetSubTextToEnd(trh,2) + ":" + Text.GetSubTextToEnd(trm,2) + ":" + Text.GetSubTextToEnd(trs,2) timShapeNew = Shapes.AddText(timStr) Shapes.Remove(timShape) timShape = timShapeNew EndIf trms = rms + "x" While Text.GetLength(trms) < 4 trms = "0" + trms EndWhile Shapes.Remove(milsShape) GraphicsWindow.FontSize = milsDigsiz milsShape = Shapes.AddText(Text.GetSubText(trms,1,3)) prms = rms prs = rs prm = rm prh = rh EndSub '---------------------------------------------------------------------------- 'Calculate the current time based on the number of millisecond since 'midnight. This does not account for the time wrap at mightnight Sub GetCurrentMils prevmils = curmils ih = Clock.Hour im = Clock.Minute is = Clock.Second ims =Clock.Millisecond CalculateMils() curmils = calcmils EndSub '---------------------------------------------------------------------------- 'Given a time, Calcualte the number of milliseconds since 'midnight Sub CalculateMils HrMn = ih * 60 MsSc = (im + HrMn) * 60 ScMl = (is + MsSc) * 1000 calcmils = ScMl + ims EndSub '---------------------------------------------------------------------------- 'Update Clock face - The clock face is obscured by places a 'black tranglular wedge between the last update and the one Sub UpdateSlice prevarad = Math.GetRadians(prevang) x1 = x + (Math.Sin(prevarad) * (siz * nudge)) y1 = y - (Math.Cos(prevarad) * (siz * nudge)) arad = Math.GetRadians(angle) x2 = x + (Math.Sin(arad) * (siz * nudge)) y2 = y - (Math.Cos(arad) * (siz * nudge)) GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "black" t = Shapes.AddTriangle(x,y,x1,y1,x2,y2) GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "red" EndSub '---------------------------------------------------------------------------- 'Based on the time slice, draw a triangle arrow pointing down 'the current angle Sub UpdatePointer Shapes.Remove(pointer) Shapes.Remove(centerDisk) UpdateSlice() ba = 180 - (angle + 90) bar = Math.GetRadians(ba) x3 = x + (Math.Sin(bar) * 15) y3 = y + (Math.cos(bar) * 15) ba = 180 - (angle + 90) + 180 bar = Math.GetRadians(ba) x4 = x + (Math.Sin(bar) * 15) y4 = y + (Math.cos(bar) * 15) pointer = Shapes.AddTriangle(x3,y3,x4,y4,x2,y2) centerDisk = Shapes.AddEllipse(cdSize,cdSize) Shapes.Move(centerDisk,x-(cdSize/2),y-(cdSize/2)) endsub '---------------------------------------------------------------------------- 'Pause for the completion of this frame. While waiting update the 'millisecond display, and check to see if the window has been 'resized. Sub frameWait 'Wait for the end of the from. Length is based on the distance to the end time and can be as long as 10 seconds While Clock.ElapsedMilliseconds - framestart < milSlice And restart = "False" DisplayTimeUpdates() 'Update the millisecond clock tick = Clock.ElapsedMilliseconds 'Inner wait - pause for roughtly 1/20 of a second to prevent flashing effect on the screen 'Wait for 1/20 of a second - 57 milliseconds to be exact. The odd number gives the illusion the clock running full speed without the flashing or over tasking the processor While Clock.ElapsedMilliseconds - tick < 57 And Clock.ElapsedMilliseconds - framestart < milSlice And restart = "False" DynamicUpdateSize() 'Check to see if the window has been resized EndWhile EndWhile framestart = Clock.ElapsedMilliseconds EndSub '---------------------------------------------------------------------------- 'Check to see if the window has been resized. Once the resize has 'been detected restart the program with the new screen size. 'A side effect is that the size of the tick frame will be recalculated, 'the clock hand will again be at zero, and the tick happen faster Sub DynamicUpdateSize If GraphicsWindow.Height <> windowHeight Then 'Has the size of the window changed? 'Recalcualte the window width, keeping it in the correct proportion. 'A glitch in SmallBasic/Windows can cause the width to resize after this setting. 'Making for an odd result. GraphicsWindow.Width = GraphicsWindow.Height + (GraphicsWindow.Height * (2/3)) 'Check if movment has passed a threshold (25 pixes). This will keep the update from happening too often. 'The change is ignored if the resulting window is too small - below 175 If Math.Abs(GraphicsWindow.Height - windowHeight) > 25 And GraphicsWindow.Height >=174 then GraphicsWindow.Width = GraphicsWindow.Height + (GraphicsWindow.Height * (2/3)) 'Match the width - again, glitch possible windowHeight = GraphicsWindow.Height 'variable used in all dynamic calculations restart = "true" 'Signal the main program loop to restart. EndIf 'If the width changes independantly of the height, simply reset back to the width that matches the current height ElseIf GraphicsWindow.Width <> windowWidth And restart = "False" then GraphicsWindow.Width = windowWidth EndIf EndSub End>RTL839.sb< Start>RTL937.sb< ' Challenge of the Month - June 2012 by NaochanON 2012/06/06 ' draft not to exceed 4m ( Ship= L: 50m * W: 5m 100tonnes cargo=5ton ) ' init() centerling() Loading() Sub Loading For K= 1 To cNumber cargoloading() EndFor Sound.PlayChimeAndWait() EndSub Sub cargoloading '------------- Loader Cargo Weight message Move Left ----------------------------------------- For MM=1 To 80 X=cX-11*MM +MM*Math.Remainder((K-1),6)*CL/80 Shapes.Move(sloader,X,100) ' loader For j=1 To 2 Shapes.Move(swire[j],x+(j-1)*cL,125) ' wire EndFor Shapes.Move(scargo[k],X,cY) ' cargo Shapes.Move(sweight[k],X+2,cY+cl/5) ' weight message Program.Delay(50) EndFor '------------- Cargo ( Weight message ) Loading ------------------------------------------------------ dy=K*2 YN= math.Floor((k-1)/6)+1 Shapes.Animate(scargo[k],X,cY+200-30*YN+dy,1000) ' cargo Shapes.Animate(sweight[k],X+2,cY+cl/5+200-30*YN+dy,1000) ' weight message Program.Delay(1000) cargosink() ' cargo sinks moveship() ' ship sinks n=k*10 w=n*5 H=0.4+0.2*K msg= " Draft H=4m "+LF+"Buoyancy = S*H*ρ = 50*5*H*ρ = 100ton + W * n "+LF msg=msg+"ρ=1 W=5ton -----> n=(50*5*H-100)/5 "+LF msg=msg+ " H= "+H+ " m -----> n = "+n+" pieces (Cargo= "+5*n +" tonnes)" Shapes.SetText(smsg,msg) Sound.PlayClickAndWait() Sound.PlayClickAndWait() '------------- Loader Cargo Weight message Move right ----------------------------- For MM=80 To 1 Step -1 X=cX-10*MM +MM*Math.Remainder((K-1),6)*CL/80 Shapes.Move(sloader,X,100) For j=1 To 2 Shapes.Move(swire[j],x+(j-1)*cL,125) EndFor Program.Delay(50) EndFor EndSub Sub cargosink For L=1 To K cT= Shapes.GetTop(scargo[L]) ' cargo top Y wT= Shapes.GetTop(sweight[L]) ' weight message top Y cX2= Shapes.GetLeft(scargo[L]) ' cargo left X wx2= Shapes.GetLeft(sweight[L]) ' weight message top X Shapes.Move(scargo[L],cX2,cT+2) Shapes.Move(sweight[L],wX2,wT+2) EndFor EndSub Sub moveship Shapes.Move(tri1,sX-tW+dx,sY-sH+dy) ' ship left trail Shapes.Move(tri2,sX+sW+dx,sY-sH+dy) ' ship right head Shapes.Move(ship,sX+dx,sY-sH+dy) ' ship body For i=1 To 9 Shapes.Move(window[i],sx+i*50+dx,sy-sH+15+dy) ' ship window EndFor Shapes.Move(draft,sX+dx,sY-sH+60+dy) ' draft line 2*20=40 100-40=60 Shapes.Move(smsg,sx+dx,560) ' n H message EndSub Sub centerling For J=1 To 100 dx=j*10 moveship() Program.Delay(50) EndFor EndSub Sub init GraphicsWindow.Hide() GraphicsWindow.Top=10 GraphicsWindow.Left=50 GraphicsWindow.Width=1200 GraphicsWindow.Height=800 '-------------------- Title & Background ---------- Denmark quay ?--------------- url="http://farm4.static.flickr.com/3239/2842722415_e8c25c879c.jpg" GraphicsWindow.DrawResizedImage(url,0,-100,1200,594) GraphicsWindow.Title="Shipping at here ......... "+url ' ---------------------------------------------------------------------------------------------- shipimage() ' ship message() ' message CargoLoader() ' cargo loader moveship() ' ship location GraphicsWindow.Show() EndSub Sub shipimage ' ------------------- ship image ---------------------------------- ShipWeight=100 ShipWidth=5 sW=500 ' ship length sH=100 ' ship height sX=-700 ' ship position -X initial -600 sY=500 ' sea surface -Y tW=20 ' head or trail triangle width tH=sH-4 ' head or trail triangle height dx=0 ' horizontal move length dy=0 ' verticl move length GraphicsWindow.BrushColor="darkgreen" GraphicsWindow.PenColor="darkgreen" tri1=Shapes.AddTriangle(0,0,tW,0,tW,tH) ' trail tri2=Shapes.AddTriangle(0,0,tW,0,0,tH) ' head ship= Shapes.AddRectangle(sW,sH) ' body GraphicsWindow.BrushColor="lightcyan" GraphicsWindow.PenColor="Red" For i=1 To 9 window[i]= Shapes.AddEllipse(15,15) ' window EndFor draft= Shapes.AddLine(0,0,sw,0) ' ------------------- image of under sea surface ---------------------------- GraphicsWindow.BrushColor="Blue" GraphicsWindow.PenColor="Blue" For i=0 To 5 Blue[i]= Shapes.AddRectangle(1200,500) Shapes.Move(blue[i],0,494+10*i*i) Shapes.SetOpacity(blue[i],30+10*I) EndFor EndSub Sub message ' ------------ Buoyancy ------------------------------------- W=5 ' 5 ton H=0.4 ' initial 100/50/5=0.4 m LF= Text.GetCharacter(10) GraphicsWindow.BrushColor="White" GraphicsWindow.FontItalic="True" GraphicsWindow.FontSize=25 n= 0 ' (50*5*H-100)/5 ' 50*5*H = 100+W*n msg= " Draft H=4m "+LF+"Buoyancy = S*H*ρ = 50*5*H*ρ = 100ton + W * n "+LF msg=msg+"ρ=1 W=5ton -----> n=(50*5*H-100)/5 "+LF msg=msg+ " H= "+H+ " m -----> n = "+n+" pieces (Cargo= "+5*n +" tonnes)" smsg=Shapes.AddText(msg) cNumber= (50*5*4-100)/(5*10) EndSub Sub CargoLoader ' ------------------- Cargo ---------------------------------- 2x2x5 m cX=1250 cY=sy-300 ' cY=200 cL=60 For K=1 To cNumber GraphicsWindow.BrushColor="khaki" GraphicsWindow.PenColor="Brown" scargo[k]=Shapes.AddRectangle(cL,30) Shapes.Move(scargo[k],cX,cY) Shapes.SetOpacity(scargo[k],65) GraphicsWindow.BrushColor="Navy" GraphicsWindow.FontSize=12 sweight[k]=Shapes.AddText("10p=50t") Shapes.Move(sweight[k],cX+2,cY+cl/5) EndFor ' ------------------- Loader ---------------------------------- GraphicsWindow.BrushColor="darkgreen" sLoader=Shapes.AddRectangle(1000,25) ' loader Shapes.Move(sloader,cX,100) GraphicsWindow.PenColor="Green" GraphicsWindow.PenWidth=3 For i=1 To 2 swire[i]= Shapes.AddLine(0,0,0,75) ' wire Shapes.Move(swire[i],cx+(i-1)*cL,125) EndFor endsub End>RTL937.sb< Start>RTM710.sb< ' PROGRAM BY YLED ' NOV 13th 2016 ' simulation of a ship approach of planet X ' goal: mastering LD3DVIEW ' PROGRAM: no FVX051 GraphicsWindow.TOP=0 GraphicsWindow.LEFT=0 GraphicsWindow.Width=1366 GraphicsWindow.Height=768 GraphicsWindow.Title ="SIMULATION PLANET" colors() GraphicsWindow.BackgroundColor=DBLUE planet = LD3DView.AddView(1366,768,"TRUE") LD3DView.AddDirectionalLight (planet,blue,180,-90,-155) LD3DView.AutoControl ("true" "true", -1 3) LD3DView.AddspotLight(planet,blue,1,4,5 ,-1 ,-1 ,-1, 18, 20) neptune=LD3DView.AddSphere (planet,1 ,100,cyan,"D") LD3DView.TranslateGeometry (planet,neptune, -2, -1, -1) io=LD3DView.AddSphere (planet,0.02 ,40,white,"D") LD3DView.TranslateGeometry (planet, io, 2, 1, 2) io1=LD3DView.AddSphere (planet,0.02 ,40,cyan,"D") LD3DView.TranslateGeometry (planet, io1, 1, 2, -1) io2=LD3DView.Addcube (planet,0.3,mgray,"D") LD3DView.TranslateGeometry (planet, io2, 1, 1, 3) triton=LD3DView.AddSphere (planet,0.05 ,20,lgreen,"D") LD3DView.TranslateGeometry (planet, triton, 1, 1, 3) triton1=LD3DView.AddSphere (planet,0.04 ,20,cyan,"D") LD3DView.TranslateGeometry (planet, triton1, 1, 2, -1) triton2=LD3DView.AddSphere (planet,0.03 ,20,magenta,"D") LD3DView.TranslateGeometry (planet, triton2, -1, -1, 3) almathe=LD3DView.AddSphere (planet,0.03 ,20,lbrown,"D") LD3DView.TranslateGeometry (planet, almathe, 1, 2, 1) almathe1=LD3DView.AddSphere (planet,0.01 ,20,lgreen,"D") LD3DView.TranslateGeometry (planet, almathe1, 1, -2, 1) almathe2=LD3DView.AddSphere (planet,0.02 ,20,blue,"D") LD3DView.TranslateGeometry (planet, almathe2, -1, -2, 1) altos=LD3DView.AddSphere (planet,0.04 ,20,blue,"D") LD3DView.TranslateGeometry (planet, altos, 0.6, 2, 1) altos1=LD3DView.AddSphere (planet,0.03 ,20,white,"D") LD3DView.TranslateGeometry (planet, altos1, -0.6, 2, 1) altos2=LD3DView.AddSphere (planet,0.03 ,20,cyan,"D") LD3DView.TranslateGeometry (planet, altos2, -0.6, -2, -1) While "true" z=Math.GetRandomNumber(5)+10 For aa=0 To 360 Step 0.5 px= (LDMath.Cos(aa)) py= (LDMath.sin (aa)) LD3DView.AnimateTranslation (planet,neptune, -2,-1,-1-W,10) LD3DView.AnimateTranslation (planet,io, px/z, py/z,aa/2,1) LD3DView.AnimateTranslation (planet,triton, -px/z, py/z,aa/4,3) LD3DView.AnimateTranslation (planet,almathe, px/z, py/z,aa/5,6) LD3DView.AnimateTranslation (planet,altos, px/z, py/z,aa,0.2) LD3DView.AnimateTranslation (planet,io1, px/z, py/z,aa/2,0.4) LD3DView.AnimateTranslation (planet,io2, -px/z, py/z,aa/1.5,15) LD3DView.AnimateTranslation (planet,triton1, px/z, py/z,aa/2.2,1) LD3DView.AnimateTranslation (planet,altos2, px/z, py/z,aa/4,23) LD3DView.AnimateTranslation (planet,altos1, px/z, py/z,aa/3,16) LD3DView.AnimateTranslation (planet,almathe1, px/z, py/z,aa/5,20) LD3DView.AnimateTranslation (planet,almathe2, px/z, py/z,aa/6,15) LD3DView.AnimateTranslation (planet,triton2, px/z, py/z,aa/7,15) Program.Delay (50) W=W-0.1 EndFor EndWhile Sub colors dblue=GraphicsWindow.GetColorFromRGB(0,0,10) dgreen=GraphicsWindow.GetColorFromRGB(0,25,0) lgreen=GraphicsWindow.GetColorFromRGB(100,225,100) dmagenta=GraphicsWindow.GetColorFromRGB(175,5,5) cyan=GraphicsWindow.GetColorFromRGB(50,250,225) blue=GraphicsWindow.GetColorFromRGB(150,150,250) magenta=GraphicsWindow.GetColorFromRGB(250,50,250) white=GraphicsWindow.GetColorFromRGB(255,255,250) lbrown=GraphicsWindow.GetColorFromRGB(250,225,100) dgray=GraphicsWindow.GetColorFromRGB(15,15,15) mgray=GraphicsWindow.GetColorFromRGB(135,145,105) EndSub End>RTM710.sb< Start>RTQ437.sb< '3D Wireframe Model By: Dudeson GraphicsWindow.Height = 300 GraphicsWindow.Width = 300 Corner_Amount = 3 Radius = 100 For i = 1 To Corner_Amount Angle[i] = (360/Corner_Amount)*i EndFor While "True" Angle_Main = -GraphicsWindow.MouseX For i = 1 To Corner_Amount u = Math.GetRadians(Angle_Main + Angle[i]) Corner_X[i] = 150 + Math.Cos(u) * Radius Corner_Y[i] = 200 + Math.Sin(u) * Radius/2 Shapes.Remove(Line1[i]) Shapes.Remove(Line2[i]) Line1[i] = Shapes.AddLine(Corner_X[i],Corner_Y[i],Corner_X[prev_i],Corner_Y[prev_i]) Line2[i] = Shapes.AddLine(Corner_X[i],Corner_Y[i],150,100) prev_i = i EndFor Program.Delay(15) EndWhile End>RTQ437.sb< Start>RTR233.sb< ' mahreen miangul OctObeR 2019 ' Multiple Animation--Mikey Mouse '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" ' ===================================mussa-maina============================= GraphicsWindow.FontSize = 8 'GraphicsWindow.brushColor = GraphicsWindow.GetRandomColor() 'GraphicsWindow.brushColor = GraphicsWindow.getcolorfromrgb(175, 75, 125) GraphicsWindow.brushColor = "gold miangul = Shapes.Addtext("mussa-maina") Shapes.Move(miangul, 700,280) 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) 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.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,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 = "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() 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=600" shY[6] ="1=550" 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" 'Ladder s[7] ="1=0.6" ' scale shx[7] ="1= 380" ' initial x -position shy[7] ="1= 180" ' initial y-position shape[7][1] = "func=line;x=0;y=0;x1=400;y1=200;x2=660;y2=525;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder P1 shape[7][2] = "func=line;x=0;y=0;x1=440;y1=200;x2=700;y2=525;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder P2 shape[7][3] = "func=line;x=0;y=0;x1=415;y1=220;x2=455;y2=220;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 1 shape[7][4] = "func=line;x=0;y=0;x1=430;y1=240;x2=470;y2=240;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 2 shape[7][5] = "func=line;x=0;y=0;x1=445;y1=260;x2=488;y2=260;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 3 shape[7][6] = "func=line;x=0;y=0;x1=460;y1=280;x2=505;y2=280;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 4 shape[7][7] = "func=line;x=0;y=0;x1=475;y1=300;x2=522;y2=300;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 5 shape[7][8] = "func=line;x=0;y=0;x1=492;y1=320;x2=537;y2=320;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 6 shape[7][9] = "func=line;x=0;y=0;x1=508;y1=340;x2=549;y2=340;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 7 shape[7][10] = "func=line;x=0;y=0;x1=528;y1=360;x2=568;y2=360;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 8 shape[7][11] = "func=line;x=0;y=0;x1=636;y1=500;x2=680;y2=500;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step L shape[7][12] = "func=line;x=0;y=0;x1=400;y1=200;x2=400;y2=530;angle=0;bc=mediumslateblue;pc=darkgray;pw=2"'<------------' Shadow1 P1 shape[7][13] = "func=line;x=0;y=0;x1=440;y1=200;x2=445;y2=500;angle=0;bc=mediumslateblue;pc=darkgray;pw=2"'<------------' Shadow1 P2 shape[7][14] = "func=line;x=0;y=0;x1=444;y1=500;x2=640;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 P1 shape[7][15] = "func=line;x=0;y=0;x1=400;y1=530;x2=660;y2=530;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 P1 shape[7][16] = "func=line;x=0;y=0;x1=400;y1=220;x2=414;y2=220;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 1 shape[7][17] = "func=line;x=0;y=0;x1=400;y1=240;x2=430;y2=240;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 2 'shape[7][0] = "func=line;x=0;y=0;x1=400;y1=530;x2=444;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow Step M 'shape[7][0] = "func=line;x=0;y=0;x1=440;y1=530;x2=484;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step 1 shape[7][18] = "func=line;x=0;y=0;x1=530;y1=530;x2=530;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step 2 shape[7][19] = "func=line;x=0;y=0;x1=570;y1=530;x2=570;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step 3 shape[7][20] = "func=line;x=0;y=0;x1=604;y1=530;x2=604;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step 4 'shape[7][0] = "func=line;x=0;y=0;x1=640;y1=530;x2=640;y2=500;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step 5 shape[7][21] = "func=line;x=0;y=0;x1=638;y1=530;x2=638;y2=502;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow2 Step L shape[7][22] = "func=line;x=0;y=0;x1=545;y1=380;x2=585;y2=380;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 9 shape[7][23] = "func=line;x=0;y=0;x1=560;y1=400;x2=600;y2=400;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 10 shape[7][24] = "func=line;x=0;y=0;x1=575;y1=420;x2=615;y2=420;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 11 shape[7][25] = "func=line;x=0;y=0;x1=590;y1=440;x2=630;y2=440;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 12 shape[7][26] = "func=line;x=0;y=0;x1=605;y1=460;x2=645;y2=460;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 13 shape[7][27] = "func=line;x=0;y=0;x1=622;y1=480;x2=660;y2=480;angle=0;bc=darkslategray;pc=#oooooo;pw=2" ' Ladder Step 14 shape[7][28] = "func=line;x=0;y=0;x1=400;y1=260;x2=445;y2=260;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 3 shape[7][29] = "func=line;x=0;y=0;x1=400;y1=280;x2=445;y2=280;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 4 shape[7][30] = "func=line;x=0;y=0;x1=400;y1=300;x2=445;y2=300;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 5 shape[7][31] = "func=line;x=0;y=0;x1=400;y1=320;x2=445;y2=320;angle=0;bc=darkslategray;pc=darkgray;pw=2" ' <------------' Shadow1 Step 6 shape[7][32] = "func=line;x=0;y=0;x1=400;y1=340;x2=445;y2=340;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 7 shape[7][33] = "func=line;x=0;y=0;x1=400;y1=360;x2=445;y2=360;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 8 shape[7][34] = "func=line;x=0;y=0;x1=400;y1=380;x2=445;y2=380;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 9 'shape[7][35] = "func=line;x=0;y=0;x1=400;y1=400;x2=445;y2=400;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 10 'shape[7][36] = "func=line;x=0;y=0;x1=400;y1=420;x2=445;y2=420;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 11 'shape[7][37] = "func=line;x=0;y=0;x1=400;y1=440;x2=445;y2=440;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 12 'shape[7][38] = "func=line;x=0;y=0;x1=400;y1=460;x2=445;y2=460;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 13 'shape[7][39] = "func=line;x=0;y=0;x1=400;y1=480;x2=445;y2=480;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 14 'shape[7][40] = "func=line;x=0;y=0;x1=400;y1=500;x2=445;y2=500;angle=0;bc=darkslategray;pc=silver;pw=2" ' <------------' Shadow1 Step 15 'Tree s[8]="1=0.7;2=0.7;3=0.7;4=0.7;" shX[8]="1=1040;2=1070;3=1100;4=1130" shY[8]="1=200;2=200;3=200;4=200" ' 5,6,13,14 shape[8]=shape[1] 'Apple s[9] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=.2;8=.2;" shX[9] ="1=1000;2=1030;3=1060;4=970;5=1000;6=1030;7=1060;8=1090" shY[9] ="1=270;2=270;3=270;4=300;5=300;6=300;7=300;8=300" shape[9]=shape[2] endsub End>RTR233.sb< Start>RTR300.sb< args=0 GraphicsWindow.Width=450 GraphicsWindow.BackgroundColor="Darkgreen GraphicsWindow.BrushColor="Lime for x=1 To 120 e[x]=Shapes.AddEllipse(40,40) fs[x]=LDFastShapes.ShapeIndex(e[x]) LDFastShapes.Move (fs[x],ldmath.Cos(x*3)*150+200,ldmath.sin(x*3)*150+200) LDShapes.PenWidth(e[x],0) EndFor LDFastShapes.Update () While 1=1 for x=1 To 120 For y=0 to 9 LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y)],0) LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y+40)],0) LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y+80)],0) EndFor LDFastShapes.Update () Program.Delay(30) For y=0 to 9 LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y)],100) LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y+40)],100) LDFastShapes.SetOpacity (fs[ldcall.Function ("mod",x+y+80)],100) EndFor EndFor EndWhile Sub mod return=math.Remainder(args[1],120)+1 endsub End>RTR300.sb< Start>RTV174.sb< dw=1200 dh=900 ya=300 r35=600 f4=10 LDUtilities.ShowErrors="false LDUtilities.ShowNoShapeErrors="false GraphicsWindow.Width =dw GraphicsWindow.Height=dh GraphicsWindow.Left=1 GraphicsWindow.Top =11 TextWindow.Show () TextWindow.Left =1220 TextWindow.Top=10 bt1=Controls.AddButton("Alphabet" 10,2) bt2=Controls.AddButton("Periodic" 110 2) bt3=Controls.AddButton("Freq" 180,2) Controls.ButtonClicked=bccl c8=text.GetCharacter(9) lb=bt2 fq="6 7 15 88 16 73|20 11 91 37 51 65|48 41 82 75 21 43|58 60 46 104 34 52|98 10 61 111 106 90|17 113 84 45 14 22|96 28 59 86 62 81|112 102 78 44 50 69|27 93 94 0 38 117|24 |55 0 68 105 8 92|29 53 99 110 118 23|0 49 63 66 76 74|0 77 31 30 19 54|89 0 64 40 36 39|47 5 32 0 0 70|13 56 1 115 |95 4 2 101 9 57|18 107 72 12 26 3|33 83 80 25 114 103|85 97 67 42 100 71|79 35 108 109 87 116 fqq=ldtext.Split (fq "|") Sub bccl lb= Controls.LastClickedButton If lb= bt3 then '----freq show kdd() GraphicsWindow.Title="Name frequency listing LD3DView.ModifyObject (view3D ssh "H") For wx=1 To Array.GetItemCount (fqq) ln=ldtext.Split (fqq[wx] c8) For wt=1 To 6 For wk=1 To Array.GetItemCount (tb[ln[wt]]) lx=(wt-3)*38*2 ly=(10-wx)*28 LD3DView.AnimateTranslation (view3D tb[ln[wt]][wk] lx ly, 0 1 ) endfor endfor endfor ElseIf lb=bt2 then GraphicsWindow.Title="Periodic listing LD3DView.ModifyObject (view3D ssh "S") For xx=1 to 118 pzc=ldtext.Split(pzm[xx] c8) lx=(pzc[1]-9)*38 ly=(8-pzc[2])*28 zp=-ldmath.Sin(pzc[1]*10)*30 For k=1 to Array.GetItemCount (tb[xx]) LD3DView.AnimateTranslation (view3D tb[xx][k] lx ly, zp 1 ) endfor endfor elseIf lb= bt1 then kdd() GraphicsWindow.Title="Alphabetic listing LD3DView.ModifyObject (view3D ssh "H") r1=0 r2=0 For wx=1 To 118 ln=ldtext.Split (abe[wx] "|") 'TextWindow.Write (ln[1]+", ") r2=r2+1 For wk=1 To Array.GetItemCount (tb[ln[2]]) lx=(r2-5)*38*1.3 ly=(8-r1)*28 LD3DView.AnimateTranslation (view3D tb[ln[2]][wk] lx ly, 0 1 ) endfor If Text.IsSubText (" Au Br Cu Fr Hs Kr Mt Os Pu Ru Sr Ts " " "+ln[1]+" ") then r1=r1+1 r2=0 endif endfor EndIf EndSub args=0 kk=1 wa="1 4 7 9 11 12 14 16 19 20 23 24 27 28 31 32 35 40 39 41 45 48 51 52 55 56 59 58 64 65 70 73 75 79 80 84 85 87 89 91 93 96 98 101 103 106 108 112 115 119 122 128 127 131 133 137 139 140 141 144 145 150 152 157 159 163 165 167 169 173 175 178 181 184 186 190 192 195 197 201 204 207 209 209 210 222 223 223 227 232 231 238 237 244 243 247 247 251 252 257 258 259 266 267 268 269 270 269 278 281 282 285 286 289 289 293 294 294 wat=ldtext.Split (wa " ") pzz="1 1|18 1|1 2|2 2|13 2|14 2|15 2|16 2|17 2|18 2|1 3|2 3|13 3|14 3|15 3|16 3|17 3|18 3|1 4|2 4|3 4|4 4|5 4|6 4|7 4|8 4|9 4|10 4|11 4|12 4|13 4|14 4|15 4|16 4|17 4|18 4|1 5|2 5|3 5|4 5|5 5|6 5|7 5|8 5|9 5|10 5|11 5|12 5|13 5|14 5|15 5|16 5|17 5|18 5|1 6|2 6|3 8|4 8|5 8|6 8|7 8|8 8|9 8|10 8|11 8|12 8|13 8|14 8|15 8|16 8|3 6|4 6|5 6|6 6|7 6|8 6|9 6|10 6|11 6|12 6|13 6|14 6|15 6|16 6|17 6|18 6|1 7|2 7|3 9|4 9|5 9|6 9|7 9|8 9|9 9|10 9|11 9|12 9|13 9|14 9|15 9|16 9|3 7|4 7|5 7|6 7|7 7|8 7|9 7|10 7|11 7|12 7|13 7|14 7|15 7|16 7|17 7|18 7 pzm=ldtext.Split (pzz "|") elm="H Hydrogen c. hydro+gen:water-forming|He Hel~ a. helios:sun|Li Lith~ w. lithos:stone|Be Beryll~ n. beryl (mineral)|B Boron n. borax (mineral)|C Carbon w. carbo:coal|N Nitrogen c. nitron+gen:niter-forming|O Oxygen c. oxy+gen:acid-forming|F Fluorine w. fluere:to flow|Ne Neon w. neos:new|Na Sod~ w. soda:natr~ |Mg Magnes~ g. Magnesia, district in Greece|Al Al`in~ w. al`ina, a compound (orig. al`in`)|Si Silicon w. silex:flint (orig. silic~)|P Phosphorus w. phoosphoros:carrying light|S Sulfur w. sulphur:fire and brimstone|Cl Chlorine r. chloros:greenish yellow|Ar Argon w. argos:idle|K Potass~ w. potassa:kal~|Ca Calc~ w. calx:lime|Sc Scand~ g. Scandia:Scandinavia|Ti Titan~ m. Titans:the sons of the Earth|V Vanad~ w. Vanadis, an Old Norse name|Cr Chrom~ w. chroma:color|Mn Manganese w. corrupted from magnesia negra|Fe Iron w. ferr`|Co Cobalt w. Kobold:goblin|Ni Nickel w. kopparnickel, cont.nickel|Cu Copper w. cupr`|Zn Zinc w. Zink|Ga Gall~ g. Gallia:France|Ge German~ g. Germania:Germany|As Arsenic w. arsenic`|Se Selen~ a. selene:moon |Br Bromine w. bromos:stench|Kr Krypton w. kryptos:hidden|Rb Rubid~ r. rubidus:deep red|Sr Stront~ g. Strontian, Scotland|Y Yttr~ g. Ytterby, Sweden|Zr Zircon~ r. Zargun:gold-colored|Nb Niob~ m. Niobe, daughter of king Tantalus|Mo Molybden` w. molybdos:lead|Tc Technet~ w. tekhnètos:artificial|Ru Ruthen~ g. Ruthenia:Russia|Rh Rhod~ r. rhodos:rose coloured|Pd Pallad~ a. Pallas, asteroid|Ag Silver w. argent`|Cd Cadm~ m. cadmia:King Kadmos|In Ind~ r. indigo|Sn Tin w. stann`|Sb Antimony c. stibi`, composed from anti+monos, against+alone|Te Tellur~ a. tellus:earth|I Iodine r. iode (after ioeides:violet)|Xe Xenon w. xenos:strange|Cs Caes~ r. caesius:sky blue|Ba Bar~ w. barys:heavy|La Lanthan` w. lanthanein:to lie hidden|Ce Cer~ a. Ceres, asteroid|Pr Praseodym~ c. praseios+didymos:green twin|Nd Neodym~ c. neos+didymos:new twin|Pm Prometh~ m. Prometheus, Greek myth.|Sm Samar~ n. Samarskite, mineral|Eu Europ~ g. Europe|Gd Gadolin~ p. Johan Gadolin, chem.|Tb Terb~ g. Ytterby, Sweden|Dy Dyspros~ c. dysprositos:hard to get|Ho Holm~ g. Holmia:Stockholm|Er Erb~ g. Ytterby, Sweden|Tm Thul~ g. Thule:Scandinavia |Yb Ytterb~ g. Ytterby, Sweden|Lu Lutet~ g. Lutetia:Paris|Hf Hafn~ g. Hafnia:Copenhagen |Ta Tantal` m. King Tantalus, father of Niobe|W Tungsten c. tung sten:heavy stone (W:wolframite)|Re Rhen~ g. Rhenus:river Rhine|Os Osm~ w. osmè =smell|Ir Irid~ m. Iris, goddess of the rainbow|Pt Platin` w. platina:little silver|Au Gold w. aur`|Hg Mercury c. mercurius, hydr+argyros:water+silver|Tl Thall~ c. thallos:green twig|Pb Lead w. pl`b` |Bi Bismuth w. old German: 'white mass'|Po Polon~ g. Polonia:Poland|At Astatine w. astatos:unstable|Rn Radon w. from rad~|Fr Franc~ g. Francia:France|Ra Rad~ w. radius:ray|Ac Actin~ w. aktis:ray|Th Thor~ m. Thor, Scand. god of thunder|Pa Protactin~ c. protos:first+actin~|U Uran~ a. Uranus, planet|Np Neptun~ a. Neptune, planet|Pu Pluton~ a. Pluto, dwarf planet|Am Americ~ g. The Americas|Cm Cur~ p. Pierre+Marie Curie|Bk Berkel~ g. Berkeley, California|Cf Californ~ g. California|Es Einstein~ p. Albert Einstein, phys.|Fm Ferm~ p. Enrico Fermi, phys.|Md Mendelev~ p. Dmitri Mendeleev, chem.|No Nobel~ p. Alfred Nobel, chem.|Lr Lawrenc~ p. Ernest O. Lawrence, phys.|Rf Rutherford~ p. Ernest Rutherford, chem. / phys.|Db Dubn~ g. Dubna, Russia|Sg Seaborg~ p. Glenn T. Seaborg, scient.|Bh Bohr~ p. Niels Bohr, phys.|Hs Hass~ g. Hesse, Germany |Mt Meitner~ p. Lise Meitner, phys.|Ds Darmstadt~ g. Darmstadt, Germ.|Rg Roentgen~ p. Wilhelm C. Röntgen, phys.|Cn Copernic~ p. Nicolaus Copernicus, astr.|Nh Nihon~ g. Japan:Nihon|Fl Flerov~ p. Georgy Flyorov, phys.|Mc Moscov~ g. Moscow Oblast, Russia|Lv Livermor~ g. Lawrence Livermore lab.|Ts Tennessine g. Tennessee, USA|Og Oganesson p. Yuri Oganessian, phys. elm=ldtext.Replace(elm "`" "um") elm=ldtext.Replace(elm "~" "ium") elm=ldtext.Replace(elm c8+c8 c8) elm=ldtext.Replace(elm ":" " = ") ell=ldtext.Split (elm "|") lln=ldtext.Split ("3 3 4 14" " ") ae=ldarray.Create (120) aae=ldarray.Create (120) nl=">"+text.GetCharacter (13)+Text.GetCharacter (10) nln=text.GetCharacter (13)+Text.GetCharacter (10) For x=1 to 118 li=ldtext.Split (ell[x] c8) LDArray.SetValue (ae x li[3]+"|"+li[1]+"|"+x+"|"+li[2]+"|"+li[4]) LDArray.SetValue (aae x li[1]+"|"+x) mty[x]="transition metal" endfor LDArray.Sort (aae) 'alphabetic LDArray.Sort (ae) 'by type be=LDArray.CopyToSBArray(ae) abe=LDArray.CopyToSBArray(aae) oll="a." For x=1 to 118 li=ldtext.Split (be[x] "|") If li[1]=oll Then lcc=lcc+1 Else TextWindow.WriteLine (lcc+"======") oll=li[1] lcc=1 endif For f=1 to 4 TextWindow.Write (LDCall.Function2("tab" li[f] lln[f])) endfor TextWindow.WriteLine (li[5]) endfor TextWindow.WriteLine (lcc+"======") Sub tab return=text.GetSubText (args[1]+" " 1 args[2]) EndSub Sub tabr return=text.GetSubTextToEnd (" " Text.GetLength (args[1]) )+args[1] EndSub ec="1|2|2 1|2 2|2 3|2 4|2 5|2 6|2 7|2 8|2 8 1|2 8 2|2 8 3|2 8 4|2 8 5|2 8 6|2 8 7|2 8 8|2 8 8 1|2 8 8 2|2 8 9 2|2 8 10 2|2 8 11 2|2 8 13 1|2 8 13 2|2 8 14 2|2 8 15 2|2 8 16 2" ec=ec+"|2 8 18 1|2 8 18 2|2 8 18 3|2 8 18 4|2 8 18 5|2 8 18 6|2 8 18 7|2 8 18 8|2 8 18 8 1|2 8 18 8 2|2 8 18 9 2|2 8 18 10 2|2 8 18 12 1|2 8 18 13 1|2 8 18 14 1|2 8 18 15 1|2 8 18 16 1 ec=ec+"|2 8 18 17 1|2 8 18 18 1|2 8 18 18 2|2 8 18 18 3|2 8 18 18 4|2 8 18 18 5|2 8 18 18 6|2 8 18 18 7|2 8 18 18 8|2 8 18 18 8 1|2 8 18 18 8 2 'lant. ec=ec+"|2 8 18 18 9 2|2 8 18 19 9 2|2 8 18 21 8 2|2 8 18 22 8 2|2 8 18 23 8 2|2 8 18 24 8 2|2 8 18 25 8 2|2 8 18 25 9 2|2 8 18 27 8 2|2 8 18 28 8 2|2 8 18 29 8 2|2 8 18 30 8 2 ec=ec+"|2 8 18 31 8 2|2 8 18 32 8 2|2 8 18 32 9 2 ec=ec+"|2 8 18 32 10 2|2 8 18 32 11 2|2 8 18 32 12 2|2 8 18 32 13 2|2 8 18 32 14 2|2 8 18 32 15 2|2 8 18 32 17 1|2 8 18 32 18 1|2 8 18 32 18 2|2 8 18 32 18 3|2 8 18 32 18 4|2 8 18 32 18 5|2 8 18 32 18 6 ec=ec+"|2 8 18 32 18 7|2 8 18 32 18 8|2 8 18 32 18 8 1|2 8 18 32 18 8 2 'act. ec=ec+"|2 8 18 32 18 9 2|2 8 18 32 18 10 2|2 8 18 32 20 9 2|2 8 18 32 21 9 2|2 8 18 32 22 9 2|2 8 18 32 24 8 2|2 8 18 32 25 8 2|2 8 18 32 25 9 2|2 8 18 32 27 8 2|2 8 18 32 28 8 2 ec=ec+"|2 8 18 32 29 8 2|2 8 18 32 30 8 2|2 8 18 32 31 8 2|2 8 18 32 32 8 2|2 8 18 32 32 9 2 ec=ec+"|2 8 18 32 32 10 2|2 8 18 32 32 11 2|2 8 18 32 32 12 2|2 8 18 32 32 13 2|2 8 18 32 32 14 2|2 8 18 32 32 15 2|2 8 18 32 32 16 2|2 8 18 32 32 17 2|2 8 18 32 32 18 2 ec=ec+"|2 8 18 32 32 18 3|2 8 18 32 32 18 4|2 8 18 32 32 18 5|2 8 18 32 32 18 6|2 8 18 32 32 18 7|2 8 18 32 32 18 8 esh=ldtext.Split (ec "|") cdf="aa=1\=@111\;2\=@37\;3\=@117\;4\=@94\;5\=@90\;;bb=1\=@111\;2\=@34\;3\=@37\;4\=@49\;5\=@71\;6\=@81\;7\=@93\;8\=@115\;9\=@125\;10\=@122\;; cdf=cdf+"pp=1\=@111\;2\=@34\;3\=@37\;4\=@49\;5\=@71\;6\=@81\;7\=@78\;;rr=1\=@111\;2\=@34\;3\=@37\;4\=@49\;5\=@71\;6\=@81\;7\=@78\;8\=@80\;9\=@115\;; cdf=cdf+"ss=1\=@49\;2\=@37\;3\=@35\;4\=@45\;5\=@67\;6\=@79\;7\=@81\;8\=@93\;9\=@115\;10\=@125\;11\=@123\;12\=@111\;;cc=1\=@49\;2\=@37\;3\=@35\;4\=@45\;5\=@100\;6\=@112\;7\=@114\;8\=@104\;; cdf=cdf+"ee=1\=@49\;2\=@37\;3\=@35\;4\=@45\;5\=@67\;6\=@79\;7\=@89\;8\=@111\;9\=@123\;10\=@125\;11\=@115\;;hh=1\=@34\;2\=@111\;3\=@78\;4\=@82\;5\=@38\;6\=@115\;; cdf=cdf+"tt=1\=@38\;2\=@34\;3\=@36\;4\=@113\;;ff=1\=@38\;2\=@34\;3\=@111\;4\=@78\;5\=@81\;;dd=1\=@34\;2\=@37\;3\=@49\;4\=@104\;5\=@114\;6\=@111\;7\=@45\;;gg=1\=@49\;2\=@37\;3\=@35\;4\=@45\;5\=@100\;6\=@112\;7\=@114\;8\=@104\;9\=@82\;10\=@80\;; cdf=cdf+"ii=1\=@34\;2\=@111\;;jj=1\=@100\;2\=@112\;3\=@114\;4\=@104\;5\=@38\;6\=@35\;;kk=1\=@37\;2\=@78\;3\=@115\;;ll=1\=@34\;2\=@111\;3\=@114\;; cdf=cdf+"mm=1\=@111\;2\=@35\;3\=@81\;4\=@39\;5\=@117\;;nn=1\=@111\;2\=@34\;3\=@115\;4\=@38\;;oo=1\=@45\;2\=@35\;3\=@38\;4\=@50\;5\=@105\;6\=@115\;7\=@112\;8\=@100\;9\=@45\;; cdf=cdf+"uu=1\=@34\;2\=@100\;3\=@112\;4\=@115\;5\=@105\;6\=@39\;;vv=1\=@34\;2\=@113\;3\=@38\;;zz=1\=@34\;2\=@38\;3\=@111\;4\=@115\;; cdf=cdf+"yy=1\=@34\;2\=@69\;3\=@38\;;xx=1\=@39\;2\=@111\;;ww=1\=@34\;2\=@112\;3\=@69\;4\=@114\;5\=@38\;; cdf=cdf+"y0=1\=@69\;2\=@113\;;x0=1\=@35\;2\=@117\;; cdf=cdf+"a1=1\=@115\;2\=@82\;3\=@70\;4\=@68\;5\=@78\;6\=@100\;7\=@112\;8\=@114\;9\=@104\;; cdf=cdf+"o1=1\=@68\;2\=@78\;3\=@100\;4\=@112\;5\=@114\;6\=@104\;7\=@82\;8\=@70\;9\=@68\;; cdf=cdf+"e1=1\=@89\;2\=@93\;3\=@82\;4\=@70\;5\=@68\;6\=@78\;7\=@100\;8\=@112\;9\=@115\;;i1=1\=@68\;2\=@69\;3\=@113\;; cdf=cdf+"l1=1\=@35\;2\=@36\;3\=@102\;4\=@114\;5\=@115\;;t1=1\=@36\;2\=@69\;3\=@68\;4\=@70\;5\=@69\;6\=@102\;7\=@114\;8\=@115\;; cdf=cdf+"b1=1\=@78\;2\=@68\;3\=@70\;4\=@82\;5\=@104\;6\=@114\;7\=@111\;8\=@34\;; cdf=cdf+"c1=1\=@82\;2\=@70\;3\=@68\;4\=@78\;5\=@100\;6\=@112\;7\=@114\;8\=@104\;; cdf=cdf+"d1=1\=@38\;2\=@115\;3\=@112\;4\=@100\;5\=@78\;6\=@68\;7\=@71\;; cdf=cdf+"p1=1\=@100\;2\=@112\;3\=@114\;4\=@104\;5\=@82\;6\=@70\;7\=@68\;8\=@78\;9\=@144\;; cdf=cdf+"u1=1\=@67\;2\=@100\;3\=@112\;4\=@114\;5\=@104\;6\=@71\;;v1=1\=@67\;2\=@113\;3\=@71\;; cdf=cdf+"w1=1\=@67\;2\=@112\;3\=@91\;4\=@114\;5\=@71\;;n1=1\=@111\;2\=@67\;3\=@70\;4\=@82\;5\=@115\;; cdf=cdf+"m1=1\=@111\;2\=@67\;3\=@68\;4\=@80\;5\=@70\;6\=@82\;7\=@115\;;z1=1\=@67\;2\=@71\;3\=@111\;4\=@115\;; cdf=cdf+"r1=1\=@111\;2\=@67\;3\=@69\;4\=@81\;;s1=1\=@71\;2\=@59\;3\=@57\;4\=@67\;5\=@78\;6\=@92\;7\=@104\;8\=@115\;9\=@125\;10\=@123\;11\=@111\;; cdf=cdf+"g1=1\=@104\;2\=@114\;3\=@112\;4\=@100\;5\=@78\;6\=@68\;7\=@71\;8\=@137\;9\=@147\;10\=@145\;11\=@133\;; cdf=cdf+"q1=1\=@104\;2\=@114\;3\=@112\;4\=@100\;5\=@78\;6\=@68\;7\=@70\;8\=@82\;9\=@148\;; cdf=cdf+"j1=1\=@70\;2\=@71\;3\=@137\;4\=@147\;5\=@145\;6\=@133\;;h1=1\=@34\;2\=@111\;; cdf=cdf+"h2=1\=@67\;2\=@69\;3\=@81\;4\=@114\;;k2=1\=@70\;2\=@89\;3\=@114\;; cdf=cdf+"f1=1\=@38\;2\=@36\;3\=@46\;4\=@112\;;f2=1\=@67\;2\=@70\;;y1=1\=@67\;2\=@100\;3\=@112\;4\=@115\;; cdf=cdf+"y2=1\=@71\;2\=@137\;3\=@147\;4\=@144\;;x1=1\=@115\;2\=@67\;;x2=1\=@71\;2\=@111\;; inn="true chrs=LDText.Replace(cdf "@" "Ellipse") GraphicsWindow.Title="cc:"+Array.GetItemCount (chrs) 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,10,1,10, -1, -1, -1, "","","") i=1 di=1 GraphicsWindow.FontBold="true GraphicsWindow.FontItalic="true GraphicsWindow.FontSize=20 GraphicsWindow.FontName="Arial\ Sub drawatm ssp=LDShapes.GetAllShapes() For x= 166 To Array.GetItemCount (ssp) If Text.StartsWith (ssp[x] "Ell") Then Shapes.Remove (ssp[x]) endif endfor If args[1]>0 then GraphicsWindow.BrushColor="teal GraphicsWindow.PenColor="lime att=ldtext.Split (esh[args[1]] " ") tc=Array.GetItemCount (att) cdx=args[4]/9 cr=args[4]-(8-tc)*cdx cx=args[2] cy=args[3]+args[4]/2 For x=1 To tc cr=cr+cdx GraphicsWindow.PenWidth=1 GraphicsWindow.BrushColor="transparent ee=Shapes.AddEllipse (cr cr) LDShapes.Centre (ee cx cy) an=-90 ai=360/att[x] For y=1 To att[x] If x=tc Then GraphicsWindow.PenWidth=1 else GraphicsWindow.PenWidth=0 endif GraphicsWindow.BrushColor=LDColours.HSLtoRGB (240 1 x/9) eq=Shapes.AddEllipse (8 8) LDShapes.Centre (eq LDMath.Cos(an)*cr/2+cx cy+ldmath.Sin(an)*cr/2) an=an+ai endfor endfor endif EndSub GraphicsWindow.BrushColor="blue qq=80 GraphicsWindow.DrawText (10 620-qq "·Nobile gases (7)") GraphicsWindow.BrushColor="yellow GraphicsWindow.DrawText (10 640-qq "·Halogens (6)") GraphicsWindow.BrushColor="gold GraphicsWindow.DrawText (10 660-qq "·Nonmetals (6)") GraphicsWindow.BrushColor="lime GraphicsWindow.DrawText (10 680-qq "·Metalloids (7)") GraphicsWindow.BrushColor="brown GraphicsWindow.DrawText (10 700-qq "·Post-​transit. met. (9)") GraphicsWindow.BrushColor="lightgray GraphicsWindow.DrawText (10 720-qq "​·Transition metals (35)") pinky=LDColours.HSLtoRGB (5 1 .6) GraphicsWindow.BrushColor="black GraphicsWindow.DrawText (10 740-qq "·Unknown props (6)") GraphicsWindow.BrushColor=pinky GraphicsWindow.DrawText (10 760-qq "·​Alcali metals (6)") GraphicsWindow.BrushColor="orange GraphicsWindow.DrawText (10 780-qq "​·Alc. earth met. (6)") GraphicsWindow.BrushColor=LDColours.HSLtoRGB (355 1 .7) GraphicsWindow.DrawText (10 800-qq "​·Lantanide met. (15)") GraphicsWindow.BrushColor= LDColours.HSLtoRGB (330 1 .6) GraphicsWindow.DrawText (10 820-qq "​·Actinide met. (15)") cmt=ldtext.Split ("aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp rr ss tt uu vv ww xx yy zz y0 x0" " ") cm2=ldtext.Split ("a1:0 b1:0 c1:0 d1:0 e1:0 f1:f2 g1:0 h1:h2 i1:0 j1:0 h1:k2 l1:0 m1:0 n1:0 o1:0 p1:0 q1:0 r1:0 s1:0 t1:t2 u1:0 v1:0 w1:0 x1:x2 y1:y2 z1:0" " ") GraphicsWindow.PenWidth=0 LDEvents.MouseWheel=mww st="0 0 0:38 0 0:38 28 0:0 28 0:0 0 0 ssh= LD3DView.AddTube (view3D st 1 33 "red" "E") mov="false For y=0 To 14 For x=0 To 10 ee[i]=Shapes.AddEllipse(14 14) Shapes.move (ee[i] x*30+25-y*10+150 y*30+65) Shapes.HideShape (ee[i]) i=i+1 EndFor EndFor GraphicsWindow.BrushColor="darkblue rtm="true 'bt=0 ad=.03 aa=77 While "true If rtm Then rtm="false mww() For xx=1 to 118 ce=xx xd=0 li=ldtext.Split (ell[xx] c8) c1=text.GetSubText (li[1] 1 1) If Text.GetLength (li[1])>1 then c2=Text.GetSubTextToEnd (li[1] 2) Else c2=0 endif pzc=ldtext.Split(pzm[xx] c8) If Text.IsSubText ("!5:!14:!32:!33:!51:!52:!84:" "!"+xx+":") then fcl="lime mty[xx]="metalloide ElseIf Text.IsSubText ("!13:!31:!49:!50:!81:!82:!83:!84:!114:" "!"+xx+":") then fcl="brown mty[xx]="post trans. metal ElseIf (xx>=109 and xx<=111) or Text.IsSubText ("!113:!115:!116:" "!"+xx+":")then fcl="black mty[xx]="unknown type elseIf pzc[1]=18 then fcl="blue mty[xx]="nobile gas elseIf pzc[1]=17 then fcl="yellow mty[xx]="halogen elseIf pzc[1]=1 and xx>1 then fcl=pinky mty[xx]="alcali met. elseIf pzc[2]=8 or xx=71 then fcl=LDColours.HSLtoRGB (355 1 .7) mty[xx]="lantanoide elseIf pzc[2]=9 or xx=103 then fcl=LDColours.HSLtoRGB (330 1 .6) mty[xx]="actinoide elseIf pzc[1]>=3 and pzc[1]<=12 then fcl="lightgray elseIf pzc[1]=2 then fcl="orange mty[xx]="alcaline earth else fcl="gold mty[xx]="nonmetal endif GraphicsWindow.Title=xx+": "+li[2]+" | "+(wat[xx]-xx) cdd=Text.GetCharacterCode (c1) If cdd>81 then cdd=cdd-1 endif LDCall.Function ("shuc" cdd-64) xd=xd+30 If c2=0 then 'nil else LDCall.Function ("shlc" Text.GetCharacterCode (c2)-96) endif ' mww() Program.Delay (10) lx=(pzc[1]-9)*38 ly=(8-pzc[2])*28 zp=-ldmath.Sin(pzc[1]*10)*30 For k=1 to kk LD3DView.SetCentre (view3D tb[ce][k] lx ly, zp "R1R2R3") LD3DView.TranslateGeometry (view3D tb[ce][k] lx ly, zp ) Program.Delay (30) LD3DView.AnimateRotation (view3D tb[ce][k] 0 1 0 0 360 1 1) endfor kk=1 endfor Program.Delay (150) kdd() GraphicsWindow.KeyDown=kdd Else aa=aa+ad If aa>105 or aa<75 then ad=-ad endif px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndIf Program.Delay (11) endwhile Sub kdd If lb=bt2 then lk=text.ConvertToLowerCase (GraphicsWindow.LastKey) If inn Then inn="false lk="right endif xc=ldtext.Split (pzm[ex] c8) d9=9 If lk="left" Then ex=ex-1 elseIf lk="right" Then ex=ex+1 elseIf lk="up" Then If xc[1]=18 then If ex>54 then d9=32 elseif ex>18 Then d9=18 Else d9=8 endif elseif xc[1]=1 then If ex>55 then d9=32 elseIf ex>19 then d9=18 elseIf ex>3 then d9=8 Else d9=2 endif elseif xc[1]=2 then If ex>56 then d9=32 elseIf ex>20 then d9=18 Else d9=8 endif elseif xc[1]>=4 and xc[1]<=16 then If xc[2]<4 then d9=8 else If ex>=90 and ex<=102 then d9=18 elseif ex>70 then d9=14 else d9=18 endif endif elseif xc[1]=3 then If ex=57 or ex=89 then d9=18 elseIf ex>57 then d9=14 Else d9=18 endif elseif xc[1]=17 then If ex>53 then d9=32 elseif ex>17 Then d9=18 Else d9=8 endif endif ex=ex-d9 elseIf lk="down" Then'------------------------------down If xc[1]=18 then If ex>=54 then d9=32 elseif ex>=18 Then d9=18 Else d9=8 endif elseif xc[1]>=4 and xc[1]<=16 then If xc[2]<3 then d9=8 else If ex>=72 and ex<=84 then d9=18 elseif ex>=58 then d9=14 else d9=18 endif endif elseif xc[1]=1 then If ex>=55 then d9=32 elseIf ex>=19 then d9=18 elseIf ex>=3 then d9=8 Else d9=2 endif elseif xc[1]=3 then If ex=71 then d9=18 elseIf ex>=57 then d9=14 Else d9=18 endif elseif xc[1]=2 then If ex>=56 then d9=32 elseIf ex>=20 then d9=18 Else d9=8 endif elseIf xc[1]=17 then If ex>=53 then d9=32 elseif ex>=17 Then d9=18 Else d9=8 endif endif ex=ex+d9 endif If ex<1 Then ex=1 ElseIf ex>118 then ex=118 EndIf xc=ldtext.Split (pzm[ex] c8) lx=(xc[1]-9)*38 ly=(7-xc[2])*28 zz=-ldmath.Sin (xc[1]*10)*30 LD3DView.TranslateGeometry (view3D ssh lx ly zz) ldcall.Function4 ("drawatm" ex 600 50 150) cl=ldtext.Split (ell[ex] c8) GraphicsWindow.Title=ex+": "+cl[2] GraphicsWindow.BrushColor="teal GraphicsWindow.FillRectangle (710 550 480 330) GraphicsWindow.BrushColor= "white GraphicsWindow.FontSize=20 GraphicsWindow.FontItalic ="true GraphicsWindow.FontBold="false GraphicsWindow.FontName="Segoe UI GraphicsWindow.DrawBoundText (800 660 400 "· "+cl[4]+nln+"· "+mty[ex]+nln+"· el.config: "+esh[ex]) GraphicsWindow.FontBold="true GraphicsWindow.FontItalic="false GraphicsWindow.FontSize=30 GraphicsWindow.DrawText (800 600 "[ "+cl[1]+" ] "+cl[2]) GraphicsWindow.FontSize=19 GraphicsWindow.FontBold="false GraphicsWindow.DrawBoundText (720 595 75 "<"+ex+nl+(wat[ex]-ex)) Else GraphicsWindow.BrushColor="teal GraphicsWindow.FillRectangle (710 550 480 330) GraphicsWindow.BrushColor= "white ldcall.Function4 ("drawatm" 0 600 50 150) endif EndSub Sub shlc occ=ldtext.Split (cm2[args[1]] ":") If occ[2]=0 then df=1 Else df=2 endif For ft= 1 to df oc=chrs[occ[ft]] ox=ldShapes.GetLeft (oc[1])/f4 oy=ldShapes.Gettop (oc[1])/f4 ttx=(ox+xd/2+xss)+":"+(10-oy)+":0: For t=2 to Array.GetItemCount(oc) ox=ldShapes.GetLeft (oc[t-1])/f4 oy=ldShapes.Gettop (oc[t-1])/f4 nx=ldShapes.GetLeft (oc[t])/f4 ny=ldShapes.Gettop (oc[t])/f4 ttx=ttx+(xd/2+nx+xss)+":"+(10-ny)+":0: endfor tb[ce][kk]= LD3DView.AddTube (view3D ttx 2 15 fcl "D") kk=kk+1 endfor endsub Sub shuc ik=args[1] xss=0 If ik=11 Then 'K ff=2 pt=0 pt[1]=9 pt[2]=11 ElseIf ik=24 then 'Y ff=2 pt=0 pt[1]=24 pt[2]=26 ElseIf ik=23 then 'X ff=2 pt=0 pt[1]=23 pt[2]=27 xss=5 Else pt=0 pt[1]=ik ff=1 If ik=13 Then 'M xss=5 ElseIf ik=1 then 'A xss=6 endif endif For fi=1 To ff oc=chrs[cmt[pt[fi]]] ox=ldShapes.GetLeft (oc[1])/f4 oy=ldShapes.Gettop (oc[1])/f4 ttx=(ox+xd/2)+":"+(10-oy)+":0: For t=2 to Array.GetItemCount(oc) pp=(t-1) ox=ldShapes.GetLeft (oc[pp])/f4 oy=ldShapes.Gettop (oc[pp])/f4 pp=t nx=ldShapes.GetLeft (oc[pp])/f4 ny=ldShapes.Gettop (oc[pp])/f4 ttx=ttx+(xd/2+nx)+":"+(10-ny)+":0: endfor tb[ce][kk]=LD3DView.AddTube (view3D ttx 2 15 fcl "D") kk=kk+1 endfor EndSub Sub mww lky=GraphicsWindow.LastKey If lky="Space" then If mov Then yp=yp+ LDEvents.LastMouseWheelDelta/20 else ya=ya+ LDEvents.LastMouseWheelDelta GraphicsWindow.Title ="Y:"+ya endif elseIf lky="LeftCtrl" then If mov then xp=xp+ LDEvents.LastMouseWheelDelta/20 else r35=r35+ LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title ="Zm:"+r35 endif elseif lky="D1" then LD3DView.AutoControl ("true" "true", -1 .25) Else aa=aa+ LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title ="a:"+aa endif px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndSub End>RTV174.sb< Start>RTV756.sb< GraphicsWindow.BackgroundColor ="#000088 GraphicsWindow.BrushColor = LDColours.HSLtoRGB (60 .8 .4) 'GraphicsWindow.FillEllipse (300 300 150 150) GraphicsWindow.Width =700 GraphicsWindow.Height =700 GraphicsWindow.Left =10 GraphicsWindow.Top =10 aa=ldtext.Split("13 35 37" " ") GraphicsWindow.Title="Saturn drawing... wait please 'GraphicsWindow.MouseMove =mdd 'GraphicsWindow.MouseDown =mdd dd="1=287;2=368;3=285;4=368;5=284;6=367;7=283;8=367;9=282;10=366;11=281;12=366;13=281;14=365;15=280;16=364;17=279;18=364;19=278;20=364;21=278;22=363;23=278;24=362;25=277;26=361;27=275;28=361;29=273;30=360;31=272;32=360;33=272;34=359;35=271;36=358;37=270;38=358;39=269;40=357;41=267;42=356;43=267;44=355;45=266;46=355;47=265;48=354;49=264;50=353;51=264;52=352;53=263;54=352;55=262;56=351;57=262;58=350;59=262;60=349;61=262;62=349;63=262;64=348;65=261;66=347;67=261;68=346;69=261;70=344;71=261;72=343;73=260;74=342;75=260;76=341;77=260;78=340;79=260;80=339;81=260;82=337;83=260;84=336;85=260;86=335;87=260;88=334;89=260;90=333;91=260;92=331;93=260;94=329;95=260;96=328;97=260;98=327;99=261;100=327;101=262;102=327;103=263;104=327;105=264;106=327;107=265;108=327;109=267;110=325;111=268;112=324;113=269;114=324;115=269;116=323;117=270;118=323;119=272;120=323;121=272;122=322;123=273;124=322;125=275;126=321;127=275;128=320;129=276;130=320;131=278;132=320;133=279;134=318;135=280;136=318;137=281;138=318;139=283;140=318;141=284;142=317;143=285;144=317;145=287;146=316;147=288;148=316;149=291;150=316;151=292;152=316;153=293;154=316;155=294;156=316;157=295;158=316;159=296;160=316;161=298;162=316;163=299;164=316;165=300;166=316;167=301;168=316;169=302;170=316;171=303;172=316;173=304;174=316;175=305;176=316;177=306;178=316;179=307;180=316;181=308;182=316;183=309;184=316;185=310;186=316;187=311;188=316;189=310;190=316;191=309;192=317;193=308;194=319;195=307;196=319;197=305;198=320;199=305;200=321;201=304;202=321;203=302;204=322;205=302;206=323;207=301;208=324;209=300;210=324;211=298;212=325;213=297;214=325;215=295;216=327;217=295;218=328;219=294;220=328;221=291;222=329;223=291;224=330;225=290;226=330;227=289;228=332;229=288;230=332;231=287;232=333;233=287;234=334;235=286;236=335;237=286;238=336;239=286;240=337;241=286;242=338;243=286;244=339;245=286;246=340;247=285;248=341;249=285;250=342;251=284;252=345;253=283;254=345;255=283;256=346;257=282;258=346;259=282;260=345;261=282;262=345;263=282;264=343;265=282;266=342;267=282;268=341;269=282;270=340;271=282;272=338;273=282;274=337;275=282;276=336;277=282;278=335;279=282;280=334;281=282;282=332;283=282;284=331;285=282;286=330;287=282;288=329;289=282;290=328;291=282;292=327;293=283;294=327;295=285;296=327;297=286;298=327;299=287;300=325;301=288;302=324;303=289;304=324;305=290;306=323;307=292;308=323;309=293;310=323;311=295;312=323;313=296;314=322;315=297;316=321;317=298;318=321;319=299;320=321;321=300;322=321;323=302;324=321;325=304;326=320;327=304;328=319;329=305;330=319;331=306;332=319;333=307;334=319;335=308;336=319;337=309;338=319;339=310;340=319;341=311;342=319;343=314;344=318;345=315;346=317;347=317;348=317;349=318;350=317;351=319;352=317;353=320;354=317;355=321;356=317;357=322;358=317;359=323;360=317;361=324;362=316;363=325;364=316;365=324;366=314;367=323;368=314;369=323;370=313;371=322;372=313;373=321;374=313;375=320;376=312;377=319;378=312;379=318;380=312;381=317;382=312;383=316;384=312;385=315;386=312;387=313;388=312;389=312;390=312;391=311;392=312;393=309;394=312;395=308;396=312;397=307;398=311;399=306;400=311;401=305;402=311;403=304;404=311;405=303;406=311;407=303;408=310;409=301;410=310;411=300;412=310;413=299;414=310;415=298;416=310;417=297;418=310;419=295;420=310;421=294;422=310;423=293;424=310;425=291;426=310;427=290;428=310;429=289;430=310;431=288;432=310;433=287;434=310;435=285;436=310;437=284;438=310;439=281;440=310;441=280;442=310;443=280;444=311;445=279;446=311;447=278;448=313;449=277;450=314;451=276;452=314;453=274;454=315;455=272;456=315;457=271;458=315;459=268;460=317;461=267;462=317;463=267;464=317;465=267;466=318;467=265;468=318;469=264;470=318;471=263;472=319;473=262;474=320;475=262;476=321;477=261;478=321;479=261;480=322;481=261;482=323;483=260;484=325;485=260;486=327;487=260;488=328;489=260;490=330;491=260;492=331;493=260;494=332;495=260;496=333;497=260;498=334;499=260;500=335;501=260;502=337;503=260;504=338;505=260;506=339;507=260;508=340;509=260;510=341;511=260;512=342;513=261;514=342;515=261;516=344;517=262;518=344;519=262;520=345;521=264;522=346;523=265;524=346;525=266;526=346;527=267;528=347;529=268;530=347;531=268;532=348;533=269;534=348;535=270;536=349;537=271;538=349;539=271;540=350;541=272;542=350;543=274;544=351;545=274;546=352;547=274;548=351;549=274;550=349;551=274;552=348;553=274;554=346;555=274;556=345;557=274;558=344;559=274;560=343;561=274;562=342;563=274;564=340;565=274;566=337;567=274;568=335;569=275;570=335;571=277;572=333;573=277;574=332;575=279;576=331;577=279;578=330;579=280;580=330;581=280;582=329;583=281;584=327;585=282;586=327;587=283;588=325;589=284;590=325;591=284;592=323;593=286;594=322;595=287;596=322;597=287;598=321;599=287;600=322;601=287;602=323;603=286;604=324;605=286;606=325;607=285;608=325;609=284;610=326;611=283;612=327;613=283;614=329;615=283;616=330;617=280;618=332;619=279;620=332;621=279;622=333;623=277;624=335;625=276;626=336;627=276;628=337;629=275;630=338;631=275;632=339;633=275;634=340;635=275;636=341;637=275;638=342;639=275;640=341;641=276;642=340;643=277;644=339;645=281;646=335;647=282;648=333;649=285;650=332;651=287;652=328;653=288;654=327;655=292;656=324;657=293;658=324;659=295;660=322;661=296;662=320;663=297;664=320;665=297;666=320;667=298;668=319;669=299;670=319;671=300;672=318;673=300;674=317;675=301;676=317;677=302;678=316;679=303;680=316;681=303;682=317;683=302;684=318;685=302;686=319;687=301;688=319;689=300;690=320;691=300;692=321;693=298;694=323;695=297;696=324;697=296;698=324;699=295;700=324;701=295;702=325;703=293;704=327;705=292;706=328;707=292;708=330;709=292;710=331;711=291;712=332;713=290;714=333;715=290;716=334;717=290;718=335;719=289;720=336;721=289;722=338;723=289;724=340;725=289;726=341;727=289;728=343;729=289;730=344;731=289;732=347;733=289;734=348;735=289;736=349;737=289;738=350;739=289;740=352;741=289;742=353;743=289;744=354;745=289;746=355;747=287;748=357;749=286;750=358;751=286;752=360;753=286;754=361;755=286;756=362;757=286;758=363;759=284;760=364;761=284;762=365;763=283;764=366;765=282;766=367;767=281;768=367;769=280;770=367;771=279;772=367;773=278;774=367;775=277;776=366;777=276;778=366;779=275;780=366;781=275;782=365;783=274;784=364;785=273;786=363;787=272;788=362;789=271;790=362;791=271;792=361;793=270;794=360;795=269;796=360;797=269;798=359;799=269;800=358;801=268;802=357;803=268;804=355;805=267;806=354;807=267;808=353;809=267;810=351;811=266;812=350;813=265;814=348;815=264;816=347;817=263;818=346;819=262;820=345;821=260;822=344;823=260;824=343;825=260;826=342;827=261;828=342;829=262;830=342;831=262;832=343;833=263;834=343;835=264;836=344;837=265;838=344;839=265;840=345;841=266;842=346;843=266;844=347;845=268;846=348;847=268;848=349;849=270;850=349;851=271;852=349;853=272;854=349;855=273;856=350;857=274;858=350;859=275;860=351;861=275;862=352;863=276;864=353;865=276;866=354;867=276;868=354;869=277;870=354;871=278;872=355;873=277;874=354;875=276;876=353;877=275;878=353;879=275;880=352;881=275;882=351;883=274;884=351;885=274;886=350;887=274;888=349;889=274;890=347;891=271;892=346;893=271;894=345;895=271;896=344;897=271;898=343;899=271;900=342;901=270;902=342;903=270;904=341;905=270;906=340;907=270;908=339;909=270;910=338;911=270;912=336;913=270;914=335;915=270;916=334;917=270;918=333;919=270;920=332;921=270;922=330;923=270;924=329;925=270;926=328;927=270;928=327;929=270;930=326;931=270;932=323;933=270;934=321;935=270;936=320;937=270;938=319;939=270;940=318;941=271;942=317;943=272;944=316;945=272;946=315;947=273;948=315;949=274;950=314;951=275;952=313;953=278;954=312;955=279;956=312;957=280;958=312;959=281;960=310;961=282;962=310;963=283;964=309;965=284;966=309;967=285;968=309;969=286;970=309;971=287;972=309;973=288;974=309;975=289;976=309;977=291;978=309;979=292;980=309;981=293;982=309;983=294;984=309;985=295;986=309;987=297;988=309;989=298;990=309;991=299;992=309;993=301;994=309;995=302;996=309;997=304;998=309;999=305;1000=309;1001=307;1002=309;1003=309;1004=309;1005=310;1006=309;1007=311;1008=309;1009=313;1010=309;1011=314;1012=309;1013=315;1014=309;1015=316;1016=309;1017=317;1018=309;1019=318;1020=309;1021=320;1022=309;1023=321;1024=309;1025=323;1026=309;1027=324;1028=309;1029=325;1030=309;1031=326;1032=309;1033=325;1034=309;1035=324;1036=309;1037=322;1038=309;1039=320;1040=309;1041=319;1042=309;1043=318;1044=309;1045=317;1046=309;1047=316;1048=309;1049=316;1050=308;1051=315;1052=308;1053=313;1054=307;1055=313;1056=306;1057=312;1058=306;1059=311;1060=306;1061=309;1062=306;1063=307;1064=305;1065=306;1066=305;1067=305;1068=305;1069=305;1070=305;1071=304;1072=305;1073=303;1074=305;1075=301;1076=305;1077=300;1078=305;1079=297;1080=305;1081=295;1082=305;1083=294;1084=305;1085=293;1086=305;1087=292;1088=305;1089=291;1090=305;1091=290;1092=305;1093=289;1094=305;1095=288;1096=305;1097=287;1098=305;1099=285;1100=305;1101=284;1102=305;1103=283;1104=305;1105=282;1106=305;1107=281;1108=305;1109=280;1110=305;1111=278;1112=305;1113=277;1114=305;1115=276;1116=305;1117=275;1118=305;1119=274;1120=305;1121=272;1122=305;1123=271;1124=305;1125=270;1126=305;1127=269;1128=305;1129=268;1130=305;1131=266;1132=306;1133=265;1134=307;1135=265;1136=308;1137=263;1138=310;1139=262;1140=310;1141=262;1142=311;1143=261;1144=312;1145=261;1146=313;1147=260;1148=315;1149=259;1150=316;1151=259;1152=317;1153=259;1154=318;1155=259;1156=319;1157=258;1158=319;1159=258;1160=320;1161=258;1162=321;1163=257;1164=322;1165=257;1166=323;1167=257;1168=324;1169=257;1170=325;1171=257;1172=328;1173=257;1174=329;1175=257;1176=331;1177=257;1178=332;1179=257;1180=333;1181=257;1182=334;1183=257;1184=335;1185=257;1186=337;1187=257;1188=338;1189=257;1190=339;1191=257;1192=340;1193=258;1194=342;1195=259;1196=343;1197=261;1198=344;1199=261;1200=345;1201=263;1202=345;1203=263;1204=346;1205=264;1206=347;1207=265;1208=348;1209=265;1210=349;1211=266;1212=351;1213=266;1214=352;1215=267;1216=352;1217=268;1218=354;1219=268;1220=355;1221=269;1222=355;1223=269;1224=356;1225=269;1226=357;1227=270;1228=357;1229=270;1230=358;1231=271;1232=358;1233=271;1234=359;1235=272;1236=360;1237=272;1238=361;1239=273;1240=361;1241=274;1242=361;1243=274;1244=362;1245=275;1246=363;1247=276;1248=365;1249=277;1250=366;1251=277;1252=367;1253=277;1254=368;1255=277;1256=369;1257=277;1258=371;1259=277;1260=372;1261=278;1262=372;1263=310;1264=302;1265=311;1266=302;1267=312;1268=302;1269=313;1270=302;1271=313;1272=302;1273=314;1274=302;1275=315;1276=302;1277=316;1278=302;1279=318;1280=302;1281=319;1282=302;1283=320;1284=302;1285=321;1286=302;1287=322;1288=302;1289=323;1290=302;1291=326;1292=302;1293=327;1294=302;1295=329;1296=302;1297=330;1298=302;1299=331;1300=302;1301=332;1302=302;1303=333;1304=303;1305=333;1306=304;1307=333;1308=305;1309=334;1310=305;1311=335;1312=305;1313=336;1314=305;1315=337;1316=306;1317=338;1318=306;1319=339;1320=306;1321=340;1322=306;1323=341;1324=306;1325=342;1326=307;1327=343;1328=307;1329=344;1330=307;1331=345;1332=307;1333=344;1334=307;1335=343;1336=307;1337=342;1338=307;1339=341;1340=307;1341=340;1342=307;1343=339;1344=307;1345=338;1346=307;1347=337;1348=307;1349=335;1350=307;1351=334;1352=307;1353=334;1354=308;1355=332;1356=308;1357=330;1358=308;1359=329;1360=308;1361=327;1362=309;1363=326;1364=310;1365=326;1366=311;1367=325;1368=311;1369=324;1370=311;1371=323;1372=312;1373=323;1374=313;1375=322;1376=313;1377=319;1378=313;1379=318;1380=314;1381=317;1382=315;1383=316;1384=315;1385=315;1386=315;1387=313;1388=317;1389=311;1390=318;1391=310;1392=318;1393=308;1394=319;1395=307;1396=320;1397=306;1398=321;1399=305;1400=321;1401=304;1402=323;1403=302;1404=324;1405=301;1406=325;1407=300;1408=325;1409=298;1410=326;1411=296;1412=328;1413=293;1414=331;1415=292;1416=332;1417=290;1418=333;1419=289;1420=335;1421=286;1422=337;1423=282;1424=340;1425=279;1426=341;1427=277;1428=345;1429=276;1430=346;1431=272;1432=349;1433=270;1434=350;1435=270;1436=351;1437=269;1438=352;1439=268;1440=353;1441=268;1442=355;1443=268;1444=356;1445=268;1446=357;1447=268;1448=358;1449=268;1450=359;1451=269;1452=361;1453=270;1454=361;1455=271;1456=362;1457=272;1458=362;1459=273;1460=364;1461=274;1462=365;1463=274;1464=366;1465=275;1466=367;1467=275;1468=366;1469=276;1470=365;1471=276;1472=364;1473=276;1474=364;1475=277;1476=362;1477=277;1478=361;1479=277;1480=359;1481=277;1482=357;1483=279;1484=355;1485=279;1486=354;1487=280;1488=352;1489=281;1490=352;1491=281;1492=351;1493=284;1494=348;1495=284;1496=347;1497=285;1498=346;1499=285;1500=345;1501=285;1502=344;1503=286;1504=344;1505=286;1506=343;1507=288;1508=341;1509=289;1510=340;1511=289;1512=339;1513=290;1514=338;1515=291;1516=337;1517=292;1518=336;1519=293;1520=335;1521=293;1522=333;1523=295;1524=331;1525=296;1526=330;1527=297;1528=329;1529=300;1530=327;1531=300;1532=326;1533=301;1534=326;1535=302;1536=325;1537=303;1538=324;1539=303;1540=323;1541=305;1542=323;1543=307;1544=321;1545=309;1546=319;1547=310;1548=319;1549=311;1550=318;1551=312;1552=318;1553=313;1554=316;1555=311;1556=316;1557=310;1558=316;1559=309;1560=316;1561=308;1562=316;1563=306;1564=316;1565=305;1566=316;1567=304;1568=316;1569=303;1570=316;1571=302;1572=316;1573=301;1574=317;1575=299;1576=317;1577=298;1578=319;1579=297;1580=320;1581=296;1582=322;1583=295;1584=322;1585=294;1586=323;1587=293;1588=323;1589=292;1590=324;1591=291;1592=326;1593=290;1594=326;1595=289;1596=327;1597=288;1598=328;1599=287;1600=328;1601=287;1602=329;1603=287;1604=330;1605=286;1606=331;1607=286;1608=333;1609=286;1610=334;1611=284;1612=335;1613=284;1614=336;1615=284;1616=337;1617=284;1618=338;1619=282;1620=340;1621=282;1622=342;1623=282;1624=343;1625=282;1626=344;1627=282;1628=342;1629=282;1630=341;1631=282;1632=340;1633=282;1634=338;1635=282;1636=336;1637=282;1638=335;1639=282;1640=334;1641=282;1642=333;1643=282;1644=332;1645=282;1646=330;1647=283;1648=329;1649=283;1650=327;1651=284;1652=327;1653=285;1654=325;1655=285;1656=324;1657=286;1658=323;1659=287;1660=322;1661=287;1662=321;1663=289;1664=318;1665=290;1666=317;1667=290;1668=316;1669=292;1670=315;1671=293;1672=314;1673=294;1674=312;1675=294;1676=312;1677=294;1678=311;1679=295;1680=311;1681=295;1682=312;1683=294;1684=315;1685=294;1686=316;1687=292;1688=317;1689=291;1690=318;1691=290;1692=320;1693=289;1694=321;1695=288;1696=322;1697=287;1698=323;1699=287;1700=324;1701=285;1702=327;1703=284;1704=327;1705=283;1706=328;1707=283;1708=329;1709=283;1710=330;1711=282;1712=330;1713=281;1714=333;1715=279;1716=333;1717=279;1718=334;1719=279;1720=335;1721=278;1722=336;1723=277;1724=337;1725=276;1726=338;1727=276;1728=339;1729=276;1730=340;1731=275;1732=342;1733=274;1734=344;1735=273;1736=344;1737=273;1738=346;1739=273;1740=347;1741=273;1742=348;1743=273;1744=349;1745=273;1746=350;1747=273;1748=352;1749=273;1750=353;1751=273;1752=354;1753=273;1754=356;1755=273;1756=357;1757=273;1758=358;1759=273;1760=360;1761=273;1762=362;1763=273;1764=363;1765=273;1766=365;1767=273;1768=366; LDGraphicsWindow.PauseUpdates () For x=1 To 60 Step 2 if Array.ContainsValue(aa x) Then GraphicsWindow.BrushColor =LDColours.HSLtoRGB (60 .7 .3) else GraphicsWindow.BrushColor = LDColours.HSLtoRGB (60+x/4 .8 .4-x/300) endif rr=150-x*2 GraphicsWindow.FillEllipse (300+x 300+x/5 rr*1.15 rr) EndFor GraphicsWindow.PenColor ="darkblue GraphicsWindow.PenWidth =3 For f=0 To 20 Step 2 GraphicsWindow.drawEllipse (308-f 300-f 150+f*2 150+f*2) EndFor GraphicsWindow.PenColor ="#aa000088 GraphicsWindow.PenWidth =5 For f=0 To 40 Step 5 GraphicsWindow.drawEllipse (338-f 250-f 250+f*2 250+f*2) EndFor GraphicsWindow.PenWidth =3 For f=0 To 40 Step 2 GraphicsWindow.PenColor =LDColours.HSLtoRGB (60 .7 (40-f)/90+math.Abs(LDMath.Sin (f*30)/2)) GraphicsWindow.drawEllipse (270-f 300-f 220+f*2 150+f*2) EndFor GraphicsWindow.brushColor ="#04000088 For r=1 to Array.GetItemCount (dd) Step 2 GraphicsWindow.FillEllipse (dd[r]-15 dd[r+1]-15 30 30) endfor LDGraphicsWindow.ResumeUpdates () GraphicsWindow.Title="Saturn i=1 Sub mdd If Mouse.IsLeftButtonDown Then tt[i]= GraphicsWindow.MouseX tt[i+1]= GraphicsWindow.MouseY i=i+2 GraphicsWindow.FillEllipse (GraphicsWindow.MouseX-15 GraphicsWindow.MouseY-15 30 30) ElseIf Mouse.IsRightButtonDown then TextWindow.Write (tt) EndIf EndSub End>RTV756.sb< Start>RTV979.sb< ' Pictogram - Elevater ' Copyright © 2019 Nonki Takahashi. The MIT License. ' Last update 2019-12-14 SB_Workaround() Init() ' initialize shapes Shapes_Init_Box() ' add shapes scale = 1 name = "Box" Group_Add() ' initialize shapes Shapes_Init_Man() ' add shapes name = "Man 1" Group_Add() i = nGroup grp = group[i] x = grp["x"] - 74 y = grp["y"] Group_Move() name = "Man 2" Group_Add() name = "Man 3" Group_Add() i = nGroup grp = group[i] x = grp["x"] + 74 y = grp["y"] Group_Move() ' initialize shapes Shapes_Init_Arrow() ' add shapes name = "Up" Group_Add() name = "Down" Group_Add() i = nGroup grp = group[i] x = grp["x"] - 156 y = grp["y"] + 10 Group_Move() angle = 180 Group_Rotate() Sub Init GraphicsWindow.Title = "Elevator" gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY, origin of shape array ' param shape[] - shape array ' param scale - to resize ' 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["height"] = shHeight grp["cx"] = shWidth / 2 grp["cy"] = shHeight / 2 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 sbd And (shp["func"] = "line") Then shp["wx"] = x shp["wy"] = y ElseIf 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 Group_Move ' Group | move a group ' param group[i] - group To move ' param x, y - position To move ' return group[i] - updated group 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] If sbd And (shp["func"] = "line") Then _x = shp["wx"] _y = shp["wy"] ElseIf silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], grp["x"] + _x * s, grp["y"] + _y * s) EndFor group[i] = grp j = Stack.PopValue("local") EndSub Sub Group_Rotate ' Group | rotate a group ' param group[i] - group to move ' param cx, cy - rotation center (if given) ' param angle - to 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"] = 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 alpha = shp["angle"] + grp["angle"] If sbd And (shp["func"] = "line") And (alpha <> 0) Then x1 = shp["x1"] y1 = shp["y1"] x2 = shp["x2"] y2 = shp["y2"] pw = shp["pw"] SB_LineWorkaround() shp["wx"] = x shp["wy"] = y ElseIf silverlight And Text.IsSubText("tri|line", shp["func"]) Then _alpha = Math.GetRadians(alpha) SB_RotateWorkAround() shp["wx"] = x shp["wy"] = y EndIf 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 (0<=a<360) 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 And y = 0 Then a = 0 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf ' at this point -90<=a<=90 If x < 0 Then a = a + 180 ElseIf x >= 0 And y < 0 Then a = a + 360 EndIf ' at this point 0<=a<360 EndSub Sub SB_LineWorkaround ' Small Basic | line rotate workaround for SBD ' param x, y - coordinate of the position of the line ' param x1, y1 - coordinate of the first point ' param x2, y2 - coordinate of the second point ' param pw - pen width ' param alpha - to rotate [degree] ' return x, y - workaround value for the coordinate Stack.PushValue("local", x) Stack.PushValue("local", y) x = x1 - x2 y = y1 - y2 Math_CartesianToPolar() y = Stack.PopValue("local") x = Stack.PopValue("local") _a = Math.GetRadians(a) _alpha = Math.GetRadians(a - alpha) Δx = pw / 4 * (Math.Sin(_alpha) - Math.Sin(_a)) Δy = pw / 4 * (Math.Cos(_alpha) - Math.Cos(_a)) x = x - Δx y = y - Δy EndSub Sub SB_RotateWorkaround ' Small Basic | rotate workaround for Silverlight ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shape[i]["func"] = "tri" Then x1 = -Math.Floor(shape[i]["x3"] / 2) y1 = -Math.Floor(shape[i]["y3"] / 2) ElseIf shape[i]["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shape[i]["x1"] - shape[i]["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shape[i]["y1"] - shape[i]["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 / SBD ' return silverlight - "True" if in remote ' return sbd - "True" if Small Basic Desktop color = GraphicsWindow.GetPixel(0, 0) sbd = "False" If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" _gw = GraphicsWindow.Width _gh = GraphicsWindow.Height If (_gw = 624) And (_gh = 441) Then sbd = "True" EndIf 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_DumpArray order = "1=func;2=x;3=y;4=width;5=height;6=x1;7=y1;8=x2;9=y2;" order = order + "10=x3;11=y3;12=txt;13=fn;14=fs;15=fb;16=fi;" order = order + "17=angle;18=pw;19=pc;20=bc;" nOrder = Array.GetItemCount(order) WQ = Text.GetCharacter(34) LF = Text.GetCharacter(10) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Consolas" GraphicsWindow.FontSize = 14 tbox = Controls.AddMultiLineTextBox(gw / 2, 10) Controls.SetSize(tbox, gw / 2 - 10, gh - 20) buf = " shX = " + shX + " ' x offset" + LF buf = buf + " shY = " + shY + " ' y offset" + LF buf = buf + " shape = " + WQ + WQ + LF For i = 1 To Array.GetItemCount(shape) buf = buf + " shape[" + i + "] = " + WQ shp = shape[i] For j = 1 To nOrder If shp[order[j]] <> "" Then buf = buf + order[j] + "=" + shp[order[j]] + ";" EndIf EndFor buf = buf + WQ + LF EndFor Controls.SetTextBoxText(tbox, buf) Shapes.SetOpacity(tbox, 50) EndSub Sub Shapes_Init_Arrow ' Shapes | initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 296.28 ' x offset shY = 43.52 ' y offset shape = "" shape[1] = "func=rect;x=66.22;y=21.48;width=30;height=150;pw=0;bc=Black;" shape[2] = "func=rect;x=44.36;y=0.00;width=21.21;height=95.45;angle=45;pw=0;bc=Black;" shape[3] = "func=rect;x=96.86;y=0.00;width=21.21;height=95.45;angle=-45;pw=0;bc=Black;" shape[4] = "func=tri;x=0.00;y=70.87;x1=21.21;y1=0;x2=0;y2=21.21;x3=42.42;y3=21.21;angle=-45;pw=0;bc=Black;" shape[5] = "func=tri;x=120.00;y=70.87;x1=21.21;y1=0;x2=0;y2=21.21;x3=42.42;y3=21.21;angle=45;pw=0;bc=Black;" EndSub Sub Shapes_Init_Box ' Shapes | initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 150 ' x offset shY = 232 ' y offset shape = "" shape[1] = "func=rect;x=0;y=0;width=300;height=300;pw=30;pc=Black;bc=Transparent;" EndSub Sub Shapes_Init_Man ' Shapes | initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 267 ' x offset shY = 305 ' y offset shape = "" shape[1] = "func=ell;x=19.8;y=0;width=26.4;height=26.4;pw=0;bc=Black;" shape[2] = "func=ell;x=0;y=34.32;width=39.6;height=39.6;pw=0;bc=Black;" shape[3] = "func=ell;x=26.4;y=34.32;width=39.6;height=39.6;pw=0;bc=Black;" shape[4] = "func=rect;x=19.8;y=34.32;width=26.4;height=39.6;pw=0;bc=Black;" shape[5] = "func=tri;x=0;y=54.12;x1=3.66;y1=0;x2=0;y2=52.8;x3=7.33;y3=52.8;angle=180;pw=0;bc=Black;" shape[6] = "func=tri;x=58.66;y=54.12;x1=3.66;y1=0;x2=0;y2=52.8;x3=7.33;y3=52.8;angle=180;pw=0;bc=Black;" shape[7] = "func=rect;x=3.66;y=54.12;width=58.66;height=52.8;pw=0;bc=Black;" shape[8] = "func=rect;x=11.88;y=106.92;width=11.88;height=78.08;pw=0;bc=Black;" shape[9] = "func=tri;x=17.82;y=106.92;x1=5.94;y1=0;x2=0;y2=78.08;x3=11.88;y3=78.08;angle=180;pw=0;bc=Black;" shape[10] = "func=rect;x=42.24;y=106.92;width=11.88;height=78.08;pw=0;bc=Black;" shape[11] = "func=tri;x=36.3;y=106.92;x1=5.94;y1=0;x2=0;y2=78.08;x3=11.88;y3=78.08;angle=180;pw=0;bc=Black;" EndSub End>RTV979.sb< Start>RTW654.sb< 'Follow the Mouse - October Graphics Challenge - codingcat aka Matthew L. Parets Turtle.Speed = 10 Timer.Tick = drawTurtle Timer.Interval = 50 sub drawTurtle GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.MoveTo(GraphicsWindow.MouseX,GraphicsWindow.MouseY) EndSub End>RTW654.sb< Start>RTW739.sb< gh = 400 gw = 400 GraphicsWindow.Height=gh GraphicsWindow.Width = gw GraphicsWindow.CanResize = "False" init() ' initialize the saving variables()' final variables that create the graphics window and all that. GraphicsWindow.KeyDown = move ' key events that tell the player to move. GraphicsWindow.KeyUp = stop ' nothing there 'if you want the player to stop when you let go of the key, go to this method and remove the ' on pressed="False" framestart = Clock.ElapsedMilliseconds ' getsthe time For i = 0 to 13 Step 1 'sets the level you are not on at false, refers to the enemy spawn levelat[i] = "False" endfor smartenemyexists="False" ' refers to the smart enemy, not yet created in this program yet numEnemy=1 createenemy()'initial enemy '========GAME LOOP=========== While 1=1 ProcessKey() 'processes the key at the current frame moveenemy() 'moves enemy If(smartenemyexists) Then ' if we are starting to cook smartenenemies, then it will start to run the appropriate subroutine movesmartenemy() ' nothing there, enemy will follow player around to prevent player from hiding in corners checkcollisionofplayersmartenemy() EndIf setlevel()'sets the level and updates it checkcollisionofplayer() ' healthloss and collision addscore() ' adds score updatehighscore() ' updates the highscore if score goes over it adjusthealth() ' event to change number of health enemyspawn() ' depending on level put an enemy, can be changed framedelay()'frame delay endwhile Sub init path = Program.Directory + "/Collision Game/" name = "High Score" ext = ".txt" ' The following line could be harmful and has been automatically commented. ' filesave = File.ReadContents(path+name+ext) ' reads the last thing in there, your highest score highscoredisplay =Shapes.AddText("High Score: " +filesave[1]) Shapes.Move(highscoredisplay, 0,50) endsub Sub variables frames = 60 frameLength = 1000/frames ' really smooth 0.016 millisecond frame. 1 frame every 0.016 millisecond. '============================== player = Shapes.AddRectangle(20, 20) playerx = Math.GetRandomNumber(gh) playery = Math.GetRandomNumber(gh) Shapes.Move(player, playerx, playery) '============================== health = 100 GraphicsWindow.BrushColor= "Green" healthdisplay = Shapes.AddText(health) Shapes.Move(healthdisplay, 0, 30) '============================== level = 1 leveldisplay = Shapes.AddText("Level" + level) Shapes.Move(leveldisplay, 350,0) '============================== GraphicsWindow.BrushColor= "BLue" scoredisplay = Shapes.AddText(score) Shapes.Move(scoredisplay, 0, 0) endsub Sub createenemy GraphicsWindow.BrushColor="Red" vel = 1 'each enemy has its own id. touchingtr[numEnemy]="False" touchingtl[numEnemy] = "False" touchingbl[numEnemy] = "False" touchingbr[numEnemy] = "False" enemy[numEnemy] = Shapes.AddRectangle(15, 15) velX[numEnemy] = vel'Math.GetRandomNumber(vel) velY[numEnemy] = 0'Math.GetRandomNumber(vel) enemyx[numEnemy] = Math.GetRandomNumber(gh-15) enemyy[numEnemy] = Math.GetRandomNumber(gh-15) endsub Sub createsmartenemy GraphicsWindow.BrushColor="Yellow" smartenemy[snumEnemy] = Shapes.AddRectangle(10, 10) smartenemyx[snumEnemy] = Math.GetRandomNumber(gh) smartenemyy[snumEnemy] = Math.GetRandomNumber(gh) touchings[snumEnemy] = "False" vels = 2 EndSub Sub ProcessKey 'process the keys once per frame If pressed = "True" Then key = GraphicsWindow.LastKey If (key = "A") then pdX = -5 pdY=0 ElseIf (key = "D") then pdX =5 pdY=0 elseif (key = "W") then pdY = -5 pdX =0 elseif(key = "S") then pdY =5 pdX =0 EndIf '===========this is the bounds check, makes sure the player doesnt leave the field. If(Shapes.GetLeft(player) <0) or (Shapes.GetLeft(player) > (gw-15)) Then If(Shapes.GetLeft(player) <0) Then playerx = 0 ElseIf(Shapes.GetLeft(player) > (gw-15)) then playerx = gw -15 EndIf Else playerx = playerx+pdX EndIf If((Shapes.Gettop(player) <0) or (Shapes.Gettop(player) > (gh-15))) Then If(Shapes.Gettop(player) <0) Then playery = 0 ElseIf(Shapes.Gettop(player) > (gh-15)) then playery = (gh-15) EndIf Else playery = playery + pdY EndIf Shapes.Move(player, playerx, playery) EndIf EndSub Sub updatehighscore If score > filesave[1] Then filesave[1] = score Shapes.SetText(highscoredisplay, "Highest score: " +score) endif endsub Sub addscore If ( health >0) Then score = score +1 Else GraphicsWindow.ShowMessage("You have lost, your score was " + score, "Game Over") savescore() Program.End() EndIf Shapes.SetText(scoredisplay, "Score: " +score) EndSub Sub adjusthealth Shapes.SetText(healthdisplay,"Health: " + health) endsub Sub setlevel If(score < 40) Then ' had issue where the level will jump once, so you will be already on level two. Goto skip endif If(Math.Remainder(score, 200) = 0) then level = level +1 EndIf skip: Shapes.SetText(leveldisplay,"Level: " +level) endsub Sub moveenemy For i = 1 To (numEnemy) step 1 ' going through all the objects ey = Shapes.GetTop(enemy[i]) ex = Shapes.GetLeft(enemy[i]) '===========simple collision================very rudamentary================ If (ex >= gw-10) Or ( ex < 0) Then velX[i] = velX[i] * -1 else velX[i] = velX[i] endif If (ey >= gh - 10) Or ( ey < 0) Then velY[i] = velY[i] * -1 Else velY[i] = velY[i] EndIf enemyx[i] = enemyx[i]+ velX[i] enemyy[i] = enemyy[i] + velY[i] Shapes.Move(enemy[i], enemyx[i], enemyy[i]) endfor endsub Sub enemyspawn If(level<9) Then If (levelat[level] ="False") Then numEnemy=numEnemy+1 createenemy() levelat[level]= "True" endif ElseIf(level>9) then if (smartenemyexists="False") then smartenemyexists="True" If (levelat[level] ="False") Then snumEnemy=snumEnemy+1 createsmartenemy() levelat[level]= "True" endif EndIf endif endsub Sub movesmartenemy For i = 1 To snumEnemy sex = Shapes.GetLeft(smartenemy[i])'SmartEnemyX sey = Shapes.Gettop(smartenemy[i]) positionx = (playerx-sex) positiony = (playery-sey) If (positionx < 0) Then velXS[i]= -vels ElseIf (positionx>0) then velXS[i] = vels Else velXS[i]=0 EndIf If (positiony < 0) Then velYS[i]= -vels ElseIf (positiony>0) then velYS[i] = vels Else velYS[i]=0 EndIf smartenemyx[i] =smartenemyx[i] + velXS[i] smartenemyy[i] =smartenemyy[i] + velYS[i] Shapes.Move(smartenemy[i], smartenemyx[i], smartenemyy[i]) endfor EndSub Sub move pressed = "True" EndSub Sub checkcollisionofplayersmartenemy For i = 1 To snumEnemy ey = Shapes.GetTop(smartenemy[i]) ex = Shapes.GetLeft(smartenemy[i]) 'checks for top left If(touchings[i]="False") Then If ((ey >= py) and (ey <= (py+20))) Then If ((ex >= px) and (ex <= (px+20)))Then numhit = numhit + 1 losshealth = "True" TextWindow.WriteLine("collision with " + i) touching[i]="True" Else EndIf Else touchings[i]="False" EndIf 'checks for top right If ((ey >= py) and (ey <= (py+20))) Then If (((ex+10) >= px) and ((ex+10) <= (px+20)))Then numhit = numhit + 1 losshealth = "True" touchings[i]="True" Else touching[i]="False" EndIf Else EndIf 'checks for bottom right If (((ey+10) >= py) and ((ey+10) <= (py+20))) Then If (((ex+10) >= px) and ((ex+10) <= (px+20)))Then numhit = numhit + 1 losshealth = "True" touchings[i]="True" Else touchings[i]="False" EndIf Else EndIf 'checks for bottom left If (((ey+10) >= py) and ((ey+10) <= (py+20))) Then If ((ex >= px) and (ex <= (px+20)))Then numhit = numhit + 1 losshealth = "True" touchings[i]="True" Else touchings[i]="False" EndIf Else EndIf If losshealth = "True" Then health = health - healthloss endif losshealth="False" endif endfor endsub '=========================================================================================== Sub checkcollisionofplayer healthloss = 2 py = Shapes.GetTop(player) px = Shapes.GetLeft(player) For i = 1 To numEnemy ey = Shapes.GetTop(enemy[i]) ex = Shapes.GetLeft(enemy[i]) 'checks for top left If ((ey >= py) and (ey <= (py+20))) Then If ((ex >= px) and (ex <= (px+20)))Then If(touchingtl[i] = "False") then health = health - healthloss touchingtl[i]="True" TextWindow.WriteLine(touchingtl[i] + ". collided with the top left. health at" + health) Goto stophurt EndIf Else touchingtl[i] = "False" EndIf Else touchingtl[i] = "False" EndIf 'checks for top right If ((ey >= py) and (ey <= (py+20))) Then If (((ex+15) >= px) and ((ex+15) <= (px+20)))Then If(touchingtr[i] = "False") then health = health - healthloss touchingtr[i]="True" TextWindow.WriteLine(touchingtr[i] + ". collided with the top right. health at" + health) Goto stophurt EndIf Else touchingtr[i] = "False" EndIf Else touchingtr[i] = "False" EndIf 'checks for bottom right If (((ey+15) >= py) and ((ey+15) <= (py+20))) Then If (((ex+15) >= px) and ((ex+15) <= (px+20)))Then If(touchingbr[i] = "False") then health = health - healthloss touchingbr[i]="True" TextWindow.WriteLine(touchingbr[i] + ". collided with the bottom right. health at" + health) Goto stophurt EndIf Else touchingbr[i] = "False" EndIf Else touchingbr[i] = "False" EndIf 'checks for bottom left If (((ey+15) >= py) and ((ey+15) <= (py+20))) Then ' if the bottom corner is within the player If ((ex >= px) and (ex <= (px+20)))Then ' if the bottom corner is withing the player If(touchingbl[i] = "False") then health = health - healthloss touchingbl[i]="True" TextWindow.WriteLine(touchingbl[i] + ". collided with the bottom left. health at" + health) Goto stophurt EndIf Else 'else if the bottom corner is not aligned touchingbl[i]= "False" EndIf else 'if the bottom corner is not even in player touchingbl[i]= "False" EndIf stophurt: endfor EndSub Sub stop 'pressed="False" 'Shapes.Move(player, playerx, playery) EndSub Sub frameDelay'codingCat is the person to thank for this. 'Precise frame timing. More exact that program.delay() because it only 'pauses for the length of time remiaining in the current frame, rather than for the 'entire time slice of the frame. Even with longer, or shorter frame processing 'times, each fram will still be exactly frameLength in duration. While Clock.ElapsedMilliseconds - framestart < frameLength ' if the time right now subtracted from the start time is les than frame length, then keep it. 'do nothing EndWhile framestart = Clock.ElapsedMilliseconds EndSub Sub savescore path = Program.Directory + "/Collision Game/" name = "High Score" ext = ".txt" If(score <= filesave[1]) Then 'if the score you got was less than your highscore, 'do not update the score, because that will become the score you got making the high score just a counter for the score you recently got. Else filesave[1] = score endif ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(path) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path+name+ext, filesave) endsub End>RTW739.sb< Start>RTW900.sb< Controls.ButtonClicked = OnButtonClicked Init() InitGrid() Main() Sub Main MainLoop = T While MainLoop = T CheckGrid() If CellChanged = T Then C = Text.ConvertToUpperCase(Text.GetSubText(Controls.GetTextBoxText(PCell[YGI][XGI]), 1, 4)) Make = F SearchCommand() If Found = T Then Found = F Controls.SetTextBoxText(Cell[YGI][XGI], PCell[YGI][XGI]) EndIf EndIf If OBC = T Then OBC = F CheckButton() EndIf EndWhile EndSub 'Main Program.End() Sub CheckGrid CellName = LDFocus.GetFocus() If CellName <> OldCell Then CheckCommand() CellChanged = T For i = 1 To GridLines For j = 1 To GridColumn If CellName = Cell[i][j] Then XGI = j YGI = i i = GridLines j = GridColumn LDFocus.SetFocus(Cell[YGI][XGI]) OldCell = Cell[YGI][XGI] EndIf EndFor EndFor Else CellChanged = F EndIf EndSub 'CheckGrid Sub CheckCommand For i = 1 To GridLines For j = 1 To GridColumn if OldCell = Cell[i][j] Then ii = i jj = j i = GridLines j = GridColumn EndIf EndFor EndFor RCell[ii][jj] = Controls.GetTextBoxText(Cell[ii][jj]) C = Text.ConvertToUpperCase(Text.GetSubText(RCell[ii][jj], 1, 4)) Make = T SearchCommand() EndSub 'CheckCommand Sub SearchCommand if Array.ContainsValue(Command, C) = T Then For k = 1 to Array.GetItemCount(Command) If C = Command[k] Then If Command[k] = "#SUM" Then If Make = T Then SumCommand() Else Found = T EndIf ElseIf Command[k] = "#ADD" Then 'AddCommand() ElseIf Command[k] = "#SUB" Then 'SubCommand() ElseIf Command[k] = "#MUL" Then 'MulCommand() ElseIf Command[k] = "#DIV" Then 'DivCommand() EndIf EndIf EndFor EndIf EndSub 'SearchCommand Sub SumCommand 'Syntax #SUM (VonZeile,VonSpalte:BisZeile,BisSpalte) ' #sum (1,1:3,1) L = Text.GetLength(RCell[ii][jj]) Index = 0 P = F Para = "" Zahl = "" For il = 6 To L Z = Text.GetSubText(RCell[ii][jj], il, 1) If Z = ")" Then Index = Index + 1 Para[Index] = Zahl Zahl = "" il = L MakeSum() ElseIf Z = "," Then Index = Index + 1 Para[Index] = Zahl Zahl = "" ElseIf Z = ":" Then Index = Index + 1 Para[Index] = Zahl Zahl = "" Elseif Z = "(" Then P = T Elseif Array.ContainsValue(Num, Z) = T Then If P = T Then Zahl = Zahl + Z EndIf EndIf EndFor EndSub 'SumCommand Sub MakeSum PCell[ii][jj] = RCell[ii][jj] If Para[1] = Para[3] Then For iP = Para[2] To Para[4] S = S + RCell[Para[1]][iP] EndFor RCell[ii][jj] = S S = "" Controls.SetTextBoxText(Cell[ii][jj], RCell[ii][jj]) Else For iP = Para[1] To Para[3] S = S + RCell[iP][Para[2]] EndFor RCell[ii][jj] = S S = "" Controls.SetTextBoxText(Cell[ii][jj], RCell[ii][jj]) EndIf EndSub 'MakeSum Sub CheckButton LBC = Controls.LastClickedButton If LBC = BT[1] Then 'New For i = 1 To GridLines For j = 1 To GridColumn Controls.SetTextBoxText(Cell[i][j], "") EndFor EndFor ElseIf LBC = BT[2] Then 'Load RCell = "" NameOfFile = LDDialogs.OpenFile("sba", RootFolder) ' The following line could be harmful and has been automatically commented. ' RCell = File.ReadContents(NameOfFile) For i = 1 To GridLines For j = 1 To GridColumn Controls.SetTextBoxText(Cell[i][j], RCell[i][j]) EndFor EndFor XGI = 1 YGI = 1 LDFocus.SetFocus(Cell[YGI][XGI]) L = Text.GetLength(NameOfFile) NNameOfFile = Text.GetSubText(NameOfFile, 1, L-1) NNameOfFile = NNameOfFile + "b" ' The following line could be harmful and has been automatically commented. ' PCell = File.ReadContents(NameOfFile) ElseIf LBC = BT[3] Then 'Save For i = 1 To GridLines For j = 1 To GridColumn RCell[i][j] = Controls.GetTextBoxText(Cell[i][j]) EndFor EndFor NameOfFile = LDDialogs.SaveFile("sba", RootFolder) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(NameOfFile, RCell) L = Text.GetLength(NameOfFile) NNameOfFile = Text.GetSubText(NameOfFile, 1, L-1) NNameOfFile = NNameOfFile + "b" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(NameOfFile, PCell) ElseIf LBC = BT[4] Then 'Exit MainLoop = F EndIf EndSub 'CheckButton Sub InitGrid GraphicsWindow.BrushColor = "SteelBlue" SPenColor = GraphicsWindow.PenColor SBrushColor = GraphicsWindow.BrushColor SBackgroundColor = GraphicsWindow.BackgroundColor GraphicsWindow.PenColor = GridLineColor GridWidth = (GraphicsWindow.Width - GridLeft - GridColumn - 25) / GridColumn GridHeight = (GraphicsWindow.Height - GridTop - GridLines - 25) / GridLines For i = 1 To GridLines X = 60 Y = i*GridHeight-GridHeight+GridTop + 6 If i < 10 Then X = X + 10 EndIf GraphicsWindow.DrawText(X, Y, i) EndFor For j = 1 To GridColumn X = j*GridWidth-GridWidth+GridLeft + 6 GraphicsWindow.DrawText(X, 25, j) EndFor For i = 1 To GridLines For j = 1 To GridColumn X = j*GridWidth-GridWidth+GridLeft Y = i*GridHeight-GridHeight+GridTop GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.DrawRectangle(X, Y, GridWidth, GridHeight) GraphicsWindow.BrushColor = "Black" Cell[i][j] = Controls.AddTextBox(X + 2 * GraphicsWindow.PenWidth, Y + 2 * GraphicsWindow.PenWidth) Controls.SetSize(Cell[i][j], GridWidth - 2 * GraphicsWindow.PenWidth - 4, GridHeight - 2 * GraphicsWindow.PenWidth - 4) EndFor EndFor XGI = 1 YGI = 1 LDFocus.SetFocus(Cell[YGI][XGI]) EndSub 'InitGrid Sub Init GraphicsWindow.Top = 1 GraphicsWindow.Left = 1 GraphicsWindow.Height = Desktop.Height - 70 GraphicsWindow.Width = Desktop.Width -30 GraphicsWindow.PenWidth = 1 GraphicsWindow.Show() RootFolder = "E:\Data\ExelLight" T = "True" F = "False" Num[1] = "1" Num[2] = "2" Num[3] = "3" Num[4] = "4" Num[5] = "5" Num[6] = "6" Num[7] = "7" Num[8] = "8" Num[9] = "9" Num[10] = "0" Command[1] = "#SUM" Command[2] = "#ADD" Command[3] = "#SUB" Command[4] = "#MUL" Command[5] = "#DIV" BT[1] = Controls.AddButton("New", 100, GraphicsWindow.Height - 30) BT[2] = Controls.AddButton("Load", 150, GraphicsWindow.Height - 30) BT[3] = Controls.AddButton("Save", 200, GraphicsWindow.Height - 30) BT[4] = Controls.AddButton("Exit", 400, GraphicsWindow.Height - 30) GridLines = 20 GridColumn = 8 GridTop = 40 GridLeft = 100 GridLineColor = "LightGray" EndSub 'Init Sub OnButtonClicked OBC = T EndSub 'OnButtonClicked End>RTW900.sb< Start>RTZ371.sb< GraphicsWindow.Title = "Charactor Code Finder v1.0 by Jay Turner" begin: GraphicsWindow.DrawText(0, 0, "Charactor Code Finder v1.0 by Jay Turner") GraphicsWindow.DrawText(0, 15, "Type a charactor and I will return its code: ") code = Text.GetCharacterCode( 'Here is where I need help, I dont want to use TextWindow.Read(), but I don't know what to use instead' ) GraphicsWindow.DrawText(0, 30, code) GraphicsWindow.Clear() Goto begin End>RTZ371.sb< Start>RVB196.sb< 'Graphics Window Settings gww = Desktop.Width - 17 gwh = Desktop.Height - 65 GraphicsWindow.Hide() GraphicsWindow.Title = "Title" GraphicsWindow.CanResize = "False" GraphicsWindow.Top = 5 GraphicsWindow.Left = 5 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 2 GraphicsWindow.Width = gww GraphicsWindow.Height = gwh GraphicsWindow.FontSize = 16 'Independent variables mdw = 500 'Mini Display Window width mdh = mdw 'Mini Display Window height defaultW = 50 'Default width defaultH = 20 'Defaylt height playGame = "True" screen = 1 'Program array variables 'MainScreen array contains object data for the mainscreen that the user is brought to in the beggining. MainScreen[1][1] = (gww / 2 - (1 / 2) * mdw) 'Mini display area x position MainScreen[1][2] = (gwh / 2 - (1 / 2) * mdh) 'Mini display area y position MainScreen[1][3] = mdw 'Mini display area width MainScreen[1][4] = mdh 'Mini display area height MainScreen[2][1] = (gww / 2 - 50) 'Centered logo x position MainScreen[2][2] = (gwh / 2 - 50) 'Centered logo y position MainScreen[2][3] = (defaultW * 2) 'Centered logo width (resized) MainScreen[2][4] = (defaultW * 2) 'Centered logo height (resized) MainScreen[3][1] = ((gww / 2) - (mdw / 4) - 25) ' "Play" text box area x position MainScreen[3][2] = ((gwh / 2) - (mdh / 4) - 10) ' "Play" text box area y position MainScreen[3][3] = defaultW ' "Play" text box area width MainScreen[3][4] = defaultH ' "Play" text box area height MainScreen[3][5] = ((MainScreen[3][1]) + (MainScreen[3][3])) ' "Play" text box area lower right x position MainScreen[3][6] = ((MainScreen[3][2]) + (MainScreen[3][4])) ' "Play" text box area lower right y position MainScreen[4][1] = ((gww / 2) - (mdw / 4) - 25) ' "Help" text box area x position MainScreen[4][2] = ((gwh / 2) + (mdh / 4) - 10) ' "Help" text box area y position MainScreen[4][3] = defaultW ' "Help" text box area width MainScreen[4][4] = defaultH ' "Help" text box area height MainScreen[4][5] = ((MainScreen[4][1]) + (MainScreen[4][3])) ' "Help" text box area lower right x position MainScreen[4][6] = ((MainScreen[4][2]) + (MainScreen[4][4])) ' "Help" text box area lower right y position MainScreen[5][1] = ((gww / 2) + (mdw / 4) - 25) ' "Credits" text box area x position MainScreen[5][2] = ((gwh / 2) - (mdh / 4) - 10) ' "Credits" text box area y position MainScreen[5][3] = defaultW ' "Credits" text box area width MainScreen[5][4] = defaultH ' "Credits" text box area height MainScreen[5][5] = ((MainScreen[5][1]) + (MainScreen[5][3])) ' "Credits" text box area lower right x position MainScreen[5][6] = ((MainScreen[5][2]) + (MainScreen[5][4])) ' "Credits" text box area lower right y position MainScreen[6][1] = ((gww / 2) + (mdw / 4) - 25) ' "Other" text box area x position MainScreen[6][2] = ((gwh / 2) + (mdh / 4) - 10) ' "Other" text box area y position MainScreen[6][3] = defaultW ' "Other" text box area width MainScreen[6][4] = defaultH ' "Other" text box area height MainScreen[6][5] = ((MainScreen[6][1]) + (MainScreen[6][3])) ' "Other" text box area lower right x position MainScreen[6][6] = ((MainScreen[6][2]) + (MainScreen[6][4])) ' "Other" text box area lower right y position 'Second screen layout data. First portion dedicated to drawRectangle, second half is filler images. ScreenA[1][1] = ((gww * (1 / 4) - defaultW)) 'Choice box left side x position ScreenA[1][2] = ((gwh / 2) - 25) 'Choice box left side y position ScreenA[1][3] = (defaultW * 2) 'Choice box left side width ScreenA[1][4] = (defaultH * 2) 'Choice box left side height ScreenA[1][5] = ((ScreenA[1][1]) + (ScreenA[1][3])) 'Choice box left side lower right x position ScreenA[1][6] = ((ScreenA[1][2]) + (ScreenA[1][4])) 'Choice box left side lower right y position ScreenA[2][1] = ((gww * (3 / 4)) - defaultW) 'Choice box right side x position ScreenA[2][2] = ((gww / 2) - 25) 'Choice box right side y position ScreenA[2][3] = (defaultW * 2) 'Choice box right side width ScreenA[2][4] = (defaultH * 2) 'Choice box right side height ScreenA[2][5] = ((ScreenA[1][1]) + (ScreenA[1][3])) 'Choice box right side lower right x position ScreenA[2][6] = ((ScreenA[1][2]) + (ScreenA[1][4])) 'Choice box right side lower right y position 'Third screen layout. First portion dedicated to drawRectangle, second half is filler images. ScreenB[1][1] = ((gww / 2) - defaultW) 'Upper choice box x position ScreenB[1][2] = ((gwh * (1 / 4)) - ((1 / 2) * defaultH)) 'Upper choice box y position ScreenB[1][3] = (defaultW * 2) 'Upper choice box width ScreenB[1][4] = defaultH 'Upper choice box height ScreenB[1][5] = ((ScreenB[1][1]) + (ScreenB[1][3])) 'Upper choice box lower right x position ScreenB[1][6] = ((ScreenB[1][2]) + (ScreenB[1][4])) 'Upper choice box lower right y position ScreenB[2][1] = ((gww / 2) - defaultW) 'Lower choice box x position ScreenB[2][2] = ((gwh * (3 / 4)) - ((1 / 2) * defaultH)) 'Lower choice box y position ScreenB[2][3] = (defaultW * 2) 'Lower choice box width ScreenB[2][4] = defaultH 'Lower choice box height ScreenB[2][5] = ((ScreenB[2][1]) + (ScreenB[2][3])) 'Lower choice box lower right x position ScreenB[2][6] = ((ScreenB[2][2]) + (ScreenB[2][4])) 'Lower choice box lower right y position 'Less important items for subsiding screens all packed into one super duper array! "Yay!" 'On Screen Objects OSObjects[1][1] = ((gww / 2) - 100) 'On screen objects x position OSObjects[1][2] = ((gwh / 2) - 50) 'On screen objects y position OSObjects[1][3] = (defaultW * 4) 'On screen objects width OSObjects[1][4] = "Test Page A1" 'OSO test A1 screen label OSObjects[1][5] = "Test Page A2" 'OSO test A2 screen label OSObjects[1][6] = "Test Page B1" 'OSO test B1 screen label OSObjects[1][7] = "Test Page B2" 'OSO test B2 screen label 'Main routine Loadscreen() Initialization() Play() Sub Loadscreen GraphicsWindow.FillRectangle(MainScreen[1][1], MainScreen[1][2], MainScreen[1][3], MainScreen[1][4]) GraphicsWindow.DrawResizedImage("http://i991.photobucket.com/albums/af31/MarekVarro/ClockworkGrunt.jpg", MainScreen[2][1], MainScreen[2][2], MainScreen[2][3], MainScreen[2][4]) For L = 3 To 6 GraphicsWindow.DrawRectangle(MainScreen[L][1], MainScreen[L][2], MainScreen[L][3], MainScreen[L][4]) EndFor EndSub Sub Initialization GraphicsWindow.Show() EndSub Sub Play While (playGame = "True") GraphicsWindow.MouseDown = ChangeScreen EndWhile EndSub Sub ChangeScreen mXPos = GraphicsWindow.MouseX mYPos = GraphicsWindow.MouseY If (screen = 1) Then If (mXPos > MainScreen[3][1] And mYPos > MainScreen[3][2] And mXPos < MainScreen[3][5] And mYPos < MainScreen[3][6]) Then LoadScreenA() ElseIf (mXPos > MainScreen[4][1] And mYPos > MainScreen[4][2] And mXPos < MainScreen[4][5] And mYPos < MainScreen[4][6]) Then LoadScreenA() ElseIf (mXPos > MainScreen[5][1] And mYPos > MainScreen[5][2] And mXPos < MainScreen[5][5] And mYPos < MainScreen[5][6]) Then LoadScreenB() ElseIf (mXPos > MainScreen[6][1] And mYPos > MainScreen[6][2] And mXPos < MainScreen[6][5] And mYPos < MainScreen[6][6]) Then LoadScreenB() EndIf If (screen = 2) Then If (mXPos > ScreenA[1][1] And mYPos > ScreenA[1][2] And mXPos < ScreenA[1][5] And mYPos < ScreenA[1][6]) Then TestPageA1() ElseIf (mXPos > ScreenA[2][1] And mYPos > ScreenA[2][2] And mXPos < ScreenA[2][5] And mYPos < ScreenA[2][6]) Then TestPageA2() EndIf EndIf If (screen = 3) Then If (mXPos > ScreenB[1][1] And mYPos > ScreenB[1][2] And mXPos < ScreenB[1][5] And mYPos < ScreenB[1][6]) Then TestPageB1() ElseIf (mXPos > ScreenB[2][1] And mYPos > ScreenB[2][2] And mXPos < ScreenB[2][5] And mYPos < ScreenB[2][6]) Then TestPageB2() EndIf EndIf EndIf EndSub Sub LoadScreenA GraphicsWindow.Clear() screen = 2 For L = 1 To 2 GraphicsWindow.DrawRectangle(ScreenA[L][1], ScreenA[L][2], ScreenA[L][3], ScreenA[L][4]) EndFor EndSub Sub LoadScreenB GraphicsWindow.Clear() screen = 3 For L = 1 To 2 GraphicsWindow.DrawRectangle(ScreenB[L][1], ScreenB[L][2], ScreenB[L][3], ScreenB[L][4]) EndFor EndSub Sub TestPageA1 GraphicsWindow.DrawBoundText(OSObjects[1][1], OSObjects[1][2], OSObjects[1][3], OSObjects[1][4]) EndSub Sub TestPageA2 GraphicsWindow.DrawBoundText(OSObjects[1][1], OSObjects[1][2], OSObjects[1][3], OSObjects[1][5]) EndSub Sub TestPageB1 GraphicsWindow.DrawBoundText(OSObjects[1][1], OSObjects[1][2], OSObjects[1][3], OSObjects[1][6]) EndSub Sub TestPageB2 GraphicsWindow.DrawBoundText(OSObjects[1][1], OSObjects[1][2], OSObjects[1][3], OSObjects[1][7]) EndSub End>RVB196.sb< Start>RVB875.sb< scorelocation="c:\Users\Tom\Documents\Entrapmenttop10score.txt" GraphicsWindow.CanResize="false" initialize() 'sub GraphicsWindow.mousedown=setkeytospace 'sub for event set mousedown to space GraphicsWindow.MouseUp=setkeytoe GraphicsWindow.Keyup=keyup GraphicsWindow.Keydown=keydown topscore=0 newgame: GraphicsWindow.BackgroundColor="Black" score=0 keyup() lastkey="none" bugs=51 h=0 trapped=0 endgame=0 For n=1 to 4 for nn=1 to 2 bulletn[n][nn]=0 EndFor endfor For n=1 to 3 livebug[n][4]=1 livebug[n][3]=Math.GetRandomNumber(2) for nn=1 to 2 livebug[n][nn]=0 EndFor endfor N=1 'begining screens------------------------------------------------------------------------------- openscreen() GraphicsWindow.Clear() 'set level question ------------------------------------------------------------------ GraphicsWindow.FontSize=20*pixelsize/4 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawBoundText(pixelsize*8*11-8,pixelsize*8*10-8,500,"Choose Level 1 to 6") GraphicsWindow.FontSize=14*pixelsize/3 GraphicsWindow.DrawBoundText(pixelsize*8*11-8,pixelsize*8*11-8,500,"(Press a key)") 'check for key 1 to 6 ------------------------------------------------------------------ nokeypressed: if kp=0 then goto nokeypressed endif keydown6() GraphicsWindow.Clear() GraphicsWindow.FontSize=20*pixelsize/4 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawBoundText(pixelsize*8*11-8,pixelsize*8*10-8,500,"Level " +lN ) GraphicsWindow.FontSize=24*pixelsize/4 For delay =1 to Delaytime endfor '=====================MAIN GAME LOOP===================== '-----------------------------------------press any key----------------------------------------- GraphicsWindow.Clear() screenboarder() pressanykeytostart() GraphicsWindow.Clear() nextlevel: ml=0 mr=0 shoot=0 GraphicsWindow.BrushColor="black" GraphicsWindow.FillRectangle(32,32,1215,96) if trapped > 50 then GraphicsWindow.Clear() Goto win endif trapped=0 GraphicsWindow.BrushColor="black" GraphicsWindow.FillRectangle(32,32,1215,96) GraphicsWindow.FillRectangle(gunloldl,928,32,32) hatch1=0 hatch2=0 hatch3=0 screenboarder() bugsstartlocation() '---------------------------------------Begin game loop--------------------------------------- gunloldl=640 gunloldr=671 gunml=640 cycle=0 bugalive=0 Goto drawgun test: Sound.stop("C:\Users\Tom\Documents\gun_silencer.wav") 'If GraphicsWindow.keydown="true" then If d=1 then delayspeed=2 else delayspeed=250000/(2+ln) endif For delay = 1 to delayspeed endfor 'gunml = GraphicsWindow.MouseX if ml=1 then gunml=gunml -32 endif If gunml < 32 then gunml=32 endif If mr=1 then gunml=gunml+32 endif if gunml > 1247 then gunml=1247 'Goto test endif '====================new bullet test================================ bugmove() If endgame=1 then goto gameend endif If hatch3=17 then if livebug[1][2]=0 and livebug[2][2]=0 and livebug[3][2]=0 then graphicsWindow.FontSize=24 GraphicsWindow.BrushColor="Yellow" ln=ln+1 delayspeed=100000/(1+ln) keyup() goto nextlevel endif endif 'If keystroke="" then If shoot=0 then goto bulletmove endif 'if keystroke=" " then If shoot=1 then If bulletn[1][1]=0 then bulletn[1][1]=gunloldl+13 bulletn[1][2]=942 Sound.Play("C:\Users\Tom\Documents\gun_silencer.wav") Goto bulletmove else If bulletn[2][1]=0 then bulletn[2][1]=gunloldl+13 bulletn[2][2]=942 Sound.Play("C:\Users\Tom\Documents\gun_silencer.wav") Goto bulletmove else If bulletn[3][1]=0 then bulletn[3][1]=gunloldl+13 bulletn[3][2]=942 Sound.Play("C:\Users\Tom\Documents\gun_silencer.wav") Goto bulletmove else If bulletn[4][1]=0 then bulletn[4][1]=gunloldl+13 bulletn[4][2]=942 Sound.Play("C:\Users\Tom\Documents\gun_silencer.wav") endif endif endif endif '------------------------------launch/move bullet-------------------------------------------- bulletmove: For n=1 To 4 GraphicsWindow.BrushColor="black" if bulletn[n][2]>0 and bulletn[n][2] < 942 then GraphicsWindow.FillRectangle(bulletn[n][1],bulletn[n][2],4,4) Endif EndFor For n = 1 To 4 If bulletn[n][2]>0 then bulletn[n][2]=bulletn[n][2]-32 endif hit=GraphicsWindow.GetPixel(bulletn[n][1],bulletn[n][2]) 'check new location if GraphicsWindow.GetPixel(bulletn[n][1],bulletn[n][2])="#000000" then Goto okmove else 'draw brick If bulletn[n][2]>0 then Sound.stop("C:\Users\Tom\Documents\Explosion_01.wav") Sound.Play("C:\Users\Tom\Documents\Explosion_01.wav") GraphicsWindow.BrushColor="DARKGRAY" GraphicsWindow.FillRectangle(bulletn[n][1]-13,bulletn[n][2]-14,32,32) GraphicsWindow.BrushColor=BRICKCOLOR GraphicsWindow.FillRectangle(bulletn[n][1]-5,bulletn[n][2]-14,24,4) GraphicsWindow.FillRectangle(bulletn[n][1]-13,bulletn[n][2]-6,16,12) GraphicsWindow.FillRectangle(bulletn[n][1]+11,bulletn[n][2]-6,8,12) GraphicsWindow.FillRectangle(bulletn[n][1]-5,bulletn[n][2]+10,24,8) if hit="#008000" or hit="#000001" or hit="#FFFF00" then score =score + ln if hit="#008000" then If bulletn[n][2]<64 then hatch3=hatch3+1 endif If bulletn[n][2]<96 and bulletn[n][2]>64 then hatch2=hatch2+1 endif If bulletn[n][2]>96 then hatch1=hatch1+1 endif endif GraphicsWindow.FontSize=24 GraphicsWindow.BrushColor="#000002" GraphicsWindow.FillRectangle(900,0,160,28) GraphicsWindow.FillRectangle(214,0,160,28) GraphicsWindow.FillRectangle(552,0,160,28) GraphicsWindow.BrushColor="darkorange" GraphicsWindow.DrawBoundText(224,0,700,"Topscore "+ topscore) GraphicsWindow.DrawBoundText(914,0,500,"Score " +score) GraphicsWindow.DrawBoundText(590,0,500,"LEVEL " +ln) 'GraphicsWindow.BrushColor="black" 'GraphicsWindow.FillRectangle(900,0,160,28) 'GraphicsWindow.FillRectangle(224,0,200,28) 'graphicsWindow.FontSize=24 'GraphicsWindow.BrushColor="Yellow" 'GraphicsWindow.DrawBoundText(928,000,500,"Score " +score) 'GraphicsWindow.DrawBoundText(224,0,700,"Topscore "+topscore) endif endif If hit="#FFFF00" then '===============================reset bug# to 0 For zn=1 to 3 if ((4*livebug[zn][1])+13) = bulletn[n][1] and ((4*livebug[zn][2])+14)=bulletn[n][2] then livebug[zn][1]=0 livebug[zn][2]=0 endif endfor endif bulletn[n][1]=0 bulletn[n][2]=0 'reset bullet okmove: endif endfor For n = 1 To 4 if bulletn[n][2]>0 then GraphicsWindow.BrushColor="yellow" GraphicsWindow.FillRectangle(bulletn[n][1],bulletn[n][2],4,4) endif endfor endif '======================================================= 'gunerase If gunml>gunloldr Then GraphicsWindow.BrushColor="Black" GraphicsWindow.FillRectangle(gunloldl,928,32,32) 'end erase gunloldr=gunloldr+32 'movegun gunloldl=gunloldl+32 'drawgun+right+++++++++++++++++++++++++++++++++++++++++++++++++++ drawgun: gunloadl=800 GraphicsWindow.PenColor="darkgray" GraphicsWindow.PenWidth=8 GraphicsWindow.DrawLine(gunloldl+15,936,gunloldl+15,949) GraphicsWindow.DrawLine(gunloldl+2,956,gunloldl+29,956) GraphicsWindow.PenWidth=4 GraphicsWindow.DrawLine(gunloldl+7,950,gunloldl+23,950) Goto test endif '+++++++++++++++++++++++++++++++++++++++++++++++++++++++ If gunml0 then GraphicsWindow.BrushColor="Black" GraphicsWindow.FillRectangle(livebug[n][1]*4,livebug[n][2]*4,32,32) 'erase oldbug or egg livebug[n][2]=livebug[n][2]+8 if GraphicsWindow.GetPixel((4*livebug[n][1])+13,(4*livebug[n][2])+14)="#000000" then livebug[n][3]=Math.GetRandomNumber(2) Goto drawbug else livebug[n][2]=livebug[n][2]-8 If livebug[n][3]=1 or livebug[n][3]=5 or livebug[n][3]=7 then livebug[n][1]=livebug[n][1]+8 ' move right if GraphicsWindow.GetPixel((4*livebug[n][1])+13,4*livebug[n][2]+14)="#000000" then else livebug[n][1]=livebug[n][1]-8 livebug[n][3]=livebug[n][3]+3 endif endif If livebug[n][3]=2 or livebug[n][3]=4 or livebug[n][3]=8 then livebug[n][1]=livebug[n][1]-8 ' move left if GraphicsWindow.GetPixel((4*livebug[n][1])+13,4*livebug[n][2]+14)="#000000" then else livebug[n][1]=livebug[n][1]+8 livebug[n][3]=livebug[n][3]+3 endif endif endif drawbug: If livebug[n][3]>8 then trapped=trapped+1 GraphicsWindow.BrushColor="DARKGRAY" GraphicsWindow.FillRectangle(4*livebug[n][1],4*livebug[n][2],32,32) GraphicsWindow.BrushColor=BRICKCOLOR GraphicsWindow.FillRectangle((4*livebug[n][1])+8,(4*livebug[n][2]),24,4) GraphicsWindow.FillRectangle((4*livebug[n][1]),(4*livebug[n][2])+8,16,12) GraphicsWindow.FillRectangle((4*livebug[n][1])+24,(4*livebug[n][2])+8,8,12) GraphicsWindow.FillRectangle((4*livebug[n][1])+8,(4*livebug[n][2])+24,24,8) score=score+ln*2 livebug[n][1]=0 livebug[n][2]=0 livebug[n][3]=1 GraphicsWindow.FontSize=24 GraphicsWindow.BrushColor="#000002" GraphicsWindow.FillRectangle(900,0,160,28) GraphicsWindow.FillRectangle(214,0,160,28) GraphicsWindow.FillRectangle(552,0,160,28) GraphicsWindow.BrushColor="darkorange" GraphicsWindow.DrawBoundText(224,0,700,"Topscore "+ topscore) GraphicsWindow.DrawBoundText(914,0,500,"Score " +score) GraphicsWindow.DrawBoundText(590,0,500,"LEVEL " +ln) 'GraphicsWindow.BrushColor="Black" ' GraphicsWindow.FillRectangle(900,0,160,28) 'GraphicsWindow.FillRectangle(224,0,200,28) ' 'GraphicsWindow.BrushColor="Yellow" 'GraphicsWindow.DrawBoundText(224,0,700,"Topscore "+ topscore) 'GraphicsWindow.DrawBoundText(914,0,500,"Score " +score) endif If livebug[n][2]>0 then bugx=livebug[n][1] bugy=livebug[n][2] If livebug[n][4]=1 then drawbug1() endif If livebug[n][4]=2 then drawbug2() endif If livebug[n][4]=1 then livebug[n][4]=2 Else livebug[n][4]=1 endif endif endif endfor '---------------------------------------------------------------------------------------------------------------------------------------------- If livebug[1][2]>0 and livebug[2][2]>0 and livebug[3][2]>0 then goto onlymove endif newran: eggnum= Math.GetRandomNumber(17) If hatch1<17 then eggx=(16*eggnum)+8 eggy=24 else If hatch2<17 then eggx=(16*eggnum)+16 eggy=16 else if hatch3<17 then eggx=(16*eggnum)+8 eggy=8 endif EndIf endif If hatch3=17 then goto onlymove endif hitcolor= GraphicsWindow.GetPixel((4*eggx)+16,(4*eggy)+8) If hitcolor = "#000001" or hitcolor= "#A9A9A9" or hitcolor ="#000000" then goto newran endif if eggy=24 Then hatch1=hatch1+1 else if eggy=16 Then hatch2=hatch2+1 else if eggy=8 Then hatch3=hatch3+1 endif endif EndIf drawcrackedegg() onlymove: If livebug[1][2]>224 or livebug[2][2]>224 or livebug[3][2]>224 then endgame=1 endif skip: EndSub GAMEEND: If score>topscore Then GraphicsWindow.Clear() Goto newtopscore endif GraphicsWindow.Clear() GraphicsWindow.FontSize=60 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawBoundText(pixelsize*8*7-8,pixelsize*8*10-8,800,"You are a loser! ha ha ha " + score+ " Points") Sound.stop("C:\Users\Tom\Documents\laugh-11.wav") Sound.Play("C:\Users\Tom\Documents\laugh-11.wav") For delay=1 to 5000000 endfor GraphicsWindow.Clear() Goto newgame win: GraphicsWindow.Clear() GraphicsWindow.FontSize=60 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawBoundText(pixelsize*8*11-8,pixelsize*8*10-8,800,"You Won! "+score +" Points") newtopscore: If score>topscore Then GraphicsWindow.FontSize=40 GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawBoundText(pixelsize*8*6,pixelsize*8*10-8,900,"Best Score of the Day! "+score +" Points") endif Sound.stop("C:\Users\Tom\Documents\applause-2.wav") Sound.Play("C:\Users\Tom\Documents\applause-2.wav") For delay=1 to 12000000 endfor If score>topscore Then Topscore=score goto Topscoresaver endif GraphicsWindow.Clear() Goto newgame '===================================================================================== '=========================================================================================== Topscoresaver: 'Top Score Saver scorelocation="c:\Users\Tom\Documents\Entrapmenttop10score.txt" GraphicsWindow.Clear() GraphicsWindow.FontSize=20 GraphicsWindow.BackgroundColor="white" GraphicsWindow.BrushColor="Blue" GraphicsWindow.TextInput = OnTextInput 'Start a character text event GraphicsWindow.DrawText(100,100,"Enter Your Initials: ") 'Ask fro name name = "" 'Initialise input to blank cn=0 continue: If cn<4 then goto continue endif 'Event subroutine called when a key is pressed when the GraphicsWindow is active Sub OntextInput char = GraphicsWindow.LastText ' get the character entered cn=cn+1 If cn<4 then GraphicsWindow.DrawText(315+(12*cn),100, char) endif If (Text.GetCharacterCode(char) = 13) or cn=4 Then GraphicsWindow.DrawText(100,150, name+ " " +score ) 'If it is Enter (return), then we are done and output name tname=name name = "" 'Renitialise input to blank Else name = name+GraphicsWindow.LastText ' Append key input to data being read EndIf EndSub checkexist: ' The following line could be harmful and has been automatically commented. ' Fileexist=File.ReadLine(scorelocation,1) If fileexist="Entrapment" Then linenumber=0 For Top10 =1 To 10 linenumber=linenumber+4 ' The following line could be harmful and has been automatically commented. ' topscoreScore[top10]=File.ReadLine(scorelocation,linenumber)'Score EndFor top10=0 linenumber=1 Top10loop: linenumber=linenumber+4 top10=top10+1 If topscorescore[top10]>score Then goto top10loop EndIf linenumber=linenumber-3 ' The following line could be harmful and has been automatically commented. ' File.InsertLine(scorelocation,linenumber,Clock.date) ' The following line could be harmful and has been automatically commented. ' File.InsertLine(scorelocation,linenumber,Score) ' The following line could be harmful and has been automatically commented. ' File.InsertLine(scorelocation,linenumber,Ln) ' The following line could be harmful and has been automatically commented. ' File.InsertLine(scorelocation,linenumber,tname) Else ' The following line could be harmful and has been automatically commented. ' File.WriteLine(scorelocation,1,"Entrapment") linenumber=1 For Scorewriting=1 To 10 linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(ScoreLocation,linenumber,"---")'Name linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(scorelocation,linenumber,1)'Difficulty Level linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(scorelocation,linenumber,"00000")'Points linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(scorelocation,linenumber,Clock.Date) EndFor Goto checkexist EndIf highscore: GraphicsWindow.FontSize=40 linenumber=1 GraphicsWindow.Clear() GraphicsWindow.BrushColor="RED" GraphicsWindow.DrawText(440,90," TOP TEN SCORES ") GraphicsWindow.BrushColor="Blue" GraphicsWindow.DrawText(200,180," RANK "+" SCORE "+" LEVEL "+" DATE "+" NAME") GraphicsWindow.BrushColor="Green" For scorereading=1 To 10 linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' tname[scorereading]=File.ReadLine(scorelocation,linenumber) linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' tlevel[scorereading]=File.ReadLine(scorelocation,linenumber) linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' tpoints[scorereading]=File.ReadLine(scorelocation,linenumber) ' linenumber=linenumber+1 ' The following line could be harmful and has been automatically commented. ' tdate[scorereading]=File.ReadLine(scorelocation,linenumber) GraphicsWindow.DrawText(250,170+60*scorereading,scorereading) GraphicsWindow.DrawText(390,170+60*scorereading,tpoints[scorereading]) GraphicsWindow.DrawText(555,170+60*scorereading,tlevel[scorereading]) GraphicsWindow.DrawText(650,170+60*scorereading,tdate[scorereading]) GraphicsWindow.DrawText(940,170+60*scorereading,tname[scorereading]) EndFor GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="Purple" GraphicsWindow.DrawText(220,900,"(press a key to continue)") kp=0 wait: If kp=1 then GraphicsWindow.Clear() kp=0 Goto newgame Else goto wait endif End: End>RVB875.sb< Start>RVD542.sb< GraphicsWindow.Show() IO_ini() Grafikfenster() Nprog=4 ''number of programs, max = 5 '========================================== 'Create Windows '========================================== Controls.ButtonClicked = OnButtonClicked StartAll= Controls.AddButton("Start All",30,100) Win[1] = LDWindows.Create() GraphicsWindow.Title = "Fenster 1" Fenster() Win[2] = LDWindows.Create() GraphicsWindow.Title = "Fenster 2" Fenster() '========================================== 'Initialisation '========================================== Sub IO_ini c = LDIOWarrior.Initialise() a = LDIOWarrior.GetSerialNumber(1) d = LDIOWarrior.GetSerialNumber(2) b = LDIOWarrior.GetName(1) EndSub Sub Grafikfenster GraphicsWindow.Title = "1.Warriorprogramm" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(420,20,200,c + " Geräte angeschlossen") GraphicsWindow.DrawBoundText(10,20,200,"Seriennummer: " + a) GraphicsWindow.DrawBoundText(10,50,200,"Seriennummer: " + d) GraphicsWindow.DrawBoundText(220,20,200,"Gerätename: " + b) EndSub '========================================== 'Additional Windows '========================================== Sub Fenster LDControls.CheckBoxChanged = OnCheckBoxChanged WinId = LDWindows.CurrentID LDScrollBars.Add(400,550) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(530,60,50,"Zeit in s") For P = 1 To Nprog GraphicsWindow.DrawBoundText(20,50*P+25,50,"Prog " + P) Wert[WinId][P]=255 EndFor For S = 1 To 8 GraphicsWindow.DrawBoundText(50*S+65,60,250,"Rel " + S) EndFor For P = 1 To Nprog For N = 1 To 8 pro[WinId][P][N] = LDControls.AddCheckBox("") Controls.Move(pro[WinId][P][N],50*N + 70,50*P+25) EndFor Zeitbox[WinId][P] = Controls.AddTextBox(530,50*P+25) Controls.SetSize(Zeitbox[WinId][P], 35,20) EndFor EndSub '========================================== 'Update Checkbox status '========================================== Sub OnCheckBoxChanged CBNam = LDControls.LastCheckBox For Id = 1 To Array.GetItemCount(Win) WinId = Win[Id] For P = 1 To Nprog For N = 1 To 8 If pro[WinId][P][N] = CBNam Then If LDControls.LastCheckBoxState = "True" Then Wert[WinId][P] = Wert[WinId][P] - Math.Power(2,N-1) Else Wert[WinId][P] = Wert[WinId][P] + Math.Power(2,N-1) EndIf EndIf EndFor EndFor EndFor EndSub '========================================== 'Main Button Event '========================================== Sub OnButtonClicked For Id = 1 To Array.GetItemCount(Win) 'Id is the IO-Warrior number WinId = Win[Id] 'The corresponding Window Id used to label controls For P = 1 To Nprog 'Check if we do this control ZeitSek = Controls.GetTextBoxText(Zeitbox[WinId][P]) If ZeitSek > 0 Then 'Set Binary value for checkboxes N[1] = 0 N[2] = Wert[WinId][P] N[3] = 255 TextWindow.WriteLine("Id = "+Id+" N[2] = "+N[2]) LDIOWarrior.Write(Id,0,N) EndIf EndFor EndFor EndSub End>RVD542.sb< Start>RVF728-1.sb< ' CSV data File Save, File Read Graphic Version by NaochanON 20140907 RVF728-1 ' This program gets Stock CSV data from Google-Finance and save its , gets average "close" data ' http://www.quantshare.com/sa-43-10-ways-to-download-historical-stock-quotes-data-for-free Controls.ButtonClicked=OnClicked GUI() Sub OnClicked StockCSVData() Count_Up() Average() EndSub Sub average Ave="" Len= Text.GetLength(sum) ' sum= Sep-14=181.23 ; Aug-14=........ While Len>0 midP= Text.GetIndexOf(sum,";") ' midP= 14 eqp= Text.GetIndexOf(sum,"=") ' eqP= 7 thismonth=Text.GetSubText(sum,1,eqp-1) thisave= Math.Round(Text.GetSubText(sum,eqp+1,midp-eqp-1)/count[thismonth]*100) /100 ave=ave+thismonth+","+thisave+","+count[thismonth]+LF sum= Text.GetSubTextToEnd(sum,midp+1) Len= Text.GetLength(sum) EndWhile Ave="Month,Ave,Days"+LF+ave Controls.SetTextBoxText(Mbox2,Symbol+" Monthly average "+LF+ave) ' The following line could be harmful and has been automatically commented. ' File.WriteContents(Program.Directory+"\Ave_"+Symbol+".csv",Ave) EndSub Sub Count_up ' The following line could be harmful and has been automatically commented. ' Conts=File.ReadContents(path) Controls.SetTextBoxText(Mbox1,Conts) LFP= text.GetIndexOf(conts,LF) ' LF Line Feed point Aitems= Text.GetSubText(Conts,1,LFP-1) ' Date,Open,High,Low,Close,Volume '--------------------------------------------------------------------------------------------- conts= Text.GetSubTextToEnd(conts,LFP+1) ' stock data contents Len= Text.GetLength(conts) sum="" Count="" NN=0 While Len>0 LFP= text.GetIndexOf(conts,LF) ' LF Line Feed point '--------------------------------------------------------------------------------------------- thisdata= Text.GetSubText(Conts,1,LFP-1)+"," ' this line data thisLen= Text.GetLength(thisdata) NN=NN+1 MM=0 While thisLen>0 cmP= text.GetIndexOf(thisdata,",") ' cmP comma point S_data= Text.GetSubText(thisdata,1,cmP-1) ' cropped data MM=MM+1 Stock_data[NN][MM]=S_data '--------------------------------------------------------------------------------------------- thisdata= Text.GetSubTextToEnd(thisdata,cmP+1) ' data remained thisLen= Text.GetLength(thisdata) endwhile monthP= Text.GetIndexOf(Stock_data[NN][1],"-")+1 thismonth= Text.GetSubTextToEnd(Stock_data[NN][1],monthP) ' month -year ex: Sep-14 sum[thismonth]=sum[thismonth]+Stock_data[NN][5] ' <---- close data Count[thismonth] =Count[thismonth] +1 ' counts '--------------------------------------------------------------------------------------------- conts= Text.GetSubTextToEnd(conts,LFP+1) ' conts data remained Len= Text.GetLength(conts) endwhile EndSub Sub StockCSVData Symbol=Controls.GetTextBoxText(Inpbox) ' symbol name ... MSFT = Microsoft url="http://www.google.com/finance/historical?output=csv&q=" ' [Symbol name] ' Google finance url URL=URL+Symbol GraphicsWindow.Title=Symbol+ " - Stock Data " RCD=Network.GetWebPageContents(URL) Path=Program.Directory+"\Stock_"+Symbol +".csv" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(Path,RCD) EndSub Sub GUI GraphicsWindow.BackgroundColor="Darkgreen" GraphicsWindow.width=700 GraphicsWindow.Height=650 GraphicsWindow.BrushColor="Navy" MBOX1= Controls.AddMultiLineTextBox(20,35) Controls.SetSize(Mbox1,350,600) MBOX2= Controls.AddMultiLineTextBox(420,35) Controls.SetSize(Mbox2,200,300) Inpbox= Controls.AddTextBox(200,5) Controls.SetSize(Inpbox,80,25) Controls.SetTextBoxText(Inpbox,"AAPL") ' AAPL ... Apple MSFT ..... Microsoft btn= Controls.AddButton("EXE",320,5) LF= Text.GetCharacter(10) GraphicsWindow.BrushColor="Yellow" GraphicsWindow.DrawText(20,5,"Input Symbol Name" +LF+"and Push EXE Button") EndSub End>RVF728-1.sb< Start>RVG805-0.sb< args=0 dbgg=0'"true init() Sub init TextWindow.Left=5 TextWindow.Top=790 GraphicsWindow.Left=5 GraphicsWindow.Top=0 GraphicsWindow.Width=960 GraphicsWindow.Height=600 LDScrollBars.Add(800 18000) LDGraphicsWindow.Width=990 LDScrollBars.Visibility="true GraphicsWindow.Title="ZX-2020 TextWindow.Title="Cmd/Lprint I/O ldTextWindow.Encoding="Unicode bbr=LDShapes.BrushGradient("1=white;2=tan;3=brown" "DD") ldGraphicsWindow.BackgroundBrush(bbr) GraphicsWindow.FontName="noto mono GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="darkred tx=Shapes.AddText("(C)2020 SB-ZX Search ltd.") Shapes.Move(tx 20 560 ) hss=0 not="true=false;false=true;0=true;1=false clm=LDText.Split("blue red magenta green cyan yellow white" " ") clm[0]="black GraphicsWindow.PenWidth=10 bb[1]=Shapes.AddLine(0 0 800 0) bb[2]=Shapes.AddLine(0 0 0 600) bb[3]=Shapes.AddLine(800 0 800 600) bb[4]=Shapes.AddLine(800 600 0 600) GraphicsWindow.PenWidth=2 cr=Text.GetCharacter(13) ds=Text.GetCharacter(10) tb=Text.GetCharacter(9) yf=1 oy=0 nln=cr+ds GraphicsWindow.FontSize=14 bt1=Controls.AddButton(" CLS " 810 1) bt2=Controls.AddButton(" LOAD " 810 41) bt3=Controls.AddButton(" NEW " 880 1) bt4=Controls.AddButton(" SAVE " 880 41) bt5=Controls.AddButton(" LIST " 810 81) bt6=Controls.AddButton(" LLIST " 880 81) bt7=Controls.AddButton(" RUN " 810 121) bt8=Controls.AddButton(" HELP " 880 121) 'GraphicsWindow.MouseMove=mmm Controls.ButtonClicked=bcc EndSub Sub mmm GraphicsWindow.Title=GraphicsWindow.Mousex+" : "+GraphicsWindow.MouseY EndSub Sub execprg GraphicsWindow.Title="run>>" GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 800 600) GraphicsWindow.BrushColor="black lls=LDList.CreateFromValues(prg) If dbgg Then lbx=LDControls.AddListBox(lls 200 400) Controls.Move(lbx 600,10) EndIf For x=1 To LDList.Count(lls) q=LDList.GetAt(lls x) 'TextWindow.WriteLine(q) For m1=1 To Array.GetItemCount(q) qq=LDText.Split(ldtext.Replace (ldtext.Replace (q[m1] "~" " ") "," " ") " ") fs=LDText.Trim( Text.ConvertToLowerCase(qq[1])) ' TextWindow.WriteLine(qq) If fs="let" Then mmv[qq[2]]=ldcall.Function("eval" qq[3]) ElseIf fs="grab" Then ggg=LDGraphicsWindow.Capture("" "false") LDImage.Crop(ggg qq[2] qq[3] qq[4] qq[5]) ElseIf fs="grdrw" Then GraphicsWindow.DrawImage(ggg qq[2] qq[3]) ElseIf fs="grdrwrs" Then GraphicsWindow.DrawResizedImage(ggg qq[2] qq[3] qq[4] qq[5]) ElseIf fs="mvimg" Then Shapes.Move(iii[qq[2]] qq[2] qq[3]) ElseIf fs="setimg" Then LDShapes.SetImage(iii[qq[2]] ggg) ElseIf fs="aopimg" Then LDShapes.AnimateOpacity(iii[qq[2]] qq[3] qq[4]) ElseIf fs="arotimg" Then LDShapes.AnimateRotation(iii[qq[2]] qq[3] qq[4]) ElseIf fs="azmimg" Then LDShapes.AnimateZoom(iii[qq[2]] qq[3] qq[4] qq[5] qq[5]) ElseIf fs="anmimg" Then Shapes.Animate(iii[qq[2]] qq[3] qq[4] qq[5]) ElseIf fs="rszimg" Then LDShapes.ReSize(iii[qq[2]] qq[3] qq[4]) ElseIf fs="addimg" Then iii[qq[2]]=Shapes.AddImage(ggg) ElseIf fs="ldimg" Then ggg=ImageList.LoadImage(qq[2]) ElseIf fs="input" Then mmv[qq[2]]=FCDialogs.AskForTextLine(qq[3]) ElseIf fs="print" Then TextWindow.WriteLine(ldmath.Evaluate2 (0+ldcall.Function("eval" qq[2]))) ElseIf fs="?" Then TextWindow.WriteLine( qq[2]) ElseIf fs="coord" Then yf=qq[2] oy=qq[3] ElseIf fs="ffill" Then nn=qq[4] ccw=nn If nn*1=nn and nn<8 Then ccw=clm[nn] EndIf LDGraphicsWindow.FloodFill(qq[2] qq[3] ccw) ElseIf fs="plot" Then lx=ldcall.Function("meval" qq[2]) ly=ldcall.Function("meval" qq[3])*yf+oy ' TextWindow.WriteLine("p:"+lx+"|"+ly) GraphicsWindow.DrawLine(lx ly lx ly) ElseIf fs="draw" Then nx=ldcall.Function("meval" qq[2])+lx ny=ldcall.Function("meval" qq[3])*yf+ly GraphicsWindow.DrawLine(lx ly nx ny) lx=nx ly=ny ' TextWindow.WriteLine("d>"+lx+"|"+ly) ElseIf fs="inc" Then mmv[qq[2]]=mmv[qq[2]]+1 ElseIf fs="dec" Then mmv[qq[2]]=mmv[qq[2]]-1 ElseIf fs="djnz" Then mmv["bc"]=mmv["bc"]-1 If mmv["bc"]>=0 Then x=x-qq[2]-1 EndIf ElseIf fs="line" Then GraphicsWindow.DrawLine(qq[2] qq[3] qq[4] qq[5]) lx=ldcall.Function("meval" qq[4]) ly=ldcall.Function("meval" qq[5]) ElseIf fs="rect" Then GraphicsWindow.FillRectangle(qq[2] qq[3] qq[4] qq[5] ) ElseIf fs="circle" Then rr=qq[4] sx=qq[2]-rr sy=qq[3]-rr If qq[5] Then GraphicsWindow.fillEllipse(sx sy*yf+oy rr*2 rr*2) Else GraphicsWindow.DrawEllipse(sx sy*yf+oy rr*2 rr*2) EndIf ElseIf fs="paper" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf fs="ink" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BrushColor=clm[nn] GraphicsWindow.PenColor=clm[nn] Else GraphicsWindow.BrushColor=nn GraphicsWindow.penColor=nn EndIf EndIf EndFor EndFor GraphicsWindow.Title="stop[] EndSub'------------------ Sub eval '========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ww EndSub'----------------------- Sub meval'========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ldmath.Evaluate2( ww+"+0") EndSub'----------------------- While 1=1 If rnn Then execprg() rnn="false EndIf TextWindow.Write(">") ll=textWindow.Read() lll=LDText.Split(ll ":") rm="true For xl=1 To Array.GetItemCount(lll) ll0=lll[xl] If xl>1 Then rm="false EndIf cc=LDText.Split(text.ConvertToLowerCase (ldtext.Replace (ll0 "=" "~")) " ") If rm and text.StartsWith (cc[1] "pap") Then nn=cc[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf rm and cc[1]="run" Then rnn="true ElseIf cc[1]*1=cc[1] Then prg[cc[1]][xl]=text.ConvertToUpperCase( cc[2])+" "+cc[3]+" "+cc[4]+" "+cc[5]+" "+cc[6] rm="False ElseIf rm and text.StartsWith (cc[1] "lli") Then llst() ElseIf rm and text.StartsWith (cc[1] "lis") Then Shapes.Remove(tx) slst() ElseIf rm and text.StartsWith (cc[1] "loa") Then loadd() ElseIf rm and text.StartsWith (cc[1] "bor") Then nn=cc[2] If nn*1=nn and nn<8 Then For r=1 To 4 LDShapes.PenColour(bb[r] clm[nn]) EndFor Else For r=1 To 4 LDShapes.PenColour(bb[r] nn) EndFor EndIf EndIf EndFor EndWhile Sub llst TextWindow.WriteLine("List:") For x=1 To 999 If Text.GetLength(prg[x])>0 Then TextWindow.Write(x+tb) ic=Array.GetItemCount(prg[x]) For m=1 To ic-1 TextWindow.Writeline(prg[x][m] +" | ") EndFor TextWindow.WriteLine( prg[x][ic]+"<<") EndIf EndFor EndSub Sub slst yy=5 Shapes.SetOpacity(bb[4] 5) For x=1 To 999 If Text.GetLength(prg[x])>0 Then tt=Shapes.AddText(x) Shapes.Move(tt 10 yy) ic=Array.GetItemCount(prg[x]) tw="" For m=1 To ic-1 tw=tw+(prg[x][m] ) tt=Shapes.AddText(tw) Shapes.Move(tt 55 yy) yy=yy+25 tw="" EndFor tw=tw+( prg[x][ic]+"<<") tt=Shapes.AddText(ldtext.Replace (tw "~" "=")) Shapes.Move(tt 55 yy) yy=yy+25 EndIf EndFor EndSub Sub bcc qq=Controls.LastClickedButton If qq=bt2 Then loadd() ElseIf qq=bT1 Then GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 800 600) GraphicsWindow.BrushColor="black for x=1 to 100 Shapes.Remove(iii[x]) EndFor ElseIf qq=bT8 Then shhlp() ElseIf qq=bt6 Then llst() ElseIf qq=bt7 Then rnn="true LDTextWindow.SendKey(TextWindow.Title "Return") ElseIf qq=bt5 Then Shapes.Remove(tx) slst() EndIf EndSub Sub loadd ff=LDDialogs.OpenFile("1=txt;2=tap;3=mem" "e:\" ) ff=Text.ConvertToLowerCase(ff) If Text.IsSubText(ff ".txt") Then ' The following line could be harmful and has been automatically commented. ' fff=File.ReadContents(ff) fff=LDText.Replace(fff nln ds) fff=LDText.Replace(fff cr ds) mm=LDText.Split(fff ds) ac=Array.GetItemCount(mm) lc=0 TextWindow.WriteLine("Loaded:") For f=1 To ac ln=LDText.Split(mm[f] "|") If ln[1]*1=ln[1] Then ln[2]=LDText.Replace(ln[2] "THEN" "Then...:") prg[ln[1]]=ldtext.Split( ln[2] ":") lc=lc+1 TextWindow.WriteLine(ln[1]+tb+prg[ln[1]]) EndIf EndFor GraphicsWindow.ShowMessage("lines parsed: "+lc+ds+"total lines:"+ac ff) EndIf EndSub Sub shhlp If hlpp Then hss=not[hss] If hss Then Controls.ShowControl(hlc) Else Controls.HideControl(hlc) EndIf Else hlpp="IMAGE operations:~----------------------~grab xx yy ww hh~ grabs screen part~----------------------~grdrw xx yy~ draws grabbed img~----------------------~grdrwrs xx yy ww hh~ draws grabbed img to size ww hh~----------------------~ldimg img~ loads image~----------------------~addimg ii ~ adds shape image and stores as ii~----------------------~mvimg ii xx yy~ moves image shape~----------------------~setimg ii~ sets new image to existing shape~ use grab or ldimg to choose image~----------------------~aopimg ii...~ animates opacity of image shape~----------------------~arotim ii...~ animates rotation of image shape~----------------------~azmimg ii...~ animates zoom of image shape~----------------------~anmimg ii...~ animates img.shape~----------------------~rszimg ii ww hh~ resizes img.shape to ww X hh px. hlpp=LDText.Replace(hlpp "~" nln) hlc=Controls.AddMultiLineTextBox(550 10) Controls.SetSize(hlc 300 600) Controls.SetTextBoxText(hlc hlpp) hlpp="true hss="true EndIf EndSub End>RVG805-0.sb< Start>RVG805-1.sb< args=0 dbgg=0'"true init() Sub init TextWindow.Left=5 TextWindow.Top=790 GraphicsWindow.Left=5 GraphicsWindow.Top=0 GraphicsWindow.Width=960 GraphicsWindow.Height=600 LDScrollBars.Add(800 18000) LDGraphicsWindow.Width=990 LDScrollBars.Visibility="true GraphicsWindow.Title="ZX-2020 TextWindow.Title="Cmd/Lprint I/O ldTextWindow.Encoding="Unicode bbr=LDShapes.BrushGradient("1=white;2=tan;3=brown" "DD") ldGraphicsWindow.BackgroundBrush(bbr) GraphicsWindow.FontName="noto mono GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="darkred tx=Shapes.AddText("(C)2020 SB-ZX Search ltd.") Shapes.Move(tx 20 560 ) hss=0 not="true=false;false=true;0=true;1=false clm=LDText.Split("blue red magenta green cyan yellow white" " ") clm[0]="black GraphicsWindow.PenWidth=10 bb[1]=Shapes.AddLine(0 0 800 0) bb[2]=Shapes.AddLine(0 0 0 600) bb[3]=Shapes.AddLine(800 0 800 600) bb[4]=Shapes.AddLine(800 600 0 600) GraphicsWindow.PenWidth=2 cr=Text.GetCharacter(13) ds=Text.GetCharacter(10) tb=Text.GetCharacter(9) yf=1 oy=0 nln=cr+ds GraphicsWindow.FontSize=14 bt1=Controls.AddButton(" CLS " 810 1) bt2=Controls.AddButton(" LOAD " 810 41) bt3=Controls.AddButton(" NEW " 880 1) bt4=Controls.AddButton(" SAVE " 880 41) bt5=Controls.AddButton(" LIST " 810 81) bt6=Controls.AddButton(" LLIST " 880 81) bt7=Controls.AddButton(" RUN " 810 121) bt8=Controls.AddButton(" HELP " 880 121) 'GraphicsWindow.MouseMove=mmm Controls.ButtonClicked=bcc EndSub Sub mmm GraphicsWindow.Title=GraphicsWindow.Mousex+" : "+GraphicsWindow.MouseY EndSub Sub execprg GraphicsWindow.Title="run>>" GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 800 600) GraphicsWindow.BrushColor="black lls=LDList.CreateFromValues(prg) If dbgg Then lbx=LDControls.AddListBox(lls 200 400) Controls.Move(lbx 600,10) EndIf For x=1 To LDList.Count(lls) q=LDList.GetAt(lls x) 'TextWindow.WriteLine(q) For m1=1 To Array.GetItemCount(q) qq=LDText.Split(ldtext.Replace (ldtext.Replace (q[m1] "~" " ") "," " ") " ") fs=LDText.Trim( Text.ConvertToLowerCase(qq[1])) ' TextWindow.WriteLine(qq) If fs="let" Then mmv[qq[2]]=ldcall.Function("eval" qq[3]) ElseIf fs="for" Then mmv["bc"]=qq[2] Stack.PushValue("fr" qq[2]) fcc=fcc+" " ElseIf fs="nxt" Then mmv["bc"]=Stack.PopValue("fr" ) mmv["bc"]=mmv["bc"]-1 Stack.PushValue("fr" mmv["bc"]) ' TextWindow.WriteLine(fcc+mmv["bc"]) If mmv["bc"]>=0 Then x=x-qq[2]-1 goto xxq Else fcc=Text.GetSubTextToEnd(fcc 4) zz=Stack.PopValue("fr" ) EndIf ElseIf fs="grab" Then ggg=LDGraphicsWindow.Capture("" "false") LDImage.Crop(ggg qq[2] qq[3] qq[4] qq[5]) ElseIf fs="grdrw" Then GraphicsWindow.DrawImage(ggg qq[2] qq[3]) ElseIf fs="grdrwrs" Then GraphicsWindow.DrawResizedImage(ggg qq[2] qq[3] qq[4] qq[5]) ElseIf fs="mvimg" Then Shapes.Move(iii[qq[2]] qq[2] qq[3]) ElseIf fs="setimg" Then LDShapes.SetImage(iii[qq[2]] ggg) ElseIf fs="aopimg" Then LDShapes.AnimateOpacity(iii[qq[2]] qq[3] qq[4]) ElseIf fs="arotimg" Then LDShapes.AnimateRotation(iii[qq[2]] qq[3] qq[4]) ElseIf fs="azmimg" Then LDShapes.AnimateZoom(iii[qq[2]] qq[3] qq[4] qq[5] qq[5]) ElseIf fs="anmimg" Then Shapes.Animate(iii[qq[2]] qq[3] qq[4] qq[5]) ElseIf fs="rszimg" Then LDShapes.ReSize(iii[qq[2]] qq[3] qq[4]) ElseIf fs="addimg" Then iii[qq[2]]=Shapes.AddImage(ggg) ElseIf fs="ldimg" Then ggg=ImageList.LoadImage(qq[2]) ElseIf fs="input" Then mmv[qq[2]]=FCDialogs.AskForTextLine(qq[3]) ElseIf fs="print" Then TextWindow.WriteLine(ldmath.Evaluate2 (0+ldcall.Function("eval" qq[2]))) ElseIf fs="?" Then TextWindow.WriteLine( qq[2]) ElseIf fs="coord" Then yf=qq[2] oy=qq[3] ElseIf fs="ffill" Then nn=qq[4] ccw=nn If nn*1=nn and nn<8 Then ccw=clm[nn] EndIf LDGraphicsWindow.FloodFill(qq[2] qq[3] ccw) ElseIf fs="plot" Then lx=ldcall.Function("meval" qq[2]) ly=ldcall.Function("meval" qq[3])*yf+oy ' TextWindow.WriteLine("p:"+lx+"|"+ly) GraphicsWindow.DrawLine(lx ly lx ly) ElseIf fs="draw" Then nx=ldcall.Function("meval" qq[2])+lx ny=ldcall.Function("meval" qq[3])*yf+ly GraphicsWindow.DrawLine(lx ly nx ny) lx=nx ly=ny ' TextWindow.WriteLine("d>"+lx+"|"+ly) ElseIf fs="inc" Then mmv[qq[2]]=mmv[qq[2]]+1 ElseIf fs="dec" Then mmv[qq[2]]=mmv[qq[2]]-1 ElseIf fs="djnz" Then mmv["bc"]=mmv["bc"]-1 If mmv["bc"]>=0 Then x=x-qq[2]-1 EndIf ElseIf fs="line" Then GraphicsWindow.DrawLine(qq[2] qq[3] qq[4] qq[5]) lx=ldcall.Function("meval" qq[4]) ly=ldcall.Function("meval" qq[5]) ElseIf fs="rect" Then GraphicsWindow.FillRectangle(qq[2] qq[3] qq[4] qq[5] ) ElseIf fs="circle" Then rr=qq[4] sx=qq[2]-rr sy=qq[3]-rr If qq[5] Then GraphicsWindow.fillEllipse(sx sy*yf+oy rr*2 rr*2) Else GraphicsWindow.DrawEllipse(sx sy*yf+oy rr*2 rr*2) EndIf ElseIf fs="paper" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf fs="ink" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BrushColor=clm[nn] GraphicsWindow.PenColor=clm[nn] Else GraphicsWindow.BrushColor=nn GraphicsWindow.penColor=nn EndIf EndIf EndFor xxq: EndFor GraphicsWindow.Title="stop[] EndSub'------------------ Sub eval '========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ww EndSub'----------------------- Sub meval'========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ldmath.Evaluate2( ww+"+0") EndSub'----------------------- While 1=1 If rnn Then execprg() rnn="false EndIf TextWindow.Write(">") ll=textWindow.Read() lll=LDText.Split(ll ":") rm="true For xl=1 To Array.GetItemCount(lll) ll0=lll[xl] If xl>1 Then rm="false EndIf cc=LDText.Split(text.ConvertToLowerCase (ldtext.Replace (ll0 "=" "~")) " ") If rm and text.StartsWith (cc[1] "pap") Then nn=cc[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf rm and cc[1]="run" Then rnn="true ElseIf cc[1]*1=cc[1] Then prg[cc[1]][xl]=text.ConvertToUpperCase( cc[2])+" "+cc[3]+" "+cc[4]+" "+cc[5]+" "+cc[6] rm="False ElseIf rm and text.StartsWith (cc[1] "lli") Then llst() ElseIf rm and text.StartsWith (cc[1] "lis") Then Shapes.Remove(tx) slst() ElseIf rm and text.StartsWith (cc[1] "loa") Then loadd() ElseIf rm and text.StartsWith (cc[1] "bor") Then nn=cc[2] If nn*1=nn and nn<8 Then For r=1 To 4 LDShapes.PenColour(bb[r] clm[nn]) EndFor Else For r=1 To 4 LDShapes.PenColour(bb[r] nn) EndFor EndIf EndIf EndFor EndWhile Sub llst TextWindow.WriteLine("List:") For x=1 To 999 If Text.GetLength(prg[x])>0 Then TextWindow.Write(x+tb) ic=Array.GetItemCount(prg[x]) For m=1 To ic-1 TextWindow.Writeline(prg[x][m] +" | ") EndFor TextWindow.WriteLine( prg[x][ic]+"<<") EndIf EndFor EndSub Sub slst yy=5 Shapes.SetOpacity(bb[4] 5) For x=1 To 999 If Text.GetLength(prg[x])>0 Then 'tt=Shapes.AddText(x) GraphicsWindow.DrawText( 10 yy x) ic=Array.GetItemCount(prg[x]) tw="" For m=1 To ic-1 tw=tw+(prg[x][m] ) ' tt=Shapes.AddText(tw) GraphicsWindow.DrawText( 55 yy tw) yy=yy+25 tw="" EndFor tw=( prg[x][ic]+"<<") tt=(ldtext.Replace (tw "~" "=")) GraphicsWindow.DrawText( 55 yy tt) yy=yy+25 EndIf EndFor EndSub Sub bcc qq=Controls.LastClickedButton If qq=bt2 Then loadd() ElseIf qq=bT1 Then GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 800 600) GraphicsWindow.BrushColor="black For x=1 To 100 Shapes.Remove(iii[x]) EndFor ElseIf qq=bT8 Then shhlp() ElseIf qq=bt6 Then llst() ElseIf qq=bt7 Then rnn="true LDTextWindow.SendKey(TextWindow.Title "Return") ElseIf qq=bt5 Then Shapes.Remove(tx) slst() EndIf EndSub Sub loadd ff=LDDialogs.OpenFile("1=txt;2=tap;3=mem" "e:\" ) ff=Text.ConvertToLowerCase(ff) If Text.IsSubText(ff ".txt") Then ' The following line could be harmful and has been automatically commented. ' fff=File.ReadContents(ff) fff=LDText.Replace(fff nln ds) fff=LDText.Replace(fff cr ds) mm=LDText.Split(fff ds) ac=Array.GetItemCount(mm) lc=0 TextWindow.WriteLine("Loaded:") For f=1 To ac ln=LDText.Split(mm[f] "|") If ln[1]*1=ln[1] Then ln[2]=LDText.Replace(ln[2] "THEN" "Then...:") prg[ln[1]]=ldtext.Split( ln[2] ":") lc=lc+1 TextWindow.WriteLine(ln[1]+tb+prg[ln[1]]) EndIf EndFor GraphicsWindow.ShowMessage("lines parsed: "+lc+ds+"total lines:"+ac ff) EndIf EndSub Sub shhlp If hlpp Then hss=not[hss] If hss Then Controls.ShowControl(hlc) Else Controls.HideControl(hlc) EndIf Else hlpp="IMAGE operations:~----------------------~grab xx yy ww hh~ grabs screen part~----------------------~grdrw xx yy~ draws grabbed img~----------------------~grdrwrs xx yy ww hh~ draws grabbed img to size ww hh~----------------------~ldimg img~ loads image~----------------------~addimg ii ~ adds shape image and stores as ii~----------------------~mvimg ii xx yy~ moves image shape~----------------------~setimg ii~ sets new image to existing shape~ use grab or ldimg to choose image~----------------------~aopimg ii...~ animates opacity of image shape~----------------------~arotim ii...~ animates rotation of image shape~----------------------~azmimg ii...~ animates zoom of image shape~----------------------~anmimg ii...~ animates img.shape~----------------------~rszimg ii ww hh~ resizes img.shape to ww X hh px. hlpp=LDText.Replace(hlpp "~" nln) hlc=Controls.AddMultiLineTextBox(550 10) Controls.SetSize(hlc 300 600) Controls.SetTextBoxText(hlc hlpp) hlpp="true hss="true EndIf EndSub End>RVG805-1.sb< Start>RVG805.sb< TextWindow.Left=5 TextWindow.Top=790 GraphicsWindow.Left=5 GraphicsWindow.Top=0 GraphicsWindow.Width=960 GraphicsWindow.Height=600 LDScrollBars.Add(800 18000) LDGraphicsWindow.Width=990 LDScrollBars.Visibility="true args=0 dbgg=0'"true GraphicsWindow.Title="ZX-2020 TextWindow.Title="Cmd/Lprint I/O ldTextWindow.Encoding="Unicode bbr=LDShapes.BrushGradient("1=white;2=tan;3=brown" "DD") ldGraphicsWindow.BackgroundBrush(bbr) GraphicsWindow.FontName="noto mono GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="darkred tx=Shapes.AddText("(C)2020 SB-ZX Search ltd.") Shapes.Move(tx 20 560 ) clm=LDText.Split("blue red magenta green cyan yellow white" " ") clm[0]="black GraphicsWindow.PenWidth=10 bb[1]=Shapes.AddLine(0 0 800 0) bb[2]=Shapes.AddLine(0 0 0 600) bb[3]=Shapes.AddLine(800 0 800 600) bb[4]=Shapes.AddLine(800 600 0 600) GraphicsWindow.PenWidth=2 cr=Text.GetCharacter(13) ds=Text.GetCharacter(10) tb=Text.GetCharacter(9) yf=1 oy=0 nln=cr+ds GraphicsWindow.FontSize=14 bt1=Controls.AddButton(" CLS " 810 1) bt2=Controls.AddButton(" LOAD " 810 41) bt3=Controls.AddButton(" NEW " 880 1) bt4=Controls.AddButton(" SAVE " 880 41) bt5=Controls.AddButton(" LIST " 810 81) bt6=Controls.AddButton(" LLIST " 880 81) bt7=Controls.AddButton(" RUN " 810 121) 'GraphicsWindow.MouseMove=mmm Controls.ButtonClicked=bcc sub mmm GraphicsWindow.Title=GraphicsWindow.Mousex+" : "+GraphicsWindow.MouseY EndSub Sub execprg GraphicsWindow.Title="run>>" GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 800 600) GraphicsWindow.BrushColor="black lls=LDList.CreateFromValues(prg) If dbgg Then lbx=LDControls.AddListBox(lls 200 400) Controls.Move(lbx 600,10) EndIf For x=1 To LDList.Count(lls) q=LDList.GetAt(lls x) 'TextWindow.WriteLine(q) For m1=1 To Array.GetItemCount(q) qq=LDText.Split(ldtext.Replace (ldtext.Replace (q[m1] "~" " ") "," " ") " ") fs=LDText.Trim( Text.ConvertToLowerCase(qq[1])) ' TextWindow.WriteLine(qq) If fs="let" Then mmv[qq[2]]=ldcall.Function("eval" qq[3]) ElseIf fs="input" Then mmv[qq[2]]=FCDialogs.AskForTextLine(qq[3]) ElseIf fs="print" Then TextWindow.WriteLine(ldmath.Evaluate2 (0+ldcall.Function("eval" qq[2]))) ElseIf fs="?" Then TextWindow.WriteLine( qq[2]) ElseIf fs="coord" Then yf=qq[2] oy=qq[3] ElseIf fs="ffill" Then nn=qq[4] ccw=nn If nn*1=nn and nn<8 Then ccw=clm[nn] EndIf LDGraphicsWindow.FloodFill(qq[2] qq[3] ccw) ElseIf fs="plot" Then lx=ldcall.Function("meval" qq[2]) ly=ldcall.Function("meval" qq[3])*yf+oy ' TextWindow.WriteLine("p:"+lx+"|"+ly) GraphicsWindow.DrawLine(lx ly lx ly) ElseIf fs="draw" Then nx=ldcall.Function("meval" qq[2])+lx ny=ldcall.Function("meval" qq[3])*yf+ly GraphicsWindow.DrawLine(lx ly nx ny) lx=nx ly=ny ' TextWindow.WriteLine("d>"+lx+"|"+ly) ElseIf fs="inc" Then mmv[qq[2]]=mmv[qq[2]]+1 ElseIf fs="dec" Then mmv[qq[2]]=mmv[qq[2]]-1 ElseIf fs="djnz" Then mmv["bc"]=mmv["bc"]-1 If mmv["bc"]>=0 Then x=x-qq[2]-1 EndIf ElseIf fs="line" Then GraphicsWindow.DrawLine(qq[2] qq[3] qq[4] qq[5]) lx=ldcall.Function("meval" qq[4]) ly=ldcall.Function("meval" qq[5]) ElseIf fs="rect" Then GraphicsWindow.FillRectangle(qq[2] qq[3] qq[4] qq[5] ) ElseIf fs="circle" Then rr=qq[4] sx=qq[2]-rr sy=qq[3]-rr If qq[5] Then GraphicsWindow.fillEllipse(sx sy*yf+oy rr*2 rr*2) Else GraphicsWindow.DrawEllipse(sx sy*yf+oy rr*2 rr*2) EndIf ElseIf fs="paper" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf fs="ink" Then nn=qq[2] If nn*1=nn and nn<8 Then GraphicsWindow.BrushColor=clm[nn] GraphicsWindow.PenColor=clm[nn] Else GraphicsWindow.BrushColor=nn GraphicsWindow.penColor=nn EndIf EndIf EndFor EndFor GraphicsWindow.Title="stop[] EndSub'------------------ Sub eval'========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ww EndSub'----------------------- Sub meval'========================== ww=args[1] ii=Array.GetAllIndices(mmv) For xx=1 To Array.GetItemCount(mmv) ww=LDText.Replace(ww "%"+ii[xx] mmv[ii[xx]]) EndFor return=ldmath.Evaluate2( ww+"+0") EndSub'----------------------- While 1=1 If rnn Then execprg() rnn="false EndIf TextWindow.Write(">") ll=textWindow.Read() lll=LDText.Split(ll ":") rm="true For xl=1 To Array.GetItemCount(lll) ll0=lll[xl] If xl>1 Then rm="false EndIf cc=LDText.Split(text.ConvertToLowerCase (ldtext.Replace (ll0 "=" "~")) " ") If rm and text.StartsWith (cc[1] "pap") Then nn=cc[2] If nn*1=nn and nn<8 Then GraphicsWindow.BackgroundColor=clm[nn] Else GraphicsWindow.BackgroundColor=nn EndIf ElseIf rm and cc[1]="run" Then rnn="true ElseIf cc[1]*1=cc[1] Then prg[cc[1]][xl]=text.ConvertToUpperCase( cc[2])+" "+cc[3]+" "+cc[4]+" "+cc[5]+" "+cc[6] rm="False ElseIf rm and text.StartsWith (cc[1] "lli") Then llst() ElseIf rm and text.StartsWith (cc[1] "lis") Then Shapes.Remove(tx) slst() ElseIf rm and text.StartsWith (cc[1] "loa") Then loadd() ElseIf rm and text.StartsWith (cc[1] "bor") Then nn=cc[2] If nn*1=nn and nn<8 Then For r=1 To 4 LDShapes.PenColour(bb[r] clm[nn]) EndFor Else For r=1 To 4 LDShapes.PenColour(bb[r] nn) EndFor EndIf EndIf EndFor EndWhile Sub llst TextWindow.WriteLine("List:") For x=1 To 999 If Text.GetLength(prg[x])>0 Then TextWindow.Write(x+tb) ic=Array.GetItemCount(prg[x]) For m=1 To ic-1 TextWindow.Writeline(prg[x][m] +" | ") EndFor TextWindow.WriteLine( prg[x][ic]+"<<") EndIf EndFor EndSub Sub slst yy=5 Shapes.SetOpacity(bb[4] 5) For x=1 To 999 If Text.GetLength(prg[x])>0 Then tt=Shapes.AddText(x) Shapes.Move(tt 10 yy) ic=Array.GetItemCount(prg[x]) tw="" For m=1 To ic-1 tw=tw+(prg[x][m] ) tt=Shapes.AddText(tw) Shapes.Move(tt 55 yy) yy=yy+25 tw="" EndFor tw=tw+( prg[x][ic]+"<<") tt=Shapes.AddText(ldtext.Replace (tw "~" "=")) Shapes.Move(tt 55 yy) yy=yy+25 EndIf EndFor EndSub Sub bcc qq=Controls.LastClickedButton If qq=bt2 Then loadd() ElseIf qq=bt6 Then llst() ElseIf qq=bt7 Then rnn="true LDTextWindow.SendKey(TextWindow.Title "Return") ElseIf qq=bt5 Then Shapes.Remove(tx) slst() EndIf EndSub Sub loadd ff=LDDialogs.OpenFile("1=txt;2=tap;3=mem" "e:\" ) ff=Text.ConvertToLowerCase(ff) If Text.IsSubText(ff ".txt") Then ' The following line could be harmful and has been automatically commented. ' fff=File.ReadContents(ff) fff=LDText.Replace(fff nln ds) fff=LDText.Replace(fff cr ds) mm=LDText.Split(fff ds) ac=Array.GetItemCount(mm) lc=0 TextWindow.WriteLine("Loaded:") For f=1 To ac ln=LDText.Split(mm[f] "|") If ln[1]*1=ln[1] Then ln[2]=LDText.Replace(ln[2] "THEN" "Then...:") prg[ln[1]]=ldtext.Split( ln[2] ":") lc=lc+1 TextWindow.WriteLine(ln[1]+tb+prg[ln[1]]) EndIf EndFor GraphicsWindow.ShowMessage("lines parsed: "+lc+ds+"total lines:"+ac ff) EndIf EndSub End>RVG805.sb< Start>RVG849-1.sb< ' Capricornus 0.21 ' やぎ ' January ' Copyright © 2013-2016 Nonki Takahashi. The MIT License. ' ' History: ' 0.21 2016-01-06 Changed calendar for 2016. (RVG849-1) ' 0.1 2013-01-03 Created from Serpens 0.1 (RSH103). (RVG849) ' 0.0 2013-01-03 19:47:07 Generated by Shapes 1.5 ' ' Reference: ' http://en.wikipedia.org/wiki/List_of_stars_in_Capricornus ' GraphicsWindow.Title = "Capricornus 0.21" GraphicsWindow.BackgroundColor = "MidnightBlue" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh InitStars() num = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) Shapes_Init() ' initialize shapes scale = 1.2 Shapes_Add() ' add shapes angle = 0 DrawGrids() GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DarkGray" For i = 1 To num e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y Shapes.AddLine(x1, y1, x2, y2) EndFor num = Array.GetItemCount(star) index = Array.GetAllIndices(star) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() mag = star[index[i]]["Mag"] d = 20 / mag ell = Shapes.AddEllipse(d, d) Shapes.Move(ell, x - d / 2, y - d / 2) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 30 GraphicsWindow.DrawText(40, 50, "January") GraphicsWindow.FontSize = 40 year = 2016 GraphicsWindow.DrawText(40, 90, year) Cal_Init() sBuf = year + ",1" Command_GetArgs() iYear = sArg[1] if iYear = "" Then Goto lEnd Endif If Math.Remainder(iYear, 4) = 0 And Math.Remainder(iYear, 100) > 0 Or Math.Remainder(iYear, 400) = 0 Then iDoM[2] = iDoM[2] + 1 Endif iNoL = Math.Floor((iYear - 1) / 4) - Math.Floor((iYear - 1) / 100) + Math.Floor((iYear - 1) / 400) ' number of leap year iWoY = Math.Remainder((iYear + iNoL), 7) ' week of year iMonth = sArg[2] If iMonth = "" Then iM0 = 1 iM1 = 12 Else iM0 = iMonth iM1 = iMonth Endif iDoY = 0 ' days of year iNoM = 1 ' number of month For iM = iM0 To iM1 While iNoM < iM iDoY = iDoY + iDoM[iNoM] iNoM = iNoM + 1 EndWhile Cal_DrawMonth() EndFor lEnd: ' Blink start While "True" Program.Delay(2900) Shapes.HideShape(shape[12]["obj"]) Program.Delay(100) Shapes.ShowShape(shape[12]["obj"]) EndWhile ' end of main Sub Cal_Init ' Calendar | Initialize days of month CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) iDoM = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;" EndSub Sub Cal_DrawMonth ' Calendar | Print month ' param iM - month ' param iDoY - days of year ' param iWoY - week of year GraphicsWindow.FontSize = 16 GraphicsWindow.FontName = "Courier New" GraphicsWindow.FontName = "Consolas" iW = Math.Remainder((iDoY + iWoY), 7) line = "SUN MON TUE WED THU FRI SAT" + CRLF iWoM = 0 While iWoM < iW line = line + " " iWoM = iWoM + 1 EndWhile For iD = 1 To iDoM[iM] If iD < 10 Then line = line + " " + iD + " " Else line = line + " " + iD + " " EndIf If Math.Remainder(iWoM, 7) = 6 Then line = line + CRLF EndIf iWoM = iWoM + 1 EndFor If Math.Remainder(iWoM, 7) > 0 Then line = line + CRLF EndIf cal = Shapes.AddText(line) Shapes.Move(cal, 324, 260) EndSub Sub Command_GetArgs ' Command line | Get arguments ' param sBuf - input buffer ' return sArg[] - arguments ' return iN - number of arguments iP = 1 ' buffer pointer iN = 1 ' number of args iC = Text.GetIndexOf(sBuf, ",") ' index of comma While iC > iP sArg[iN] = Text.GetSubText(sBuf, iP, iC - iP) iP = iC + 1 iN = iN + 1 iC = Text.GetIndexOf(sBuf, ",") EndWhile iE = Text.GetLength(sBuf) + 1 ' end of buffer sArg[iN] = Text.GetSubText(sBuf, iP, iE - iP) EndSub Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" y1 = 0 y2 = GraphicsWindow.Height For ra = 19 To 22 RADec2XY() Shapes.AddLine(x, y1, x, y2) EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -30 To 0 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() Shapes.AddLine(x1, y, x2, y) EndFor EndSub Sub RADec2XY ' param ra, dec ' return x, y x = Text.GetSubText(ra, 1, 2) x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = 30 - (x - 22) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = 100 - y * 3600 / 360 EndSub Sub InitStars ' Initialize stars in Capricornus ' index: Flamsteed designation ' RA (Right ascension), Dec (Declination), Mag (Apparent magnitude) star[49] = "name=δ Cap;ra=21 47 02.29;dec=-16 07 35.6;mag=2.85;" star[9] = "name=β1 Cap;ra=20 21 00.65;dec=-14 46 53.0;mag=3.05;" star[6] = "name=α2 Cap;ra=20 18 03.22;dec=-12 32 41.5;mag=3.58;" star[40] = "name=γ Cap;ra=21 40 05.34;dec=-16 39 44.1;mag=3.69;" star[34] = "name=ζ Cap;ra=21 26 40.03;dec=-22 24 41.0;mag=3.77;" star[23] = "name=θ Cap;ra=21 05 56.78;dec=-17 13 57.8;mag=4.08;" star[18] = "name=ω Cap;ra=20 51 49.30;dec=-26 55 08.9;mag=4.12;" star[16] = "name=ψ Cap;ra=20 46 05.77;dec=-25 16 13.9;mag=4.13;" star[32] = "name=ι Cap;ra=21 22 14.78;dec=-16 50 04.4;mag=4.27;" star[5] = "name=α1 Cap;ra=20 17 38.86;dec=-12 30 29.6;mag=4.30;" star[24] = "name=24 Cap;ra=21 07 07.69;dec=-25 00 20.7;mag=4.49;" star[36] = "name=36 Cap;ra=21 28 43.32;dec=-21 48 25.8;mag=4.50;" star[39] = "name=ε Cap;ra=21 37 04.82;dec=-19 27 57.6;mag=4.51;" star[43] = "name=κ Cap;ra=21 42 39.42;dec=-18 51 58.7;mag=4.72;" star[8] = "name=ν Cap;ra=20 20 39.81;dec=-12 45 32.6;mag=4.77;" star[11] = "name=ρ Cap;ra=20 28 51.62;dec=-17 48 49.2;mag=4.77;" star[22] = "name=η Cap;ra=21 04 24.32;dec=-19 51 17.8;mag=4.82;" star[51] = "name=μ Cap;ra=21 53 17.58;dec=-13 33 06.5;mag=5.07;" star[10] = "name=π Cap;ra=20 27 19.20;dec=-18 12 42.1;mag=5.08;" star[46] = "name=46 Cap;ra=21 45 00.25;dec=-09 04 56.7;mag=5.10;" star[15] = "name=υ Cap;ra=20 40 02.96;dec=-18 08 19.0;mag=5.15;" star[42] = "name=42 Cap;ra=21 41 32.93;dec=-14 02 48.7;mag=5.16;" star[28] = "name=φ Cap;ra=21 15 37.89;dec=-20 39 06.1;mag=5.17;" star[14] = "name=τ2 Cap;ra=20 39 16.32;dec=-14 57 17.0;mag=5.24;" star[41] = "name=41 Cap;ra=21 42 00.64;dec=-23 15 45.5;mag=5.24;" star[7] = "name=σ Cap;ra=20 19 23.60;dec=-19 07 06.6;mag=5.28;" star[25] = "name=χ Cap;ra=21 08 33.61;dec=-21 11 36.7;mag=5.30;" star[29] = "name=29 Cap;ra=21 15 44.83;dec=-15 10 17.4;mag=5.31;" star[33] = "name=33 Cap;ra=21 24 09.60;dec=-20 51 05.6;mag=5.38;" star[30] = "name=30 Cap;ra=21 17 57.28;dec=-17 59 06.5;mag=5.40;" star[48] = "name=λ Cap;ra=21 46 32.08;dec=-11 21 57.4;mag=5.57;" star[37] = "name=37 Cap;ra=21 34 51.07;dec=-20 05 03.8;mag=5.70;" star[19] = "name=19 Cap;ra=20 54 47.85;dec=-17 55 22.3;mag=5.78;" star[35] = "name=35 Cap;ra=21 27 14.83;dec=-21 11 46.1;mag=5.78;" star[2] = "name=ξ2 Cap;ra=20 12 25.76;dec=-12 37 01.3;mag=5.84;" star[4] = "name=4 Cap;ra=20 18 01.38;dec=-21 48 35.6;mag=5.86;" star[44] = "name=44 Cap;ra=21 43 04.40;dec=-14 23 59.1;mag=5.88;" star[17] = "name=17 Cap;ra=20 46 09.97;dec=-21 30 50.4;mag=5.91;" star[12] = "name=ο Cap A;ra=20 29 53.89;dec=-18 34 58.7;mag=5.94;" star[45] = "name=45 Cap;ra=21 44 00.98;dec=-14 44 57.8;mag=5.96;" star[47] = "name=47 Cap;ra=21 46 16.26;dec=-09 16 33.4;mag=6.00;" star[21] = "name=21 Cap;ra=21 00 51.78;dec=-17 31 51.1;mag=6.07;" star[27] = "name=27 Cap;ra=21 09 32.93;dec=-20 33 22.8;mag=6.25;" star[20] = "name=20 Cap;ra=20 59 36.13;dec=-19 02 06.8;mag=6.26;" star[3] = "name=3 Cap;ra=20 16 22.80;dec=-12 20 13.5;mag=6.30;" star[1] = "name=ξ1 Cap;ra=20 11 57.90;dec=-12 23 32.5;mag=6.34;" star[12] = "name=ο Cap B;ra=20 29 52.58;dec=-18 35 10.2;mag=6.74;" star[13] = "name=τ1 Cap;ra=20 37 21.16;dec=-15 08 50.0;mag=6.76;" star[50] = "name=50 Cap;ra=21 46 42.09;dec=-11 41 52.2;mag=7.01;" star[31] = "name=31 Cap;ra=21 18 15.64;dec=-17 27 44.2;mag=7.07;" edge = "1=6-9;2=9-16;3=16-18;4=18-34;5=34-49;6=49-40;7=40-32;" edge = edge + "8=32-23;9=23-9;" EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 10 ' x offset shY = 121 ' y offset shape = "" shape[1] = "func=rect;x=191;y=68;width=44;height=86;bc=#83809C;pw=0;" shape[2] = "func=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0;" shape[3] = "func=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0;" shape[4] = "func=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16;" shape[5] = "func=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16;" shape[6] = "func=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16;" shape[7] = "func=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16;" shape[8] = "func=ell;x=1;y=82;width=97;height=99;bc=#83809C;pw=0;" shape[9] = "func=ell;x=59;y=72;width=144;height=87;angle=351;bc=#83809C;pw=0;" shape[10] = "func=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#191970;pw=4;" shape[11] = "func=ell;x=35;y=123;width=15;height=16;bc=#191970;pw=0;" shape[12] = "func=ell;x=210;y=93;width=15;height=16;bc=#191970;pw=0;" shape[13] = "func=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0;" shape[14] = "func=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0;" shape[15] = "func=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4;" shape[16] = "func=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0;" shape[17] = "func=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0;" shape[18] = "func=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4;" shape[19] = "func=text;x=380;y=-80;text=♑;fs=100;bc=#83809C;" EndSub Sub Shapes_Add ' Shapes | Add shapes as shapes data ' param shape - array of shapes ' param scale - to zoom ' return nShapes - number of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) nShapes = Array.GetItemCount(shape) s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddRectangle(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddEllipse(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddTriangle(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s, shape[i]["x3"] * s, shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then shape[i]["obj"] = Shapes.AddLine(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s) ElseIf shape[i]["func"] = "text" Then GraphicsWindow.BrushColor = shape[i]["bc"] GraphicsWindow.FontSize = shape[i]["fs"] shape[i]["obj"] = Shapes.AddText(shape[i]["text"]) EndIf Shapes.Move(shape[i]["obj"], shX + shape[i]["x"] * s, shY + shape[i]["y"] * s) If Text.IsSubText("rect|ell|tri", shape[i]["func"]) And shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf shape[i]["rx"] = shape[i]["x"] shape[i]["ry"] = shape[i]["y"] EndFor shAngle = 0 i = Stack.PopValue("local") EndSub End>RVG849-1.sb< Start>RVG849.sb< ' Capricornus 0.1 ' Copyright (c) 2013 Nonki Takahashi. All rights reserved. ' ' History: ' 0.1 2013/01/03 Created from Serpens 0.1 (RSH103). () ' 0.0 2013/01/03 19:47:07 Generated by Shapes 1.5 ' ' Reference: ' http://en.wikipedia.org/wiki/List_of_stars_in_Capricornus ' GraphicsWindow.Title = "Capricornus 0.1" GraphicsWindow.BackgroundColor = "MidnightBlue" InitStars() num = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) Shapes_Init() ' initialize shapes scale = 1.2 Shapes_Add() ' add shapes angle = 0 DrawGrids() GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DarkGray" For i = 1 To num e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y Shapes.AddLine(x1, y1, x2, y2) EndFor num = Array.GetItemCount(star) index = Array.GetAllIndices(star) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() mag = star[index[i]]["Mag"] d = 20 / mag ell = Shapes.AddEllipse(d, d) Shapes.Move(ell, x - d / 2, y - d / 2) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 30 GraphicsWindow.DrawText(40, 50, "January") GraphicsWindow.FontSize = 40 GraphicsWindow.DrawText(40, 90, "2013") Cal_Init() sBuf = "2013,1" Command_GetArgs() iYear = sArg[1] if iYear = "" Then Goto lEnd Endif If Math.Remainder(iYear, 4) = 0 And Math.Remainder(iYear, 100) > 0 Or Math.Remainder(iYear, 400) = 0 Then iDoM[2] = iDoM[2] + 1 Endif iNoL = Math.Floor((iYear - 1) / 4) - Math.Floor((iYear - 1) / 100) + Math.Floor((iYear - 1) / 400) ' number of leap year iWoY = Math.Remainder((iYear + iNoL), 7) ' week of year iMonth = sArg[2] If iMonth = "" Then iM0 = 1 iM1 = 12 Else iM0 = iMonth iM1 = iMonth Endif iDoY = 0 ' days of year iNoM = 1 ' number of month For iM = iM0 To iM1 While iNoM < iM iDoY = iDoY + iDoM[iNoM] iNoM = iNoM + 1 EndWhile Cal_DrawMonth() EndFor lEnd: ' Blink start While "True" Program.Delay(2900) Shapes.HideShape(shape[12]["obj"]) Program.Delay(100) Shapes.ShowShape(shape[12]["obj"]) EndWhile ' end of main Sub Cal_Init ' Calender | Initialize days of month CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) iDoM = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;" EndSub Sub Cal_DrawMonth ' Calender | Print month ' param iM - month ' param iDoY - days of year ' param iWoY - week of year GraphicsWindow.FontSize = 16 GraphicsWindow.FontName = "Consolas" iW = Math.Remainder((iDoY + iWoY), 7) line = "SUN MON TUE WED THU FRI SAT" + CRLF iWoM = 0 While iWoM < iW line = line + " " iWoM = iWoM + 1 EndWhile For iD = 1 To iDoM[iM] If iD < 10 Then line = line + " " + iD + " " Else line = line + " " + iD + " " EndIf If Math.Remainder(iWoM, 7) = 6 Then line = line + CRLF EndIf iWoM = iWoM + 1 EndFor If Math.Remainder(iWoM, 7) > 0 Then line = line + CRLF EndIf cal = Shapes.AddText(line) Shapes.Move(cal, 340, 260) EndSub Sub Command_GetArgs ' Command line | Get arguments ' param sBuf - input buffer ' return sArg[] - arguments ' return iN - number of arguments iP = 1 ' buffer pointer iN = 1 ' number of args iC = Text.GetIndexOf(sBuf, ",") ' index of comma While iC > iP sArg[iN] = Text.GetSubText(sBuf, iP, iC - iP) iP = iC + 1 iN = iN + 1 iC = Text.GetIndexOf(sBuf, ",") EndWhile iE = Text.GetLength(sBuf) + 1 ' end of buffer sArg[iN] = Text.GetSubText(sBuf, iP, iE - iP) EndSub Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" y1 = 0 y2 = GraphicsWindow.Height For ra = 19 To 22 RADec2XY() Shapes.AddLine(x, y1, x, y2) EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -30 To 0 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() Shapes.AddLine(x1, y, x2, y) EndFor EndSub Sub RADec2XY x = Text.GetSubText(ra, 1, 2) x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = 30 - (x - 22) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = 100 - y * 3600 / 360 EndSub Sub InitStars ' index: Flamsteed designation ' RA (Right ascension), Dec (Declination), Mag (Apparent magnitude) star[6] = "name=α2 Cap;RA=20 18 03.22;Dec=-12 32 41.5;Mag=3.58;" star[9] = "name=β Cap;RA=20 21 00.65;Dec=-14 46 53.0;Mag=3.05;" star[16] = "name=ψ Cap;RA=20 46 05.77;Dec=-25 16 13.9;Mag=4.13;" star[18] = "name=ω Cap A;RA=20 51 49.30;Dec=-26 55 08.9;Mag=4.12;" star[34] = "name=ζ Cap;RA=21 26 40.03;Dec=-22 24 41.0;Mag=3.77;" star[49] = "name=δ Cap;RA=21 47 02.29;Dec=-16 07 35.6;Mag=2.85;" star[40] = "name=γ Cap;RA=21 40 05.34;Dec=-16 39 44.1;Mag=3.69;" star[32] = "name=ι Cap;RA=21 22 14.78;Dec=-16 50 04.4;Mag=4.28;" star[23] = "name=θ Cap;RA=21 05 56.78;Dec=-17 13 57.8;Mag=4.08;" edge = "1=6-9;2=9-16;3=16-18;4=18-34;5=34-49;6=49-40;7=40-32;" edge = edge + "8=32-23;9=23-9;" EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 10 ' x offset shY = 121 ' y offset shape = "" shape[1] = "func=rect;x=191;y=68;width=44;height=86;bc=#83809C;pw=0;" shape[2] = "func=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0;" shape[3] = "func=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0;" shape[4] = "func=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16;" shape[5] = "func=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16;" shape[6] = "func=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16;" shape[7] = "func=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16;" shape[8] = "func=ell;x=1;y=82;width=97;height=99;bc=#83809C;pw=0;" shape[9] = "func=ell;x=59;y=72;width=144;height=87;angle=351;bc=#83809C;pw=0;" shape[10] = "func=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#191970;pw=4;" shape[11] = "func=ell;x=35;y=123;width=15;height=16;bc=#191970;pw=0;" shape[12] = "func=ell;x=210;y=93;width=15;height=16;bc=#191970;pw=0;" shape[13] = "func=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0;" shape[14] = "func=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0;" shape[15] = "func=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4;" shape[16] = "func=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0;" shape[17] = "func=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0;" shape[18] = "func=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4;" EndSub Sub Shapes_Add ' Shapes | Add shapes as shapes data ' param shape - array of shapes ' param scale - to zoom ' return nShapes - number of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) nShapes = Array.GetItemCount(shape) s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf If shape[i]["func"] = "rect" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddRectangle(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddEllipse(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "tri" Then GraphicsWindow.BrushColor = shape[i]["bc"] shape[i]["obj"] = Shapes.AddTriangle(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s, shape[i]["x3"] * s, shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then shape[i]["obj"] = Shapes.AddLine(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s) EndIf Shapes.Move(shape[i]["obj"], shX + shape[i]["x"] * s, shY + shape[i]["y"] * s) If Text.IsSubText("rect|ell|tri", shape[i]["func"]) And shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf shape[i]["rx"] = shape[i]["x"] shape[i]["ry"] = shape[i]["y"] EndFor shAngle = 0 i = Stack.PopValue("local") EndSub End>RVG849.sb< Start>RVK712.sb< GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.BackgroundColor = "AntiqueWhite" GraphicsWindow.Width = 1080 GraphicsWindow.height = 420 GraphicsWindow.PenWidth = 10 turtle.speed = 10 dash = 10 ' Dash length space = 3 ' Space length scale = 1.7 'Scale letters baseX = 70 'X Position of left of first letter baseY = 250 'Y Position of bottom of letters 'M Turtle.X = baseX Turtle.Y = baseY angle = "1=0;2=155;3=25;4=180;" length = "1=88;2=70;3=70;4=88;" DrawLetter() 'I Turtle.X = baseX+90*scale Turtle.Y = baseY angle = "1=0;" length = "1=88;" DrawLetter() 'A Turtle.X = baseX+110*scale Turtle.Y = baseY angle = "1=25;2=155;" length = "1=95;2=95;" DrawLetter() Turtle.Turn(180) Turtle.PenUp() Turtle.Move(35*scale) angle = "1=-90;" length = "1=50;" DrawLetter() 'N Turtle.X = baseX+210*scale Turtle.Y = baseY angle = "1=0;2=155;3=0;" length = "1=88;2=95;3=88;" DrawLetter() 'G - special case due to curve Turtle.X = baseX+360*scale Turtle.Y = baseY-69*scale Turtle.Angle = 320 minAngle = 30 DrawArc() Turtle.X = Turtle.X-15*scale angle = "1=90;" length = "1=30;" DrawLetter() 'U Turtle.X = baseX+400*scale Turtle.Y = baseY-88*scale angle = "1=180;2=90;3=0;" length = "1=88;2=60;3=88;" DrawLetter() 'L Turtle.X = baseX+490*scale Turtle.Y = baseY-88*scale angle = "1=180;2=90;" length = "1=88;2=60;" DrawLetter() 'Underline Turtle.X = baseX Turtle.Y = baseY+40*scale angle = "1=90;" length = "1=550;" DrawLetter() Turtle.Hide() Sub DrawLetter For i = 1 To Array.GetItemCount(angle) DrawLine() EndFor EndSub Sub DrawLine Turtle.Angle = angle[i] dist = length[i]*scale While (dist > 0) SetColour() len = Math.Min(dash,dist) Turtle.PenDown() Turtle.Move(len) dist = dist-len len = Math.Min(space,dist) Turtle.PenUp() Turtle.Move(len) dist = dist-len EndWhile EndSub Sub DrawArc While Turtle.Angle > minAngle SetColour() Turtle.PenDown() Turtle.Move(dash) Turtle.Angle = Math.Max(minAngle,Turtle.Angle - 1.3*dash/scale) Turtle.PenUp() Turtle.Move(space) Turtle.Angle = Math.Max(minAngle,Turtle.Angle - 1.3*space/scale) EndWhile EndSub Sub SetColour 'GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() col = col+0.1 R = 255*(1+Math.Cos(col))/2 G = 255*(1+Math.Sin(col/2))/2 B = 255*(1+Math.Sin(col/3))/2 GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(R,G,B) EndSub End>RVK712.sb< Start>RVM680.sb< GraphicsWindow.BackgroundColor ="Darkblue datFile = "e:\datt.db" GraphicsWindow.Title ="Stars of Zodiac GraphicsWindow.Height=900 GraphicsWindow.Width =1500 database = LDDataBase.AddDataBase(datFile) listView = LDDataBase.AddListView(GraphicsWindow.Width,100) LDShapes.BrushColour (listView,"#80ffffff") symbol = LDText.Split("♓ ♈ ♈ ♉ ♉ ♊ ♊ ♋ ♋ ♌ ♌ ♍ ♍ ♍ ♎ ♎ ♏ ♏ ♐ ♐ ♑ ♒ ♒ ♓"," ") nmm= LDText.Split ("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"," ") cnm=LDControls.AddComboBox(nmm,100,500) controls.AddButton("show",10,140) Controls.ButtonClicked =ccb Controls.Move (cnm,60,140) args=0 Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" GraphicsWindow.BrushColor ="Cyan y1 = 110 y2 = GraphicsWindow.Height For ra = 1 To 24 '19 To 22 x = ra * 15*ee GraphicsWindow.drawLine(x, y1, x, y2) GraphicsWindow.DrawText (x,120,(25-ra)+symbol[25-ra]) EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -30 To 30 Step 10 y = e500 - dec * ee GraphicsWindow.PenColor = "DimGray" If dec=0 Then GraphicsWindow.PenColor = "Red" endif GraphicsWindow.drawLine(x1, y, x2, y) EndFor EndSub Sub ccb 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) endsub p14=25 ee=4 e500=500 res=LDDataBase.Query(database, "SELECT * FROM Stars1 order by tx2,mag ", listView, "True") DrawGrids () LDCall.Function ("shstarr",1) Sub shstarr For i = 1 To Array.GetItemCount(res) x=res[i]["rx1"] y=res[i]["ry1"] x = 30 - (x - p14) * 15*ee y = e500 - y * ee mg=res[i]["mag"] d = math.round(20 / mg) If d>20 Then d=20 EndIf If d<2 then GraphicsWindow.SetPixel(x,y,"Green") else If args[1]=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 endif GraphicsWindow .FillEllipse ( x - d / 2, y - d / 2,d,d) endif EndFor EndSub End>RVM680.sb< Start>RVN823.sb< DECLARE SUB Lecturelisting (M!) DECLARE SUB lecture (M!) DECLARE SUB Message (Msg$, Lgn%, Col%) DECLARE SUB ecriture () DECLARE SUB OptionBasEcran (T#) DECLARE SUB SuiteNumero (i!, M!, N!()) DECLARE SUB TITRE (T$) DECLARE SUB EntreeNumero (N$) ON ERROR GOTO TraitErreur CLS DEFDBL D, P-Z: DIM l(200), N(1000), X(1000), Y(1000), ag(200), z(1000), com$(1000), tlg(1000), tnlg(1000) PI = 3.141592654# LIGNE$ = STRING$(80, 126) LEPOL1$ = "No point Coord. X Coord. Y Coord. Z Natpt " LEPOL2$ = "-------- ------------ -------- -------- --------" LEPOL3$ = "###### ######.### ######.### ####.### " CLS TIT1$ = " Point No Coord. X Coord. Y Distance" TIT2$ = " -------- -------- -------- --------" LIG1$ = " ######### ######.### ######.### ######.###" '=========================================== i '===impression du menu general a l'ecran==== '=========================================== TYPE Coordonnees NumPoint AS INTEGER XPoint AS DOUBLE YPoint AS DOUBLE ZPoint AS DOUBLE END TYPE DIM Enregistrement AS Coordonnees T$ = "Calculs topographiques" CLS LOCATE 8, 9: COLOR 1, 7: prt = 10 COLOR 7, 1 Nbr = 10000 donnees$ = "Calculs.TOP": CLS OPEN donnees$ FOR RANDOM AS #2 LEN = LEN(Enregistrement) LOCATE 10, 25: PRINT " Pr�paration de votre disque dur " FOR i = 1 TO Nbr Enregistrement.NumPoint = 0 Enregistrement.XPoint = 0 Enregistrement.YPoint = 0 Enregistrement.ZPoint = 0 PUT #2, i, Enregistrement NEXT LOCATE 15, 25 INPUT "Nom de fichier ", Fichier$ d$ = Fichier$ Fichier$ = "c:\qb\" + Fichier$ + ".txt" REM dossier de rangement des donn�es!!! LOCATE prt, 22: COLOR 7, 1 IF ERR = 53 THEN GOTO afficadre OPEN Fichier$ FOR INPUT AS #1 charge: en = 0: i = 0 DO WHILE NOT EOF(1) LINE INPUT #1, pol$ IF LEN(pol$) = 74 THEN i = 1 IF LEN(pol$) = 75 THEN i = 2 IF LEN(pol$) = 76 THEN i = 3 IF LEN(pol$) = 77 THEN i = 4 X = VAL(MID$(pol$, (32 + i), 10)) Y = VAL(MID$(pol$, (46 + i), 10)) z = VAL(MID$(pol$, (58 + i), 8)) N = VAL(MID$(pol$, (2), (2 + i))) IF bloc$ <> "Id" THEN Enregistrement.NumPoint = N Enregistrement.XPoint = X Enregistrement.YPoint = Y Enregistrement.ZPoint = z en = en + 1: i = 0 PUT #2, en, Enregistrement END IF LOOP Ndeb = 1: Nfin = en PRINT "Compteur de ligne : "; en a = 1 afficadre: CLS c = 0 ch$ = "123" LOCATE 1, 1: PRINT "�" + STRING$(78, "�") + "�"; FOR z = 1 TO 18 LOCATE 1 + z, 1: PRINT "�" + SPACE$(78) + "�"; NEXT z LOCATE 1 + z, 1: PRINT "�" + STRING$(78, "�") + "�"; LOCATE 2, 3: PRINT "Ver. HP200LX" LOCATE 2, 70: PRINT DATE$ LOCATE 3, 60: PRINT "Points charg�s "; en LOCATE 2, ((80 - LEN(" Topographie ")) / 2): PRINT " Topographie " LOCATE 3, 25: PRINT " 1. Calcul de points polaires ": LOCATE 5, 25: PRINT " 2. Calcul de points orthogonaux ": LOCATE 7, 25: PRINT " 3. Calcul de surface ": LOCATE 9, 25: PRINT " 4. Rabattements polaires ": LOCATE 11, 25: PRINT " 5. Rabattements orthogonaux ": LOCATE 13, 25: PRINT " 6. Intersection de droites ": LOCATE 15, 25: PRINT " 7. Gestion des Fichiers ": LOCATE 17, 24: PRINT " 10. Fin des calculs ": LOCATE 19, 24: INPUT " Votre choix ", ch$ CLS SELECT CASE ch$ CASE IS = "1" GOTO LEVERPOLAIRES CASE IS = "2" GOTO LEVERORTHOGONAUX CASE IS = "3" GOTO surface CASE IS = "4" GOTO RABATTEMENTSPOLAIRES CASE IS = "5" GOTO RABATTEMENTSORTHOGONAUX CASE IS = "10" GOTO FINDESCALCULS CASE IS = "6" GOTO INTERSECTION CASE IS = "7" GOTO LECTUREDEDONNEESSURDISQUE CASE IS = "" GOTO afficadre END SELECT '================================================================== '============== Module du Calcul de Surface======================== '================================================================== surface: CLS T$ = " S U R F A C E " TITRE (T$) c = 1 M = 1: i = 1 IF c = 0 THEN GOTO afficadre ELSEIF c = 1 THEN CLS GOTO LEC ELSE GOTO surface END IF LEC: TITRE (T$) LOCATE 23, 10: PRINT "Pour une suite de num�ros Tapez . puis le dernier numero" LECTUREDISQUE: CALL EntreeNumero(N$) N(i) = VAL(N$) IF i = 1 THEN LOCATE 3, 14: PRINT , "Le premier point de la surface est "; N(i); " ": END IF IF N$ = "." THEN CALL SuiteNumero(i, M, N()) ELSEIF N(i) = 0 THEN GOTO LECTUREDONNEES ELSEIF N(i) > 1010 THEN GOTO LECTUREDISQUE ELSEIF M = 18 THEN GOSUB EFFACEMENTECRAN M = O: LOCATE 5 + M, 25: PRINT "NUMERO DU POINT "; N(i) END IF i = i + 1: M = M + 1 GOTO LECTUREDISQUE LECTUREDONNEES: FOR b = 1 TO i - 1 a = b M = N(b) CALL lecture(M) NEXT b RESET CALCULSURFACE: max = i - 1: S = 0 Y(0) = Y(max): Y(max + 1) = Y(1): X(max + 1) = X(1) FOR i = 1 TO max l(i) = SQR((X(i + 1) - X(i)) ^ 2 + (Y(i + 1) - Y(i)) ^ 2) p = X(i) * (Y(i + 1) - Y(i - 1)) S = S + p NEXT i S = S / 2 S = INT(S + .5) '--impression ecran--- '--------------------- CLS : TITRE (T$) LOCATE 3, 13: PRINT , "Pour la suite de l'affichage appuyer sur une touche ": LOCATE 5, 13: PRINT "N� pt X Y Dist ": PRINT a = 1: i = 1 DO IF N(i) < Nbr THEN PRINT USING LIG1$; N(i); X(i); Y(i); l(i) END IF i = i + 1: a = a + 1 IF a = 16 THEN WHILE INKEY$ = "": WEND a = 0 CLS TITRE (T$) LOCATE 3, 13: PRINT , "Pour la suite de l'affichage appuyer sur une touche ": LOCATE 5, 13: PRINT , "N� pt X Y Dist ": PRINT END IF LOOP WHILE i < max + 1 PRINT PRINT " S U R F A C E : "; S; "M2": N(max + 1) = N(1) ECRAN: CALL OptionBasEcran(T) IF T = 4 THEN RUN "droites" ELSEIF T = 1 THEN CLS GOTO surface ELSEIF T = 3 THEN GOTO CALCULSURFACE ELSEIF T = 5 THEN GOTO afficadre END IF '=========================================================================== '--------- CALCULS DE POINTS LEVES PAR LA METHODE POLAIRE '=========================================================================== LEVERPOLAIRES: T$ = " LEVERS POLAIRES " CLS : TITRE (T$): l = 0: i = 1: flag = 0 REM Nom des fichiers de donn�es � calculer !!! INPUT "Calculs fichier **.gsi O/N ", z$ z$ = UCASE$(z$) REM A voire??????????????????????????????????????????????????????????????? IF z$ = "O" THEN a = 1 N(a) = 1000: M = 1000 XS = 1000: YS = 1000: NS = 1000: ZS = 10 LOCATE 6, 2: PRINT USING LEPOL3$; N(a); XS; YS; ZS a = a + 1 N(a) = 1001: M = N(a) XO = 1000: YO = 1200: NO = N(a): ZO = 10 LOCATE 7, 2: PRINT USING LEPOL3$; N(a); XO; YO; ZO l = 0 Dx = XO - XS: Dy = YO - YS IF Dy = 0 THEN Dy = .00000001# IF Dx = 0 THEN Dx = .00000001# gt = ATN(Dx / Dy) IF Dy < 0 AND Dx > 0 THEN gt = gt - PI IF Dy < 0 AND Dx < 0 THEN gt = PI + gt IF Dy > 0 AND Dx < 0 THEN gt = 2 * PI + gt gt = gt * 200 / PI DB = SQR(Dx ^ 2 + Dy ^ 2) LOCATE 8, 20: : PRINT "DIT.BASE: "; USING "####.###"; DB: h = 0 LOCATE 9, 1: PRINT LIGNE$ LOCATE 10, 1: PRINT "No pt Com Angle horizontal Distance horizontal Delta H " pol$ = "" CLOSE : OPEN d$ + ".gsi" FOR INPUT AS #3 suitelec: WHILE NOT EOF(3) LINE INPUT #3, pol$ PRINT pol$ bloc = VAL(MID$(pol$, 1, 2)) IF bloc = 41 THEN GOTO suitelec numpt = VAL(MID$(pol$, 10, 6)) anghz = VAL(MID$(pol$, 24, 8)) anghz = anghz / 100000 anghz = anghz - angouvhz IF anghz < 0 THEN anghz = 400 + anghz angve = VAL(MID$(pol$, 40, 8)) angve = angve / 100000 disto = VAL(MID$(pol$, 56, 8)) disto = disto / 1000 T = angve * PI / 200 a = SIN(T): b = COS(T) Dh = disto * a PRINT Dh Dz = disto * -b PRINT Dz ag = anghz + gt IF ag < 0 THEN ag = ag + 400 T = ag * PI / 200 a = SIN(T): b = COS(T) X(i) = XS + disto * a Y(i) = YS + disto * b z(i) = ZS + Dz N(i) = numpt PRINT USING LEPOL3$; N(i); X(i); Y(i); z(i); IF Nfin < N(i) THEN Nfin = N(i) CALL ecriture i = i + 1 WEND Ndeb = N(1): Nfin = N(i - 1) GOTO IMPRESSIONPOLAIREECRAN END IF manuel: a = 1 CLS LOCATE 10, 5: INPUT " No de Station ", nstat LOCATE 12, 5: INPUT " No de l'Ouverture ", nouv LOCATE 14, 5: INPUT " Angle d'Ouverture ", angouvhz CLS GOSUB calculbase introdonnees: LOCATE 14, 10 INPUT "N� Pt � calculer ", numpt IF Ndeb > N(i) THEN Ndeb = N(i) IF Nfin < N(i) THEN Nfin = N(i) IF numpt = 0 THEN GOTO IMPRESSIONPOLAIREECRAN: LOCATE 15, 10 INPUT "Angle horizontal ", anghz angouvhz = anghz - angouvhz IF anghz < 0 THEN anghz = 400 + anghz LOCATE 16, 10 INPUT "Distance horizontale ", dist LOCATE 17, 10 INPUT "D�nivel�e ", deltaH Dz = deltaH ag = anghz + gt IF ag < 0 THEN ag = ag + 400 T = ag * PI / 200 a = SIN(T): b = COS(T) X(i) = XS + dist * a Y(i) = YS + dist * b z(i) = ZS + Dz N(i) = numpt PRINT USING LEPOL3$; N(i); X(i); Y(i); z(i) IF Nfin < N(i) THEN Nfin = N(i) CALL ecriture i = i + 1 LOCATE 14, 10: PRINT " " LOCATE 15, 10: PRINT " " LOCATE 16, 10: PRINT " " LOCATE 17, 10: PRINT " " GOTO introdonnees '--- impression a l'ecran-- '--------------------------- IMPRESSIONPOLAIREECRAN: CLS : TITRE (T$) CLS LOCATE 2, 15: PRINT " COORDONNEES DE LA BASE " LOCATE 3, 15: PRINT LEPOL1$ LOCATE 4, 15: PRINT LEPOL2$ LOCATE 6, 1: PRINT "ST=>"; USING LIG1$; NS; XS; YS; ZS PRINT "OR=>"; USING LIG1$; NO; XO; YO; ZO PRINT LOCATE 8, 19: PRINT "DIT.BASE: "; USING "####.###"; DB PRINT c = 1 FOR a = 1 TO i - 1 CALL lecture(N(a)) PRINT USING LEPOL3$; N(a); X(a); Y(a); z(a) IF c = 13 THEN PRINT "Appuyez sur une touche pour la suite des points " SLEEP CLS LOCATE 2, 15: PRINT " COORDONNEES DE LA BASE " LOCATE 3, 15: PRINT LEPOL1$ LOCATE 4, 15: PRINT LEPOL2$ LOCATE 6, 1: PRINT "ST=>"; USING LIG1$; NS; XS; YS; ZS PRINT "OR=>"; USING LIG1$; NO; XO; YO; ZO c = 0 END IF NEXT SLEEP CLOSE #3 GOTO afficadre '================================================ 'Calcul d'une base en conaissant nstat et nouv = polaire HP LX200 '================================================ GOTO afficadre '-------------------------------------------------------------- '-------Calcul de points par la methode orthogonale------------ '-------------------------------------------------------------- LEVERORTHOGONAUX: T$ = "LEVERS ORTHOGONAUX" CLS : TITRE (T$): l = 1 LOCATE 5, 10 INPUT "Num�ro de station : ", nstat LOCATE 6, 10 INPUT "Num�ro de station : ", nouv GOSUB calculbase LOCATE 11, 46: PRINT " Distance mesur�e : ": LOCATE 11, 65: INPUT DM: IF DM = 0 THEN DM = DB cm = DB / DM BASE$ = "Base calcul�e : " + MID$(STR$(DB), 1, 7) + " Distance mesur�e : " + MID$(STR$(DM), 1, 7) lg = LEN(BASE$) Col = INT((85 - lg) / 2) LOCATE 10, Col: PRINT STRING$(lg - 10, 45) LOCATE 11, 1: PRINT STRING$(78, 32) LOCATE 11, Col: PRINT BASE$: LOCATE 12, Col: PRINT STRING$(lg, 45) LOCATE 13, 7: PRINT " N� Abscisse Ordonnee" i = 1: M = 1 DONNEESLEVERSORTHOGONAUX: LOCATE 13 + M, 8: INPUT ; N(i) IF Ndeb > N(i) THEN Ndeb = N(i) IF Nfin < N(i) THEN Nfin = N(i) IF N(i) = 0 THEN GOTO ECRANLEVERORTHOGONAUX LOCATE 13 + M, 28: INPUT T: IF T = 0 THEN T = .000001 T = T * cm LOCATE 13 + M, 44: INPUT z ag = ATN(z / T) ag = (gt * PI / 200) - ag IF T < 0 THEN ag = ag + PI a = SIN(ag) b = COS(ag) l = SQR(T ^ 2 + z ^ 2) X(i) = XS + l * a Y(i) = YS + l * b IF Nfin < N(i) THEN Nfin = N(i) CALL ecriture 'LOCATE 13 + M, 65: INPUT ; z(i) IF M = 7 THEN FOR M = -2 TO 7 LOCATE 15 + M, 22 PRINT SPACE$(65) NEXT M: M = 0 LOCATE 13 + M, 28: PRINT N(i), T, z END IF i = i + 1: M = M + 1 GOTO DONNEESLEVERSORTHOGONAUX '--------------------- '-- IMPRESSION ECRAN-- '--------------------- ECRANLEVERORTHOGONAUX: CLS : TITRE (T$) LOCATE 4, 21: PRINT " COORDONNEES DE LA BASE " LOCATE 5, 21: PRINT LEPOL1$ LOCATE 6, 21: PRINT LEPOL2$ LOCATE 8, 4: PRINT "ST=>"; PRINT USING LEPOL3$; NS; XS; YS; ZS LOCATE 9, 4: PRINT "OV=>"; PRINT USING LEPOL3$; NO; XO; YO; ZO LOCATE 12, Col: PRINT STRING$(lg, 45) : LOCATE 13, Col: PRINT BASE$: : PRINT LOCATE 14, Col: PRINT STRING$(lg, 45) FOR a = 1 TO i - 1 PRINT USING LEPOL3$; N(a); X(a); Y(a); z(a) NEXT a RESET SLEEP GOTO afficadre calculbase: a = 1 N(a) = nstat: M = nstat CALL lecture(M) XS = X(a): YS = Y(a): NS = N(a): ZS = z(a) LOCATE 6, 2: PRINT USING LEPOL3$; N(a); XS; YS; ZS a = a + 1 N(a) = nouv: M = N(a) CALL lecture(M) XO = X(a): YO = Y(a): NO = N(a): ZO = z(a) LOCATE 7, 2: PRINT USING LEPOL3$; N(a); XO; YO; ZO l = 0 Dx = XO - XS: Dy = YO - YS IF Dy = 0 THEN Dy = .00000001# IF Dx = 0 THEN Dx = .00000001# gt = ATN(Dx / Dy) IF Dy < 0 AND Dx > 0 THEN gt = gt - PI IF Dy < 0 AND Dx < 0 THEN gt = PI + gt IF Dy > 0 AND Dx < 0 THEN gt = 2 * PI + gt gt = gt * 200 / PI DB = SQR(Dx ^ 2 + Dy ^ 2) LOCATE 8, 20: : PRINT "DIT.BASE: "; USING "####.###"; DB: h = 0 LOCATE 9, 1: PRINT angouvhz pol$ = "" RETURN '----------------------------------------------- '------------CALCUL D'INTERSECTION-------------- '----------------------------------------------- INTERSECTION: T$ = " INTERSECTION " CLS : TITRE (T$) c = 1 IF c = 0 THEN GOTO afficadre ELSEIF c = 1 THEN CLS TITRE (T$) LOCATE 10, 10 GOTO LECTUREI ELSE GOTO INTERSECTION END IF LECTUREI: FOR i = 1 TO 4 LOCATE 4 + i, 10: PRINT " NUMERO DU POINT "; : INPUT N(i) IF N(i) < 0 OR N(i) > 1010 THEN GOTO LECTUREI a = i: M = N(i) CALL lecture(M) N(i) = N(a): X(i) = X(a): Y(i) = Y(a) NEXT i CALCULINTERSECTION: LOCATE 14, 16: PRINT LEFT$(LIGNE$, 48) LOCATE 16, 6: INPUT "N� pt d'int. "; N(5): IF X(1) = 0 THEN X(1) = 1: IF X(3) = 0 THEN X(3) = 1 'LOCATE 16, 28: INPUT "N�lg"; lg(5) LOCATE 16, 38: INPUT "N�ptlg "; nlg(5) LOCATE 16, 54: INPUT " Com."; com$(5) i = 2: z = X(2) - X(1): IF z = 0 THEN X(1) = X(1) + 1 K = (Y(2) - Y(1)) / (X(2) - X(1)): i = 4: z = X(4) - X(3): IF z = 0 THEN X(3) = X(3) + 1 J = (Y(4) - Y(3)) / (X(4) - X(3)): i = 1: z = (K - J): IF z = 0 THEN J = J + 1 X5 = (K * X(1) - J * X(3) - Y(1) + Y(3)) / (K - J) Y5 = X5 * K - K * X(1) + Y(1) X(5) = X5 + .005 Y(5) = Y5 + .005 '--- impression ecran------ ' ------------------------- CLS : TITRE (T$) INTER1$ = "Pt d'intersec Coord. X Coord. Y Ligne N�/Ligne " INTER2$ = "------------- -------- -------- " INTER3$ = " ##### ######.## ######.## #### #### " LOCATE 5, 14: PRINT INTER1$ LOCATE 6, 14: PRINT INTER2$ LOCATE 8, 14: PRINT USING INTER3$; N(5); X(5); Y(5); lg(5); nlg(5) LOCATE 11, 6: PRINT LEFT$(LIGNE$, 67) FOR i = 1 TO 4 l(i) = SQR((X(i) - X(5)) ^ 2 + (Y(i) - Y(5)) ^ 2) l(i) = l(i) + .005 LOCATE 13 + i, 6 PRINT USING "Du point No ##### au point d'intersection ##### ... ######.##"; N(i); N(5); l(i) NEXT i a = 5 IF Nfin < N(i) THEN Nfin = N(i) CALL ecriture RESET SLEEP GOTO afficadre '----------------------------------------------------------- '---------------- RABATTEMENTS POLAIRES ------------------ '----------------------------------------------------------- RABATTEMENTSPOLAIRES: T$ = "RABATTEMENTS POLAIRES" CLS : TITRE (T$) LOCATE 5, 10 INPUT "Num�ro de station : ", nstat LOCATE 6, 10 INPUT "Num�ro de station : ", nouv GOSUB calculbase FOR l = 13 TO 23: LOCATE l, 1: PRINT SPACE$(80): NEXT l suite: LOCATE 13, 22: PRINT "LECTURE D'UNE SUITE DE POINTS : < 1 >" LOCATE 14, 22: PRINT "LECTURE DE POINTS SPECIFIQUES : < 2 >" LOCATE 16, 22: INPUT "V o t r e c h o i x : "; c i = 1: h = 1 FOR l = 13 TO 22: LOCATE l, 13: PRINT SPACE$(65): NEXT l: LI = 13 IF c = 1 THEN GOTO SUITEENREGISTREMENT ENREGISTREMENTSALIRE: LOCATE LI, 25 PRINT "No de point � rabattre : "; : INPUT N(i): M = N(i) IF N(i) < 0 OR N(i) > 1010 THEN GOTO ENREGISTREMENTSALIRE IF N(i) = 0 THEN GOTO IMPRESSIONECRANRABATTEMENTPOLAIRES END IF a = i CALL lecture(M) N(i) = N(a): X(i) = X(a): Y(i) = Y(a) GOSUB CALCULRP i = i + 1: LI = LI + 1 IF LI = 23 THEN FOR l = 13 TO 22 LOCATE l, 15 PRINT SPACE$(55) NEXT l LI = 15 END IF GOTO ENREGISTREMENTSALIRE SUITEENREGISTREMENT: LOCATE 16, 25: PRINT "Du num�ro de point ..... " LOCATE 18, 25: PRINT "Au num�ro de point ..... " LOCATE 16, 58: INPUT c IF c < 0 OR c > 1010 THEN GOTO SUITEENREGISTREMENT LOCATE 18, 58: INPUT d IF d < 0 OR d > 1010 THEN GOTO SUITEENREGISTREMENT f = 1 h = 1: IF c > d THEN f = -1 FOR b = c TO d STEP f N(h) = b: M = b a = h CALL lecture(M) N(h) = N(a): X(h) = X(a): Y(h) = Y(a) GOSUB CALCULRP NEXT b RESET: GOTO IMPRESSIONECRANRABATTEMENTPOLAIRES CALCULRP: Dx = X(h) - XS: IF Dx = 0 THEN Dx = .000001 Dy = Y(h) - YS: IF Dy = 0 THEN Dy = .000001 a = Dx / Dy T = ATN(a) IF Dy < 0 AND Dx > 0 THEN T = T - PI IF Dy < 0 AND Dx < 0 THEN T = PI + T IF Dy > 0 AND Dx < 0 THEN T = 2 * PI + T T = T * 200 / PI T = T - gt Dx = Dx ^ 2: Dy = Dy ^ 2 l(h) = SQR(Dx + Dy) ag(h) = T: IF ag(h) < 0 THEN ag(h) = 400 + ag(h) IF ag(h) > 400 THEN ag(h) = ag(h) - 400 h = h + 1 RETURN IMPRESSIONECRANRABATTEMENTPOLAIRES: '--- impression ecran '--------------------- CLS : TITRE (T$) PRINT : PRINT TIT1$: PRINT TIT2$: PRINT LOCATE 4, 25: PRINT " COORDONNEES DE LA BASE " LOCATE 6, 15: PRINT USING LEPOL3$; NS; XS; YS; ZS LOCATE 7, 15: PRINT USING LEPOL3$; NO; XO; YO; ZO LOCATE 9, 5: PRINT "DISTANCE DE LA BASE : "; : PRINT USING "####.##"; DB PRINT a = 1: i = 1 DO PRINT LOCATE 12 + a, 15: PRINT USING "##### ###.#### #####.### "; N(i); ag(i); l(i) i = i + 1: a = a + 1 IF a = 10 THEN WHILE INKEY$ = "": WEND a = 0 CLS TITRE (T$) LOCATE 3, 13: PRINT , "Pour la suite de l'affichage appuyer sur une touche ": LOCATE 5, 13: PRINT , "N� pt X Y Dist ": PRINT END IF LOOP WHILE i < h PRINT FOR a = 1 TO h e = e + 1 IF e > 10 THEN e = 1 NEXT a: RESET PRINT CHR$(7) '--------------------------------------------- 'impression rabattements polaires imprimante-- '--------------------------------------------- SLEEP GOTO afficadre '----------------------------------------------------------- '-----------------RABATTEMENTS ORTHOGONAUX------------------ '----------------------------------------------------------- RABATTEMENTSORTHOGONAUX: T$ = " RABATTEMENTS ORTHOGONAUX " CLS : TITRE (T$) LOCATE 5, 10 INPUT "Num�ro de station : ", nstat LOCATE 6, 10 INPUT "Num�ro de station : ", nouv GOSUB calculbase FOR l = 13 TO 23: LOCATE l, 1: PRINT SPACE$(80): NEXT l : LOCATE 14, 18 PRINT " Pour le rabattement ": suiteo: LOCATE 16, 22: PRINT "LECTURE D'UNE SUITE DE POINTS : < 1 >" LOCATE 17, 22: PRINT "LECTURE DE POINTS SPECIFIQUES : < 2 >" LOCATE 20, 22: INPUT "V o t r e c h o i x : "; c i = 1: h = 1 FOR l = 15 TO 22: LOCATE l, 15: PRINT SPACE$(55): NEXT l: LI = 15 IF c = 1 THEN GOTO SUITEENREGISTREMENTO ENREGISTREMENTSALIREO: LOCATE LI, 25 PRINT "No de point � rabattre : "; : INPUT N(i): M = N(i) IF N(i) < 0 OR N(i) > 1010 THEN GOTO ENREGISTREMENTSALIREO IF N(i) = 0 THEN GOTO IMPRESSIONECRANRABATTEMENTO END IF a = i CALL lecture(M) N(i) = N(a): X(i) = X(a): Y(i) = Y(a) GOSUB CALCULRO i = i + 1: LI = LI + 1 IF LI = 23 THEN FOR l = 15 TO 22 LOCATE l, 15 PRINT SPACE$(55) NEXT l LI = 15 END IF GOTO ENREGISTREMENTSALIREO SUITEENREGISTREMENTO: LOCATE 16, 25: PRINT "Du num�ro de point ..... " LOCATE 18, 25: PRINT "Au num�ro de point ..... " LOCATE 16, 58: INPUT c IF N(i) < 0 OR N(i) > 1010 THEN GOTO SUITEENREGISTREMENTO LOCATE 18, 58: INPUT d IF N(i) < 0 OR N(i) > 1010 THEN GOTO SUITEENREGISTREMENTO f = 1 h = 1: IF c > d THEN f = -1 FOR b = c TO d STEP f N(h) = b: M = b a = h CALL lecture(M) N(h) = N(a): X(h) = X(a): Y(h) = Y(a) GOSUB CALCULRO NEXT b GOTO IMPRESSIONECRANRABATTEMENTO CALCULRO: Dx = X(h) - XS: IF Dx = 0 THEN Dx = .00001 Dy = Y(h) - YS: IF Dy = 0 THEN Dy = .00001 a = Dx / Dy T = ATN(a) T = ATN(a) IF Dy < 0 AND Dx > 0 THEN T = T - PI IF Dy < 0 AND Dx < 0 THEN T = PI + T IF Dy > 0 AND Dx < 0 THEN T = 2 * PI + T T = T * 200 / PI T = T - gt T = T / 200 * PI Dx = Dx ^ 2: Dy = Dy ^ 2 l(h) = SQR(Dx + Dy) c = COS(T): d = SIN(T) ag(h) = l(h) * c: z(h) = l(h) * d l(h) = -z(h) h = h + 1 RETURN IMPRESSIONECRANRABATTEMENTO: ' impression ecran------ '----------------------- CLS : TITRE (T$) PRINT : LOCATE 4, 25: PRINT " COORDONNEES DE LA BASE " LOCATE 5, 25: PRINT NXY1$ LOCATE 6, 25: PRINT NXY2$ LOCATE 7, 5: PRINT "ST==> "; PRINT USING LEPOL3$; NS; XS; YS; ZS LOCATE 8, 5: PRINT "OV==> "; PRINT USING LEPOL3$; NO; XO; YO; ZO LOCATE 10, 5: PRINT "DISTANCE DE LA BASE : "; : PRINT USING "####.###"; DB PRINT a = 1: i = 1 DO PRINT LOCATE 12 + a, 25: PRINT USING " ##### #####.### #####.### "; N(i); ag(i); l(i) i = i + 1: a = a + 1 IF a = 10 THEN WHILE INKEY$ = "": WEND a = 0 CLS TITRE (T$) LOCATE 3, 13: PRINT , "Pour la suite de l'affichage appuyer sur une touche ": LOCATE 5, 13: PRINT , "N� pt X Y Dist ": PRINT END IF LOOP WHILE i < h PRINT PRINT CHR$(7) SLEEP GOTO afficadre '-------------------------------------------------------------- '----------- LECTURE D'ENREGISTREMENT SUR DISQUE -------------- '-------------------------------------------------------------- LECTUREDEDONNEESSURDISQUE: T$ = " LISTING DE COORDONNEES " CLS : TITRE (T$) LOCATE 7, 10: PRINT " Lecture de donnees pour "; T$: LOCATE 10, 18: PRINT "Lecture d'une suite de points ...... < 1 >" LOCATE 12, 18: PRINT "Lecture de points sp�cifiques ...... < 2 >" LOCATE 14, 18: PRINT "Introduction de points .............. < 3 >" LOCATE 16, 18: PRINT "Fichier Design Cad .................. < 4 >" LOCATE 18, 18: PRINT "V o t r e c h o i x :" LOCATE 18, 45: INPUT c IF c = 0 THEN GOTO afficadre ELSEIF c = 1 THEN CLS TITRE (T$) GOTO POINTALIRE ELSEIF c = 2 THEN i = 1 LI = 22 GOTO POINTALIRE ELSEIF c = 3 THEN GOTO correct ELSEIF c = 4 THEN GOTO Dessincad ELSE GOTO LECTUREDEDONNEESSURDISQUE END IF CLS : TITRE (T$) correct: i = 1: a = 1: CLS LOCATE 9, 5: Nouveaupoint: LOCATE 10, 3: INPUT "N.pt: "; N(a) M = N(a) IF M < 0 OR M > Nbr THEN GOTO correct IF M = 0 THEN GOTO afficadre 'LOCATE 10, 15: INPUT "Comm.: "; com$(a): com$(a) = UCASE$(com$(a)) 'LOCATE 10, 24: PRINT com$(a) LOCATE 10, 30: INPUT "X ", X(a) LOCATE 10, 40: INPUT "Y ", Y(a) LOCATE 10, 50: INPUT "Z ", z(a) IF Nfin < N(a) THEN Nfin = N(a) CALL ecriture GOTO correct POINTALIRE: IF LI = 22 THEN CLS : CALL TITRE(T$) LI = 5 END IF LOCATE LI, 15: PRINT "No du point � lire: "; INPUT N(i) IF N(i) < 0 OR N(i) > 1010 THEN GOTO POINTALIRE IF N(i) = 0 THEN GOTO COORDONNEESECRAN2 a = i: M = N(i) CALL Lecturelisting(M) N(i) = N(a): X(i) = X(a): Y(i) = Y(a): z(i) = z(a): com$(i) = com$(a) LOCATE LI + 1, 1: PRINT " " LOCATE LI, 15: PRINT "No du point � lire: "; N(i) i = i + 1: LI = LI + 1: GOTO POINTALIRE COORDONNEESECRAN2: PRINT LEPOL1$ PRINT LEPOL2$ PRINT FOR c = 1 TO i - 1 IF N(c) <> 0 THEN PRINT USING LEPOL3$; N(c); X(c); Y(c); z(c) END IF NEXT c SLEEP PRINT CHR$(7) EFFACEMENTECRAN: FOR M = 0 TO 19: LOCATE 4 + M : PRINT SPACE$(50): NEXT M RETURN FINDESCALCULS: CLS LOCATE 13, 9: PRINT "Vous etes certain ? Si oui appuyez sur la touche Enter <---" LOCATE 15, 19: PRINT " Vous allez recr�er un fichier ASCII " LOCATE 17, 30 PRINT " Votre Choix? "; : INPUT c$: c$ = UCASE$(c$) IF (c$) = "" THEN PRINT "" PRINT : PRINT CLOSE END IF PRINT " J. LECOMTE vous remercie et vous souhaite bonne continuation" CLS LOCATE 10, 5: PRINT " Transfert du fichier calculs vers le fichier origine " GOTO fin Dessincad: REM **************************************************** REM **** Formation d'un fichier au format Designcad **** REM **** pour le modifier en Designcad2D ************** REM **************************************************** CLS LOCATE 8, 9: d$ = "calculs.top" T$ = "Dessin sur DESIGNCAD" LOCATE 10, 22: CLOSE : OPEN "calculs.top" FOR RANDOM AS #2 LEN = LEN(Enregistrement) LOCATE 10, 25: PRINT " Pr�paration du fichier dessin " i = Ndeb GET #2, i, Enregistrement N = Enregistrement.NumPoint Xg = Enregistrement.XPoint Yb = Enregistrement.YPoint Xd = Enregistrement.XPoint Yh = Enregistrement.YPoint FOR i = Ndeb TO Nfin GET #2, i, Enregistrement X = Enregistrement.XPoint Y = Enregistrement.YPoint IF X < Xg AND X <> 0 THEN SWAP X, Xg IF Y < Yb AND Y <> 0 THEN SWAP Y, Yb IF X > Xd AND X <> 0 THEN SWAP X, Xd IF Y > Yh AND Y <> 0 THEN SWAP Y, Yh NEXT lg = Xd - Xg ht = Yh - Yb M = 5 CLOSE CLS LOCATE M, 32: M = M + 1 PRINT "X min.: "; USING "######.##"; Xg LOCATE M, 32: M = M + 1 PRINT "Y min.: "; USING "######.##"; Yb LOCATE M, 32: M = M + 1 PRINT "lg: "; USING "#####.##"; lg LOCATE M, 32: M = M + 2 PRINT "ht: "; USING "#####.##"; ht CLOSE INPUT "Nom du fichier dessin : ", d$ OPEN "c:\MAE\" + d$ + ".DC2" FOR OUTPUT AS #4 OPEN "calculs.top" FOR RANDOM AS #2 LEN = LEN(Enregistrement) INPUT "Choix de l'Echelle du plan : ", ech lgdes = lg / ech: htdes = ht / ech Xg = Xg - ((ech * .406) - lg) + (.02 * ech) Yb = Yb - (ech * .005) h = ech / 500 PRINT #4, USING "######.## "; Xg; PRINT #4, USING "######.## "; Yb; PRINT #4, USING "######.## "; lg; PRINT #4, USING "######.## "; ht PRINT #4, "40 1 0 0 0 0" PRINT #4, "1.000000 1.000000 1.000000" REM ---------------------------- REM Dessin du cadre layer 11 coleur 3 REM ----------------------------- PRINT #4, "21 11 0 0 0 0" REM PRINT #4, "1 5 1 0 0 1 255 0 0" REM PRINT #4, USING "######.### "; Xg; Yb REM PRINT #4, USING "######.### "; (Xg + (.406 * ech)); Yb REM PRINT #4, USING "######.### "; (Xg + (.406 * ech)); (Yb + (.283 * ech)) REM PRINT #4, USING "######.### "; Xg; (Yb + (.283 * ech)) REM PRINT #4, USING "######.### "; Xg; Yb REM---------------------------- REM Dessin des points et symbole REM ----------------------------- PRINT #4, "21 6 0 0 0 0" FOR i = 0 TO (Nfin - Ndeb - 1) GET #2, Ndeb + i, Enregistrement X(i) = Enregistrement.XPoint Y(i) = Enregistrement.YPoint PRINT #4, "1 2 1 0 0 1 0 0 255 " PRINT #4, USING "######.### "; X(i); Y(i) PRINT #4, USING "######.### "; X(i); Y(i) PRINT #4, "16 4 16 0 0 1 0 1 0 255 0 0" PRINT #4, USING "######.### "; X(i); Y(i) PRINT #4, USING "######.### "; X(i); (Y(i) + (.5 * h)) PRINT #4, USING "######.### "; X(i); (Y(i) + (.5 * h)) PRINT #4, USING "######.### "; (X(i) + 2); (Y(i) + (.5 * h)) NEXT REM--------------------------- REM G�n�ration des numeros " REM--------------------------- compteur = 0 CLOSE #2: OPEN "calculs.top" FOR RANDOM AS #2 LEN = LEN(Enregistrement) PRINT #4, "21 5 0 0 0 0" FOR i = 0 TO (Nfin - Ndeb - 1) GET #2, Ndeb + i, Enregistrement N = Enregistrement.NumPoint X(i) = Enregistrement.XPoint Y(i) = Enregistrement.YPoint IF N > 0 THEN l = 1 IF N > 9 THEN l = 2 IF N > 99 THEN l = 3 IF N > 999 THEN l = 4 IF N > 0 THEN PRINT #4, "3 4 10 0 0 2" PRINT #4, USING "######.### "; (X(i) + 2); (Y(i) + 1) PRINT #4, USING "######.### "; (X(i) + 2 + (2.33 * h)); (Y(i) + 1) PRINT #4, USING "######.### "; (X(i) + 2); (Y(i) + 1 + h) PRINT #4, USING "######.### "; (X(i) + 2 + (2.33 * h)); (Y(i) + 1 + h) PRINT #4, N END IF NEXT REM------------------------- REM Generation lignes REM------------------------- PRE = 3 generationligne: PRINT #4, "21 4 0 0 0 0" PLU = 2 FOR a = 0 TO (Nfin - Ndeb - 2) GET #2, Ndeb + a, Enregistrement X(a) = Enregistrement.XPoint Y(a) = Enregistrement.YPoint IF (Ndeb + a + 1) > Nfin THEN EXIT FOR GET #2, (Ndeb + a + 1), Enregistrement X(a + 1) = Enregistrement.XPoint Y(a + 1) = Enregistrement.YPoint Dx = X(a) - X(a + 1): Dy = Y(a) - Y(a + 1) Dx = Dx * Dx: Dy = Dy * Dy lligne = SQR(Dx + Dy) IF lligne < 1000 THEN PRINT #4, "1 2 1 0 0 1" PRINT #4, USING "######.### "; X(a); Y(a) PRINT #4, USING "######.### "; X(a + 1); Y(a + 1) END IF NEXT GET #2, Ndeb, Enregistrement X(1) = Enregistrement.XPoint Y(1) = Enregistrement.YPoint GET #2, Nfin, Enregistrement X(2) = Enregistrement.XPoint Y(2) = Enregistrement.YPoint IF lligne < 1000 THEN PRINT #4, "1 2 1 0 0 1" PRINT #4, USING "######.### "; X(1); Y(1) PRINT #4, USING "######.### "; X(2); Y(2) fin: END IF CLOSE OPEN donnees$ FOR RANDOM AS #1 LEN = LEN(Enregistrement) OPEN "C:\MAE\" + d$ + ".txt" FOR OUTPUT AS #3 OPEN "C:\MAE\" + d$ + ".dc" FOR OUTPUT AS #4 REM LPRINT REM LPRINT fichier$ REM LPRINT "**********************************" REM LPRINT FOR a = 0 TO (Nfin - Ndeb) GET #1, Ndeb + a, Enregistrement X = Enregistrement.XPoint: Y = Enregistrement.YPoint z = Enregistrement.ZPoint N = Enregistrement.NumPoint IF N > 0 THEN PRINT #3, USING " #####"; N; PRINT #3, USING " ######.###"; X; PRINT #3, USING " ######.###"; Y; PRINT #3, USING " ####.###"; z PRINT #4, USING " ######.###"; X; PRINT #4, USING " ######.###"; Y; PRINT #4, USING " ####.###"; z END IF NEXT a CLOSE KILL donnees$ END IF c$ = "F" THEN END END IF TraitErreur: PRINT ERR SELECT CASE ERR CASE 25 'Imprimante eteinte PRINT "** ERREUR - Imprimante NON pr�te" PRINT "Appuyez sur C pour continuer, R pour relancer, Q pour quitter : " DO Car$ = UCASE$(INPUT$(1)) IF Car$ = "C" THEN RESUME 'Reprendre au point 'd'arr�t. ELSEIF Car$ = "R" THEN Relance = TRUE 'Reprendre au d�but. RESUME 0 ELSEIF Car$ = "M" THEN GOTO afficadre ELSEIF Car$ = "Q" THEN END 'Ne pas reprendre. END IF LOOP CASE 53: 'Fichier inexistant. LOCATE 23, 5 PRINT "** ERREUR - Fichier � cr�er "; "" RESUME afficadre CASE 76: LOCATE 24, 5: PRINT "**Erreur mauvais chemin d'acc�s " RESUME afficadre CASE 63: LOCATE 24, 5: PRINT "**Erreur mauvais chemin d'acc�s " RESUME afficadre CASE ELSE: 'Erreur impr�visible ' D�sactiver l'interception d'erreurs et ' afficher le message standard du syst�me�: RESUME afficadre END SELECT SUB ecriture SHARED donnees$, N(), X(), Y(), z(), i, choisi, Nbr DIM Enregistrement AS Coordonnees c = 1 CLOSE #2: OPEN donnees$ FOR RANDOM AS #2 LEN = LEN(Enregistrement) maxi = LOF(2) / LEN(Enregistrement) IF N(i) = 0 THEN EXIT SUB ELSEIF N(i) > Nbr THEN PRINT "Mauvais num�ro, entrez un num�ro inf�rieur �"; Nbr + 1; INPUT "nouveau num�ro "; N(i) CALL ecriture ELSEIF N(i) <> 0 THEN T = N(i) 'c$ = com$(i) tx = X(i) ty = Y(i) tz = z(i) GET #2, T, Enregistrement NT = Enregistrement.NumPoint IF N(i) = NT THEN ch = 1 X(c) = Enregistrement.XPoint: Y(c) = Enregistrement.YPoint z(c) = Enregistrement.ZPoint tol = SQR((tx - X(c)) ^ 2 + (ty - Y(c)) ^ 2): tol = ABS(tol) tolz = z(c) - tz: tolz = ABS(tolz) IF tol > .002 THEN PRINT PRINT " Ce point existe d�ja avec comme coordonees" LEPOL3$ = "###### ######.### ######.### ####.### #### #### " PRINT USING LEPOL3$; NT; X(c); Y(c); z(c) ' lg(c); nlg(c); PRINT d$ PRINT " Le point est calcul� avec les coordonees suivantes" PRINT USING LEPOL3$; NT; tx; ty; tz PRINT choix: PRINT " Si vous - voulez ecraser le point, O/N " ch$ = INPUT$(1) ch$ = UCASE$(ch$) IF ch$ = "O" THEN Enregistrement.NumPoint = T Enregistrement.XPoint = tx Enregistrement.YPoint = ty Enregistrement.ZPoint = tz PUT #2, T, Enregistrement CLS PRINT USING LEPOL3$; NT; tx; ty; tz EXIT SUB ELSEIF ch$ = "N" THEN CLS PRINT USING LEPOL3$; NT; X(c); Y(c); z(c) EXIT SUB ELSEIF ch$ <> "N" OR ch$ <> "O" THEN GOTO choix END IF END IF END IF Enregistrement.NumPoint = T Enregistrement.XPoint = tx Enregistrement.YPoint = ty Enregistrement.ZPoint = tz PUT #2, T, Enregistrement END IF CLOSE #2 END SUB DEFSNG D, P-Z SUB EntreeNumero (N$) SHARED M LOCATE 5 + M, 25: INPUT "Numero du Point ", N$ LongeurChaine = LEN(N$) IF LEN(N$) > 3 THEN LOCATE 5 + M, 42: PRINT " " CALL EntreeNumero(N$) ELSEIF N$ = "." THEN EXIT SUB END IF Car1$ = "" FOR c% = 1 TO LongeurChaine Car$ = MID$(N$, c%, 1) IF INSTR("0123456789", Car$) > 0 THEN Car1$ = Car1$ + Car$ ELSEIF INSTR("0123456789", Car$) = 0 THEN LOCATE 5 + M, 42: PRINT " " CALL EntreeNumero(N$) END IF NEXT c% END SUB DEFDBL D, P-Z SUB lecture (M) SHARED N(), X(), Y(), z(), tlg(), tnlg(), a, donnees$, com$(), Nbr DIM Enregistrement AS Coordonnees c = 1: b = M CLOSE #2: OPEN donnees$ FOR RANDOM AS #2 LEN = LEN(Enregistrement) maxi = LOF(2) \ LEN(Enregistrement) IF maxi = 0 THEN EXIT SUB END IF IF a <> 0 THEN GET #2, M, Enregistrement NT = Enregistrement.NumPoint IF b = NT THEN X(a) = Enregistrement.XPoint: Y(a) = Enregistrement.YPoint z(a) = Enregistrement.ZPoint N(a) = Enregistrement.NumPoint ch = 1 END IF END IF IF ch <> 1 THEN Msg$ = "Ce point n'existe pas ? Voulez vous changer ce point, " CALL Message(Msg$, 23, 1): PRINT b: BEEP IF b < Nbr THEN INPUT " Nouveau Num�ro de point : "; M CALL lecture(M) ELSEIF b > Nbr THEN PRINT "Num�ro ignor� ???." EXIT SUB N(a) = N(a) END IF END IF END SUB SUB Lecturelisting (M) SHARED N(), X(), Y(), z(), tlg(), tnlg(), a, donnees$, com$() DIM Enregistrement AS Coordonnees c = 1: b = M CLOSE #2: OPEN donnees$ FOR RANDOM AS #2 LEN = LEN(Enregistrement) maxi = LOF(2) \ LEN(Enregistrement) IF maxi = 0 THEN EXIT SUB END IF IF a <> 0 THEN GET #2, M, Enregistrement NT = Enregistrement.NumPoint IF b = NT THEN X(a) = Enregistrement.XPoint: Y(a) = Enregistrement.YPoint z(a) = Enregistrement.ZPoint N(a) = Enregistrement.NumPoint ch = 1 END IF END IF IF ch <> 1 THEN Msg$ = "Ce point n'existe pas ? " CALL Message(Msg$, 23, 1): PRINT b: BEEP N(a) = 0 EXIT SUB END IF END SUB SUB Message (Msg$, Lgn%, Col%) LgnAct% = CSRLIN ColAct% = POS(0) LOCATE Lgn%, Col%: PRINT SPACE$(79) LOCATE Lgn%, Col%: PRINT Msg$ LOCATE LgnAct%, ColAct% END SUB DEFDBL A-C, M SUB OptionBasEcran (T) PRINT CHR$(7) LOCATE 22, 1: PRINT LIGNE$ LOCATE 22, 20 PRINT " ouv. Calcul ffichage Surface in " ch$ = INPUT$(1): ch$ = UCASE$(ch$) IF ch$ = "C" THEN T = 4 ELSEIF ch$ = "N" THEN T = 1 ELSEIF ch$ = "A" THEN T = 3 ELSEIF ch$ = "F" THEN T = 5 ELSEIF ch$ = "" THEN T = 3 ELSEIF ch$ <> "C" OR ch$ <> "N" OR ch$ <> "I" OR ch$ <> "A" OR ch$ <> "F" OR ch$ <> "D" THEN CALL OptionBasEcran(T) END IF END SUB DEFSNG A-D, M, P-Z SUB SuiteNumero (i, M, N()) a = N(i - 1) LOCATE 5 + M, 25: PRINT "1er Point de la suite "; a LOCATE 6 + M, 25: INPUT "Dernier Point de la suite ", b M = M + 1 IF b > a THEN DO a = a + 1 N(i) = a i = i + 1 LOOP WHILE a < b i = i - 1 ELSEIF b < a THEN DO a = a - 1 N(i) = a i = i + 1 LOOP WHILE a > b i = i - 1 END IF END SUB DEFDBL D, P-Z SUB TITRE (T$) SHARED d$ tit$ = T$ + SPACE$(71 - (LEN(T$) + LEN(d$))) + "FICHIER " + d$ : PRINT tit$: END SUB End>RVN823.sb< Start>RVQ381.sb< 'JPT045 args=0 p=0 GraphicsWindow.title="Tree Leaves Falling in Autumn ii=1 sub tree' :size p=p+1 size[p]=args[1] if size[p] < 30 then dd=size tmov() 'dd=size ' tmov() GraphicsWindow.BrushColor=LDColours.HSLtoRGB (50 .7 .2+Math.GetRandomNumber (50)/100) e[ii]=Shapes.AddEllipse (7 11) LDShapes.PenWidth (e[ii] 0) zz=math.GetRandomNumber (8)/10+.9 Shapes.Zoom (e[ii] zz zz) Shapes.Move (e[ii] tx ty) ii=ii+1 else dd= size[p]/3 tmov() tang=tang- 30 ldcall.Function ("tree" size[p]*2/3 ) p=p-1 tang=tang+ 30 dd=size[p]/6 tmov() tang=tang+ 25 ldcall.Function ("tree" size[p]/2) p=p-1 tang=tang - 25 dd= size[p]/3 tmov() tang=tang+ 25 ldcall.Function ("tree" size[p]/2 ) p=p-1 tang=tang - 25 dd=size[p]/6 tmov() dd=-size[p] tmov() EndIf EndSub GraphicsWindow.left=10 GraphicsWindow.top=10 GraphicsWindow.Width =1500 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.PenWidth =3 GraphicsWindow.PenColor =LDColours.HSLtoRGB (0 .7 .3) tx=600 ty=600 tang=-20 ldcall.Function ("tree" 330) tx=600 ty=600 tang=20 ldcall.Function ("tree" 330) tx=600 ty=600 tang=40 ldcall.Function ("tree" 300) ii=ii-1 ic=ii While ii>0 rr=math.GetRandomNumber (ic) If e[rr]=0 then 'GraphicsWindow.Title=ii else Shapes.Animate (e[rr] Shapes.GetLeft (e[rr])+Math.GetRandomNumber (150)-75 800 Math.GetRandomNumber (500)*10+5000) Program.Delay (55) e[rr]=0 ii=ii-1 EndIf endwhile Sub tmov mm=LDMath.Convert2Cartesian(tx ty dd tang-90) GraphicsWindow.DrawLine (tx ty mm[1] mm[2]) tx=mm[1] ty=mm[2] EndSub End>RVQ381.sb< Start>RVQ634.sb< ' mahreen miangul JuLy 2017 ' Kiwi Bird Move ArrowKeys ' AirCraft Animation SWAT ' Cannon Move Fire XZ F GraphicsWindow.Left = 0.1 * (Desktop.Width - GraphicsWindow.Width) ' 0.5 GraphicsWindow.Top = 0.1 * (Desktop.Height - GraphicsWindow.Height) ' 0.5 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = "1288" GraphicsWindow.Height = "666" ' GRID 'GraphicsWindow.PenWidth=1 '<------------- 'GraphicsWindow.penColor = "Lightcyan"' "snow" 'for i=0 To 400 Step 40 '<------------- 'hline[i/40]= shapes.AddLine(0,i ,1080,i) '<------------- 'endfor '<------------- 'for j=0 To 1080 Step 60 '<------------- 'vline[j/60]= shapes.AddLine(j,0 ,j,420) 'endfor '<------------- ' MOON GraphicsWindow.BackgroundColor="midnightblue" GraphicsWindow.BrushColor = "yellow" GraphicsWindow.PenWidth=0 '<------------- moon= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(moon,50,50) '<------------- GraphicsWindow.BrushColor = "midnightblue" shadow= Shapes.AddEllipse(20,20) '<------------- Shapes.Move(shadow,60,45) '<------------- ' Hill GraphicsWindow.brushColor = "lightslategray" GraphicsWindow.fillEllipse(-88,505,620,288) GraphicsWindow.fillEllipse(211,388,622,366) GraphicsWindow.fillEllipse(211,388,1888,666) ' TEXT CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) '<------------- line feed GraphicsWindow.brushColor = "snow" GraphicsWindow.FontSize = 44 msg=Shapes.AddText("H E L L O!"+CRLF+"from"+CRLF+"mahreen "+CRLF+"miangul!") '<------------- Shapes.Move(msg,420,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/1.8) star[i]=Shapes.AddText("★") '<------------- Shapes.Move(star[i],x,y) '<------------- Program.Delay(10) EndFor ' mahreen miangul/<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1 GraphicsWindow.KeyDown = onkeyDown GraphicsWindow.BrushColor = "slateblue" cannon1_x = 333 cannon1_y = 566 cannon = Shapes.AddRectangle(50,100) Shapes.Move(cannon, cannon1_x, cannon1_y) 'Makesprite() SPRITE_init() ' <--------- all shape data is input here!! add_shapes() ' <--------- all shapes are added here!! ' mahreen miangul/<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<2 ' dX=0 ' dY=0 GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor="darkslategray" Ball=Shapes.AddEllipse(40,40) Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) Timer.Interval=1000 '<-------------- Timer.Tick=kiwi_up '<-------------- 'Animate Cycle dZ = 0.1 zoom = 1 ddx=0 ' initial cycle moving speed-X ddy=0 ' initial cycle moving speed-Y bdx=0 ' initial ball moving speed-X bdy=10 ' initial ball moving speed-Y NMB="8:1" ' Aircraft shapes number=5 repeat =1 shoot="False" While 0=0 ' Blinking   zoom = zoom - dZ   For i = 1 To Array.GetItemCount(shape[8]) ' Aircraft shapes data number = 5     If Array.ContainsValue(shape[8][i], "eye") Then       Shapes.Zoom(shp[NMB][i], 1, zoom)     ElseIf Array.ContainsValue(shape[8][i], "mouth") Then       Shapes.Zoom(shp[NMB][i], zoom, zoom)     EndIf shapes.Move(shp[NMB][i],shapes.GetLeft(shp[NMB][i])+ddx,shapes.Gettop(shp[NMB][i])+ddy) EndFor   If zoom = 0.1 Or zoom = 1 Then     dZ = -dZ   EndIf ' cycle reverse moving X,Y direction cycleX= shapes.GetLeft(shp[NMB][1]) ' 1 = Aircraftr's body cycleY= shapes.GetTop(shp[NMB][1]) If cycleX<0 Or cycleX>GraphicsWindow.Width-shape[8][1]["width"] Then ' 1 = Aircraft's body ddx=-ddx EndIf If cycleY<0 Or cycleY>cannon1_y-shape[8][1]["height"] Then ' 1 = Aircraft's body ddy=-ddy EndIf ' ball moving and collision check If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)+angle/4,shapes.Gettop(ball)-bdy) If shapes.Gettop(ball)<-100 then shoot="False" Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) EndIf ' collision check here ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (cycleX1 ' 1 =reindeer's body GraphicsWindow.Title="You Hit !!!!!!!!!!!" Sound.PlayChimeAndWait() shoot="False" Shapes.Move(Ball,cannon1_x+8,cannon1_y+30) Shapes.HideShape(Ball) EndIf EndIf Program.Delay(20) EndWhile Sub kiwi_up Timer.Pause() For L=1 To Array.GetItemCount(shape[1]) Shapes.Rotate(SHP["1:1"][L],Shape[1][L]["angle"]) ' <-------------- rotating angle EndFor Program.Delay(300) For L=1 To Array.GetItemCount(shape[1]) Shapes.Rotate(SHP["1:1"][L], 0) ' <-------------- rotating angle EndFor Program.Delay(300) Timer.Resume() EndSub Sub add_shapes For M=1 to Array.GetItemCount(s) ' 5 types shapes // Kiwi Bird , House , Trees , Apple , sprite1 , sprite2 , sprite3 , Aircraft For N=1 to Array.GetItemCount(s[M]) ' repeat number //Kiwi Bird=1 , House=1 , Trees =12 , Apple=16 , sprite=1 , sprite=2 , sprite=3 , Aircraft=1, ss=s[M][N] ' scale _shx=shx[M][N] ' base point _X _shY=shY[M][N] ' base point _Y _shape=shape[M] ' temporary shape data NMB=M+":"+N ' shape index 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[N][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 ' Keys S, W, A, T, X,Z,F , SpaceBar works Sub OnKeyDown key= GraphicsWindow.LastKey If key="S" Then ddx=4 ElseIf Key="W"then ddx=-4 ElseIf Key="A"then ddy=4 ElseIf key="T"Then ddy=-4 ElseIf key="Space" Then ddx=0 ddy=0 EndIf If shoot="False" Then If Key = "X" Then angle=angle+1 Shapes.Rotate(cannon,angle) ElseIf Key = "Z" Then angle=angle-1 Shapes.Rotate(cannon,angle) ElseIf Key="F" then Shapes.ShowShape(Ball) shoot="True" EndIf endif PMXY= text.GetCharacterCode(GraphicsWindow.LastKey) If PMXY=76 Or PMXY=82 Then ' Left Arrow : 76 Right Arrow : 82 dX= (PMXY-79)/3*5 ' <-- (82-76)/2=3 ,82-3=79 , dX=+5 or -5 dY=0 Move_index() elseIf PMXY=68 Or PMXY=85 Then ' Up Arrow : 85 Down Arrow : 68 dY= (76.5-PMXY)/8.5*5 ' <-- (85-68)/2=8.5, 85-8.5=76.5, dY=+5 or -5 dx=0 Move_index() endif EndSub Sub move_index For ii=1 To 47 ' <--- shp[] array number is 47 Shapes.Move(shp["1:1"][ii],Shapes.GetLeft(shp["1:1"][ii])+dX,Shapes.Gettop(shp["1:1"][ii])+dY) ' current position +dX ,+dY EndFor EndSub Sub SPRITE_init ' Kiwi Bird s[1] ="1=.4" shX[1] ="1=560" shY[1] ="1=240" shape[1][1]="func=line;X=35;Y=360;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 1<------ shape[1][2]="func=line;X=35;Y=370;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 2<------ shape[1][3]="func=line;X=35;Y=380;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 3<------ shape[1][4]="func=ell;X=19;Y=380;width=10;height=40;angle=50;bc=orange;pw=0" ' F 1 <------ shape[1][5]="func=ell;X=27;Y=390;width=10;height=44;angle=30;bc=orange;pw=0" ' F 2<------ shape[1][6]="func=ell;X=41;Y=390;width=10;height=44;angle=15;bc=orange;pw=0" ' F 3<------ shape[1][7]="func=line;X=118;Y=360;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 1<------ shape[1][8]="func=line;X=118;Y=370;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 2<------ shape[1][9]="func=line;X=118;Y=380;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 3<------ shape[1][10]="func=ell;X=118;Y=390;width=10;height=40;angle=-15;bc=orange;pw=0" ' F 1<------ shape[1][11]="func=ell;X=133;Y=390;width=10;height=44;angle=-30;bc=orange;pw=0" ' F 2<------ shape[1][12]="func=ell;X=145;Y=380;width=10;height=44;angle=-50;bc=orange;pw=0" ' F 3<------ shape[1][13]="func=ell;X=-10;Y=190;width=35;height=110;angle=40;bc=darkslategray;pc=darkslategray;;pw=0"' Arm 1 shape[1][14]="func=ell;X=140;Y=190;width=35;height=110;angle=-40;bc=darkslategray;pc=darkslategray;pw=0"' Arm 2 shape[1][15]="func=ell;X=0;Y=200;width=170;height=180;angle=0;bc=snow;pc=darkslategray;pw=4"' body shape[1][16]="func=ell;X=30;Y=110;width=120;height=120;bc=darkslategray;pc=darkslategray;;pw=0"' Face shape[1][17]="func=ell;X=40;Y=130;width=50;height=70;angle=20;bc=snow;pc=darkslategray;pw=0"' Face 1 shape[1][18]="func=ell;X=90;Y=130;width=50;height=70;angle=-10;bc=snow;pc=darkslategray;pw=0"' Face 2 shape[1][19]="func=ell;X=46;Y=145;width=88;height=80;angle=0;bc=snow;pc=darkslategray;pw=0"' Face 3 shape[1][20]="func=ell;X=60;Y=150;width=25;height=25;bc=snow;pc=darkslategray;pw=2"' eye 1 shape[1][21]="func=ell;X=65;Y=161;width=10;height=10;bc=darkslategray;pc=darkslategray;pw=2"' eye 1 shape[1][22]="func=ell;X=100;Y=150;width=25;height=25;bc=snow;pc=darkslategray;pw=2"' eye 2 shape[1][23]="func=ell;X=105;Y=161;width=10;height=10;bc=darkslategray;pc=darkslategray;pw=2"' eye 2 shape[1][24]="func=tri;X=-40;Y=20;x1=120;y1=170;x2=130;y2=180;x3=140;y3=170;bc=orange" ' nosy ' 14 Trees s[2]="1=0.8;2=.8;3=.8;4=.8;5=.8;6=.8;7=.8;8=.8;9=.8;10=.8;11=.8;12=.8;13=.8;14=.8" shX[2]="1=-0;2=100;3=280;4=200;5=10;6=150;7=740;8=644;9=777;10=866;11=966;12=1088;13=920;14=1100" shY[2]="1=200;2=170;3=100;4=140;5=300;6=300;7=280;8=100;9=80;10=70;11=80;12=100;13=330;14=330" shape[2][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2" shape[2][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2 shape[2][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2 shape[2][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2 shape[2][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2 shape[2][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2 shape[2][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2 shape[2][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2 shape[2][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2 shape[2][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 shape[2][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0 ' 18 Apples s[3] ="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[3] ="1=-60;2=60;3=140;4=140;5=650;6=600;7=700;8=800;9=900;10=1000;11=1080;12=-80;13=0;14=100;15=740;16=240;17=920;18=1100" shY[3] ="1=360;2=300;3=270;4=444;5=420;6=240;7=220;8=240;9=220;10=240;11=220;12=440;13=420;14=420;15=420;16=240;17=480;18=460" shape[3][1] = "func=rect;x=626;y=110;width=20;height=60;angle=30;bc=yellowgreen;pw=0;" shape[3][2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;" shape[3][3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;" shape[3][4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;" shape[3][5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;" shape[3][6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;" shape[3][7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;" shape[3][8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;" ' House s[4] ="1=1.8" shX[4] ="1=-22" shY[4] ="1=240" shape[4][1] = "func=rect;x=230;y=50;width=80;height=40;bc=skyblue;pc=darkslategray;pw=1"'Rec A4 shape[4][2] = "func=rect;x=240;y=60;width=20;height=30;bc=orange;pc=darkslategray;pw=1"'Rec A3 shape[4][3] = "func=rect;x=280;y=60;width=20;height=20;bc=lightblue;pc=darkslategray;pw=2"'Rec A2 shape[4][4] = "func=tri;x=0;y=0;x1=230;y1=50;x2=270;y2=10;x3=310;y3=50;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[4][5] = "func=rect;x=300;y=20;width=10;height=30;bc=gray;pc=darkslategray;pw=2"'Tri A2 ' mahreen miangul s[5] ="1=1" shX[5] ="1=0" shY[5] ="1=0" ' mahreen miangul s[6] ="1=1.2" shX[6] ="1=-50" shY[6] ="1=50" ' mahreen miangul s[7] ="1=1.4" shX[7] ="1=-100" shY[7] ="1=100" ' Aircraft s[8] = "1=0.7" shX[8]= "1=980" shY[8]= "1=10" shape[8][1] = "func=tri;x=0;y=0;x1=400;y1=150;x2=370;y2=50;x3=150;y3=150;angle=0;bc=lightslategray;pc=darkslategray;pw=0" shape[8][2] = "func=tri;x=0;y=0;x1=400;y1=150;x2=370;y2=250;x3=150;y3=150;angle=0;bc=lightslategray;pc=darkslategray;pw=0" shape[8][3] = "func=ell;x=350;y=40;width=33;height=22;bc=yellow;pw=0;tag=eye" ' eye 1 <------ shape[8][4] = "func=ell;x=350;y=235;width=33;height=22;bc=yellow;pw=0;tag=eye" ' eye 2 <------ shape[8][5] = "func=ell;x=20;y=130;width=280;height=40;bc=lightslategray;pc=darkslategray;pw=0"'<------------CockPit 1 shape[8][6] = "func=ell;x=40;y=137;width=120;height=25;bc=snow;pc=darkslategray;pw=2" ' <------CockPit 2 shape[8][7] = "func=rect;x=368;y=105;width=25;height=40;angle=-10;bc=darkslategray;pc=darkslategray;pw=2" ' <------Tail shape[8][8] = "func=rect;x=370;y=150;width=25;height=40;angle=15;bc=darkslategray;pc=darkslategray;pw=2" ' <------Tail shape[8][9] = "func=rect;x=320;y=142;width=80;height=10;angle=0;bc=lightslategray;pc=lightslategray;pw=2" '---------Tail shape[8][10] = "func=ell;x=370;y=133;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' <------ shape[8][11] = "func=ell;x=370;y=153;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' <------ endsub zm=1 ' star blinking program While zm<6 NMB= Math.GetRandomNumber(80) ' blinking star number _op=Shapes.GetOpacity(star[NMB]) ' opacity ... brightness If _op>50 Then Shapes.SetOpacity(star[NMB],Math.GetRandomNumber(49)) ' darker Else Shapes.SetOpacity(star[NMB],50+Math.GetRandomNumber(50)) ' brighter EndIf If NMB=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 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) EndWhile End>RVQ634.sb< Start>RVR167.sb< GraphicsWindow.Clear() GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "red" GraphicsWindow.BackgroundColor="white" GraphicsWindow.Title = "Conway`s Game of Life Introduction" GraphicsWindow.Width = 535 GraphicsWindow.Height = 390 Controls.ButtonClicked = onButtonClick GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.Show() intro=0 GraphicsWindow.FontSize=16 GraphicsWindow.DrawText( 5, 20, "Read the rules to understand how Conway´s Game of Life works:" ) GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize=12 GraphicsWindow.DrawText( 40, 90, "1. Any live cell with fewer than two live neighbours dies," ) GraphicsWindow.DrawText( 40, 110, " as if caused by under-population." ) GraphicsWindow.DrawText( 40, 135, "2. Any live cell with more than three live neighbours dies," ) GraphicsWindow.DrawText( 40, 155, " as if by overcrowding." ) GraphicsWindow.DrawText( 40, 180, "3. Any live cell with two or three live neighbours lives" ) GraphicsWindow.DrawText( 40, 200, " on to the next generation." ) GraphicsWindow.DrawText( 40, 225, "4. Any dead cell with exactly three live neighbours becomes" ) GraphicsWindow.DrawText( 40, 245, " a live cell, as if by reproduction." ) GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText( 40, 280, "More information at:" ) GraphicsWindow.BrushColor = "black" url1=Controls.AddTextBox(40,300) url2=Controls.AddTextBox(40,330) Controls.SetSize(url1, 350,25) Controls.SetSize(url2, 350,25) Controls.SetTextBoxText(url1,"http://en.wikipedia.org/wiki/Conway's_Game_of_Life") Controls.SetTextBoxText(url2,"http://de.wikipedia.org/wiki/Conways_Spiel_des_Lebens") introbutton=Controls.AddButton("start the Program",40,360) While intro = 0 endwhile ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' programstart: size = 15 Feldgröße = 20 GraphicsWindow.Clear() GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "red" GraphicsWindow.BackgroundColor="white" GraphicsWindow.Title = "Conway`s Game of Life with the rules 23/3" GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 'GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.Show() i=0 start = 0 quit = 0 editor=0 editore=2 ready=0 DrawUI() 'GraphicsWindow.ShowMessage("The Rules of Conways Game of Life: 1.Any live cell with fewer than two live neighbours dies, as if caused by under-population.","Rules") RunLoop: Controls.ButtonClicked = onButtonClick If ready=1 and j = 1 then Feldausgabe1() ready = ready+1 GraphicsWindow.PenColor = "black" endif If (start = 0 ) Then Goto RunLoop EndIf 'If (quit = 1 ) Then 'Goto End 'EndIf GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText( Feldgröße*size + 120, 80, " "+i ) Feldausgabe1() Nachbarprüfung() Felderneuerung() GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle( Feldgröße*size + 115, 75, 40, 30 ) GraphicsWindow.BrushColor = "black" i = i + 1 'Program.Delay(10) Goto RunLoop Sub Zufallsbelegung1 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y] = 0 If (Math.GetRandomNumber(5) > 3) Then grid[x][y] = 1 Else grid[x][y] = 0 EndIf EndFor Endfor EndSub Sub Feldausgabe1 For x = 1 To Feldgröße For y = 1 To Feldgröße If (grid[x][y] = 1) Then GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle(x * size, y * size, size-1, size-1) buffgrid[x][y] = grid[x][y] endif If grid[x][y]=0 and buffgrid[x][y]=1 then GraphicsWindow.BrushColor = "white" 'GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(x * size, y * size, size, size) ''GraphicsWindow.DrawRectangle(x * size, y * size, size, size) buffgrid[x][y]=0 GraphicsWindow.BrushColor = "blue" endif EndFor EndFor EndSub Sub Nachbarprüfung For x = 1 To Feldgröße For y = 1 To Feldgröße Zellnachbar = 0 If (grid[x-1][y] = 1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x-1][y-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x-1][y+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x+1][y]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x+1][y+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x+1][y-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x][y-1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf If (grid[x][y+1]=1) Then Zellnachbar = Zellnachbar + 1 EndIf 'GraphicsWindow.ShowMessage("" + Zellnachbar , "Zellnachbar") If (grid[x][y]=1) Then If (Zellnachbar = 3 or Zellnachbar = 2) Then buffergrid[x][y] = 1 Else buffergrid[x][y] = 0 EndIf EndIf If(grid[x][y]=0) Then If (Zellnachbar = 3) Then buffergrid[x][y] = 1 Else buffergrid[x][y] = 0 EndIf EndIf EndFor EndFor EndSub Sub Felderneuerung For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y] = buffergrid[x][y] EndFor EndFor EndSub Sub DrawUI GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 Controls.GetTextBoxText(textbox1) GraphicsWindow.BrushColor = "blue" button1=Controls.AddButton("Start",Feldgröße*size + 40, 12) button2=Controls.AddButton("Stop ",Feldgröße*size + 40, 42) button3=Controls.AddButton(" Clear ",Feldgröße*size + 85, 42) button8=Controls.AddButton("Editor",Feldgröße*size + 145, 12) buttonrestart=Controls.AddButton("Restart",Feldgröße*size + 85, 12) GraphicsWindow.BrushColor = "red" buttonexit=Controls.AddButton(" Exit ",Feldgröße*size + 145, 42) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine( Feldgröße*size + 30, 0, Feldgröße*size + 30, Feldgröße*size + 40) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine( Feldgröße*size + 30,160, Feldgröße*size + 200, 160) GraphicsWindow.DrawText( Feldgröße*size + 90, 145, "Presets:" ) GraphicsWindow.DrawText( Feldgröße*size + 40, 80, "Generation:") GraphicsWindow.DrawText( Feldgröße*size + 40, 100, "grid-size:") textbox1=Controls.AddTextBox(Feldgröße*size + 40, 115) GraphicsWindow.DrawText( Feldgröße*size + 140, 100, "now: "+Feldgröße) Controls.TextTyped = textinput1 GraphicsWindow.BrushColor = "black" button4=Controls.AddButton("Random",Feldgröße*size + 40, 177) button5=Controls.AddButton(" Glider1 ",Feldgröße*size + 40, 207) button51=Controls.AddButton(" Glider2 ",Feldgröße*size + 40, 237) button7=Controls.AddButton(" Oszillo ",Feldgröße*size + 40, 267) button6=Controls.AddButton(" 54 Gen ",Feldgröße*size + 40, 297) button11=Controls.AddButton("f-Pentomino",Feldgröße*size + 105, 177) button12=Controls.AddButton(" Exploder ",Feldgröße*size + 105, 207) button13=Controls.AddButton(" Butterfly ",Feldgröße*size + 105, 237) button14=Controls.AddButton(" Relay ",Feldgröße*size + 105, 267) EndSub Sub DrawUI2 GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = (Feldgröße) * size + 40 GraphicsWindow.BrushColor = "red" button9=Controls.AddButton("Ready",Feldgröße*size + 40, 12) button10=Controls.AddButton(" Close ",Feldgröße*size + 40, 42) buttonnew=Controls.AddButton("New",Feldgröße*size + 100, 12) GraphicsWindow.DrawText( Feldgröße*size + 40, 82, "grid-size:") textbox2=Controls.AddTextBox(Feldgröße*size + 40, 102) GraphicsWindow.DrawText( Feldgröße*size + 40, 122, "now: "+Feldgröße) Controls.TextTyped = textinput GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine( Feldgröße*size + 30,170, Feldgröße*size + 200, 170) GraphicsWindow.DrawText( Feldgröße*size + 40, 155, "Edit one of the Presets:" ) GraphicsWindow.BrushColor = "black" button4=Controls.AddButton("Random",Feldgröße*size + 40, 177) button5=Controls.AddButton(" Glider1 ",Feldgröße*size + 40, 207) button51=Controls.AddButton(" Glider2 ",Feldgröße*size + 40, 237) button7=Controls.AddButton(" Oszillo ",Feldgröße*size + 40, 267) button6=Controls.AddButton(" 54 Gen ",Feldgröße*size + 40, 297) button11=Controls.AddButton("f-Pentomino",Feldgröße*size + 105, 177) button12=Controls.AddButton(" Exploder ",Feldgröße*size + 105, 207) button13=Controls.AddButton(" Butterfly ",Feldgröße*size + 105, 237) button14=Controls.AddButton(" Relay ",Feldgröße*size + 105, 267) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawLine( Feldgröße*size + 30, 0, Feldgröße*size + 30, Feldgröße*size + 20) EndSub Controls.TextTyped = textinput Controls.ButtonClicked = onButtonClick Sub textinput Feldgröße=Controls.GetTextBoxText(textbox2)*10 'Feldgröße=Controls.LastTypedTextBox editor() 'Goto runloop endsub Sub textinput1 If Controls.GetTextBoxText(textbox1)>0 then Feldgröße=Controls.GetTextBoxText(textbox1)*10 GraphicsWindow.Clear() DrawUI() Goto RunLoop endif endsub Sub onButtonClick If Controls.LastClickedButton = introbutton Then GraphicsWindow.Clear() intro=1 'Goto IntroLoop 'GraphicsWindow.ShowMessage("ss","") Endif If Controls.LastClickedButton = button1 Then start = 1 Endif If Controls.LastClickedButton = button2 Then start = 0 Endif If Controls.LastClickedButton = button3 Then i = 0 start = 0 Clear() DrawUI() Endif If Controls.LastClickedButton = buttonrestart Then i = 0 start = 0 Clear() For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y] = restartbuffergrid[x][y] EndFor EndFor Feldausgabe1() DrawUI() Endif If Controls.LastClickedButton = buttonexit Then Program.End() Endif If Controls.LastClickedButton = button4 Then For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor start=0 Zufallsbelegung1() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button5 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() Glider() 'Feldausgabe1() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button51 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() Glider2() 'Feldausgabe1() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button6 Then start = 0 GraphicsWindow.Clear() For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor start = 0 DrawUI() gen() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button7 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() start = 0 DrawUI() Blinker() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button11 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() fPentomino() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button12 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() Exploder() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button13 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() Butterfly() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If Controls.LastClickedButton = button14 Then start = 0 For x = 1 To 34 For y = 1 To 34 grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() Relay() restartbuffer() If editor=1 then editor() DrawUI2() else Feldausgabe1() DrawUI() endif Endif If editore =2 and Controls.LastClickedButton = button8 Then editore =2'3 start = 0 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() start = 0 Editor() Endif If editor=1 And Controls.LastClickedButton = button9 Then GraphicsWindow.Clear() start = 0 editor=0 ready=1 j=1 DrawUI() restartbuffer() Goto RunLoop Endif If editor=1 And Controls.LastClickedButton = button10 Then GraphicsWindow.Clear() start = 0 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor Feldgröße = 20 i = 0 Clear() DrawUI() editor=0 Goto programstart Endif If editor=1 And Controls.LastClickedButton = buttonnew Then GraphicsWindow.Clear() editore =2'3 start = 0 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor GraphicsWindow.Width = Feldgröße * size + 200 GraphicsWindow.Height = Feldgröße * size + 40 GraphicsWindow.Clear() start = 0 Editor() Endif Endsub Sub OnMouseDown If editor=1 then x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If ( x > 0 And x < Feldgröße*size And y > 0 And y < Feldgröße*size ) Then gridx = Math.Floor(x/size)'-(size*0.5) gridy = Math.Floor(y/size)'-(size*0.5) If grid[gridx][gridy]=1 then grid[gridx][gridy]=0 Else grid[gridx][gridy]=1 EndIf editor() EndIf endif EndSub Sub Editor editor=1 GraphicsWindow.Clear() DrawUI2() For x = 1 To Feldgröße For y = 1 To Feldgröße If (grid[x][y] = 1) Then GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle(x * size, y * size, size, size) GraphicsWindow.DrawRectangle(x * size, y * size, size, size) Else GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawRectangle(x * size, y * size, size, size) EndIf EndFor Endfor Endsub Sub Clear GraphicsWindow.Clear() For x = 1 To Feldgröße For y = 1 To Feldgröße GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle(x * size, y * size, size, size) grid[x][y]=0 EndFor EndFor EndSub '''''''''''''''''''''''''''''''''''''''''''''''''''''''PRESETS:''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Glider For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[4][2]=1 grid[4][3]=1 grid[4][4]=1 grid[3][4]=1 grid[2][3]=1 EndSub Sub Glider2 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[2][5]=1 grid[3][5]=1 grid[4][5]=1 grid[5][5]=1 grid[5][4]=1 grid[5][3]=1 grid[4][2]=1 grid[1][4]=1 grid[1][2]=1 EndSub Sub Blinker For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[10][10]=1 grid[10][11]=1 grid[10][12]=1 grid[5][5]=1 grid[5][6]=1 grid[5][7]=1 grid[6][6]=1 grid[6][7]=1 grid[6][8]=1 grid[13][5]=1 grid[14][5]=1 grid[13][6]=1 grid[14][6]=1 grid[15][7]=1 grid[16][7]=1 grid[15][8]=1 grid[16][8]=1 EndSub Sub gen GraphicsWindow.Clear() If Feldgröße <34 then Feldgröße = 34 endif DrawUI() For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[14][18]=1 grid[14][19]=1 grid[14][20]=1 grid[15][18]=1 grid[15][20]=1 grid[16][18]=1 grid[16][20]=1 grid[18][18]=1 grid[18][20]=1 grid[19][18]=1 grid[19][20]=1 grid[20][18]=1 grid[20][19]=1 grid[20][20]=1 EndSub Sub fPentomino GraphicsWindow.ShowMessage("if the grid is large enough, the fPentomino can grow 1103 generations long","") For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[Feldgröße/2][Feldgröße/2+1]=1 grid[Feldgröße/2][Feldgröße/2]=1 grid[Feldgröße/2][Feldgröße/2-1]=1 grid[Feldgröße/2+1][Feldgröße/2+1]=1 grid[Feldgröße/2-1][Feldgröße/2]=1 EndSub Sub Exploder For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[Feldgröße/2-2][Feldgröße/2-2]=1 grid[Feldgröße/2-2][Feldgröße/2-1]=1 grid[Feldgröße/2-2][Feldgröße/2]=1 grid[Feldgröße/2-2][Feldgröße/2+1]=1 grid[Feldgröße/2-2][Feldgröße/2+2]=1 grid[Feldgröße/2+2][Feldgröße/2-2]=1 grid[Feldgröße/2+2][Feldgröße/2-1]=1 grid[Feldgröße/2+2][Feldgröße/2]=1 grid[Feldgröße/2+2][Feldgröße/2+1]=1 grid[Feldgröße/2+2][Feldgröße/2+2]=1 grid[Feldgröße/2][Feldgröße/2-2]=1 grid[Feldgröße/2][Feldgröße/2+2]=1 EndSub Sub Butterfly For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[Feldgröße/2-1][Feldgröße/2-2]=1 grid[Feldgröße/2-1][Feldgröße/2-1]=1 grid[Feldgröße/2-1][Feldgröße/2]=1 grid[Feldgröße/2][Feldgröße/2+1]=1 grid[Feldgröße/2+1][Feldgröße/2+1]=1 grid[Feldgröße/2+2][Feldgröße/2+1]=1 grid[Feldgröße/2][Feldgröße/2-1]=1 grid[Feldgröße/2+1][Feldgröße/2]=1 EndSub Sub Relay Feldgröße=42 For x = 1 To Feldgröße For y = 1 To Feldgröße grid[x][y]=0 EndFor EndFor grid[Feldgröße/2-1][Feldgröße/2-1]=1 grid[Feldgröße/2][Feldgröße/2-1]=1 grid[Feldgröße/2][Feldgrö��e/2]=1 grid[Feldgröße/2+1][Feldgröße/2]=1 grid[Feldgröße/2-1][Feldgröße/2+1]=1 grid[Feldgröße/2-8][Feldgröße/2+3]=1 grid[Feldgröße/2-9][Feldgröße/2+3]=1 grid[Feldgröße/2-11][Feldgröße/2+3]=1 grid[Feldgröße/2-12][Feldgröße/2+3]=1 grid[Feldgröße/2-13][Feldgröße/2+3]=1 grid[Feldgröße/2-14][Feldgröße/2+3]=1 grid[Feldgröße/2-16][Feldgröße/2+3]=1 grid[Feldgröße/2-17][Feldgröße/2+3]=1 grid[Feldgröße/2-10][Feldgröße/2+2]=1 grid[Feldgröße/2-10][Feldgröße/2+4]=1 grid[Feldgröße/2-15][Feldgröße/2+2]=1 grid[Feldgröße/2-15][Feldgröße/2+4]=1 grid[Feldgröße/2+8][Feldgröße/2-1]=1 grid[Feldgröße/2+9][Feldgröße/2-1]=1 grid[Feldgröße/2+11][Feldgröße/2-1]=1 grid[Feldgröße/2+12][Feldgröße/2-1]=1 grid[Feldgröße/2+13][Feldgröße/2-1]=1 grid[Feldgröße/2+14][Feldgröße/2-1]=1 grid[Feldgröße/2+16][Feldgröße/2-1]=1 grid[Feldgröße/2+17][Feldgröße/2-1]=1 grid[Feldgröße/2+10][Feldgröße/2]=1 grid[Feldgröße/2+10][Feldgröße/2-2]=1 grid[Feldgröße/2+15][Feldgröße/2]=1 grid[Feldgröße/2+15][Feldgröße/2-2]=1 EndSub Sub restartbuffer 'for the restartbutton For x = 1 To Feldgröße For y = 1 To Feldgröße restartbuffergrid[x][y] = grid[x][y] EndFor EndFor Endsub End>RVR167.sb< Start>RVR504.sb< ' original upload code:- ?BRS931 ' new uploda code LZW978 ' Raycaster maze ' uses a simple ray casting technique (see lodev.org for tutorial) to draw ' vertical stripes down the graphics window. ' Each stripe is drawn to a size dependent upon the distance of the wall from the viewer. ' "Rays" are cast across a viewing plane in front of the viewer, from left to right. ' the height of the wall stripe depends on the distance of the wall from the viewer. InitialSetUp: ' set up screen width and height ' values also used to determine the width and height of the "viewing plane" ' "size" is used to determine the width of each vertical line drawn. ' a smaller value makes the walls sharper, but draws slower (there are more lines) ' a larger value makes the walls blockier, but draws more quickly 'w = 511 'h = 384 w = 511 h = 384 size = 8 'intensity of light source. The lower the number the further you can see. intensity = 50 GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.CanResize = 1 GraphicsWindow.BackgroundColor = "black" ' ' set up the player's start position and direction ' these are the x/y co-ordinates of the world map ' nb absolute values place the player at grid intersections!! posX = 5.5 posY = 10.5 dirX = 1 dirY = 0 planeX = 0 ' ' plane y is the size of the viewing plane in degrees ' (altering this gives different perspective views) planeY = 0.66 completed = 1 ' ' movespeed is how far forward you move each step. ' bigger values create bigger steps, lower values mean smaller (smoother) steps ' rotspeed is how much you rotate left/right when you turn ' a value of 1/3 of rotspeed seems about right moveSpeed = 0.2 rotSpeed = 0.07 ' set up the key press interrupts GraphicsWindow.Keydown = OnKeydown GraphicsWindow.Keyup = OnKeyup ' call the setupmap subroutine to draw the initial map view setupmap() main() Loop: Goto loop 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 - dirX * 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 main completed = 0 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) If coladj < 0 Then coladj = 0 EndIf If coladj > 200 Then coladj = 200 EndIf coldistr = coladj coldistg = coladj coldistb = coladj ' red If worldMap[mapx][mapy] = 2 Then coldistr = coladj coldistg = 0 coldistb = 0 EndIf 'green If worldMap[mapx][mapy] = 3 Then coldistr = 0 coldistg = coladj coldistb = 0 EndIf 'blue If worldMap[mapx][mapy] = 4 Then coldistr = 0 coldistg = 0 coldistb = coladj EndIf 'magenta If worldMap[mapx][mapy] = 5 Then coldistr = coladj coldistg = 0 coldistb = coladj EndIf 'yellow If worldMap[mapx][mapy] = 6 Then coldistr = coladj coldistg = coladj coldistb = 0 EndIf colour = GraphicsWindow.GetColorFromRGB(coldistr, coldistg, coldistb) If side = 1 Then colour = GraphicsWindow.GetColorFromRGB(coldistr / 1.3, coldistg / 1.3, coldistb / 1.3) EndIf 'draw the pixels of the stripe as a vertical line GraphicsWindow.PenWidth = size GraphicsWindow.PenColor = colour ' ' if the colour intensity is > 0 then draw the line, GraphicsWindow.DrawLine (x * size,drawStart,x * size,drawEnd) GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,0,x*size,drawstart) GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,drawend,x*size,h) EndFor completed = 1 Endsub Sub setupmap mapwidth = 21 mapheight = 21 'define the map in the mapline array as strings mapline[1] = "155555511111111555555" mapline[2] = "600000000000000000005" mapline[3] = "600000002000005000051" mapline[4] = "600000000000305000051" mapline[5] = "600000002600305022201" mapline[6] = "604020006000005000001" mapline[7] = "604031006016604444441" mapline[8] = "600000000010004000001" mapline[9] = "600230000010004000001" mapline[10] = "100000000000004000003" mapline[11] = "100002200022000000003" mapline[12] = "100000000000000000033" mapline[13] = "100002200022000333033" mapline[14] = "100000000000000033031" mapline[15] = "103333311111111011011" mapline[16] = "100000011110000000002" mapline[17] = "100000001110000000002" mapline[18] = "100200000110000000002" mapline[19] = "100000000116543211302" mapline[20] = "100000000000000000003" mapline[21] = "111111111116543211222" ' ' 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 End>RVR504.sb< Start>RVZ536.sb< targetTotal = 489.69 iterMax = 1000 valNum = 37 For i = 1 To valNum ' The following line could be harmful and has been automatically commented. ' val[i] = File.ReadLine(Program.Directory+"\values.txt",i) EndFor 'Assume value can only be used once For incNum = 3 To 12 'Included numbers inc = "" incTotal = 0 For i = 1 To incNum inc[i] = val[valNum+1-i] incTotal = incTotal+inc[i] EndFor incDev = Math.Abs(incTotal-targetTotal) 'Excluded numbers exc = "" excNum = valNum-incNum For i = incNum+1 To valNum exc[i-incNum] = val[valNum+1-i] EndFor swap = 1 iter = 0 While (iter < iterMax And incDev > 0 And swap = 1) iter = iter + 1 swap = 0 'Test all combinations of included and excluded numbers to see if we can do better For i = 1 To incNum For ii = i+1 To incNum For iii = ii+1 To incNum For j = 1 To excNum For jj = j+1 To excNum For jjj = jj+1 To excNum newDev = Math.Abs(incTotal-inc[i]-inc[ii]-inc[iii]+exc[j]+exc[jj]+exc[jjj]-targetTotal) If (newDev < incDev) Then incTotal = incTotal-inc[i]-inc[ii]-inc[iii]+exc[j]+exc[jj]+exc[jjj] incDev = newDev swap = 1 temp = inc[i] inc[i] = exc[j] exc[j] = temp temp = inc[ii] inc[ii] = exc[jj] exc[jj] = temp temp = inc[iii] inc[iii] = exc[jjj] exc[jjj] = temp EndIf EndFor EndFor EndFor EndFor EndFor EndFor EndWhile 'Output the results TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Best answer for "+incNum+" numbers in "+iter+" iterations is "+incTotal+" deviation "+(incTotal-targetTotal)) TextWindow.ForegroundColor = "White" For i = 1 To incNum TextWindow.Write(inc[i]+" ") EndFor TextWindow.WriteLine("") EndFor End>RVZ536.sb< Start>RVZ973.sb< args=0 GraphicsWindow.Title ="Ferns s=1 sub fern ':size :sign s=s+1 size[s]=args[1] sign[s]=args[2] if size[s] >= 1 then dd=( size[s]) tmov() Tang=tang+ ( 70 * sign[s]) LDCall.Function2 ("fern" size[s]/2, -sign[s]) s=s-1 Tang=tang+ (- 70 * sign[s]) dd= ( size[s]) tmov() Tang=tang+ (- 70 * sign[s]) LDCall.Function2 ("fern" size[s]/2 sign[s]) s=s-1 Tang=tang+ ( 70 * sign[s]) Tang=tang+ (7 * sign[s]) LDCall.Function2 ("fern" size[s] - 1 sign[s]) s=s-1 Tang=tang+ (-7 * sign[s]) dd= ( -size[s]*2) tmov() EndIf EndSub Sub tmov mm=LDMath.Convert2Cartesian(tx ty dd tang-90) GraphicsWindow.DrawLine (tx ty mm[1] mm[2]) tx=mm[1] ty=mm[2] EndSub GraphicsWindow.left=10 GraphicsWindow.top=10 GraphicsWindow.Width =1500 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor ="teal GraphicsWindow.PenColor ="black tang=-25 ty=700 tx=700 LDCall.Function2 ("fern" 25, 1) GraphicsWindow.PenColor ="darkgreen Tang =2 tx=700 ty=700 LDCall.Function2 ("fern" 25 1) tang=-2 ty=700 tx=700 LDCall.Function2 ("fern" 25, -1) GraphicsWindow.PenColor ="lime Tang =30 tx=700 ty=700 LDCall.Function2 ("fern" 25 1) tang=-30 ty=700 tx=700 LDCall.Function2 ("fern" 25, -1) End>RVZ973.sb< Start>RWB273.sb< GraphicsWindow.Title="Saturn Sub main GraphicsWindow.BackgroundColor = "#000022" Init() DrawStars() ' sphere param["x"] = ra param["y"] = ra For z = ra * 2 To 0 Step -1 If z=ra Then ora=ra For ra = ora * 2.5 To ora*1.5 Step -1 tt=tt+1 param["z"] = z ha = Math.Abs(ra - z) rb = Math.SquareRoot(ra * ra - ha * ha) param["r"] = rb If ra < z Then z2 = z + 1 Else z2 = z - 1 EndIf ha2 = Math.Abs(ra - z2) rb2 = Math.SquareRoot(ra * ra - ha2 * ha2) param["w"] = Math.Max(Math.Abs(rb - rb2), 2) param["color"]=LDColours.HSLtoRGB (60+z/4 .8 .4-z/300) if Math.Remainder(tt 17)<8 Then else DrawRingOnXY() EndIf EndFor ra=ora EndIf param["z"] = z ha = Math.Abs(ra - z) rb = Math.SquareRoot(ra * ra - ha * ha) param["r"] = rb If ra < z Then z2 = z + 1 Else z2 = z - 1 EndIf ha2 = Math.Abs(ra - z2) rb2 = Math.SquareRoot(ra * ra - ha2 * ha2) param["w"] = Math.Max(Math.Abs(rb - rb2), 2) param["color"]=LDColours.HSLtoRGB (60+z/4 .8 .4-z/300) DrawRingOnXY() EndFor For i = 1 To j LDShapes.AnimateOpacity(stt[i] 3500+Math.GetRandomNumber(50)*150 0) EndFor EndSub Sub Init UNDEFINED = "N/A" gw = 600 gh = 500 cx = gw/2 cy = gh/2-30 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = 0.5 * gw yo = 0.46 * gh ra = 64 u = 2 ru = u * Math.SquareRoot(2 / 3) a60 = Math.GetRadians(60) a120 = Math.GetRadians(120) ColorsqqInit() EndSub Sub CalcColors color = param["color"] If color = "Transparent" Then transparent = "True" color = "Black" Else transparent = "False" EndIf ColorqqNameToRGB() colorRight = color ColorqqRGBtoHSL() savedLightness = lightness lightness = Math.Min(savedLightness * 0.1, 1) ColorqqHSLtoRGB() colorTop = color lightness = Math.Max(savedLightness * 0.2, 0) ColorqqHSLtoRGB() colorLeft = color If transparent Then colorTop = "#66" + Text.GetSubTextToEnd(colorTop, 2) colorLeft = "#66" + Text.GetSubTextToEnd(colorLeft, 2) colorRight = "#66" + Text.GetSubTextToEnd(colorRight, 2) EndIf EndSub Sub DrawRingOnXY ' param["x"], param["y"] - center of the ring ' param["z"] - X-Y surface ' param["r"] - radius of the ring ' param["w"] - width of the ring Stack.PushValue("local", param) ox = param["x"] oy = param["y"] rb = param["r"] wr = param["w"] For y = oy + rb To oy - rb Step -1 param["y"] = y hb = Math.Abs(y - oy) w = Math.SquareRoot(rb * rb - hb * hb) If rb - wr < hb Then For x = ox + w To ox - w Step -1 param["x"] = x DrawVoxel() EndFor Else w2 = Math.SquareRoot((rb - wr) * (rb - wr) - hb * hb) For x = ox + w To ox + w2 Step -1 param["x"] = x DrawVoxel() EndFor For x = ox - w2 To ox - w Step -1 param["x"] = x DrawVoxel() EndFor EndIf EndFor param = Stack.PopValue("local") EndSub Sub DrawStars GraphicsWindow.PenWidth=0 For i = 1 To 1000 l = Math.GetRandomNumber(255) x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh) d = Math.GetRandomNumber(u) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(l, l, l) rr=LDMath.Convert2Radial(cx cy x y) If rr[1]>135 Then j=j+1 stt[j]=Shapes.AddEllipse(d d) Shapes.Move(stt[j] x, y) EndIf EndFor EndSub Sub DrawVoxel CalcColors() x0 = xo + ru * Math.Sin(a60) * param["y"] + ru * Math.Sin(-a60) * param["x"] y0 = yo - ru * Math.Cos(a60) * param["y"] + ru * param["z"] - ru * Math.Cos(-a60) * param["x"] x1 = x0 y1 = y0 - ru x2 = x0 + ru * Math.Sin(-a60) y2 = y0 - ru * Math.Cos(-a60) x3 = x0 + ru * Math.Sin(a60) y3 = y0 - ru * Math.Cos(a60) GraphicsWindow.BrushColor=colorRight GraphicsWindow.FillEllipse(x1, y1, 4,4) EndSub Sub ColorqqHSLtoRGB If lightness <= 0.5 Then n2 = lightness * (1 + saturation) Else n2 = lightness + saturation - lightness * saturation EndIf n1 = 2 * lightness - n2 If saturation = 0 Then r = Math.Round(lightness * 255) g = Math.Round(lightness * 255) b = Math.Round(lightness * 255) Else h = hue + 120 ColorqqValue() r = value h = hue ColorqqValue() g = value h = hue - 120 ColorqqValue() b = value EndIf color = GraphicsWindow.GetColorFromRGB(r, g, b) EndSub Sub ColorqqNameToRGB If Text.StartsWith(color, "#") Then color = Text.ConvertToUpperCase(color) Else color = Text.ConvertToLowerCase(color) color = colors[color] EndIf EndSub Sub ColorqqValue If h >= 360 Then h = h - 360 EndIf If h < 0 Then h = h + 360 EndIf If h < 60 Then v = n1 + (n2 - n1) * h / 60 ElseIf h < 180 Then v = n2 ElseIf h < 240 Then v = n1 + (n2 - n1) * (240 - h) / 60 Else v = n1 EndIf value = Math.Round(v * 255) EndSub Sub ColorqqRGBtoHSL ColorqqNameToRGB() sR = Text.GetSubText(color, 2, 2) sG = Text.GetSubText(color, 4, 2) sB = Text.GetSubText(color, 6, 2) dec=LDMath.Base2Decimal(sR 16) ' r = dec / 255 ' occurs Math.Max() bug r = Math.Round(dec / 255 * 10000) / 10000 dec=LDMath.Base2Decimal(sG 16) ' g = dec / 255 ' occurs Math.Max() bug g = Math.Round(dec / 255 * 10000) / 10000 dec=LDMath.Base2Decimal(sB 16) ' b = dec / 255 ' occurs Math.Max() bug b = Math.Round(dec / 255 * 10000) / 10000 max = Math.Max(r, g) max = Math.Max(max, b) min = Math.Min(r, g) min = Math.Min(min, b) lightness = (max + min) / 2 If max = min Then ' r = g = b saturation = 0 hue = UNDEFINED Else If lightness <= 0.5 Then saturation = (max - min) / (max + min) Else saturation = (max - min) / (2 - max - min) EndIf rc = (max - r) / (max - min) gc = (max - g) / (max - min) bc = (max - b) / (max - min) If r = max Then ' between Yellow and Magenta hue = bc - gc ElseIf g = max Then ' between Cyan and Yellow hue = 2 + rc - bc ElseIf b = max Then ' between Magenta and Cyan hue = 4 + gc - rc EndIf hue = hue * 60 If hue < 0 Then hue = hue + 360 EndIf EndIf EndSub Sub ColorqqGrayFromLightness iGray = Math.Round(lightness * 255) gray = GraphicsWindow.GetColorFromRGB(iGray, iGray, iGray) EndSub Sub ColorsqqInit colors["black"]="#000000" colors["white"]="#FFFFFF" EndSub main() End>RWB273.sb< Start>RWB597.sb< 'Pizza Delivery Program xv = 0 yv = 0 accel = 0.5 yv2 = 0 accel2 = 0 falling = "false" GraphicsWindow.BrushColor = "Red" car = Shapes.AddRectangle(23,23) four = "false" mg = "" Shapes.HideShape(car) InitializeProgram() Sound.Play("F:\boss.mp3") GraphicsWindow.KeyUp = KeyUpSub GraphicsWindow.KeyDown = KeyDownSub While "true" If four = "true" Then four = "false" pleaseGiveMeAFour() EndIf If mg <> "" Then If mg = "Game1" Then Game1() ElseIf mg = "Game2" Then Game2() ElseIf mg = "Game3" Then Game3() ElseIf mg = "Game4" Then Game4() ElseIf mg = "Game5" Then Game5() ElseIf mg = "Game6" Then Game6() ElseIf mg = "Game7" Then Game7() ElseIf mg = "Game8" Then Game8() ElseIf mg = "Game9" Then Game9() EndIf EndIf mg = "" EndWhile Sub KeyUpSub k = GraphicsWindow.LastKey If k = "Left" Then left = 0 EndIf If k = "Right" Then right = 0 EndIf If k = "Up" Then up = 0 EndIf If k = "Down" Then down = 0 EndIf EndSub Sub KeyDownSub k = GraphicsWindow.LastKey If k = "Left" Then left = 2 EndIf If k = "Right" Then right = 2 EndIf If k = "Up" Then up = 2 EndIf If k = "Down" Then down = 2 EndIf 'If GameStatus = "Playing" Then n = 0 If k = "D1" Or k = "NumPad1" Then If locked[1] = "false" Then n = 1 Else mg = "Game1" EndIf ElseIf k = "D2" or k = "NumPad2" then If locked[2] = "false" Then n = 2 Else mg = "Game2" EndIf ElseIf k = "D3" or k = "NumPad3" then If locked[3] = "false" Then n = 3 Else mg = "Game3" EndIf ElseIf k = "D4" or k = "NumPad4" then If locked[4] = "false" Then n = 4 Else mg = "Game4" EndIf ElseIf k = "D5" or k = "NumPad5" then If locked[5] = "false" Then n = 5 Else mg = "Game5" EndIf ElseIf k = "D6" or k = "NumPad6" then If locked[6] = "false" Then n = 6 Else mg = "Game6" EndIf ElseIf k = "D7" or k = "NumPad7" then If locked[7] = "false" Then n = 7 Else mg = "Game7" EndIf ElseIf k = "D8" or k = "NumPad8" then If locked[8] = "false" Then n = 8 Else mg = "Game8" EndIf ElseIf k = "D9" or k = "NumPad9" then If locked[9] = "false" Then n = 9 Else mg = "Game9" EndIf EndIf EndSub Sub Game1 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 128 knife[i] = Shapes.AddRectangle(10,160) Shapes.Move(knife[i], 60+Math.GetRandomNumber(270), -300 + Math.Floor((i-1)/4)*-225) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num1 = Shapes.AddText("1") Shapes.Move(num1, GraphicsWindow.Width/2 - 32, -7000) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove() kmove() Program.Delay(5) EndWhile For i = 1 To 128 Shapes.Remove(knife[i]) EndFor Shapes.Remove(num1) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub right = 0 left = 0 down = 0 up = 0 slow = 1 Sub rmove If (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 320) And (Shapes.GetTop(player) + down - up >= 60) And (Shapes.GetTop(player) + down - up <= 320) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player) + down - up) ElseIf (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 320) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player)) ElseIf (Shapes.GetTop(player) + down - up >= 60) And (Shapes.GetTop(player) + down - up <= 320) Then Shapes.Move(player,Shapes.GetLeft(player),Shapes.GetTop(player) + down - up) EndIf EndSub Sub kmove For i = 1 To 128 Shapes.Move(knife[i], Shapes.GetLeft(knife[i]), Shapes.GetTop(knife[i]) + 3) If (Shapes.GetLeft(player) <= Shapes.GetLeft(knife[i]) + 10) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(knife[i])) And (Shapes.GetTop(player) <= Shapes.GetTop(knife[i]) + 160) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(knife[i])) Then mgPlaying = "false" i = 128 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num1, Shapes.GetLeft(num1), Shapes.GetTop(num1) + 3) If Shapes.GetTop(num1) > GraphicsWindow.Height Then mgPlaying = "false" locked[1] = "false" 'Shapes.Remove(lockpic[1]) EndIf EndSub Sub Game2 GraphicsWindow.Width = 800 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(700,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 64 glove[i] = Shapes.AddRectangle(50,50) Shapes.Move(glove[i], 1600 + i*150, 60+Math.GetRandomNumber(230)) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize = 64 num2 = Shapes.AddText("2") Shapes.Move(num2, 11200, (GraphicsWindow.Height/2) - 32) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove2() gmove() Program.Delay(5) EndWhile For i = 1 To 64 Shapes.Remove(glove[i]) EndFor Shapes.Remove(num2) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove2 If (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 720) And (Shapes.GetTop(player) + down - up >= 60) And (Shapes.GetTop(player) + down - up <= 320) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player) + down - up) ElseIf (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 720) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player)) ElseIf (Shapes.GetTop(player) + down - up >= 60) And (Shapes.GetTop(player) + down - up <= 320) Then Shapes.Move(player,Shapes.GetLeft(player),Shapes.GetTop(player) + down - up) EndIf EndSub Sub gmove For i = 1 To 64 Shapes.Move(glove[i], Shapes.GetLeft(glove[i]) - 5, Shapes.GetTop(glove[i])) If (Shapes.GetLeft(player) <= Shapes.GetLeft(glove[i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(glove[i])) And (Shapes.GetTop(player) <= Shapes.GetTop(glove[i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(glove[i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num2, Shapes.GetLeft(num2) - 5, Shapes.GetTop(num2)) If Shapes.GetLeft(num2) < GraphicsWindow.Width Then mgPlaying = "false" locked[2] = "false" 'Shapes.Remove(lockpic[2]) EndIf EndSub Sub Game3 speed = 1 GraphicsWindow.Width = 800 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(700,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Purple" l1 = Shapes.AddRectangle(680,10) Shapes.Move(l1, 60, 60 + 280/4 - 5) l2 = Shapes.AddRectangle(680,10) Shapes.Move(l2, 60, 60 + 280/2 - 5) l3 = Shapes.AddRectangle(680,10) Shapes.Move(l3, 60, 60 + (280*3)/4 - 5) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 32 wall[i] = Shapes.AddRectangle(110,110) Shapes.Move(wall[i], 1600 + i*660, 60 + (280*Math.GetRandomNumber(3))/4 - 55) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize = 64 num3 = Shapes.AddText("3") Shapes.Move(num3, 22720, (GraphicsWindow.Height/2) - 32) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove3() wmove() speed = speed + 0.003 Program.Delay(5) EndWhile For i = 1 To 32 Shapes.Remove(wall[i]) EndFor Shapes.Remove(num3) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) Shapes.Remove(l1) Shapes.Remove(l2) Shapes.Remove(l3) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub wmove For i = 1 To 32 Shapes.Move(wall[i], Shapes.GetLeft(wall[i]) - speed, Shapes.GetTop(wall[i])) If (Shapes.GetLeft(player) <= Shapes.GetLeft(wall[i]) + 110) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(wall[i])) And (Shapes.GetTop(player) <= Shapes.GetTop(wall[i]) + 110) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(wall[i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num3, Shapes.GetLeft(num3) - speed, Shapes.GetTop(num3)) If Shapes.GetLeft(num3) < GraphicsWindow.Width Then mgPlaying = "false" locked[3] = "false" 'Shapes.Remove(lockpic[3]) EndIf EndSub Sub rmove3 If (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 720) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,60 + 280/2 + ((280/4)*down/2) - ((280/4)*up/2) - 10) EndIf EndSub Sub Game4 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 32 firespeedx[1][i] = Math.GetRandomNumber(2) firespeedy[1][i] = Math.GetRandomNumber(2) fire[1][i] = Shapes.AddRectangle(20,20) Shapes.Move(fire[1][i], -200 - Math.GetRandomNumber(100) - 40*i, -200 - Math.GetRandomNumber(100) - 40*i) EndFor For i = 1 To 32 firespeedx[2][i] = Math.GetRandomNumber(2) firespeedy[2][i] = Math.GetRandomNumber(2) fire[2][i] = Shapes.AddRectangle(20,20) Shapes.Move(fire[2][i], 600 + Math.GetRandomNumber(100) + 40*i, -200 - Math.GetRandomNumber(100) - 40*i) EndFor For i = 1 To 32 firespeedx[3][i] = Math.GetRandomNumber(2) firespeedy[3][i] = Math.GetRandomNumber(2) fire[3][i] = Shapes.AddRectangle(20,20) Shapes.Move(fire[3][i], -200 - Math.GetRandomNumber(100) - 40*i, 600 + Math.GetRandomNumber(100) + 40*i) EndFor For i = 1 To 32 firespeedx[4][i] = Math.GetRandomNumber(2) firespeedy[4][i] = Math.GetRandomNumber(2) fire[4][i] = Shapes.AddRectangle(20,20) Shapes.Move(fire[4][i], 600 + Math.GetRandomNumber(100) + 40*i, 600 + Math.GetRandomNumber(100) + 40*i) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num4 = Shapes.AddText("4") Shapes.Move(num4, GraphicsWindow.Width/2 - 32, -3000) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove() fmove() Program.Delay(5) EndWhile For i = 1 To 32 Shapes.Remove(fire[1][i]) Shapes.Remove(fire[2][i]) Shapes.Remove(fire[3][i]) Shapes.Remove(fire[4][i]) EndFor Shapes.Remove(num4) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub fmove For i = 1 To 32 Shapes.Move(fire[1][i], Shapes.GetLeft(fire[1][i]) + firespeedx[1][i], Shapes.GetTop(fire[1][i]) + firespeedy[1][i]) Shapes.Move(fire[2][i], Shapes.GetLeft(fire[2][i]) - firespeedx[2][i], Shapes.GetTop(fire[2][i]) + firespeedy[2][i]) Shapes.Move(fire[3][i], Shapes.GetLeft(fire[3][i]) + firespeedx[3][i], Shapes.GetTop(fire[3][i]) - firespeedy[3][i]) Shapes.Move(fire[4][i], Shapes.GetLeft(fire[4][i]) - firespeedx[4][i], Shapes.GetTop(fire[4][i]) - firespeedy[4][i]) If (Shapes.GetLeft(player) <= Shapes.GetLeft(fire[1][i]) + 20) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(fire[1][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(fire[1][i]) + 20) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(fire[1][i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(fire[2][i]) + 20) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(fire[2][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(fire[2][i]) + 20) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(fire[2][i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(fire[3][i]) + 20) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(fire[3][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(fire[3][i]) + 20) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(fire[3][i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(fire[4][i]) + 20) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(fire[4][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(fire[4][i]) + 20) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(fire[4][i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num4, Shapes.GetLeft(num4), Shapes.GetTop(num4) + 2) If Shapes.GetTop(num4) > GraphicsWindow.Height Then mgPlaying = "false" locked[4] = "false" 'Shapes.Remove(lockpic[4]) EndIf EndSub Sub Game5 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Green" For i = 1 To 25 block[i] = Shapes.AddRectangle(40,40) Shapes.Move(block[i], (i-1)*80 - Math.Floor((i-1)/5)*400, Math.Floor((i-1)/5)*80) EndFor GraphicsWindow.BrushColor = "Red" For i = 1 To 128 ball[i] = Shapes.AddRectangle(40,40) Shapes.Move(ball[i], Math.GetRandomNumber(360), 800 + Math.Floor((i-1)/6)*120) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num5 = Shapes.AddText("5") Shapes.Move(num5, GraphicsWindow.Width/2 - 32, 3440) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove4() 'kmove() Program.Delay(5) EndWhile For i = 1 To 25 Shapes.Remove(block[i]) EndFor For i = 1 To 128 Shapes.Remove(ball[i]) EndFor Shapes.Remove(num5) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove4 If up = 2 And yv > -10 Then yv = yv - accel ElseIf up = 0 And yv < 0 And down = 0 Then yv = yv + accel EndIf If down = 2 And yv < 10 Then yv = yv + accel ElseIf down = 0 And yv > 0 And up = 0 Then yv = yv - accel EndIf If right = 2 And xv < 10 Then xv = xv + accel ElseIf right = 0 And xv > 0 And left = 0 Then xv = xv - accel EndIf If left = 2 And xv > -10 Then xv = xv - accel ElseIf left = 0 And xv < 0 And right = 0 Then xv = xv + accel EndIf For i = 1 To 25 Shapes.Move(block[i], Shapes.GetLeft(block[i]) - xv, Shapes.GetTop(block[i]) - yv) If Shapes.GetLeft(block[i]) < -40 Then Shapes.Move(block[i], GraphicsWindow.Width, Shapes.GetTop(block[i])) EndIf If Shapes.GetLeft(block[i]) > GraphicsWindow.Width Then Shapes.Move(block[i], -40, Shapes.GetTop(block[i])) EndIf If Shapes.GetTop(block[i]) < -40 Then Shapes.Move(block[i], Shapes.GetLeft(block[i]), GraphicsWindow.Height) EndIf If Shapes.GetTop(block[i]) > GraphicsWindow.Height Then Shapes.Move(block[i], Shapes.GetLeft(block[i]), -40) EndIf EndFor For i = 1 To 128 Shapes.Move(ball[i], Shapes.GetLeft(ball[i]) - xv, Shapes.GetTop(ball[i]) - yv - 10) If Shapes.GetLeft(ball[i]) < -40 Then Shapes.Move(ball[i], GraphicsWindow.Width, Shapes.GetTop(ball[i])) EndIf If Shapes.GetLeft(ball[i]) > GraphicsWindow.Width Then Shapes.Move(ball[i], -40, Shapes.GetTop(ball[i])) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ball[i]) + 40) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ball[i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ball[i]) + 40) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ball[i])) Then mgPlaying = "false" i = 128 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num5, Shapes.GetLeft(num5) - xv, Shapes.GetTop(num5) - yv - 10) If Shapes.GetLeft(num5) < -40 Then Shapes.Move(num5, GraphicsWindow.Width, Shapes.GetTop(num5)) EndIf If Shapes.GetLeft(num5) > GraphicsWindow.Width Then Shapes.Move(num5, -40, Shapes.GetTop(num5)) EndIf If Shapes.GetTop(num5) < 0 Then mgPlaying = "false" locked[5] = "false" 'Shapes.Remove(lockpic[5]) EndIf EndSub Sub Game6 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(60,60) Shapes.Move(border, 340, 170) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 32 laser[i] = Shapes.AddRectangle(60,20) Shapes.Move(laser[i], -1000 - 200*i, 180 + (Math.GetRandomNumber(2)-1)*20) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num6 = Shapes.AddText("6") Shapes.Move(num6, -7600, GraphicsWindow.Height/2) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, 360, 190) mgPlaying = "true" While mgPlaying = "true" rmove5() lmove() Program.Delay(5) EndWhile For i = 1 To 32 Shapes.Remove(laser[i]) EndFor Shapes.Remove(num6) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove5 If (Shapes.GetLeft(player) + right - left >= 350) And (Shapes.GetLeft(player) + right - left <= 370) And (Shapes.GetTop(player) + down - up >= 180) And (Shapes.GetTop(player) + down - up <= 200) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player) + down - up) ElseIf (Shapes.GetLeft(player) + right - left >= 350) And (Shapes.GetLeft(player) + right - left <= 370) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player)) ElseIf (Shapes.GetTop(player) + down - up >= 350) And (Shapes.GetTop(player) + down - up <= 200) Then Shapes.Move(player,Shapes.GetLeft(player),Shapes.GetTop(player) + down - up) EndIf EndSub Sub lmove For i = 1 To 32 Shapes.Move(laser[i], Shapes.GetLeft(laser[i])+3, Shapes.GetTop(laser[i])) If (Shapes.GetLeft(player) < Shapes.GetLeft(laser[i]) + 60) And (Shapes.GetLeft(player) + 20 > Shapes.GetLeft(laser[i])) And (Shapes.GetTop(player) < Shapes.GetTop(laser[i]) + 20) And (Shapes.GetTop(player) + 20 > Shapes.GetTop(laser[i])) Then mgPlaying = "false" i = 32 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num6, Shapes.GetLeft(num6)+3, Shapes.GetTop(num6)) If Shapes.GetLeft(num6) > GraphicsWindow.Width Then mgPlaying = "false" locked[6] = "false" 'Shapes.Remove(lockpic[6]) EndIf EndSub Sub Game7 GraphicsWindow.Width = 400 GraphicsWindow.Height = 600 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,500) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Green" For i = 1 To 5 line[i] = Shapes.AddRectangle(400,10) Shapes.Move(line[i], 0, 100*i) EndFor GraphicsWindow.BrushColor = "Red" For i = 1 To 64 debris[i] = Shapes.AddRectangle(50,100) Shapes.Move(debris[i], 60+Math.GetRandomNumber(230), -1000 - i*200) EndFor lava = Shapes.AddRectangle(400,100) Shapes.Move(lava, 0, GraphicsWindow.Height - 70) GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize = 64 num7 = Shapes.AddText("7") Shapes.Move(num7, (GraphicsWindow.Width/2) - 32, -13800) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove6() dmove() Program.Delay(5) EndWhile For i = 1 To 64 Shapes.Remove(debris[i]) EndFor For i = 1 To 5 Shapes.Remove(line[i]) EndFor Shapes.Remove(lava) Shapes.Remove(num2) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove6 If (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 320) And (Shapes.GetTop(player) + down - up + 1 >= 60) And (Shapes.GetTop(player) + down - up + 1 <= 520) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player) + down - up + 1) ElseIf (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 320) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player)) ElseIf (Shapes.GetTop(player) + down - up + 1 >= 60) And (Shapes.GetTop(player) + down - up + 1 <= 520) Then Shapes.Move(player,Shapes.GetLeft(player),Shapes.GetTop(player) + down - up + 1) EndIf EndSub Sub dmove For i = 1 To 5 Shapes.Move(line[i], 0, Shapes.GetTop(line[i]) + 1) If Shapes.GetTop(line[i]) >= Shapes.GetTop(lava) Then Shapes.Move(line[i],0,-20) EndIf EndFor For i = 1 To 64 Shapes.Move(debris[i], Shapes.GetLeft(debris[i]), Shapes.GetTop(debris[i])+5) If (Shapes.GetLeft(player) <= Shapes.GetLeft(debris[i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(debris[i])) And (Shapes.GetTop(player) <= Shapes.GetTop(debris[i]) + 100) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(debris[i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf EndFor If (Shapes.GetLeft(player) <= Shapes.GetLeft(lava) + 400) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(lava)) And (Shapes.GetTop(player) <= Shapes.GetTop(lava) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(lava)) Then mgPlaying = "false" Sound.PlayClick() Program.Delay(1000) EndIf Shapes.Move(num7, Shapes.GetLeft(num7), Shapes.GetTop(num7)+5) If Shapes.GetTop(num7) > GraphicsWindow.Height Then mgPlaying = "false" locked[7] = "false" 'Shapes.Remove(lockpic[7]) EndIf EndSub Sub Game8 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Yellow" For i = 1 To 9 peg[i] = Shapes.AddRectangle(20,20) EndFor Shapes.Move(peg[1], 190, 190) Shapes.Move(peg[2], 190, 90) Shapes.Move(peg[3], 90, 190) Shapes.Move(peg[4], 290, 190) Shapes.Move(peg[5], 190, 290) Shapes.Move(peg[6], 90, 90) Shapes.Move(peg[7], 90, 290) Shapes.Move(peg[8], 290, 90) Shapes.Move(peg[9], 290, 290) GraphicsWindow.BrushColor = "Red" For i = 1 To 64 c = Math.GetRandomNumber(6) If c = 1 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], 175, -500 - i * 100) ElseIf c = 2 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], -500 - i * 100, 175) ElseIf c = 3 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], 75, 500 + i * 100) ElseIf c = 4 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], 500 + i * 100, 75) i = i + 1 ElseIf c = 5 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], 275, 500 + i * 100) ElseIf c = 6 Then ddr[c][i] = Shapes.AddRectangle(50,50) Shapes.Move(ddr[c][i], 500 + i * 100, 275) EndIf EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num8 = Shapes.AddText("8") Shapes.Move(num8, GraphicsWindow.Width/2 - 32, -7000) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove7() ddrmove() Program.Delay(5) EndWhile For k = 1 To 6 For i = 1 To 64 Shapes.Remove(ddr[k][i]) EndFor EndFor For i = 1 To 9 Shapes.Remove(peg[i]) EndFor Shapes.Remove(num8) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove7 Shapes.Move(player,400/2 + ((400/4)*right/2) - ((400/4)*left/2) - 10,400/2 + ((400/4)*down/2) - ((400/4)*up/2) - 10) EndSub Sub ddrmove For i = 1 To 64 Shapes.Move(ddr[1][i], Shapes.GetLeft(ddr[1][i]), Shapes.GetTop(ddr[1][i])+2) Shapes.Move(ddr[2][i], Shapes.GetLeft(ddr[2][i])+2, Shapes.GetTop(ddr[2][i])) Shapes.Move(ddr[3][i], Shapes.GetLeft(ddr[3][i]), Shapes.GetTop(ddr[3][i])-2) Shapes.Move(ddr[5][i], Shapes.GetLeft(ddr[5][i]), Shapes.GetTop(ddr[5][i])-2) Shapes.Move(ddr[4][i], Shapes.GetLeft(ddr[4][i])-2, Shapes.GetTop(ddr[4][i])) Shapes.Move(ddr[6][i], Shapes.GetLeft(ddr[6][i])-2, Shapes.GetTop(ddr[6][i])) If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[1][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[1][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[1][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[1][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[2][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[2][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[2][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[2][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[3][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[3][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[3][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[3][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[4][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[4][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[4][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[4][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[5][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[5][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[5][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[5][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(ddr[6][i]) + 50) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(ddr[6][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(ddr[6][i]) + 50) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(ddr[6][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num8, Shapes.GetLeft(num8), Shapes.GetTop(num8)+2) If Shapes.GetTop(num8) > GraphicsWindow.Height Then mgPlaying = "false" locked[8] = "false" 'Shapes.Remove(lockpic[8]) EndIf EndSub Sub Game9 GraphicsWindow.Width = 400 GraphicsWindow.Height = 400 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) For i = GraphicsWindow.Height To 0 Step -1 Shapes.Move(bg,0,i) Program.Delay(1) EndFor GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 10 border = Shapes.AddRectangle(300,300) Shapes.Move(border, 50, 50) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" For i = 1 To 64 size[i] = Math.GetRandomNumber(70) + 50 spike[1][i] = Shapes.AddRectangle(10,size[i]) spike[2][i] = Shapes.AddRectangle(10,220-size[i]) Shapes.Move(spike[1][i], 500 + 400*i, 350-size[i]) Shapes.Move(spike[2][i], 500 + 400*i, 50) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 64 num9 = Shapes.AddText("9") Shapes.Move(num9, 26500, GraphicsWindow.Height/2 - 32) GraphicsWindow.BrushColor = "Blue" player = Shapes.AddRectangle(20,20) Shapes.Move(player, GraphicsWindow.Width/2 - 10, GraphicsWindow.Height/2 - 10) mgPlaying = "true" While mgPlaying = "true" rmove8() smove() Program.Delay(5) EndWhile For i = 1 To 64 Shapes.Remove(spike[1][i]) Shapes.Remove(spike[2][i]) EndFor Shapes.Remove(num9) Shapes.Remove(player) Shapes.Remove(border) Shapes.Remove(bg) GraphicsWindow.Width = 1050 GraphicsWindow.Height = 400 EndSub Sub rmove8 If up = 2 And yv2 <= 0 And Shapes.GetTop(player) > 200 And falling = "false" Then accel2 = 0.1 yv2 = -3 + accel2 ElseIf Shapes.GetTop(player) + yv2 + accel2 < 320 Then accel2 = 0.1 yv2 = yv2 + accel2 falling = "true" Else falling = "false" yv2 = 0 accel2 = 0 Shapes.Move(player, Shapes.GetLeft(player), 320) EndIf If (Shapes.GetLeft(player) + right - left >= 60) And (Shapes.GetLeft(player) + right - left <= 320) Then Shapes.Move(player,Shapes.GetLeft(player) + right - left,Shapes.GetTop(player) + yv2 + accel2) Else Shapes.Move(player,Shapes.GetLeft(player),Shapes.GetTop(player) + yv2 + accel2) EndIf EndSub Sub smove For i = 1 To 64 Shapes.Move(spike[1][i], Shapes.GetLeft(spike[1][i]) - 3, Shapes.GetTop(spike[1][i])) Shapes.Move(spike[2][i], Shapes.GetLeft(spike[2][i]) - 3, Shapes.GetTop(spike[2][i])) If (Shapes.GetLeft(player) <= Shapes.GetLeft(spike[1][i]) + 10) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(spike[1][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(spike[1][i]) + size[i]) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(spike[1][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf If (Shapes.GetLeft(player) <= Shapes.GetLeft(spike[2][i]) + 10) And (Shapes.GetLeft(player) + 20 >= Shapes.GetLeft(spike[2][i])) And (Shapes.GetTop(player) <= Shapes.GetTop(spike[2][i]) + 220 - size[i]) And (Shapes.GetTop(player) + 20 >= Shapes.GetTop(spike[2][i])) Then mgPlaying = "false" i = 64 Sound.PlayClick() Program.Delay(1000) EndIf EndFor Shapes.Move(num9, Shapes.GetLeft(num9) - 3, Shapes.GetTop(num9)) If Shapes.GetLeft(num9) < GraphicsWindow.Width Then mgPlaying = "false" locked[9] = "false" 'Shapes.Remove(lockpic[9]) EndIf EndSub Sub pleaseGiveMeAFour For i = 1 To 10 Shapes.Remove(pepperoni[i]) EndFor For i = 1 to 10 vy[i] = -0.4 EndFor GraphicsWindow.BackgroundColor = "SkyBlue" GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "SkyBlue" bg = Shapes.AddRectangle(GraphicsWindow.Width,GraphicsWindow.Height) Shapes.Move(bg,0,0) GraphicsWindow.BrushColor = "Peru" table = Shapes.AddRectangle(GraphicsWindow.Width,100) Shapes.Move(table,0,GraphicsWindow.Height - 100) GraphicsWindow.BrushColor = "Tan" pizza = Shapes.AddRectangle(GraphicsWindow.Width, 50) Shapes.Move(pizza,0,GraphicsWindow.Height - 150) GraphicsWindow.BrushColor = "Red" For i = 1 To 100 done[i] = 0 x = Math.GetRandomNumber(25) + 49 GraphicsWindow.BrushColor = "Red" pepperoni[i] = Shapes.AddRectangle(x, 10) Shapes.Move(pepperoni[i], Math.GetRandomNumber(GraphicsWindow.Width - x) + 1,-40*i) EndFor donepizza = 0 While donepizza < 10 Program.Delay(50) For i = 1 To 10 If Shapes.GetTop(pepperoni[i]) + 10 + vy[i] >= Shapes.GetTop(pizza) And done[i] = 0 Then Shapes.Move(pepperoni[i], Shapes.GetLeft(pepperoni[i]), Shapes.GetTop(pizza)-10) vy[i] = 0 done[i] = 1 donepizza = donepizza + 1 EndIf If vy[i] <> 0 Then vy[i] = vy[i] + 0.5 EndIf Shapes.Move(pepperoni[i], Shapes.GetLeft(pepperoni[i]), Shapes.GetTop(pepperoni[i])+vy[i]) EndFor EndWhile Shapes.Remove(pizza) Shapes.Remove(table) Shapes.Remove(bg) For i = 1 To 10 Shapes.Remove(pepperoni[i]) EndFor EndSub Sub InitializeProgram 'graphics window GraphicsWindow.Width = 715 GraphicsWindow.Height = 520 GraphicsWindow.Title = "Pizza Delivery" 'draw new delivery grid DrawGrid() 'draw clock and sales GraphicsWindow.BrushColor="Blue" GraphicsWindow.FillRectangle(505,5,100,60) GraphicsWindow.FillRectangle(610,5,100,60) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = "false" GraphicsWindow.DrawText(510,5,"Time") GraphicsWindow.DrawText(615,5,"Sales") ClockTime = "6:00" GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = "false" TimeDisplay = Shapes.AddText(ClockTime) Shapes.Move(TimeDisplay,535,30) TotalSales = 0 'format as $0.00 Amount = TotalSales FormatAmount() SalesDisplay = Shapes.AddText(AmountText) Shapes.Move(SalesDisplay,620,30) 'draw message area GraphicsWindow.BrushColor = "LightYellow" GraphicsWindow.FillRectangle(505,190,205,50) GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawRectangle(505,190,205,50) GraphicsWindow.DrawRectangle(505,70,205,120) 'draw pizza oven DrawBlueOven() 'add pizza button GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 16 addpizzabutton = Controls.AddButton("Add Pizza",510,380) Controls.SetSize(addpizzabutton,95,33) 'bake pizza button bakepizzabutton = Controls.AddButton("Bake Pizza",610,380) Controls.SetSize(bakepizzabutton,95,33) 'draw pizza loading boxes GraphicsWindow.BrushColor = "Blue" GraphicsWindow.FillRectangle(505,420,70,60) GraphicsWindow.FillRectangle(580,420,130,60) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(510,420,"Baked") GraphicsWindow.DrawText(585,420,"Pizzas in Car") pizzasready = 0 GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 20 pizzasreadydisplay = Shapes.AddText(pizzasready) Shapes.Move(pizzasreadydisplay,535,445) pizzasincar = 0 pizzasincardisplay = Shapes.AddText(pizzasincar) Shapes.Move(pizzasincardisplay, 615,445) 'load button GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 16 loadbutton = Controls.AddButton("Load",660,445) Controls.SetSize(loadbutton,45,33) 'start/pause button startpausebutton = Controls.AddButton("Start Game",505,485) Controls.SetSize(startpausebutton,110,33) 'exit/stop button exitstopbutton = Controls.AddButton("Exit",620,485) Controls.SetSize(exitstopbutton,90,33) Controls.HideControl(addpizzabutton) Controls.HideControl(bakepizzabutton) Controls.HideControl(loadbutton) gamestatus = "Stopped" 'game variables pizzasreadymax = 20 pizzasbakingmax = 100 bakingtime = 10 pizzaimage = "F:\pizza.jpg" pizzasincarmax = 100 hcarimage = "" vcarimage = "" ordermaxtime = 60 orderlatetime = 30 netsoldpizza = 10 netlatepizza = 5 costmissedpizza = 1 pizzacost = 3 mileagecost = 0.1 Timer.Interval = 50 Timer.Pause() Timer.Tick = timerticksub clockticksmax = 6 Controls.ButtonClicked = buttonclickedsub GraphicsWindow.MouseDown = mousedownsub EndSub Sub drawgrid GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FillRectangle(0,0,500,520) 'gridr is row, gridc is column; build one row at a time gridw = 22 GraphicsWindow.FontBold = "false" GraphicsWindow.FontSize = 16 For gridr = 0 To 20 For gridc = 0 To 20 deliverygridx[gridr][gridc] = 10 +gridc *gridw deliverygridy[gridr][gridc] = 20 +gridr *gridw pizzas[gridr][gridc] = 0 pizzatime[gridr][gridc] = 0 If gridr = 0 Then If gridc <> 0 Then 'column letters GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(deliverygridx[gridr][gridc] + 5, deliverygridy[gridr][gridc], Text.GetCharacter(gridc +64)) EndIf ElseIf gridc = 0 then If gridr <> 0 then 'row numbers GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(deliverygridx[gridr][gridc], deliverygridy[gridr][gridc],gridr) EndIf Else deliverygridcolor[gridr][gridc] = "White" deliverygridtext[gridr][gridc] = "" drawgridsquare() EndIf EndFor EndFor EndSub Sub drawgridsquare GraphicsWindow.BrushColor = deliverygridcolor[gridr][gridc] GraphicsWindow.FillRectangle(deliverygridx[gridr][gridc], deliverygridy[gridr][gridc], gridw, gridw) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawRectangle(deliverygridx[gridr][gridc], deliverygridy[gridr][gridc], gridw, gridw) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontSize = 16 GraphicsWindow.DrawText(deliverygridx[gridr][gridc]+6, deliverygridy[gridr][gridc]+1, deliverygridtext[gridr][gridc]) EndSub Sub formatamount dollars = Math.Floor(amount) cents = Math.Floor(100*(Amount-dollars)) AmountText = "$" + dollars +"." If cents = 0 Then AmountText = AmountText + "00" ElseIf cents <10 then AmountText= AmountText + "0" + cents Else AmountText = AmountText + cents EndIf EndSub Sub DrawBlueOven 'draw pizza oven GraphicsWindow.BrushColor = "Blue" GraphicsWindow.FillRectangle(505,245,205,170) GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawText(510,245,"Oven Off") EndSub Sub TimerTickSub 'clock update clockticks = clockticks +1 If clockticks >= clockticksmax Then clockticks = 0 clockminute = clockminute +1 If clockminute > 59 Then clockminute = 0 clockhour = clockhour +1 If clockhour = 11 Then ClockTime = "11:00" Shapes.SetText(TimeDisplay, clocktime) stopgame() EndIf EndIf clocktime="" ClockTime = Text.Append(clocktime, clockhour) If clockminute <10 Then ClockTime = ClockTime +":0" + clockminute Else ClockTime = ClockTime +":"+clockminute EndIf Shapes.SetText(TimeDisplay, clocktime) 'pizzas in oven If ovengoing Then bakingminutesleft = bakingminutesleft -1 If bakingminutesleft = 0 Then ovengoing = "false" pizzasready = pizzasready + pizzasbaking If pizzasready > pizzasreadymax Then pizzasready = pizzasreadymax EndIf Shapes.SetText(pizzasreadydisplay , pizzasready ) DrawBlueOven() pizzasbaking = 0 Controls.ShowControl(addpizzabutton) addpizzavisible = "true" Controls.ShowControl(bakepizzabutton) bakepizzavisible = "true" EndIf EndIf 'check for late orders - check if first is expired clockminutes = clockminute + 60 * clockhour If numberorders <>0 Then For i = 1 To numberorders s = order[i] gridr = Text.GetSubText(s,9,2) If Text.GetSubText(gridr, 1,1) = " " Then gridr = Text.GetSubTextToEnd(gridr, 2) EndIf gridc = Text.GetCharacterCode(Text.GetSubText(s,12,1))-64 If (i = 1 And (clockminutes - pizzatime[gridr][gridc]) >= ordermaxtime) Then deliverygridcolor[gridr][gridc] = "White" deliverygridtext[gridr][gridc] = "" drawgridsquare() misseddeliveries = misseddeliveries + pizzas[gridr][gridc] pizzas[gridr][gridc] = 0 'remove top item itemtoremove = 1 removeitem() ElseIf clockminutes - pizzatime[gridr][gridc] >= orderlatetime then deliverygridcolor[gridr][gridc] = "DarkRed" drawgridsquare() EndIf EndFor EndIf EndIf 'phone update phoneticks = phoneticks +1 If phoneticks >= phoneticksmax Then phoneticks = 0 If clockhour = 10 And clockminute >=30 Then Goto leavephone EndIf getlocation: gridr = Math.GetRandomNumber(20) gridc = Math.GetRandomNumber(20) If pizzas[gridr][gridc] <>0 Then Goto getlocation EndIf p = Math.GetRandomNumber(100) If p>=1 And p<=30 Then pizzas[gridr][gridc] = 1 ElseIf p>=31 and p<=50 then pizzas[gridr][gridc] = 2 ElseIf p>=51 and p<=70 then pizzas[gridr][gridc] = 3 ElseIf p>=71 and p<=85 then pizzas[gridr][gridc] = 4 Else pizzas[gridr][gridc] = 5 EndIf pizzatime[gridr][gridc] = clockminute + 60 * clockhour 'build string listing order numberorders = numberorders +1 orderstring = ClockTime + " l " If clockhour < 10 Then orderstring = " " + orderstring EndIf If gridr <10 Then orderstring = orderstring + " " EndIf orderstring = orderstring + gridr + " " orderstring = orderstring + Text.GetCharacter(gridc +64) + " -> " + pizzas[gridr][gridc] + " pizza(s)" order[numberorders] = orderstring displayorders() 'print new order on grid deliverygridcolor[gridr][gridc] = "DarkGreen" deliverygridtext[gridr][gridc] = pizzas[gridr][gridc] drawgridsquare() phoneticksmax = Math.GetRandomNumber(7) * clockticksmax EndIf leavephone: 'car update - updated each tick If carmoving Then 'replace what is there gridr = carr gridc = carc drawgridsquare() 'move vertically first If deltar <>0 Then mileage = mileage +1 carimage = vcarimage If deltar > 0 Then carr = carr +1 Else carr = carr -1 EndIf deltar = deliveryr - carr Else mileage = mileage +1 carimage = hcarimage If deltac > 0 Then carc = carc +1 Else carc = carc -1 EndIf delatc = deliveryc - carc EndIf Shapes.Move(car, deliverygridx[carr][carc], deliverygridy[carr][carc]) If carr = deliveryr And carc = deliveryc Then carmoving = "false" If carr = pizzar And carc = pizzac Then message1 = "Car at Pizza Parlor:" message2 = carr + " " + Text.GetCharacter(carc + 64) displaymessage() gridr = carr gridc = carc drawgridsquare() pizzasincar = 0 Shapes.SetText(pizzasincardisplay, pizzasincar) Controls.ShowControl(loadbutton) loadvisible = "true" Else 'check delivery status message1 = "Car at " + carr + " " + Text.GetCharacter(carc + 64) If pizzas[carr][carc] = 0 Then message2 = "No Pizza Wanted" displaymessage() Else If pizzas[carr][carc] > pizzasincar Then message2 = "Not Enough Pizzas" displaymessage() Else message2 = "Delivered " + pizzas[carr][carc] + " Pizza(s)" 'see if on time If ((clockminute + 60 * clockhour) - pizzatime[carr][carc] <= orderlatetime) Then message2 = message2 + ": On-Time" TotalSales = TotalSales + pizzas[carr][carc]* netsoldpizza pizzasontime = pizzasontime + pizzas[carr][carc] Else message2 = message2 + ": Late!" TotalSales = TotalSales + pizzas[carr][carc]* netlatepizza pizzaslate = pizzaslate + pizzas[carr][carc] EndIf Amount = TotalSales formatamount() Shapes.SetText(SalesDisplay, AmountText) displaymessage() pizzasincar = pizzasincar - pizzas[carr][carc] Shapes.SetText(pizzasincardisplay, pizzasincar) pizzas[carr][carc]=0 deliverygridcolor[carr][carc] = "White" deliverygridtext[carr][carc] ="" gridr =carr gridc = carc drawgridsquare() 'GraphicsWindow.DrawResizedImage(carimage, deliverygridx[carr][carc]+3, deliverygridy[carr][carc]+3,20,20) 'remove from list For itemtoremove = 1 To numberorders s = order[itemtoremove] r = Text.GetSubText(s,9,2) If Text.GetSubText(r,1,1) = " " Then r = Text.GetSubTextToEnd(r,2) EndIf c = Text.GetCharacterCode(Text.GetSubText(s,12,1))-64 If r = deliveryr And c = deliveryc Then Goto foundorder EndIf EndFor foundorder: 'remove itemtoremove from orders removeitem() EndIf EndIf EndIf EndIf EndIf EndSub Sub Buttonclickedsub b = Controls.LastClickedButton If b = startpausebutton Then 'start, stop, pause button startpausebuttonclick() ElseIf b = exitstopbutton then 'exit stop button exitstopbuttonclick() elseif b = addpizzabutton then 'add pizza button addpizzabuttonclick() elseif b = bakepizzabutton then 'bake pizza button bakepizzabuttonclick() elseif b = loadbutton then 'load car button loadbuttonclick() EndIf EndSub sub startpausebuttonclick If gamestatus = "Stopped" Then gamestatus = "Playing" Controls.SetButtonCaption(startpausebutton, "Pause Game") Controls.SetButtonCaption(exitstopbutton, "Stop Game") 'initialize clock clockhour = 6 clockminute = 0 ClockTime = "6:00" Shapes.SetText(TimeDisplay, clocktime) clockticks = 0 'initialize phone phoneticks = 0 phoneticksmax = Math.GetRandomNumber(7) * clockticksmax 'new grid drawgrid() 'clear order area GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(510,75,190,110) numberorders = 0 'clear pizza oven GraphicsWindow.BrushColor = "Blue" GraphicsWindow.FillRectangle(507,270,200,100) pizzasbaking = 0 Controls.ShowControl(addpizzabutton) addpizzavisible = "true" Controls.ShowControl(bakepizzabutton) bakepizzavisible = "true" pizzasready = pizzasbakingmax totalpizzasbaked = pizzasready Shapes.SetText(pizzasreadydisplay,pizzasready) pizzasincar = 0 Shapes.SetText(pizzasincardisplay, pizzasincar) Controls.ShowControl(loadbutton) loadvisible = "true" 'initialize pizza parlor and car location pizzar = 1+Math.GetRandomNumber(18) pizzac = 1+Math.GetRandomNumber(18) deliverygridcolor[pizzar][pizzac] = "Black" deliverygridtext[pizzar][pizzac] = "X" pizzas[pizzar][pizzac] = -1 gridr = pizzar gridc = pizzac drawgridsquare() Shapes.ShowShape(car) Shapes.Move(car,deliverygridx[gridr][gridc],deliverygridy[gridr][gridc]) carr = pizzar carc = pizzac mileage=0 message1 = "Car at Pizza Parlor:" message2=carr + " " + Text.GetCharacter(carc + 64) displaymessage() carmoving="false" pizzasontime=0 pizzaslate=0 misseddeliveries=0 totalsales=0 amount=totalsales formatamount() Shapes.SetText(SalesDisplay, AmountText) Timer.Resume() ElseIf gamestatus = "Playing" then gamestatus = "Paused" Timer.Pause() Controls.SetButtonCaption(startpausebutton, "Restart Game") Controls.HideControl(exitstopbutton) Controls.HideControl(addpizzabutton) Controls.HideControl(bakepizzabutton) Controls.HideControl(loadbutton) Else 'game restarted gamestatus = "Playing" Controls.SetButtonCaption(startpausebutton, "Pause Game") Controls.ShowControl(exitstopbutton) 'show other buttons if they were showing before If addpizzavisible Then Controls.ShowControl(addpizzabutton) EndIf If bakepizzavisible Then Controls.ShowControl(bakepizzabutton) EndIf If loadvisible Then Controls.ShowControl(loadbutton) EndIf Timer.Resume() EndIf EndSub Sub Exitstopbuttonclick If gamestatus = "Playing" Then stopgame() Else Program.End() EndIf EndSub Sub stopgame gamestatus = "Stopped" Timer.Pause() Controls.SetButtonCaption(startpausebutton, "Start Game") Controls.SetButtonCaption(exitstopbutton, "Exit") 'hide other buttons Controls.HideControl(addpizzabutton) Controls.HideControl(bakepizzabutton) Controls.HideControl(loadbutton) ovengoing = "false" DrawBlueOven() carmoving = "false" salesresults() EndSub Sub displayorders 'display oldest five orders 'print orders - clear first GraphicsWindow.BrushColor= "White" GraphicsWindow.FillRectangle(510,75,190,110) y = 80 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 14 For k = 1 To 5 If k <=numberorders Then GraphicsWindow.DrawText(525, y, order[k]) y = y +20 EndIf EndFor EndSub Sub addpizzabuttonclick pizzasbaking = pizzasbaking +1 If pizzasbaking <5 Then pizzax = 507 + (pizzasbaking -1) *50 pizzay = 270 Else pizzax = 507 + (pizzasbaking -5)*50 pizzay = 320 EndIf four = "true" GraphicsWindow.DrawResizedImage(pizzaimage, pizzax, pizzay, 50,50) If pizzasbaking = pizzasbakingmax Then Controls.HideControl(addpizzabutton) addpizzavisible = "false" EndIf EndSub Sub bakepizzabuttonclick If pizzasbaking = 0 Then Goto leavebakepizzabutton EndIf 'redraw red oven GraphicsWindow.BrushColor = "Red" GraphicsWindow.FillRectangle(505,245,205,170) For i = 1 To pizzasbaking If i <5 Then pizzax = 507 +(i-1)*50 pizzay = 270 Else pizzax = 507+(i-5)*50 pizzay = 320 EndIf GraphicsWindow.DrawResizedImage(pizzaimage, pizzax, pizzay, 50,50) EndFor Controls.HideControl(addpizzabutton) addpizzavisible= "false" Controls.HideControl(bakepizzabutton) bakepizzavisible = "false" hout = clockhour mout = clockminute + bakingtime If mout >59 Then mout = mout -60 hout = hout +1 EndIf GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FontSize = 20 oventext = "Pizza(s) Out at " + hout + ":" If mout <10 Then oventext = oventext + "0" EndIf oventext = oventext + mout GraphicsWindow.DrawText(510,245,oventext) bakingminutesleft = bakingtime ovengoing = "true" leavebakepizzabutton: EndSub Sub loadbuttonclick If pizzasready = 0 Then Goto leaveloadcarbutton EndIf If pizzasready > pizzasincarmax Then pizzasincar = pizzasincar + pizzasincarmax pizzasready = pizzasready - pizzasincarmax Else pizzasincar = pizzasincar + pizzasready pizzasready = 0 EndIf Shapes.SetText(pizzasreadydisplay, pizzasready) Shapes.SetText(pizzasincardisplay, pizzasincar) Controls.HideControl(loadbutton) loadvisible = "false" leaveloadcarbutton: EndSub Sub displaymessage 'clear first GraphicsWindow.BrushColor = "LightYellow" GraphicsWindow.FillRectangle(505,190,205,50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 14 GraphicsWindow.DrawText(510,195,message1) GraphicsWindow.DrawText(510,215,message2) EndSub Sub mousedownsub x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If gamestatus = "Playing" Then If carmoving = "false" And loadvisible = "false" Then deliveryr = 1 +Math.Floor((y- deliverygridy[1][1])/ gridw) deliveryc = 1+ Math.Floor((x- deliverygridx[1][1])/ gridw) If deliveryr<1 Or deliveryr > 20 Or deliveryc <1 Or deliveryc>20 Then Goto leavemousedownsub EndIf deltar = deliveryr - carr deltac = deliveryc - carc If deltar <> 0 Or deltac <> 0 Then message1 = "Car GOING to:" message2 = deliveryr + " " + Text.GetCharacter(deliveryc+ 64) displaymessage() carmoving = "true" EndIf EndIf EndIf leavemousedownsub: EndSub Sub removeitem 'remove itemtoremove from orders If itemtoremove <> numberorders And numberorders <> 1 Then For j = itemtoremove To numberorders -1 order[j] = order[j+1] EndFor EndIf numberorders = numberorders -1 displayorders() EndSub Sub salesresults GraphicsWindow.Hide() TextWindow.Show() TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Black" TextWindow.Clear() TextWindow.Title = "Pizza Delivery Sales Results" TextWindow.CursorLeft = 2 TextWindow.CursorTop = 2 TextWindow.WriteLine("Pizza Delivery Sales Results:") TextWindow.WriteLine("") TextWindow.CursorLeft = 2 TextWindow.WriteLine("Start Time: 6:00 Stop Time: " + ClockTime) TextWindow.CursorLeft = 2 TextWindow.WriteLine("------------------------------------------") TextWindow.WriteLine("") 'sales TextWindow.CursorLeft = 2 TextWindow.WriteLine("Sales:") TextWindow.WriteLine("") 'on time pizzas t = pizzasontime + " On Time Deliveries" TextWindow.CursorLeft = 25 - Text.GetLength(t) TextWindow.Write(t) Amount = pizzasontime * netsoldpizza formatamount() TextWindow.CursorLeft = 35 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) 'total sales TextWindow.WriteLine("") TextWindow.CursorLeft =14 TextWindow.Write("Total Sales") Amount = TotalSales formatamount() TextWindow.CursorLeft = 35 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) 'costs TextWindow.CursorLeft = 40 TextWindow.CursorTop = 7 TextWindow.WriteLine("Costs:") TextWindow.WriteLine("") 'pizzas baked t = totalpizzasbaked + " Pizzas Baked" TextWindow.CursorLeft = 60 - Text.GetLength(t) TextWindow.Write(t) Amount = totalpizzasbaked * pizzacost formatamount() TextWindow.CursorLeft = 70 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) 'mileage t = mileage + " Units Driven" TextWindow.CursorLeft = 60 - Text.GetLength(t) TextWindow.Write(t) Amount = mileage * mileagecost formatamount() TextWindow.CursorLeft = 70 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) 'missed deliveries t = misseddeliveries + " Missed Deliveries" TextWindow.CursorLeft = 60 - Text.GetLength(t) TextWindow.Write(t) Amount = misseddeliveries * costmissedpizza formatamount() TextWindow.CursorLeft = 70 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) 'total costs TextWindow.WriteLine("") TextWindow.CursorLeft = 49 TextWindow.Write("Total Costs") costs = totalpizzasbaked * pizzacost + mileage * mileagecost + misseddeliveries * costmissedpizza Amount = costs formatamount() TextWindow.CursorLeft = 70 - Text.GetLength(AmountText) TextWindow.WriteLine(AmountText) TextWindow.WriteLine("") TextWindow.CursorLeft = 2 TextWindow.WriteLine("----------------------------------------------") TextWindow.WriteLine("") Amount = TotalSales - costs formatamount() TextWindow.CursorLeft = 10 TextWindow.Write("Total Profits: " + AmountText) If clockhour > 6 Then 'only show hourly profits if been selling for more than one hour Amount = (TotalSales - costs) / (clockhour - 6 + clockminute / 60) formatamount() TextWindow.CursorLeft = 40 TextWindow.Write("Hourly Profits: " + AmountText) EndIf TextWindow.CursorLeft = 2 TextWindow.CursorTop = 23 TextWindow.Write("Press Enter to Return to Pizza Delivery") t = TextWindow.Read() TextWindow.Hide() GraphicsWindow.Show() EndSub End>RWB597.sb< Start>RWD351.sb< ' SmallBasic Version 1.2 ' Program: Move ComboShape ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/b9dd2148-0663-4459-b072-700880d387f1/mahreen-miangul-9th-september-2016 ' ImportURL: http://smallbasic.com/program/? ' Extension: ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ cols = "1=Red;2=Lime;3=Blue;4=Yellow;" nShps = Array.GetItemCount(cols) '' let's use same number of single shapes as colors (4) w = 50 '' w = h (4 squares) gw = GraphicsWindow.Width gh = GraphicsWindow.Height offY = gh/2 - w '' offset down in y-direction, vert. center in GW.Height '' a.) CREATE ComboShape 'shp[]' and b.) place in initial position GraphicsWindow.Title = "Moving ComboShape" GraphicsWindow.PenWidth = 0 For n = 1 To nShps '' a.) GraphicsWindow.BrushColor = cols[n] shp[n] = Shapes.AddRectangle(w,w) '' b.) x = Math.Remainder(n-1, 2) * w '' or keep x in array eg. x[n] for later moving y = Math.Floor((n-1) / 2) * w Shapes.Move(shp[n], x, y + offY) EndFor Program.Delay(2000) '' MOVE ComboShape 'shp[]' continuously, part by part dx = 1 '' step width 1 (move right) or -1 (move left) While "True" For n = 1 To nShps x = Shapes.GetLeft(shp[n]) + dx '' or x[n] = x[n] + dx , if kept in array y = Shapes.GetTop(shp[n]) Shapes.Move(shp[n], x,y) EndFor If (x >= gw-w) Or (x <= w) Then '' If shp[2|4] IsRightOut OR shp[1|3] IsLeftOut .... dx = -dx '' ... reverse (-) direction EndIf Program.Delay(10) EndWhile End>RWD351.sb< Start>RWF024.sb< FCExtensions.CreateEvent("vento") GraphicsWindow.Title ="SMS events center" GraphicsWindow.Top=10 GraphicsWindow.Height =800 FCExtensions.RegisterSubToEvent("vento","venn") GraphicsWindow.BackgroundColor ="Gray m1=Controls.AddMultiLineTextBox(10,10) Controls.SetSize (m1,500,270) Timer.Tick=smss Timer.Interval=500 Timer.Pause () For x=1 to 5 m[x]=Controls.AddMultiLineTextBox(10,220+85*x) Controls.SetTextBoxText(m[x],(Math.GetRandomNumber (20000)+20000)+ESLText.CRLF ) Controls.SetSize (m[x],450,80) endfor While 1=1 if LDUtilities.KeyDown("F1") Then For x=1 to 5 If LDFocus.IsFocus (m[x]) then ct=LDText.Split ( Controls.GetTextBoxText (m[x]),ESLText.CRLF ) kk="!send_sms|"+ct[1]+"|"+ct[2]+"|"+ct[3] fCExtensions.RaiseEvent("vento") Timer.Resume () endif endfor elseif LDUtilities.KeyDown("F2") Then Timer.Resume () elseif LDUtilities.KeyDown("F3") Then kk="bel fCExtensions.RaiseEvent("vento") elseif LDUtilities.KeyDown("F4") Then kk="bambynn fCExtensions.RaiseEvent("vento") endif Program.Delay(100) endwhile GraphicsWindow.KeyDown=kkk Sub kkk GraphicsWindow.Title=GraphicsWindow.LastKey EndSub Sub smss Timer.Pause () kkl= LDText.Split(Controls.GetTextBoxText (m1),ESLText.CRLF ) dc=0 For t=1 To Array.GetItemCount (kkl) ree: cc=LDText.Split ( kkl[t],"|") If cc[1]="!warn!" Then For x=1 To 5 LDFocus.SetFocus(m[x]) SPExtra.SendKeys ("{END}{ENTER}"+ "! WARNING!:"+cc[2]) dc=dc+1 cc[1]=">WarnOK"+dc kkl[t]=cc[1]+"/"+cc[2]+"/"+cc[3]+"//"+cc[4] endfor elseIf cc[1]="!info" Then For x=1 To 5 LDFocus.SetFocus(m[x]) SPExtra.SendKeys ("{END}{ENTER}"+ "INFO: "+cc[2]) dc=dc+1 cc[1]=">InfoOK"+dc kkl[t]=cc[1]+"/"+cc[2]+"/"+cc[3]+"//"+cc[4] endfor elseIf cc[1]="!delv_sms" Then For x=1 To 5 ct= Controls.GetTextBoxText (m[x]) If Text.StartsWith (ct,cc[3]) Then LDFocus.SetFocus(m[x]) SPExtra.SendKeys ("{END}{ENTER}"+ cc[2]+":"+cc[4]) dc=dc+1 cc[1]=">delivOK"+dc kkl[t]=cc[1]+"/"+cc[2]+"/"+cc[3]+"//"+cc[4] endif EndFor If dc=0 then kkl[t]="!delv_sms|11111|"+text.GetSubTextToEnd (cc[2],3)+"|"+"Unknown recv!" Goto ree EndIf endif endfor tt="" For t=1 To Array.GetItemCount (kkl) tt=tt+kkl[t]+ ESLText.CRLF EndFor Controls.SetTextBoxText (m1,tt) EndSub Sub venn Timer.Pause () GraphicsWindow.Title="Event" If Text.StartsWith (kk,"!") Then cc=LDText.Split ( kk,"|") If cc[1]="!send_sms" Then Controls.SetTextBoxText (m1,"!delv_sms|s:"+cc[2]+"|"+cc[3]+"|"+cc[4]+ESLText.CRLF+ Controls.GetTextBoxText(m1) ) endif endif Program.Delay(100) EndSub End>RWF024.sb< Start>RWF648.sb< gw = 500 gh = 500 worldScale = 10 GraphicsWindow.Width = gw GraphicsWindow.Width = gh mapRegionImage = ImageList.LoadImage("http://www.ezilon.com/maps/images/world-physical-map.gif") LDImage.Resize(mapRegionImage,worldScale*gw,worldScale*gh) mapRegion = Shapes.AddImage(mapRegionImage) 'GraphicsWindow.BrushColor = "Red" 'mapRegion = Shapes.AddRectangle(worldScale*gw,worldScale*gh) GraphicsWindow.BrushColor = "Blue" 'Shapes.Move(staticObject,100,100) mapObject = Shapes.AddEllipse(50,50) Shapes.Move(mapObject,gw/2-25,gw/2-25)'center Shapes.Move(mapObject,200,200) list[1] = "Option 1" list[2] = "Option 2" list[3] = "Option 3" list[4] = "Option 4" staticObject = LDControls.AddListBox(list,100,gh/2) 'staticObject = Shapes.AddRectangle(100,100) scale = 1 scaleStep = 1.01 LDScrollBars.Add(worldScale*gw,worldScale*gh) LDScrollBars.ScrollBarChanged = OnScrollBarChanged While ("True") start = Clock.ElapsedMilliseconds LDGraphicsWindow.PauseUpdates() If (LDUtilities.KeyDown("Q")) Then scale = scale*scaleStep If (scale > 1) Then scale = 1 EndIF ReScale() ElseIf (LDUtilities.KeyDown("A")) Then scale = scale/scaleStep If (scale < 1/worldScale) Then scale = 1/worldScale EndIF ReScale() EndIf LDGraphicsWindow.ResumeUpdates() delay = 20 - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile Sub OnScrollBarChanged RepositionStaticShapes() EndSub Sub Rescale 'TextWindow.WriteLine(LDScrollBars.HorizontalScroll) 'Center of GW in view coordinates pos = LDGraphicsWindow.RepositionPoint(LDScrollBars.HorizontalScroll+gw/2,LDScrollBars.VerticalScroll+gh/2,"False") 'Rescale view LDGraphicsWindow.Reposition(scale,scale,0,0,0) 'New center of view in GW coordinates pos1 = LDGraphicsWindow.RepositionPoint(pos[1],pos[2],"True") 'Scroll to keep the old center at the new scaled view center LDScrollBars.HorizontalScroll = pos1[1]-gw/2'-0.4 LDScrollBars.VerticalScroll = pos1[2]-gh/2'-0.4 'Keep image in view posMin = LDGraphicsWindow.RepositionPoint(0,0,"True") posMax = LDGraphicsWindow.RepositionPoint(worldScale*gw,worldScale*gh,"True") LDScrollBars.HorizontalScroll = Math.Min(posMax[1]-gw,Math.Max(posMin[1],LDScrollBars.HorizontalScroll)) LDScrollBars.VerticalScroll = Math.Min(posMax[2]-gh,Math.Max(posMin[2],LDScrollBars.VerticalScroll)) RepositionStaticShapes() EndSub Sub RepositionStaticShapes position = LDGraphicsWindow.RepositionPoint(LDScrollBars.HorizontalScroll+0,LDScrollBars.VerticalScroll+0,"False") Shapes.Move(staticObject,position[1]+100*(1/scale-1)/2,position[2]+gh/2*(1/scale-1)/2) Shapes.Zoom(staticObject,1/scale,1/scale) EndSub End>RWF648.sb< Start>RWJ531-0.sb< GraphicsWindow.Width=1200 GraphicsWindow.Height=900 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.BrushColor="darkblue GraphicsWindow.Title="OctaPulsar c7=3 s3=3 sc7=6 For y=1 To 145 c7=s3 s3=s3-.005 For x=0 To 145 c7=c7-.005 nn=math.SquareRoot( x*y) GraphicsWindow.BrushColor=LDColours.HSLtoRGB(math.remainder(nn*10 360) 1 .5) GraphicsWindow.FillEllipse (500-x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse(500-x*c7 350+y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350+y*c7 sc7 sc7) EndFor EndFor End>RWJ531-0.sb< Start>RWJ531-1.sb< GraphicsWindow.Width=1200 GraphicsWindow.Height=900 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.BrushColor="darkblue GraphicsWindow.Title="OctaPulsar c7=3 s3=3 sc7=6 For y=1 To 145 c7=s3 s3=s3-.005 For x=0 To 145 c7=c7-.005 nn=math.SquareRoot( x*y) GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(LDMath.Cos(x*y)*200 ldMath.Sin(x+y)*150 (x+y)/2) GraphicsWindow.FillEllipse (500-x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse(500-x*c7 350+y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350+y*c7 sc7 sc7) EndFor EndFor End>RWJ531-1.sb< Start>RWJ531-2.sb< GraphicsWindow.Width=1200 GraphicsWindow.Height=900 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.BrushColor="darkblue GraphicsWindow.Title="OctaPulsar c7=3 s3=3 sc7=6 For y=1 To 145 c7=s3 s3=s3-.005 For x=0 To 145 c7=c7-.005 nn=math.SquareRoot( x*y) GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(LDMath.Cos(x*x/y)*200 ldMath.Sin(x/y)*200 x) GraphicsWindow.FillEllipse (500-x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350-y*c7 sc7 sc7) GraphicsWindow.FillEllipse(500-x*c7 350+y*c7 sc7 sc7) GraphicsWindow.FillEllipse (500+x*c7 350+y*c7 sc7 sc7) EndFor EndFor End>RWJ531-2.sb< Start>RWJ531.sb< GraphicsWindow.Width=1200 GraphicsWindow.Height=900 GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkblue ll=LDList.CreateFromValues("0=0") GraphicsWindow.Title="Abacus prmm="2;3;5;7;11;13;17;19;23;29;31;37;41;43;47;53;59;61;67;71;73;79;83;89;97;101;103;107;109;113;127;131;137;139;149;151;157;163;167;173;179;181;191;193;197;199;211;223;227;229;233;239;241;251;257;263;269;271;277;281;283;293;307;311;313;317;331;337;347;349;353;359;367;373;379;383;389;397;401;409;419;421;431;433;439;443;449;457;461;463;467;479;487;491;499;503;509;521;523;541;547;557;563;569;571;577;587;593;599;601;607;613;617;619;631;641;643;647;653;659;661;673;677;683;691;701;709;719;727;733;739;743;751;757;761;769;773;787;797;809;811;821;823;827;829;839;853;857;859;863;877;881;883;887;907;911;919;929;937;941;947;953;967;971;977;983;991;997;1009;1013;1019;1021" pr= LDText.Split(prmm ";") oo= LDText.Split("7 11 13 17 19 21 23 29 30 31 32" " ") For y=1 To 95 For x=0 To 95 If x=0 Then GraphicsWindow.BrushColor="darkblue if Array.ContainsValue(oo y) Then GraphicsWindow.BrushColor="white endif Else GraphicsWindow.BrushColor="darkblue If x*y=y*y Then GraphicsWindow.BrushColor="red EndIf If 1=0 Then ln=Text.GetLength(x*y)*2 if ln>6 Then ln=6 EndIf GraphicsWindow.DrawText(x*33 y*23+5 Text.GetSubTextToEnd(" "+x*y ln)) LDList.Add(ll x*y) Else nn=LDMath.FixDecimal( math.SquareRoot( x*y) 1) GraphicsWindow.BrushColor=LDColours.HSLtoRGB(math.remainder(nn*10 360) 1 .5) GraphicsWindow.FillRectangle(x*7 y*7 7 7) If 1=0 Then nn1=Math.Floor(nn) GraphicsWindow.BrushColor="black" GraphicsWindow.DrawText(x*33+10 5+y*23 NN1) EndIf EndIf EndIf EndFor EndFor End>RWJ531.sb< Start>RWJ884.sb< 'JJ Gun Sights Routine. 'Aug 2013 '***Key: scopeVariableName scopeRadius = 20 scopeLensOpacity = 20 'allows the target to be seen GraphicsWindow.MouseMove = OnMouseMove '==========================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 End>RWJ884.sb< Start>RWJ900.sb< ' Jigsaw puzzle made by NaoChanON 2012/02/22 ' Data Extension is required. shortest_time =60 ' My(NaoChanON) shortest time XD GraphicsWindow.MouseDown=Onmousedown GraphicsWindow.MouseUp = OnMouseUp Timer.Tick=Time_show Timer.Interval=1000 init() ' Initial View Url_Photo() ' Gets a photo from Flickr or User's file Crop_photo() ' crop photo Random_Photo() ' Cropped photograph are scattered Timer.Resume() T0=clock.ElapsedMilliseconds While ("True") For i = 1 To n*m If (OnMove[i] = 1) Then PosX[i] = GraphicsWindow.MouseX PosY[i] = GraphicsWindow.MouseY Shapes.Move(sCrop[i],posX[i],posY[i]) C_i=i EndIf EndFor Program.Delay(50) EndWhile Sub Check_original ' if position is same as original If (math.Round(PosX[C_i]/dIW)+1)=(math.Remainder((C_i-1),m)+1) And (math.Round(PosY[C_i]/dIH)+1)=(math.Floor((C_i-1)/m)+1) Then tend[C_i]=1 ' If its position is filled Shapes.Move(sCrop[C_i],math.Remainder((C_i-1),m)*dIW,math.Floor((C_i-1)/m)*dIH) ' adjust position endif EndSub Sub Time_check count=0 For NN=1 To n*m count=count+tend[NN] EndFor If Count=n*m Then Timer.Pause() if past< shortest_time Then Sound.PlayBellRingAndWait() Shapes.SetText(PGEND," Congratulation! You win! ") Else Shapes.SetText(PGEND," You finished. But you are not so fast. ") EndIf EndIf EndSub Sub OnMouseDown MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY For i = 1 To n*m If (MX >= PosX[i] And MX <= PosX[i]+dIW/4 And MY >= PosY[i] And MY <= PosY[i]+dIH/4) then onmove[i] = 1 If Text.IsSubText(Prei,i) Then ' avoid multiple selection Goto end1 EndIf Prei="_"+i+":" EndIf end1: EndFor EndSub Sub OnMouseUp check_original() ' check if finished or not Time_Check() ' fast time check For i = 1 To n*m onMove[i] = 0 EndFor EndSub Sub Time_show past= Math.Round((Clock.ElapsedMilliseconds-T0)/1000+0.5) Shapes.SetText(Currenttime,Past+" sec") ' Elapsed seconds EndSub Sub Random_photo For k=1 To n*m Retry: PreXY="" X= math.GetRandomNumber(4*m) ' X-scatter positon Y= Math.GetRandomNumber(4*n) ' Y-scatter-position PreXY="_"+Text.Append(x,y)+":" If Text.IsSubText(sumPreXY,PreXY) Then ' avoid near position Goto retry EndIf sumPreXY=sumPreXY+PreXY ' list up position PosX[k]=X*dIW/4+IW-dIW/4 PosY[k]=Y*dIH/4-dIH/4 Shapes.Animate(sCrop[k],PosX[k],PosY[k],2000) EndFor Shapes.Move(mask,0,0) For i= 1 To 60 Shapes.SetOpacity(mask,i) ' masking original photo (not completely) Program.Delay(20) EndFor Yellow_line() ' draw meshes GraphicsWindow.BrushColor="Navy" Currenttime= Shapes.AddText("0 sec") ' Count time Shapes.Move(Currenttime,50,GH-40) Shapes.Zoom(Currenttime,2,2) EndSub Sub Crop_photo n=5 ' Y - dividing number dIH=IH/n ' divided height m=4 ' X - dividing number dIW=IW/m ' divided width For j=1 To n ' Y For i=1 To m ' X kij=i+m*(j-1) ' count up Lmargin=GL+dIW*(i-1) Rmargin=DW-(GL+dIW*i) Tmargin=GT+dIH*(j-1) Bmargin=DH-(GT+dIH*j) Crop_Photo[kij]=PictureTools.TakeScreenShot(Lmargin,Rmargin,Tmargin,Bmargin)' Crop Screen sCrop[kij]= Shapes.AddImage(Crop_Photo[kij]) Shapes.Move(sCrop[kij],0,-500) EndFor EndFor Yellow_line() PGEND= Shapes.AddText(" Start rearrange photos correctly ! Shortest time is :"+shortest_time+" sec") Shapes.Zoom(PGEND,2,2) Shapes.Animate(PGend,300,GH-40,1000) EndSub Sub Yellow_line ' Make meshes For i=1 To m-1 GraphicsWindow.PenColor="Yellow" YLineH[i]= Shapes.AddLine(0,0,0,IH) ' Lengthwise direction Shapes.Move(YLineH[i],i*dIW,0) EndFor For i=1 To n-1 GraphicsWindow.PenColor="Yellow" YLineW[i]= Shapes.AddLine(0,0,IW,0) ' Transverse direction Shapes.Move(YLineW[i],0,i*dIH) EndFor EndSub Sub init DW= Desktop.Width DH= Desktop.Height GL=20 GT=40 GW=1300 GH=700 IW=(GW-100)/2 IH=GH*0.9 GraphicsWindow.Clear() GraphicsWindow.BackgroundColor="lightcyan" GraphicsWindow.Left=GL-5 ' Left trimming =5 GraphicsWindow.Top=GT-23 ' Top trimming =23 GraphicsWindow.Width=GW GraphicsWindow.Height=GH GraphicsWindow.Show() GraphicsWindow.BrushColor="Red" GraphicsWindow.FontSize=13 GraphicsWindow.FontItalic="True" ' EndSub Sub Url_Photo url="http://farm4.static.flickr.com/3152/2668377616_c14dc5a823.jpg" ' <------- "60sec" is this case 'url= Flickr.GetRandomPicture("Flower") ' If you want to get a random photo from Flickr PX=ImageList.LoadImage(url) GraphicsWindow.DrawResizedImage(PX,0,0,IW,IH) GraphicsWindow.Title=url GraphicsWindow.BrushColor="white" ' mask= Shapes.AddRectangle(IW,IH) Shapes.Move(mask,0,-1000) GraphicsWindow.BrushColor="red" ' Endsub End>RWJ900.sb< Start>RWJ975-0.sb< ' Draw Ellipse with Turtle ' Version 0.4 ' Copyright © 2018 Nonki Takahashi. The MIT License. ' Challenge 2018-09 ' Last update 2018-09-15 ' Program ID RWJ975-0 GraphicsWindow.Title = "Ellipse by Turtle 0.4" Init() a = 150 b = 100 x = ox - a y = oy - b GraphicsWindow.PenColor = "Orange" Turtle.Speed = 9 toRight = "True" Turtle.Turn(-90) For y1 = oy - b To oy + b Step 2 y = y1 - oy x = Math.SquareRoot(b * b - y * y) / b * a x1 = ox - x x2 = ox + x Turtle.PenUp() If toRight Then Turtle.X = x1 Turtle.Y = y1 Turtle.Turn(-180) Else Turtle.X = x2 Turtle.Y = y1 Turtle.Turn(180) EndIf Turtle.PenDown() Turtle.Move(x2 - x1) toRight = Not[toRight] EndFor GraphicsWindow.PenColor = "Black" For θ = 0 To 360 Step 5 _θ = Math.GetRadians(θ) x = ox - a * Math.Sin(_θ) y = oy + b * Math.Cos(_θ) If θ = 0 Then Turtle.X = x Turtle.Y = y Else Turtle.MoveTo(x, y) EndIf EndFor Sub Init Not = "False=True;True=False;" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh ox = gw / 2 oy = gh / 2 EndSub End>RWJ975-0.sb< Start>RWJ975.sb< ' Draw Ellipse with Turtle ' Copyright © 2018 Nonki Takahashi. The MIT License. ' Last update 2018-05-20 GraphicsWindow.Title = "Ellipse by Turtle" Turtle.Speed = 10 ratio = 2 / 3 d1 = 1.5 lastα2 = 0 For α1 = 0 To 359 β1 = 90 - α1 _β1 = Math.GetRadians(β1) _β2 = Math.ArcTan(ratio * Math.Tan(_β1)) β2 = Math.GetDegrees(_β2) If _β2 = 0 Then d2 = d1 Else d2 = d1 * Math.Sin(_β1) / Math.Sin(_β2) EndIf α2 = 90 - β2 Turtle.Move(d2) Turtle.Turn(α2 - lastα2) lastα2 = α2 EndFor b = d1 / (2 * Math.Tan(Math.GetRadians(1 / 2))) a = b / ratio x = Turtle.X y = Turtle.Y GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.FillEllipse(x, y - b - d1 / 2, 2 * a, 2 * b) Turtle.Hide() End>RWJ975.sb< Start>RWN229-0.sb< ' Space and Rocket (TB3) ' Version 0.2 ' Copyright © 2019 Nonki Takahashi. The MIT License. ' Program ID RWN229-0 GraphicsWindow.Title = "Space and Rocket" bg = "#000022" GraphicsWindow.BackgroundColor = bg gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh SB_Workaround() DrawGalaxy() DrawStars() ' initialize shapes for TB3 Shapes_Init_TB3() angle = 0 scale = 0.8 name = "TB3" Group_Add() i = nGroup cx = "" cy = "" angle = 60 Group_Rotate() Sub DrawGalaxy ox = 0 oy = gh For i = 1 To 200 rand = Math.GetRandomNumber(3) If rand = 1 Then GraphicsWindow.BrushColor = "#01FF0099" ElseIf rand = 2 Then GraphicsWindow.BrushColor = "#0100FF99" ElseIf rand = 3 Then GraphicsWindow.BrushColor = "#010000FF" EndIf rx = Math.GetRandomNumber(gw / 4) + gw * 3 / 4 ry = Math.GetRandomNumber(gh / 4) + gh * 3 / 4 a = Math.GetRandomNumber(100) - 1 _a = Math.GetRadians(a) x = ox + rx * Math.Sin(_a) y = oy - ry * Math.Cos(_a) s = Math.GetRandomNumber(gh / 2) GraphicsWindow.FillEllipse(x - s / 2 , y - s / 2 , s, s) EndFor EndSub Sub DrawStars For i = 1 To 500 h = Text.GetSubText("456789ABCDEF", Math.GetRandomNumber(12), 1) GraphicsWindow.BrushColor = "#" + h + h + "FFFFFF" x = Math.GetRandomNumber(gw) - 1 y = Math.GetRandomNumber(gh) - 1 s = Math.GetRandomNumber(3) GraphicsWindow.FillEllipse(x, y, s, s) EndFor 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["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) shp["width"] = shp["x3"] - shp["x2"] shp["height"] = shp["y2"] - shp["y1"] ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) shp["width"] = Math.Max(shp["x1"], shp["x2"]) - Math.Min(shp["x1"], shp["x2"]) shp["height"] = Math.Max(shp["y1"], shp["y2"]) - Math.Min(shp["y1"], shp["y2"]) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) shp["width"] = shp["fs"] * 0.6 * Text.GetLength(shp["text"]) shp["height"] = shp["fs"] EndIf param["x"] = shp["x"] param["y"] = shp["y"] param["cx"] = shWidth / 2 param["cy"] = shHeight / 2 param["width"] = shp["width"] param["height"] = shp["height"] param["scale"] = s param["angle"] = 0 Shapes_CalcRotateZoomPos() 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, shY + y) Else Shapes.Move(shp["obj"], shX + x, shY + y) 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 ' Group | Move a group ' param group[i] - group To move ' param x, y - position To move ' return group[i] - updated group 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] If silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], grp["x"] + _x, grp["y"] + _y) EndFor group[i] = grp j = Stack.PopValue("local") EndSub Sub Group_Rotate ' Group | Rotate a group ' param group[i] - group To move ' param cx, cy - rotation center (If given) ' param angle - To 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 If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"] + grp["angle"]) SB_RotateWorkAround() shp["wx"] = x shp["wy"] = y EndIf 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 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_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 * param["scale"] y = _cy - param["height"] / 2 * param["scale"] 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_TB3 ' Shapes | initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 249 ' x offset shY = 50.74 ' y offset shape = "" shape[1] = "func=ell;x=35;y=26.92;width=30;height=130;pw=0;bc=OrangeRed;" shape[2] = "func=tri;x=39.39;y=0.00;x1=10.6;y1=0;x2=0;y2=45.96;x3=21.21;y3=45.96;pw=0;bc=OrangeRed;" shape[3] = "func=rect;x=35;y=91.92;width=30;height=160;pw=0;bc=OrangeRed;" shape[4] = "func=ell;x=42;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[5] = "func=tri;x=43.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[6] = "func=tri;x=43.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[7] = "func=rect;x=47;y=283.92;width=6;height=40;pw=0;bc=OrangeRed;" shape[8] = "func=ell;x=48;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[9] = "func=tri;x=49.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[10] = "func=tri;x=49.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[11] = "func=tri;x=44;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=#DDDDDD;" shape[12] = "func=rect;x=46;y=316.92;width=8;height=8;angle=180;pw=0;bc=#DDDDDD;" shape[13] = "func=tri;x=52;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=#DDDDDD;" shape[14] = "func=rect;x=30;y=91.92;width=40;height=10;pw=0;bc=White;" shape[15] = "func=ell;x=25;y=291.92;width=50;height=20;pw=0;bc=Gray;" shape[16] = "func=rect;x=25;y=251.92;width=50;height=50;pw=0;bc=OrangeRed;" shape[17] = "func=tri;x=25;y=231.92;x1=10;y1=0;x2=0;y2=20;x3=20;y3=20;pw=0;bc=OrangeRed;" shape[18] = "func=tri;x=55;y=231.92;x1=10;y1=0;x2=0;y2=20;x3=20;y3=20;pw=0;bc=OrangeRed;" shape[19] = "func=rect;x=65;y=279.92;width=30;height=20;angle=30;pw=0;bc=OrangeRed;" shape[20] = "func=rect;x=5;y=279.92;width=30;height=20;angle=-30;pw=0;bc=OrangeRed;" shape[21] = "func=ell;x=0;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[22] = "func=tri;x=1.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[23] = "func=tri;x=1.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[24] = "func=ell;x=6;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[25] = "func=tri;x=7.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[26] = "func=tri;x=7.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[27] = "func=ell;x=90;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[28] = "func=tri;x=91.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[29] = "func=tri;x=91.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[30] = "func=ell;x=84;y=276.92;width=10;height=40;pw=0;bc=OrangeRed;" shape[31] = "func=tri;x=85.46;y=268.64;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;pw=0;bc=OrangeRed;" shape[32] = "func=tri;x=85.46;y=311.06;x1=3.53;y1=0;x2=0;y2=14.14;x3=7.07;y3=14.14;angle=180;pw=0;bc=OrangeRed;" shape[33] = "func=line;x=8;y=171.92;x1=0;y1=0;x2=0;y2=150;pw=4;pc=OrangeRed;" shape[34] = "func=line;x=92;y=171.92;x1=0;y1=0;x2=0;y2=150;pw=4;pc=OrangeRed;" shape[35] = "func=line;x=7.92;y=135.77;x1=32.14;y1=0;x2=0.00;y2=38.3;pw=4;pc=OrangeRed;" shape[36] = "func=line;x=59.92;y=135.77;x1=0.00;y1=0;x2=32.14;y2=38.3;pw=4;pc=OrangeRed;" shape[37] = "func=tri;x=18;y=119.92;x1=5;y1=0;x2=0;y2=60;x3=10;y3=60;angle=-144;pw=0;bc=OrangeRed;" shape[38] = "func=tri;x=72;y=119.92;x1=5;y1=0;x2=0;y2=60;x3=10;y3=60;angle=144;pw=0;bc=OrangeRed;" shape[39] = "func=tri;x=2;y=269.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;pw=0;bc=White;" shape[40] = "func=rect;x=4;y=269.92;width=8;height=8;pw=0;bc=White;" shape[41] = "func=tri;x=10;y=269.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;pw=0;bc=White;" shape[42] = "func=tri;x=2;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=White;" shape[43] = "func=rect;x=4;y=316.92;width=8;height=8;angle=180;pw=0;bc=White;" shape[44] = "func=tri;x=10;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=White;" shape[45] = "func=tri;x=86;y=269.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;pw=0;bc=White;" shape[46] = "func=rect;x=88;y=269.92;width=8;height=8;pw=0;bc=White;" shape[47] = "func=tri;x=94;y=269.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;pw=0;bc=White;" shape[48] = "func=tri;x=86;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=White;" shape[49] = "func=rect;x=88;y=316.92;width=8;height=8;angle=180;pw=0;bc=White;" shape[50] = "func=tri;x=94;y=316.92;x1=2;y1=0;x2=0;y2=8;x3=4;y3=8;angle=180;pw=0;bc=White;" shape[51] = "func=tri;x=30;y=176.92;x1=5;y1=0;x2=0;y2=10;x3=10;y3=10;pw=0;bc=Gray;" shape[52] = "func=rect;x=35;y=176.92;width=30;height=10;pw=0;bc=Gray;" shape[53] = "func=tri;x=60;y=176.92;x1=5;y1=0;x2=0;y2=10;x3=10;y3=10;pw=0;bc=Gray;" shape[54] = "func=tri;x=20;y=186.92;x1=10;y1=0;x2=0;y2=35;x3=20;y3=35;pw=0;bc=DimGray;" shape[55] = "func=rect;x=30;y=186.92;width=40;height=35;pw=0;bc=DimGray;" shape[56] = "func=tri;x=60;y=186.92;x1=10;y1=0;x2=0;y2=35;x3=20;y3=35;pw=0;bc=DimGray;" shape[57] = "func=tri;x=20;y=221.92;x1=15;y1=0;x2=0;y2=5;x3=30;y3=5;angle=180;pw=0;bc=DimGray;" shape[58] = "func=rect;x=35;y=221.92;width=30;height=5;angle=180;pw=0;bc=DimGray;" shape[59] = "func=tri;x=50;y=221.92;x1=15;y1=0;x2=0;y2=5;x3=30;y3=5;angle=180;pw=0;bc=DimGray;" shape[60] = "func=line;x=21.01;y=186.91;x1=9.66;y1=0.00;x2=0.00;y2=35.00;pw=2;pc=Gray;" shape[61] = "func=line;x=28.77;y=186.91;x1=7.08;y1=0.00;x2=0.00;y2=35.00;pw=2;pc=Gray;" shape[62] = "func=line;x=42.23;y=186.91;x1=2.58;y1=0.00;x2=0;y2=35.00;pw=2;pc=Gray;" shape[63] = "func=line;x=55.17;y=186.91;x1=0;y1=0.00;x2=2.58;y2=35.00;pw=2;pc=Gray;" shape[64] = "func=line;x=64.13;y=186.91;x1=0.00;y1=0.00;x2=7.08;y2=35.00;pw=2;pc=Gray;" shape[65] = "func=line;x=69.31;y=186.91;x1=0;y1=0.00;x2=9.65;y2=35.00;pw=2;pc=Gray;" shape[66] = "func=line;x=32;y=126.92;x1=0;y1=0;x2=0;y2=13;pw=2;pc=Gray;" shape[67] = "func=line;x=27;y=135.92;x1=0;y1=0;x2=0;y2=11;pw=2;pc=Gray;" shape[68] = "func=line;x=22;y=144.92;x1=0;y1=0;x2=0;y2=9;pw=2;pc=Gray;" shape[69] = "func=line;x=17;y=153.92;x1=0;y1=0;x2=0;y2=7;pw=2;pc=Gray;" shape[70] = "func=line;x=12;y=162.92;x1=0;y1=0;x2=0;y2=5;pw=2;pc=Gray;" shape[71] = "func=line;x=68;y=126.92;x1=0;y1=0;x2=0;y2=13;pw=2;pc=Gray;" shape[72] = "func=line;x=73;y=135.92;x1=0;y1=0;x2=0;y2=11;pw=2;pc=Gray;" shape[73] = "func=line;x=78;y=144.92;x1=0;y1=0;x2=0;y2=9;pw=2;pc=Gray;" shape[74] = "func=line;x=83;y=153.92;x1=0;y1=0;x2=0;y2=7;pw=2;pc=Gray;" shape[75] = "func=line;x=88;y=162.92;x1=0;y1=0;x2=0;y2=5;pw=2;pc=Gray;" EndSub End>RWN229-0.sb< Start>RWP251.sb< GraphicsWindow.Show() GW = 600 GraphicsWindow.Width = GW GraphicsWindow.Height = GW TextWindow.Left = GraphicsWindow.Left + GW + 15 TextWindow.Top = GraphicsWindow.Top GraphicsWindow.PenColor = "White" Pi = Math.Pi Ground = GW-100 GraphicsWindow.DrawLine(0,Ground,GW,Ground) Metaball_Sides = 16 Metaball_Radius = 100 Metaball_Hardness = Metaball_Radius/2 Metaball_Original_Radius_Sum = Metaball_Sides*Metaball_Radius For i = 0 to Metaball_Sides Outline_Angle[i] = Pi * ((i * (360/Metaball_Sides)) / 180) 'No -0.5 endfor GraphicsWindow.BrushColor = "#55FF0000" GraphicsWindow.PenWidth = 0 Circle = Shapes.AddEllipse(Metaball_Radius*2,Metaball_Radius*2) GraphicsWindow.BrushColor = "Red" Center = Shapes.AddEllipse(10,10) GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenWidth = 5 While "True" UpdateOutlines() If Mouse.IsLeftButtonDown Then Metaball_Y = GraphicsWindow.MouseY Metaball_X = GraphicsWindow.MouseX Metaball_WY = 0 endif Shapes.Move(Center,Metaball_Center_X-5,Metaball_Center_Y-5) 'The circle is meant to show the difference between the original area and the metaball area Shapes.Move(Circle,Metaball_Center_X-Metaball_Radius,Metaball_Center_Y-Metaball_Radius) TextWindow.WriteLine("Outline radius sum: " + barg) TextWindow.WriteLine("Original Radius Sum: " + Metaball_Original_Radius_Sum) Program.Delay(15) TextWindow.Clear() endwhile Sub UpdateOutlines Metaball_WY = Metaball_WY + 1 Metaball_Y = Metaball_Y + Metaball_WY Metaball_Cornersum_Y = 0 Metaball_Cornersum_X = 0 For i = 1 to Metaball_Sides Metaball_Cornersum_Y = Metaball_Cornersum_Y + Outline_Y[i] Metaball_Cornersum_X = Metaball_Cornersum_X + Outline_X[i] endfor Metaball_Center_Y = Metaball_Cornersum_Y/Metaball_Sides Metaball_Center_X = Metaball_Cornersum_X/Metaball_Sides If Metaball_Center_Y+Metaball_Radius > Ground Then 'Metaball_Center_Y+Metaball_Radius <= this cant be right since the metaball radius is actually constantly changing.. 'but Metaball_Radius is always 100. any solution? Metaball_WY = (Metaball_WY*0.9)-(Metaball_Hardness - (Ground - Metaball_Y))*0.05 For i = 0 To Metaball_Sides Outline_Radius[i] = Metaball_WY + Metaball_Radius 'Math.SquareRoot((Metaball_Area)/Pi) endfor endif Outline_NotTouchingGroundSum = Metaball_Sides Outline_Radius_Sum = 0 'First pass at shape and area For i = 0 To Metaball_Sides Outline_X[i] = Metaball_Center_X+Outline_Radius[i]*Math.Cos(Outline_Angle[i]) Outline_Y[i] = Metaball_Center_Y+Outline_Radius[i]*Math.Sin(Outline_Angle[i]) If Outline_Y[i] > Ground Then Outline_Y[i] = Ground Outline_Radius[i] = Math.SquareRoot(Math.Power((Outline_Y[i]-Metaball_Center_Y),2) + Math.Power((Outline_X[i]-Metaball_Center_X),2)) Outline_NotTouchingGroundSum = Outline_NotTouchingGroundSum - 1 Else Outline_Radius[i] = Metaball_Radius endif Outline_Radius_Sum = Outline_Radius_Sum + Outline_Radius[i] endfor 'Rescale radii to maintain area approximately scale = (Metaball_Original_Radius_Sum-Outline_Radius_Sum)/Metaball_Sides barg = 0 'Second pass at shape For i = 0 To Metaball_Sides Outline_Radius[i] = Outline_Radius[i] + scale barg = barg + Outline_Radius[i] Outline_X[i] = Metaball_X + Outline_Radius[i] * Math.Cos(Outline_Angle[i]) Outline_Y[i] = Metaball_Y + Outline_Radius[i] * Math.Sin(Outline_Angle[i]) If Outline_Y[i] > Ground Then Outline_Y[i] = Ground ' I dont think we need this code here because the radius isnt being used after this here.... (can we delete it?) ' Outline_Radius[i] = Math.SquareRoot(Math.Power((Outline_Y[i]-Metaball_Center_Y),2) + Math.Power((Outline_X[i]-Metaball_Center_X),2)) 'Else ' Outline_Radius[i] = Metaball_Radius endif If i > 0 Then Shapes.Remove(Outline[i]) Outline[i] = Shapes.AddLine(Outline_X[i-1],Outline_Y[i-1],Outline_X[i],Outline_Y[i]) endif endfor endsub End>RWP251.sb< Start>RWV527.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 = "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 '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>RWV527.sb< Start>RWZ477.sb< ' Challenge of the month August 2013 Curriculum 4.1's See Saw exercise By NaochanON GUI() Controls.ButtonClicked=Onclicked GraphicsWindow.KeyDown = OnKeyDown While "true" If Play="True" Then angle=angle+dangle BX=BX+ angle/5 BY=XYC["Y"]+(BX-XYC["X"])*math.Tan(math.GetRadians(angle))-DR Shapes.Move(ball,BX,BY) Shapes.Rotate(ball,angle) Shapes.Rotate(rect,angle) '----------------------------------------------------------- et=Math.Floor((clock.ElapsedMilliseconds-t0)/100)/10 Shapes.SetText(msg," Elapsed time= "+et+" sec") '----------------------------------------------------------- If Math.Abs(BX+DR/2-XYC["X"])>(RWH["W"]/2) then play="False" Shapes.Animate(ball,BX,XYC["Y"]+1000,2000) ' ball falls endif endif Program.Delay(5) endwhile Sub OnKeyDown If Play = "True" Then dangle = dang[GraphicsWindow.LastKey] EndIf EndSub Sub Onclicked Play="True" angle=2*dx/math.Abs(dx) ' +2 or -2 t0=clock.ElapsedMilliseconds EndSub Sub GUI DR=30 ' ball size RWH="W=500;H=15" ' bar width height XYC="X=300;Y=200" ' center position dang="Left=-0.15;Right=0.1" ' bar rotating speed // not even dx= 50.5-Math.GetRandomNumber(100) ' start point ... avoid center position '----------------------------------------------------------- GraphicsWindow.BackgroundColor="Lightcyan" Tri= Shapes.AddTriangle(DR,0,0,DR,2*DR,DR) '----------------------------------------------------------- GraphicsWindow.BrushColor="Darkgreen" GraphicsWindow.PenColor="Darkgreen" rect=shapes.AddRectangle(RWH["W"],RWH["H"]) '----------------------------------------------------------- GraphicsWindow.BrushColor="Red" GraphicsWindow.PenColor="Red" ball=shapes.AddEllipse(DR,DR) '----------------------------------------------------------- Shapes.Move(ball,XYC["X"]+dx-DR/2,XYC["Y"]-DR) Shapes.Move(rect,XYC["X"]-RWH["W"]/2,XYC["Y"]) Shapes.Move(tri,XYC["X"]-DR,XYC["Y"]+RWH["H"]) '----------------------------------------------------------- GraphicsWindow.FontSize=20 Controls.AddButton("Start",XYC["X"],XYC["Y"]+100) msg= Shapes.AddText(" *** Push Start button to play ***") '----------------------------------------------------------- Play="False" BX= Shapes.GetLeft(ball) BY= Shapes.GetTop(ball) EndSub End>RWZ477.sb< Start>RXC438.sb< gh=600 gw=800 GraphicsWindow.Width = gw GraphicsWindow.Height = gh start: GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "Black" count = 0 For i = 1 To gh x=math.GetRandomNumber(gw) y=math.GetRandomNumber(gh) size=math.GetRandomNumber(8) R=100+math.GetRandomNumber(55) G=100+math.GetRandomNumber(55) B=100+math.GetRandomNumber(55) GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(R,G,B) GraphicsWindow.FillEllipse(x,y,size,size) EndFor next: count = count+1 startx=math.GetRandomNumber(gw) starty=gh endx=math.GetRandomNumber(gw) endy=math.GetRandomNumber(gh/2) rand = math.GetRandomNumber(6) If (rand=1) Then R=254 G=math.GetRandomNumber(100) B=0 EndIf If (rand=2) Then G=254 B=math.GetRandomNumber(100) R=0 EndIf If (rand=3) Then B=254 R=math.GetRandomNumber(100) G=0 EndIf If (rand=4) Then R=254 G=254 B=math.GetRandomNumber(100) EndIf If (rand=5) Then G=254 B=254 R=math.GetRandomNumber(100) EndIf If (rand=6) Then B=254 R=254 G=math.GetRandomNumber(100) EndIf GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(R,G,B) ball = Shapes.AddEllipse(15,15) For i = 1 To 100 x=startx+i/100*(endx-startx) y=starty+i/100*(endy-starty) Program.Delay(5) Shapes.Move(ball, x, y) endfor Shapes.Remove(ball) Sound.PlayClick() nlayer = 50 nangle = 20 grav = Math.GetRandomNumber(8)/nlayer For k = 1 To 2 If (k = 2) then GraphicsWindow.BrushColor="Black" EndIf GraphicsWindow.DrawText(endx-30,endy-50,"Well Done!") For i = 1 To nlayer Program.Delay(500/nlayer) dist = 200/nlayer*i size = 1+0.2*nlayer/math.SquareRoot(i) For j = 1 To nangle x=endx+dist*math.Cos(j/nangle*2*3.14) y=endy+dist*math.Sin(j/nangle*2*3.14)+grav*i*i GraphicsWindow.FillEllipse(x,y,size,size) EndFor If (k = 2) Then Program.Delay(10) EndIf EndFor Program.Delay(300) EndFor If (count = 10) Then Goto start EndIf Goto next end: End>RXC438.sb< Start>RXG926.sb< midw = GraphicsWindow.Width / 2 midh = GraphicsWindow.Height / 2 'stupid math, dont change sizew and sizeh please sizew = 150 sizeh = 90 GraphicsWindow.BrushColor = "green" GraphicsWindow.PenWidth = 0 bg = Shapes.AddRectangle(sizew,sizeh) Shapes.Move(bg, midw - (sizew/2),midh - (sizeh/2)) GraphicsWindow.BrushColor = "yellow" topd = Shapes.AddTriangle(midw - (sizew/2),midh,midw,midh - (sizeh/2),midw + (sizeh-15),midh) downd = Shapes.AddTriangle(midw + (sizew/2),midh,midw,midh + (sizeh/2),midw - (sizeh-15),midh) GraphicsWindow.BrushColor = "blue" circle = Shapes.AddEllipse(sizew/3.5,sizeh/2) Shapes.Move(circle,midw-(sizew/3.5)/2,midh-(sizeh/2)/2) End>RXG926.sb< Start>RXH939-0.sb< ' SmallBasic Version 1.2 ' Program: ScanImage ' Changelog: 16.05 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/325039ec-8d1f-45f0-89e9-72bacc3ca7a7/how-can-i-draw-this-sphere ' ImportURL: http://smallbasic.com/program/?RXH939-0 ' Extension: LitDev ' Comment: further use img (resp. img2 after using LDImage.Copy(img)) ' ' Variables: ' ToDo: ' ================================================================================ 'pic = "https://social.msdn.microsoft.com/Forums/getfile/862810" pic = Program.Directory +"\img\RedBall.png" img = ImageList.LoadImage(pic) imgW = ImageList.GetWidthOfImage(img) ' 75 (1-75) 'imgH = ImageList.GetHeightOfImage(img) ' 99 (1-99) r = Math.Floor(imgW/2) 'Math.Ceiling(imgW/2) LDImage.Crop(img, 0,0, imgW,imgW) GraphicsWindow.DrawImage(img, 0,0) 'img2 = LDImage.Copy(img) arrPxl = LDImage.GetImagePixels(img) ScanImage() GraphicsWindow.DrawImage(img, 100,0) ' ////////// SUB \\\\\\\\\\ Sub ScanImage ' remove Pixels outside of circle -> set to 'Transparent' For x = 1 To imgW For y = 1 To imgW If (x-r)*(x-r) + (y-r)*(y-r) > r*r Then '' >= r*r Then arrPxl[x][y] = LDColours.Transparent EndIf EndFor EndFor img = LDImage.SetImagePixels(arrPxl) EndSub End>RXH939-0.sb< Start>RXH939-1.sb< ' SmallBasic Version 1.2 ' Program: BrushEllipse2 (from a drawn square, rectangle or what ever) ' Changelog: 16.05 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/325039ec-8d1f-45f0-89e9-72bacc3ca7a7/how-can-i-draw-this-sphere ' ImportURL: http://smallbasic.com/program/?RXH939-1 ' Extension: LitDev ' Comment: further use shpEll ' ' Variables: ' ToDo: ' ================================================================================ 'pic = "https://social.msdn.microsoft.com/Forums/getfile/862810" 'pic = Program.Directory +"\img\RedBall.png" '' from region (x,y, w,h) resp. (x,y, wh,wh) for circle x = 100 y = 200 'w = 100 'h = 100 ' r = Math.SquareRoot(w*w + h*h) wh = 100 ' r = imgW * Math.SquareRoot(2) '' wh .. w = h for circle GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.FillRectangle(x,y, wh,wh) Program.Delay(2000) ''img = ImageList.LoadImage(pic) img = LDGraphicsWindow.Capture("","") GraphicsWindow.Clear() '' or leave the original drawing there ''imgW = ImageList.GetWidthOfImage(img) imgW = wh ' or w ''imgH = ImageList.GetHeightOfImage(img) 'imgH = wh ' or h LDImage.Crop(img, x,y, imgW,imgW) ' Ellipse Shape ... GraphicsWindow.PenWidth = 0 shpEll = Shapes.AddEllipse(imgW,imgW) ' w,h) ' ... with BrushImage LDShapes.BrushShape(shpEll, LDShapes.BrushImage(img)) LDImage.Remove(img) Shapes.Move(shpEll, (GraphicsWindow.Width-imgW)/2, (GraphicsWindow.Height-imgW)/2) int = 1000 LDShapes.AnimateZoom(shpEll, int, 0, 10,10) LDShapes.AnimateRotation(shpEll, 10000, 0) GraphicsWindow.MouseDown = OnDown GraphicsWindow.KeyDown = OnDown ' ////////// EVENT \\\\\\\\\\ Sub OnDown If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf int = 1000 - int 'int = Math.Abs(int - 1000) LDShapes.AnimateZoom(shpEll, int, 0, 6,6) ' 10,10) EndSub End>RXH939-1.sb< Start>RXH939.sb< ' SmallBasic Version 1.2 ' Program: BrushEllipse ' Changelog: 16.04 ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/325039ec-8d1f-45f0-89e9-72bacc3ca7a7/how-can-i-draw-this-sphere ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ pic = "https://social.msdn.microsoft.com/Forums/getfile/862810" 'pic = Program.Directory +"\img\RedBall.png" img = ImageList.LoadImage(pic) imgW = ImageList.GetWidthOfImage(img) 'imgH = ImageList.GetHeightOfImage(img) LDImage.Crop(img, 0,0, imgW,imgW) ' Ellipse Shape GraphicsWindow.PenWidth = 0 shpEll = Shapes.AddEllipse(imgW,imgW) ' ... with BrushImage LDShapes.BrushShape(shpEll, LDShapes.BrushImage(img)) LDImage.Remove(img) Shapes.Move(shpEll, (GraphicsWindow.Width-imgW)/2, (GraphicsWindow.Height-imgW)/2) int = 1000 LDShapes.AnimateZoom(shpEll, int, 0, 10,10) LDShapes.AnimateRotation(shpEll, 10000, 0) GraphicsWindow.MouseDown = OnDown GraphicsWindow.KeyDown = OnDown ' ////////// SUB \\\\\\\\\\ Sub OnDown If GraphicsWindow.LastKey = "Escape"Then Program.End() EndIf 'int = Math.Abs(int - 1000) int = 1000 - int LDShapes.AnimateZoom(shpEll, int, 0, 6,6) ' 10,10) EndSub End>RXH939.sb< Start>RXH973.sb< ii=ImageList.LoadImage("e:\horrc.png") i1=ImageList.LoadImage("e:\hc2.png") ccc=LDImage.SplitImage(ii 8 1) cc1=LDImage.SplitImage(i1 5 1) ss=4 d1=0 GraphicsWindow.Title="SB Horace v0.11 GraphicsWindow.BackgroundColor="teal For f=1 To 8 cc[f-1]=Shapes.AddImage(ccc[f][1]) Shapes.HideShape(cc[f-1]) EndFor For f=1 To 5 cq[f-1]=Shapes.AddImage(cc1[f][1]) Shapes.HideShape(cq[f-1]) EndFor For f=0 To 7 Shapes.Move(cc[f] 15 15) Shapes.Move(cq[f] 550 15) EndFor Timer.Interval=15 Timer.Tick=ttt GraphicsWindow.KeyDown=kkk GraphicsWindow.PenWidth=3 GraphicsWindow.BrushColor="black GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height) GraphicsWindow.DrawRectangle(5 5 GraphicsWindow.Width-10 GraphicsWindow.Height-10) GraphicsWindow.DrawRectangle(125 124 200 200) For f=0 To 5 Shapes.Animate(cq[f] 15 15 5500) EndFor Sub kkk ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) If ll="left" Then dx=-ss dy=0 dd=6 ox=-3 oy=9 ElseIf ll="right" Then dx=ss dy=0 dd=0 ox=33 oy=9 ElseIf ll="up" Then dx=0 dy=-ss dd=4 ox=5 oy=-3 ElseIf ll="down" Then dx=0 dy=ss dd=2 ox=5 oy=35 EndIf For f=0 To 7 Shapes.HideShape(cc[f]) EndFor EndSub Sub ttt q=q+1 If Math.Remainder(q 12)=0 Then Shapes.HideShape(cc[m+dd]) Shapes.ShowShape(cc[1-m+dd]) If d1=0 Then Shapes.HideShape(cq[m]) Shapes.ShowShape(cq[1-m]) EndIf m=1-m EndIf For ff=0 To 7 If LDShapes.OverlapCircle(cc[ff] cq[1]) Then dx=0 dy=0 For f=0 To 7 Shapes.Move(cc[f] 15 15) Shapes.Move(cq[f] 550 15) EndFor For f=0 To 5 Shapes.Animate(cq[f] 15 15 5500) EndFor rr=Shapes.AddRectangle(GraphicsWindow.Width GraphicsWindow.Height) LDShapes.BrushColour(rr "black") LDShapes.AnimateOpacity(rr 750 1) Program.Delay(800) Shapes.Remove(rr) Goto xff EndIf EndFor xff: aa=Shapes.GetLeft(cc[1]) bb=Shapes.GetTop(cc[1]) ' GraphicsWindow.SetPixel (aa+ox bb+oy "white") If GraphicsWindow.GetPixel(aa+ox bb+oy)="#000000" or GraphicsWindow.GetPixel(ox+aa+1 bb+oy)="#000000" or GraphicsWindow.GetPixel(aa+ox oy+bb+1)="#000000" or GraphicsWindow.GetPixel(aa+1+ox oy+bb+1)="#000000" Then ' GraphicsWindow.Title=GraphicsWindow.GetPixel(aa+ox bb+oy) Else ' EndIf For f=0 To 7 Shapes.Move(cc[f] dx+aa dy+bb) EndFor EndIf EndSub End>RXH973.sb< Start>RXJ895.sb< GraphicsWindow.Title = "* * * Match Sticks * * * " GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Width = 620 GraphicsWindow.Height = 360 Turtle.Speed = 10 GameKey=25 For i = 26 To 598 Step 26 GraphicsWindow.PenColor = "Moccasin" GraphicsWindow.PenWidth = 6 Turtle.X = i Turtle.Y = 72 Turtle.MoveTo(i,220) GraphicsWindow.PenColor = "red" GraphicsWindow.PenWidth = 8 GraphicsWindow.DrawLine(i,60,i,71) Sticks=Sticks + 1 endfor X= 624 Turtle.Hide() Turtle.Speed = 9 GraphicsWindow.DrawText(30,230,"You and the computer take turns drawing 1,2 or 3 match sticks.") GraphicsWindow.DrawText(30,245,"who ever draws the last one is the looser.") GraphicsWindow.DrawText(30,260,"Do you want me to go first? (Y/N)") GraphicsWindow.TextInput = TextInput1 Sub TextInput1 Key=GraphicsWindow.LastText If Sticks = 23 then If Key="y" Or Key="n" then If Key = "y" Then ComputersTurn() PlayersTurn() EndIf If Key = "n" Then PlayersTurn() EndIf Else GraphicsWindow.ShowMessage("You pressed somthing other than y or n","Input Error") EndIf EndIf EndSub Sub PlayersTurn GraphicsWindow.TextInput = TextInput2 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(30,230, 400, 60) GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawText(30,260,"Please press number key 1,2,3 or Q to quit and R to reset.") EndSub Sub ComputersTurn If Sticks = GameKey then Qty = Math.GetRandomNumber(3) If Sticks=1 Then Qty=1 EndIf GraphicsWindow.ShowMessage("Computer draws " + Qty,"Computers Turn") RemoveStick() GameKey=GameKey-4 If Sticks<1 Then GraphicsWindow.ShowMessage("Looks like you got lucky that time.","Computer Lost") Program.End() EndIf Else GameKey=GameKey-4 Qty=Sticks-GameKey If Qty=0 Then Qty = Math.GetRandomNumber(3) EndIf If Sticks=1 Then Qty=1 EndIf GraphicsWindow.ShowMessage("Computer draws " + Qty,"Computers Turn") RemoveStick() If Sticks<1 Then GraphicsWindow.ShowMessage("Looks like you got lucky that time.","Computer Lost") Program.End() EndIf 'GraphicsWindow.ShowMessage("Sticks = " + Sticks + " GameKey = " + GameKey,"Computer Winning!") EndIf EndSub Sub TextInput2 Key=GraphicsWindow.LastText If (Key>0 And Key<4) or (Key="q") or (Key="r") then Qty=Key RemoveStick() If Sticks<1 Then GraphicsWindow.ShowMessage("I WIN, YOU LOOSE","Computer Wins!") Program.End() EndIf ComputersTurn() Else GraphicsWindow.ShowMessage("You pressed somthing other than 1,2 or 3","Input Error") EndIf EndSub Sub RemoveStick 'GraphicsWindow.ShowMessage(Qty + " Sticks to be removed","RemoveStick") For D = Qty To 1 step - 1 X=X-26 Sticks=Sticks - 1 GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 8 Turtle.X = X Turtle.Y = 60 Turtle.MoveTo(X,220) EndFor EndSub End>RXJ895.sb< Start>RXN233.sb< 'triangle numbers 'Robin Andrews ' begin: TextWindow.WriteLine("Please enter the which triangle number you would like to know (as a number): ") n=textwindow.ReadNumber() ' sum = 0 For i = 1 To n sum = sum + i EndFor TextWindow.WriteLine("Answer: ") TextWindow.Write(sum) TextWindow.WriteLine("") ' repeat: TextWindow.WriteLine("Another? (y/n): ") repeat = TextWindow.Read() If repeat = "y" Then Goto begin ElseIf repeat = "n" then Program.End() else Goto repeat EndIf End>RXN233.sb< Start>RXP210.sb< pi="31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157959847035622262934860034158722980534989650226291748788202734209222245339856264766914905562842503912757710284027998066365825488926488025456610172967026640765590429099456815065265305371829412703369313785178609040708667114965583434347693385781711386455873678123014587687126603489139095620099393610310291616152881384379099042317473363948045759314931405297634757481193567091101377517210080315590248530906692037671922033229094334676851422144773793937517034436619910403375111735471918550464490263655128162288244625759163330391072253837421821408835086573917715096828874782656995995744906617583441375223970968340800535598491754173818839994469748676265516582765848358845314277568790029095170283529716344562129640435231176006651012412006597558512761785838292041974844236080071930457618932349229279650198751872127267507981255470958904556357921221033346697499235630254947802490114195212382815309114079073860251522742995818072471625916685451333123948049470791191532673430282441860414263639548000448002670496248201792896476697583183271314251702969234889627668440323260927524960357996469256504936818360900323809293459588970695365349406034021665443755890045632882250545255640564482465151875471196218443965825337543885690941130315095261793780029741207665147939425902989695946995565761218656196733786236256125216320862869222103274889218654364802296780705765615144632046927906821207388377814233562823608963208068222468012248261177185896381409183903673672220888321513755600372798394004152970028783076670944474560134556417254370906979396122571429894671543578468788614445812314593571984922528471605049221242470141214780573455105008019086996033027634787081081754501193071412233908663938339529425786905076431006383519834389341596131854347546495569781038293097164651438407007073604112373599843452251610507027056235266012764848308407611830130527932054274628654036036745328651057065874882256981579367897669742205750596834408697350201410206723585020072452256326513410559240190274216248439140359989535394590944070469120914093870012645600162374288021092764579310657922955249887275846101264836999892256959688159205600101655256375679 fi="16180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911374847540880753868917521266338622235369317931800607667263544333890865959395829056383226613199282902678806752087668925017116962070322210432162695486262963136144381497587012203408058879544547492461856953648644492410443207713449470495658467885098743394422125448770664780915884607499887124007652170575179788341662562494075890697040002812104276217711177780531531714101170466659914669798731761356006708748071013179523689427521948435305678300228785699782977834784587822891109762500302696156170025046433824377648610283831268330372429267526311653392473167111211588186385133162038400522216579128667529465490681131715993432359734949850904094762132229810172610705961164562990981629055520852479035240602017279974717534277759277862561943208275051312181562855122248093947123414517022373580577278616008688382952304592647878017889921990270776903895321968198615143780314997411069260886742962267575605231727775203536139362107673893764556060605921658946675955190040055590895022953094231248235521221241544400647034056573479766397239494994658457887303962309037503399385621024236902513868041457799569812244574717803417312645322041639723213404444948730231541767689375210306873788034417009395440962795589867872320951242689355730970450959568440175551988192180206405290551893494759260073485228210108819464454422231889131929468962200230144377026992300780308526118075451928877050210968424936271359251876077788466583615023891349333312231053392321362431926372891067050339928226526355620902979864247275977256550861548754357482647181414512700060238901620777322449943530889990950168032811219432048196438767586331479857191139781539780747615077221175082694586393204565209896985556781410696837288405874610337810544439094368358358138113116899385557697548414914453415091295407005019477548616307542264172939468036731980586183391832859913039607201445595044977921207612478564591616083705949878600697018940988640076443617093341727091914336501371576601148038143062623805143211734815100559013456101180079050638142152709308588092875703450507808145458819906336129827981411745339273120809289727922213298064294687824274874017450554067787570832373109759151177629784432847479081765180977872684161176325038612112914368343767023503711163307258698832587103363222381098090121101989917684149175123313401527338438372345009347860497929459915822012581045982309255287212413704361491020547185549611808764265765110605458814756044317847985845397312863016254487611485202170644041116607669505977578325703951108782308271064789390211156910392768384538633332156582965977310343603232254574363720412440640888267375843395367959312322134373209957498894699565647360072959998391288103197426312517971414320123112795518947781726914158911779919564812558001845506563295285985910009086218029775637892599916499464281930222935523466747593269516542140210913630181947227078901220872873617073486499981562554728113734798716569527489008144384053274837813782466917444229634914708157007352545707089772675469343822619546861533120953357923801460927351021011919021836067509730895752895774681422954339438549315533963038072916917584610146099505506480367930414723657203986007355076090231731250161320484358364817704848181099160244252327167219018933459637860878752870173935930301335901123710239171265904702634940283076687674363865132710628032317406931733448234356453185058135310854973335075996677871244905836367541328908624063245639535721252426117027802865604323494283730172557440583727826799603173936401328762770124367983114464369476705312724924104716700138247831286565064934341803900410178053395058772458665575522939158239708417729833728231152569260929959422400005606266786743579239724540848176519734362652689448885527202747787473359835367277614075917120513269344837529916499809360246178442675727767900191919070380522046123248239132610432719168451230602362789354543246176997575368904176365025478513824631465833638337602357789926729886321618583959036399818384582764491245980937043055559613797343261348304949496868108953569634828178128862536460842033946538194419457142666823718394918323709085748502665680398974406621053603064002608171126659954199368731609457228881092077882277203636684481532561728411769097926666552238468831137185299192163190520156863122282071559987646842355205928537175780765605036773130975191223973887224682580571597445740484298780735221598426676625780770620194304005425501583125030175340941171910192989038447250332988024501436796844169479595453045910313811621870456799786636617460595700034459701135251813460065655352034788811741499412748264152135567763940390710387088182338068033500380468001748082205910968442026446402187705340100318028816644153091393948156403192822785482414510503188825189970074862287942155895742820216657062188090578088050324676991297287210387073697406435667458920258656573978560859566534107035997832044633634648548949766388535104552729824229069984885369682804645974576265143435905093832124374333387051665714900590710567024887985804371815126100440381488040725244061642902247822715272411208506578883871249363510680636516674322232776775579739927037623191470473239551206070550399208844260370879084333426183841359707816482955371432196118950379771463000755597537957035522714493191321725564401283091805045008992187051211860693357315389593507903007367270233141653204234015537414426871540551164796114332302485440409406911456139873026039518281680344825254326738575900560432024537271929124864581333441698529939135747869895798643949802304711696715736228391201812731291658995275991922031837235682727938563733126547998591246327503006059256745497943508811929505685493259355318729141801136412187470752628106869830135760524719445593219553596104528303148839117693011965858343144248948985655842508341094295027719758335224429125736493807541711373924376014350682987849327129975122868819604983577515877178041069713196675347719479226365190163397712847390793361111914089983056033610609871717830554354035608952929081846414371392943781356048203894791257450770755751030024207266290018090422934249425906066614133228722698069014599451199547801639915141261252572828066433126165746938819510644216738718000110042184830258091654338374923641183888564685143150063731904295148146942431460895254707203740556691306922099080481945297511065046428105417755259095187131888359147659960413179602094153085855332387725380232727632977372143127968216716234421183201802881412747443168847218459392781435474099999072233203059262976611238327983316988253931262006503702884478286669404473079471047612558658375298623625099982323359715507233838332440815257781933642626304330265895817080045127887311593558774721725649470005163667257715392098409503274511215368730091219962952276591316370939686072713426926231547533043799331658110736964314217197943405639155121081081362626888569748068060116918941750272298741586991791453499462444194012197858601373660828690722365147713912687420966513787562059185432888834174292090156313328319357562208971376563097850156315498245644586542479293572282875060848145335135218172958793299117100324762220521946451053624505129884308713444395072442673514628617991832336459836963763272257569159723954383052086647474238151107927349483695239647926899369832491799950278950006045966131346336302494995148080532901790297518251587504900743518798351183603272277260171740453557165885557829729106195819351710554825793070910057635869901929721799516873117556314448564810022001425454055429273458837116020994794572082378043687189448056368918258024449963187834202749101533579107273362532890693347412380222201162627711930854485029541913200400999865566651775664095365619789781838045103035651013158945890287186108690589394713680148457001836649564720329433437429894642741255143590584348409195487015236140317391390361644019845505104912116979200120199960506994966403035086369290394100701945053201623487276323273244943963048089055425137972331475185207091025063685981679530481810073942453170023880475983432345041425843140636127210960228242337822809027976596077710849391517488731687771352239009117117350918600654620099024975852779254278165970383495058010626155333691093784659771052975022317307412177834418941184596586102980187787427445638669661277245038458605264151030408982577775447411533207640758816775149755380471162966777100587664615954967769270549623939857092550702740699781408431249653630718665337180605874224259816530705257383454157705429216299811491750861131176577317209561565647869547448927132060806354577946241453106698374211379816896382353330447788316933972872891810366408326985698825443851667586228993069643468489751484087903964760420361020602171739447026348763365439319522907738361673898117812424836557810503416945156362604300366574310847665487778012857792364541852244723617137422925584159313561286637167032807217155339264632573067306391085410886808574283858828060230334140855039097353872613451196292641599521278931135443146015273090255382710432596622674390374556361228613907831943357059003814870089866131539819585744233044197085669672229314273074138488278897558886079973870447020316683485694199096548029824931981765792682985562972301068277723516274078380743187782731821191969528005160879157212882633796823127256287000150018292975772999357909491964076344286157571354442789838304045470271019458004258202120234458063034503365814721854920367998997293535391968121331951653797453991114942444518303385884129040181781882137600665928494136775431745160540938711036871521164040582193447120448277596054169486453987832626954801391501903899593130670318661670663719640256928671388714663118919268568269199527645799771827875946096161721886810945465157886912241060981419726861925547878992631535947292282508054251690681401078179602188533076230556381631640192245450325765673925997651753080142716071430871886285983603746505713420467008343275423027704779331118366690323288530687387990713590074030490745988951364768760867844323824821893061757031956380323081971936356727419643872625870615433072963703812751517040600505759488272385634515639052657710426459476040556950959840888903762079956638801786185591594411172509231327977113803 rr=40 GraphicsWindow.Title ="Pi/Fi tower GraphicsWindow.Width=1200 GraphicsWindow.Height =1000 GraphicsWindow .top=0 GraphicsWindow.Left=0 dw=1000 dh=1000 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.PenWidth =1 view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddDirectionalLight(view3D,"Pink",-1,-1,-1) LD3DView.AddDirectionalLight(view3D,"yellow",1,1,1) LD3DView.AddAmbientLight(view3D,"#50111111") LD3DView.ResetCamera(view3D,0,0,170, 0,0,-1,"","","") LD3DView.AutoControl("true" "true", -1 3) LDEvents .MouseWheel =mww GraphicsWindow.KeyDown=kdd rott="true m=0 h20=250 Sub kdd If GraphicsWindow.LastKey ="Space" Then rott="true Else rott="false EndIf EndSub fk=6 ss=.2 ff=.9994 For x=1 to 1000 rr=rr*ff n=Text.GetSubText(pi x 1) nx=LDMath.cos(n*36+m)*rr ny=LDMath.sin(n*36+m)*rr tt=tt+nx+":"+(x/10)+":"+ny+":" n=Text.GetSubText(fi x 1) nx=LDMath.cos(n*36+18)*rr ny=LDMath.sin(n*36+18)*rr tt1=tt1+nx+":"+(x/10)+":"+ny+":" EndFor s1=LD3DView.AddTube (view3D tt .3 12 "red" "D") s2=lD3DView.AddTube (view3D tt1 .3 12 "cyan" "D") While 1=1 For nn=0 To 360 Step .2 deg=deg-1 xx=ldMath.Sin(nn)*17*fk zz=ldmath.Cos(nn)*17*fk If Math.Remainder (nn 45)=0 Then u=math.GetRandomNumber(3) If u=1 then LD3DView.ModifyObject (view3D s1 "H") LD3DView.ModifyObject (view3D s2 "S") ElseIf u=2 then LD3DView.ModifyObject (view3D s2 "H") LD3DView.ModifyObject (view3D s1 "S") Else LD3DView.ModifyObject (view3D s1 "S") LD3DView.ModifyObject (view3D s2 "S") EndIf EndIf If rott then LD3DView.ResetCamera(view3D,xx,0,zz,-xx*5,h20,-zz*5,"","","") 'LD3DView.SetBillBoard (view3D pn) endif Program.Delay(3) EndFor EndWhile Sub mww h20=h20+LDEvents.LastMouseWheelDelta*3 EndSub End>RXP210.sb< Start>RXP916.sb< initialPressure = 2 'Bar initialVolume = 1 'Litre initialTemperature = 20 'degC isentropicExponent = 1.4 'Approximately air constantA = initialPressure * initialVolume / (273 + initialTemperature) constantB = initialPressure * Math.Power(initialVolume, isentropicExponent) GraphicsWindow.Height=600 GraphicsWindow.Width=600 GraphicsWindow.Top=20 GraphicsWindow.Left=20 TextWindow.Left=600 GraphicsWindow.Title="Expansion/compression of 1 liter of air from a pressure of 2 bar and 20 degC" GraphicsWindow.DrawLine(40,50,60,50) GraphicsWindow.DrawLine(50,50,50,560) GraphicsWindow.DrawLine(40,550,550,550) GraphicsWindow.DrawLine(550,550,550,560) GraphicsWindow.DrawText(30,45,"3") GraphicsWindow.DrawText(30,540,"1") GraphicsWindow.DrawText(45,560,"0.8") GraphicsWindow.DrawText(540,560,"1.2") GraphicsWindow.DrawText(400,570,"Volume (liter)") GraphicsWindow.PenColor="blue" GraphicsWindow.DrawText(30,30,"Pressure(bar)") GraphicsWindow.BrushColor="red" GraphicsWindow.DrawText(10,10,"Temp (degC)") GraphicsWindow.DrawText(10,45,"50") GraphicsWindow.DrawText(20,540,"0") GraphicsWindow.brushColor="green" GraphicsWindow.PenColor="green" GraphicsWindow.DrawLine(300,450,300,250) GraphicsWindow.DrawText(320,250,"Starting condition") vx=50 vy=50 vy2=50 For Volume = 0.8 To 1.2 Step 0.01 Pressure = constantB / Math.Power(Volume, isentropicExponent) Temperature = (Pressure * Volume / constantA) - 273 'Write results rounding to 2 decimal places TextWindow.WriteLine("Volume = "+0.01*Math.Floor(0.5+100*Volume)+" Pressure = "+0.01*Math.Floor(0.5+100*Pressure)+" Temperature = "+0.01*Math.Floor(0.5+100*Temperature)) x=50+500/0.4*(Volume-0.8) y=50-500/2*(pressure-3) y2=50-500/50*(Temperature-50) GraphicsWindow.PenColor="blue " GraphicsWindow.DrawLine(vx,vy,x,y) GraphicsWindow.PenColor="red" GraphicsWindow.DrawLine(vx,vy2,x,y2) vx=x vy=y vy2=y2 EndFor End>RXP916.sb< Start>RXS936.sb< GraphicsWindow.BackgroundColor="tan GraphicsWindow.Width=800 GraphicsWindow.Height=GraphicsWindow.Width+50 GraphicsWindow.Title="Hearts f100=80 While 1=1 For c220=185 To 220 Step 10 ii=0 For c=0 To 350 Step 60 ii=ii+1 For o=Math.Remainder(ii 2)*15*4 To 200 Step 15 sx=Math.GetRandomNumber(600)+10 sy=Math.GetRandomNumber(500) For a=0 To 6.28 Step .006 px=0.75*Math.Sin(a)-Math.Sin(3*a)/4 py=Math.Cos(a)-Math.Cos(2*a)*5/13-Math.Cos(3*a)*2/13-Math.Cos(4*a)/13 pp=LDMath.Rotate(f100 c220 f100+px*f100 f100-py*f100 c) rpp=LDMath.Convert2Radial(f100 c220 pp[1] pp[2]) ' TextWindow.WriteLine(rpp) dpp=LDMath.Convert2Cartesian(f100 c220 rpp[1]+o rpp[2]) GraphicsWindow.SetPixel(dpp[1]+300 dpp[2]+200 "red") 'Program.Delay(2) EndFor EndFor EndFor Program.Delay(3333) GraphicsWindow.Clear() EndFor EndWhile End>RXS936.sb< Start>RXS942.sb< ' Reduced Sum ' Copyright © 2018 Nonki Takahashi. The MIT License. ' Challenge 2018-07 While "True" TextWindow.Write("Number? ") n = TextWindow.Read() ReducedSum() TextWindow.WriteLine(sum) EndWhile Sub ReducedSum ' param n ' return sum Stack.PushValue("local", n) len = Text.GetLength(n) sum = n While 1 < len sum = 0 For p = 1 To len sum = sum + Text.GetSubText(n, p, 1) EndFor len = Text.GetLength(sum) n = sum EndWhile n = Stack.PopValue("local") EndSub End>RXS942.sb< Start>RXT128.sb< '---------------------------------- 'Small Basic Programming Challange created by Nicholas Mills (October - November 2013). Do not distribute without direct permission!! '---------------------------------- 'NB: I've made a note of preloading everything (all the backgrounds etc.) As a result, this has made the UI flow so much better - there are no white transitions or closing/opening of the graphicswindow. start: 'Basic rules for our Graphics Window. GraphicsWindow.Hide() GraphicsWindow.Width="1200" GraphicsWindow.Height="600" GraphicsWindow.CanResize="False" '---------------------------------- 'Images and textboxes '---------------------------------- 'Defining the resource directory (will make things much easier! localpath=Program.Directory + "\resources\" 'Backgrounds bg = Shapes.AddImage(localpath + "\mainbg.jpg") timebg = Shapes.AddImage(localpath + "\timebg.png") percbg = Shapes.AddImage(localpath + "\percbg.png") grey = Shapes.AddImage(localpath + "\grey.png") 'Various images logo = Shapes.AddImage(localpath + "\logo.png") timelogo = Shapes.AddImage(localpath + "\clock.png") percentage = Shapes.AddImage(localpath + "\percentage.png") welcometotime = Shapes.AddImage(localpath + "\welcometotime.png") welcometoperc = Shapes.AddImage(localpath + "\welcometoperc.png") startlogo = Shapes.AddImage(localpath + "\start.png") mcinfo = Shapes.AddImage(localpath + "\info.png") 'Various texts chooselogo = Shapes.AddText("Choose your mode:") descriptionchoose = Shapes.AddText("(Percentage Mode or TimeTrial Mode)") playbutton = Shapes.AddText("Play") countdowntext = Shapes.AddText("The Game Starts in 5 Seconds!") '---------------------------------- 'Starting variables (these variables lets me track where abouts the user is in the program and act upon it) '---------------------------------- OnMainMenu = 1 OnOptionMenu = 0 OnPreTimeGame = 0 OnPrePercGame = 0 OnTimeGame = 0 OnPercGame = 0 OnScoreTime = 0 OnScorePerc = 0 QuestionsAnswered = 0 CurQuestion = 0 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(216,16,86) 'Going with a nice purple colour (modelled off the starting bg) for all of my text. '---------------------------------- 'Moving the shapes and editing their opacities. '---------------------------------- 'Backgrounds Shapes.Move(bg, -200, -200) Shapes.SetOpacity(timebg, 0) Shapes.SetOpacity(percbg, 0) Shapes.SetOpacity(grey, 0) Shapes.Zoom(grey, 5, 5) Shapes.Zoom(percbg, 0.8, 1) Shapes.Move(percbg, 0, -10) Shapes.Move(logo, 50, 50) Shapes.SetOpacity(logo,50) Shapes.Zoom(playbutton, 3, 3) Shapes.Move(playbutton, 900,500) Shapes.Zoom(chooselogo, 4, 4) Shapes.Move(chooselogo, 350,50) Shapes.SetOpacity(chooselogo, 0) Shapes.Zoom(descriptionchoose, 2.5, 2.5) Shapes.Move(descriptionchoose, 300,125) Shapes.SetOpacity(descriptionchoose, 0) Shapes.Zoom(timelogo, 0.25, 0.25) Shapes.SetOpacity(timelogo, 0) Shapes.Move(timelogo, 875, 415) Shapes.Zoom(percentage, 0.35,0.35) Shapes.SetOpacity(percentage, 0) Shapes.Move(percentage,200 ,400) Shapes.SetOpacity(welcometotime, 0) Shapes.Zoom(welcometotime, 0.5,0.5) Shapes.SetOpacity(welcometoperc, 0) Shapes.Zoom(welcometoperc, 0.5, 0.5) Shapes.SetOpacity(mcinfo, 0) Shapes.Move(mcinfo,100,350) Shapes.SetOpacity(startlogo, 0) Shapes.Zoom(startlogo, 0.5, 0.5) Shapes.Move(startlogo, 900,400) Shapes.SetOpacity(countdowntext, 0) Shapes.Move(countdowntext, 100, 125) Shapes.Zoom(countdowntext, 5, 5) '-------------------------- 'Question Resources '------------------------- 'NB: I wanted to make the question images seperate from the other images, as it would cause way too much confusion otherwise. 'Question Pictures Question1pic= Shapes.AddImage(localpath + "\question1.png") Question2pic= Shapes.AddImage(localpath + "\question2.png") Question3pic= Shapes.AddImage(localpath + "\question3.png") Question4pic= Shapes.AddImage(localpath + "\question4.png") Question5pic= Shapes.AddImage(localpath + "\question5.png") Question6pic= Shapes.AddImage(localpath + "\question6.png") Question7pic= Shapes.AddImage(localpath + "\question7.png") Shapes.SetOpacity(Question1pic, 0) Shapes.SetOpacity(Question2pic, 0) Shapes.SetOpacity(Question3pic, 0) Shapes.SetOpacity(Question4pic, 0) Shapes.SetOpacity(Question5pic, 0) Shapes.SetOpacity(Question6pic, 0) Shapes.SetOpacity(Question7pic, 0) '--Question Answers (they're multiple choice... 1 means A, 2 means B, 3 means C and 4 means D) '(If I have them as letters the program treats them all as variables and that would just take more time!) Questionans[1]="B" Questionans[2]="D" Questionans[3]="C" Questionans[4]="B" Questionans[5]="A" Questionans[6]="C" Questionans[7]="D" GraphicsWindow.Show() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseMove = OnMouseMove Sub OnMouseDown If OnMainMenu = 1 Then If Mouse.IsLeftButtonDown Then If GraphicsWindow.MouseX > 880 And GraphicsWindow.MouseX < 985 And GraphicsWindow.MouseY >500 And GraphicsWindow.MouseY < 545 Then fadeToChoice() OnMainMenu = 0 EndIf EndIf ElseIf OnOptionMenu = 1 then If Mouse.IsLeftButtonDown Then If GraphicsWindow.MouseX > 870 And GraphicsWindow.MouseX < 990 And GraphicsWindow.MouseY >410 And GraphicsWindow.MouseY < 565 Then 'Clock BuildTimeChallange() Elseif GraphicsWindow.MouseX > 225 And GraphicsWindow.MouseX < 355 And GraphicsWindow.MouseY >425 And GraphicsWindow.MouseY < 550 Then 'Percentage BuildPercentageChallange() EndIf EndIf Elseif OnPreTimeGame = 1 then If Mouse.IsLeftButtonDown then If GraphicsWindow.MouseX > 905 And GraphicsWindow.MouseX < 1065 And GraphicsWindow.MouseY > 395 And GraphicsWindow.MouseY < 555 Then StartTimeChallange() Endif Endif Elseif OnPrePercGame = 1 then If Mouse.IsLeftButtonDown then If GraphicsWindow.MouseX > 905 And GraphicsWindow.MouseX < 1065 And GraphicsWindow.MouseY > 395 And GraphicsWindow.MouseY < 555 Then StartPercChallange() Endif EndIf Endif EndSub Sub fadeToChoice For i = 1 To 51 Shapes.SetOpacity(logo,50 -i) Shapes.SetOpacity(playbutton, 50 - i) Shapes.SetOpacity(chooselogo, i*1.5) Shapes.SetOpacity(descriptionchoose, i*1.5) Shapes.SetOpacity(timelogo, i*1.5) Shapes.SetOpacity(percentage, i*1.5) Program.Delay(10) Endfor OnOptionMenu = 1 Endsub Sub OnMouseMove If OnMainMenu = 0 And OnOptionMenu = 1 Then If GraphicsWindow.MouseX > 225 And GraphicsWindow.MouseX < 355 And GraphicsWindow.MouseY >425 And GraphicsWindow.MouseY < 550 Then 'Percentage Shapes.SetOpacity(percentage, 100) ElseIf GraphicsWindow.MouseX > 870 And GraphicsWindow.MouseX < 990 And GraphicsWindow.MouseY >410 And GraphicsWindow.MouseY < 565 Then 'Clock Shapes.SetOpacity(timelogo, 100) Else Shapes.SetOpacity(timelogo, 51*1.5) Shapes.SetOpacity(percentage, 51*1.5) EndIf Endif EndSub Sub BuildPercentageChallange OnOptionMenu = 0 OnPrePercGame = 1 GraphicsWindow.Title = "Percentage" For i = 1 To 100 'Fading stuff out Shapes.SetOpacity(bg, 100-i) Shapes.SetOpacity(timelogo, 100-i) Shapes.SetOpacity(percentage, 100-i) Shapes.SetOpacity(descriptionchoose, 100-i) Shapes.SetOpacity(chooselogo, 100-i) 'Fading stuff in Shapes.SetOpacity(percbg,i) Program.Delay(5) 'When we're dealing with so many objects, delaying by too much makes the fade take too long! EndFor Program.Delay(500) For i = 1 To 100 Shapes.SetOpacity(welcometoperc, i) Shapes.SetOpacity(mcinfo, i) Program.Delay(5) Endfor 'Lets give the user some time to read the instructions! Program.Delay(2500) For i = 1 To 75 Shapes.SetOpacity(startlogo, i) Program.Delay(5) Endfor EndSub Sub BuildTimeChallange OnOptionMenu = 0 OnPreTimeGame = 1 GraphicsWindow.Title = "Time" For i = 1 To 100 'Fading stuff out Shapes.SetOpacity(bg, 100-i) Shapes.SetOpacity(timelogo, 100-i) Shapes.SetOpacity(percentage, 100-i) Shapes.SetOpacity(descriptionchoose, 100-i) Shapes.SetOpacity(chooselogo, 100-i) 'Fading stuff in Shapes.SetOpacity(timebg,i) Program.Delay(5) 'When we're dealing with so many objects, delaying by too much makes the fade take too long! EndFor Program.Delay(500) For i = 1 To 100 Shapes.SetOpacity(welcometotime, i) Shapes.SetOpacity(mcinfo, i) Program.Delay(5) Endfor 'Lets give the user some time to read the instructions! Program.Delay(2500) For i = 1 To 75 Shapes.SetOpacity(startlogo, i) Program.Delay(5) Endfor EndSub Sub StartTimeChallange OnPreTimeGame = 0 OnTimeGame = 1 GraphicsWindow.Title="Running Time!" For i = 1 To 50 Shapes.SetOpacity(welcometotime, 50-i) Shapes.SetOpacity(startlogo, 50-i) Shapes.SetOpacity(mcinfo, 50-i) Shapes.SetOpacity(grey, i*0.5) Program.Delay(5) Endfor Program.Delay(500) For i = 1 To 25 Shapes.SetOpacity(countdowntext, i*4) Program.Delay(5) EndFor Program.Delay(5000) Shapes.SetOpacity(countdowntext, 0) Shapes.SetOpacity(grey, 0) EndSub Sub StartPercChallange OnPrePercGame = 0 OnPercGame = 1 GraphicsWindow.Title="Running Perc!" For i = 1 To 50 Shapes.SetOpacity(welcometoperc, 50-i) Shapes.SetOpacity(startlogo, 50-i) Shapes.SetOpacity(mcinfo, 50-i) Shapes.SetOpacity(grey, i*0.5) Program.Delay(5) Endfor Program.Delay(500) For i = 1 To 25 Shapes.SetOpacity(countdowntext, i*4) Program.Delay(5) EndFor Program.Delay(5000) Shapes.SetOpacity(countdowntext, 0) Shapes.SetOpacity(grey, 0) AskQuestion() EndSub Sub AskQuestion If OnPercGame = 1 Or OnTimeGame = 1 Then sumN="" For i=1 To 5 Retry: N= Math.GetRandomNumber(7) If text.IsSubText(sumN,N) Then Goto Retry EndIf sumN=text.Append(sumN,N) GraphicsWindow.Title="Question No= "+N+ " : "+Questionans Question() wait="True" While wait="True" ' waiting for key input (A or B or C or D) endwhile EndFor GraphicsWindow.Title="Question End" Endif EndSub Sub OnKeyDown LK= GraphicsWindow.LastKey ' input A ,B,C,D If LK= Questionans[N] Then ' if answer is right or not Points = Points + 1 GraphicsWindow.BrushColor="Red" GraphicsWindow.DrawBoundText(20,50,100,"Correct!") EndIf wait="False" EndSub Sub Question GraphicsWindow.Title = N If N = 1 Then Shapes.SetOpacity(Question1pic, 100) elseIf N = 2 Then Shapes.SetOpacity(Question2pic, 100) elseif N = 3 Then Shapes.SetOpacity(Question3pic, 100) elseif N = 4 Then Shapes.SetOpacity(Question4pic, 100) elseif N = 5 Then Shapes.SetOpacity(Question5pic, 100) elseif N = 6 Then Shapes.SetOpacity(Question6pic, 100) elseif N = 7 Then Shapes.SetOpacity(Question7pic, 100) EndIf Endsub Sub EndTimeGame GraphicsWindow.Title = "TimeGame ENDED" Program.End() EndSub Sub EndPercGame GraphicsWindow.Title = "PercGame ENDED" Program.End() Endsub End>RXT128.sb< Start>RXT665.sb< 'By Dyrand' 'Math Challenge 1 - September' '9/22/12' Begin: i=0 p=0 TextWindow.ForegroundColor="White" TextWindow.WriteLine("Enter a number you want to be changed into a binary number: ") Number=TextWindow.ReadNumber() TextWindow.WriteLine("") If number<0 Then number=number/-1 negative=1 ElseIf Number>=0 then negative=0 endif While Number<>0 i=i+1 BinaryDigit[i]=math.Remainder(Number,2) Number=Math.Floor(Number/2) EndWhile If negative=0 then While p<=i p=p+4 endwhile endif If negative=0 then TextWindow.ForegroundColor="Green" TextWindow.Write("UnSigned: ") ElseIf negative=1 then TextWindow.ForegroundColor="Red" TextWindow.Write("Signed: ") TextWindow.ForegroundColor="DarkRed" TextWindow.Write("1") endif TextWindow.ForegroundColor="white" For o=i To p-1 TextWindow.Write(0) endfor For o=i To 1 Step -1 If math.Remainder(m,8)<=3 then TextWindow.ForegroundColor="DarkGreen" Else TextWindow.ForegroundColor="Gray" endif m=m+1 TextWindow.Write(BinaryDigit[o]) endfor TextWindow.WriteLine("") TextWindow.WriteLine("") Goto Begin End>RXT665.sb< Start>RXW260.sb< TextWindow.Top = 0 TextWindow.Left = -5 GraphicsWindow.BackgroundColor = "White" GraphicsWindow.Width = 1000 GraphicsWindow.Height = 670 GraphicsWindow.Top = 10 GraphicsWindow.Left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.CanResize = "False" n1 = 1 minbullets = 1 Tower = Shapes.AddEllipse(50, 50) TowerX = GraphicsWindow.Width / 2 TowerY = GraphicsWindow.Height / 2 Shapes.Move(Tower, TowerX - 25, TowerY - 25) BulletGlobalSpeed = 0.6 GraphicsWindow.MouseDown = OnMouseDown Sub OnMouseDown MouseIsDown = "True" EndSub While "True" If MouseIsDown Then AddBullet() EndIf MoveBullets() CheckBulletPos() EndWhile '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''END''GAME''CODE'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''SUBS''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub AddBullet Bullet[n1] = Shapes.AddEllipse(20, 20) BulletX[n1] = GraphicsWindow.Width / 2 - 10 BulletY[n1] = GraphicsWindow.Height / 2 - 10 ' Getting velocity: BulletSpeedX and BulletSpeedY DifferenceX = GraphicsWindow.MouseX - TowerX DifferenceY = GraphicsWindow.MouseY - TowerY If DifferenceX > 0 Then Slope = DifferenceY / DifferenceX BulletSpeedX[n1] = Math.SquareRoot(Math.Power(BulletGlobalSpeed, 2) / (Math.Power(Slope, 2) + 1)) BulletSpeedY[n1] = BulletSpeedX[n1] * Slope ElseIf DifferenceX < 0 Then Slope = DifferenceY / DifferenceX BulletSpeedX[n1] = 0 - (Math.SquareRoot(Math.Power(BulletGlobalSpeed, 2) / (Math.Power(Slope, 2) + 1))) BulletSpeedY[n1] = BulletSpeedX[n1] * Slope ElseIf DifferenceX = 0 And DifferenceY > 0 Then BulletSpeedX[n1] = 0 BulletSpeedY[n1] = BulletGlobalSpeed ElseIf DifferenceX = 0 And DifferenceY <= 0 Then BulletSpeedX[n1] = 0 BulletSpeedY[n1] = -BulletGlobalSpeed EndIf ' Got velocity n1 = n1 + 1 indices = Bullet MouseIsDown = "False" EndSub Sub MoveBullets For i = 1 To Array.GetItemCount(Bullet) index = indices[i] BulletX[index] = BulletX[index] + BulletSpeedX[index] BulletY[index] = BulletY[index] + BulletSpeedY[index] Shapes.Move(Bullet[index], BulletX[index], BulletY[index]) EndFor EndSub Sub CheckBulletPos For i = 1 To Array.GetItemCount(bullet) index = indices[i] If BulletX[i] > GraphicsWindow.Width - 100 Or BulletX[i] < 0 - 100 Or BulletY[i] > GraphicsWindow.Height + 100 Or BulletY[i] < 0 - 100 Then Shapes.Remove(Bullet[index]) BulletX[index] = "" BulletY[index] = "" BulletSpeedX[index] = "" BulletSpeedY[index] = "" EndIf EndFor indices = Array.GetAllIndices(Bullet) EndSub '''''''''''Not in use''''' End''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub SomeHandling While BulletX[i] < GraphicsWindow.Width + 100 And BulletX[i] > - 100 And BulletY[i] < GraphicsWindow.Height + 100 And BulletY[i] > 0 - 100 For i = minbullets To Array.GetItemCount(Bullet) If BulletX[i] > GraphicsWindow.Width - 100 Or BulletX[i] < 0 - 100 Or BulletY[i] > GraphicsWindow.Height + 100 Or BulletY[i] < 0 - 100 Then GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() Shapes.Remove(Bullet[i]) BulletX[minbullets] = TowerX BulletY[minbullets] = TowerY minbullets = minbullets + 1 Else BulletX[i] = BulletX[i] + BulletSpeedX[i] BulletY[i] = BulletY[i] + BulletSpeedY[i] Shapes.Move(Bullet[i], BulletX[i], BulletY[i]) EndIf EndFor Program.Delay(1) EndWhile EndSub Sub Var_Handling TextWindow.Clear() TextWindow.WriteLine("TowerX=" + TowerX) TextWindow.WriteLine("TowerY=" + TowerY) TextWindow.WriteLine("BulletX=" + BulletX) TextWindow.WriteLine("BulletY=" + BulletY) TextWindow.WriteLine("DifferenceX=" + DifferenceX) TextWindow.WriteLine("DifferenceY=" + DifferenceY) TextWindow.WriteLine("Slope=" + Slope) TextWindow.WriteLine("BulletGlobalSpeed=" + BulletGlobalSpeed) TextWindow.WriteLine("BulletSpeedX=" + BulletSpeedX) TextWindow.WriteLine("BulletSpeedY=" + BulletSpeedY) TextWindow.Clear() TextWindow.WriteLine("i=" + i) TextWindow.WriteLine("minbullets=" + minbullets) TextWindow.WriteLine("n1=" + n1) TextWindow.WriteLine("BulletX[1]=" + BulletX[1]) TextWindow.WriteLine("BulletY[1]=" + BulletY[1]) TextWindow.WriteLine("BulletSpeedX[1]=" + BulletSpeedX[1]) TextWindow.WriteLine("BulletSpeedY[1]=" + BulletSpeedY[1]) Program.Delay(80) EndSub End>RXW260.sb< Start>RZB216.sb< 'Copyright(c)All Rights Reserved. 'Made by ProfessionalOfSmallBasic[POSB] 'Made date :06.04.2014 15:45 'Thanks For Playing materials() k=Math.GetRandomNumber(600) f=Math.GetRandomNumber(600) m=0 time=0 'Start Game Sub start GraphicsWindow.Title="Score: "+time game() meteor() wrongway() die() x=x+m EndSub 'Initialise Sub initialise GraphicsWindow.Clear() back=ImageList.LoadImage("http://lparchive.org/Gazillionaire-Deluxe/Update%2048/26-SPACE.png") GraphicsWindow.DrawImage(back,0,0) rocket=ImageList.LoadImage("http://theponga.com/img/soon/rocket.png") mete=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_32x32_006.png") mete1=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_64x64_006.png") mete2=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_64x64_006.png") mete3=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_32x32_006.png") mete4=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_32x32_006.png") mete5=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_64x64_006.png") mete6=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_64x64_006.png") mete7=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_32x32_006.png") x=294 y=374 g=-75 l=-75 b=-75 z=-75 v=-75 r=-75 ı=-75 p=-75 GraphicsWindow.KeyDown=keydown EndSub 'Rocket's move-Score Sub game Shapes.Move(rock,x,y) time=time+1 EndSub 'Keys Sub keydown last=GraphicsWindow.LastKey If last="Left" Then m=-2 last="" EndIf If last="Right" Then m=2 last="" EndIf If last="P" Then time=time-1 y=y-1 GraphicsWindow.ShowMessage("Click to continue","Game Paused") time=time+1 y=y+1 last="" EndIf EndSub Sub wrongway If x=-10 Then m=-m EndIf If x=604 Then m=-m EndIf EndSub 'meteor's move Sub meteor Shapes.Move(met1,k,l) Shapes.Animate(met1,k,l,10) l=l+2 If l>480 Then l=-Math.GetRandomNumber(70) k=Math.GetRandomNumber(600) EndIf Shapes.Move(met,f,g) Shapes.Animate(met,f,g,10) g=g+2 If g>480 Then g=-Math.GetRandomNumber(70) f=Math.GetRandomNumber(600) EndIf Shapes.Move(met2,u,ı) Shapes.Animate(met2,u,ı,10) ı=ı+2 If ı>480 Then ı=-Math.GetRandomNumber(70) u=Math.GetRandomNumber(600) EndIf Shapes.Move(met3,o,p) Shapes.Animate(met3,o,p,10) p=p+2 If p>480 Then p=-Math.GetRandomNumber(70) o=Math.GetRandomNumber(600) EndIf Shapes.Move(met5,n,b) Shapes.Animate(met5,n,b,10) b=b+2 If b>480 Then b=-Math.GetRandomNumber(70) n=Math.GetRandomNumber(600) EndIf Shapes.Move(met4,c,z) Shapes.Animate(met4,c,z,10) z=z+2 If z>480 Then z=-Math.GetRandomNumber(70) c=Math.GetRandomNumber(600) EndIf Shapes.Move(met6,q,v) Shapes.Animate(met6,q,v,10) v=v+2 If v>480 Then v=-Math.GetRandomNumber(70) q=Math.GetRandomNumber(600) EndIf Shapes.Move(met7,t,r) Shapes.Animate(met7,t,r,10) r=r+2 If r>480 Then r=-Math.GetRandomNumber(70) t=Math.GetRandomNumber(600) EndIf Program.Delay(0) EndSub 'rocket crash Sub die rktop=Shapes.GetTop(rock) mettop=Shapes.GetTop(met) met1top=Shapes.GetTop(met1) met2top=Shapes.GetTop(met2) met3top=Shapes.GetTop(met3) met4top=Shapes.GetTop(met4) met5top=Shapes.GetTop(met5) met6top=Shapes.GetTop(met6) met7top=Shapes.GetTop(met7) rkleft=Shapes.GetLeft(rock) metleft=Shapes.GetLeft(met) met1left=Shapes.GetLeft(met1) met2left=Shapes.GetLeft(met2) met3left=Shapes.GetLeft(met3) met4left=Shapes.GetLeft(met4) met5left=Shapes.GetLeft(met5) met6left=Shapes.GetLeft(met6) met7left=Shapes.GetLeft(met7) If rktop<=mettop+32 And rktop>=mettop And rkleft>metleft And rkleft=met1top And rkleft>met1left And rkleft=met2top And rkleft>met2left And rkleft=met3top And rkleft>met3left And rkleft=met4top And rkleft>met4left And rkleft=met5top And rkleft>met5left And rkleft=met6top And rkleft>met6left And rkleft=met7top And rkleft>met7left And rkleftRZB216.sb< Start>RZD792-1.sb< ' Challenge of the month March 2013 Like pong gme . by NaochanON ' If Player (or PC) get 5 Points , You ( or PC) wins. RZD792-1 ' You can select Level GraphicsWindow.MouseMove=Playermoving Shapes_Init() Shapes_Add() InitData() While Gameover<>"true" Moving="true" RNDBallPosition() While Moving="true" NN=NN+0.005 defence_moving() PCMoving() ball_moving() If NN>10 then NN=10 endif Program.Delay(25-NN-LVL) ' speed Up endwhile Program.Delay(1000) NN=0 endwhile endmessage() ' Game Over sub PlayerMoving MX=graphicswindow.MouseX PLT= Shapes.GetTop(SHP[10]["obj"]) If MXWR then MX=WR-3-PLW/2 EndIf Shapes.Move(SHP[10]["obj"],MX-PLW/2,PLT) EndSub Sub PCMoving PCSX=shapes.GetLeft(SHP[9]["obj"]) ' PC slider Distance=(BL+BW/2)-(GLX+GLW/2) chaseSpeed=Distance*((PLpoint+1)/( PLpoint-LVL+11.5)) ' chasing speed changes related to PLPoint If BYY<0 and math.Abs(Distance)<3*GLW/4 Then Shapes.Move(SHP[9]["obj"],GLX+GLW/4+chaseSpeed,Shapes.GetTop(SHP[9]["obj"])) EndIf endsub Sub ball_moving If Moving="true" Then BL=Shapes.GetLeft(SHP[8]["obj"]) ' ball left position BT=Shapes.Gettop(SHP[8]["obj"]) ' ball top position PCSX=shapes.GetLeft(SHP[9]["obj"]) ' PC slider position PLSX=shapes.GetLeft(SHP[10]["obj"]) ' Player slider position DFX=Shapes.GetLeft(SHP[7]["obj"]) ' defence X position DFY=shapes.GetTop(SHP[7]["obj"]) ' defence Y position If (GPCY-GLH)< BT and (BT+BW)<(GPPY+GLH) And BL<=WL Then ' left wall BXX=BXY["X"] ElseIf (GPCY-GLH)0 and (DFX-BW<=BL and BL<=(DFX+DFW)) and (DFY<=(BT+BW) and (BT+BW)<(DFY+DFH/2) ) then ' at defence from PC BYY=-(BXY["Y"]+1) ElseIf BYY<0 and (DFX-BW<=BL and BL<=(DFX+DFW)) and ((DFY+DFH/2)0 and (PLSX-BW<=BL and BL<(PLSX+PLW)) and (PLT500 or BT<0 then ' if ball run throgh Player's Goal !!! PC Wins WhichWins() EndIf Shapes.Move(SHP[8]["obj"],BL+BXX,BT+BYY) EndIf EndSub Sub endmessage If PCpoint>PLpoint Then winmsg="You loose !!!! " Sound.PlayBellRing() Else winmsg="You Win !!!! " Sound.PlayChime() EndIf wmsg=Shapes.AddText(winmsg) Shapes.Move(wmsg,130,225) EndSub Sub WhichWins Moving="false" If BT<0 Then PLpoint=PLpoint+1 elseif BT>500 Then PCpoint=PCpoint+1 endif Shapes.SetText(smsg," PC : "+PCpoint+" Player : "+PLpoint) If PLPoint=5 Or PCPoint=5 Then ' If You (PC) get 5 points GameOver="true" EndIf EndSub Sub defence_moving DFX=Shapes.GetLeft(SHP[7]["obj"]) ' defence X position DFY=shapes.GetTop(SHP[7]["obj"]) ' defence Y position If DFXRZD792-1.sb< Start>RZD792.sb< ' Challenge of the month March 2013 Like pong gme . by NaochanON ' If Player (or PC) get 5 Points , You ( or PC) wins. GraphicsWindow.MouseMove=Playermoving Shapes_Init() Shapes_Add() InitData() While Gameover<>"true" Moving="true" RNDBallPosition() While Moving="true" NN=NN+0.005 defence_moving() PCMoving() ball_moving() If NN>15 then NN=15 endif Program.Delay(20-NN) ' speed Up endwhile Program.Delay(1000) NN=0 endwhile endmessage() ' Game Over Sub PCMoving PCSX=shapes.GetLeft(SHP[9]["obj"]) ' PC slider Distance=(BL+BW/2)-(GLX+GLW/2) chaseSpeed=Distance*((PLpoint+1)/( PLpoint+5.5)) ' chasing speed changes related to PLPoint If BYY<0 and math.Abs(Distance)<3*GLW/4 Then Shapes.Move(SHP[9]["obj"],GLX+GLW/4+chaseSpeed,Shapes.GetTop(SHP[9]["obj"])) EndIf endsub Sub ball_moving If Moving="true" Then BL=Shapes.GetLeft(SHP[8]["obj"]) ' ball left position BT=Shapes.Gettop(SHP[8]["obj"]) ' ball top position PCSX=shapes.GetLeft(SHP[9]["obj"]) ' PC slider position PLSX=shapes.GetLeft(SHP[10]["obj"]) ' Player slider position DFX=Shapes.GetLeft(SHP[7]["obj"]) ' defence X position DFY=shapes.GetTop(SHP[7]["obj"]) ' defence Y position If (GPCY-GLH)< BT and (BT+BW)<(GPPY+GLH) And BL<=WL Then ' left wall BXX=BXY["X"] ElseIf (GPCY-GLH)0 and (DFX-BW<=BL and BL<=(DFX+DFW)) and (DFY<=(BT+BW) and (BT+BW)<(DFY+DFH/2) ) then ' at defence from PC BYY=-(BXY["Y"]+1) ElseIf BYY<0 and (DFX-BW<=BL and BL<=(DFX+DFW)) and ((DFY+DFH/2)0 and (PLSX-BW<=BL and BL<(PLSX+PLW)) and (PLT500 or BT<0 then ' if ball run throgh Player's Goal !!! PC Wins WhichWins() EndIf Shapes.Move(SHP[8]["obj"],BL+BXX,BT+BYY) EndIf EndSub Sub endmessage If PCpoint>PLpoint Then winmsg="You loose !!!! " Sound.PlayBellRing() Else winmsg="You Win !!!! " Sound.PlayChime() EndIf wmsg=Shapes.AddText(winmsg) Shapes.Move(wmsg,130,225) EndSub Sub WhichWins Moving="false" If BT<0 Then PLpoint=PLpoint+1 elseif BT>500 Then PCpoint=PCpoint+1 endif Shapes.SetText(smsg," PC : "+PCpoint+" Player : "+PLpoint) If PLPoint=5 Or PCPoint=5 Then ' If You (PC) get 5 points GameOver="true" EndIf EndSub Sub defence_moving DFX=Shapes.GetLeft(SHP[7]["obj"]) ' defence X position DFY=shapes.GetTop(SHP[7]["obj"]) ' defence Y position If DFXWR then MX=WR-3-PLW/2 EndIf Shapes.Move(SHP[10]["obj"],MX-PLW/2,PLT) EndSub Sub Shapes_Init X0 = 100 ' x offset Y0 = 100 ' y offset SHP[1] = "func=rect;x=1;y=1;width=70;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' Upper left SHP[2] = "func=rect;x=198;y=0;width=70;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' Upper right SHP[3] = "func=rect;x=1;y=10;width=12;height=351;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' left wall SHP[4] = "func=rect;x=1;y=361;width=70;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' lower left SHP[5] = "func=rect;x=198;y=361;width=70;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' lower right SHP[6] = "func=rect;x=256;y=11;width=12;height=351;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' Right wall SHP[7] = "func=rect;x=94;y=185;width=50;height=12;bc=#EE0515;pc=#EE0515;pw=2;" ' center defence SHP[8] = "func=ell;x=140;y=30;width=16;height=16;bc=#209F09;pc=#209F09;pw=2;" ' ball SHP[9] = "func=rect;x=94;y=36;width=60;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' PC's slider SHP[10] = "func=rect;x=110;y=326;width=60;height=12;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' your slider EndSub Sub SHaPes_Add Mouse.HideCursor() GraphicsWindow.Title=" Get 5 points to Win to PC !!! " GraphicsWindow.Width=500 GraphicsWindow.Height=500 GraphicsWindow.BackgroundColor="Black" s=1 For i = 1 To Array.GetItemCount(SHP) GraphicsWindow.PenWidth = SHP[i]["pw"]*s GraphicsWindow.PenColor = SHP[i]["pc"] GraphicsWindow.BrushColor = SHP[i]["bc"] If SHP[i]["func"] = "rect" Then SHP[i]["obj"] = Shapes.AddRectangle(SHP[i]["width"]*s, SHP[i]["height"]*s) ElseIf SHP[i]["func"] = "ell" Then SHP[i]["obj"] = Shapes.AddEllipse(SHP[i]["width"]*s, SHP[i]["height"]*s) ElseIf SHP[i]["func"] = "tri" Then SHP[i]["obj"] = Shapes.AddTriangle(SHP[i]["x1"]*s, SHP[i]["y1"]*s, SHP[i]["x2"]*s, SHP[i]["y2"]*s, SHP[i]["x3"]*s, SHP[i]["y3"]*s) ElseIf SHP[i]["func"] = "line" Then SHP[i]["obj"] = Shapes.AddLine(SHP[i]["x1"]*s, SHP[i]["y1"]*s, SHP[i]["x2"]*s, SHP[i]["y2"]*s) EndIf Shapes.Move(SHP[i]["obj"], X0 + SHP[i]["x"]*s, Y0 + SHP[i]["y"]*s) Shapes.Rotate(SHP[i]["obj"], SHP[i]["angle"]) EndFor EndSub Sub InitData '---------------------------------------------------------------------------------------------------- dPM=1 ' defence moving '---------------------------------------------------------------------------------------------------- WL=Shapes.GetLeft(SHP[3]["obj"])+SHP[3]["width"]*s ' Wall left position WR=Shapes.GetLeft(SHP[6]["obj"]) ' wall right position BW=SHP[8]["width"]*s ' ball width & height GPCY=Shapes.Gettop(SHP[1]["obj"])+SHP[1]["height"]*s ' Goal PC position Y GLH=SHP[1]["height"]*s ' Goal wall height DFW=SHP[7]["width"]*s ' defence width DFH=SHP[7]["height"]*s ' defence height GPPY=Shapes.Gettop(SHP[4]["obj"]) ' Goal Player position Y GLX=Shapes.Getleft(SHP[1]["obj"])+SHP[1]["width"]*s ' goal position X //PC & Player same value GLX2=Shapes.Getleft(SHP[2]["obj"]) ' goal position X2 // PC & Player same value GLW=GLX2-GLX ' goal width PCT=Shapes.Gettop(SHP[9]["obj"]) ' PC's slider Top PCW=SHP[9]["width"]*s ' PC's slider width PCH=SHP[9]["height"]*s ' PC's slider Height PLW=SHP[10]["width"]*s ' Player's slider width PLH=SHP[10]["height"]*s ' Player's slider Height GraphicsWindow.FontSize=30 GraphicsWindow.BrushColor="White" smsg= Shapes.AddText(" PC : 0 Player : 0 ") Shapes.Move(smsg,50,25) Moving="true" ' Initial Moving = true EndSub Sub RNDBallPosition BXY="X=1;Y=4" ' ball speed BYY=BXY["Y"] BXX=BXY["X"] Shapes.Move(SHP[8]["obj"],WL+Math.GetRandomNumber(200),GPCY+50+Math.GetRandomNumber(100)) EndSub End>RZD792.sb< Start>RZF052.sb< ' Digital River ' Version 0.1 ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Challenge 2016-01/02 ' GraphicsWindow.Title = "Digital River 0.1" gw = 598 gh = 214 GraphicsWindow.Width = gw GraphicsWindow.Height = gh size = 55 GraphicsWindow.PenWidth = 0 GraphicsWindow.BackgroundColor = "#00EEEE" GraphicsWindow.BrushColor = "#00CCCC" rowMax = 3 colMax = 11 n = rowMax * colMax For i = 1 To n row = Math.Floor((i - 1) / colMax) + 1 col = Math.Remainder(i - 1, colMax) + 1 ell[i] = Shapes.AddRectangle(size, size) x0[i] = gw / 2 + size * 1.2 * (col - Math.Ceiling(colMax / 2)) y0[i] = gh / 2 + size * 1.2 * (row - Math.Ceiling(rowMax / 2)) x[i] = x0[i] y[i] = y0[i] vx[i] = 0 vy[i] = 0 EndFor GraphicsWindow.BrushColor = "#11000000" For i = n + 1 To 2 * n + colMax row = Math.Floor(((i - n) - 1) / colMax) + 1 col = Math.Remainder((i - n) - 1, colMax) + 1 ell[i] = Shapes.AddRectangle(size, size) x0[i] = gw / 2 + size * 1.2 * (col - colMax) y0[i] = gh / 2 + size * 1.2 * (row - Math.Ceiling(rowMax / 2)) - size / 2 x[i] = x0[i] y[i] = y0[i] vx[i] = 200 vy[i] = 0 EndFor dt = 1 / 15 ' [sec] max = 30 count = max Timer.Interval = dt * 1000 Timer.Tick = OnTick While "True" If tick Then For i = 1 To n If count = max Then a = Math.GetRandomNumber(360) - 1 _a = Math.GetRadians(a) ax[i] = 100 * (x0[i] - x[i]) + 200 * Math.Cos(_a) ay[i] = 100 * (y0[i] - y[i]) + 200 * Math.Sin(_a) Else ax[i] = 100 * (x0[i] - x[i]) ay[i] = 100 * (y0[i] - y[i]) EndIf dvx = ax[i] * dt dvy = ay[i] * dt dx = (2 * vx[i] + dvx) * dt / 2 dy = (2 * vy[i] + dvy) * dt / 2 vx[i] = (vx[i] + dvx) * 0.8 vy[i] = (vy[i] + dvy) * 0.8 x[i] = x[i] + dx y[i] = y[i] + dy Shapes.Move(ell[i], x[i] - size / 2, y[i] - size / 2) EndFor For i = n + 1 To 2 * n + colMax If count = max Then a = Math.GetRandomNumber(360) - 1 _a = Math.GetRadians(a) ay[i] = 100 * (y0[i] - y[i]) + 500 * Math.Sin(_a) Else ay[i] = 100 * (y0[i] - y[i]) EndIf dvx = ax[i] * dt dvy = ay[i] * dt dx = (2 * vx[i] + dvx) * dt / 2 dy = (2 * vy[i] + dvy) * dt / 2 vx[i] = vx[i] + dvx vy[i] = (vy[i] + dvy) * 0.8 x[i] = x[i] + dx y[i] = y[i] + dy If gw + size / 2 < x[i] Then x[i] = x[i] - size * 1.2 * colMax EndIf Shapes.Move(ell[i], x[i] - size / 2, y[i] - size / 2) EndFor count = count - 1 If count = 0 Then count = max EndIf tick = "False" EndIf EndWhile Sub OnTick tick = "True" EndSub End>RZF052.sb< Start>RZG368.sb< ' Pictionary - Root ' Version 1.2.0 ' Copyright © 2017-2020 Nonki Takahashi. The MIT License. ' Last update 2020-04-19 GraphicsWindow.Title = "Pictionary" bbb=LDShapes.BrushGradient("1=white;2=white;3=gray" "DD") LDGraphicsWindow.BackgroundBrush(bbb) SB_Workaround() Init() ' initialize image shapes Shapes_Init_Triangle() name = "Triangle" scale = 1.5 Sprite_Add() ' initialize caption shapes Shapes_Init_Caption() name = "Caption" scale = 1 Sprite_Add() Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 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 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 / SBD ' return silverlight - "True" if in remote ' return sbd - "True" if Small Basic Desktop color = GraphicsWindow.GetPixel(0, 0) sbd = "False" If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" _gw = GraphicsWindow.Width _gh = GraphicsWindow.Height If (_gw = 624) And (_gh = 441) Then sbd = "True" EndIf 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 = 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_Caption ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 471 ' x offset shY = 358 ' y offset shape = "" shape[1] = "func=text;x=0;y=0;text=Root;fn=Trebuchet MS;fs=50;fb=True;bc=Black;" EndSub Sub Shapes_Init_Triangle ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 160 ' x offset shY = 110 ' y offset shape = "" shape[1] = "func=tri;x=0;y=0;x1=0;y1=100;x2=173.2;y2=0;x3=173.2;y3=100;bc=DarkTurquoise;pc=Black;pw=2;" shape[2] = "func=line;x=78;y=18;x1=-16;y1=16;x2=-12;y2=14;pw=1;pc=Black;" shape[3] = "func=line;x=78;y=18;x1=-12;y1=14;x2=-8;y2=22;pw=1;pc=Black;" shape[4] = "func=line;x=78;y=18;x1=-8;y1=22;x2=-2;y2=0;pw=1;pc=Black;" shape[5] = "func=line;x=78;y=18;x1=-2;y1=0;x2=12;y2=0;pw=1;pc=Black;" shape[6] = "func=text;x=78;y=18;text=4;fn=Trebuchet MS;fs=20;bc=Black;" shape[11] = "func=text;x=200;y=40;text=1;fn=Trebuchet MS;fs=20;bc=Black;" shape[7] = "func=line;x=90;y=110;x1=-16;y1=16;x2=-12;y2=14;pw=1;pc=Black;" shape[8] = "func=line;x=90;y=110;x1=-12;y1=14;x2=-8;y2=22;pw=1;pc=Black;" shape[9] = "func=line;x=90;y=110;x1=-8;y1=22;x2=-2;y2=0;pw=1;pc=Black;" shape[12] = "func=line;x=90;y=110;x1=-2;y1=0;x2=12;y2=0;pw=1;pc=Black;" shape[10] = "func=text;x=90;y=110;text=3;fn=Trebuchet MS;fs=20;bc=Black;" EndSub Sub Sprite_Add ' Sprite | add shapes to a sprite ' param name - sprite name ' param shX, shY - origin of shape array ' param scale - to resize ' param shape[] - shape array ' param nSprite - number of sprite ' return nSprite - updated number of sprite ' return sprite[] - sprite array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nSprite = nSprite + 1 spr = "" spr["name"] = name spr["x"] = shX spr["y"] = shY spr["angle"] = 0 spr["dir"] = 1 Shapes_CalcWidthAndHeight() spr["width"] = shWidth spr["height"] = shHeight spr["cx"] = shWidth / 2 spr["cy"] = shHeight / 2 If scale = "" Then scale = 1 EndIf s = scale spr["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 sbd And (shp["func"] = "line") Then shp["wx"] = x shp["wy"] = y ElseIf 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 spr["shape"] = shape sprite[nSprite] = spr y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>RZG368.sb< Start>RZJ560.sb< ' Profiler Sample ' Copyright © 2015 Nonki Takahashi. The MIT License. ' Last update 2015-06-30 ' color = "1=Gray;2=Cyan;3=Blue;" ic = 1 Profiler_Init() ' for profile For i = 1 To 20 For j = 1 To 79 InnerLoop() EndFor OuterLoop() EndFor TextWindow.ForegroundColor = "Gray" Profiler_Dump() ' for profile Sub OuterLoop subName = "OuterLoop" ' for profile Profiler_Begin() ' for profile TextWindow.WriteLine("") Program.Delay(20) ic = ic + 1 If 3 < ic Then ic = 1 EndIf TextWindow.ForegroundColor = color[ic] Profiler_End() ' for profile EndSub Sub InnerLoop subName = "InnerLoop" ' for profile Profiler_Begin() ' for profile TextWindow.Write(".") Program.Delay(20) Profiler_End() ' for profile EndSub Sub Profiler_Init ' for profile Timer.Interval = 50 Timer.Tick = Profiler_OnTick Profiler_sub = "main" EndSub Sub Profiler_OnTick ' for profile profile[Profiler_sub] = profile[Profiler_sub] + 1 EndSub Sub Profiler_Begin ' for profile Stack.PushValue("local", Profiler_sub) Profiler_sub = subName EndSub Sub Profiler_End ' for profile Profiler_sub = Stack.PopValue("local") EndSub Sub Profiler_Dump ' for profile nProfile = Array.GetItemCount(profile) index = Array.GetAllIndices(profile) For iProfile = 1 To nProfile TextWindow.WriteLine(index[iProfile] + " : " + profile[index[iProfile]]) EndFor TextWindow.WriteLine("") EndSub End>RZJ560.sb< Start>RZJ747.sb< '******************************************************************************** ' NEWTON RAPHSON '******************************************************************************** 'Initialisation GraphicsWindow.BackgroundColor = "White" GraphicsWindow.Title="Newton Raphson" GraphicsWindow.Width=720 GraphicsWindow.Height=720 GraphicsWindow.CanResize=0 GraphicsWindow.Show() SetColours() rand=math.GetRandomNumber(7) Mouseclicks=0 GraphicsWindow.MouseDown=OnMouseDown GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=36 GraphicsWindow.DrawText(40,300,"Click anywhere to draw the fractal") While Mouseclicks=0 Program.Delay(10) Endwhile 'Use nested loops to colour each pixel one by one For i=0 To 720 For j=0 To 720 'x runs from -2 to 2 x=i/180-2 'y runs from 2 to -2 y=2-j/180 root=0 col=0 'iterate until the output is the same as the input While root=0 col=col+1 p=x q=y 'this part is NR for z^3-1 ' x = Real(z) and y = Im(z) a=p*p+q*q x=2*p/3+(p*p-q*q)/(3*a*a) y=2*q/3-2*p*q/(3*a*a) If Math.Abs(x-p)<0.00001 And Math.Abs(y-q)<0.00001 Then root=1 EndIf EndWhile 'Now colour according to the root usecol = Math.Remainder(col+rand,7)+1 If x>0.5 then GraphicsWindow.SetPixel(i,j,Colours[0][usecol]) Elseif y>0.25 then GraphicsWindow.SetPixel(i,j,Colours[1][usecol]) Else GraphicsWindow.SetPixel(i,j,Colours[2][usecol]) EndIf EndFor EndFor Sub OnMouseDown Mouseclicks=Mouseclicks+1 EndSub Sub SetColours Colours[0][1]="Red" Colours[0][2]="Crimson" Colours[0][3]="IndianRed" Colours[0][4]="LightCoral" Colours[0][5]="Salmon" Colours[0][6]="DarkSalmon" Colours[0][7]="LightSalmon" Colours[1][1]="Blue" Colours[1][2]="RoyalBlue" Colours[1][3]="DodgerBlue" Colours[1][4]="LightSkyBlue" Colours[1][5]="SkyBlue" Colours[1][6]="LightBlue" Colours[1][7]="PowderBlue" Colours[2][1]="Yellow" Colours[2][2]="Khaki" Colours[2][3]="PapayaWhip" Colours[2][4]="Moccasin" Colours[2][5]="LightGoldenrodYellow" Colours[2][6]="LemonChiffon" Colours[2][7]="LightYellow" EndSub End>RZJ747.sb< Start>RZJ923.sb< GraphicsWindow.Width=1600 GraphicsWindow.Height=900 GraphicsWindow.BackgroundColor="midnightblue GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="blue shapes.move(Shapes.AddEllipse (500 500) 200, -450) GraphicsWindow.Title ="Orbital Daisy er=6367444.7 ep=er*2*math.Pi d=math.pi*1000 e=2*er/1000 'f=e*d/2 ff=1000*Math.pi/(er*2) g=9.80665 sine_a=Math.SquareRoot (45)/2 v=3500 t=1 LDEvents.MouseWheel=mww zz=.1 yy=-1500 GraphicsWindow.KeyDown=kkk mww() Sub mww zz=zz+ LDEvents.LastMouseWheelDelta/100 LDGraphicsWindow.Reposition (zz zz xx yy 0) EndSub Sub kkk ls=text.ConvertToLowerCase (GraphicsWindow.LastKey) If ls="left" then xx=xx-50 ElseIf ls="right" then xx=xx+50 ElseIf ls="up" then yy=yy-50 ElseIf ls="down" then yy=yy+50 EndIf LDGraphicsWindow.Reposition (zz zz xx yy 0) EndSub dd=0 For r=0 to 8 t=1 h=0.1 GraphicsWindow.BrushColor=LDColours.HSLtoRGB (r*70-30 1 .7) While t<2400 h = v*sine_a*t-g*t*t/2 dx=v*sine_a*t s=Math.ArcSin(dx/ep) px=Math.cos(s+dd)*(250+h*ff)+450 py=math.Sin(s+dd)*(250+h*ff)-200 Shapes.move (shapes.AddEllipse (25 25) px py) 'Program.Delay (4) ' Shapes.move (shapes.AddEllipse (3 3) dx*ff 300-h*ff) t=t+2 ' dd=dd+0.015 ' GraphicsWindow.Title=t EndWhile dd=dd+.7 endfor End>RZJ923.sb< Start>RZK225.sb< GraphicsWindow.Show() CardsInit() For i = 1 to 32 TextWindow.WriteLine(C[i]) EndFor Riffle() Deal() Sub CardsInit For i = 1 To 4 For j = 1 To 8 nr = nr + 1 If i = 1 Then C[nr] = Text.GetCharacter(4) EndIf If i = 2 Then C[nr] = Text.GetCharacter(3) EndIf If i = 3 Then C[nr] = Text.GetCharacter(6) EndIf If i = 4 Then C[nr] = Text.GetCharacter(5) EndIf If j = 1 Then C[nr] = Text.Append(C[nr], " 7") EndIf If j = 2 Then C[nr] = Text.Append(C[nr], " 8") EndIf If j = 3 Then C[nr] = Text.Append(C[nr], " 9") EndIf If j = 4 Then C[nr] = Text.Append(C[nr], " 10") EndIf If j = 5 Then C[nr] = Text.Append(C[nr], " B") EndIf If j = 6 Then C[nr] = Text.Append(C[nr], " D") EndIf If j = 7 Then C[nr] = Text.Append(C[nr], " K") EndIf If j = 8 Then C[nr] = Text.Append(C[nr], " A") EndIf SC[nr] = Shapes.AddText(C[nr]) EndFor EndFor sl = nr EndSub 'CardsInit Sub Riffle For i = 1 To sl weiter = 0 While weiter = 0 nr = Math.GetRandomNumber(32) if Array.ContainsValue(RC, nr) = "False" Then RC[i] = nr weiter = 1 EndIf EndWhile EndFor EndSub 'Riffle Sub Deal For i = 1 To sl/2 ii = i * 2 Shapes.ShowShape(SC[RC[i]]) Shapes.HideShape(SC[RC[i]]) 'Shapes.Zoom(SC[i], 4, 4) Shapes.ShowShape(SC[RC[ii]]) Shapes.HideShape(SC[RC[ii]]) 'Shapes.Zoom(SC[ii], 4, 4) x = i * 10 - 10 y = GraphicsWindow.Height / 2 Shapes.Animate(SC[i], x, y, 1500) Program.Delay(500) Shapes.Animate(SC[ii], x, y, 1500) EndFor Program.Delay(2000) For j = 1 to 10 For i = 1 To sl x = i * 10 - 10 If Math.Remainder(i, 2) = 0 Then y = GraphicsWindow.Height / 2 - 100 + 30 Else y = GraphicsWindow.Height / 2 - 100 - 30 EndIf Shapes.Animate(SC[i], x, y, 1500) EndFor Program.Delay(1500) For i = 1 To sl x = i * 10 - 10 If Math.Remainder(i, 2) = 0 Then y = GraphicsWindow.Height / 2 - 100 - 30 Else y = GraphicsWindow.Height / 2 - 100 + 30 EndIf Shapes.Animate(SC[i], x, y, 1500) EndFor Program.Delay(1500) EndFor Program.Delay(1200) For i = sl To 1 Step - 1 Shapes.HideShape(SC[i]) Program.Delay(300) EndFor EndSub 'Deal End>RZK225.sb< Start>RZK270.sb< P1 = ImageList.LoadImage("http://www.xnadevelopment.com/sprites/thumbs/thumb_SharkGuy1.png") P2 = ImageList.LoadImage("http://www.xnadevelopment.com/sprites/thumbs/thumb_SharkGuy2.png") S1 = Shapes.AddImage(P1) S2 = Shapes.AddImage(P2) Shapes.Move(S1, 50,50) Shapes.Move(S2, 50,50) Shapes.HideShape(S2) GraphicsWindow.Width = Desktop.Width-17 GraphicsWindow.Height = Desktop.Height-75 GraphicsWindow.Title = "Shark" GraphicsWindow.Left = .5 GraphicsWindow.Top = .5 GraphicsWindow.BackgroundColor = "red" GraphicsWindow.BrushColor = "gray" GraphicsWindow.FillRectangle(0,0,GraphicsWindow.Width,20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(10,2,30, "File") GraphicsWindow.DrawBoundText(40,2,50, "Options") Score = 0 LastFace = "D" Timer.Interval = 355 int = 0 Timer.Tick = Control Sub Control int = int + 15 If(Math.Remainder(Int, 10) = 0)Then Shapes.HideShape(S2) Shapes.ShowShape(S1) Show = "S1" Else Shapes.HideShape(S1) Shapes.ShowShape(S2) Show = "S2" EndIf K = GraphicsWindow.LastKey If(K = "Right")Then Shapes.Move(S1, Shapes.GetLeft(S1)+50 Shapes.GetTop(S1)) Shapes.Move(S2, Shapes.GetLeft(S2)+50Shapes.GetTop(S2)) Shapes.Rotate(S1, 0) Shapes.Rotate(S2, 0) ElseIf(K = "Down")Then Shapes.Move(S1, Shapes.GetLeft(S1) Shapes.GetTop(S1)+50) Shapes.Move(S2, Shapes.GetLeft(S2) Shapes.GetTop(S2)+50) Shapes.Rotate(S1, 90) Shapes.Rotate(S2, 90) ElseIf(K = "Left")Then Shapes.Move(S1, Shapes.GetLeft(S1)-50 Shapes.GetTop(S1)) Shapes.Move(S2, Shapes.GetLeft(S2)-50 Shapes.GetTop(S2)) Shapes.Rotate(S1, 180) Shapes.Rotate(S2, 180) ElseIf(K = "Up")Then Shapes.Move(S1, Shapes.GetLeft(S1) Shapes.GetTop(S1)-50) Shapes.Move(S2, Shapes.GetLeft(S2) Shapes.GetTop(S2)-50) Shapes.Rotate(S1, -90) Shapes.Rotate(S2, -90) EndIf Score = Score +10 GraphicsWindow.Title = "Score: " + Score + " Shark Pac-Man" endSub End>RZK270.sb< Start>RZL295.sb< GraphicsWindow.BackgroundColor="darkblue tt=LDControls.AddRichTextBox(600 800) GraphicsWindow.Height=850 GraphicsWindow.Width=1200 GraphicsWindow.Title="SimpleBasic LDShapes.BrushColour(tt "transparent") LDControls.RichTextBoxFontFamily="Lucida Console LDControls.RichTextBoxFontSize=14 LDControls.RichTextBoxFontForeground="cyan LDControls.RichTextBoxFontBackground="#007799 LDControls.RichTextBoxDefault(tt) Controls.AddButton (" Run >>> " 5 5) cmp=Controls.AddButton (" >>Cmpct<< " 95 5) nln=Text.GetCharacter(13)+Text.GetCharacter(10) dd=LDText.Replace("get a supply_a_value;loop 5;get b supply_b_value;set c %a+%b;? result:_%a+%b=%c;eloop" ";" nln) dd=LDText.Replace("clr ;set h 0;for 0 120 15;set a 0;set x 0;set h %h+15;lpp 500;set y Math.Sin(%a)*70;set a %a+.02;hsb %h 1 .5;ell %x %y+155+%1 5 5 %ccc;set x %x+1;elp ;nxt ;dly 3333" ";" nln) LDControls.RichTextBoxSetText(tt dd "false") Shapes.Move(tt 5 35) rtbcc() Controls.ButtonClicked=bbb While "true If run Then mm="" Shapes.SetOpacity(tt 15) tx=ldtext.split(LDControls.RichTextBoxGetText(tt) nln) xx=1 For x=1 To Array.GetItemCount(tx) tx[x]= LDText.Trim(tx[x]) If Text.StartsWith(tx[x] "`") Then lbm[Text.GetSubTextToEnd(tx[x] 2)]=x+1 EndIf EndFor ' TextWindow.WriteLine(lbm) While xx<=Array.GetItemCount(tx) ll=LDText.Split(ldtext.Replace(ldtext.Replace(tx[xx] " " "~") "_" " ") "~") lc=Text.ConvertToLowerCase(ll[1]) ii=Array.GetAllIndices(mm) 'TextWindow.WriteLine(ii) For q=2 To Array.GetItemCount(ll) For m=1 To Array.GetItemCount(mm) ll[q]=LDText.Replace(ll[q] "%"+ii[m] mm[ii[m]]) EndFor For m=1 To Array.GetItemCount(lp) ll[q]=LDText.Replace(ll[q] "%"+m lps[m]) EndFor ll[q]=LDText.Replace(ll[q] "%ccc" clr) EndFor ' TextWindow.WriteLine(ll) If lc="get" or lc="inp" or lc="<<<" Then mm[ll[2]]= FCDialogs.AskForTextLine(ll[3]) ElseIf lc="for" or lc="{::" Then lw=lw+1 lp[lw]=xx+1 lpc[lw]=Math.Floor((ll[3]-ll[2])/ll[4]) lps[lw]=ll[2] lpi[lw]=ll[4] ElseIf lc="jmp" or lc=">+>" Then xx=xx+ll[2] Goto nxt ElseIf lc="iff" or lc="whn" Then If LDMath.Evaluate3(ll[2]) Then Else xx=xx+ll[3] Goto nxt EndIf ElseIf lc="jtl" or lc=">>:" Then xx=ll[2] Goto nxt ElseIf lc="rct" or lc="rect" Then GraphicsWindow.BrushColor=ll[6] GraphicsWindow.FillRectangle(ll[2] ll[3] ll[4] ll[5]) ElseIf lc="ell" or lc="elip" Then GraphicsWindow.BrushColor=ll[6] GraphicsWindow.FillEllipse(ldmath.Evaluate(ll[2]+"+0") ldmath.Evaluate("0+"+ll[3]) ldmath.Evaluate("0+"+ll[4]) ldmath.Evaluate("0+"+ll[5])) ElseIf lc="jlb" or lc=">>>" Then xx=lbm[ll[2]] Goto nxt ElseIf lc="hsb" Then clr= LDColours.HSLtoRGB(ll[2] ll[3] ll[4]) ElseIf lc="loop" or lc="lpp" or lc="{" Then lw=lw+1 lp[lw]=xx+1 lpc[lw]=ll[2]-1 lps[lw]=0 ElseIf lc="clr" Then GraphicsWindow.BrushColor="darkblue" GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height) ElseIf lc="dly" or lc="pause" Then Program.Delay(ll[2]) ElseIf lc="efor" or lc="efr" or lc="}/}" or lc="nxt" Then If lpc[lw]>0 Then lpc[lw]=lpc[lw]-1 xx=lp[lw] lps[lw]=lps[lw]+lpi[lw] Goto nxt Else lw=lw-1 EndIf ElseIf lc="eloop" or lc="elp" or lc="}" Then If lpc[lw]>0 Then lpc[lw]=lpc[lw]-1 xx=lp[lw] lps[lw]=lps[lw]+1 Goto nxt Else lw=lw-1 EndIf ElseIf lc="set" or lc="let" or lc=":::" Then mm[ll[2]]=LDMath.Evaluate(ll[3]) ' TextWindow.WriteLine( mm[ll[2]]) ElseIf lc="?" or lc="???" or lc="msg" Then GraphicsWindow.ShowMessage(ll[2] "Info") EndIf xx=xx+1 nxt: EndWhile Shapes.SetOpacity(tt 95) run="false EndIf EndWhile Sub bbb If Controls.LastClickedButton=cmp Then rtbcc() Else run="true EndIf EndSub sub rtbcc tx=ldtext.split(LDControls.RichTextBoxGetText(tt) nln) For x=1 To Array.GetItemCount(tx) tx[x]= LDText.Trim(tx[x]) ln=LDText.Split(tx[x] " ") q1=ln[1] If q1="loop" Then ln[1]="lpp" ElseIf q1="eloop" Then ln[1]="elp" ElseIf q1="?" Then ln[1]="? " EndIf agg="" For r=2 To Array.GetItemCount(ln) agg=Text.Append(agg ln[r]+" ") EndFor tx[x]=ln[1]+"@"+ldtext.trim(agg) EndFor agg="" LDControls.RichTextBoxClear(tt) tx1="{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Lucida console;}{\f1\fnil\fcharset0 Calibri;}} tx1=tx1+"{\colortbl ;\red255\green85\blue0;\red0\green128\blue128;\red255\green170\blue0;\red255\green255\blue0;\red170\green255\blue0;\red85\green255\blue0;\red0\green255\blue0;\red0\green255\blue85;\red0\green255\blue170;\red0\green255\blue255;\red0\green170\blue255;\red0\green85\blue255;\red0\green0\blue255;\red0\green0\blue0;} tx1=tx1+"{\*\generator Riched20 6.3.9600}\viewkind4\uc1" tx1=tx1+"\pard\cf1\highlight2\f0 For r=1 To Array.GetItemCount(tx) ty=LDText.Split(tx[r] "@") tx1=tx1+"\cf3\fs22 "+ty[1]+" " tx1=tx1+"\cf5\fs24 "+ty[2]+"\par \pard EndFor tx1=tx1+"\par}" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(Program.Directory+"\tx.rtf" tx1) LDControls.RichTextBoxLoad (tt Program.Directory+"\tx.rtf" "false") EndSub End>RZL295.sb< Start>RZL408.sb< ' Fibonacci ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Last update 2017-06-06 ' Challenge 2017-06 GraphicsWindow.Title = "Fibonacci" LF = Text.GetCharacter(10) f[0] = 0 f[1] = 1 For i = 2 To 19 f[i] = f[i - 2] + f[i - 1] EndFor For i = 0 To 19 txt = txt + "f[" + i + "]=" + f[i] + LF EndFor max = 12 GraphicsWindow.Width = 4 * f[max] GraphicsWindow.Height = 4 * f[max - 1] GraphicsWindow.BrushColor = "#000" ts = Shapes.AddText(txt) Shapes.Move(ts, 480, 30) GraphicsWindow.PenColor = "#999" Turtle.Speed = 10 Turtle.X = 4 * f[max] Turtle.Y = 4 * f[max - 1] + 4 For i = max - 1 To 1 Step -1 d = 4 * f[i] * Math.Pi / 180 For a = 1 To 90 Turtle.Move(d) Turtle.Turn(-1) EndFor Turtle.Turn(-90) Turtle.Move(4 * f[i]) Turtle.Turn(-180) Turtle.PenUp() Turtle.Move(4 * f[i]) Turtle.Turn(-90) Turtle.PenDown() EndFor Turtle.Hide() End>RZL408.sb< Start>RZM182.sb< '================================================================================================================== gwindows: GraphicsWindow.Top = 385 GraphicsWindow.Left = 700 GraphicsWindow.CanResize = "false" GraphicsWindow.Width = 480 GraphicsWindow.Height = 210 GraphicsWindow.Title = "Kviz" GraphicsWindow.FontBold = "true" GraphicsWindow.FontItalic = "false" GraphicsWindow.FontName = "Comic Sans MS" GraphicsWindow.FontSize = 40 GraphicsWindow.BrushColor = "black" GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB( 0, 56, 12 ) tekst1 = "KVIZ ZNANJA" tekstforma1 = Shapes.AddText(tekst1) Shapes.Move(tekstforma1, 75, 70) Shapes.SetOpacity(tekstforma1, 60) GraphicsWindow.PenColor = "darkgreen" li1 = Shapes.AddLine(0, 15, 480, 15) li2 = Shapes.AddLine(0, 195, 480, 195) GraphicsWindow.PenColor = "yellow" li3 = Shapes.AddLine(10, 16, 10, 194) li4 = Shapes.AddLine(470, 16, 470, 194) Program.Delay(3000) GraphicsWindow.Hide() pocetak: TextWindow.Clear() TextWindow.Title = "Kviz" TextWindow.ForegroundColor = "yellow" TextWindow.WriteLine(" -KVIZ ZNANJA-") TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "red" TextWindow.WriteLine(" Unesite 1 da pokrenete igru,a 2 da vidite Info. ") TextWindow.BackgroundColor = "black" TextWindow.ForegroundColor = "yellow" TextWindow.Write("--> ") opcije1 = TextWindow.ReadNumber() igra = "1" info = "2" If opcije1 = igra Then TextWindow.Clear() Goto bi EndIf If opcije1 = info Then TextWindow.Clear() TextWindow.ForegroundColor = "green" TextWindow.BackgroundColor = "black" TextWindow.Title = "Kviz - Info" TextWindow.WriteLine(" -Info-") TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "black" TextWindow.WriteLine("Dobrodosli u kviz!Meni ce vas sprovesti do pocetka igre,a navigator vam je taste-r ENTER i opcije koje su u mogucnosti da unesete.Kao i u svakom kvizu takmicar odgovara na postavljena pitanja.Kviz se sastoji od 10 pitanja.Odgovara se slovim-a(A,B,C).") TextWindow.WriteLine("Potrudi se da imas sto bolji rezultat.Ako pogresis jedno pitanje izgubio si,a ig-ra te stavlja na pocetak.") TextWindow.WriteLine("U kvizu ima dva rezima,laki i teski.U kom su pitanja prosca i svako pitanje nosi 10 poena.U teskom svako pitanje nosi 20 poena i to je tezi mod gde su pitanja nepoznata za osobe cije opste znanje ne prelazi neki prosek.Sami izaberite i uzi-vajte!") TextWindow.WriteLine("Igru napravio:Neks") TextWindow.ForegroundColor = "gray" TextWindow.BackgroundColor = "black" TextWindow.Pause() TextWindow.Clear() Goto pocetak ElseIf opcije1 <> igra or info then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "gray" TextWindow.BackgroundColor = "black" TextWindow.Pause() TextWindow.Clear() Goto pocetak EndIf bi: TextWindow.BackgroundColor = "gray" TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() TextWindow.WriteLine("Kako se zovete?") TextWindow.Write("Zovem se: ") ime = TextWindow.Read() TextWindow.Write("Dobrodosao/la " + ime + "! ") opcije2: TextWindow.WriteLine("Mozemo li krenuti (da/ne) ?") opcije2 = TextWindow.Read() If ( opcije2 = "da" Or opcije2 = "Da" Or opcije2 = "DA" Or opcije2 = "dA" ) Then TextWindow.Clear() Goto rezim TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" EndIf If ( opcije2 = "ne" Or opcije2 = "Ne" Or opcije2 = "NE" Or opcije2 = "nE" ) Then TextWindow.BackgroundColor = "black" TextWindow.Clear() Goto pocetak EndIf TextWindow.ForegroundColor = "gray" TextWindow.BackgroundColor = "black" If opcije2 <> "da" Or opcije2 <> "Da" Or opcije2 <> "DA" Or opcije2 <> "dA" Or opcije2 <> "ne" Or opcije2 <> "Ne" Or opcije2 <> "NE" Or opcije2 <> "nE" Then TextWindow.ForegroundColor = "red" TextWindow.BackgroundColor = "black" TextWindow.WriteLine("Greska:Mozete uneti samo ponudjene opcije (da/ne) !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto opcije2 EndIf rezim: TextWindow.WriteLine("Izaberite rezim igre:") TextWindow.WriteLine("Laki (unesi 1)") TextWindow.WriteLine("Teski(unesi 2)") TextWindow.WriteLine("Idi na meni (unesi m)") rezim = TextWindow.Read() If rezim = "1" Then TextWindow.Clear() Goto igrapocela ElseIf rezim = "2" then TextWindow.Clear() Goto rezim2 ElseIf rezim = "m" or rezim = "M" then TextWindow.Clear() TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "black" Goto pocetak TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "red" EndIf If rezim <> "1" Or rezim <> "2" Or rezim <> "m" or rezim <> "M" Then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Ponudjene opcije su 1, 2 i m !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto rezim EndIf igra: igrapocela: p1: TextWindow.WriteLine("1. Koji je najveci sisar na svetu?") 'izmedju navodnika menjajte pitanje ali odgovore dole TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Gorila B - Kit C - Slepi mis") 'napisite odgovore *(A - Gorila /promenite u A - Mark Twen) u skladu sa pitanjima, a tacno resenje stavite pod B 'TAKO URADITI ZA SVE p1 = TextWindow.Read() If p1 = "B" Or p1 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p2 ElseIf p1 = "A" Or p1 = "a" or p1 = "C" Or p1 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:0") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g1: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p1 EndIf opcije3 = TextWindow.ReadNumber() If opcije3 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije3 = "2" then Program.End() ElseIf opcije3 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g1 EndIf p2: TextWindow.WriteLine("2. Koje godine se zavrsio Prvi svetski rat?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 1918 B - 1919 C - 1917") 'tacno resenje stavite pod A p2 = TextWindow.Read() If p2 = "A" Or p2 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p3 ElseIf p2 = "B" Or p2 = "b" or p2 = "C" Or p2 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:10") TextWindow.WriteLine("Tacno resenje je pod A.") TextWindow.Pause() TextWindow.Clear() g2: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p2 EndIf opcije4 = TextWindow.ReadNumber() If opcije4 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije4 = "2" then Program.End() ElseIf opcije4 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g2 EndIf p3: TextWindow.WriteLine("3. Sta ispunjava unutrasnjost celije?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Krvna plazma B - Citoplazma C - Leukoplasti") 'tacno resenje stavite pod B p3 = TextWindow.Read() If p3 = "B" Or p3 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p4 ElseIf p3 = "A" Or p3 = "a" or p3 = "C" Or p3 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:20") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g3: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p3 EndIf opcije5 = TextWindow.ReadNumber() If opcije5 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije5 = "2" then Program.End() ElseIf opcije5 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g3 EndIf p4: TextWindow.WriteLine("4. Demografija je nauka o?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Dezintegrisanju ploca B - Ljudima C - Stanovnistvu") 'tacno resenje stavite pod C p4 = TextWindow.Read() If p4 = "C" Or p4 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p5 ElseIf p4 = "A" Or p4 = "a" or p4 = "B" Or p4 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:30") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g4: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p4 EndIf opcije6 = TextWindow.ReadNumber() If opcije6 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije6 = "2" then Program.End() ElseIf opcije6 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g4 EndIf p5: TextWindow.WriteLine("5. Zvanicna merna jedinica za termo-dinamicku temperaturu je?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Kandela (Cd) B - Kelvin (K) C - Farad (F)") 'tacno resenje stavite pod B p5 = TextWindow.Read() If p5 = "B" Or p5 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p6 ElseIf p5 = "A" Or p5 = "a" or p5 = "C" Or p5 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:40") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g5: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p5 EndIf opcije7 = TextWindow.ReadNumber() If opcije7 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije7 = "2" then Program.End() ElseIf opcije7 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g5 EndIf p6: TextWindow.WriteLine("6. Koja je oznaka za hemijski simbol joda?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 'J' B - 'Ir' C - 'I' ") 'tacno resenje stavite pod B p6 = TextWindow.Read() If p6 = "C" Or p6 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p7 ElseIf p6 = "A" Or p6 = "a" or p6 = "B" Or p6 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:50") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g6: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p6 EndIf opcije8 = TextWindow.ReadNumber() If opcije8 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije8 = "2" then Program.End() ElseIf opcije8 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g6 EndIf p7: TextWindow.WriteLine("7. Koliko nula ima Avogadrov broj?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 23 B - 12 C - 32 ") 'tacno resenje stavite pod A p7 = TextWindow.Read() If p7 = "A" Or p7 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p8 ElseIf p7 = "B" Or p7 = "b" or p7 = "C" Or p7 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:60") TextWindow.WriteLine("Tacno resenje je pod A.") TextWindow.Pause() TextWindow.Clear() g7: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p7 EndIf opcije9 = TextWindow.ReadNumber() If opcije9 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije9 = "2" then Program.End() ElseIf opcije9 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g7 EndIf p8: TextWindow.WriteLine("8. Rec 'medjutim' je?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Prilog B - Recica C - Predlog ") 'tacno resenje stavite pod B p8 = TextWindow.Read() If p8 = "B" Or p8 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p9 ElseIf p8 = "A" Or p8 = "a" Or p8 = "C" Or p8 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:70") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g8: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p8 EndIf opcije10 = TextWindow.ReadNumber() If opcije10 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije10 = "2" then Program.End() ElseIf opcije10 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g8 EndIf p9: TextWindow.WriteLine("9. Kada je osnovan Rim?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 453. p.n.e B - 753. C - 753. p.n.e ") 'tacno resenje stavite pod C p9 = TextWindow.Read() If p9 = "C" Or p9 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p10 ElseIf p9 = "A" Or p9 = "a" Or p9 = "B" Or p9 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:80") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g9: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p9 EndIf opcije11 = TextWindow.ReadNumber() If opcije11 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije11 = "2" then Program.End() ElseIf opcije11 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g9 EndIf p10: TextWindow.WriteLine("10. Koliko prosecan covek ima dlaka na glavi?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 50 000 B - 500 000 C - 100 000 ") 'tacno resenje stavite pod C p10 = TextWindow.Read() If p10 = "C" Or p10 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto pobeda ElseIf p10 = "A" Or p10 = "a" Or p10 = "B" Or p10 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:90") TextWindow.WriteLine("I korak koji vas je delio od pobede je bio odgovor pod C") TextWindow.Pause() TextWindow.Clear() g10: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p10 EndIf opcije12 = TextWindow.ReadNumber() If opcije12 = "1" Then TextWindow.Clear() Goto igra ElseIf opcije12 = "2" then Program.End() ElseIf opcije12 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g10 EndIf pobeda: TextWindow.BackgroundColor = "yellow" TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Bravo!!!Pobedio si u kvizu znanja.") TextWindow.Pause() kraj: TextWindow.BackgroundColor = "gray" TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Da li zelite da idete na glavni meni ili da izadjete iz kviza?") TextWindow.WriteLine("Unesi 1 da ides do meni-a.") TextWindow.WriteLine("Unesi 2 da izadjes iz kviza.") opcije13 = TextWindow.ReadNumber() If opcije13 = "1" Then TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "black" TextWindow.Clear() Goto pocetak TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "black" ElseIf opcije13 = "2" then Program.End() Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() TextWindow.BackgroundColor = "red" TextWindow.ForegroundColor = "yellow" Goto kraj EndIf rezim2: igra2: p11: 'OVO JE TEZI REZIM TAKO DA STAVITE MALO TEZA PITANJA TextWindow.WriteLine("1. Koji je najveci vodopad na svetu?") 'izmedju navodnika menjajte pitanje ali odgovore dole TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Andjeolski B - Nijagarini C - Ejndzel") 'napisite odgovore *(A - Gorila /promenite u A - Mark Twen) u skladu sa pitanjima, a tacno resenje stavite pod C 'TAKO URADITI ZA SVE p11 = TextWindow.Read() If p11 = "C" Or p11 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p12 ElseIf p11 = "A" Or p11 = "a" or p11 = "B" Or p11 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:0") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g11: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p11 EndIf opcije20 = TextWindow.ReadNumber() If opcije20 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije20 = "2" then Program.End() ElseIf opcije20 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g11 EndIf p12: TextWindow.WriteLine("2. Kako se zvao otac Aleksandra Velikog?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Filip B - Stefan C - Darije") 'tacno resenje stavite pod A p12 = TextWindow.Read() If p12 = "A" Or p12 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p13 ElseIf p12 = "B" Or p12 = "b" or p12 = "C" Or p12 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:20") TextWindow.WriteLine("Tacno resenje je pod A.") TextWindow.Pause() TextWindow.Clear() g12: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p12 EndIf opcije21 = TextWindow.ReadNumber() If opcije21 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije21 = "2" then Program.End() ElseIf opcije21 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g12 EndIf p13: TextWindow.WriteLine("3. Koji je predsednik po redu Barak Obama?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 44 B - 31 C - 18") 'tacno resenje stavite pod A p13 = TextWindow.Read() If p13 = "A" Or p13 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p14 ElseIf p13 = "B" Or p13 = "b" or p13 = "C" Or p13 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:40") TextWindow.WriteLine("Tacno resenje je pod A.") TextWindow.Pause() TextWindow.Clear() g13: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p13 EndIf opcije22 = TextWindow.ReadNumber() If opcije22 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije22 = "2" then Program.End() ElseIf opcije22 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g13 EndIf p14: TextWindow.WriteLine("4. Koja je prirodna vrednost broja 1?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 1.66 B - -1 C - 1") 'tacno resenje stavite pod B p14 = TextWindow.Read() If p14 = "B" Or p14 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p15 ElseIf p14 = "A" Or p14 = "a" or p14 = "C" Or p14 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:60") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g14: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p14 EndIf opcije23 = TextWindow.ReadNumber() If opcije23 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije23 = "2" then Program.End() ElseIf opcije23 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g14 EndIf p15: TextWindow.WriteLine("5. Kolika je konstanta vakuma?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - 9*10 na 9 B - 10*10 na 9 C - 10 na 9") 'tacno resenje stavite pod A p15 = TextWindow.Read() If p15 = "A" Or p15 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p16 ElseIf p15 = "B" Or p15 = "b" or p15 = "C" Or p15 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:80") TextWindow.WriteLine("Tacno resenje je pod A.") TextWindow.Pause() TextWindow.Clear() g15: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p15 EndIf opcije24 = TextWindow.ReadNumber() If opcije24 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije24 = "2" then Program.End() ElseIf opcije24 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g15 EndIf p16: TextWindow.WriteLine("6. Koja je oznaka hemijsko elementa Germanijuma?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - nepostoji taj element B - 'Gr' C - 'Ge' ") 'tacno resenje stavite pod C p16 = TextWindow.Read() If p16 = "C" Or p16 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p17 ElseIf p16 = "A" Or p16 = "a" or p16 = "B" Or p16 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:100") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g16: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p16 EndIf opcije25 = TextWindow.ReadNumber() If opcije25 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije25 = "2" then Program.End() ElseIf opcije25 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g16 EndIf p17: TextWindow.WriteLine("7. Ko je od sledecih imena spadao u umetnike renesanse?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Lisip B - Orlando Laso C - Georg Fridrih Hendl") 'tacno resenje stavite pod B p17 = TextWindow.Read() If p17 = "B" Or p17 = "b" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p18 ElseIf p17 = "A" Or p17 = "a" or p17 = "C" Or p17 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:120") TextWindow.WriteLine("Tacno resenje je pod B.") TextWindow.Pause() TextWindow.Clear() g17: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p17 EndIf opcije26 = TextWindow.ReadNumber() If opcije26 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije26 = "2" then Program.End() ElseIf opcije26 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g17 EndIf p18: TextWindow.WriteLine("8. Sta je po zanimanju bio Jovan Jovanovic Zmaj") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Pesnik za decu B - Obucar C - Lekar ") 'tacno resenje stavite pod C p18 = TextWindow.Read() If p18 = "C" Or p18 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p19 ElseIf p18 = "A" Or p18 = "a" Or p18 = "B" Or p18 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:140") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g18: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p18 EndIf opcije27 = TextWindow.ReadNumber() If opcije27 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije27 = "2" then Program.End() ElseIf opcije27 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g18 EndIf p19: TextWindow.WriteLine("9. Koja drzava je pobedila na svetskom prvenstvu u fudbalu 2014. godine?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Nemacka B - Brazil C - Spanija ") 'tacno resenje stavite pod A p19 = TextWindow.Read() If p19 = "A" Or p19 = "a" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto p20 ElseIf p19 = "B" Or p19 = "b" Or p19 = "C" Or p19 = "c" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:160") TextWindow.WriteLine("Tacno resenje je pod C.") TextWindow.Pause() TextWindow.Clear() g19: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p19 EndIf opcije28 = TextWindow.ReadNumber() If opcije28 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije28 = "2" then Program.End() ElseIf opcije28 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g19 EndIf p20: TextWindow.WriteLine("10. Koji od ponudjenih glumaca je najvise ginuo na kraju filmova u kojima ") TextWindow.WriteLine(" je glumio?") TextWindow.ForegroundColor = "black" TextWindow.WriteLine("A - Jack Niklson B - Al Pacino C - Robert De Niro ") 'tacno resenje stavite pod C p20 = TextWindow.Read() If p20 = "C" Or p20 = "c" Then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Tacan odgovor!") TextWindow.Pause() TextWindow.Clear() Goto pobeda2 ElseIf p20 = "A" Or p20 = "a" Or p20 = "B" Or p20 = "b" then TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Netacan ogovor!Osvojen broj poena:180") TextWindow.WriteLine("I korak koji vas je delio od pobede je bio odgovor pod C") TextWindow.Pause() TextWindow.Clear() g20: TextWindow.WriteLine("Zelite ponovo igrati ili izaci?") TextWindow.WriteLine("Unesi 1 da igras opet.") TextWindow.WriteLine("Unesi 2 da izadjes.") Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Ponudjeni odgovori su A,B,C !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() Goto p20 EndIf opcije29 = TextWindow.ReadNumber() If opcije29 = "1" Then TextWindow.Clear() Goto igra2 ElseIf opcije29 = "2" then Program.End() ElseIf opcije29 <> "1" or "2" then TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.BackgroundColor = "gray" TextWindow.Pause() TextWindow.Clear() Goto g20 EndIf pobeda2: TextWindow.BackgroundColor = "yellow" TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Bravo!!!Pobedio si u kvizu znanja.") TextWindow.Pause() kraj2: TextWindow.BackgroundColor = "gray" TextWindow.ForegroundColor = "blue" TextWindow.WriteLine("Da li zelite da idete na glavni meni ili da izadjete iz kviza?") TextWindow.WriteLine("Unesi 1 da ides do meni-a.") TextWindow.WriteLine("Unesi 2 da izadjes iz kviza.") opcije30 = TextWindow.ReadNumber() If opcije30 = "1" Then TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "black" TextWindow.Clear() TextWindow.ForegroundColor = "yellow" TextWindow.BackgroundColor = "red" Goto pocetak ElseIf opcije30 = "2" then Program.End() Else TextWindow.ForegroundColor = "red" TextWindow.WriteLine("Greska:Moguce opcije su 1 i 2 !") TextWindow.ForegroundColor = "blue" TextWindow.Pause() TextWindow.Clear() TextWindow.BackgroundColor = "red" TextWindow.ForegroundColor = "yellow" Goto kraj2 EndIf '======================================================================================================================== End>RZM182.sb< Start>RZM991.sb< GraphicsWindow.Title ="Rainfall Screen GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.PenWidth =0 GraphicsWindow.BrushColor ="#dd00ffff LDPhysics.SetGravity (0 70) GraphicsWindow.Width=450 sc[2]=".ooo..oo...oo...oo...o..oooo... sc[3]="o....o..o.o..o.o..o..o..o...... sc[4]="o.oo.o..o.o....o.....o..ooo.... sc[5]="o..o.o..o.o....o.....o..o...... sc[6]="o..o.o..o.o..o.o..o..o..o...... sc[7]=".ooo..oo...oo...oo...o..oooo... sc[8]="............................. sc[9]=".o.....o.......o.o....o....o. sc[10]="....o....o..o.....o....o.o.o. sc[1]=".............................. For i=1 To 10 For j=1 To 30 If Text.GetSubText (sc[11-i] j 1) ="o" Then v=100 Else v=0 endif ll[i][j]=v EndFor EndFor While "true If t<80 and Math.Remainder (t 9)=0 then gcce() EndIf LDPhysics.DoTimestep () Program.Delay (30) t=t+1 If t>100 and Math.Remainder (t 9)=0 Then GraphicsWindow.Height=270 For f=1 To 30 i=c+f sh=("Ellipse"+i) LDPhysics.SetVelocity (sh 0 30) LDPhysics.SetPosition (sh f*15 10 0) Shapes.SetOpacity (sh ll[c/30+1][f]) EndFor c=math.Remainder (c+30 300) If c=0 then For r=0 To 70 LDPhysics.DoTimestep () Program.Delay (30) EndFor endif EndIf endwhile Sub gcce For i=1 To 30 ss=Shapes.AddEllipse (9 9) LDShapes.AnimateZoom (ss 2000 0 1.3 1.3) Program.Delay (Math.GetRandomNumber (70)) Shapes.Move (ss i*15 10) LDPhysics.AddMovingShape (ss 0 0 1) LDPhysics.SetVelocity (sh 0 30) EndFor EndSub End>RZM991.sb< Start>RZQ456.sb< '================================================== 'Setup window and events '================================================== nball = 10 radius = 20 gw = (nball+1)*4*radius gh = 500 GraphicsWindow.BackgroundColor = "LightBlue" GraphicsWindow.Width = gw GraphicsWindow.Height = gh startButton = Controls.AddButton("START",10,10) pauseButton = Controls.AddButton("PAUSE/RESUME",80,10) colourButton = Controls.AddButton("CHANGE COLOUR",210,10) Controls.ButtonClicked = OnButtonClicked '================================================== 'Main game loop '================================================== While ("True") If (nactive = 0) Then EndIf If (startFlag = 1) Then initialise() EndIf If (colourFlag = 1) Then changeColour() EndIf detectHit() If (runFlag = 1) Then For i = 1 To nball xVel[i] = xVel[i]+xAcc[i] yVel[i] = yVel[i]+yAcc[i] xPos[i] = xPos[i]+xVel[i] yPos[i] = yPos[i]+yVel[i] 'Bounce on bottom If (yPos[i] > gh-radius) Then yPos[i] = 2*(gh-radius)-yPos[i] yVel[i] = -yVel[i] EndIf 'Bounce on sides If (xPos[i] < radius) Then xPos[i] = 2*(radius)-xPos[i] xVel[i] = -xVel[i] EndIf If (xPos[i] > gw-radius) Then xPos[i] = 2*(gw-radius)-xPos[i] xVel[i] = -xVel[i] EndIf Shapes.Move(ball[i],xPos[i]-radius,yPos[i]-radius) EndFor updateTime() EndIf Program.Delay(20) EndWhile '================================================== 'Subroutines '================================================== Sub initialise startFlag = 0 runFlag = 1 colourFlag = 0 nactive = nball GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() For i = 1 To nball xPos[i] = i*4*radius yPos[i] = 80 xVel[i] = (Math.GetRandomNumber(201)-101)/40 yVel[i] = 0 xAcc[i] = 0 yAcc[i] = 1 active[i] = 1 Shapes.Remove(ball[i]) ball[i] = Shapes.AddEllipse(2*radius,2*radius) Shapes.Move(ball[i],xPos[i]-radius,yPos[i]-radius) EndFor startTime = Clock.ElapsedMilliseconds EndSub Sub changeColour GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() For i = 1 To nball If (active[i] = 1) Then Shapes.Remove(ball[i]) ball[i] = Shapes.AddEllipse(2*radius,2*radius) Shapes.Move(ball[i],xPos[i]-radius,yPos[i]-radius) EndIf EndFor colourFlag = 0 EndSub Sub detectHit xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY For i = 1 To nball If (active[i] = 1) Then dist = (xM-xPos[i])*(xM-xPos[i]) + (yM-yPos[i])*(yM-yPos[i]) If (dist < radius*radius) Then Shapes.HideShape(ball[i]) active[i] = 0 nactive = nactive-1 Sound.PlayClick() EndIf EndIf EndFor EndSub Sub updateTime elapsed = 0.1*Math.Floor(0.5+(Clock.ElapsedMilliseconds-startTime)/100) GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(gw-80,0,100,30) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(gw-80,10,elapsed) EndSub '================================================== 'Event Subroutines '================================================== Sub OnButtonClicked If (Controls.LastClickedButton = startButton) Then startFlag = 1 ElseIf (Controls.LastClickedButton = pauseButton) Then runFlag = 1-runFlag If (runFlag = 0) Then pauseTime = Clock.ElapsedMilliseconds-startTime Else startTime = Clock.ElapsedMilliseconds-pauseTime EndIf ElseIf (Controls.LastClickedButton = colourButton) Then colourFlag = 1 EndIf EndSub End>RZQ456.sb< Start>RZQ745.sb< GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp GW = 600 GraphicsWindow.Width = GW GraphicsWindow.Height = GW TextWindow.Left=900 ProgramDirectory=Program.Directory GraphicsWindow.PenColor="Black" GraphicsWindow.BrushColor="Green" For i = 1 to 5 BlockHeight[i]=Math.GetRandomNumber(195)+50 BlockWidth[i]=Math.GetRandomNumber(195)+50 Block[i]=Shapes.AddRectangle(BlockWidth[i],BlockHeight[i]) Shapes.Move(Block[i],Math.GetRandomNumber(GW),Math.GetRandomNumber(GW)+50) BlockX[i] = shapes.GetLeft(Block[i]) BlockY[i] = shapes.GetTop(Block[i]) endfor GraphicsWindow.BrushColor="LightBlue" Player[1]=Shapes.AddRectangle(20,20) PlayerRagdoll[1]=Shapes.AddRectangle(20,20) GraphicsWindow.BrushColor="Red" Player[2]=Shapes.AddRectangle(20,20) PlayerRagdoll[2]=Shapes.AddRectangle(20,20) Shapes.Move(Player[2],500,0) GraphicsWindow.PenWidth=10 GraphicsWindow.PenColor="LightGreen" PlayerHPBar[1]=Shapes.AddLine(0,0,60,0) PlayerHPBar[2]=Shapes.AddLine(0,0,60,0) GraphicsWindow.PenColor="Black" Restart() Sub Restart RightShift=0 Left=0 Right=0 Up=0 Shot[1] = 0 HPPlayer[1]=100 LeftShift=0 A=0 D=0 W=0 Enemy="Human" bp = 5 bp2 = 5 BulletXMain[1] = 1 BulletXMain[2] = 1 endsub While "True" For i = Array.GetItemCount(Bullet)-5 To Array.GetItemCount(Bullet) Shapes.Move(Bullet[i],shapes.GetLeft(Bullet[i])+BulletX[i], Shapes.GetTop(Bullet[i])+BulletY[i]) Shapes.Remove(Bullet[Array.GetItemCount(Bullet)-5]) If Shapes.GetLeft(Bullet[i])>GW or Shapes.GetLeft(Bullet[i])<0 then Shapes.Remove(Bullet[i]) endif If Shapes.GetLeft(Bullet[i]) >= PlayerX[2] And Shapes.GetLeft(Bullet[i]) <= PlayerX[2]+20 And Shapes.GetTop(Bullet[i]) >= PlayerY[2] And Shapes.GetTop(Bullet[i]) <= PlayerY[2]+20 Then TextWindow.WriteLine("HIT") HPPlayer[2] = HPPlayer[2]-10 Shapes.Remove(Bullet[i]) endif endfor For i = 1 To 2 Shapes.Zoom(PlayerHPBar[i],HPPlayer[i]/100,1) If HPPlayer[i] < 1 Then Shapes.Move(PlayerRagdoll[i],PlayerX[i],PlayerY[i]) PlayerRagdollWX[i] = PlayerWX[i] PlayerRagdollWY[i] = PlayerWY[i] Shapes.Move(Player[i],20,20) HPPlayer[i]=100 endif If playerWY[i]<1.1 Then playerWY[i]=PlayerWY[i]+0.005 endif PlayerX[i] = shapes.GetLeft(Player[i]) PlayerY[i] = shapes.GetTop(Player[i]) If PlayerTG[i] = "True" Then PlayerWX[i] = PlayerWX[i] * 0.972 If Right[i]=1 And PlayerWX[i]<0.4 Then PlayerWX[i] = PlayerWX[i] + 0.03 elseif Left[i] = 1 And PlayerWX[i]>-0.4 then PlayerWX[i] = PlayerWX[i] - 0.03 endif Else PlayerWX[i] = PlayerWX[i] * 0.999 If Right[i]=1 And PlayerWX[i]<0.4 Then PlayerWX[i] = PlayerWX[i] + 0.01 elseif Left[i] = 1 And PlayerWX[i]>-0.4 then PlayerWX[i] = PlayerWX[i] - 0.001 endif endif If Left[i] = 1 Then BulletXMain[i] = -1 endif If Right[i] = 1 then BulletXMain[i] = 1 endif Boundaries() Collision() Shapes.Move(PlayerRagdoll[i],Shapes.GetLeft(PlayerRagdoll[i])+PlayerRagdollWX[i],Shapes.GetTop(PlayerRagdoll[i])+PlayerRagdollWY[i]) Shapes.Move(PlayerHPBar[i],PlayerX[i]-20,PlayerY[i]-10) PlayerRagdollWX[i] = PlayerRagdollWX[i] * 0.999 If PlayerRagdollWY[i]<1.1 Then PlayerRagdollWY[i]=PlayerRagdollWY[i]+0.005 endif If hpold[i]<>HPPlayer[i] then Shapes.Remove(PlayerHPBar[i]) GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(200,HPPlayer[i]*2.5,0) PlayerHPBar[i]=Shapes.AddLine(0,0,60,0) endif hpold[i]=HPPlayer[i] endfor If Enemy = "CPU" Then AI() endif For i = 1 To 2 Shapes.Move(Player[i],PlayerX[i]+PlayerWX[i],PlayerY[i]+PlayerWY[i]) TextWindow.WriteLine(PlayerTG[i]) endfor Program.Delay(1) TextWindow.Clear() Endwhile '=======================ON KEY DOWN============================= Sub OnKeyDown Key = GraphicsWindow.LastKey If (Key = "Left") Then Left[1] = 1 ElseIf (Key = "Right") Then Right[1] = 1 ElseIf (Key = "Up") Then Up[1] = 1 ElseIf (Key = "Down") Then Down[1] = 1 ElseIf (Key = "RightShift") Then Shift[1] = 1 ElseIf (Key = "RightCtrl" and Shot[1] = 0) Then BulletShot() ElseIf (Key = "A") Then Left[2] = 1 ElseIf (Key = "D") Then Right[2] = 1 ElseIf (Key = "W") Then Up[2] = 1 ElseIf (Key = "LeftShift") Then Shift[2] = 1 ElseIf (Key = "LeftCtrl") and Shot[2] = 0 Then BulletShot2() EndIf EndSub '=======================ON KEY UP================================ Sub OnKeyUp Key = GraphicsWindow.LastKey If (Key = "Left") Then Left[1] = 0 ElseIf (Key = "Right") Then Right[1] = 0 ElseIf (Key = "Up") Then Up[1] = 0 ElseIf (Key = "Down") Then Down[1] = 0 ElseIf (Key = "RightShift") Then Shift[1] = 0 ElseIf (Key = "RightCtrl") Then Shot[1] = 0 ElseIf (Key = "A") Then Left[2] = 0 ElseIf (Key = "D") Then Right[2] = 0 ElseIf (Key = "W") Then Up[2] = 0 ElseIf (Key = "LeftShift") Then Shift[2] = 0 ElseIf (Key = "LeftCtrl") Then Shot[2] = 0 endif EndSub '=======================COLLISION================================ Sub Collision For n = 1 To 5 IF PlayerY[i]+20 >= BlockY[n] and PlayerY[i] <= BlockY[n]+BlockHeight[n] then If PlayerX[i]+20 > BlockX[n] and PlayerX[i]+20 < BlockX[n]+1 then playerWX[i] = -0.01 elseif PlayerX[i] < BlockX[n]+BlockWidth[n] and PlayerX[i] > BlockX[n]-1 then playerWX[i] = 0.01 endif ELSEIF PlayerX[i]+20 >= BlockX[n] and PlayerX[i] <= BlockX[n]+BlockWidth[n] then If PlayerY[i]+21 > BlockY[n] and PlayerY[i] < BlockY[n]+1 then if Shift[i] = 1 then playerWY[i] = -1 else playerWY[i] = 0 PlayerTG[i] = "True" endif Elseif PlayerY[i]-1 < BlockY[n]+BlockHeight[n] and PlayerY[i] > BlockY[n]+BlockHeight[n]-1 then playerWY[i] = 0.01 Else endif ELSE PlayerTG[i] = "False" ENDIF EndFor endsub '=======BOUNDARIES========= sub Boundaries If PlayerY[i]<0 Then playerY[i] = 1 ElseIf PlayerY[i]>GW-20 then PlayerY[i] = 0 endif If PlayerX[i]<0 Then playerWX[i] = 0.01 ElseIf PlayerX[i] > GW-20 then playerWX[i] = -0.01 endif endsub '==================SUB BULLETSHOT======================== Sub Bulletshot GraphicsWindow.PenColor="Black" b=b+1 Bullet[b]=Shapes.AddRectangle(5,5) Shapes.Move(Bullet[b],playerX[1]+8,PlayerY[1]+bp) '7 BulletX[b] = BulletXMain[1]*5 If Up[1] = 1 Then BulletY[b] = -5 If Right[1] = 0 And Left[1] = 0 then BulletX[b] = 0 endif ElseIf Down[1] = 1 then BulletY[b] = 5 If Right[1] = 0 And Left[1] = 0 then BulletX[b] = 0 endif elseif Down[1] = 0 and Up[1] = 0 then BulletY[b] = 0 endif If bp > 11 then bp = 0 endif bp = bp+4 Shot[1] = 1 endsub Sub Bulletshot2 endsub Sub AI If PlayerX[2] < PlayerX[1]-25 Then If PlayerTG[2] = "True" then If PlayerWX[2]<0.4 Then PlayerWX[2] = PlayerWX[2] + 0.03 endif ElseIf PlayerTG[2] = "False" then if PlayerWX[2]>0.25 then PlayerWX[2] = PlayerWX[2] + 0.001 endif endif ElseIf PlayerX[2]-25 > PlayerX[1] Then If PlayerTG[2] = "True" then If PlayerWX[2]>-0.4 Then PlayerWX[2] = PlayerWX[2] - 0.03 endif elseIf PlayerTG[2] = "False" then if PlayerWX[2]>-0.25 then PlayerWX[2] = PlayerWX[2] - 0.001 endif endif endif if PlayerTG[2] = "True" then If PlayerY[1]+50 < PlayerY[2] Then PlayerWY[2] = -1 Else PlayerWY[2] = 0 endif endif EndSub If i > 2 then Shapes.Move(Block[i],400,300) 'Shapes.Move(Block[i],Math.GetRandomNumber(GW),Math.GetRandomNumber(GW)+50) 'Shapes.Move(Block[i],400,300) else Shapes.Move(Block[i],0,300) 'Shapes.Move(Block[i],Math.GetRandomNumber(GW),Math.GetRandomNumber(GW)+50) Shapes.Move(Block[i],0,300) 'Shapes.Move(Block[i],Math.GetRandomNumber(GW),Math.GetRandomNumber(GW)+50) endif End>RZQ745.sb< Start>RZR554.sb< ' mahreen miangul ' JanUary 2017 ' Turtle Writing miangul GraphicsWindow.Width = 1444 GraphicsWindow.Height = 555 GraphicsWindow.BackgroundColor = "snow" Turtle.Show() Turtle.Speed = 8 GraphicsWindow.PenWidth = 8 GraphicsWindow.penColor = "firebrick" ' repos for M Turtle.X = turtle.x+-250 Turtle.Y = turtle.y+10 Turtle.Move(150) ' M Turtle.Angle = 150 Turtle.Move(170) turtle.Angle = 10 turtle.Move(160) turtle.Angle = 150 turtle.Move(160) GraphicsWindow.penColor = "magenta" ' repos for U Turtle.X = turtle.x+80 Turtle.Y = turtle.y-100 Turtle.PenDown() 'U Turtle.Angle = 180 Turtle.Move(60) Turtle.Angle = 90 Turtle.Move(60) Turtle.Angle = 0 Turtle.Move(60) Turtle.PenUp() Turtle.Angle = 90 Turtle.Move(40) turtle.angle = -190 GraphicsWindow.penColor = "teal" ' repos for S Turtle.X= turtle.x+40 Turtle.y= Turtle.y+50 Turtle.Pendown() ' S Turtle.Turn(-35) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(5) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(5) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) GraphicsWindow.penColor = "teal" 'repos for S Turtle.X= turtle.x+80 Turtle.y= Turtle.y+30 Turtle.Pendown() ' S Turtle.Turn(-35) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(5) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(-45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(5) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) Turtle.Turn(45) Turtle.Move(10) GraphicsWindow.penColor = "royalblue" 'repos for A Turtle.X= turtle.x+80 Turtle.y= Turtle.y+0 Turtle.PenUp() Turtle.Angle = -180 Turtle.move(80) Turtle.pendown() ' A turtle.Angle = 10 turtle.Move(160) turtle.Angle = 150 turtle.Move(160) Turtle.Angle = -750 Turtle.Move(70) Turtle.Angle = -100 Turtle.Move(70) turtle.penup() Turtle.Angle = 90 turtle.Move(150) GraphicsWindow.penColor = "firebrick" ' repos for M Turtle.X = turtle.x-420 Turtle.Y = turtle.y+250 Turtle.PenDown() ' M Turtle.Angle =-0 Turtle.Move(150) Turtle.Angle = 150 Turtle.Move(170) turtle.Angle = 10 turtle.Move(160) turtle.Angle = 150 turtle.Move(160) Turtle.PenUp() GraphicsWindow.penColor = "teal" ' A Turtle.X = turtle.x+40 Turtle.Y = turtle.y+5 Turtle.pendown() turtle.Angle = 10 turtle.Move(160) turtle.Angle = 150 turtle.Move(160) Turtle.Angle = -750 Turtle.Move(70) Turtle.Angle = -100 Turtle.Move(70) turtle.penup() Turtle.Angle = 90 turtle.Move(120) Turtle.Angle = 120 turtle.Move(80) GraphicsWindow.penColor = "yellowgreen" ' I Turtle.X = turtle.x+10 Turtle.Y = turtle.y+0 Turtle.PenDown() Turtle.Angle = 0 Turtle.Move(150) GraphicsWindow.penColor = "greenyellow" ' repos for N Turtle.X= turtle.x+80 Turtle.y= Turtle.y+150 Turtle.Move(150) ' N Turtle.Angle = 150 Turtle.Move(170) turtle.Angle = 10 turtle.Move(160) Turtle.X= Turtle.x+40 Turtle.y= Turtle.y+140 GraphicsWindow.penColor = "royalblue" ' repos for A Turtle.X = turtle.x+15 Turtle.Y = turtle.y+5 Turtle.pendown() ' A turtle.Angle = 10 turtle.Move(160) turtle.Angle = 150 turtle.Move(160) Turtle.Angle = -750 Turtle.Move(70) Turtle.Angle = -100 Turtle.Move(70) turtle.penup() End>RZR554.sb< Start>RZR742-0.sb< ' Teams teams[1]["name"] = "Hannover 96" teams[1]["abwehr"] = 70 teams[1]["mittelfeld"] = 80 teams[1]["sturm"] = 80 teams[1]["id"] = 1 teams[1]["punkte"] = 0 teams[1]["tore"] = 0 teams[1]["gegentore"] = 0 teams[2]["name"] = "Eintracht Braunschweig" teams[2]["abwehr"] = 60 teams[2]["mittelfeld"] = 60 teams[2]["sturm"] = 60 teams[2]["id"] = 2 teams[2]["punkte"] = 0 teams[2]["tore"] = 0 teams[2]["gegentore"] = 0 teams[3]["name"] = "Bayern München" teams[3]["abwehr"] = 80 teams[3]["mittelfeld"] = 90 teams[3]["sturm"] = 90 teams[3]["id"] = 3 teams[3]["punkte"] = 0 teams[3]["tore"] = 0 teams[3]["gegentore"] = 0 teams[4]["name"] = "Werder Bremen" teams[4]["abwehr"] = 80 teams[4]["mittelfeld"] = 80 teams[4]["sturm"] = 85 teams[4]["id"] = 4 teams[4]["punkte"] = 0 teams[4]["tore"] = 0 teams[4]["gegentore"] = 0 ' Spiele spiele[1]["heimTeam"] = teams[1] spiele[1]["gastTeam"] = teams[2] spiele[2]["heimTeam"] = teams[3] spiele[2]["gastTeam"] = teams[4] ' spiele[3]["heimTeam"] = teams[4] spiele[3]["gastTeam"] = teams[1] spiele[4]["heimTeam"] = teams[2] spiele[4]["gastTeam"] = teams[3] ' spiele[5]["heimTeam"] = teams[1] spiele[5]["gastTeam"] = teams[3] spiele[6]["heimTeam"] = teams[2] spiele[6]["gastTeam"] = teams[4] ' Spieltage 'spieltage[1][1] = spiele[1] 'spieltage[1][2] = spiele[2] 'spieltage[2][1] = spiele[3] 'spieltage[2][2] = spiele[4] 'spieltage[3][1] = spiele[5] 'spieltage[3][2] = spiele[6] 'Saison 'saison2009[1] = spieltage[1] 'saison2009[2] = spieltage[2] 'saison2009[3] = spieltage[3] ' Liga 'bundesliga[1] = teams[1] 'bundesliga[2] = teams[2] 'bundesliga[3] = teams[3] 'bundesliga[4] = teams[4] grafik[0] = 28 grafik[1] = 110 grafik[2] = 220 grafik[3] = 320 grafik[4] = 440 grafik[5] = 540 grafik[6] = 640 grafik[7] = 730 gameplaying = 0 main() Sub main init() GraphicsWindow.KeyDown = onKeyDown 'GraphicsWindow.Show() showMenu() Endsub Sub showMenu auswahl = 0 While (auswahl <> 9) TextWindow.Clear() TextWindow.Show() TextWindow.WriteLine("1: Naechstes Spiel") TextWindow.WriteLine("2: Spielplan") TextWindow.WriteLine("3: Tabelle") TextWindow.WriteLine("9: Ende") auswahl = TextWindow.ReadNumber() TextWindow.Clear() If (auswahl = 1) then schonGespielt = 0 For z = 1 to Array.GetItemCount(spiele) If (spiele[z]["gespielt"] <> 1) then If (schonGespielt = 0) then spiel = spiele[z] playGame() spiele[z] = spiel teams[spiel["heimTeam"]["id"]] = spiel["heimTeam"] teams[spiel["gastTeam"]["id"]] = spiel["gastTeam"] schonGespielt = 1 Endif Endif EndFor ElseIf (auswahl = 2) then showSpielplan() ElseIf (auswahl = 3) then showTable() EndIf EndWhile EndSub Sub showSpielplan For m = 1 to Array.GetItemCount(spiele) TextWindow.WriteLine(m + ". Spiel " + spiele[m]["heimTeam"]["name"] + " - " + spiele[m]["gastTeam"]["name"] + " " + spiele[m]["htore"] + ":" + spiele[m]["gtore"]) EndFor TextWindow.Pause() Endsub Sub showTable table = teams size = Array.GetItemCount(table) swapped = 0 'For i = 1 to size-1 'If (teams[i] 'EndFor For i = 1 to Array.GetItemCount(teams) TextWindow.WriteLine(i + ". " + teams[i]["name"] + " " + teams[i]["punkte"] + " " + teams[i]["tore"] + ":" + teams[i]["gegentore"]) EndFor TextWindow.Pause() Endsub Sub onKeyDown 'GraphicsWindow.ShowMessage(GraphicsWindow.LastKey, "") If (gameplaying = 0) Then gameplaying = 1 spiel = spiele[1] playGame() EndIf Endsub Sub init GraphicsWindow.Width = 1024 GraphicsWindow.Height= 510 imgSpielfeld = ImageList.LoadImage(Program.Directory + "\Spielfeld.PNG") GraphicsWindow.DrawResizedImage(imgSpielfeld, 0, 0, 800, 510) GraphicsWindow.Show() Endsub ' Führt ein Spiel aus und zeigt es im Grafikmodus. ' Input: Spiel[] Das Spiel, das gespielt werden soll 'Output: Spiel[] Das mit den Spieldaten aktualisierte Spiel Sub playGame GraphicsWindow.Clear() GraphicsWindow.DrawResizedImage(imgSpielfeld, 0, 0, 800, 510) imgFussball = ImageList.LoadImage(Program.Directory + "\Fussball.PNG") shapeFussball = Shapes.AddImage(imgFussball) Shapes.Move(shapeFussball, 380, 240) 'TextWindow.WriteLine("Es geht los!") spiel["hTore"] = 0 spiel["gTore"] = 0 spielposition = 4 spielpositionNeu = 4 For i = 1 To 5 calcAction() spielposition = spielposition + spielpositionNeu Shapes.Animate(shapeFussball, grafik[spielposition], 240, 1000) If (spielposition > 6) Then spiel["hTore"] = spiel["hTore"] + 1 spielposition = 3 Program.Delay(3000) Shapes.move(shapeFussball, 380, 240) ElseIf (spielposition < 1) Then spiel["gTore"] = spiel["gTore"] + 1 spielposition = 4 Program.Delay(3000) Shapes.Move(shapeFussball, 380, 240) EndIf GraphicsWindow.FontSize = 20 GraphicsWindow.FontName = "Verdana" GraphicsWindow.BrushColor = "#00AE00" GraphicsWindow.FillRectangle(365, 50, 20, 20) GraphicsWindow.FillRectangle(410, 50, 20, 20) GraphicsWindow.FillRectangle(380, 480, 50, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(180, 50, spiel["heimTeam"]["name"]) GraphicsWindow.DrawText(450, 50, spiel["gastTeam"]["name"]) GraphicsWindow.DrawText(365, 50, spiel["hTore"]) GraphicsWindow.DrawText(410, 50, spiel["gTore"]) GraphicsWindow.DrawText(380, 480, i + ".min") Program.Delay(1000) EndFor spiel["heimTeam"]["tore"] = spiel["heimTeam"]["tore"] + spiel["hTore"] spiel["heimTeam"]["gegentore"] = spiel["heimTeam"]["gegentore"] + spiel["gTore"] spiel["gastTeam"]["tore"] = spiel["gastTeam"]["tore"] + spiel["gTore"] spiel["gastTeam"]["gegentore"] = spiel["gastTeam"]["gegentore"] + spiel["hTore"] spiel["gespielt"] = 1 If (spiel["hTore"] > spiel["gTore"]) Then spiel["heimTeam"]["punkte"] = spiel["heimTeam"]["punkte"] + 3 ElseIf (spiel["hTore"] < spiel["gTore"]) Then spiel["gastTeam"]["punkte"] = spiel["gastTeam"]["punkte"] + 3 ElseIf (spiel["hTore"] = spiel["gTore"]) Then spiel["heimTeam"]["punkte"] = spiel["heimTeam"]["punkte"] + 1 spiel["gastTeam"]["punkte"] = spiel["gastTeam"]["punkte"] + 1 EndIf Endsub Sub calcAction If (spielposition = 1 Or spielposition = 2) Then random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["abwehr"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["sturm"] ElseIf (spielposition = 3 Or spielposition = 4) Then random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["mittelfeld"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["mittelfeld"] Else random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["sturm"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["abwehr"] EndIf ' Heimvorteil, bei gleicher Zahl, Fortschritt Heim If (random1 >= random2) Then spielpositionNeu = 1 Else spielpositionNeu = -1 EndIf GraphicsWindow.BrushColor = "#00AE00" GraphicsWindow.FillRectangle(280, 480, 50, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(280, 480, random1 - random2) EndSub End>RZR742-0.sb< Start>RZR742.sb< ' Teams teams[1]["name"] = "Hannover 96" teams[1]["abwehr"] = 70 teams[1]["mittelfeld"] = 80 teams[1]["sturm"] = 80 teams[1]["id"] = 1 teams[1]["punkte"] = 0 teams[1]["tore"] = 0 teams[1]["gegentore"] = 0 teams[2]["name"] = "Eintracht Braunschweig" teams[2]["abwehr"] = 60 teams[2]["mittelfeld"] = 60 teams[2]["sturm"] = 60 teams[2]["id"] = 2 teams[2]["punkte"] = 0 teams[2]["tore"] = 0 teams[2]["gegentore"] = 0 teams[3]["name"] = "Bayern München" teams[3]["abwehr"] = 80 teams[3]["mittelfeld"] = 90 teams[3]["sturm"] = 90 teams[3]["id"] = 3 teams[3]["punkte"] = 0 teams[3]["tore"] = 0 teams[3]["gegentore"] = 0 teams[4]["name"] = "Werder Bremen" teams[4]["abwehr"] = 80 teams[4]["mittelfeld"] = 80 teams[4]["sturm"] = 85 teams[4]["id"] = 4 teams[4]["punkte"] = 0 teams[4]["tore"] = 0 teams[4]["gegentore"] = 0 ' Spiele spiele[1]["heimTeam"] = teams[1] spiele[1]["gastTeam"] = teams[2] spiele[2]["heimTeam"] = teams[3] spiele[2]["gastTeam"] = teams[4] ' spiele[3]["heimTeam"] = teams[4] spiele[3]["gastTeam"] = teams[1] spiele[4]["heimTeam"] = teams[2] spiele[4]["gastTeam"] = teams[3] ' spiele[5]["heimTeam"] = teams[1] spiele[5]["gastTeam"] = teams[3] spiele[6]["heimTeam"] = teams[2] spiele[6]["gastTeam"] = teams[4] ' Spieltage 'spieltage[1][1] = spiele[1] 'spieltage[1][2] = spiele[2] 'spieltage[2][1] = spiele[3] 'spieltage[2][2] = spiele[4] 'spieltage[3][1] = spiele[5] 'spieltage[3][2] = spiele[6] 'Saison 'saison2009[1] = spieltage[1] 'saison2009[2] = spieltage[2] 'saison2009[3] = spieltage[3] ' Liga 'bundesliga[1] = teams[1] 'bundesliga[2] = teams[2] 'bundesliga[3] = teams[3] 'bundesliga[4] = teams[4] grafik[0] = 28 grafik[1] = 110 grafik[2] = 220 grafik[3] = 320 grafik[4] = 440 grafik[5] = 540 grafik[6] = 640 grafik[7] = 730 main() Sub main init() GraphicsWindow.KeyDown = onKeyDown GraphicsWindow.Show() 'showMenu() Endsub Sub showMenu auswahl = 0 While (auswahl <> 9) TextWindow.Clear() TextWindow.Show() TextWindow.WriteLine("1: Naechstes Spiel") TextWindow.WriteLine("2: Spielplan") TextWindow.WriteLine("3: Tabelle") TextWindow.WriteLine("9: Ende") auswahl = TextWindow.ReadNumber() TextWindow.Clear() If (auswahl = 1) then schonGespielt = 0 For z = 1 to Array.GetItemCount(spiele) If (spiele[z]["gespielt"] <> 1) then If (schonGespielt = 0) then spiel = spiele[z] playGame() spiele[z] = spiel teams[spiel["heimTeam"]["id"]] = spiel["heimTeam"] teams[spiel["gastTeam"]["id"]] = spiel["gastTeam"] schonGespielt = 1 Endif Endif EndFor ElseIf (auswahl = 2) then showSpielplan() ElseIf (auswahl = 3) then showTable() EndIf EndWhile EndSub Sub showSpielplan For m = 1 to Array.GetItemCount(spiele) TextWindow.WriteLine(m + ". Spiel " + spiele[m]["heimTeam"]["name"] + " - " + spiele[m]["gastTeam"]["name"] + " " + spiele[m]["htore"] + ":" + spiele[m]["gtore"]) EndFor TextWindow.Pause() Endsub Sub showTable table = teams size = Array.GetItemCount(table) swapped = 0 'For i = 1 to size-1 'If (teams[i] 'EndFor For i = 1 to Array.GetItemCount(teams) TextWindow.WriteLine(i + ". " + teams[i]["name"] + " " + teams[i]["punkte"] + " " + teams[i]["tore"] + ":" + teams[i]["gegentore"]) EndFor TextWindow.Pause() Endsub Sub onKeyDown 'GraphicsWindow.ShowMessage(GraphicsWindow.LastKey, "") spiel = spiele[1] playGame() Endsub Sub init GraphicsWindow.Width = 1024 GraphicsWindow.Height= 510 imgSpielfeld = ImageList.LoadImage(Program.Directory + "\Spielfeld.PNG") GraphicsWindow.DrawResizedImage(imgSpielfeld, 0, 0, 800, 510) GraphicsWindow.Show() Endsub ' Führt ein Spiel aus und zeigt es im Grafikmodus. ' Input: Spiel[] Das Spiel, das gespielt werden soll 'Output: Spiel[] Das mit den Spieldaten aktualisierte Spiel Sub playGame GraphicsWindow.Clear() GraphicsWindow.DrawResizedImage(imgSpielfeld, 0, 0, 800, 510) imgFussball = ImageList.LoadImage(Program.Directory + "\Fussball.PNG") shapeFussball = Shapes.AddImage(imgFussball) Shapes.Move(shapeFussball, 380, 240) 'TextWindow.WriteLine("Es geht los!") spiel["hTore"] = 0 spiel["gTore"] = 0 spielposition = 4 spielpositionNeu = 4 For i = 1 To 5 calcAction() spielposition = spielposition + spielpositionNeu Shapes.Animate(shapeFussball, grafik[spielposition], 240, 1000) If (spielposition > 6) Then spiel["hTore"] = spiel["hTore"] + 1 spielposition = 3 Program.Delay(3000) Shapes.move(shapeFussball, 380, 240) ElseIf (spielposition < 1) Then spiel["gTore"] = spiel["gTore"] + 1 spielposition = 4 Program.Delay(3000) Shapes.Move(shapeFussball, 380, 240) EndIf GraphicsWindow.FontSize = 20 GraphicsWindow.FontName = "Verdana" GraphicsWindow.BrushColor = "#00AE00" GraphicsWindow.FillRectangle(365, 50, 20, 20) GraphicsWindow.FillRectangle(410, 50, 20, 20) GraphicsWindow.FillRectangle(380, 480, 50, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(180, 50, spiel["heimTeam"]["name"]) GraphicsWindow.DrawText(450, 50, spiel["gastTeam"]["name"]) GraphicsWindow.DrawText(365, 50, spiel["hTore"]) GraphicsWindow.DrawText(410, 50, spiel["gTore"]) GraphicsWindow.DrawText(380, 480, i + ".min") Program.Delay(1000) EndFor spiel["heimTeam"]["tore"] = spiel["heimTeam"]["tore"] + spiel["hTore"] spiel["heimTeam"]["gegentore"] = spiel["heimTeam"]["gegentore"] + spiel["gTore"] spiel["gastTeam"]["tore"] = spiel["gastTeam"]["tore"] + spiel["gTore"] spiel["gastTeam"]["gegentore"] = spiel["gastTeam"]["gegentore"] + spiel["hTore"] spiel["gespielt"] = 1 If (spiel["hTore"] > spiel["gTore"]) Then spiel["heimTeam"]["punkte"] = spiel["heimTeam"]["punkte"] + 3 ElseIf (spiel["hTore"] < spiel["gTore"]) Then spiel["gastTeam"]["punkte"] = spiel["gastTeam"]["punkte"] + 3 ElseIf (spiel["hTore"] = spiel["gTore"]) Then spiel["heimTeam"]["punkte"] = spiel["heimTeam"]["punkte"] + 1 spiel["gastTeam"]["punkte"] = spiel["gastTeam"]["punkte"] + 1 EndIf Endsub Sub calcAction If (spielposition = 1 Or spielposition = 2) Then random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["abwehr"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["sturm"] ElseIf (spielposition = 3 Or spielposition = 4) Then random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["mittelfeld"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["mittelfeld"] Else random1 = Math.GetRandomNumber(100) + spiel["heimTeam"]["sturm"] random2 = Math.GetRandomNumber(100) + spiel["gastTeam"]["abwehr"] EndIf ' Heimvorteil, bei gleicher Zahl, Fortschritt Heim If (random1 >= random2) Then spielpositionNeu = 1 Else spielpositionNeu = -1 EndIf GraphicsWindow.BrushColor = "#00AE00" GraphicsWindow.FillRectangle(280, 480, 50, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(280, 480, random1 - random2) EndSub End>RZR742.sb< Start>RZS268.sb< ' ' Game Controller Sample 3 ' 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 ' Move turtle with left stick. ' Speed = 2.5 Turtle.Speed = 10 GraphicsWindow.Show() GraphicsWindow.Title = "Game Controller Sample 3" Turtle.Show() While "True" 'Make sure controller is connected While GameController.IsConnected = "False" Dialogs.ShowMessageBox("Controller not found!","","","Error") EndWhile Dialogs.ShowMessageBox("Controller Found!","","","Information") While GameController.IsConnected GameController.UpdateValues() If GameController.LeftStickX = 0 And GameController.LeftStickY = 0 Then Else Turtle.Angle = MathPlus.GetDegrees(MathPlus.ATan2(-GameController.LeftStickX, GameController.LeftStickY)) - 90 Turtle.Move(Speed) EndIf CheckButtons() EndWhile Dialogs.ShowMessageBox("Lost Connection To Controller!","","","Error") EndWhile Sub CheckButtons If GameController.IsButtonDown("A") And OldAState = "False" Then OldAState = "True" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() EndIf If GameController.IsButtonDown("A") = "False" Then OldAState = "False" EndIf If GameController.IsButtonDown("X") And OldXState = "False" Then OldXState = "True" Turtle.PenUp() EndIf If GameController.IsButtonDown("X") = "False" Then OldXState = "False" EndIf If GameController.IsButtonDown("B") And OldBState = "False" Then OldBState = "True" Turtle.PenDown() EndIf If GameController.IsButtonDown("B") = "False" Then OldBState = "False" EndIf EndSub End>RZS268.sb< Start>RZT522.sb< GraphicsWindow.BackgroundColor="teal GraphicsWindow .Width=999 GraphicsWindow.Height =750 ii=ImageList.LoadImage ("c:\razno\plmm.png") GraphicsWindow.Title="PalmKeys f15=50 ddd() 'LDEvents.MouseWheel=mm LDShapes.ShapeEvent=see Sub mm f15=f15+ LDEvents.LastMouseWheelDelta*3 GraphicsWindow.Title =f15 ddd() EndSub Sub see ss= LDShapes.LastEventShape If LDShapes.LastEventType ="MouseDown" Then LDEffect.DropShaddow (ss "ShadowDepth=25") ElseIf LDShapes.LastEventType="MouseUp" then LDEffect.DropShaddow (ss "ShadowDepth=11") EndIf EndSub Sub ddd GraphicsWindow.Clear () For j=5 To 1 Step -1 For i=1 To 5 im=Shapes.AddImage (ii) shapes.move(im 85*(j+i)-60 60*i+220-j*f15) LDShapes.SetShapeEvent (im) LDEffect.DropShaddow (im "ShadowDepth=11") EndFor EndFor EndSub End>RZT522.sb< Start>RZV471.sb< GraphicsWindow.Title ="Waterjump GraphicsWindow.BackgroundColor="Darkblue GraphicsWindow.PenWidth=0 dw=800 dh=desktop.Height-40 GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 cx=dw/2 cy=dh/2 LDPhysics.Reset() p10=12 GraphicsWindow.BrushColor="lightblue" GraphicsWindow.FillRectangle(0,dh-20,dw,dh) s200=120 s150=200 dd=1 GraphicsWindow.FillRectangle (cx-10 dh-150 20 150) GraphicsWindow.FillEllipse (cx-100 dh-150 200 33) For n=1 To s200 water[n]=Shapes.AddEllipse(9,9) LDPhysics.AddMovingShape(water[n],0,0,2) LDPhysics.SetPosition(water[n],400,dh-140,0) LDPhysics.SetVelocity (water[n] dd*s150/3 ,-s150*2) LDPhysics.DoTimestep() Program.Delay(p10) dd=dd*-1 EndFor a=1 Timer.Interval=6000 Timer.Tick =ttt Sub ttt Timer.Interval=10000 inn="true EndSub While "true If inn Then dd=1 f2=math.GetRandomNumber (15)/10+.6 d5=5+Math.GetRandomNumber (20) For n=1 To s200 LDPhysics.SetVelocity (water[n] 0 0) LDPhysics.SetPosition(water[n],400,dh-140,0) LDPhysics.SetVelocity (water[n] dd*s150/3 ,-s150*f2) LDPhysics.DoTimestep() Program.Delay(p10) If Math.Remainder (n 10)=0 Then For r=1 To d5 Program.Delay (p10) LDPhysics.DoTimestep () endfor endif dd=dd*-1 EndFor inn="false else For n=1 To s200 aa=LDPhysics.GetPosition (water [n]) If aa[2]>dh-10 then LDPhysics.SetPosition (water [n] aa[1] dh-10 0) EndIf EndFor LDPhysics.DoTimestep() Program.Delay(p10) endif EndWhile End>RZV471.sb< Start>RZV694.sb< TH = 23 hh = Desktop.Height ww = Desktop.Width GraphicsWindow.Width = (ww - 10) GraphicsWindow.Height = (hh - 100) GraphicsWindow.CanResize = "False" Controls.LoadTheme("XPRoyale") W = Controls.AddWebBrowser(GraphicsWindow.Width, GraphicsWindow.Height-TH) Controls.Move(w, 0, 0) GraphicsWindow.Left=0 GraphicsWindow.Top=0 T = Controls.AddTextBox(GraphicsWindow.Width-125, TH, "") Controls.Move(t, 50, 0) SmallBasic.SetInterval("UpdateT", 500, -1) Controls.SetUrlOfWebBrowser(W, "google.com") CanUpdateT = "True" Sub UpdateT If Controls.IsFocused(t) Then CanUpdateT = "False" Else If CanUpdateT = "True" Then Controls.SetText(t, Controls.GetUrlOfWebBrowser(w)) Else CanUpdateT = "True" EndIf EndIf EndSub End>RZV694.sb< Start>RZX837.sb< Sigma = 10 Pigmus = 28 Beta = 8/3 'ρ=28, σ=10, β=8/3 'ρ = 28, σ = 10, and β = 8/3 x = 10 y = 0 z = 10 Magnificiation = 6 dt = 0.002 For Counter = 1 to 100000 dx = Sigma * (y - x) dy = x * (Pigmus - z) - y dz = x * y - Beta * z x = x + dx * dt y = y + dy * dt z = z + dz * dt Particle = Shapes.AddEllipse(2, 2) Particle1 = Shapes.AddEllipse(2, 2) Particle2 = Shapes.AddEllipse(2, 2) Shapes.Move(Particle, 150 + Magnificiation * y,300 - Magnificiation * z) 'Shapes.Move(Particle1, 400 + Magnificiation * x, 300 - Magnificiation * z) 'Shapes.Move(Particle2, 650 + Magnificiation * x, 150 - Magnificiation * y) EndFor End>RZX837.sb<