none
Is there a way to program an SB extension from within the program itself?

    Question

  • It would be a plus if I didn't have to install version 0.6 to do it. Right now, I have programmed this class of the extension called Music, and so far it has this code (requires the extension found at CodePlex):

    Sub stream
      streamfile = MessageBox.AskForInput("Enter music file to play, local files are allowed as well.")
      Sound.Play(streamfile)
    EndSub

    Sub holdstream
      Sound.Pause(streamfile)
    EndSub

    Sub resumestream
      Sound.Play(streamfile)
    EndSub

    Sub endstream
      Sound.Stop(streamfile)
    EndSub

    Saturday, March 03, 2012 1:18 AM

Answers

  • Uploaded on extension website here, in the 'Other Resource Downloads' section.  I added a simple test - The only syntax change I could remember was the square brackets for arrays and I also tries a recent new command (the sound music).  These work and are in a simple test case.  Report any other problems and good luck.
    Monday, April 09, 2012 5:08 PM
    Moderator
  • It works fine for me, try the following and report.

    1] Put ALL of the files in the zip in a new directory somewhere.

    2] run the SmallBasicExtensionCompiler.exe and browse for the file called Compile-Test.sb - this should create a file called Compile-Test.dll in the same directory.

    3] Now copy this Compile-Test.dll to the SB lib directory for extensions, open SmallBasic and run the file Compile-Run.sb

    Please state exactly what step didn't work.

    Monday, April 09, 2012 9:34 PM
    Moderator

All replies

  • Why do you have to use version 0.6?

    You can write an extension in VB or C# that uses another extension, but I don't think you can write an extension directly from SmallBasic using the current version.

    There have been some ideas on this in the past (e.g. here) but I don't think they are maintained and in any case it is probably easier to write an extension of the type you are writing in VB, and you get to learn VB at the same time.

    EDIT

    I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported.  It is possible to recompile his program for use in version 1.0, but you should get his permission to do this.  If you get his permission, I am happy to do the conversion.

    Saturday, March 03, 2012 4:36 PM
    Moderator
  • Writing an extension from smallbasic and for smallbasic is contradicting. Cause whatever you want to extend lets say I want to add music If I write the code in smallbasic then I can just do it basically using the same code. Sorry bad english
    Wednesday, April 04, 2012 12:25 AM
  • True, but you could effectively write libraries of useful functionality that you wouldn't need to copy into multiple programs.
    Wednesday, April 04, 2012 8:13 AM
    Moderator
  • Why do you have to use version 0.6?

    You can write an extension in VB or C# that uses another extension, but I don't think you can write an extension directly from SmallBasic using the current version.

    There have been some ideas on this in the past (e.g. here) but I don't think they are maintained and in any case it is probably easier to write an extension of the type you are writing in VB, and you get to learn VB at the same time.

    EDIT

    I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported.  It is possible to recompile his program for use in version 1.0, but you should get his permission to do this.  If you get his permission, I am happy to do the conversion.


    Do you happen to know his email?
    Thursday, April 05, 2012 8:43 PM
  • You can contact him I imagine via his SkyDrive account (follow links above), a little looking and his email is on his CV also posted on the SkyDrive.
    Thursday, April 05, 2012 9:49 PM
    Moderator
  • I contacted him, and he wrote that he never updated the compiler because he had to totally rewrite the code whenever a new SmallBasic version came out. He also said that if he can get the compiler's source code from Vijaye Raji (he now works for Facebook), he is OK to rewrite the compiler to work for this version of Small Basic. However, he doesn't want to work with a decompiled version of the compiler, as it takes too much time to start.

    Saturday, April 07, 2012 5:03 PM
  • I just recompiled his code and it works fine as far as I can see with version 1.0 - there may be specific issues, but generally looks OK.
    Sunday, April 08, 2012 4:12 PM
    Moderator
  • Do you have an online version that we can download to test it out?
    Sunday, April 08, 2012 8:18 PM
  • As I said in post 2:

    I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported.  It is possible to recompile his program for use in version 1.0, but you should get his permission to do this.  If you get his permission, I am happy to do the conversion.

    If you get permission from Fremy I will upload the conversion.

    Sunday, April 08, 2012 8:29 PM
    Moderator
  • I contacted Fremy, and he said that he will allow the upload. However, he also wrote that "Not all features of Small Basic will work the same way using that compiler than using the v1.0 compiler of Small Basic (even if you should get very close, since not a lot of compiler features were added between v0.6 and v1.0)."
    Monday, April 09, 2012 12:19 PM
  • Uploaded on extension website here, in the 'Other Resource Downloads' section.  I added a simple test - The only syntax change I could remember was the square brackets for arrays and I also tries a recent new command (the sound music).  These work and are in a simple test case.  Report any other problems and good luck.
    Monday, April 09, 2012 5:08 PM
    Moderator
  • The compiler doesn't work. I tried searching for the dll file(s) that were supposed to appear from the compiler, but no luck. :(
    Monday, April 09, 2012 9:25 PM
  • It works fine for me, try the following and report.

    1] Put ALL of the files in the zip in a new directory somewhere.

    2] run the SmallBasicExtensionCompiler.exe and browse for the file called Compile-Test.sb - this should create a file called Compile-Test.dll in the same directory.

    3] Now copy this Compile-Test.dll to the SB lib directory for extensions, open SmallBasic and run the file Compile-Run.sb

    Please state exactly what step didn't work.

    Monday, April 09, 2012 9:34 PM
    Moderator
  • Your program works, there is an error in my programming. Sorry to bug you about this.
    Monday, April 09, 2012 10:21 PM
  • Great, BTW the program is > 99.9% Fremy's work so you can thank him.
    Monday, April 09, 2012 10:28 PM
    Moderator