Advertisement
gnamp

Small Basic Syntax cheat sheet

Aug 20th, 2012
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. Array:
  2.  
  3. myArray[1] = "myString"
  4. TextWindow.WriteLine(Array.GetItemCount(myArray))
  5.  
  6. Directory:
  7.  
  8. File.CreateDirectory("C:\temp\myTempDir")
  9.  
  10. Ellipse:
  11.  
  12. GraphicsWindow.DrawEllipse(10, 15, 75, 25)
  13.  
  14. ' Or...
  15.  
  16. myEllipse = Shapes.AddEllipse(100, 50)
  17.  
  18. Flickr image:
  19.  
  20. GraphicsWindow.DrawImage(Flickr.GetPictureOfMoment(), 0, 0)
  21.  
  22. For statement:
  23.  
  24. For i = 1 To 10
  25. TextWindow.WriteLine(i)
  26. EndFor
  27.  
  28. If/Then statement:
  29.  
  30. If Clock.Year = 2010 Then
  31. TextWindow.WriteLine("2010")
  32. Else
  33. TextWindow.WriteLine("Not 2010")
  34. EndIf
  35.  
  36. Image:
  37.  
  38. myImage = Shapes.AddImage(ImageList.LoadImage("http://www.microsoft.com/about/images/home_blue.jpg"))
  39.  
  40. Label:
  41.  
  42. Goto myLabel
  43.  
  44. myLabel:
  45. TextWindow.WriteLine("Hello, World!")
  46.  
  47. Line:
  48.  
  49. GraphicsWindow.DrawLine(10, 20, 100, 50)
  50.  
  51. ' Or...
  52.  
  53. myLine = Shapes.AddLine(15, 20, 40, 65)
  54.  
  55. Rectangle:
  56.  
  57. GraphicsWindow.DrawRectangle(5, 15, 80, 35)
  58.  
  59. ' Or...
  60.  
  61. myRectangle = Shapes.AddRectangle(50, 35)
  62.  
  63. Shape:
  64.  
  65. myEllipse = Shapes.AddEllipse(100, 50)
  66.  
  67. Stack:
  68.  
  69. Stack.PushValue("myStack", "myValue")
  70. TextWindow.WriteLine(Stack.PopValue("myStack"))
  71.  
  72. Subroutine:
  73.  
  74. mySub()
  75.  
  76. Sub mySub
  77. TextWindow.WriteLine("Hello, World!")
  78. EndSub
  79.  
  80. Triangle:
  81.  
  82. GraphicsWindow.DrawTriangle(10, 15, 50, 100, 75, 25)
  83.  
  84. ' Or...
  85.  
  86. myTriangle = Shapes.AddTriangle(30, 10, 100, 75, 145, 35)
  87.  
  88. Access
  89.  
  90. Clock functions:
  91.  
  92. TextWindow.WriteLine(Clock.Date)
  93.  
  94. Desktop:
  95.  
  96. TextWindow.WriteLine(Desktop.Height)
  97.  
  98. Dictionary:
  99.  
  100. TextWindow.WriteLine(Dictionary.GetDefinition("banana"))
  101.  
  102. File functions:
  103.  
  104. TextWindow.WriteLine(File.GetTemporaryFilePath())
  105.  
  106. Graphics window:
  107.  
  108. GraphicsWindow.DrawBoundText(20, 10, 80, "Hello, World!")
  109.  
  110. Image:
  111.  
  112. GraphicsWindow.DrawImage(ImageList.LoadImage("http://www.microsoft.com/about/images/home_blue.jpg"), 0, 0)
  113.  
  114. Image list:
  115.  
  116. TextWindow.WriteLine(ImageList.GetHeightOfImage(ImageList.LoadImage("http://www.microsoft.com/about/images/home_blue.jpg")))
  117.  
  118. Math functions:
  119.  
  120. TextWindow.WriteLine(Math.SquareRoot(25))
  121.  
  122. Mouse:
  123.  
  124. GraphicsWindow.MouseDown = OnMouseDown
  125.  
  126. Sub OnMouseDown
  127. If Mouse.IsLeftButtonDown Then
  128. GraphicsWindow.Title = "Left button pressed"
  129. Else
  130. GraphicsWindow.Title = "Left button not pressed"
  131. EndIf
  132. EndSub
  133.  
  134. Network functions:
  135.  
  136. TextWindow.WriteLine(Network.GetWebPageContents("http://www.microsoft.com/"))
  137.  
  138. Program functions:
  139.  
  140. TextWindow.WriteLine(Program.Directory)
  141.  
  142. Sound functions:
  143.  
  144. Sound.PlayBellRingAndWait()
  145.  
  146. Stack:
  147.  
  148. Stack.PushValue("myStack", "myValue")
  149. TextWindow.WriteLine(Stack.PopValue("myStack"))
  150.  
  151. Text functions:
  152.  
  153. TextWindow.WriteLine(Text.GetLength("myText"))
  154.  
  155. Text window:
  156.  
  157. TextWindow.WriteLine("Hello, World!")
  158.  
  159. Timer:
  160.  
  161. Timer.Tick = OnTick
  162. Timer.Interval = 5000
  163.  
  164. Sub OnTick
  165. TextWindow.WriteLine(Clock.Time)
  166. EndSub
  167. Turtle:
  168.  
  169. Turtle.Move(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement