locked
Small Basic Functions RRS feed

  • Question

  • 1) The introduction seems to assume that the student knows all of the functions available in Small Basic. is there a list of these available.
    2) Is it possible to reade and write files in Small Basic. I can't find any reference to files in the intro

    Saturday, November 28, 2009 3:37 PM

Answers

  • The thing to remember is this is an Alpha version so the notes will lag behind the software.  The key to finding what is available in terms of objects, function, etc is intellisence.  For example to find out which math functions are available type "math." then scroll through intellisense.

    File IO is available.  The key is the word FILE.

    Using this technique I have compiled the following list:
    (I also have updated my own version of the getting started notes which I don't mind sharing if some one can tell how to send it as a file.)

    Array.ContainsIndex
    Array.ContainsValue
    Array.GetAllIndices
    Array.GetItemCount
    Array.IsArray

    Clock.Date
    Clock.Day
    Clock.ElapsedMilliseconds
    Clock.Hour
    Clock.Millisecond
    Clock.Minute
    Clock.Month
    Clock.Second
    Clock.Time
    Clock.WeekDay
    Clock.Year

    Desktop.Height
    Desktop.SetWallPaper
    Desktop.Width

    Dictionary.GetDefinition
    Dictionary.GetDefinitionInFrench

    File.AppendContents
    File.CopyFile
    File.CreateDirectory
    File.DeleteDirectory
    File.DeleteFile
    File.GetDirectories
    File.GetSettingsFilePath
    File.GetTemporaryFilePath
    File.InsertLine
    File.LastError
    File.ReadContents
    File.ReadLine
    File.WriteContents
    File.WriteLine

    Flickr.GetPictureOfMoment
    Flickr.GetRandomPicture

    GraphicsWindow.BackgroundColor
    GraphicsWindow.BrushColor
    GraphicsWindow.CanResize
    GraphicsWindow.Clear
    GraphicsWindow.DrawBoundText
    GraphicsWindow.DrawEllipse
    GraphicsWindow.DrawImage
    GraphicsWindow.DrawLine
    GraphicsWindow.DrawRectangle
    GraphicsWindow.DrawResizedImage
    GraphicsWindow.DrawText
    GraphicsWindow.DrawTriangle
    GraphicsWindow.FillEllipse
    GraphicsWindow.FillRectangle
    GraphicsWindow.FillTriangle
    GraphicsWindow.FontBold
    GraphicsWindow.FontItalic
    GraphicsWindow.FontName
    GraphicsWindow.FontSize
    GraphicsWindow.GetColorFromRGB
    GraphicsWindow.GetPixel
    GraphicsWindow.GetRandomColor
    GraphicsWindow.Height
    GraphicsWindow.Hide
    GraphicsWindow.KeyDown
    GraphicsWindow.KeyUp
    GraphicsWindow.LastKey
    GraphicsWindow.LastText
    GraphicsWindow.Left
    GraphicsWindow.MouseDown
    GraphicsWindow.MouseMove
    GraphicsWindow.MouseUp
    GraphicsWindow.MouseX
    GraphicsWindow.MouseY
    GraphicsWindow.PenColor
    GraphicsWindow.PenWidth
    GraphicsWindow.SetPixel
    GraphicsWindow.Show
    GraphicsWindow.ShowMessage
    GraphicsWindow.TextInput
    GraphicsWindow.Title
    GraphicsWindow.Top
    GraphicsWindow.Width

    ImageList.GetHeightOfImage
    ImageList.GetWidthOfImage
    ImageList.LoadImage
    ImageList.

    Math.Abs
    Math.ArcCos
    Math.ArcSin
    Math.ArcTan
    Math.Ceiling
    Math.Cos
    Math.Floor
    Math.GetDegrees
    Math.GetRadians
    Math.GetRandomNumber
    Math.Log
    Math.Max
    Math.Min
    Math.NaturalLog
    Math.Pi
    Math.Power
    Math.Remainder
    Math.Round
    Math.Sin
    Math.SquareRoot
    Math.Tan

    Mouse.HideCursor
    Mouse.IsLeftButtonDown
    Mouse.IsRightButtonDown
    Mouse.MouseX
    Mouse.MouseY
    Mouse.ShowCursor

    Network.DownloadFile
    Network.GetWebPageContents

    Program.ArgumentCount
    Program.Delay
    Program.Directory
    Program.End
    Program.GetArgument

    Shapes.AddEllipse
    Shapes.AddEllipse
    Shapes.AddImage
    Shapes.AddLine
    Shapes.AddRectangle
    Shapes.AddTriangle
    Shapes.Animate
    Shapes.GetLeft
    Shapes.GetOpacity
    Shapes.GetTop
    Shapes.HideShape
    Shapes.Move
    Shapes.Remove
    Shapes.Rotate
    Shapes.SetOpacity
    Shapes.ShowShape
    Shapes.Zoom

    Sound.Pause
    Sound.Play
    Sound.PlayAndWait
    Sound.PlayBellRing
    Sound.PlayBellRingAndWait
    Sound.PlayChime
    Sound.PlayChimeAndWait
    Sound.PlayChimes
    Sound.PlayChimesAndWait
    Sound.PlayClick
    Sound.PlayClickAndWait
    Sound.Stop

    Stack.GetCount
    Stack.PopValue
    Stack.PushValue

    Text.Append
    Text.ConvertToLowerCase
    Text.ConvertToUpperCase
    Text.EndsWith
    Text.GetCharacter
    Text.GetCharacterCode
    Text.GetIndexOf
    Text.GetLength
    Text.GetSubText
    Text.GetSubTextToEnd
    Text.IsSubText
    Text.StartsWith
    Text.

    TextWindow.BackgroundColor
    TextWindow.Clear
    TextWindow.CursorLeft
    TextWindow.CursorTop
    TextWindow.ForegroundColor
    TextWindow.Hide
    TextWindow.Left
    TextWindow.Pause
    TextWindow.PauseIfVisible
    TextWindow.PauseWithoutMessage
    TextWindow.Read
    TextWindow.ReadNumber
    TextWindow.Show
    TextWindow.Title
    TextWindow.Top
    TextWindow.Write
    TextWindow.WriteLine

    Turtle.Angle
    Turtle.Hide
    Turtle.Move
    Turtle.MoveTo
    Turtle.PenDown
    Turtle.PenUp
    Turtle.Show
    Turtle.Speed
    Turtle.Turn
    Turtle.TurnLeft
    Turtle.TurnRight
    Turtle.X
    Turtle.Y

    Timer.Interval
    Timer.Pause
    Timer.Resume
    Timer.Tick
    Timer.


    While
     
    EndWhile

    For
      Goto
      If
       
      Else
        EndFor
      EndIf
     

    • Marked as answer by Vijaye Raji Monday, November 30, 2009 6:41 PM
    Saturday, November 28, 2009 8:22 PM

All replies

  • The thing to remember is this is an Alpha version so the notes will lag behind the software.  The key to finding what is available in terms of objects, function, etc is intellisence.  For example to find out which math functions are available type "math." then scroll through intellisense.

    File IO is available.  The key is the word FILE.

    Using this technique I have compiled the following list:
    (I also have updated my own version of the getting started notes which I don't mind sharing if some one can tell how to send it as a file.)

    Array.ContainsIndex
    Array.ContainsValue
    Array.GetAllIndices
    Array.GetItemCount
    Array.IsArray

    Clock.Date
    Clock.Day
    Clock.ElapsedMilliseconds
    Clock.Hour
    Clock.Millisecond
    Clock.Minute
    Clock.Month
    Clock.Second
    Clock.Time
    Clock.WeekDay
    Clock.Year

    Desktop.Height
    Desktop.SetWallPaper
    Desktop.Width

    Dictionary.GetDefinition
    Dictionary.GetDefinitionInFrench

    File.AppendContents
    File.CopyFile
    File.CreateDirectory
    File.DeleteDirectory
    File.DeleteFile
    File.GetDirectories
    File.GetSettingsFilePath
    File.GetTemporaryFilePath
    File.InsertLine
    File.LastError
    File.ReadContents
    File.ReadLine
    File.WriteContents
    File.WriteLine

    Flickr.GetPictureOfMoment
    Flickr.GetRandomPicture

    GraphicsWindow.BackgroundColor
    GraphicsWindow.BrushColor
    GraphicsWindow.CanResize
    GraphicsWindow.Clear
    GraphicsWindow.DrawBoundText
    GraphicsWindow.DrawEllipse
    GraphicsWindow.DrawImage
    GraphicsWindow.DrawLine
    GraphicsWindow.DrawRectangle
    GraphicsWindow.DrawResizedImage
    GraphicsWindow.DrawText
    GraphicsWindow.DrawTriangle
    GraphicsWindow.FillEllipse
    GraphicsWindow.FillRectangle
    GraphicsWindow.FillTriangle
    GraphicsWindow.FontBold
    GraphicsWindow.FontItalic
    GraphicsWindow.FontName
    GraphicsWindow.FontSize
    GraphicsWindow.GetColorFromRGB
    GraphicsWindow.GetPixel
    GraphicsWindow.GetRandomColor
    GraphicsWindow.Height
    GraphicsWindow.Hide
    GraphicsWindow.KeyDown
    GraphicsWindow.KeyUp
    GraphicsWindow.LastKey
    GraphicsWindow.LastText
    GraphicsWindow.Left
    GraphicsWindow.MouseDown
    GraphicsWindow.MouseMove
    GraphicsWindow.MouseUp
    GraphicsWindow.MouseX
    GraphicsWindow.MouseY
    GraphicsWindow.PenColor
    GraphicsWindow.PenWidth
    GraphicsWindow.SetPixel
    GraphicsWindow.Show
    GraphicsWindow.ShowMessage
    GraphicsWindow.TextInput
    GraphicsWindow.Title
    GraphicsWindow.Top
    GraphicsWindow.Width

    ImageList.GetHeightOfImage
    ImageList.GetWidthOfImage
    ImageList.LoadImage
    ImageList.

    Math.Abs
    Math.ArcCos
    Math.ArcSin
    Math.ArcTan
    Math.Ceiling
    Math.Cos
    Math.Floor
    Math.GetDegrees
    Math.GetRadians
    Math.GetRandomNumber
    Math.Log
    Math.Max
    Math.Min
    Math.NaturalLog
    Math.Pi
    Math.Power
    Math.Remainder
    Math.Round
    Math.Sin
    Math.SquareRoot
    Math.Tan

    Mouse.HideCursor
    Mouse.IsLeftButtonDown
    Mouse.IsRightButtonDown
    Mouse.MouseX
    Mouse.MouseY
    Mouse.ShowCursor

    Network.DownloadFile
    Network.GetWebPageContents

    Program.ArgumentCount
    Program.Delay
    Program.Directory
    Program.End
    Program.GetArgument

    Shapes.AddEllipse
    Shapes.AddEllipse
    Shapes.AddImage
    Shapes.AddLine
    Shapes.AddRectangle
    Shapes.AddTriangle
    Shapes.Animate
    Shapes.GetLeft
    Shapes.GetOpacity
    Shapes.GetTop
    Shapes.HideShape
    Shapes.Move
    Shapes.Remove
    Shapes.Rotate
    Shapes.SetOpacity
    Shapes.ShowShape
    Shapes.Zoom

    Sound.Pause
    Sound.Play
    Sound.PlayAndWait
    Sound.PlayBellRing
    Sound.PlayBellRingAndWait
    Sound.PlayChime
    Sound.PlayChimeAndWait
    Sound.PlayChimes
    Sound.PlayChimesAndWait
    Sound.PlayClick
    Sound.PlayClickAndWait
    Sound.Stop

    Stack.GetCount
    Stack.PopValue
    Stack.PushValue

    Text.Append
    Text.ConvertToLowerCase
    Text.ConvertToUpperCase
    Text.EndsWith
    Text.GetCharacter
    Text.GetCharacterCode
    Text.GetIndexOf
    Text.GetLength
    Text.GetSubText
    Text.GetSubTextToEnd
    Text.IsSubText
    Text.StartsWith
    Text.

    TextWindow.BackgroundColor
    TextWindow.Clear
    TextWindow.CursorLeft
    TextWindow.CursorTop
    TextWindow.ForegroundColor
    TextWindow.Hide
    TextWindow.Left
    TextWindow.Pause
    TextWindow.PauseIfVisible
    TextWindow.PauseWithoutMessage
    TextWindow.Read
    TextWindow.ReadNumber
    TextWindow.Show
    TextWindow.Title
    TextWindow.Top
    TextWindow.Write
    TextWindow.WriteLine

    Turtle.Angle
    Turtle.Hide
    Turtle.Move
    Turtle.MoveTo
    Turtle.PenDown
    Turtle.PenUp
    Turtle.Show
    Turtle.Speed
    Turtle.Turn
    Turtle.TurnLeft
    Turtle.TurnRight
    Turtle.X
    Turtle.Y

    Timer.Interval
    Timer.Pause
    Timer.Resume
    Timer.Tick
    Timer.


    While
     
    EndWhile

    For
      Goto
      If
       
      Else
        EndFor
      EndIf
     

    • Marked as answer by Vijaye Raji Monday, November 30, 2009 6:41 PM
    Saturday, November 28, 2009 8:22 PM
  • Having all the functions available in a single list is great. Howver, I can't get anything more than the first page to print. Any ideas?
    Monday, November 30, 2009 3:00 PM
  • Try copy / paste into a wordpad or notepad document. I know using Word works fine!
    Monday, November 30, 2009 3:55 PM
  • A good reference for SmallBasic statements and functions may be found on-line here:

    http://smallbasic.com/smallbasic.com/doc/

    It is not easy to print, however, so I copied the information, reformatted it, made a PDF file and posted it here:

    http://tinyurl.com/ydrtbgr

    Jim Stubchaer
    Tuesday, December 1, 2009 7:31 PM
  • thanks Jim, that file is great and very helpful.
    any idea where to find a compilation (or library) of sb sample codes, something more helpful than the cryptic server at msdn? i need to get up to full speed in about 1 or 2 days.  the import button is fantastic, but one has to actively follow the forum to know which codes are being posted.  for me it would be so much better to be able to search for a code when i have a purpose in mind!
    --olden

    ps/simple basic is a savior for me at this time...  i stopped writing scientific code for a living 20 yrs ago (in fortran 90; structured pascal; early C; plc; ibm assembly;  etc.) but this is a new world, like having been in a coma and awakening into a different century--literally. i'm now putting together a few intro lectures in molecular modelling for freshmen;  small basic or visual basic would be ideal for the model input/output/visualization functions. somehow i need to link my c/fortran object codes and perhaps there are examples out there... 
    Thursday, February 11, 2010 3:06 AM
  • You can still buy fortran compilers.  If you're talking 'link' like I think you are, there's probably no way linking old object files would work with modern compilers output, especially .net. 

    I wouldn't teach fortran, I think it's pretty dead.  Maybe you just wanted to convert the source over?

    BTW I couldn't get smallbasic to deal with large numbers, and don't think it understands scientific notation either.  Maybe that'll change someday (hopefully).  You also dont get to pass/return variables to functions.
    Thursday, February 11, 2010 8:20 PM
  • What is your issue?  Perhaps it is the original post of this thred by Davcidw147?, perhaps it is something to do with getting a printable version of SmallBasic API? 

    If it is question 1 then, Yes, SmallBasic can read and write files, look at the File options - the way to check it out is have a go - any questions on its use can be asked on this forum.

    If it is questions 2, then there are several printable API's about, heres one .

    Assuming question 1, then here is a simple example writing and reading a simple array to a file (there are many others, but without knowing what you want to do its hard to know what  to say other than the commands do what they say they do and therefore play with them).

    Sorry if this isn't your issue, if not you will have to be clearer.

    Start:

    TextWindow.Clear()
    TextWindow.WriteLine("Save (s) or Read (r) the data?")

    'Wait for a valid input
    input = ""
    While (input <> "r" And input <> "s")
      input = Text.ConvertToLowerCase(TextWindow.Read())
    EndWhile

    fileName = Program.Directory+"\test.txt" 'Save the file somewhere to use the Program.Directory feature effectively

    data = "" 'Clear data
    If (input = "r") Then
      data = File.ReadLine(fileName,1)
      TextWindow.WriteLine("Data read from "+fileName)
    Else
      'Create some data in an array
      For i = 1 To 10
        data[i] = i*10
      EndFor
      File.WriteLine(fileName,1,data)
      TextWindow.WriteLine("Data writtin to "+fileName)
    EndIf
    If (data = "") Then
      TextWindow.WriteLine("There is no data")
    Else
      TextWindow.WriteLine("This is the data")
      For i = 1 To Array.GetItemCount(data)
        TextWindow.WriteLine(i+ " : "+data[i])
      EndFor
    EndIf

    TextWindow.Pause()
    Goto Start

    Saturday, October 9, 2010 11:01 PM