Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Boo Scripting Resource Thread

Discussion in 'Scripting' started by anothervenue, Jan 1, 2011.

  1. bizziboi

    bizziboi

    Joined:
    Feb 24, 2013
    Posts:
    18
    Hi,

    Just posted this in the scripting forum, but since here there are people that actually use Boo, maybe someone here has experience with this?....elsewhere the common reply is 'and this is why you want to use C#', but that's besides the point.

    I really want to mix languages, for the simple reason that Boo allows me to modify the compiler behaviour, so I really want to be able to use Boo.

    At the same time I want to call C# functions from Boo as it's only used as a compile-time scripting language.

    Of course, being in that capacity, Boo functions need to be called from C#, since my core code is C# as well.

    Is this setup even possible?
    I looked at the script compilation order page (http://docs.unity3d.com/Documentatio...erFolders.html - tip for Unity - don't move pages around between releases - it kills the usefulness of a forum. Every link in the forum about this points to a 404. Set up redirects when you must).

    I don't understand why I have to move files to 'plugins', or 'standard assets', that's just plain hacky, and it seems to me it can't solve circular references (which they really aren't, only in the way Unity handles things). Can't really put game scripts in the Editor directory, right, and I need a 3 step compilation.

    All the code cares about at that point is the interface. Can't the interfaces be parsed, a stub DLL generated, and then the rest filled in?
    Alternatively, couldn't the code at least be compiled to multiple DLL's with an advanced setting per script for the DLL to throw it in? I'm willing to handle that inconvenience to at least make it possible. Or a DLL per folder, whatever.

    It's kinda evil. Unite 2010 showed some great use for Boo, but in reality it's useless unless you go full Boo, which is hardly realistic in any real world production environment.

    Can *anyone* think of a solution for this? Preferrably one that doesn't kill workflow \
     
  2. Yoska

    Yoska

    Joined:
    Nov 14, 2012
    Posts:
    188
    Are there any good examples of how to sort lists in Boo? Boo.Codehaus.org has this:

    Code (csharp):
    1. //Sorting a list.  Only works if all the items are comparable
    2. //(all ints or strings for example)
    3. //or if you pass your own compare function.
    4. newlist =  [2, 4, 3, 5, 1]
    5. print newlist
    6. print newlist.Sort()
    7. result = newlist.Sort() do (left as int, right as int):
    8.     return right - left //reverse sort order
    9. print result
    And that's pretty much all I have found. I'm guessing there are more complex things you can do with sorting and those might be obvious to more seasoned programmers but I haven't been able to figure it out.

    Oh that Livity thing is cool.
     
    Last edited: Oct 14, 2013
  3. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322

    You can find the DLL on your machine, just copy it into your Unity project and you should be good to go. Note that you need the right version (mono ~2ish). For example, on my mac, it is at /Library/Frameworks/Mono.framework/Versions/2.10.10/lib/mono/boo/Boo.Lang.Interpreter.dll
     
  4. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    That's pretty much it. Passing in an arbitrary function for comparison gets you just about everything you could need, right?

    The return value is pretty standard: -1 for less than, 0 for equal, 1 for greater than.
     
  5. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    So this can be handled best by the Google Boo group.

    However, yes, you can integrate C# and Boo quite easily.

    Couple thoughts:

    1. The compilation order is important with Unity and there is no real way around that UNLESS you build your own DLL and put it into your Unity project. Which is easy. For myself, I have Boo code wherever, important C# code (that is, code I am going to use from Boo) in /Plugins, and stand-alone C# code wherever. It works fine.

    2. Oops, that was my only thought. There are easy solutions for what you're looking for. You can even hook into the Unity compilation process, I believe, if you want to have ot run some sort of build for your DLL.
     
  6. marciusoliveira

    marciusoliveira

    Joined:
    Mar 19, 2013
    Posts:
    3
    Boo is very pythonics, and its all I need know! tks for the materials
     
  7. cstaylor8311

    cstaylor8311

    Joined:
    Mar 11, 2013
    Posts:
    9
    As a python dev, I find boo to be fantastic! I still pimarily use c# these days though because monodevelops VI bindings are lacking, and thanks to Omnisharp using C# in gvim is pretty good.

    Has anyone run across anything like https://github.com/nosami/Omnisharp for boo? I've found some vim syntax highlighting on the codehaus github, but not much else.
     
  8. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    I've got a mode of sorts for Emacs if you wanted to use Evil (vim pseudo-emulator in Emacs).
     
  9. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    I have re-written the Emacs boo mode that I am currently using.

    You can get to it here: https://github.com/algoterranean/boo-mode

    It's very rudimentary but basic syntax highlighting and indentation is OK. Hopefully it will mature as the days pass.
     
  10. Taugeshtu

    Taugeshtu

    Joined:
    Apr 2, 2011
    Posts:
    21
    All right, I decided to give it a second shot, and here's what worked:
    1. Go to Boo repo on github;
    2. Grab the freshest Boo.Lang.Interpreter.dll from "bin" folder;
    3. Put it somewhere in your project;
    4. Include it in your file like this:
    Code (csharp):
    1. import Boo.Lang.Interpreter
    5. Then you're good to go with a following snippet:
    Code (csharp):
    1. jsonString = '{"y":8,"x":4}'
    2. interpreter = InteractiveInterpreter()
    3. interpreter.Declare( "zz", Hash )
    4. interpreter.Eval( "zz = "+jsonString )
    5. hash = interpreter.GetValue( "zz" ) cast Hash
    For some reason doing plain Eval didn't worked for me, maybe interpreter dropped context after evaluating it, but declaring variable foremost seems to make it consider it as belonging to global context.

    And here you go, JSON parsing in 5 lines of code.

    Yep, just tested it, lists inside JSON are parsed just as well. They get IEnumerable type or something like that (which doesn't really matter since we can easily just typecast it to whatever we need)
     
    Last edited: Apr 2, 2014
  11. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
  12. Taugeshtu

    Taugeshtu

    Joined:
    Apr 2, 2011
    Posts:
    21
    If you're using unity 5.0 and miss "create boo script" option, I've got somewhat working solution for you.
    Import the package into your project and you'll see "[New Boo class]" context menu option in Project View.
    Screenshot_1.png
    Something like this :)
    Also, you can use nice 'lil "Alt+B" shortcut.

    Note: it doesn't allow you to enter class/file name (haven't looked into it yet), and isn't placed in "Create" menu for prior-5.0 compatibility reasons.
    But hey, you won't have to copy-rename files directly anymore!

    Script template is in "BooBringer.boo" class, edit it to your likings.
     

    Attached Files:

    Last edited: Nov 8, 2014
    Pi_3-14 and ThievesofTime like this.
  13. UnitedBluff

    UnitedBluff

    Joined:
    Apr 19, 2015
    Posts:
    15
    I didn't know that Boo was still supported, but I'm glad it is. I prefer functional languages with nice syntax so I don't want to go back to primitive and ugly languages like C# and JS if I can avoid it.
    I don't understand why people don't use Boo. It 's SO much better.
    Anyway, just letting you and Unity know that we're (Boo users) still out there and new one are added once in while as well.
     
  14. basementApe

    basementApe

    Joined:
    Oct 2, 2013
    Posts:
    19
    I'd use it in a heartbeat if there was decent support for it. Javascript can be a pain and C# is just horrible.
     
  15. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    254
    It seems that the people in the google group boolang are having trouble contacting Rodrigo B. de Oliveira.
    To me it seems a little too dumb to be true.
    https://groups.google.com/forum/#!topic/boolang/iqRauhAPLGw

    Does anyone here have the capacity to contact him in a friendly way about this request?
    Boo should be allowed to live on, even though Rodrigo isn't currently very active.

    Having his blessing in an effort to bring the language forward is key. At least I think it is.
     
  16. Pi_3-14

    Pi_3-14

    Joined:
    May 9, 2012
    Posts:
    168
    #boo IRC channel (Freenode)

    A group of us are bringing the IRC channel to life.
    Rodrigo has taken ownership of the channel, so it is the official Boo IRC channel!

    Do join, everyone!

    @steinbitglis, Rodrigo is back in action, as can be seen from this post.
    He can (at time of writing) be found on #boo.

    @ErekT, there is currently decent support! Time to switch :)